Restore the notion of an out-of-turn move
This fixes a lot of replay sync issues with cloners; in CC2, actors advance only one frame (1/3 tic) at a time, so when a cloned object happens to get a turn later in the same tic that it was cloned, it only ends up 1 frame ahead of everything else. Since actors can only begin moves on tic-aligned frames, even though it does get where it was going sooner, it has to wait for a frame before moving, so the advantage doesn't change anything. The problem is that LL counts movement in tics, not frames, so that kind of bonus turn puts the clone an entire tic ahead which can gum things up. This is still not perfect, but it's much closer.
This commit is contained in:
parent
beb5a5c743
commit
efd25294ac
10
js/game.js
10
js/game.js
@ -564,7 +564,7 @@ export class Level {
|
|||||||
if (! actor.cell)
|
if (! actor.cell)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (actor.movement_cooldown > 0) {
|
if (actor.movement_cooldown > 0 && actor.cooldown_delay_tic !== this.tic_counter) {
|
||||||
this._set_tile_prop(actor, 'movement_cooldown', Math.max(0, actor.movement_cooldown - 1));
|
this._set_tile_prop(actor, 'movement_cooldown', Math.max(0, actor.movement_cooldown - 1));
|
||||||
|
|
||||||
if (actor.movement_cooldown <= 0) {
|
if (actor.movement_cooldown <= 0) {
|
||||||
@ -1078,7 +1078,13 @@ export class Level {
|
|||||||
|
|
||||||
// FIXME delete this
|
// FIXME delete this
|
||||||
attempt_out_of_turn_step(actor, direction) {
|
attempt_out_of_turn_step(actor, direction) {
|
||||||
return this.attempt_step(actor, direction);
|
if (this.attempt_step(actor, direction)) {
|
||||||
|
this._set_tile_prop(actor, 'cooldown_delay_tic', this.tic_counter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the given actor to the given position and perform any appropriate
|
// Move the given actor to the given position and perform any appropriate
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user