Compare commits

...

5 Commits

Author SHA1 Message Date
fluxionary 4305841cf2
Fix duplicated book entities on the enchanting table (#155)
Because of a race condition, the check for whether to regenerate a book entity can happen while the entity is unloaded, resulting in multiple entities per enchanting server.
2022-07-27 20:51:21 +02:00
SmallJoker 3b5b3f0c11 Fix texture alpha deprecation warnings 2022-02-26 12:03:20 +01:00
nixnoxus a4c18c984b
Add missing cauldron descriptions and translations (#151) 2021-12-21 19:46:23 +01:00
Jordan Irwin 0dbf92e789
Add xdecor:is_repairable method for mods (#147)
to check whether items are repairable with the workbench
2021-07-13 20:49:59 +02:00
Jordan Irwin 3103d426d2
Add method to register items as repairable (#145) 2021-07-07 18:28:25 +02:00
10 changed files with 52 additions and 11 deletions

View File

@ -36,6 +36,7 @@ check=
Bowl=
Bowl of soup=
Cauldron=
Cauldron (active)=
Cauldron (active) - Drop foods inside to make a soup=
Cauldron (active) - Use a bowl to eat the soup=
Cauldron (empty)=

View File

@ -34,6 +34,7 @@ check=Schach
Bowl=Schüssel
Bowl of soup=Suppenschüssel
Cauldron=Kessel
Cauldron (active)=Kessel (aktiv)
Cauldron (active) - Drop foods inside to make a soup=Kessel (aktiv) - Nahrungsmittel einwerfen, um Suppe zu machen.
Cauldron (active) - Use a bowl to eat the soup=Kessel (aktiv) - Benutze eine Schüssel, um die Suppe zu essen
Cauldron (empty)=Kessel (leer)

View File

@ -36,6 +36,7 @@ check=échec
Bowl=Bol
Bowl of soup=Bol de soupe
Cauldron=Chaudron
Cauldron (active)=Chaudron (actif)
Cauldron (active) - Drop foods inside to make a soup=Chaudron (actif) - Placez des ingrédients à lintérieur pour faire une soupe
Cauldron (active) - Use a bowl to eat the soup=Chaudron (actif) - Utilisez un bol pour boire la soupe
Cauldron (empty)=Chaudron (vide)

View File

@ -36,6 +36,7 @@ check=scacco
Bowl=Ciotola
Bowl of soup=Ciotola di zuppa
Cauldron=Calderone
Cauldron (active)=Calderone (attivo)
Cauldron (active) - Drop foods inside to make a soup=Calderone (attivo) - Mettere gli ingredienti all'interno per fare una zuppa.
Cauldron (active) - Use a bowl to eat the soup=Calderone (actif) - Utilizzare una ciotola per mangiare la zuppa
Cauldron (empty)=Calderone (vuoto)

View File

@ -1,6 +1,7 @@
local realchess = {}
local S = minetest.get_translator("xdecor")
local FS = function(...) return minetest.formspec_escape(S(...)) end
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
screwdriver = screwdriver or {}
local function index_to_xy(idx)
@ -1429,6 +1430,7 @@ minetest.register_node(":realchess:chessboard", {
inventory_image = "chessboard_top.png",
wield_image = "chessboard_top.png",
tiles = {"chessboard_top.png", "chessboard_top.png", "chessboard_sides.png"},
use_texture_alpha = ALPHA_OPAQUE,
groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed", fixed = {-.375, -.5, -.375, .375, -.4375, .375}},

View File

@ -173,6 +173,7 @@ xdecor.register("cauldron_empty", {
})
xdecor.register("cauldron_idle", {
description = S("Cauldron (idle)"),
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
on_rotate = screwdriver.rotate_simple,
tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"},
@ -185,6 +186,7 @@ xdecor.register("cauldron_idle", {
})
xdecor.register("cauldron_boiling", {
description = S("Cauldron (active)"),
groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1},
on_rotate = screwdriver.rotate_simple,
drop = "xdecor:cauldron_empty",
@ -207,6 +209,7 @@ xdecor.register("cauldron_boiling", {
})
xdecor.register("cauldron_soup", {
description = S("Cauldron (active)"),
groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
on_rotate = screwdriver.rotate_simple,
drop = "xdecor:cauldron_empty",

View File

@ -186,11 +186,6 @@ function enchanting.destruct(pos)
end
function enchanting.timer(pos)
local num = #minetest.get_objects_inside_radius(pos, 0.9)
if num == 0 then
minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open")
end
local minp = {x = pos.x - 2, y = pos.y, z = pos.z - 2}
local maxp = {x = pos.x + 2, y = pos.y + 1, z = pos.z + 2}
@ -249,14 +244,26 @@ minetest.register_entity("xdecor:book_open", {
collisionbox = {0},
physical = false,
textures = {"xdecor_book_open.png"},
on_activate = function(self)
local pos = self.object:get_pos()
local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
static_save = false,
})
if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then
self.object:remove()
minetest.register_lbm({
label = "recreate book entity",
name = "xdecor:create_book_entity",
nodenames = {"xdecor:enchantment_table"},
run_at_every_load = true,
action = function(pos, node)
local objs = minetest.get_objects_inside_radius(pos, 0.9)
for _, obj in ipairs(objs) do
local e = obj:get_luaentity()
if e and e.name == "xdecor:book_open" then
return
end
end
end
minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open")
end,
})
function enchanting:register_tools(mod, def)

View File

@ -6,6 +6,7 @@ local plate = {}
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
local function door_toggle(pos_actuator, pos_door, player)
local player_name = player:get_player_name()
@ -59,6 +60,7 @@ function plate.register(material, desc, def)
xdecor.register("pressure_" .. material .. "_off", {
description = def.description or (desc .. " Pressure Plate"),
tiles = {"xdecor_pressure_" .. material .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}),
groups = def.groups,
@ -70,6 +72,7 @@ function plate.register(material, desc, def)
})
xdecor.register("pressure_" .. material .. "_on", {
tiles = {"xdecor_pressure_" .. material .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}),
groups = def.groups,
@ -95,6 +98,7 @@ plate.register("stone", "Stone", {
xdecor.register("lever_off", {
description = S("Lever"),
tiles = {"xdecor_lever_off.png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}),
groups = {cracky = 3, oddly_breakable_by_hand = 2},
@ -118,6 +122,7 @@ xdecor.register("lever_off", {
xdecor.register("lever_on", {
tiles = {"xdecor_lever_on.png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}),
groups = {cracky = 3, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1},

View File

@ -1,5 +1,7 @@
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
local function register_pane(name, desc, def)
xpanes.register_pane(name, {
@ -80,6 +82,7 @@ local function register_storage(name, desc, def)
inventory = {size = def.inv_size or 24},
infotext = desc,
tiles = def.tiles,
use_texture_alpha = ALPHA_OPAQUE,
node_box = def.node_box,
on_rotate = def.on_rotate,
on_place = def.on_place,
@ -480,6 +483,7 @@ local painting_box = {
xdecor.register("painting_1", {
description = S("Painting"),
tiles = {"xdecor_painting_1.png"},
use_texture_alpha = ALPHA_OPAQUE,
inventory_image = "xdecor_painting_empty.png",
wield_image = "xdecor_painting_empty.png",
paramtype2 = "wallmounted",
@ -505,6 +509,7 @@ xdecor.register("painting_1", {
for i = 2, 4 do
xdecor.register("painting_" .. i, {
tiles = {"xdecor_painting_" .. i .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
paramtype2 = "wallmounted",
drop = "xdecor:painting_1",
sunlight_propagates = true,
@ -584,6 +589,7 @@ xdecor.register("tatami", {
xdecor.register("trampoline", {
description = S("Trampoline"),
tiles = {"xdecor_trampoline.png", "mailbox_blank16.png", "xdecor_trampoline_sides.png"},
use_texture_alpha = ALPHA_CLIP,
groups = {cracky = 3, oddly_breakable_by_hand = 1, fall_damage_add_percent = -80, bouncy = 90},
node_box = xdecor.nodebox.slab_y(0.5),
sounds = {
@ -616,6 +622,7 @@ xdecor.register("woodframed_glass", {
drawtype = "glasslike_framed",
sunlight_propagates = true,
tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"},
use_texture_alpha = ALPHA_CLIP,
groups = {cracky = 2, oddly_breakable_by_hand = 1},
sounds = default.node_sound_glass_defaults()
})

View File

@ -36,8 +36,15 @@ workbench.defs = {
local repairable_tools = {"pick", "axe", "shovel", "sword", "hoe", "armor", "shield"}
local custom_repairable = {}
function xdecor:register_repairable(item)
custom_repairable[item] = true
end
-- Tools allowed to be repaired
function workbench:repairable(stack)
if custom_repairable[stack] then return true end
for _, t in ipairs(repairable_tools) do
if stack:find(t) then
return true
@ -45,6 +52,11 @@ function workbench:repairable(stack)
end
end
-- method to allow other mods to check if an item is repairable
function xdecor:is_repairable(stack)
return workbench:repairable(stack)
end
function workbench:get_output(inv, input, name)
local output = {}
for i = 1, #self.defs do
@ -298,6 +310,7 @@ for i = 1, #nodes do
drawtype = "nodebox",
sounds = def.sounds,
tiles = tiles,
use_texture_alpha = def.use_texture_alpha,
groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),