Skip to content

Commit b8661dc

Browse files
committed
resetSpeed option for tele crystals
1 parent 48c7e6a commit b8661dc

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

Code/TeleCrystal.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public TeleCrystal(EntityData data, Vector2 offset) : base(data.Position + offse
4949
oneUse = data.Bool("oneUse", false);
5050
preventCrash = data.Bool("preventCrash", true);
5151
useTime = data.Float("respawnTime", 0.2f);
52+
resetSpeed = data.Bool("resetSpeed", true);
5253

5354
Collider = new Hitbox(16f, 16f, -8f, -8f);
5455
Add(new PlayerCollider(new Action<Player>(OnPlayer), null, null));
@@ -150,13 +151,16 @@ private void OnPlayer(Player player)
150151
{
151152
player.MoveVExact(-2);
152153
}
153-
if (dirVector.X != 0)
154+
if (resetSpeed)
154155
{
155-
player.Speed.X = 0;
156-
}
157-
else
158-
{
159-
player.Speed.Y = 0;
156+
if (dirVector.X != 0)
157+
{
158+
player.Speed.X = 0;
159+
}
160+
else
161+
{
162+
player.Speed.Y = 0;
163+
}
160164
}
161165
player.StateMachine.State = 0;
162166
Audio.Play("event:/game/general/diamond_touch", Position);
@@ -198,6 +202,8 @@ private IEnumerator RefillRoutine(Player player)
198202

199203
private float useTime;
200204

205+
private bool resetSpeed;
206+
201207
private Vector2 dirVector;
202208

203209
private float respawnTimer;

Loenn/entities/tele_crystal.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ for i, dir in ipairs(directions) do
2828
direction = dir,
2929
oneUse = false,
3030
preventCrash = true,
31-
respawnTime = 0.2
31+
respawnTime = 0.2,
32+
resetSpeed = true,
3233
}
3334
}
3435
end

Loenn/lang/en_gb.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ entities.vitellary/goodtelecrystal.attributes.description.direction=The directio
130130
entities.vitellary/goodtelecrystal.attributes.description.oneUse=Whether the refill should respawn after being used.
131131
entities.vitellary/goodtelecrystal.attributes.description.preventCrash=If false, the crystal will attempt to move you as far as possible until you collide with a wall, which will crash the game if it never does collide with a wall.
132132
entities.vitellary/goodtelecrystal.attributes.description.respawnTime=How long (in seconds) after using the crystal for it to respawn.
133+
entities.vitellary/goodtelecrystal.attributes.description.resetSpeed=Whether the crystal should reset the player's speed along the teleported axis.
133134

134135
# Star Crystal
135136
entities.vitellary/starcrystal.attributes.description.oneUse=Whether the refill should respawn after being used.

0 commit comments

Comments
 (0)