Skip to content

Commit 365ed32

Browse files
authored
Merge pull request #183 from EverestAPI/integrate_map_specific_code_mods
Integrate map specific code mods
2 parents 62e93af + 6d2cbd7 commit 365ed32

File tree

3 files changed

+117
-62
lines changed

3 files changed

+117
-62
lines changed

Ahorn/triggers/swapDashTrigger.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module SpringCollab2020SwapDashTrigger
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Trigger "SpringCollab2020/SwapDashTrigger" SwapDashTrigger(x::Integer, y::Integer, width::Integer=Maple.defaultTriggerWidth, height::Integer=Maple.defaultTriggerHeight)
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Swap Dash (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
SwapDashTrigger,
10+
"rectangle"
11+
)
12+
)
13+
14+
end

SpringCollab2020Module.cs

Lines changed: 74 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,83 @@
11
using Celeste.Mod.SpringCollab2020.Effects;
2-
using Celeste.Mod.SpringCollab2020.Entities;
3-
using Celeste.Mod.SpringCollab2020.Triggers;
2+
using Celeste.Mod.SpringCollab2020.Entities;
3+
using Celeste.Mod.SpringCollab2020.Triggers;
4+
using Microsoft.Xna.Framework;
45
using System;
56

6-
namespace Celeste.Mod.SpringCollab2020 {
7-
public class SpringCollab2020Module : EverestModule {
8-
7+
namespace Celeste.Mod.SpringCollab2020 {
8+
public class SpringCollab2020Module : EverestModule {
9+
910
public static SpringCollab2020Module Instance;
1011

1112
public override Type SessionType => typeof(SpringCollab2020Session);
1213
public SpringCollab2020Session Session => (SpringCollab2020Session) _Session;
1314

14-
public SpringCollab2020Module() {
15-
Instance = this;
16-
}
17-
18-
public override void Load() {
19-
NoRefillField.Load();
20-
FloatierSpaceBlock.Load();
21-
MoveBlockBarrier.Load();
22-
MoveBlockBarrierRenderer.Load();
23-
RemoveLightSourcesTrigger.Load();
24-
SafeRespawnCrumble.Load();
25-
UpsideDownJumpThru.Load();
26-
BubbleReturnBerry.Load();
27-
SidewaysJumpThru.Load();
28-
CrystalBombDetonatorRenderer.Load();
29-
FlagTouchSwitch.Load();
30-
DisableIcePhysicsTrigger.Load();
31-
MultiRoomStrawberrySeed.Load();
32-
MadelineSilhouetteTrigger.Load();
33-
BlockJellySpawnTrigger.Load();
34-
StrawberryIgnoringLighting.Load();
35-
SeekerCustomColors.Load();
36-
CameraCatchupSpeedTrigger.Load();
37-
ColorGradeFadeTrigger.Load();
38-
Everest.Events.Level.OnLoadBackdrop += onLoadBackdrop;
39-
}
40-
41-
public override void LoadContent(bool firstLoad) {
42-
base.LoadContent(firstLoad);
43-
GlassBerry.LoadContent();
44-
StrawberryIgnoringLighting.LoadContent();
45-
}
46-
47-
public override void Unload() {
48-
NoRefillField.Unload();
49-
FloatierSpaceBlock.Unload();
50-
MoveBlockBarrier.Unload();
51-
MoveBlockBarrierRenderer.Unload();
52-
RemoveLightSourcesTrigger.Unload();
53-
SafeRespawnCrumble.Unload();
54-
GlassBerry.Unload();
55-
UpsideDownJumpThru.Unload();
56-
BubbleReturnBerry.Unload();
57-
SidewaysJumpThru.Unload();
58-
CrystalBombDetonatorRenderer.Unload();
59-
FlagTouchSwitch.Unload();
60-
DisableIcePhysicsTrigger.Unload();
61-
MultiRoomStrawberrySeed.Unload();
62-
MadelineSilhouetteTrigger.Unload();
63-
BlockJellySpawnTrigger.Unload();
64-
StrawberryIgnoringLighting.Unload();
65-
SeekerCustomColors.Unload();
66-
CameraCatchupSpeedTrigger.Unload();
67-
ColorGradeFadeTrigger.Unload();
68-
Everest.Events.Level.OnLoadBackdrop -= onLoadBackdrop;
15+
public SpringCollab2020Module() {
16+
Instance = this;
17+
}
18+
19+
public override void Load() {
20+
NoRefillField.Load();
21+
FloatierSpaceBlock.Load();
22+
MoveBlockBarrier.Load();
23+
MoveBlockBarrierRenderer.Load();
24+
RemoveLightSourcesTrigger.Load();
25+
SafeRespawnCrumble.Load();
26+
UpsideDownJumpThru.Load();
27+
BubbleReturnBerry.Load();
28+
SidewaysJumpThru.Load();
29+
CrystalBombDetonatorRenderer.Load();
30+
FlagTouchSwitch.Load();
31+
DisableIcePhysicsTrigger.Load();
32+
MultiRoomStrawberrySeed.Load();
33+
MadelineSilhouetteTrigger.Load();
34+
BlockJellySpawnTrigger.Load();
35+
StrawberryIgnoringLighting.Load();
36+
SeekerCustomColors.Load();
37+
CameraCatchupSpeedTrigger.Load();
38+
ColorGradeFadeTrigger.Load();
39+
Everest.Events.Level.OnLoadBackdrop += onLoadBackdrop;
40+
41+
DecalRegistry.AddPropertyHandler("scale", (decal, attrs) => {
42+
Vector2 scale = decal.Scale;
43+
if (attrs["multiply"] != null) {
44+
scale *= float.Parse(attrs["multiply"].Value);
45+
}
46+
if (attrs["divide"] != null) {
47+
scale /= float.Parse(attrs["divide"].Value);
48+
}
49+
decal.Scale = scale;
50+
});
51+
}
52+
53+
public override void LoadContent(bool firstLoad) {
54+
base.LoadContent(firstLoad);
55+
GlassBerry.LoadContent();
56+
StrawberryIgnoringLighting.LoadContent();
57+
}
58+
59+
public override void Unload() {
60+
NoRefillField.Unload();
61+
FloatierSpaceBlock.Unload();
62+
MoveBlockBarrier.Unload();
63+
MoveBlockBarrierRenderer.Unload();
64+
RemoveLightSourcesTrigger.Unload();
65+
SafeRespawnCrumble.Unload();
66+
GlassBerry.Unload();
67+
UpsideDownJumpThru.Unload();
68+
BubbleReturnBerry.Unload();
69+
SidewaysJumpThru.Unload();
70+
CrystalBombDetonatorRenderer.Unload();
71+
FlagTouchSwitch.Unload();
72+
DisableIcePhysicsTrigger.Unload();
73+
MultiRoomStrawberrySeed.Unload();
74+
MadelineSilhouetteTrigger.Unload();
75+
BlockJellySpawnTrigger.Unload();
76+
StrawberryIgnoringLighting.Unload();
77+
SeekerCustomColors.Unload();
78+
CameraCatchupSpeedTrigger.Unload();
79+
ColorGradeFadeTrigger.Unload();
80+
Everest.Events.Level.OnLoadBackdrop -= onLoadBackdrop;
6981
}
7082

7183
private Backdrop onLoadBackdrop(MapData map, BinaryPacker.Element child, BinaryPacker.Element above) {
@@ -79,6 +91,6 @@ public override void PrepareMapDataProcessors(MapDataFixup context) {
7991
base.PrepareMapDataProcessors(context);
8092

8193
context.Add<SpringCollab2020MapDataProcessor>();
82-
}
83-
}
94+
}
95+
}
8496
}

Triggers/SwapDashTrigger.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Celeste.Mod.Entities;
2+
using Microsoft.Xna.Framework;
3+
4+
namespace Celeste.Mod.SpringCollab2020.Triggers {
5+
[CustomEntity("SpringCollab2020/SwapDashTrigger")]
6+
class SwapDashTrigger : Trigger {
7+
private float enterX;
8+
9+
public SwapDashTrigger(EntityData data, Vector2 offset)
10+
: base(data, offset) {
11+
}
12+
13+
public override void OnEnter(Player player) {
14+
enterX = player.X;
15+
}
16+
17+
public override void OnLeave(Player player) {
18+
Session session = SceneAs<Level>().Session;
19+
if (player.MaxDashes == 1 && (!(enterX + 16f >= player.X) || !(enterX - 16f <= player.X))) {
20+
session.Inventory.Dashes = 2;
21+
} else if (player.MaxDashes == 2 && (!(enterX + 16f >= player.X) || !(enterX - 16f <= player.X))) {
22+
session.Inventory.Dashes = 1;
23+
if (player.Dashes == 2) {
24+
player.Dashes = 1;
25+
}
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)