From 5c48c76aa252f5627593db5034b948c83aafaaae Mon Sep 17 00:00:00 2001 From: Paramat Date: Fri, 3 May 2019 23:49:07 +0100 Subject: [PATCH] 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. --- game_api.txt | 9 ++++++- mods/doors/README.txt | 4 ++- mods/doors/init.lua | 25 +++++++++++------- mods/doors/textures/doors_trapdoor_side.png | Bin 169 -> 118 bytes .../textures/doors_trapdoor_steel_side.png | Bin 101 -> 98 bytes 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/game_api.txt b/game_api.txt index 61be13f..841c6e2 100644 --- a/game_api.txt +++ b/game_api.txt @@ -214,6 +214,8 @@ The doors mod allows modders to register custom doors and trapdoors. inventory_image = "mod_door_inv.png", groups = {choppy = 2}, tiles = {"mod_door.png"}, -- UV map. + -- The front and back of the door must be identical in appearence as they swap on + -- open/close. recipe = craftrecipe, sounds = default.node_sound_wood_defaults(), -- optional sound_open = sound play for open door, -- optional @@ -228,7 +230,12 @@ The doors mod allows modders to register custom doors and trapdoors. inventory_image = "mod_trapdoor_inv.png", groups = {choppy = 2}, tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor - tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor + tile_side = "doors_trapdoor_side.png", + -- The texture for the four sides of the trapdoor. + -- The texture should have the trapdoor side drawn twice, in the lowest and highest + -- 1/8ths of the texture, both upright. The area between is not used. + -- The lower 1/8th will be used for the closed trapdoor, the higher 1/8th will be used + -- for the open trapdoor. sounds = default.node_sound_wood_defaults(), -- optional sound_open = sound play for open door, -- optional sound_close = sound play for close door, -- optional diff --git a/mods/doors/README.txt b/mods/doors/README.txt index 9c114b0..f9caaff 100644 --- a/mods/doors/README.txt +++ b/mods/doors/README.txt @@ -40,8 +40,10 @@ Following textures created by PenguinDad (CC BY-SA 4.0): Following textures created by sofar (CC-BY-SA-3.0): doors_trapdoor_steel.png - doors_trapdoor_steel_side.png + +Following textures created by paramat (CC-BY-SA-3.0): door_trapdoor_side.png + doors_trapdoor_steel_side.png Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0): door_obsidian_glass.png diff --git a/mods/doors/init.lua b/mods/doors/init.lua index 20ce026..dff65c7 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -642,10 +642,14 @@ function doors.register_trapdoor(name, def) type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} } - def_closed.tiles = {def.tile_front, - def.tile_front .. '^[transformFY', - def.tile_side, def.tile_side, - def.tile_side, def.tile_side} + def_closed.tiles = { + def.tile_front, + def.tile_front .. '^[transformFY', + def.tile_side, + def.tile_side, + def.tile_side, + def.tile_side + } def_opened.node_box = { type = "fixed", @@ -655,11 +659,14 @@ function doors.register_trapdoor(name, def) type = "fixed", fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} } - def_opened.tiles = {def.tile_side, def.tile_side, - def.tile_side .. '^[transform3', - def.tile_side .. '^[transform1', - def.tile_front .. '^[transform46', - def.tile_front .. '^[transform6'} + def_opened.tiles = { + def.tile_side, + def.tile_side .. '^[transform2', + def.tile_side .. '^[transform3', + def.tile_side .. '^[transform1', + def.tile_front .. '^[transform46', + def.tile_front .. '^[transform6' + } def_opened.drop = name_closed def_opened.groups.not_in_creative_inventory = 1 diff --git a/mods/doors/textures/doors_trapdoor_side.png b/mods/doors/textures/doors_trapdoor_side.png index 4a8b99f2836e47737f494f2c1959486337994e6e..55981ea32cb49b8227fe85beafafb2ee599653c7 100644 GIT binary patch delta 88 zcmZ3Cm9$R7?Zr+T^Kr8Wj%l#&H|6f zVg?3oVGw3ym^DWND9B#o>Fdh=kd1>=hGUOwpaxJ#!PCVtgyVX0L7`z;VPRoeVn9$z mKv0lSh>O94ppp<~h8{C<&-)9@KLOP;c)GIrxvX diff --git a/mods/doors/textures/doors_trapdoor_steel_side.png b/mods/doors/textures/doors_trapdoor_steel_side.png index 44c4344b2b4f4ba16d9ea1427d94ad5abcff8ef3..e29c59e014db2e8b1aee99b652af4138e85a3f76 100644 GIT binary patch delta 62 zcmYdInxJXPz`(G5`}T9^&WThV69;lcJY5_^IIbs0u(I$hbU5I^*)W@l!Syiv&xgg= RX949IJYD@<);T3K0RW`~6<+`V delta 65 zcmYdFouFy6ef#!v=g!@`cdtb>)SQ8VLEO{DF@)oKasoqRfI>n9D~kZr8C8EKhCO@5 VUoyE{UjQm$@O1TaS?83{1OQ2k7OMaN