forked from CommunalHelper/EeveeHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEeveeHelperModule.cs
More file actions
158 lines (138 loc) · 5.47 KB
/
Copy pathEeveeHelperModule.cs
File metadata and controls
158 lines (138 loc) · 5.47 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
using Celeste.Mod.EeveeHelper.Compat;
using Celeste.Mod.EeveeHelper.Components;
using Celeste.Mod.EeveeHelper.Effects;
using Celeste.Mod.EeveeHelper.Entities;
using Celeste.Mod.EeveeHelper.Handlers;
using Celeste.Mod.EeveeHelper.Handlers.Impl;
using Monocle;
using System;
using System.Collections.Generic;
namespace Celeste.Mod.EeveeHelper;
public class EeveeHelperModule : EverestModule
{
public static EeveeHelperModule Instance { get; set; }
public EeveeHelperModule()
{
Instance = this;
}
public override Type SessionType => typeof(EeveeHelperSession);
public static EeveeHelperSession Session => (EeveeHelperSession)Instance._Session;
public override Type SettingsType => typeof(EeveeHelperSettings);
public static EeveeHelperSettings Settings => (EeveeHelperSettings)Instance._Settings;
public static bool AdventureHelperLoaded { get; set; }
public static bool StyleMaskHelperLoaded { get; set; }
public static bool SpeedrunToolLoaded { get; set; }
public static bool BetterRefillGemsLoaded { get; set; }
public override void Load()
{
MiscHooks.Load();
RoomChest.Load();
HoldableTiles.Load();
PatientBooster.Load();
CoreZone.Load();
FreezeUpdateHook.Load();
Everest.Events.Level.OnLoadBackdrop += OnLoadBackdrop;
EntityHandler.RegisterInherited<Water>((entity, container) => new WaterHandler(entity));
EntityHandler.RegisterInherited<TrackSpinner>((entity, container) => new TrackSpinnerHandler(entity));
EntityHandler.RegisterInherited<RotateSpinner>((entity, container) => new RotateSpinnerHandler(entity));
EntityHandler.RegisterInherited<DashSwitch>((entity, container) => new AxisMoverHandler(entity, new Tuple<string, bool>("startY", true)));
EntityHandler.RegisterInherited<ZipMover>((entity, container) => new ZipMoverNodeHandler(entity, true),
(entity, container) => ZipMoverNodeHandler.InsideCheck(container, true, entity as ZipMover));
EntityHandler.RegisterInherited<ZipMover>((entity, container) => new ZipMoverNodeHandler(entity, false),
(entity, container) => ZipMoverNodeHandler.InsideCheck(container, false, entity as ZipMover));
EntityHandler.RegisterInherited<SwapBlock>((entity, container) => new SwapBlockHandler(entity, true),
(entity, container) => SwapBlockHandler.InsideCheck(container, true, entity as SwapBlock));
EntityHandler.RegisterInherited<SwapBlock>((entity, container) => new SwapBlockHandler(entity, false),
(entity, container) => SwapBlockHandler.InsideCheck(container, false, entity as SwapBlock));
EntityHandler.RegisterInherited<Decal>((entity, container) => new DecalHandler(entity),
(entity, container) => container.CheckDecal(entity as Decal));
}
public override void Unload()
{
MiscHooks.Unload();
RoomChest.Unload();
HoldableTiles.Unload();
PatientBooster.Unload();
CoreZone.Unload();
FreezeUpdateHook.Unload();
Everest.Events.Level.OnLoadBackdrop -= OnLoadBackdrop;
}
public override void Initialize()
{
RoomChest.Initialize();
AdventureHelperLoaded = Everest.Loader.DependencyLoaded(new EverestModuleMetadata
{
Name = "AdventureHelper",
VersionString = "1.5.1"
});
StyleMaskHelperLoaded = Everest.Loader.DependencyLoaded(new EverestModuleMetadata
{
Name = "StyleMaskHelper",
VersionString = "1.2.0"
});
SpeedrunToolLoaded = Everest.Loader.DependencyLoaded(new EverestModuleMetadata
{
Name = "SpeedrunTool",
VersionString = "3.21.0"
});
BetterRefillGemsLoaded = Everest.Loader.TryGetDependency(new EverestModuleMetadata
{
Name = "BetterRefillGems",
VersionString = "1.0.1"
}, out var betterRefillGemsModule);
if (AdventureHelperLoaded)
{
AdventureHelperCompat.Initialize();
}
if (SpeedrunToolLoaded)
{
SpeedrunToolCompat.Initialize();
}
if (BetterRefillGemsLoaded)
{
BetterRefillGemsCompat.Initialize(betterRefillGemsModule);
}
}
public override void OnInputInitialize()
{
base.OnInputInitialize();
Settings.ActivateCustomInputBlock.BufferTime = 0f;
}
private static Backdrop OnLoadBackdrop(MapData map, BinaryPacker.Element child, BinaryPacker.Element above)
{
if (child.Name.Equals("EeveeHelper/SeededStarfield", StringComparison.OrdinalIgnoreCase))
return new SeededStarfield(Calc.HexToColor(child.Attr("color", "ffffff")) * child.AttrFloat("alpha", 1f), child.AttrFloat("speed", 1f), child.AttrInt("seed", 0), child.Attr("textureDir", "particles/starfield"));
return null;
}
public static Dictionary<string, Ease.Easer> EaseTypes = new()
{
{ "Linear", Ease.Linear },
{ "SineIn", Ease.SineIn },
{ "SineOut", Ease.SineOut },
{ "SineInOut", Ease.SineInOut },
{ "QuadIn", Ease.QuadIn },
{ "QuadOut", Ease.QuadOut },
{ "QuadInOut", Ease.QuadInOut },
{ "CubeIn", Ease.CubeIn },
{ "CubeOut", Ease.CubeOut },
{ "CubeInOut", Ease.CubeInOut },
{ "QuintIn", Ease.QuintIn },
{ "QuintOut", Ease.QuintOut },
{ "QuintInOut", Ease.QuintInOut },
{ "BackIn", Ease.BackIn },
{ "BackOut", Ease.BackOut },
{ "BackInOut", Ease.BackInOut },
{ "ExpoIn", Ease.ExpoIn },
{ "ExpoOut", Ease.ExpoOut },
{ "ExpoInOut", Ease.ExpoInOut },
{ "BigBackIn", Ease.BigBackIn },
{ "BigBackOut", Ease.BigBackOut },
{ "BigBackInOut", Ease.BigBackInOut },
{ "ElasticIn", Ease.ElasticIn },
{ "ElasticOut", Ease.ElasticOut },
{ "ElasticInOut", Ease.ElasticInOut },
{ "BounceIn", Ease.BounceIn },
{ "BounceOut", Ease.BounceOut },
{ "BounceInOut", Ease.BounceInOut }
};
}