Kill debris if it falls into liquid.

This commit is contained in:
Steve 2018-03-23 08:05:41 +00:00
parent 290613612e
commit 6044cbf957
1 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void tick(void);
static void action(void);
static void touch(Entity *other);
static void changeEnvironment(void);
void initDebris(Decoration *d)
{
@ -39,6 +40,7 @@ void initDebris(Decoration *d)
d->tick = tick;
d->action = action;
d->touch = touch;
d->changeEnvironment = changeEnvironment;
}
static void tick(void)
@ -75,3 +77,18 @@ static void touch(Entity *other)
d->dx *= 0.9;
}
}
static void changeEnvironment(void)
{
switch (self->environment)
{
case ENV_LAVA:
case ENV_SLIME:
case ENV_WATER:
self->alive = ALIVE_DEAD;
break;
default:
break;
}
}