Skip to content

Commit 264fc25

Browse files
committed
Variable Crumble Block: fix the 'texture' attribute + add 'respawn time' attribute
1 parent beca2a9 commit 264fc25

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Ahorn/entities/variableCrumble.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module SpringCollab2020VariableCrumbleBlock
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "SpringCollab2020/variableCrumbleBlock" VariableCrumbleBlock(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, texture::String="default", timer::Number=0.4)
5+
@mapdef Entity "SpringCollab2020/variableCrumbleBlock" VariableCrumbleBlock(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, texture::String="default",
6+
timer::Number=0.4, respawnTimer::Number=2.0)
67

78
const placements = Ahorn.PlacementDict(
89
"Variable Crumble Blocks ($(uppercasefirst(texture))) (Spring Collab 2020)" => Ahorn.EntityPlacement(

Ahorn/lang/en_gb.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ placements.triggers.SpringCollab2020/LightningStrikeTrigger.tooltips.constant=If
3535
# Variable Crumble Blocks
3636
placements.entities.SpringCollab2020/variableCrumbleBlock.tooltips.texture=The texture of the blocks that are crumbling.2
3737
placements.entities.SpringCollab2020/variableCrumbleBlock.tooltips.timer=How long the blocks will shake for before falling.
38+
placements.entities.SpringCollab2020/variableCrumbleBlock.tooltips.respawnTimer=How much time (in seconds) the block will take before respawning.
3839

3940
# Floatier Space Block
4041
placements.entities.SpringCollab2020/floatierSpaceBlock.tooltips.disableSpawnOffset=Whether or not the entity should spawn without the random offset.

Entities/VariableCrumbleBlock.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,27 @@ public class VariableCrumblePlatform : Solid {
2626

2727
public float crumbleTime = 0.4f;
2828

29-
public string OverrideTexture;
29+
public float respawnTime = 2f;
3030

31-
public VariableCrumblePlatform(Vector2 position, float width, float timer)
31+
private string overrideTexture;
32+
33+
public VariableCrumblePlatform(Vector2 position, float width, string overrideTexture, float timer, float respawnTimer)
3234
: base(position, width, 8f, false) {
3335
EnableAssistModeChecks = false;
36+
this.overrideTexture = overrideTexture;
3437
crumbleTime = timer;
38+
respawnTime = respawnTimer;
3539
}
3640

3741
public VariableCrumblePlatform(EntityData data, Vector2 offset)
38-
: this(data.Position + offset, (float) data.Width, data.Float("timer", 0.4f)) {
42+
: this(data.Position + offset, (float) data.Width, data.Attr("texture"), data.Float("timer", 0.4f), data.Float("respawnTimer", 2f)) {
3943
}
4044

4145
public override void Added(Scene scene) {
4246
AreaData areaData = AreaData.Get(scene);
4347
string crumbleBlock = areaData.CrumbleBlock;
44-
if (OverrideTexture != null) {
45-
areaData.CrumbleBlock = OverrideTexture;
48+
if (overrideTexture != null) {
49+
areaData.CrumbleBlock = overrideTexture;
4650
}
4751
base.Added(scene);
4852
MTexture mTexture = GFX.Game["objects/crumbleBlock/outline"];
@@ -142,7 +146,7 @@ private IEnumerator Sequence() {
142146
}
143147
}
144148
}
145-
yield return 2f;
149+
yield return respawnTime;
146150
while (CollideCheck<Actor>() || CollideCheck<Solid>()) {
147151
yield return null;
148152
}

0 commit comments

Comments
 (0)