More tweaks & cleanup on hammer/worktable
This commit is contained in:
parent
3778a20957
commit
5aea49f875
@ -134,7 +134,7 @@ xdecor.register("frame", {
|
|||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"xdecor:frame"},
|
nodenames = {"xdecor:frame"},
|
||||||
interval = 15,
|
interval = 5,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then
|
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then
|
||||||
|
@ -340,13 +340,7 @@ minetest.register_tool("xdecor:flint_steel", {
|
|||||||
|
|
||||||
minetest.register_tool("xdecor:hammer", {
|
minetest.register_tool("xdecor:hammer", {
|
||||||
description = "Hammer",
|
description = "Hammer",
|
||||||
inventory_image = "xdecor_hammer.png",
|
inventory_image = "xdecor_hammer.png"
|
||||||
tool_capabilities = {
|
|
||||||
groupcaps = { snappy = {uses=20, maxlevel=2} }
|
|
||||||
},
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing.type == "node" then return end -- The hammer ain't meant for digging but for repairing.
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("ivy", {
|
xdecor.register("ivy", {
|
||||||
|
BIN
textures/xdecor_enchantment_bottom.png
Normal file
BIN
textures/xdecor_enchantment_bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
BIN
textures/xdecor_enchantment_side.png
Normal file
BIN
textures/xdecor_enchantment_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 371 B |
BIN
textures/xdecor_enchantment_top.png
Normal file
BIN
textures/xdecor_enchantment_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 186 B |
@ -53,18 +53,18 @@ local function xconstruct(pos)
|
|||||||
"label[2,1.5;Output]"..
|
"label[2,1.5;Output]"..
|
||||||
"list[current_name;output;2,2;1,1;]"..
|
"list[current_name;output;2,2;1,1;]"..
|
||||||
"label[5,1.5;Tool]"..
|
"label[5,1.5;Tool]"..
|
||||||
"list[current_name;src;5,2;1,1;]"..
|
"list[current_name;tool;5,2;1,1;]"..
|
||||||
"image[6,2;1,1;xdecor_anvil.png]"..
|
"image[6,2;1,1;xdecor_anvil.png]"..
|
||||||
"label[6.8,1.5;Hammer]]"..
|
"label[6.8,1.5;Hammer]]"..
|
||||||
"list[current_name;fuel;7,2;1,1;]"..
|
"list[current_name;hammer;7,2;1,1;]"..
|
||||||
"list[current_player;main;0,3.25;8,4;]")
|
"list[current_player;main;0,3.25;8,4;]")
|
||||||
meta:set_string("infotext", "Work Table")
|
meta:set_string("infotext", "Work Table")
|
||||||
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("output", 1)
|
inv:set_size("output", 1)
|
||||||
inv:set_size("input", 1)
|
inv:set_size("input", 1)
|
||||||
inv:set_size("src", 1)
|
inv:set_size("tool", 1)
|
||||||
inv:set_size("fuel", 1)
|
inv:set_size("hammer", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function xfields(pos, formname, fields, sender)
|
local function xfields(pos, formname, fields, sender)
|
||||||
@ -112,14 +112,14 @@ local function xput(pos, listname, index, stack, player)
|
|||||||
if listname == "output" then
|
if listname == "output" then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if listname == "fuel" then
|
if listname == "hammer" then
|
||||||
if stack:get_name() == "xdecor:hammer" then
|
if stack:get_name() == "xdecor:hammer" then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if listname == "src" then
|
if listname == "tool" then
|
||||||
local tname = stack:get_name()
|
local tname = stack:get_name()
|
||||||
local tdef = minetest.registered_tools[tname]
|
local tdef = minetest.registered_tools[tname]
|
||||||
local twear = stack:get_wear()
|
local twear = stack:get_wear()
|
||||||
@ -196,7 +196,7 @@ for m=1, #material do
|
|||||||
light_source = light,
|
light_source = light,
|
||||||
sounds = sound,
|
sounds = sound,
|
||||||
tiles = {tile},
|
tiles = {tile},
|
||||||
groups = {snappy=2, cracky=2, not_in_creative_inventory=1},
|
groups = {snappy=2, cracky=3, not_in_creative_inventory=1},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = w[3]
|
fixed = w[3]
|
||||||
@ -208,27 +208,27 @@ end
|
|||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"xdecor:worktable"},
|
nodenames = {"xdecor:worktable"},
|
||||||
interval = 1, chance = 1,
|
interval = 2, chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local src = inv:get_stack("src", 1)
|
local tool = inv:get_stack("tool", 1)
|
||||||
local fuel = inv:get_stack("fuel", 1)
|
local hammer = inv:get_stack("hammer", 1)
|
||||||
local wear = src:get_wear()
|
local wear = tool:get_wear()
|
||||||
local wear2 = fuel:get_wear()
|
local wear2 = hammer:get_wear()
|
||||||
|
|
||||||
local repair = -1400 -- Tool's repairing factor (higher in negative means greater repairing).
|
local repair = -500 -- Tool's repairing factor (higher in negative means greater repairing).
|
||||||
local wearhammer = 700 -- Hammer's wearing factor (higher in positive means greater wearing).
|
local wearhammer = 250 -- Hammer's wearing factor (higher in positive means greater wearing).
|
||||||
|
|
||||||
if (src:is_empty() or wear == 0 or wear == 65535) then return end
|
if (tool:is_empty() or wear == 0 or wear == 65535) then return end
|
||||||
|
|
||||||
if (fuel:is_empty() or fuel:get_name() ~= "xdecor:hammer") then
|
if (hammer:is_empty() or hammer:get_name() ~= "xdecor:hammer") then
|
||||||
return end
|
return end
|
||||||
|
|
||||||
src:add_wear(repair)
|
tool:add_wear(repair)
|
||||||
fuel:add_wear(wearhammer)
|
hammer:add_wear(wearhammer)
|
||||||
|
|
||||||
inv:set_stack("src", 1, src)
|
inv:set_stack("tool", 1, tool)
|
||||||
inv:set_stack("fuel", 1, fuel)
|
inv:set_stack("hammer", 1, hammer)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user