Skip to content

Commit a6f6ba9

Browse files
authored
Merge pull request CommunalHelper#267 from Etpio/dev
Held Cassete Blocks options
2 parents 69e6f08 + b22b60f commit a6f6ba9

13 files changed

+619
-559
lines changed

Loenn/entities/cassette_blocks/cassette_falling_block.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ for i = 1, 4 do
3232
height = 16,
3333
customColor = colors[i],
3434
oldConnectionBehavior = false,
35+
held = false,
3536
}
3637
}
3738
end

Loenn/entities/cassette_blocks/cassette_move_block.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ for i = 1, 4 do
4949
direction = "Right",
5050
moveSpeed = 60.0,
5151
oldConnectionBehavior = false,
52+
held = false,
5253
crashTime = 0.15,
5354
regenTime = 3.0,
5455
shakeOnCollision = true,

Loenn/entities/cassette_blocks/cassette_swap_block.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ for i = 1, 4 do
3636
customColor = colors[i],
3737
noReturn = false,
3838
oldConnectionBehavior = false,
39+
held = false,
3940
}
4041
}
4142
end

Loenn/entities/cassette_blocks/cassette_zip_mover.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ for i = 1, 4 do
4747
noReturn = false,
4848
customColor = colors[i],
4949
oldConnectionBehavior = false,
50+
held = false,
5051
}
5152
}
5253
end

Loenn/entities/cassette_blocks/custom_cassette_block.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ for i = 1, 4 do
3232
height = 16,
3333
customColor = colors[i],
3434
oldConnectionBehavior = false,
35+
held = false,
3536
}
3637
}
3738
end

Loenn/lang/en_gb.lang

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ entities.CommunalHelper/CustomCassetteBlock.attributes.description.index=The col
156156
entities.CommunalHelper/CustomCassetteBlock.attributes.description.tempo=The tempo of the cassette music in the room.
157157
entities.CommunalHelper/CustomCassetteBlock.attributes.description.customColor=Optional hexadecimal color code, visual-only change.
158158
entities.CommunalHelper/CustomCassetteBlock.attributes.description.oldConnectionBehavior=Force the old texture connection behavior (cassette entities connect to anything around them that is on the same index).
159+
entities.CommunalHelper/CustomCassetteBlock.attributes.description.held=Whether this Cassette Block is activated by holding the manual cassette key binding (using the Manual Cassette Controller).\nThis only works if this block's index is 0 or 1:\n- index 0: ACTIVE when key is HELD.\n- index 1: INACTIVE when key is HELD.
159160

160161
# Cassette Falling Block
161162
entities.CommunalHelper/CassetteFallingBlock.placements.name.cassette_block_0=Cassette Falling Block (0 - Blue)
@@ -166,6 +167,7 @@ entities.CommunalHelper/CassetteFallingBlock.attributes.description.index=The co
166167
entities.CommunalHelper/CassetteFallingBlock.attributes.description.tempo=The tempo of the cassette music in the room.
167168
entities.CommunalHelper/CassetteFallingBlock.attributes.description.customColor=Optional hexadecimal color code, visual-only change.
168169
entities.CommunalHelper/CassetteFallingBlock.attributes.description.oldConnectionBehavior=Force the old texture connection behavior (cassette entities connect to anything around them that is on the same index).
170+
entities.CommunalHelper/CassetteFallingBlock.attributes.description.held=Whether this Cassette Block is activated by holding the manual cassette key binding (using the Manual Cassette Controller).\nThis only works if this block's index is 0 or 1:\n- index 0: ACTIVE when key is HELD.\n- index 1: INACTIVE when key is HELD.
169171

170172
# Cassette Zip Mover
171173
entities.CommunalHelper/CassetteZipMover.placements.name.cassette_block_0=Cassette Zip Mover (0 - Blue)
@@ -180,6 +182,7 @@ entities.CommunalHelper/CassetteZipMover.attributes.description.waiting=Whether
180182
entities.CommunalHelper/CassetteZipMover.attributes.description.ticking=Causes this block to tick 5 times at every node before going back to its starting point, unless the player triggers it again. If `permanent` is true and the player doesn't trigger the Zip Mover in time, it'll lock in place.
181183
entities.CommunalHelper/CassetteZipMover.attributes.description.customColor=Optional hexadecimal color code, visual-only change.
182184
entities.CommunalHelper/CassetteZipMover.attributes.description.oldConnectionBehavior=Force the old texture connection behavior (cassette entities connect to anything around them that is on the same index).
185+
entities.CommunalHelper/CassetteZipMover.attributes.description.held=Whether this Cassette Block is activated by holding the manual cassette key binding (using the Manual Cassette Controller).\nThis only works if this block's index is 0 or 1:\n- index 0: ACTIVE when key is HELD.\n- index 1: INACTIVE when key is HELD.
183186

184187
# Cassette Move Block
185188
entities.CommunalHelper/CassetteMoveBlock.placements.name.cassette_block_0=Cassette Move Block (0 - Blue)
@@ -198,6 +201,7 @@ entities.CommunalHelper/CassetteMoveBlock.attributes.description.crashTime=The t
198201
entities.CommunalHelper/CassetteMoveBlock.attributes.description.regenTime=The time it takes for this Cassette Move Block to respawn after breaking in seconds.
199202
entities.CommunalHelper/CassetteMoveBlock.attributes.description.shakeOnCollision=Whether this Cassette Move Block should start shaking if it collides with a solid for longer than the default break time.
200203
entities.CommunalHelper/CassetteMoveBlock.attributes.description.noDebris=Whether this Cassette Move Block should not spawn debris when it breaks.
204+
entities.CommunalHelper/CassetteMoveBlock.attributes.description.held=Whether this Cassette Block is activated by holding the manual cassette key binding (using the Manual Cassette Controller).\nThis only works if this block's index is 0 or 1:\n- index 0: ACTIVE when key is HELD.\n- index 1: INACTIVE when key is HELD.
201205

202206
# Cassette Swap Block
203207
entities.CommunalHelper/CassetteSwapBlock.placements.name.cassette_block_0=Cassette Swap Block (0 - Blue)
@@ -209,6 +213,7 @@ entities.CommunalHelper/CassetteSwapBlock.attributes.description.index=The color
209213
entities.CommunalHelper/CassetteSwapBlock.attributes.description.tempo=The tempo of the cassette music in the room.
210214
entities.CommunalHelper/CassetteSwapBlock.attributes.description.customColor=Optional hexadecimal color code, visual-only change.
211215
entities.CommunalHelper/CassetteSwapBlock.attributes.description.oldConnectionBehavior=Force the old texture connection behavior (cassette entities connect to anything around them that is on the same index).
216+
entities.CommunalHelper/CassetteSwapBlock.attributes.description.held=Whether this Cassette Block is activated by holding the manual cassette key binding (using the Manual Cassette Controller).\nThis only works if this block's index is 0 or 1:\n- index 0: ACTIVE when key is HELD.\n- index 1: INACTIVE when key is HELD.
212217

213218
# Cassette Jump Fix Controller
214219
entities.CommunalHelper/CassetteJumpFixController.placements.name.controller=Cassette Jump Fix Controller

src/CommunalHelperModule.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public override void Load()
5858
// Panel-specific hooks loaded from AbstractPanel.Load
5959

6060
ConnectedSwapBlockHooks.Hook();
61-
CustomCassetteBlock.Hook();
61+
CustomCassetteBlock.Hook();
6262

6363
AttachedWallBooster.Hook();
6464
MoveBlockRedirect.Load();
@@ -157,7 +157,7 @@ public override void Unload()
157157
DreamDashCollider.Unload();
158158

159159
ConnectedSwapBlockHooks.Unhook();
160-
CustomCassetteBlock.Unhook();
160+
CustomCassetteBlock.Unhook();
161161

162162
AttachedWallBooster.Unhook();
163163
MoveBlockRedirect.Unload();
@@ -247,7 +247,7 @@ public override void Initialize()
247247
}
248248

249249
// Register CustomCassetteBlock types
250-
CustomCassetteBlock.Initialize();
250+
CustomCassetteBlock.Initialize();
251251

252252
// We may hook methods in other mods, so this needs to be done after they're loaded
253253
AbstractPanel.LoadDelayed();

src/Entities/CassetteBlocks/CassetteFallingBlock.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public class CassetteFallingBlock : CustomCassetteBlock
1010

1111
public bool HasStartedFalling { get; private set; }
1212

13-
public CassetteFallingBlock(Vector2 position, EntityID id, int width, int height, int index, float tempo, bool oldConnectionBehavior, Color? overrideColor)
14-
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior, dynamicHitbox: true, overrideColor)
13+
public CassetteFallingBlock(Vector2 position, EntityID id, int width, int height, int index, float tempo, bool oldConnectionBehavior, bool held ,Color? overrideColor)
14+
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior,held , dynamicHitbox: true, overrideColor)
1515
{
1616
Add(new Coroutine(Sequence()));
1717
}
1818

1919
public CassetteFallingBlock(EntityData data, Vector2 offset, EntityID id)
20-
: this(data.Position + offset, id, data.Width, data.Height, data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.HexColorNullable("customColor"))
20+
: this(data.Position + offset, id, data.Width, data.Height, data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.Bool("held"), data.HexColorNullable("customColor"))
2121
{ }
2222

2323
public override void OnStaticMoverTrigger(StaticMover sm)

src/Entities/CassetteBlocks/CassetteMoveBlock.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public class CassetteMoveBlock : CustomCassetteBlock
6262

6363
private readonly bool noDebris;
6464

65-
public CassetteMoveBlock(Vector2 position, EntityID id, int width, int height, Directions direction, float moveSpeed, int index, float tempo, bool oldConnectionBehavior, Color? overrideColor, float crashTime, float regenTime, bool shakeOnCollision, bool noDebris)
66-
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior, dynamicHitbox: true, overrideColor)
65+
public CassetteMoveBlock(Vector2 position, EntityID id, int width, int height, Directions direction, float moveSpeed, int index, float tempo, bool oldConnectionBehavior, bool held, Color? overrideColor, float crashTime, float regenTime, bool shakeOnCollision, bool noDebris)
66+
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior, held, dynamicHitbox: true, overrideColor)
6767
{
6868
startPosition = position;
6969
Direction = direction;
@@ -121,7 +121,7 @@ public CassetteMoveBlock(Vector2 position, EntityID id, int width, int height, D
121121
}
122122

123123
public CassetteMoveBlock(EntityData data, Vector2 offset, EntityID id)
124-
: this(data.Position + offset, id, data.Width, data.Height, data.Enum("direction", Directions.Left), data.Bool("fast") ? FastMoveSpeed : data.Float("moveSpeed", MoveSpeed), data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.HexColorNullable("customColor"), data.Float("crashTime", 0.15f), data.Float("regenTime", 3f), data.Bool("shakeOnCollision", true), data.Bool("noDebris"))
124+
: this(data.Position + offset, id, data.Width, data.Height, data.Enum("direction", Directions.Left), data.Bool("fast") ? FastMoveSpeed : data.Float("moveSpeed", MoveSpeed), data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.Bool("held"),data.HexColorNullable("customColor"), data.Float("crashTime", 0.15f), data.Float("regenTime", 3f), data.Bool("shakeOnCollision", true), data.Bool("noDebris"))
125125
{
126126
}
127127

src/Entities/CassetteBlocks/CassetteSwapBlock.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ private void DrawTarget(Vector2 position, Color color)
6565

6666
private readonly bool noReturn;
6767

68-
public CassetteSwapBlock(Vector2 position, EntityID id, int width, int height, Vector2 node, int index, float tempo, bool oldConnectionBehavior, bool noReturn, Color? overrideColor)
69-
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior, false, overrideColor)
68+
public CassetteSwapBlock(Vector2 position, EntityID id, int width, int height, Vector2 node, int index, float tempo, bool oldConnectionBehavior, bool held ,bool noReturn, Color? overrideColor)
69+
: base(position, id, width, height, index, tempo, true, oldConnectionBehavior, held ,false, overrideColor)
7070
{
7171
start = Position;
7272
end = node;
@@ -107,7 +107,7 @@ public CassetteSwapBlock(Vector2 position, EntityID id, int width, int height, V
107107
}
108108

109109
public CassetteSwapBlock(EntityData data, Vector2 offset, EntityID id)
110-
: this(data.Position + offset, id, data.Width, data.Height, data.Nodes[0] + offset, data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.Bool("noReturn", false), data.HexColorNullable("customColor"))
110+
: this(data.Position + offset, id, data.Width, data.Height, data.Nodes[0] + offset, data.Int("index"), data.Float("tempo", 1f), data.Bool("oldConnectionBehavior", true), data.Bool("held"), data.Bool("noReturn", false), data.HexColorNullable("customColor"))
111111
{
112112
}
113113

0 commit comments

Comments
 (0)