Implement PROP_NEUTABSORB

This commit is contained in:
jacksonmj 2012-01-15 21:54:31 +08:00 committed by Simon Robertshaw
parent 16ea042bab
commit bdf277e687
2 changed files with 9 additions and 2 deletions

View File

@ -237,9 +237,9 @@
#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 (not currently implemented or used)
#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 (not currently implemented or used)
#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

View File

@ -94,6 +94,8 @@ void init_can_move()
if (ptypes[t].weight <= ptypes[rt].weight) can_move[t][rt] = 0;
if (t==PT_NEUT && ptypes[rt].properties&PROP_NEUTPASS)
can_move[t][rt] = 2;
if (t==PT_NEUT && ptypes[rt].properties&PROP_NEUTABSORB)
can_move[t][rt] = 1;
if (t==PT_NEUT && ptypes[rt].properties&PROP_NEUTPENETRATE)
can_move[t][rt] = 1;
if (ptypes[t].properties&PROP_NEUTPENETRATE && rt==PT_NEUT)
@ -313,6 +315,11 @@ int try_move(int i, int x, int y, int nx, int ny)
}
//else e=1 , we are trying to swap the particles, return 0 no swap/move, 1 is still overlap/move, because the swap takes place later
if (parts[i].type==PT_NEUT && (ptypes[r&0xFF].properties&PROP_NEUTABSORB))
{
parts[i].type=PT_NONE;
return 0;
}
if ((r&0xFF)==PT_VOID || (r&0xFF)==PT_PVOD) //this is where void eats particles
{
if (parts[i].type == PT_STKM)