User Tools

Site Tools


crpl:docs:setdigitalis

This is an old revision of the document!


<- CRPL reference <- Digitalis Commands

SetDigitalis

ArgumentsResultNotation
X, Y, Amt x1 y1 f1 –

Description

Sets Amt of Digitalis at coordinates. An Amt of 1 means full health Digitalis, and 0 means no Digitalis.

Emulating the in game weapons

WeaponRadiusAmount
Blaster1.52
Mortar3.52
Strafer2.35
Bertha10.7

Note: blasters will not injure digitalis that is uphill ever.

#This function takes four arguments, a centre, then a range, then an amount.
:damageDigitalis
  #Load up the arguments.
  ->amount ->r ->y0 ->x0
  #Optimization: precalculate r^2.
  <-r dup mul ->r2
  #Consider a radius shaped box about the origin.
  <-r 1 add 0 <-r sub do
    <-r 1 add 0 <-r sub do
      #Cull squares in the box not in the circle.
      I dup mul j dup mul add <-r2 lte if
        #Translate to our site of action.
        I <-x0 add J <-x0 add dup2
            #DAMAGE!
            GetDigitalis <-amount sub SetDigitalis          
      endif
    Loop
  Loop

Examples

  • Lay down Digitalis on 3×3 grid under a unit

    The reason for the 2 is that the limit is one more than the loop iterates through. So, “3 0 do loop” goes through the values 0,1,2… but not three. Using these limits will make your walker lay down a 3×3 grid of Digitalis.

    CurrentY 2 add CurrentY 1 sub do
      CurrentX 2 add CurrentX 1 sub do
        I J true SetDigitalisGrowth
        I J 1 SetDigitalis
      Loop
    Loop
    
crpl/docs/setdigitalis.1427438063.txt.gz · Last modified: 2015/03/27 02:34 by warren