Skip to content

Commit eedf4cb

Browse files
committed
Add Transparent Background option to Reskinnable Swap Blocks
1 parent f6a56f8 commit eedf4cb

File tree

8 files changed

+13
-4
lines changed

8 files changed

+13
-4
lines changed

Ahorn/entities/maxHelpingHandReskinnableSwapBlock.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using ..Ahorn, Maple
44

55
@pardef ReskinnableSwapBlock(x1::Integer, y1::Integer, x2::Integer=x1+16, y2::Integer=y1, width::Integer=Maple.defaultBlockWidth, height::Integer=Maple.defaultBlockHeight,
6-
spriteDirectory::String="objects/swapblock", particleColor1::String="fbf236", particleColor2::String="6abe30",
6+
spriteDirectory::String="objects/swapblock", transparentBackground::Bool=false, particleColor1::String="fbf236", particleColor2::String="6abe30",
77
moveSound::String="event:/game/05_mirror_temple/swapblock_move", returnSound::String="event:/game/05_mirror_temple/swapblock_return",
88
moveEndSound::String="event:/game/05_mirror_temple/swapblock_move_end", returnEndSound::String="event:/game/05_mirror_temple/swapblock_return_end") =
99
Entity("MaxHelpingHand/ReskinnableSwapBlock", x=x1, y=y1, nodes=Tuple{Int, Int}[(x2, y2)], width=width, height=height, spriteDirectory=spriteDirectory, particleColor1=particleColor1, particleColor2=particleColor2,

Ahorn/lang/en_gb.lang

+1
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ placements.triggers.MaxHelpingHand/ColorGradeFadeTrigger.tooltips.evenDuringRefl
352352

353353
# Reskinnable Swap Block
354354
placements.entities.MaxHelpingHand/ReskinnableSwapBlock.tooltips.spriteDirectory=The directory containing all the swap block sprites.\nTo make your own, copy Graphics/Atlases/Gameplay/objects/swapblock (or objects/swapblock/moon) to Mods/yourmod/Graphics/Atlases/Gameplay/MyMap/myswapblock and type MyMap/myswapblock in this field.
355+
placements.entities.MaxHelpingHand/ReskinnableSwapBlock.tooltips.transparentBackground=If checked, the background textures (pathH and pathV) will be replaced with transparent textures.
355356
placements.entities.MaxHelpingHand/ReskinnableSwapBlock.tooltips.particleColor1=One of the 2 colors of the particles the swap block emits when it moves.
356357
placements.entities.MaxHelpingHand/ReskinnableSwapBlock.tooltips.particleColor2=One of the 2 colors of the particles the swap block emits when it moves.
357358
placements.entities.MaxHelpingHand/ReskinnableSwapBlock.names.particleColor1=Particle Color 1

Entities/ReskinnableSwapBlock.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private static void onSwapBlockConstruct(On.Celeste.SwapBlock.orig_ctor_EntityDa
4242
// we are using a hook rather than the constructor, because we want to run our code before the base constructor.
4343
if (self is ReskinnableSwapBlock swapBlock) {
4444
swapBlock.spriteDirectory = data.Attr("spriteDirectory", "objects/swapblock");
45+
swapBlock.transparentBackground = data.Bool("transparentBackground");
4546
}
4647

4748
orig(self, data, offset);
@@ -68,7 +69,11 @@ private static void modSwapBlockTextures(ILContext il, bool isPathRenderer) {
6869
}
6970
cursor.EmitDelegate<Func<string, SwapBlock, string>>((orig, self) => {
7071
if (self is ReskinnableSwapBlock swapBlock) {
71-
return orig.Replace("objects/swapblock", swapBlock.spriteDirectory);
72+
if (swapBlock.transparentBackground && orig == "objects/swapblock/path") {
73+
return orig.Replace("objects/swapblock", "MaxHelpingHand/swapblocktransparentbg");
74+
} else {
75+
return orig.Replace("objects/swapblock", swapBlock.spriteDirectory);
76+
}
7277
}
7378
return orig;
7479
});
@@ -110,6 +115,7 @@ private static void modSwapBlockSounds(ILContext il) {
110115
private string moveEndSound;
111116
private string returnSound;
112117
private string returnEndSound;
118+
private bool transparentBackground;
113119

114120
public ReskinnableSwapBlock(EntityData data, Vector2 offset) : base(data, offset) {
115121
DynData<SwapBlock> self = new DynData<SwapBlock>(this);
Loading
Loading

Loenn/entities/reskinnableSwapBlock.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ swapBlock.placements = {
4444
width = 16,
4545
height = 16,
4646
spriteDirectory = "objects/swapblock",
47+
transparentBackground = false,
4748
particleColor1 = "fbf236",
4849
particleColor2 = "6abe30",
4950
moveSound = "event:/game/05_mirror_temple/swapblock_move",
@@ -91,7 +92,7 @@ local function addTrailSprites(sprites, entity, trailTexture)
9192
x, y = math.min(x, nodeX), math.min(y, nodeY)
9293

9394
local pathDirection = x == nodeX and "V" or "H"
94-
local pathTexture = string.format("%s/path%s", entity.spriteDirectory, pathDirection)
95+
local pathTexture = string.format("%s/path%s", entity.transparentBackground and "MaxHelpingHand/swapblocktransparentbg" or entity.spriteDirectory, pathDirection)
9596
local pathNinePatch = drawableNinePatch.fromTexture(pathTexture, pathNinePatchOptions, x, y, drawWidth, drawHeight)
9697
local pathSprites = pathNinePatch:getDrawableSprite()
9798

Loenn/lang/en_gb.lang

+1
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ entities.MaxHelpingHand/ReskinnableStarTrackSpinner.attributes.description.immun
633633
# Reskinnable Swap Block
634634
entities.MaxHelpingHand/ReskinnableSwapBlock.placements.name.swapblock=Swap Block (Reskinnable)
635635
entities.MaxHelpingHand/ReskinnableSwapBlock.attributes.description.spriteDirectory=The directory containing all the swap block sprites.\nTo make your own, copy Graphics/Atlases/Gameplay/objects/swapblock (or objects/swapblock/moon) to Mods/yourmod/Graphics/Atlases/Gameplay/MyMap/myswapblock and type MyMap/myswapblock in this field.
636+
entities.MaxHelpingHand/ReskinnableSwapBlock.attributes.description.transparentBackground=If checked, the background textures (pathH and pathV) will be replaced with transparent textures.
636637
entities.MaxHelpingHand/ReskinnableSwapBlock.attributes.description.particleColor1=One of the 2 colors of the particles the swap block emits when it moves.
637638
entities.MaxHelpingHand/ReskinnableSwapBlock.attributes.description.particleColor2=One of the 2 colors of the particles the swap block emits when it moves.
638639
entities.MaxHelpingHand/ReskinnableSwapBlock.attributes.name.particleColor1=Particle Color 1

everest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The mod used to be known as "max480's Helping Hand", and wasn't renamed for compatibility reasons
22
- Name: MaxHelpingHand
3-
Version: 1.31.2
3+
Version: 1.31.3
44
DLL: bin/Release/net452/MaxHelpingHand.dll
55
Dependencies:
66
- Name: Everest

0 commit comments

Comments
 (0)