Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: planetfall on March 07, 2014, 10:29:00 PM

Title: Bug with SetDigitalisRaw (and confusing behavior for SetDigitalis)
Post by: planetfall on March 07, 2014, 10:29:00 PM
If I set the digitalis to 0, the cell no longer becomes able to contain digitalis. It still shows up as growth area, but no digitalis will grow onto it. Calling x y 1 SetDigitalisGrowth on the cell afterwards doesn't fix the problem. I'm using game version 1.82. (EDIT: updated to 1.87 and bug is still present.)

...looking back at the old update logs, I see this is a "feature" for SetDigitalis, but apparently not for SetDigitalisRaw, which nonetheless has the same effect.

What, exactly, is the rationale behind this, then?
Title: Re: Bug with SetDigitalisRaw (and confusing behavior for SetDigitalis)
Post by: knucracker on March 16, 2014, 03:02:34 PM
The digitalis data structure is a little hard to interpret.  I used a single int in the digitalis array to encode different state information.  Internally a negative value in the digitalis array means that the cell is "growing".  The growth rate is 20000 per frame.  Growth means that the cell is charging up and on it's way to becoming a cell with digitalis in it.  Once the value climbs up to 0, the cell's value will suddenly get set to the max health from Digitalis, which is 1000000.

So positive values are the health of digitalis and negative values are the growth value.  That's how it works internally.
The SetDigitalisRaw call lets you set the raw digitalis cell value to some int.  The SetDigitalis call was supposed to hide these internal details.  You pass in a float 0-1 to determine the health (0 to 1000000 interally).  A negative value simple means to set the cell to -1000000.