Skip to content

Commit a2c22dd

Browse files
authored
Merge pull request #102 from AdamKorinek/customSwitchBorder
Added custom border option for custom moving touch switches
2 parents dac13fa + 9b65863 commit a2c22dd

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

Code/FLCC/CustomMovingTouchSwitch.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ public CustomMovingTouchSwitch(EntityData data, Vector2 offset) : base(data.Posi
7171
revisitPreviousNodes = data.Bool("revisitPreviousNodes");
7272
var iconName = data.Attr("icon", "vanilla");
7373
icon = new Sprite(GFX.Game, iconName == "vanilla" ? "objects/touchswitch/icon" : $"objects/{(iconName is "tall" or "triangle" or "circle" ? "CrystallineHelper/FLCC/" : "")}customMovingTouchSwitch/{iconName}/icon");
74+
var borderName = data.Attr("border", "vanilla");
75+
if(borderName != "vanilla") border = GFX.Game["objects/customMovingTouchSwitch/" + borderName];
7476

75-
Depth = 2000;
77+
Depth = 2000;
7678
Switch = string.IsNullOrEmpty(flag) ? (ISwitch)new BasicSwitch() : (ISwitch)new FlagSwitch(flag, inverted, allowDisable);
7779
Add(Switch as Component);
7880
if (persistent)

Loenn/entities/custom_touch_switch.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local drawableSprite = require "structs.drawable_sprite"
2+
local atlases = require("atlases")
23

34
local customTouchSwitch = {}
45

@@ -23,10 +24,13 @@ customTouchSwitch.placements = {
2324
randomOrder = false,
2425
pathLength = -1,
2526
revisitPreviousNodes = false,
27+
border = "vanilla"
2628
}
2729
}
2830
}
2931

32+
customTouchSwitch.fieldOrder = {"x","y","moveTime","flag","icon","border","inactiveColor","activeColor","finishColor","movingColor","easing","pathLength"}
33+
3034
local easeTypes = {
3135
"Linear", "SineIn", "SineOut", "SineInOut", "QuadIn", "QuadOut", "QuadInOut", "CubeIn", "CubeOut", "CubeInOut", "QuintIn", "QuintOut", "QuintInOut", "BackIn", "BackOut", "BackInOut", "ExpoIn", "ExpoOut", "ExpoInOut", "BigBackIn", "BigBackOut", "BigBackInOut", "ElasticIn", "ElasticOut", "ElasticInOut", "BounceIn", "BounceOut", "BounceInOut"
3236
}
@@ -41,6 +45,9 @@ customTouchSwitch.fieldInformation = {
4145
pathLength = {
4246
fieldType = "integer",
4347
},
48+
border = {
49+
default = "vanilla"
50+
},
4451
}
4552

4653
function customTouchSwitch.ignoredFields(ent)
@@ -55,7 +62,11 @@ customTouchSwitch.nodeLimits = {0, -1}
5562
customTouchSwitch.nodeLineRenderType = "line"
5663

5764
function customTouchSwitch.sprite(room, entity)
58-
local containerSprite = drawableSprite.fromTexture("objects/touchswitch/container", entity)
65+
local borderResource = "objects/touchswitch/container"
66+
if (entity.border ~= nil) and (entity.border ~= "vanilla") and atlases.gameplay["objects/customMovingTouchSwitch/" .. entity.border] then
67+
borderResource = "objects/customMovingTouchSwitch/" .. entity.border
68+
end
69+
local containerSprite = drawableSprite.fromTexture(borderResource, entity)
5970

6071
local iconResource = "objects/touchswitch/icon00"
6172
if entity.icon ~= "vanilla" then

Loenn/lang/en_gb.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ entities.vitellary/customheart.attributes.description.poemCutscene=Whether the h
245245
# Custom Moving Touch Switch
246246
entities.vitellary/customtouchswitch.attributes.description.flag=The session flag this touch switch sets. Give the same to multiple touch switches and switch gates to group them.
247247
entities.vitellary/customtouchswitch.attributes.description.icon=The name of the icon for the touch switch (relative to objects/customMovingTouchSwitch), or "vanilla" for the default one.
248+
entities.vitellary/customtouchswitch.attributes.description.border=The border of the touch switch (relative to objects/customMovingTouchSwitch), or "vanilla" for the default one.
248249
entities.vitellary/customtouchswitch.attributes.description.persistent=If enabled, the touch switch will stay active when the player dies or changes rooms.
249250
entities.vitellary/customtouchswitch.attributes.description.inactiveColor=The switch colour when not triggered yet.
250251
entities.vitellary/customtouchswitch.attributes.description.movingColor=The switch colour while moving to the next node.

0 commit comments

Comments
 (0)