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({
|
||||
nodenames = {"xdecor:frame"},
|
||||
interval = 15,
|
||||
interval = 5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
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", {
|
||||
description = "Hammer",
|
||||
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
|
||||
inventory_image = "xdecor_hammer.png"
|
||||
})
|
||||
|
||||
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]"..
|
||||
"list[current_name;output;2,2;1,1;]"..
|
||||
"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]"..
|
||||
"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;]")
|
||||
meta:set_string("infotext", "Work Table")
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("output", 1)
|
||||
inv:set_size("input", 1)
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("fuel", 1)
|
||||
inv:set_size("tool", 1)
|
||||
inv:set_size("hammer", 1)
|
||||
end
|
||||
|
||||
local function xfields(pos, formname, fields, sender)
|
||||
@ -112,14 +112,14 @@ local function xput(pos, listname, index, stack, player)
|
||||
if listname == "output" then
|
||||
return 0
|
||||
end
|
||||
if listname == "fuel" then
|
||||
if listname == "hammer" then
|
||||
if stack:get_name() == "xdecor:hammer" then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
if listname == "src" then
|
||||
if listname == "tool" then
|
||||
local tname = stack:get_name()
|
||||
local tdef = minetest.registered_tools[tname]
|
||||
local twear = stack:get_wear()
|
||||
@ -196,7 +196,7 @@ for m=1, #material do
|
||||
light_source = light,
|
||||
sounds = sound,
|
||||
tiles = {tile},
|
||||
groups = {snappy=2, cracky=2, not_in_creative_inventory=1},
|
||||
groups = {snappy=2, cracky=3, not_in_creative_inventory=1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = w[3]
|
||||
@ -208,27 +208,27 @@ end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"xdecor:worktable"},
|
||||
interval = 1, chance = 1,
|
||||
interval = 2, chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local src = inv:get_stack("src", 1)
|
||||
local fuel = inv:get_stack("fuel", 1)
|
||||
local wear = src:get_wear()
|
||||
local wear2 = fuel:get_wear()
|
||||
local tool = inv:get_stack("tool", 1)
|
||||
local hammer = inv:get_stack("hammer", 1)
|
||||
local wear = tool:get_wear()
|
||||
local wear2 = hammer:get_wear()
|
||||
|
||||
local repair = -1400 -- Tool's repairing factor (higher in negative means greater repairing).
|
||||
local wearhammer = 700 -- Hammer's wearing factor (higher in positive means greater wearing).
|
||||
local repair = -500 -- Tool's repairing factor (higher in negative means greater repairing).
|
||||
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
|
||||
return end
|
||||
if (hammer:is_empty() or hammer:get_name() ~= "xdecor:hammer") then
|
||||
return end
|
||||
|
||||
src:add_wear(repair)
|
||||
fuel:add_wear(wearhammer)
|
||||
tool:add_wear(repair)
|
||||
hammer:add_wear(wearhammer)
|
||||
|
||||
inv:set_stack("src", 1, src)
|
||||
inv:set_stack("fuel", 1, fuel)
|
||||
inv:set_stack("tool", 1, tool)
|
||||
inv:set_stack("hammer", 1, hammer)
|
||||
end
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user