Skip to content

Commit c438e4a

Browse files
authored
Merge branch 'master' into troll_berry
2 parents 2e13c12 + 0ffeb1b commit c438e4a

17 files changed

+555
-38
lines changed

Ahorn/entities/bubblePushField.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "SpringCollab2020/bubblePushField" BubblePushField(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight, strength::Number=1, upwardStrength::Number=1, direction::String="Right", water::Bool=true)
5+
@mapdef Entity "SpringCollab2020/bubblePushField" BubblePushField(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight,
6+
strength::Number=1.0, upwardStrength::Number=1.0, direction::String="Right", water::Bool=true, flag::String="bubble_push_field", activationMode::String="Always")
67

78
const placements = Ahorn.PlacementDict(
89
"Bubble Column (Spring Collab 2020)" => Ahorn.EntityPlacement(
@@ -12,7 +13,8 @@ const placements = Ahorn.PlacementDict(
1213
)
1314

1415
Ahorn.editingOptions(entity::BubblePushField) = Dict{String,Any}(
15-
"direction" => ["Up", "Down", "Left", "Right"]
16+
"direction" => ["Up", "Down", "Left", "Right"],
17+
"activationMode" => ["Always", "OnlyWhenFlagActive", "OnlyWhenFlagInactive"]
1618
)
1719

1820
Ahorn.minimumSize(entity::BubblePushField) = 8, 8

Ahorn/entities/customSandwichLava.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using ..Ahorn, Maple
44

55
@mapdef Entity "SpringCollab2020/CustomSandwichLava" CustomSandwichLava(x::Integer, y::Integer,
6-
direction::String="CoreModeBased", speed::Number=20, sandwichGap::Number=160)
6+
direction::String="CoreModeBased", speed::Number=20.0, sandwichGap::Number=160.0)
77

88
const directions = String["AlwaysUp", "AlwaysDown", "CoreModeBased"]
99

Ahorn/entities/floatierSpaceBlock.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module SpringCollab2020FloatierSpaceBlock
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "SpringCollab2020/floatierSpaceBlock" FloatierSpaceBlock(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight, tiletype::String="3", disableSpawnOffset::Bool=false, floatinessMultiplier::Number=1, bounceBackMultiplier::Number=1)
5+
@mapdef Entity "SpringCollab2020/floatierSpaceBlock" FloatierSpaceBlock(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight, tiletype::String="3", disableSpawnOffset::Bool=false, floatinessMultiplier::Number=1.0, bounceBackMultiplier::Number=1.0)
66

77
const placements = Ahorn.PlacementDict(
88
"Floatier Space Block (Spring Collab 2020)" => Ahorn.EntityPlacement(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module SpringCollab2020HorizontalRoomWrapController
2+
3+
using ..Ahorn, Maple
4+
5+
@mapdef Entity "SpringCollab2020/HorizontalRoomWrapController" HorizontalRoomWrapController(x::Integer, y::Integer)
6+
7+
const placements = Ahorn.PlacementDict(
8+
"Horizontal Room Wrap Controller (Spring Collab 2020)" => Ahorn.EntityPlacement(
9+
HorizontalRoomWrapController
10+
)
11+
)
12+
13+
function Ahorn.selection(entity::HorizontalRoomWrapController)
14+
x, y = Ahorn.position(entity)
15+
16+
return Ahorn.Rectangle(x - 12, y - 12, 24, 24)
17+
end
18+
19+
Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::HorizontalRoomWrapController, room::Maple.Room) = Ahorn.drawSprite(ctx, "ahorn/SpringCollab2020/horizontal_room_wrap", 0, 0)
20+
21+
end

Ahorn/entities/invisibleLightSource.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "SpringCollab2020/invisibleLightSource" InvisibleLightSource(x::Integer, y::Integer, alpha::Number=1, radius::Number=48, startFade::Number=24, endFade::Number=48, color::String="White")
5+
@mapdef Entity "SpringCollab2020/invisibleLightSource" InvisibleLightSource(x::Integer, y::Integer, alpha::Number=1.0, radius::Number=48.0, startFade::Number=24.0, endFade::Number=48.0, color::String="White")
66

77
const colors = sort(collect(keys(Ahorn.XNAColors.colors)))
88

Ahorn/entities/moveBlockCustomSpeed.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using ..Ahorn, Maple
44

55
@mapdef Entity "SpringCollab2020/MoveBlockCustomSpeed" MoveBlockCustomSpeed(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight,
6-
direction::String="Up", canSteer::Bool=false, moveSpeed::Number=60)
6+
direction::String="Up", canSteer::Bool=false, moveSpeed::Number=60.0)
77

88
const placements = Ahorn.PlacementDict()
99

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
module SpringCollab2020MultiNodeMovingPlatform
2+
3+
using ..Ahorn, Maple
4+
5+
@pardef MultiNodeMovingPlatform(x::Integer, y::Integer, width::Integer=Maple.defaultBlockWidth, mode::String="Loop", texture::String="default", moveTime::Number=2.0, pauseTime::Number=0.0, easing::Bool=true) =
6+
Entity("SpringCollab2020/MultiNodeMovingPlatform", x=x, y=y, nodes=Tuple{Int, Int}[], width=width, mode=mode, texture=texture, moveTime=moveTime, pauseTime=pauseTime, easing=easing)
7+
8+
const placements = Ahorn.PlacementDict()
9+
10+
const modes = ["Loop", "LoopNoPause", "BackAndForth", "BackAndForthNoPause", "TeleportBack"]
11+
12+
for texture in Maple.wood_platform_textures
13+
placements["Platform (Moving, Multi-Node, $(uppercasefirst(texture))) (Spring Collab 2020)"] = Ahorn.EntityPlacement(
14+
MultiNodeMovingPlatform,
15+
"rectangle",
16+
Dict{String, Any}(
17+
"texture" => texture
18+
),
19+
function(entity)
20+
x, y = Int(entity.data["x"]), Int(entity.data["y"])
21+
width = Int(get(entity.data, "width", 8))
22+
entity.data["x"], entity.data["y"] = x + width, y
23+
entity.data["nodes"] = [(x, y)]
24+
end
25+
)
26+
end
27+
28+
Ahorn.editingOptions(entity::MultiNodeMovingPlatform) = Dict{String, Any}(
29+
"texture" => Maple.wood_platform_textures,
30+
"mode" => modes
31+
)
32+
33+
Ahorn.nodeLimits(entity::MultiNodeMovingPlatform) = 1, -1
34+
35+
Ahorn.resizable(entity::MultiNodeMovingPlatform) = true, false
36+
37+
Ahorn.minimumSize(entity::MultiNodeMovingPlatform) = 8, 0
38+
39+
function Ahorn.selection(entity::MultiNodeMovingPlatform)
40+
width = Int(get(entity.data, "width", 8))
41+
42+
nodes = get(entity.data, "nodes", ())
43+
startX, startY = Int(entity.data["x"]), Int(entity.data["y"])
44+
rectangles = Ahorn.Rectangle[Ahorn.Rectangle(startX, startY, width, 8)]
45+
46+
for node in nodes
47+
nodeX, nodeY = Int.(node)
48+
push!(rectangles, Ahorn.Rectangle(nodeX, nodeY, width, 8))
49+
end
50+
51+
return rectangles
52+
end
53+
54+
outerColor = (30, 14, 25) ./ 255
55+
innerColor = (10, 0, 6) ./ 255
56+
57+
function renderConnection(ctx::Ahorn.Cairo.CairoContext, x::Number, y::Number, nx::Number, ny::Number, width::Number)
58+
cx, cy = x + floor(Int, width / 2), y + 4
59+
cnx, cny = nx + floor(Int, width / 2), ny + 4
60+
61+
length = sqrt((x - nx)^2 + (y - ny)^2)
62+
theta = atan(cny - cy, cnx - cx)
63+
64+
Ahorn.Cairo.save(ctx)
65+
66+
Ahorn.translate(ctx, cx, cy)
67+
Ahorn.rotate(ctx, theta)
68+
69+
Ahorn.setSourceColor(ctx, outerColor)
70+
Ahorn.set_antialias(ctx, 1)
71+
Ahorn.set_line_width(ctx, 3);
72+
73+
Ahorn.move_to(ctx, 0, 0)
74+
Ahorn.line_to(ctx, length, 0)
75+
76+
Ahorn.stroke(ctx)
77+
78+
Ahorn.setSourceColor(ctx, innerColor)
79+
Ahorn.set_antialias(ctx, 1)
80+
Ahorn.set_line_width(ctx, 1);
81+
82+
Ahorn.move_to(ctx, 0, 0)
83+
Ahorn.line_to(ctx, length, 0)
84+
85+
Ahorn.stroke(ctx)
86+
87+
Ahorn.Cairo.restore(ctx)
88+
end
89+
90+
function renderPlatform(ctx::Ahorn.Cairo.CairoContext, texture::String, x::Number, y::Number, width::Number)
91+
tilesWidth = div(width, 8)
92+
93+
for i in 2:tilesWidth - 1
94+
Ahorn.drawImage(ctx, "objects/woodPlatform/$texture", x + 8 * (i - 1), y, 8, 0, 8, 8)
95+
end
96+
97+
Ahorn.drawImage(ctx, "objects/woodPlatform/$texture", x, y, 0, 0, 8, 8)
98+
Ahorn.drawImage(ctx, "objects/woodPlatform/$texture", x + tilesWidth * 8 - 8, y, 24, 0, 8, 8)
99+
Ahorn.drawImage(ctx, "objects/woodPlatform/$texture", x + floor(Int, width / 2) - 4, y, 16, 0, 8, 8)
100+
end
101+
102+
function Ahorn.renderAbs(ctx::Ahorn.Cairo.CairoContext, entity::MultiNodeMovingPlatform, room::Maple.Room)
103+
width = Int(get(entity.data, "width", 8))
104+
mode = get(entity.data, "mode", "Loop")
105+
106+
firstNodeX, firstNodeY = Int(entity.data["x"]), Int(entity.data["y"])
107+
previousNodeX, previousNodeY = firstNodeX, firstNodeY
108+
109+
texture = get(entity.data, "texture", "default")
110+
111+
nodes = get(entity.data, "nodes", ())
112+
for node in nodes
113+
nodeX, nodeY = Int.(node)
114+
renderConnection(ctx, previousNodeX, previousNodeY, nodeX, nodeY, width)
115+
previousNodeX, previousNodeY = nodeX, nodeY
116+
end
117+
118+
if mode == "Loop" || mode == "LoopNoPause"
119+
renderConnection(ctx, previousNodeX, previousNodeY, firstNodeX, firstNodeY, width)
120+
end
121+
122+
renderPlatform(ctx, texture, firstNodeX, firstNodeY, width)
123+
end
124+
125+
function Ahorn.renderSelectedAbs(ctx::Ahorn.Cairo.CairoContext, entity::MultiNodeMovingPlatform, room::Maple.Room)
126+
width = Int(get(entity.data, "width", 8))
127+
mode = get(entity.data, "mode", "Loop")
128+
129+
firstNodeX, firstNodeY = Int(entity.data["x"]), Int(entity.data["y"])
130+
previousNodeX, previousNodeY = firstNodeX, firstNodeY
131+
132+
texture = get(entity.data, "texture", "default")
133+
134+
nodes = get(entity.data, "nodes", ())
135+
for node in nodes
136+
nodeX, nodeY = Int.(node)
137+
renderPlatform(ctx, texture, nodeX, nodeY, width)
138+
Ahorn.drawArrow(ctx, previousNodeX + width / 2, previousNodeY, nodeX + width / 2, nodeY, Ahorn.colors.selection_selected_fc, headLength=6)
139+
previousNodeX, previousNodeY = nodeX, nodeY
140+
end
141+
142+
if mode == "Loop" || mode == "LoopNoPause"
143+
Ahorn.drawArrow(ctx, previousNodeX + width / 2, previousNodeY, firstNodeX + width / 2, firstNodeY, Ahorn.colors.selection_selected_fc, headLength=6)
144+
end
145+
end
146+
147+
end

Ahorn/entities/sidewaysLava.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module SpringCollab2020SidewaysLava
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "SpringCollab2020/SidewaysLava" SidewaysLava(x::Integer, y::Integer, intro::Bool=false, lavaMode::String="LeftToRight", speedMultiplier::Number=1)
5+
@mapdef Entity "SpringCollab2020/SidewaysLava" SidewaysLava(x::Integer, y::Integer, intro::Bool=false, lavaMode::String="LeftToRight", speedMultiplier::Number=1.0)
66

77
const lavaModes = String["LeftToRight", "RightToLeft", "Sandwich"]
88

Ahorn/lang/en_gb.lang

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
# Diagonal Winged Strawberry
2-
32
placements.entities.SpringCollab2020/diagonalWingedStrawberry.tooltips.order=The order within a checkpoint. When -1, Everest automatically sets it.
43
placements.entities.SpringCollab2020/diagonalWingedStrawberry.tooltips.checkpointID=The checkpoint the berry is located within. When -1, Everest automatically sets it.
54

5+
# Bubble Return Strawberry
6+
placements.entities.SpringCollab2020/returnBerry.tooltips.winged=Flies away upon dashing.
7+
placements.entities.SpringCollab2020/returnBerry.tooltips.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)
8+
placements.entities.SpringCollab2020/returnBerry.tooltips.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)
9+
10+
# Glass Berry
11+
placements.entities.SpringCollab2020/glassBerry.tooltips.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)
12+
placements.entities.SpringCollab2020/glassBerry.tooltips.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)
13+
14+
# Lightning Dash Switch
15+
placements.entities.SpringCollab2020/LightningDashSwitch.tooltips.side=Which direction the switch is facing.
16+
placements.entities.SpringCollab2020/LightningDashSwitch.tooltips.sprite=Changes the visual appearance of the switch.
17+
placements.entities.SpringCollab2020/LightningDashSwitch.tooltips.persistent=Whether or not the switch will stay pressed upon leaving the room.
18+
19+
620
# Cave Wall
721
placements.entities.SpringCollab2020/caveWall.tooltips.tiletype=Changes the visual appearance of the wall.
822

923
# Variable Crumble Blocks
10-
1124
placements.entities.SpringCollab2020/variableCrumbleBlock.tooltips.texture=The texture of the blocks that are crumbling.2
1225
placements.entities.SpringCollab2020/variableCrumbleBlock.tooltips.timer=How long the blocks will shake for before falling.
1326

@@ -47,6 +60,8 @@ placements.entities.SpringCollab2020/bubblePushField.tooltips.strength=The stren
4760
placements.entities.SpringCollab2020/bubblePushField.tooltips.upwardStrength=How much the bubbles push the player up to compensate for gravity.
4861
placements.entities.SpringCollab2020/bubblePushField.tooltips.direction=The direction the bubbles push the player.
4962
placements.entities.SpringCollab2020/bubblePushField.tooltips.water=If the bubble field will create a Water entity to make its presence visible.
63+
placements.entities.SpringCollab2020/bubblePushField.tooltips.activationMode=Determines on which condition the bubble column activates.
64+
placements.entities.SpringCollab2020/bubblePushField.tooltips.flag=The session flag this bubble push field reacts to (when Activation Mode is "only if flag (in)active").
5065

5166
# Upside Down Jump Thru
5267
placements.entities.SpringCollab2020/UpsideDownJumpThru.tooltips.texture=Changes the appearance of the platform.
@@ -129,4 +144,11 @@ placements.triggers.SpringCollab2020/CustomBirdTutorialTrigger.tooltips.birdId=T
129144
placements.triggers.SpringCollab2020/CustomBirdTutorialTrigger.tooltips.showTutorial=If checked, the trigger will make the bird show the tutorial bubble. If unchecked, the trigger will make the bird fly away.
130145

131146
# Troll Strawberry
132-
placements.entities.SpringCollab2020/trollStrawberry.tooltips.winged=The strawberry attempts to vertically rise offscreen when the player dashes.
147+
placements.entities.SpringCollab2020/trollStrawberry.tooltips.winged=The strawberry attempts to vertically rise offscreen when the player dashes.
148+
149+
# Multi-Node Moving Platform
150+
placements.entities.SpringCollab2020/MultiNodeMovingPlatform.tooltips.moveTime=The time the platform takes to move between two successive positions. Default is 2 seconds.
151+
placements.entities.SpringCollab2020/MultiNodeMovingPlatform.tooltips.pauseTime=The time the platform stops at each position. Default is 0 seconds.
152+
placements.entities.SpringCollab2020/MultiNodeMovingPlatform.tooltips.mode=Determines the way the platform will move between its nodes. For example, with 3 nodes A, B, C:\n- Loop: A > B > C > A\n- LoopNoPause: A > A (going through B and C)\n- BackAndForth: A > B > C > B > A\n- BackAndForthNoPause: A > C > A (going through B)\n- TeleportBack: A > B > C, then the platform teleports to A upon reaching C
153+
placements.entities.SpringCollab2020/MultiNodeMovingPlatform.tooltips.texture=What texture to use for the platform.
154+
placements.entities.SpringCollab2020/MultiNodeMovingPlatform.tooltips.easing=Whether the platform movement should be eased (speedup/slowdown around each position).

Ahorn/triggers/customSandwichLavaSettings.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module SpringCollab2020CustomSandwichLavaSettingsTrigger
33
using ..Ahorn, Maple
44

55
@mapdef Trigger "SpringCollab2020/CustomSandwichLavaSettingsTrigger" CustomSandwichLavaSettingsTrigger(x::Integer, y::Integer, width::Integer=Maple.defaultTriggerWidth, height::Integer=Maple.defaultTriggerHeight,
6-
onlyOnce::Bool=false, direction::String="CoreModeBased", speed::Number=20)
6+
onlyOnce::Bool=false, direction::String="CoreModeBased", speed::Number=20.0)
77

88
const directions = String["AlwaysUp", "AlwaysDown", "CoreModeBased"]
99

0 commit comments

Comments
 (0)