Skip to content

Commit 20d96da

Browse files
authored
Merge pull request CommunalHelper#254 from aonkeeper4/cassette-aero-blocks-v2
Add cassette functionality to Charged Aero Blocks
2 parents 213cfe0 + 5f27182 commit 20d96da

File tree

4 files changed

+409
-186
lines changed

4 files changed

+409
-186
lines changed

Loenn/entities/aero/aero_block_charged.lua

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
local drawableNinePatch = require "structs.drawable_nine_patch"
22
local drawableRectangle = require "structs.drawable_rectangle"
33
local utils = require "utils"
4+
local communalHelper = require("mods").requireFromPlugin("libraries.communal_helper")
5+
6+
local cassetteIndexOptions = {
7+
["None"] = -1,
8+
["0 - Blue"] = 0,
9+
["1 - Rose"] = 1,
10+
["2 - Bright Sun"] = 2,
11+
["3 - Malachite"] = 3
12+
}
13+
local cassetteIndexColors = communalHelper.cassetteBlockHexColors
414

515
local aeroBlockCharged = {}
616

717
aeroBlockCharged.name = "CommunalHelper/AeroBlockCharged"
818
aeroBlockCharged.depth = 4999
9-
aeroBlockCharged.minimumSize = {16, 16}
19+
aeroBlockCharged.minimumSize = { 16, 16 }
1020

11-
aeroBlockCharged.nodeLimits = {0, -1}
21+
aeroBlockCharged.nodeLimits = { 0, -1 }
1222
aeroBlockCharged.nodeLineRenderType = "line"
1323

1424
aeroBlockCharged.fieldInformation = {
@@ -17,6 +27,14 @@ aeroBlockCharged.fieldInformation = {
1727
},
1828
inactiveColor = {
1929
fieldType = "color"
30+
},
31+
cassetteIndex = {
32+
options = cassetteIndexOptions,
33+
editable = false,
34+
fieldType = "integer",
35+
},
36+
cassetteTempo = {
37+
minimumValue = 0
2038
}
2139
}
2240

@@ -31,16 +49,38 @@ aeroBlockCharged.placements = {
3149
loop = false,
3250
activeColor = "4BC0C8",
3351
inactiveColor = "FF6347",
34-
easing = "CubeIn",
3552
-- SpirialisBug = false,
3653
SpirialisBugV2 = false,
37-
wallbounceLeniency = true
54+
wallbounceLeniency = true,
55+
cassetteIndex = -1,
56+
cassetteTempo = 1,
57+
moveOnCassetteTick = false
3858
}
3959
}
4060
}
61+
for i = 0, 3 do
62+
table.insert(aeroBlockCharged.placements, {
63+
name = string.format("aero_block_charged_%s", i),
64+
data = {
65+
width = 16,
66+
height = 16,
67+
buttonSequence = "left -> right+top",
68+
hover = true,
69+
loop = false,
70+
activeColor = cassetteIndexColors[i + 1],
71+
inactiveColor = "FF6347",
72+
-- SpirialisBug = false,
73+
SpirialisBugV2 = false,
74+
wallbounceLeniency = true,
75+
cassetteIndex = i,
76+
cassetteTempo = 1,
77+
moveOnCassetteTick = false
78+
}
79+
})
80+
end
4181

42-
local backgroundColor = {20 / 255, 3 / 255, 3 / 255}
43-
local outlineColor = {0, 0, 0}
82+
local backgroundColor = { 20 / 255, 3 / 255, 3 / 255 }
83+
local outlineColor = { 0, 0, 0 }
4484
local blockTexture = "objects/CommunalHelper/aero_block/blocks/nnn"
4585

4686
local blockNinePatchOptions = {
@@ -60,6 +100,12 @@ function aeroBlockCharged.sprite(room, entity)
60100
table.insert(sprites, outline:getDrawableSprite())
61101
table.insert(sprites, rectangle:getDrawableSprite())
62102

103+
if entity.cassetteIndex and entity.cassetteIndex ~= -1 then
104+
local cassetteIndicatorColor = entity.activeColor ~= "" and communalHelper.hexToColor(entity.activeColor) or cassetteIndexColors[entity.cassetteIndex + 1]
105+
local cassetteIndicator = drawableRectangle.fromRectangle("fill", x + 4, y + 4, width - 8, height - 8, cassetteIndicatorColor)
106+
table.insert(sprites, cassetteIndicator:getDrawableSprite())
107+
end
108+
63109
local frameNinePatch = drawableNinePatch.fromTexture(blockTexture, blockNinePatchOptions, x, y, width, height)
64110
local frameSprites = frameNinePatch:getDrawableSprite()
65111

@@ -85,4 +131,4 @@ function aeroBlockCharged.selection(room, entity)
85131
return rect, noderects
86132
end
87133

88-
return aeroBlockCharged
134+
return aeroBlockCharged

Loenn/lang/en_gb.lang

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -741,15 +741,22 @@ entities.CommunalHelper/AeroBlockFlying.attributes.description.endColor=The endi
741741

742742
# Aero Block Charged
743743
entities.CommunalHelper/AeroBlockCharged.placements.name.aero_block_charged=Charged Aero Block
744-
entities.CommunalHelper/AeroBlockCharged.attributes.description.buttonSequence=Text that describes how the buttons of this block are shown and hidden as the block moves to each node. It is parsed by the entity, so this field must follow a specified format:\n\nFor each node, you can have the LEFT, RIGHT, and TOP buttons enabled or not.\nTo combine multiple buttons, use the + operator. For instance: LEFT+RIGHT represents both the left and right button enabled, while the top one is off.\n\nThere are other keywords that represent multiple buttons at once: HORIZONTAL, VERTICAL, ALL, NONE:\n * HORIZONTAL = LEFT + RIGHT\n * VERTICAL = TOP\n * ALL = TOP + LEFT + RIGHT\n * NONE: (no buttons)\n\nIf you have multiple nodes, you must use the -> operator (a hyphen followed by a right-chevron, aka. "greater than") to indicate that whatever follows is for the next node.\nFor instance: LEFT+RIGHT -> TOP will start the block with the left and right buttons on, and when the blocks moves at the next node, only the top button will be on.\nYou don't necessarily have to write as many -> transitions as nodes this entity has, because the button sequence will just loop back if it reaches its end before the block ends its node sequence.\nYou must not have more transitions than nodes. In such a case, the extra button combinations are discarded.\n\nEvery word can be lowercase (they are case-insensitive).\nOther words that are not LEFT, RIGHT, TOP, HORIZONTAL, VERTICAL, ALL, NONE, will be dismissed and a warning will be printed in the log.\nLeading & trailing whitespaces are discarded, so feel free to format the string the way you prefer.\n\nHere are more examples of valid sequences:\n * LEFT\n * HORIZONTAL -> TOP + LEFT\n * right->left->tOP->All\n * ALL -> none + LEFT+right -> rIgHt\n\nCheck the log if something goes wrong, you'll find the error messages there.
745-
entities.CommunalHelper/AeroBlockCharged.attributes.description.hover=Whether this block has a hovering "floating" movement to it. If disable, the block stays in place until it needs to move.
746-
entities.CommunalHelper/AeroBlockCharged.attributes.description.loop=Whether this block's sequence has no ending. When the last node is reached, it loops back around to the initial position.
747-
entities.CommunalHelper/AeroBlockCharged.attributes.description.activeColor=This block's button and screen particles color when it is active (flying).
748-
entities.CommunalHelper/AeroBlockCharged.attributes.description.inactiveColor=This block's button colors when it is inactive.
749-
entities.CommunalHelper/AeroBlockCharged.attributes.description.SpirialisBug=This enables a bug where Spirialis Helper will override the player's jump speed with the boost from an Aero Block, even when Spirialis Helper is not enabled.\nThis effectively makes your vertical momentum much stronger than normal from aeroblocks in most, but not all, cases.\n(Legacy, replace this block for an improved version of this toggle.)
744+
entities.CommunalHelper/AeroBlockCharged.placements.name.aero_block_charged_0=Charged Aero Block (Cassette, 0 - Blue)
745+
entities.CommunalHelper/AeroBlockCharged.placements.name.aero_block_charged_1=Charged Aero Block (Cassette, 1 - Rose)
746+
entities.CommunalHelper/AeroBlockCharged.placements.name.aero_block_charged_2=Charged Aero Block (Cassette, 2 - Bright Sun)
747+
entities.CommunalHelper/AeroBlockCharged.placements.name.aero_block_charged_3=Charged Aero Block (Cassette, 3 - Malachite)
748+
entities.CommunalHelper/AeroBlockCharged.attributes.description.buttonSequence=Text that describes how the buttons of this block are shown and hidden as the block moves to each node. It is parsed by the entity, so this field must follow a specified format:\n\nFor each node, you can have the LEFT, RIGHT, and TOP buttons either enabled or not.\nTo combine multiple buttons, use a "+" symbol. For instance: LEFT+RIGHT represents both the left and right button being enabled, while the top one is not.\n\nThere are other keywords that represent multiple buttons at once: HORIZONTAL, VERTICAL, ALL, NONE:\n * HORIZONTAL = LEFT + RIGHT\n * VERTICAL = TOP\n * ALL = TOP + LEFT + RIGHT\n * NONE: (no buttons)\n\nIf you have multiple nodes, you must list the buttons for each node, separated by "->".\nFor instance: LEFT+RIGHT -> TOP will start the block with the left and right buttons on, and when the blocks moves to the next node, only the top button will be on.\nYou don't necessarily have to write as many button combinations as the number of nodes this entity has, because the button sequence will loop if it is exhausted before the block reaches the end of its node sequence.\nHowever, you should not have more button combinations than nodes as the extra button combinations will be discarded.\n\nWord capitalization does not matter.\nWords that are not LEFT, RIGHT, TOP, HORIZONTAL, VERTICAL, ALL or NONE will be dismissed and a warning will be printed in the log.\nLeading & trailing whitespaces are discarded, so feel free to format the string the way you prefer.\n\nHere are more examples of valid sequences:\n * LEFT\n * HORIZONTAL -> TOP + LEFT\n * right->left->tOP->All\n * ALL -> none + LEFT+right -> rIgHt\n\nIf something goes wrong, check the log; you'll find the error messages there.
749+
entities.CommunalHelper/AeroBlockCharged.attributes.description.hover=Whether this block has a "floating" movement when idle. If disabled, the block stays in place until it needs to move.
750+
entities.CommunalHelper/AeroBlockCharged.attributes.description.loop=Whether when the last node of this block's sequence is reached, it should loop back around to the initial position instead of becoming inactive.
751+
entities.CommunalHelper/AeroBlockCharged.attributes.description.activeColor=This block's button and screen particle color when it is active.
752+
entities.CommunalHelper/AeroBlockCharged.attributes.description.inactiveColor=This block's button color when it is inactive.
753+
entities.CommunalHelper/AeroBlockCharged.attributes.description.SpirialisBug=This enables a bug where Spirialis Helper will override the player's jump speed with the boost from an Aero Block, even when Spirialis Helper is not enabled.\nThis effectively makes your vertical momentum much stronger than normal from Aero Blocks in most, but not all, cases.\n(Legacy, replace this block for an improved version of this toggle.)
750754
entities.CommunalHelper/AeroBlockCharged.attributes.name.SpirialisBugV2=Stronger Vertical Boost
751755
entities.CommunalHelper/AeroBlockCharged.attributes.description.SpirialisBugV2=This enables a legacy behavior (originally caused by Spirialis Helper) where the player's jump speed will be overridden with the boost from an Aero Block.\nTurning this on effectively makes your vertical momentum from Aero Blocks much stronger than normal in most cases.
752-
entities.CommunalHelper/AeroBlockCharged.attributes.description.wallbounceLeniency=Allows wallbounces up to all 5 pixels of horizontal leniency to receive the boost from this block instead of only ones within the first 3 pixels.\nThis prevents there from being a 2 pixel window where you can wallbounce without receiving the boost.
756+
entities.CommunalHelper/AeroBlockCharged.attributes.description.wallbounceLeniency=Allows wallbounces up to all 5 pixels of horizontal leniency to receive the boost from this block instead of only the first 3 pixels.\nThis prevents there from being a 2 pixel window where you can wallbounce without receiving the boost.
757+
entities.CommunalHelper/AeroBlockCharged.attributes.description.cassetteIndex=The cassette index of this Charged Aero Block. If set to anything other than "None", the buttons on this block will (de)activate in sync with cassette blocks of this index.
758+
entities.CommunalHelper/AeroBlockCharged.attributes.description.cassetteTempo=The cassette tempo of this Charged Aero Block. See the tooltip of the "Tempo" field on Cassette Blocks for a thorough explanation.\nDoes nothing if "Cassette Index" is set to "None".
759+
entities.CommunalHelper/AeroBlockCharged.attributes.description.moveOnCassetteTick=Whether this block will move to the next node at the end of the current cassette tick if it has not already been activated.\nDoes nothing if "Cassette Index" is set to "None".
753760

754761
# Aero Block Slingshot
755762
entities.CommunalHelper/AeroBlockSlingshot.placements.name.normal=Slingshot Aero Block

0 commit comments

Comments
 (0)