Rename xpanes to lzr_panes and simplify it

master
Wuzzy 2022-02-15 06:54:12 +01:00
parent fc6c9be6bb
commit 58a6dea613
33 changed files with 84 additions and 223 deletions

View File

@ -5,7 +5,7 @@ Lazarr! is a puzzle game by Wuzzy, using some textures, sounds and code from oth
External mods used: External mods used:
* `show_wielded_item` * `show_wielded_item`
* `player_api`, `xpanes`, `stairs`, `screwdriver2` * `player_api`, `stairs`, `screwdriver2`
--- ---
@ -98,8 +98,9 @@ Sounds:
- All other sounds come from Minetest Game (see license of Minetest Game 5.4.1 for details) - All other sounds come from Minetest Game (see license of Minetest Game 5.4.1 for details)
Code: Code:
- `player_api`, `stairs`, `xpanes` come from Minetest Game 5.4.1 (mods modified for Lazarr!), by Minetest Game developers (see README.txt in those folders) - `player_api`, `stairs` come from Minetest Game 5.4.1 (mods modified for Lazarr!), by Minetest Game developers (see README.txt in those folders)
- `screwdriver2` by 12Me21, modified version (CC0) - `screwdriver2` by 12Me21, modified version (CC0)
- `lzr_panes` is based on `xpanes` from Minetest Game and massively simplified (MIT License for code, CC BY-SA 3.0 for media)
- `lzr_decor` is based on `xdecor` by jp (BSD-3 clause license; massively-simplified version from the original) - `lzr_decor` is based on `xdecor` by jp (BSD-3 clause license; massively-simplified version from the original)
Other stuff: Other stuff:

View File

@ -22,7 +22,7 @@ local pixelbox = function(size, boxes)
end end
local function register_pane(name, desc, def) local function register_pane(name, desc, def)
xpanes.register_pane(name, { lzr_panes.register_pane(name, {
description = desc, description = desc,
drawtype = "airlike", drawtype = "airlike",
paramtype = "light", paramtype = "light",

View File

@ -1,14 +1,18 @@
Minetest Game mod: xpanes Lazarr! mod: lzr_panes
========================= ======================
A simplified version of xpanes.
See license.txt for license information. See license.txt for license information.
Authors of source code Original authors of source code
---------------------- -------------------------------
Originally by xyz (MIT) xpanes mod originally by xyz (MIT)
BlockMen (MIT) BlockMen (MIT)
sofar (MIT) sofar (MIT)
Various Minetest developers and contributors (MIT) Various Minetest developers and contributors (MIT)
Transformation to Lazarr! version of this mod: Wuzzy (MIT)
Authors of media (textures) Authors of media (textures)
--------------------------- ---------------------------
xyz (CC BY-SA 3.0): xyz (CC BY-SA 3.0):
@ -22,11 +26,3 @@ paramat (CC BY-SA 3.0):
Krock (CC0 1.0): Krock (CC0 1.0):
xpanes_edge.png xpanes_edge.png
TumeniNodes (CC BY-SA 3.0):
xpanes_door_steel_bar.png
xpanes_item_steel_bar.png
xpanes_trapdoor_steel_bar.png
xpanes_trapdoor_steel_bar_side.png
xpanes_steel_bar_door_close.ogg
xpanes_steel_bar_door_open.ogg

49
mods/lzr_panes/init.lua Normal file
View File

@ -0,0 +1,49 @@
-- Load support for MT game translation.
local S = minetest.get_translator("lzr_panes")
local HTHICK = 1/16 -- half pane thickness
lzr_panes = {}
function lzr_panes.register_pane(name, def)
local flatgroups = table.copy(def.groups)
flatgroups.pane = 1
minetest.register_node(":lzr_panes:" .. name .. "_flat", {
description = def.description,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
paramtype2 = "facedir",
tiles = {
def.textures[3],
def.textures[3],
def.textures[3],
def.textures[3],
def.textures[1],
def.textures[1]
},
groups = flatgroups,
sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha and "blend" or "clip",
node_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
selection_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
})
end
lzr_panes.register_pane("bar", {
description = S("Steel Bars"),
textures = {"xpanes_bar.png", "", "xpanes_bar_top.png"},
inventory_image = "xpanes_bar.png",
wield_image = "xpanes_bar.png",
groups = {breakable=1},
sounds = lzr_sounds.node_sound_metal_defaults(),
})

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=Stahlgitter

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Barras de acero Steel Bars=Barras de acero

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Barreaux d'acier Steel Bars=Barreaux d'acier

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=Batang Baja

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Sbarre d'acciaio Steel Bars=Sbarre d'acciaio

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=lo gasta garna Steel Bars=lo gasta garna

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Jeriji Keluli Steel Bars=Jeriji Keluli

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Barras de Aço Steel Bars=Barras de Aço

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Стальная Решётка Steel Bars=Стальная Решётка

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=Stålgaller

View File

@ -1,2 +1,2 @@
# textdomain: xpanes # textdomain: lzr_panes
Steel Bars=Oceľové mreže Steel Bars=Oceľové mreže

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=钢筋

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=鋼筋

View File

@ -0,0 +1,2 @@
# textdomain: lzr_panes
Steel Bars=

2
mods/lzr_panes/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = lzr_panes
depends = lzr_sounds

View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View File

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 101 B

View File

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 269 B

View File

@ -1,183 +0,0 @@
-- xpanes/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator("xpanes")
local HTHICK = 1/16 -- half pane thickness
local function is_pane(pos)
return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0
end
local function connects_dir(pos, name, dir)
local aside = vector.add(pos, minetest.facedir_to_dir(dir))
if is_pane(aside) then
return true
end
local connects_to = minetest.registered_nodes[name].connects_to
if not connects_to then
return false
end
local list = minetest.find_nodes_in_area(aside, aside, connects_to)
if #list > 0 then
return true
end
return false
end
local function swap(pos, node, name, param2)
if node.name == name and node.param2 == param2 then
return
end
minetest.swap_node(pos, {name = name, param2 = param2})
end
local function update_pane(pos)
if not is_pane(pos) then
return
end
local node = minetest.get_node(pos)
local name = node.name
if name:sub(-5) == "_flat" then
name = name:sub(1, -6)
end
local any = node.param2
local c = {}
local count = 0
for dir = 0, 3 do
c[dir] = connects_dir(pos, name, dir)
if c[dir] then
any = dir
count = count + 1
end
end
if count == 0 then
swap(pos, node, name .. "_flat", any)
elseif count == 1 then
swap(pos, node, name .. "_flat", (any + 1) % 4)
elseif count == 2 then
if (c[0] and c[2]) or (c[1] and c[3]) then
swap(pos, node, name .. "_flat", (any + 1) % 4)
else
swap(pos, node, name, 0)
end
else
swap(pos, node, name, 0)
end
end
minetest.register_on_placenode(function(pos, node)
if minetest.get_item_group(node, "pane") then
update_pane(pos)
end
for i = 0, 3 do
local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir))
end
end)
minetest.register_on_dignode(function(pos)
for i = 0, 3 do
local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir))
end
end)
xpanes = {}
function xpanes.register_pane(name, def)
for i = 1, 15 do
minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat")
end
local flatgroups = table.copy(def.groups)
flatgroups.pane = 1
minetest.register_node(":xpanes:" .. name .. "_flat", {
description = def.description,
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
paramtype2 = "facedir",
tiles = {
def.textures[3],
def.textures[3],
def.textures[3],
def.textures[3],
def.textures[1],
def.textures[1]
},
groups = flatgroups,
drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha and "blend" or "clip",
node_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
selection_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
connect_sides = { "left", "right" },
})
local groups = table.copy(def.groups)
groups.pane = 1
groups.not_in_creative_inventory = 1
minetest.register_node(":xpanes:" .. name, {
drawtype = "nodebox",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
description = def.description,
tiles = {
def.textures[3],
def.textures[3],
def.textures[1]
},
groups = groups,
drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha and "blend" or "clip",
node_box = {
type = "connected",
fixed = {{-HTHICK, -1/2, -HTHICK, HTHICK, 1/2, HTHICK}},
connect_front = {{-HTHICK, -1/2, -1/2, HTHICK, 1/2, -HTHICK}},
connect_left = {{-1/2, -1/2, -HTHICK, -HTHICK, 1/2, HTHICK}},
connect_back = {{-HTHICK, -1/2, HTHICK, HTHICK, 1/2, 1/2}},
connect_right = {{HTHICK, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"},
})
end
xpanes.register_pane("bar", {
description = S("Steel Bars"),
textures = {"xpanes_bar.png", "", "xpanes_bar_top.png"},
inventory_image = "xpanes_bar.png",
wield_image = "xpanes_bar.png",
groups = {breakable=1},
sounds = lzr_sounds.node_sound_metal_defaults(),
})
minetest.register_lbm({
name = "xpanes:gen2",
nodenames = {"group:pane"},
action = function(pos, node)
update_pane(pos)
for i = 0, 3 do
local dir = minetest.facedir_to_dir(i)
update_pane(vector.add(pos, dir))
end
end
})

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=Stahlgitter

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=Batang Baja

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=Stålgaller

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=钢筋

View File

@ -1,2 +0,0 @@
# textdomain: xpanes
Steel Bars=鋼筋

View File

@ -1,4 +0,0 @@
name = xpanes
description = Minetest Game mod: xpanes
depends = lzr_sounds
optional_depends = doors