Teleporters with an actor on them are blocked
This commit is contained in:
parent
2dc18a98db
commit
ad615e5caf
@ -822,9 +822,15 @@ export class Level {
|
|||||||
// Handle teleporting, now that the dust has cleared
|
// Handle teleporting, now that the dust has cleared
|
||||||
// FIXME something funny happening here, your input isn't ignore while walking out of it?
|
// FIXME something funny happening here, your input isn't ignore while walking out of it?
|
||||||
if (teleporter) {
|
if (teleporter) {
|
||||||
let goal = teleporter.connection;
|
let goal = teleporter;
|
||||||
// TODO in pathological cases this might infinite loop
|
// TODO in pathological cases this might infinite loop
|
||||||
while (true) {
|
while (true) {
|
||||||
|
goal = goal.connection;
|
||||||
|
|
||||||
|
// Teleporters already containing an actor are blocked and unusable
|
||||||
|
if (goal.cell.some(tile => tile.type.is_actor && tile !== actor))
|
||||||
|
continue;
|
||||||
|
|
||||||
// Physically move the actor to the new teleporter
|
// Physically move the actor to the new teleporter
|
||||||
// XXX is this right, compare with tile world? i overhear it's actually implemented as a slide?
|
// XXX is this right, compare with tile world? i overhear it's actually implemented as a slide?
|
||||||
// XXX not especially undo-efficient
|
// XXX not especially undo-efficient
|
||||||
@ -839,7 +845,6 @@ export class Level {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Otherwise, try the next one
|
// Otherwise, try the next one
|
||||||
goal = goal.connection;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user