More simplification
This commit is contained in:
parent
9c6b49621c
commit
201f402fcb
@ -11,7 +11,7 @@ local cauldron_cbox = {
|
||||
}
|
||||
}
|
||||
|
||||
local function fill_water_bucket(pos, node, clicker, itemstack, _)
|
||||
local function fill_water_bucket(pos, node, clicker, itemstack)
|
||||
local wield_item = clicker:get_wielded_item():get_name()
|
||||
if wield_item == "bucket:bucket_empty" then
|
||||
minetest.set_node(pos, {name="xdecor:cauldron_empty", param2=node.param2})
|
||||
@ -74,7 +74,7 @@ xdecor.register("cauldron_soup", {
|
||||
"xdecor_cauldron_sides.png"
|
||||
},
|
||||
collision_box = cauldron_cbox,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, _)
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local inv = clicker:get_inventory()
|
||||
if clicker:get_wielded_item():get_name() == "xdecor:bowl" then
|
||||
if inv:room_for_item("main", "xdecor:bowl_soup 1") then
|
||||
@ -93,7 +93,7 @@ xdecor.register("cauldron_soup", {
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:cauldron_idle"},
|
||||
interval = 15, chance = 1,
|
||||
action = function(pos, node, _, _)
|
||||
action = function(pos, node)
|
||||
local below_node = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
if minetest.get_node(below_node).name:find("fire") then
|
||||
minetest.set_node(pos, {name="xdecor:cauldron_boiling_water", param2=node.param2})
|
||||
@ -104,7 +104,7 @@ minetest.register_abm({
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:cauldron_boiling_water"},
|
||||
interval = 3, chance = 1,
|
||||
action = function(pos, node, _, _)
|
||||
action = function(pos, node)
|
||||
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
||||
if not objs then return end
|
||||
|
||||
|
@ -36,7 +36,7 @@ minetest.register_craftitem("xdecor:bowl_soup", {
|
||||
wield_image = "xdecor_bowl_soup.png",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, _)
|
||||
on_use = function(itemstack, user)
|
||||
itemstack:replace("xdecor:bowl 1")
|
||||
if minetest.get_modpath("hunger") then
|
||||
minetest.item_eat(20)
|
||||
|
@ -32,7 +32,7 @@ function enchanting.formspec(pos, tooltype)
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
||||
function enchanting.on_put(pos, listname, _, stack, _)
|
||||
function enchanting.on_put(pos, listname, _, stack)
|
||||
if listname == "tool" then
|
||||
local stn = stack:get_name()
|
||||
if stn:find("pick") or stn:find("axe") or stn:find("shovel") then
|
||||
@ -47,7 +47,7 @@ function enchanting.on_put(pos, listname, _, stack, _)
|
||||
end
|
||||
end
|
||||
|
||||
function enchanting.fields(pos, _, fields, _)
|
||||
function enchanting.fields(pos, _, fields)
|
||||
if fields.quit then return end
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local toolstack = inv:get_stack("tool", 1)
|
||||
@ -68,7 +68,7 @@ function enchanting.fields(pos, _, fields, _)
|
||||
end
|
||||
end
|
||||
|
||||
function enchanting.dig(pos, _)
|
||||
function enchanting.dig(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
return inv:is_empty("tool") and inv:is_empty("mese")
|
||||
end
|
||||
@ -82,7 +82,7 @@ local function allowed(tool)
|
||||
return false
|
||||
end
|
||||
|
||||
function enchanting.put(_, listname, _, stack, _)
|
||||
function enchanting.put(_, listname, _, stack)
|
||||
local toolstack = stack:get_name()
|
||||
local toolname = toolstack:match("[%w_]+:([%w_]+)")
|
||||
|
||||
@ -95,7 +95,7 @@ function enchanting.put(_, listname, _, stack, _)
|
||||
return 0
|
||||
end
|
||||
|
||||
function enchanting.on_take(pos, listname, _, _, _)
|
||||
function enchanting.on_take(pos, listname)
|
||||
if listname == "tool" then
|
||||
enchanting.formspec(pos, nil)
|
||||
end
|
||||
|
4
hive.lua
4
hive.lua
@ -27,7 +27,7 @@ xdecor.register("hive", {
|
||||
},
|
||||
groups = {choppy=3, oddly_breakable_by_hand=2, flammable=1},
|
||||
on_construct = hive.construct,
|
||||
can_dig = function(pos, _)
|
||||
can_dig = function(pos)
|
||||
return minetest.get_meta(pos):get_inventory():is_empty("honey")
|
||||
end,
|
||||
on_punch = function(_, _, puncher)
|
||||
@ -39,7 +39,7 @@ xdecor.register("hive", {
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:hive"},
|
||||
interval = 30, chance = 10,
|
||||
action = function(pos, _, _, _)
|
||||
action = function(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local honeystack = inv:get_stack("honey", 1)
|
||||
local honey = honeystack:get_count()
|
||||
|
@ -144,7 +144,7 @@ xdecor.register("frame", {
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:frame"},
|
||||
interval = 15, chance = 1,
|
||||
action = function(pos, node, _, _)
|
||||
action = function(pos, node)
|
||||
local num = #minetest.get_objects_inside_radius(pos, 0.5)
|
||||
if num > 0 then return end
|
||||
update_item(pos, node)
|
||||
|
@ -10,7 +10,7 @@ xdecor.register("mailbox", {
|
||||
},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=1},
|
||||
on_rotate = screwdriver.rotate_simple,
|
||||
after_place_node = function(pos, placer, _)
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player_name = placer:get_player_name()
|
||||
|
||||
@ -21,7 +21,7 @@ xdecor.register("mailbox", {
|
||||
inv:set_size("mailbox", 6*4)
|
||||
inv:set_size("drop", 1)
|
||||
end,
|
||||
on_rightclick = function(pos, _, clicker, _)
|
||||
on_rightclick = function(pos, _, clicker)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
|
13
nodes.lua
13
nodes.lua
@ -134,7 +134,7 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here.
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {dig_immediate=3, flammable=3},
|
||||
selection_box = {type="wallmounted"},
|
||||
on_rightclick = function(pos, node, _, _)
|
||||
on_rightclick = function(pos, node)
|
||||
minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=node.param2})
|
||||
end
|
||||
})
|
||||
@ -147,7 +147,7 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here.
|
||||
groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
|
||||
selection_box = {type="wallmounted"},
|
||||
drop = "xdecor:curtain_"..c,
|
||||
on_rightclick = function(pos, node, _, _)
|
||||
on_rightclick = function(pos, node)
|
||||
minetest.set_node(pos, {name="xdecor:curtain_"..c, param2=node.param2})
|
||||
end
|
||||
})
|
||||
@ -272,7 +272,7 @@ minetest.register_tool("xdecor:hammer", {
|
||||
description = "Hammer",
|
||||
inventory_image = "xdecor_hammer.png",
|
||||
wield_image = "xdecor_hammer.png",
|
||||
on_use = function(...) do return end end
|
||||
on_use = function() do return end end
|
||||
})
|
||||
|
||||
xdecor.register("ivy", {
|
||||
@ -453,14 +453,13 @@ xdecor.register("stonepath", {
|
||||
selection_box = xdecor.nodebox.slab_y(0.05)
|
||||
})
|
||||
|
||||
local stonish = {"desertstone_tile", "stone_tile", "stone_rune", "coalstone_tile",
|
||||
"hard_clay"}
|
||||
local stonish = {"desertstone_tile", "stone_tile", "stone_rune",
|
||||
"coalstone_tile", "hard_clay"}
|
||||
|
||||
for _, t in pairs(stonish) do
|
||||
xdecor.register(t, {
|
||||
drawtype = "normal",
|
||||
description = string.sub(t:gsub("^%l", string.upper), 1, -6)
|
||||
.." "..t:sub(-4):gsub("^%l", string.upper),
|
||||
description = string.gsub(" "..t, "%W%l", string.upper):sub(2):gsub("_", " "),
|
||||
tiles = {"xdecor_"..t..".png"},
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
|
@ -207,7 +207,7 @@ function worktable.construct(pos)
|
||||
worktable.main(meta)
|
||||
end
|
||||
|
||||
function worktable.fields(pos, _, fields, _)
|
||||
function worktable.fields(pos, _, fields)
|
||||
if fields.quit then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
@ -260,7 +260,7 @@ function worktable.fields(pos, _, fields, _)
|
||||
end
|
||||
end
|
||||
|
||||
function worktable.dig(pos, _)
|
||||
function worktable.dig(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
return inv:is_empty("input") and inv:is_empty("hammer") and
|
||||
inv:is_empty("tool") and inv:is_empty("storage")
|
||||
@ -277,7 +277,7 @@ function worktable.contains(table, element)
|
||||
return false
|
||||
end
|
||||
|
||||
function worktable.put(_, listname, _, stack, _)
|
||||
function worktable.put(_, listname, _, stack)
|
||||
local stackname = stack:get_name()
|
||||
local mod, node = stackname:match("([%w_]+):([%w_]+)")
|
||||
|
||||
@ -306,7 +306,7 @@ function worktable.take(pos, listname, _, stack, player)
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
function worktable.move(pos, from_list, from_index, to_list, to_index, count, _)
|
||||
function worktable.move(pos, from_list, from_index, to_list, to_index, count)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
@ -340,14 +340,14 @@ function worktable.get_output(inv, stack)
|
||||
inv:set_list("forms", output)
|
||||
end
|
||||
|
||||
function worktable.on_put(pos, listname, _, stack, _)
|
||||
function worktable.on_put(pos, listname, _, stack)
|
||||
if listname == "input" then
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
worktable.get_output(inv, stack)
|
||||
end
|
||||
end
|
||||
|
||||
function worktable.on_take(pos, listname, index, stack, _)
|
||||
function worktable.on_take(pos, listname, index, stack)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local inputstack = inv:get_stack("input", 1)
|
||||
|
||||
@ -429,13 +429,12 @@ end
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:worktable"},
|
||||
interval = 3, chance = 1,
|
||||
action = function(pos, _, _, _)
|
||||
action = function(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local tool = inv:get_stack("tool", 1)
|
||||
local hammer = inv:get_stack("hammer", 1)
|
||||
local wear = tool:get_wear()
|
||||
|
||||
if tool:is_empty() or hammer:is_empty() or wear == 0 then
|
||||
if tool:is_empty() or hammer:is_empty() or tool:get_wear() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user