Add CC2's single-frame delay after a light switch is pressed
This commit is contained in:
parent
22758e64ac
commit
1273843f26
@ -1693,23 +1693,37 @@ const TILE_TYPES = {
|
|||||||
draw_layer: DRAW_LAYERS.terrain,
|
draw_layer: DRAW_LAYERS.terrain,
|
||||||
is_power_source: true,
|
is_power_source: true,
|
||||||
get_emitting_edges(me, level) {
|
get_emitting_edges(me, level) {
|
||||||
|
// TODO this is inconsistent with the pink/black buttons, but cc2 has a single-frame
|
||||||
|
// delay here!
|
||||||
|
if (me.is_first_frame) {
|
||||||
|
level._set_tile_prop(me, 'is_first_frame', false);
|
||||||
|
return me.wire_directions;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
// TODO distinct sfx? more clicky?
|
// TODO distinct sfx? more clicky?
|
||||||
level.sfx.play_once('button-press', me.cell);
|
level.sfx.play_once('button-press', me.cell);
|
||||||
level.transmute_tile(me, 'light_switch_on');
|
level.transmute_tile(me, 'light_switch_on');
|
||||||
|
level._set_tile_prop(me, 'is_first_frame', true);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
light_switch_on: {
|
light_switch_on: {
|
||||||
draw_layer: DRAW_LAYERS.terrain,
|
draw_layer: DRAW_LAYERS.terrain,
|
||||||
is_power_source: true,
|
is_power_source: true,
|
||||||
get_emitting_edges(me, level) {
|
get_emitting_edges(me, level) {
|
||||||
|
// TODO this is inconsistent with the pink/black buttons, but cc2 has a single-frame
|
||||||
|
// delay here!
|
||||||
|
if (me.is_first_frame) {
|
||||||
|
level._set_tile_prop(me, 'is_first_frame', false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return me.wire_directions;
|
return me.wire_directions;
|
||||||
},
|
},
|
||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
level.sfx.play_once('button-press', me.cell);
|
level.sfx.play_once('button-press', me.cell);
|
||||||
level.transmute_tile(me, 'light_switch_off');
|
level.transmute_tile(me, 'light_switch_off');
|
||||||
|
level._set_tile_prop(me, 'is_first_frame', true);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// LL tile: circuit block, overrides the wiring on the floor below (if any)
|
// LL tile: circuit block, overrides the wiring on the floor below (if any)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user