Skip to content

Commit 3952a4c

Browse files
committed
Update Ahorn plugin
1 parent 00897df commit 3952a4c

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

Ahorn/entities/maxHelpingHandFlagSwitchGate.jl

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ using ..Ahorn, Maple
77
shakeTime::Number=0.5, moveTime::Number=1.8, moveSpeed::Number=60.0, moveEased::Bool=true, allowReturn::Bool=false, moveSound::String="event:/game/general/touchswitch_gate_open", finishedSound::String="event:/game/general/touchswitch_gate_finish",
88
smoke::Bool=true, surfaceIndex::Int16=convert(Int16, 8), particles::Bool=true, speedMode::Bool=false) =
99
Entity("MaxHelpingHand/FlagSwitchGate", x=x1, y=y1, nodes=Tuple{Int, Int}[(x2, y2)], width=width, height=height, sprite=sprite, persistent=persistent, flag=flag, icon=icon,
10-
inactiveColor=inactiveColor, activeColor=activeColor, finishColor=finishColor, shakeTime=shakeTime, moveTime=moveTime, moveEased=moveEased, allowReturn=allowReturn, moveSound=moveSound, finishedSound=finishedSound,
11-
smoke=smoke, surfaceIndex=surfaceIndex, particles=particles)
10+
inactiveColor=inactiveColor, activeColor=activeColor, finishColor=finishColor, shakeTime=shakeTime, moveTime=moveTime, moveSpeed=moveSpeed, moveEased=moveEased, allowReturn=allowReturn, moveSound=moveSound, finishedSound=finishedSound,
11+
smoke=smoke, surfaceIndex=surfaceIndex, particles=particles, speedMode=speedMode)
1212

1313
function gateFinalizer(entity)
1414
x, y = Ahorn.position(entity)
@@ -35,6 +35,14 @@ const placements = Ahorn.PlacementDict(
3535

3636
Ahorn.editingOrder(entity::FlagSwitchGate) = String["x", "y", "width", "height", "flag", "inactiveColor", "activeColor", "finishColor", "hitSound", "moveSound", "finishedSound", "shakeTime", "moveTime", "moveSpeed", "icon", "sprite", "surfaceIndex", "allowReturn", "moveEased", "persistent", "particles", "smoke", "speedMode"]
3737

38+
function Ahorn.editingIgnored(entity::FlagSwitchGate, multiple::Bool=false)
39+
if get(entity.data, "speedMode", false)
40+
return String["moveTime", "moveEased"]
41+
else
42+
return String["moveSpeed"]
43+
end
44+
end
45+
3846
Ahorn.editingOptions(entity::FlagSwitchGate) = Dict{String, Any}(
3947
"sprite" => textures,
4048
"icon" => bundledIcons,

Entities/FlagSwitchGate.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,9 @@ private IEnumerator moveSequence(Vector2 node, bool goingBack) {
271271
int particleAt = 0;
272272

273273
Tween tween;
274-
if (speedMode)
275-
{
276-
tween = Tween.Create(Tween.TweenMode.Oneshot, null, (float)Math.Round(((Vector2.Distance(start, node)) / moveSpeed), 3), start: true);
277-
}
278-
else
279-
{
274+
if (speedMode) {
275+
tween = Tween.Create(Tween.TweenMode.Oneshot, null, (float) Math.Round(((Vector2.Distance(start, node)) / moveSpeed), 3), start: true);
276+
} else {
280277
tween = Tween.Create(Tween.TweenMode.Oneshot, moveEased ? Ease.CubeOut : null, moveTime + (moveEased ? 0.2f : 0f), start: true);
281278
}
282279

@@ -299,7 +296,7 @@ private IEnumerator moveSequence(Vector2 node, bool goingBack) {
299296
};
300297
Add(tween);
301298

302-
float moveTimeLeft = speedMode ? (float)Math.Round(((Vector2.Distance(start, node)) / moveSpeed), 3) : moveTime;
299+
float moveTimeLeft = speedMode ? (float) Math.Round(((Vector2.Distance(start, node)) / moveSpeed), 3) : moveTime;
303300
while (moveTimeLeft > 0f) {
304301
yield return null;
305302
moveTimeLeft -= Engine.DeltaTime;

0 commit comments

Comments
 (0)