Allow some entities to be crushed, to prevent them blocking lifts, etc.

This commit is contained in:
Steve 2018-03-04 13:36:00 +00:00
parent 95a4131a99
commit 934dd431aa
5 changed files with 9 additions and 3 deletions

View File

@ -142,6 +142,7 @@ enum
#define EF_NO_TELEPORT (2 << 17) #define EF_NO_TELEPORT (2 << 17)
#define EF_NO_OBSERVE (2 << 18) #define EF_NO_OBSERVE (2 << 18)
#define EF_BULLET_HIT (2 << 19) #define EF_BULLET_HIT (2 << 19)
#define EF_CRUSHABLE (2 << 20)
#define GRAVITY_POWER 0.5f #define GRAVITY_POWER 0.5f
#define FRICTION 0.75f #define FRICTION 0.75f

View File

@ -34,7 +34,7 @@ void initDebris(Decoration *d)
d->spriteFrame = 0; d->spriteFrame = 0;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT | EF_CRUSHABLE;
d->tick = tick; d->tick = tick;
d->action = action; d->action = action;

View File

@ -30,7 +30,7 @@ void initFleshChunk(Decoration *d)
d->type = ET_DECORATION; d->type = ET_DECORATION;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT | EF_CRUSHABLE;
d->bleedTime = FPS * 3; d->bleedTime = FPS * 3;

View File

@ -34,7 +34,7 @@ Item *initConsumable(void)
i->type = ET_CONSUMABLE; i->type = ET_CONSUMABLE;
i->flags |= EF_IGNORE_BULLETS; i->flags |= EF_IGNORE_BULLETS | EF_CRUSHABLE;
i->health = FPS * 10; i->health = FPS * 10;

View File

@ -257,6 +257,11 @@ void doEntities(void)
if (!pushEntity(e, 0, e->riding->dy)) if (!pushEntity(e, 0, e->riding->dy))
{ {
e->riding->y -= e->riding->dy; e->riding->y -= e->riding->dy;
if (e->flags & EF_CRUSHABLE)
{
e->health--;
}
} }
e->y = e->riding->y - e->h; e->y = e->riding->y - e->h;