11local drawableNinePatch = require " structs.drawable_nine_patch"
22local drawableRectangle = require " structs.drawable_rectangle"
33local 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
515local aeroBlockCharged = {}
616
717aeroBlockCharged .name = " CommunalHelper/AeroBlockCharged"
818aeroBlockCharged .depth = 4999
9- aeroBlockCharged .minimumSize = {16 , 16 }
19+ aeroBlockCharged .minimumSize = { 16 , 16 }
1020
11- aeroBlockCharged .nodeLimits = {0 , - 1 }
21+ aeroBlockCharged .nodeLimits = { 0 , - 1 }
1222aeroBlockCharged .nodeLineRenderType = " line"
1323
1424aeroBlockCharged .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 }
4484local blockTexture = " objects/CommunalHelper/aero_block/blocks/nnn"
4585
4686local 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
86132end
87133
88- return aeroBlockCharged
134+ return aeroBlockCharged
0 commit comments