Skip to content

Commit eb52649

Browse files
authored
Merge pull request #92 from earthwise01/custom-wind-fixes
Custom Wind Fixes
2 parents 15177cb + 9e93c3e commit eb52649

6 files changed

Lines changed: 21 additions & 14 deletions

File tree

Ahorn/lang/en_gb.lang

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,15 @@ placements.triggers.vitellary/resetdoortrigger.tooltips.onlyInRoom=Whether the t
213213

214214
# Custom Wind Trigger
215215
placements.triggers.vitellary/customwindtrigger.tooltips.speedX=The horizontal speed of the wind. Can be a list of speeds, separated by commas. For reference, normal wind speed is 4, and strong is 8.
216-
placements.triggers.vitellary/customwindtrigger.tooltips.speedY=The vertical speed of the wind. Can be a list of speeds, separated by commas. For reference, normal wind speed is 4, and strong is 8.
216+
placements.triggers.vitellary/customwindtrigger.tooltips.speedY=The vertical speed of the wind. Can be a list of speeds, separated by commas. For reference, normal down wind speed is 3, and up is -4.
217217
placements.triggers.vitellary/customwindtrigger.tooltips.alternationSpeed=The time, in seconds, that it takes to switch between speeds if there is a list in either horizontal or vertical speed. Can also be a list of speeds, separated by commas, which will be looped through.
218218
placements.triggers.vitellary/customwindtrigger.tooltips.catchupSpeed=How fast the wind changes from the previous value. Default is 1.
219219
placements.triggers.vitellary/customwindtrigger.tooltips.activationType=Special condition for the wind to activate.
220220
placements.triggers.vitellary/customwindtrigger.tooltips.loop=Whether the wind should loop or just stop at the last values when going through a list of speeds.
221221
placements.triggers.vitellary/customwindtrigger.tooltips.persist=If true, the wind created will stay after transitioning to a different room or dying. It will still be replaced by other wind triggers.
222222
placements.triggers.vitellary/customwindtrigger.tooltips.oneUse=Whether the wind trigger should disappear after being used.
223223
placements.triggers.vitellary/customwindtrigger.tooltips.onRoomEnter=Whether the wind trigger should activate immediately when the player enters its room, regardless of the player position.
224+
placements.triggers.vitellary/customwindtrigger.tooltips.fixUpdateDepth=Whether the wind should always update before the player. If unchecked, whether it updates before or after the player is able to change depending on load order, resulting in inconsistent behavior.
224225

225226
# Player Timestop Trigger
226227
placements.triggers.vitellary/nomovetrigger.tooltips.stopLength=Determines how long the player will be frozen for.

Ahorn/triggers/customWindTrigger.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module CustomWindTrigger
22

33
using ..Ahorn, Maple
44

5-
const actTypes = ["", "Seed", "Strawberry", "Keyberry", "Locked Door", "Refill", "Jellyfish", "Theo", "Core Mode (Hot)", "Core Mode (Cold)", "Death"]
5+
const actTypes = ["", "Seeds", "Strawberry", "Keyberry", "Locked Door", "Refill", "Jellyfish", "Theo", "Core Mode (Hot)", "Core Mode (Cold)", "Death"]
66

7-
@mapdef Trigger "vitellary/customwindtrigger" Wind(x::Integer, y::Integer, width::Integer=Maple.defaultTriggerWidth, height::Integer=Maple.defaultTriggerHeight, speedX::String="0", speedY::String="0", alternationSpeed::String="0", catchupSpeed::Number=1.0, activationType::String="", loop::Bool=true, persist::Bool=false, oneUse::Bool=false, onRoomEnter::Bool=false)
7+
@mapdef Trigger "vitellary/customwindtrigger" Wind(x::Integer, y::Integer, width::Integer=Maple.defaultTriggerWidth, height::Integer=Maple.defaultTriggerHeight, speedX::String="0", speedY::String="0", alternationSpeed::String="0", catchupSpeed::Number=1.0, activationType::String="", loop::Bool=true, persist::Bool=false, oneUse::Bool=false, onRoomEnter::Bool=false, fixUpdateDepth::Bool=true)
88

99
const placements = Ahorn.PlacementDict(
1010
"Custom Wind Trigger (Crystalline)" => Ahorn.EntityPlacement(
@@ -16,6 +16,6 @@ const placements = Ahorn.PlacementDict(
1616
Ahorn.editingOptions(entity::Wind) = Dict{String, Any}(
1717
"activationType" => actTypes
1818
)
19-
Ahorn.editingOrder(entity::Wind) = String["x", "y", "width", "height", "speedX", "speedY", "alternationSpeed", "catchupSpeed", "activationType", "onRoomEnter", "persist", "loop", "oneUse"]
19+
Ahorn.editingOrder(entity::Wind) = String["x", "y", "width", "height", "speedX", "speedY", "alternationSpeed", "catchupSpeed", "activationType", "onRoomEnter", "persist", "loop", "oneUse", "fixUpdateDepth"]
2020

2121
end

Code/CustomWindController.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static void Unload()
3131
On.Celeste.TheoCrystal.OnPickup -= TheoCrystal_OnPickup;
3232
}
3333

34-
public CustomWindController(List<float> speedX, List<float> speedY, List<float> alternateSpeed, float catchupSpeed, string activateType, bool loop, bool persist)
34+
public CustomWindController(List<float> speedX, List<float> speedY, List<float> alternateSpeed, float catchupSpeed, string activateType, bool loop, bool persist, bool fixUpdateDepth)
3535
{
3636
active = false;
3737
Tag = Tags.TransitionUpdate;
@@ -42,9 +42,10 @@ public CustomWindController(List<float> speedX, List<float> speedY, List<float>
4242
this.activateType = activateType;
4343
this.loop = loop;
4444
if (persist)
45-
{
4645
Tag |= Tags.Global | Tags.Persistent;
47-
}
46+
47+
if (fixUpdateDepth)
48+
Depth = 1;
4849
}
4950

5051
public override void Update()
@@ -240,7 +241,7 @@ public void ActivateWind(bool debug = false)
240241

241242
public void DeactivateWind()
242243
{
243-
if (!active) { return; }
244+
if (!active) return;
244245
active = false;
245246
if (coroutine != null)
246247
{

Code/CustomWindTrigger.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public CustomWindTrigger(EntityData data, Vector2 offset) : base(data, offset)
1818
{
1919
speedX = new List<float>();
2020
string[] speedXStrings = data.Attr("speedX", "0").Split(',');
21-
foreach(string sx in speedXStrings)
21+
foreach (string sx in speedXStrings)
2222
{
2323
speedX.Add(float.Parse(sx));
2424
}
@@ -30,7 +30,7 @@ public CustomWindTrigger(EntityData data, Vector2 offset) : base(data, offset)
3030
}
3131
alternateSpeed = new List<float>();
3232
string[] alternateSpeedStrings = data.Attr("alternationSpeed", "0").Split(',');
33-
foreach(string sa in alternateSpeedStrings)
33+
foreach (string sa in alternateSpeedStrings)
3434
{
3535
alternateSpeed.Add(float.Parse(sa));
3636
}
@@ -41,6 +41,7 @@ public CustomWindTrigger(EntityData data, Vector2 offset) : base(data, offset)
4141
oneUse = data.Bool("oneUse", false);
4242
ID = data.ID;
4343
onRoomEnter = data.Bool("onRoomEnter", false);
44+
fixUpdateDepth = data.Bool("fixUpdateDepth", false);
4445
}
4546

4647
public override void Awake(Scene scene)
@@ -65,7 +66,7 @@ public override void OnEnter(Player player)
6566
{
6667
customWind.RemoveSelf();
6768
}
68-
customWind = new CustomWindController(speedX, speedY, alternateSpeed, catchupSpeed, activateType, loop, persist);
69+
customWind = new CustomWindController(speedX, speedY, alternateSpeed, catchupSpeed, activateType, loop, persist, fixUpdateDepth);
6970
Scene.Add(customWind);
7071
if (oneUse)
7172
{
@@ -97,5 +98,7 @@ public override void OnEnter(Player player)
9798
private int ID;
9899

99100
private bool onRoomEnter;
101+
102+
private bool fixUpdateDepth;
100103
}
101104
}

Loenn/lang/en_gb.lang

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,15 @@ entities.vitellary/dashcodecontroller.attributes.description.index=This sequence
342342

343343
# Custom Wind Trigger
344344
triggers.vitellary/customwindtrigger.attributes.description.speedX=The horizontal speed of the wind. Can be a list of speeds, separated by commas. For reference, normal wind speed is 4, and strong is 8.
345-
triggers.vitellary/customwindtrigger.attributes.description.speedY=The vertical speed of the wind. Can be a list of speeds, separated by commas. For reference, normal wind speed is 4, and strong is 8.
345+
triggers.vitellary/customwindtrigger.attributes.description.speedY=The vertical speed of the wind. Can be a list of speeds, separated by commas. For reference, normal down wind speed is 3, and up is -4.
346346
triggers.vitellary/customwindtrigger.attributes.description.alternationSpeed=The time, in seconds, that it takes to switch between speeds if there is a list in either horizontal or vertical speed. Can also be a list of speeds, separated by commas, which will be looped through.
347347
triggers.vitellary/customwindtrigger.attributes.description.catchupSpeed=How fast the wind changes from the previous value. Default is 1.
348348
triggers.vitellary/customwindtrigger.attributes.description.activationType=Special condition for the wind to activate.
349349
triggers.vitellary/customwindtrigger.attributes.description.loop=Whether the wind should loop or just stop at the last values when going through a list of speeds.
350350
triggers.vitellary/customwindtrigger.attributes.description.persist=If true, the wind created will stay after transitioning to a different room or dying. It will still be replaced by other wind triggers.
351351
triggers.vitellary/customwindtrigger.attributes.description.oneUse=Whether the wind trigger should disappear after being used.
352352
triggers.vitellary/customwindtrigger.attributes.description.onRoomEnter=Whether the wind trigger should activate immediately when the player enters its room, regardless of the player position.
353+
triggers.vitellary/customwindtrigger.attributes.description.fixUpdateDepth=Whether the wind should always update before the player. If unchecked, whether it updates before or after the player is able to change depending on load order, resulting in inconsistent behavior.
353354

354355
# Custom Wind Snow
355356
effects.CrystallineHelper/CustomWindSnow.attributes.description.colors=List of possible colors the wind particles can have, separated by commas.

Loenn/triggers/custom_wind_trigger.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local activationTypes = {
22
"",
3-
"Seed",
3+
"Seeds",
44
"Strawberry",
55
"Keyberry",
66
"Locked Door",
@@ -35,7 +35,8 @@ customWindTrigger.placements = {
3535
loop = true,
3636
persist = false,
3737
oneUse = false,
38-
onRoomEnter = false
38+
onRoomEnter = false,
39+
fixUpdateDepth = true
3940
}
4041
}
4142
}

0 commit comments

Comments
 (0)