Skip to content

Commit 1575f8b

Browse files
committed
allow fade_color on teleport game event
1 parent 12487bf commit 1575f8b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

base/game_events/GameEventManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,8 @@ export class GameEventManager {
11361136
info.target_tile_position,
11371137
info.target_collision_layer,
11381138
info.target_direction,
1139-
info.keep_encounter_cumulator
1139+
info.keep_encounter_cumulator,
1140+
info.fade_color
11401141
);
11411142
case event_types.SET_NPC_COLLISION:
11421143
return new SetNpcCollisionEvent(

base/game_events/TeleportEvent.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class TeleportEvent extends GameEvent {
77
private target_collision_layer: number;
88
private target_direction: string;
99
private keep_encounter_cumulator: boolean;
10+
private fade_color: string;
1011

1112
constructor(
1213
game,
@@ -18,14 +19,16 @@ export class TeleportEvent extends GameEvent {
1819
target_tile_position,
1920
target_collision_layer,
2021
target_direction,
21-
keep_encounter_cumulator
22+
keep_encounter_cumulator,
23+
fade_color
2224
) {
2325
super(game, data, event_types.TELEPORT, active, key_name, keep_reveal);
2426
this.target_map_key = target_map_key;
2527
this.target_tile_position = target_tile_position;
2628
this.target_collision_layer = target_collision_layer;
2729
this.target_direction = target_direction;
2830
this.keep_encounter_cumulator = keep_encounter_cumulator ?? true;
31+
this.fade_color = fade_color;
2932
}
3033

3134
_fire() {
@@ -57,7 +60,7 @@ export class TeleportEvent extends GameEvent {
5760
undefined,
5861
undefined,
5962
undefined,
60-
undefined
63+
this.fade_color
6164
);
6265
event.set_fadein_callback(() => {
6366
this.data.game_event_manager.events_running_count = 0;

base/tile_events/TeleportEvent.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TeleportEvent extends TileEvent {
3838
};
3939
private spiral_stair: "up" | "down";
4040
private on_event_toggle_layers: string[];
41-
private fade_color: number;
41+
private fade_color: string;
4242

4343
constructor(
4444
game,
@@ -102,7 +102,7 @@ export class TeleportEvent extends TileEvent {
102102
this.fadein_callback = null;
103103
this.door_settings = door_settings ?? null;
104104
this.spiral_stair = spiral_stair ?? null;
105-
this.fade_color = fade_color ?? 0x0;
105+
this.fade_color = fade_color ?? "0x0";
106106
this.on_event_toggle_layers = on_event_toggle_layers
107107
? Array.isArray(on_event_toggle_layers)
108108
? on_event_toggle_layers
@@ -275,9 +275,10 @@ export class TeleportEvent extends TileEvent {
275275
};
276276

277277
if (this.fade_camera) {
278+
const fade_color = parseInt(this.fade_color, 16);
278279
if (
279280
this.game.camera.fxType === Phaser.Camera.FADE_OUT &&
280-
this.game.camera.fx.graphicsData[0]?.fillColor === this.fade_color
281+
this.game.camera.fx.graphicsData[0]?.fillColor === fade_color
281282
) {
282283
const timer = this.game.time.create(true);
283284
timer.add(this.fade_duration, () => {
@@ -286,7 +287,7 @@ export class TeleportEvent extends TileEvent {
286287
});
287288
timer.start();
288289
} else {
289-
this.game.camera.fade(this.fade_color, this.fade_duration, true);
290+
this.game.camera.fade(fade_color, this.fade_duration, true);
290291
this.game.camera.onFadeComplete.addOnce(on_camera_fade_in);
291292
}
292293
} else {

0 commit comments

Comments
 (0)