-
Notifications
You must be signed in to change notification settings - Fork 21
/
FadeInRemover.ts
60 lines (53 loc) · 1.54 KB
/
FadeInRemover.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { game } from "../../../core/cachedClasses";
import { Exported } from "../../../decorators";
import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
import { Feature } from "../../private/Feature";
const INSTANT_FADE_IN_SPEED = 1;
export class FadeInRemover extends Feature {
private enabled = false;
/** @internal */
constructor() {
super();
this.customCallbacksUsed = [
[
ModCallbackCustom.POST_GAME_STARTED_REORDERED,
this.postGameStartedReordered,
[undefined],
],
];
}
// ModCallbackCustom.POST_GAME_STARTED_REORDERED
private readonly postGameStartedReordered = () => {
if (this.enabled) {
game.Fadein(INSTANT_FADE_IN_SPEED);
}
};
/**
* Removes the fade-in that occurs at the beginning of a run. If this behavior is desired, call
* this function once at the beginning of your mod.
*
* This is useful for debugging, when you are resetting the game often.
*
* You can restore the vanilla behavior with the `restoreFadeIn` function.
*
* In order to use this function, you must upgrade your mod with `ISCFeature.FADE_IN_REMOVER`.
*
* @public
*/
@Exported
public removeFadeIn(): void {
this.enabled = true;
}
/**
* Disables the fade-in remover. Only useful if you have previously called the `removeFadeIn`
* function.
*
* In order to use this function, you must upgrade your mod with `ISCFeature.FADE_IN_REMOVER`.
*
* @public
*/
@Exported
public restoreFadeIn(): void {
this.enabled = false;
}
}