Fix wiring order; relax player/monster collision

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-12 21:00:28 -07:00
parent f95913b6d8
commit bd4c04c1d8

View File

@ -500,8 +500,6 @@ export class Level {
} }
// Used for various tic-local effects; don't need to be undoable // Used for various tic-local effects; don't need to be undoable
// Used to check for a monster chomping the player's tail
this.player_leaving_cell = this.player.cell;
// TODO maybe this should be undone anyway so rewind looks better? // TODO maybe this should be undone anyway so rewind looks better?
this.player.is_blocked = false; this.player.is_blocked = false;
@ -547,12 +545,6 @@ export class Level {
} }
} }
} }
// Handle wiring, now that a bunch of buttons may have been pressed. Do it three times,
// because CC2 runs it once per frame, not once per tic
this.update_wiring();
this.update_wiring();
this.update_wiring();
} }
finish_tic(p1_actions) { finish_tic(p1_actions) {
@ -675,6 +667,8 @@ export class Level {
if (! dest_cell) if (! dest_cell)
continue; continue;
// FIXME it looks like cc2 actually starts pushing blocks here
// FIXME similarly, if the player steps into a monster cell here, they die instantly
if (! actor.cell.blocks_leaving(actor, direction) && if (! actor.cell.blocks_leaving(actor, direction) &&
! dest_cell.blocks_entering(actor, direction, this, true)) ! dest_cell.blocks_entering(actor, direction, this, true))
{ {
@ -754,6 +748,12 @@ export class Level {
this.remember_player_move(this.player.direction); this.remember_player_move(this.player.direction);
} }
// Handle wiring, now that a bunch of buttons may have been pressed. Do it three times,
// because CC2 runs it once per frame, not once per tic
this.update_wiring();
this.update_wiring();
this.update_wiring();
// Strip out any destroyed actors from the acting order // Strip out any destroyed actors from the acting order
// FIXME this is O(n), where n is /usually/ small, but i still don't love it. not strictly // FIXME this is O(n), where n is /usually/ small, but i still don't love it. not strictly
// necessary, either; maybe only do it every few tics? // necessary, either; maybe only do it every few tics?
@ -979,10 +979,13 @@ export class Level {
} }
} }
// If we're stepping directly on the player, that kills them too // If we're stepping directly on the player, that kills them too; the player and a monster
// TODO this only works because i have the player move first; in lynx the check is the other // must be at least 5 tics apart
// way around // TODO the rules in lynx might be slightly different?
if (actor.type.is_monster && goal_cell === this.player_leaving_cell) { if (actor.type.is_monster && goal_cell === this.player.previous_cell &&
// Player has decided to leave their cell, but hasn't actually taken a step yet
this.player.movement_cooldown === this.player.movement_speed)
{
this.fail(actor.type.name); this.fail(actor.type.name);
} }