Skip to content

Commit 6c47cb5

Browse files
committed
add registerstrawberry attribute to dream strawberries + add placement for a tracked version
1 parent b78dc90 commit 6c47cb5

File tree

3 files changed

+48
-31
lines changed

3 files changed

+48
-31
lines changed
Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
11
local utils = require("utils")
22

3-
local dreamDashBerry = {}
4-
5-
dreamDashBerry.name = "CommunalHelper/DreamStrawberry"
6-
dreamDashBerry.depth = -100
7-
dreamDashBerry.nodeLineRenderType = "fan"
8-
dreamDashBerry.nodeLimits = {0, -1}
9-
10-
dreamDashBerry.fieldInformation = {
11-
order = {
12-
fieldType = "integer"
13-
},
14-
checkpointID = {
15-
fieldType = "integer"
3+
local function createHandler(name)
4+
handler = {}
5+
6+
handler.name = name
7+
handler.depth = -100
8+
handler.nodeLineRenderType = "fan"
9+
handler.nodeLimits = {0, -1}
10+
11+
handler.fieldInformation = {
12+
order = {
13+
fieldType = "integer"
14+
},
15+
checkpointID = {
16+
fieldType = "integer"
17+
}
1618
}
17-
}
1819

19-
dreamDashBerry.placements = {
20-
name = "dream_dash_berry",
21-
data = {
22-
order = -1,
23-
checkpointID = -1
20+
handler.placements = {
21+
name = "dream_dash_berry",
22+
data = {
23+
order = -1,
24+
checkpointID = -1
25+
}
2426
}
25-
}
2627

27-
dreamDashBerry.texture = "collectables/CommunalHelper/dreamberry/wings01"
28-
dreamDashBerry.nodeTexture = "collectables/CommunalHelper/dreamberry/seed02"
28+
handler.texture = "collectables/CommunalHelper/dreamberry/wings01"
29+
handler.nodeTexture = "collectables/CommunalHelper/dreamberry/seed02"
2930

30-
function dreamDashBerry.selection(room, entity)
31-
local x, y = entity.x or 0, entity.y or 0
32-
local nodes = entity.nodes or {{x = 0, y = 0}}
31+
function handler.selection(room, entity)
32+
local x, y = entity.x or 0, entity.y or 0
33+
local nodes = entity.nodes or {{x = 0, y = 0}}
3334

34-
local rects = {}
35-
for _, node in ipairs(nodes) do
36-
local nx, ny = node.x or 0, node.y or 0
37-
table.insert(rects, utils.rectangle(nx - 4, ny - 4, 7, 9))
35+
local rects = {}
36+
for _, node in ipairs(nodes) do
37+
local nx, ny = node.x or 0, node.y or 0
38+
table.insert(rects, utils.rectangle(nx - 4, ny - 4, 7, 9))
39+
end
40+
41+
return utils.rectangle(x - 6, y - 7, 12, 13), rects
3842
end
3943

40-
return utils.rectangle(x - 6, y - 7, 12, 13), rects
44+
return handler
4145
end
4246

43-
return dreamDashBerry
47+
return createHandler("CommunalHelper/DreamStrawberry"), createHandler("CommunalHelper/DreamStrawberryTracked")

Loenn/lang/en_gb.lang

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ entities.CommunalHelper/RedlessBerry.attributes.description.winged=Makes this Re
672672
entities.CommunalHelper/DreamStrawberry.placements.name.dream_dash_berry=Dream Strawberry
673673
entities.CommunalHelper/DreamStrawberry.attributes.description.checkpointID=Manually determine what checkpoint section strawberries are visually grouped up in, showing up on the start menu during gameplay and level select. Overrides Everest's automatic berry IDs. (Default= -1)
674674
entities.CommunalHelper/DreamStrawberry.attributes.description.order=Manually determine what order strawberries are visually placed in on the start menu during gameplay and level select. Overrides Everest's automatic berry IDs. (Default= -1)
675+
entities.CommunalHelper/DreamStrawberryTracked.placements.name.dream_dash_berry=Dream Strawberry (Counts Toward Total)
676+
entities.CommunalHelper/DreamStrawberryTracked.attributes.description.checkpointID=Manually determine what checkpoint section strawberries are visually grouped up in, showing up on the start menu during gameplay and level select. Overrides Everest's automatic berry IDs. (Default= -1)
677+
entities.CommunalHelper/DreamStrawberryTracked.attributes.description.order=Manually determine what order strawberries are visually placed in on the start menu during gameplay and level select. Overrides Everest's automatic berry IDs. (Default= -1)
675678

676679
# Seeker Dash Refill
677680
entities.CommunalHelper/SeekerDashRefill.placements.name.seeker_dash_refill=Seeker Dash Refill

src/Entities/Misc/DreamStrawberry.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Celeste.Mod.CommunalHelper.Entities;
99
// Originally I made this as a standalone entity for someone's map they were working on, but to make this fully work with DreamTunnelDash I moved it to CommunalHelper
1010
// I gave them a plugin for the old version when i finished and I'd like to keep some compatability to the old version so they dont have to redo their berries using it
1111
[CustomEntity("CommunalHelper/DreamStrawberry", "DreamDashListener/DreamDashBerry")]
12+
[RegisterStrawberry(false, false)]
1213
public class DreamStrawberry : Strawberry
1314
{
1415
// Original OnDash method from Celeste.Strawberry
@@ -174,3 +175,12 @@ private static void Player_ctor(On.Celeste.Player.orig_ctor orig, Player self, V
174175

175176
#endregion
176177
}
178+
179+
// is this the right way to do it? maybe!
180+
[CustomEntity("CommunalHelper/DreamStrawberryTracked")]
181+
[RegisterStrawberry(true, false)]
182+
public class DreamStrawberryTracked : DreamStrawberry
183+
{
184+
public DreamStrawberryTracked(EntityData data, Vector2 offset, EntityID id) : base(data, offset, id)
185+
{ }
186+
}

0 commit comments

Comments
 (0)