Disallow taking yellow teleporters if the level only started with one (fixes #30)
This commit is contained in:
parent
c7012f2565
commit
54d38527f2
15
js/game.js
15
js/game.js
@ -464,6 +464,9 @@ export class Level extends LevelInterface {
|
|||||||
let n = 0;
|
let n = 0;
|
||||||
let connectables = [];
|
let connectables = [];
|
||||||
this.remaining_players = 0;
|
this.remaining_players = 0;
|
||||||
|
// If there's exactly one yellow teleporter when the level loads, it cannot be picked up
|
||||||
|
let yellow_teleporter_count = 0;
|
||||||
|
this.allow_taking_yellow_teleporters = false;
|
||||||
// Speedup for flame jets, which aren't actors but do a thing every tic
|
// Speedup for flame jets, which aren't actors but do a thing every tic
|
||||||
// TODO this won't notice if a new tile with an on_tic is created, but that's impossible
|
// TODO this won't notice if a new tile with an on_tic is created, but that's impossible
|
||||||
// atm... or, at least, it's hacked to still work with flame_jet_off
|
// atm... or, at least, it's hacked to still work with flame_jet_off
|
||||||
@ -504,6 +507,13 @@ export class Level extends LevelInterface {
|
|||||||
if (tile.type.connects_to) {
|
if (tile.type.connects_to) {
|
||||||
connectables.push(tile);
|
connectables.push(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tile.type.name === 'teleport_yellow' && ! this.allow_taking_yellow_teleporters) {
|
||||||
|
yellow_teleporter_count += 1;
|
||||||
|
if (yellow_teleporter_count > 1) {
|
||||||
|
this.allow_taking_yellow_teleporters = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1780,9 +1790,10 @@ export class Level extends LevelInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! success) {
|
if (! success) {
|
||||||
if (actor.type.has_inventory && teleporter.type.name === 'teleport_yellow') {
|
if (actor.type.has_inventory && teleporter.type.name === 'teleport_yellow' &&
|
||||||
|
this.allow_taking_yellow_teleporters)
|
||||||
|
{
|
||||||
// Super duper special yellow teleporter behavior: you pick it the fuck up
|
// Super duper special yellow teleporter behavior: you pick it the fuck up
|
||||||
// FIXME not if there's only one in the level?
|
|
||||||
this.make_slide(actor, null);
|
this.make_slide(actor, null);
|
||||||
this.attempt_take(actor, teleporter);
|
this.attempt_take(actor, teleporter);
|
||||||
if (actor === this.player) {
|
if (actor === this.player) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user