Skip to content

Commit 5c48c76

Browse files
authoredMay 3, 2019
Fix trapdoor side textures and orientations
Previously, opening a trapdoor caused the side textures to flip. Fix the incorrect textures. Also add a texture transform to a tile of the open trapdoor, such that the closed trapdoor sides use the lower part of the texture and the open trapdoor sides use the higher part. Clean up some codestyle issues.
1 parent f21bab2 commit 5c48c76

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed
 

‎game_api.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ The doors mod allows modders to register custom doors and trapdoors.
214214
inventory_image = "mod_door_inv.png",
215215
groups = {choppy = 2},
216216
tiles = {"mod_door.png"}, -- UV map.
217+
-- The front and back of the door must be identical in appearence as they swap on
218+
-- open/close.
217219
recipe = craftrecipe,
218220
sounds = default.node_sound_wood_defaults(), -- optional
219221
sound_open = sound play for open door, -- optional
@@ -228,7 +230,12 @@ The doors mod allows modders to register custom doors and trapdoors.
228230
inventory_image = "mod_trapdoor_inv.png",
229231
groups = {choppy = 2},
230232
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
231-
tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor
233+
tile_side = "doors_trapdoor_side.png",
234+
-- The texture for the four sides of the trapdoor.
235+
-- The texture should have the trapdoor side drawn twice, in the lowest and highest
236+
-- 1/8ths of the texture, both upright. The area between is not used.
237+
-- The lower 1/8th will be used for the closed trapdoor, the higher 1/8th will be used
238+
-- for the open trapdoor.
232239
sounds = default.node_sound_wood_defaults(), -- optional
233240
sound_open = sound play for open door, -- optional
234241
sound_close = sound play for close door, -- optional

‎mods/doors/README.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ Following textures created by PenguinDad (CC BY-SA 4.0):
4040

4141
Following textures created by sofar (CC-BY-SA-3.0):
4242
doors_trapdoor_steel.png
43-
doors_trapdoor_steel_side.png
43+
44+
Following textures created by paramat (CC-BY-SA-3.0):
4445
door_trapdoor_side.png
46+
doors_trapdoor_steel_side.png
4547

4648
Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0):
4749
door_obsidian_glass.png

‎mods/doors/init.lua

+16-9
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,14 @@ function doors.register_trapdoor(name, def)
642642
type = "fixed",
643643
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
644644
}
645-
def_closed.tiles = {def.tile_front,
646-
def.tile_front .. '^[transformFY',
647-
def.tile_side, def.tile_side,
648-
def.tile_side, def.tile_side}
645+
def_closed.tiles = {
646+
def.tile_front,
647+
def.tile_front .. '^[transformFY',
648+
def.tile_side,
649+
def.tile_side,
650+
def.tile_side,
651+
def.tile_side
652+
}
649653

650654
def_opened.node_box = {
651655
type = "fixed",
@@ -655,11 +659,14 @@ function doors.register_trapdoor(name, def)
655659
type = "fixed",
656660
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
657661
}
658-
def_opened.tiles = {def.tile_side, def.tile_side,
659-
def.tile_side .. '^[transform3',
660-
def.tile_side .. '^[transform1',
661-
def.tile_front .. '^[transform46',
662-
def.tile_front .. '^[transform6'}
662+
def_opened.tiles = {
663+
def.tile_side,
664+
def.tile_side .. '^[transform2',
665+
def.tile_side .. '^[transform3',
666+
def.tile_side .. '^[transform1',
667+
def.tile_front .. '^[transform46',
668+
def.tile_front .. '^[transform6'
669+
}
663670

664671
def_opened.drop = name_closed
665672
def_opened.groups.not_in_creative_inventory = 1
-51 Bytes
Loading
-3 Bytes
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.