74 lines
2.5 KiB
Lua
74 lines
2.5 KiB
Lua
-- laddersmod mod for Minetest
|
|
-- Copyright © 2020 Alex Yst <mailto:copyright@y.st>
|
|
|
|
-- This program is free software; you can redistribute it and/or
|
|
-- modify it under the terms of the GNU Lesser General Public
|
|
-- License as published by the Free Software Foundation; either
|
|
-- version 2.1 of the License, or (at your option) any later version.
|
|
|
|
-- This software is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
-- Lesser General Public License for more details.
|
|
|
|
-- You should have received a copy of the GNU Lesser General Public
|
|
-- License along with this program. If not, see
|
|
-- <https://www.gnu.org./licenses/>.
|
|
|
|
-- Minetest Game changed the flat signs that were thinner than paper
|
|
-- into actual 3D signs that can be seen from any angle. This same
|
|
-- treatment was never given to ladders though.
|
|
--
|
|
-- The node boxes used here are my interpretation of what the textures
|
|
-- would look like in 3D. Because ladder textures include empty space
|
|
-- on both sides, they don't really work on their own for side
|
|
-- textures. Because of that, I've combined the ladder textures with
|
|
-- the applewood and steel block textures to create something that
|
|
-- doesn't stand out too much.
|
|
for type, data in next, {
|
|
steel = {
|
|
nodebox = {
|
|
{-0.4375, -0.5, -0.5, -0.25, -0.3125, 0.5},
|
|
{0.25, -0.5, -0.5, 0.4375, -0.3125, 0.5},
|
|
{-0.25, -0.4375, -0.4375, 0.25, -0.375, -0.3125},
|
|
{-0.25, -0.4375, -0.1875, 0.25, -0.375, -0.0625},
|
|
{-0.25, -0.4375, 0.0625, 0.25, -0.375, 0.1875},
|
|
{-0.25, -0.4375, 0.3125, 0.25, -0.375, 0.4375},
|
|
},
|
|
texture = "default_steel_block.png^default_ladder_steel.png",
|
|
},
|
|
wood = {
|
|
nodebox = {
|
|
{-0.375, -0.5, -0.5, -0.25, -0.4375, 0.5},
|
|
{0.25, -0.5, -0.5, 0.375, -0.4375, 0.5},
|
|
{-0.375, -0.375, -0.5, -0.25, -0.3125, 0.5},
|
|
{0.25, -0.375, -0.5, 0.375, -0.3125, 0.5},
|
|
{-0.4375, -0.4375, -0.4375, 0.4375, -0.375, -0.3125},
|
|
{-0.4375, -0.4375, -0.1875, 0.4375, -0.375, -0.0625},
|
|
{-0.4375, -0.4375, 0.0625, 0.4375, -0.375, 0.1875},
|
|
{-0.4375, -0.4375, 0.3125, 0.4375, -0.375, 0.4375},
|
|
},
|
|
texture = "default_wood.png^default_ladder_wood.png"
|
|
},
|
|
} do
|
|
minetest.override_item("default:ladder_"..type, {
|
|
drawtype = "nodebox",
|
|
node_box = {
|
|
type = "fixed",
|
|
fixed = data.nodebox,
|
|
},
|
|
selection_box = {
|
|
type = "fixed",
|
|
fixed = data.nodebox,
|
|
},
|
|
tiles = {
|
|
data.texture,
|
|
data.texture,
|
|
data.texture.."^[transformR90",
|
|
data.texture.."^[transformR90",
|
|
data.texture,
|
|
data.texture,
|
|
},
|
|
})
|
|
end
|