Add two new properties for CLNE-like elements

the thing CLNE does, drawing upon it will set ctype; and what BCLN  does to CLNE - disables #1). Made use of the two new properties
This commit is contained in:
jacob1 2013-06-10 10:51:55 -04:00
parent 52ec8f438b
commit b699bb176f
12 changed files with 41 additions and 39 deletions

View File

@ -1737,6 +1737,8 @@ void LuaScriptInterface::initElementsAPI()
SETCONST(l, PROP_LIFE_KILL_DEC);
SETCONST(l, PROP_SPARKSETTLE);
SETCONST(l, PROP_NOAMBHEAT);
SETCONST(l, PROP_DRAWONCTYPE);
SETCONST(l, PROP_NOCTYPEDRAW);
SETCONST(l, FLAG_STAGNANT);
SETCONST(l, FLAG_SKIPMOVE);
SETCONST(l, FLAG_MOVABLE);

View File

@ -10,25 +10,27 @@
#define O_MAX_TEMP 3500
#define O_MIN_TEMP -273
#define TYPE_PART 0x00001 //1 Powders
#define TYPE_LIQUID 0x00002 //2 Liquids
#define TYPE_SOLID 0x00004 //4 Solids
#define TYPE_GAS 0x00008 //8 Gasses (Includes plasma)
#define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
#define PROP_CONDUCTS 0x00020 //32 Conducts electricity
#define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
#define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons
#define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default
#define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass
#define PROP_DEADLY 0x00400 //1024 Is deadly for stickman
#define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow
#define PROP_LIFE 0x01000 //4096 Is a GoL type
#define PROP_RADIOACTIVE 0x02000 //8192 Radioactive
#define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero
#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
#define TYPE_PART 0x00001 //1 Powders
#define TYPE_LIQUID 0x00002 //2 Liquids
#define TYPE_SOLID 0x00004 //4 Solids
#define TYPE_GAS 0x00008 //8 Gasses (Includes plasma)
#define TYPE_ENERGY 0x00010 //16 Energy (Thunder, Light, Neutrons etc.)
#define PROP_CONDUCTS 0x00020 //32 Conducts electricity
#define PROP_BLACK 0x00040 //64 Absorbs Photons (not currently implemented or used, a photwl attribute might be better)
#define PROP_NEUTPENETRATE 0x00080 //128 Penetrated by neutrons
#define PROP_NEUTABSORB 0x00100 //256 Absorbs neutrons, reflect is default
#define PROP_NEUTPASS 0x00200 //512 Neutrons pass through, such as with glass
#define PROP_DEADLY 0x00400 //1024 Is deadly for stickman
#define PROP_HOT_GLOW 0x00800 //2048 Hot Metal Glow
#define PROP_LIFE 0x01000 //4096 Is a GoL type
#define PROP_RADIOACTIVE 0x02000 //8192 Radioactive
#define PROP_LIFE_DEC 0x04000 //2^14 Life decreases by one every frame if > zero
#define PROP_LIFE_KILL 0x08000 //2^15 Kill when life value is <= zero
#define PROP_LIFE_KILL_DEC 0x10000 //2^16 Kill when life value is decremented to <= zero
#define PROP_SPARKSETTLE 0x20000 //2^17 Allow Sparks/Embers to settle
#define PROP_NOAMBHEAT 0x40000 //2^18 Don't transfer or receive heat from ambient heat.
#define PROP_DRAWONCTYPE 0x80000 //2^19 Set its ctype to another element if the element is drawn upon it (like what CLNE does)
#define PROP_NOCTYPEDRAW 0x100000 // 2^20 When this element is drawn upon with, do not set ctype (like BCLN for CLNE)
#define FLAG_STAGNANT 0x1
#define FLAG_SKIPMOVE 0x2 // skip movement for one frame, only implemented for PHOT

View File

@ -2033,6 +2033,7 @@ void Simulation::init_can_move()
}
}
//a list of lots of things PHOT can move through
// TODO: replace with property
for (movingType = 0; movingType < PT_NUM; movingType++)
{
if (movingType == PT_GLAS || movingType == PT_PHOT || movingType == PT_FILT || movingType == PT_INVIS
@ -2721,20 +2722,17 @@ int Simulation::create_part(int p, int x, int y, int tv)
{
if (pmap[y][x])
{
//If an element has the PROP_DRAWONCTYPE property, and the element being drawn to it does not have PROP_NOCTYPEDRAW (Also some special cases), set the element's ctype
int drawOn = pmap[y][x]&0xFF;
if ((
(drawOn == PT_STOR && !(elements[t].Properties&TYPE_SOLID)) ||
drawOn==PT_CLNE ||
drawOn==PT_BCLN ||
drawOn==PT_CONV ||
(drawOn==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN) ||
(drawOn==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
)&&(
t != PT_CLNE && t != PT_PCLN && t != PT_BCLN && t != PT_STKM && t != PT_STKM2 && t != PT_PBCN && t != PT_STOR && t != PT_FIGH && t != PT_CONV)
)
if (((elements[drawOn].Properties & PROP_DRAWONCTYPE) ||
(drawOn == PT_STOR && !(elements[t].Properties & TYPE_SOLID)) ||
(drawOn == PT_PCLN && t != PT_PSCN && t != PT_NSCN) ||
(drawOn == PT_PBCN && t != PT_PSCN && t != PT_NSCN))
&& (!(elements[t].Properties & PROP_NOCTYPEDRAW)))
{
parts[pmap[y][x]>>8].ctype = t;
if (t == PT_LIFE && v < NGOL && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
if (t == PT_LIFE && v < NGOL && drawOn != PT_STOR)
parts[pmap[y][x]>>8].tmp = v;
}
else if ((drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME)) && drawOn != t)
{

View File

@ -31,7 +31,7 @@ Element_BCLN::Element_BCLN()
Description = "Breakable Clone.";
State = ST_NONE;
Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC;
Properties = TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_CLNE::Element_CLNE()
Description = "Solid. Duplicates any particles it touches.";
State = ST_SOLID;
Properties = TYPE_SOLID;
Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_CONV::Element_CONV()
Description = "Solid. Converts everything into whatever it first touches.";
State = ST_NONE;
Properties = TYPE_SOLID;
Properties = TYPE_SOLID|PROP_DRAWONCTYPE|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_FIGH::Element_FIGH()
Description = "Fighter. Tries to kill stickmen. You must first give it an element to kill him with.";
State = ST_NONE;
Properties = 0;
Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_PBCN::Element_PBCN()
Description = "Powered breakable clone.";
State = ST_NONE;
Properties = TYPE_SOLID;
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_PCLN::Element_PCLN()
Description = "Powered clone. When activated, duplicates any particles it touches.";
State = ST_NONE;
Properties = TYPE_SOLID;
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_STKM::Element_STKM()
Description = "Stickman. Don't kill him! Control with the arrow keys.";
State = ST_NONE;
Properties = 0;
Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_STKM2::Element_STKM2()
Description = "Second stickman. Don't kill him! Control with wasd.";
State = ST_NONE;
Properties = 0;
Properties = PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;

View File

@ -31,7 +31,7 @@ Element_STOR::Element_STOR()
Description = "Captures and stores a single particle. releases when charged with PSCN, also passes to PIPE.";
State = ST_NONE;
Properties = TYPE_SOLID;
Properties = TYPE_SOLID|PROP_NOCTYPEDRAW;
LowPressure = IPL;
LowPressureTransition = NT;