Global cleaning + fix cushion sitting when node.param2 > 3
This commit is contained in:
parent
7978618ac0
commit
f0d50395b9
@ -31,21 +31,19 @@ function enchanting.on_put(pos, listname, _, stack, _)
|
|||||||
local stn = stack:get_name()
|
local stn = stack:get_name()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
if listname == "tool" then
|
if listname == "tool" and stn:find("sword") then
|
||||||
if stn:find("sword") then
|
meta:set_string("formspec", enchanting.swords_fs())
|
||||||
meta:set_string("formspec", enchanting.swords_fs())
|
else meta:set_string("formspec", enchanting.tools_fs()) end
|
||||||
else
|
|
||||||
meta:set_string("formspec", enchanting.tools_fs())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function enchanting.is_allowed(toolname)
|
function enchanting.is_allowed(toolname)
|
||||||
local tdef = minetest.registered_tools[toolname]
|
local tdef = minetest.registered_tools[toolname]
|
||||||
if tdef and toolname:find("default:") and not toolname:find("stone") and not
|
if tdef and toolname:find("default:") and not
|
||||||
|
toolname:find("stone") and not
|
||||||
toolname:find("wood") then
|
toolname:find("wood") then
|
||||||
return 1
|
return 1
|
||||||
else return 0 end
|
end
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function enchanting.fields(pos, _, fields, _)
|
function enchanting.fields(pos, _, fields, _)
|
||||||
@ -69,22 +67,19 @@ end
|
|||||||
|
|
||||||
function enchanting.dig(pos, _)
|
function enchanting.dig(pos, _)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
if not inv:is_empty("tool") or not inv:is_empty("mese") then
|
return inv:is_empty("tool") and inv:is_empty("mese")
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function enchanting.put(_, listname, _, stack, _)
|
function enchanting.put(_, listname, _, stack, _)
|
||||||
local toolname = stack:get_name()
|
local toolname = stack:get_name()
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
|
|
||||||
if listname == "mese" then
|
if listname == "mese" and
|
||||||
if toolname == "default:mese_crystal" then return count
|
toolname == "default:mese_crystal" then return count
|
||||||
else return 0 end
|
elseif listname == "tool" then
|
||||||
|
return enchanting.is_allowed(toolname)
|
||||||
end
|
end
|
||||||
if listname == "tool" then return enchanting.is_allowed(toolname) end
|
return 0
|
||||||
return count
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xdecor.register("enchantment_table", {
|
xdecor.register("enchantment_table", {
|
||||||
|
13
hive.lua
13
hive.lua
@ -15,8 +15,7 @@ end
|
|||||||
|
|
||||||
function hive.dig(pos, _)
|
function hive.dig(pos, _)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
if not inv:is_empty("honey") then return false end
|
return inv:is_empty("honey")
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xdecor.register("hive", {
|
xdecor.register("hive", {
|
||||||
@ -37,10 +36,7 @@ xdecor.register("hive", {
|
|||||||
local health = clicker:get_hp()
|
local health = clicker:get_hp()
|
||||||
clicker:set_hp(health - 1)
|
clicker:set_hp(health - 1)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = function(_, listname, _, stack, _)
|
allow_metadata_inventory_put = function(...) return 0 end
|
||||||
if listname == "honey" then return 0 end
|
|
||||||
return stack:get_count()
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -56,7 +52,8 @@ minetest.register_abm({
|
|||||||
local maxp = vector.add(pos, radius)
|
local maxp = vector.add(pos, radius)
|
||||||
local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower")
|
local flowers = minetest.find_nodes_in_area(minp, maxp, "group:flower")
|
||||||
|
|
||||||
if #flowers >= 2 and honey < 10 then
|
if #flowers >= 2 and honey < 12 then
|
||||||
inv:add_item("honey", "xdecor:honey") end
|
inv:add_item("honey", "xdecor:honey")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
17
mailbox.lua
17
mailbox.lua
@ -1,6 +1,6 @@
|
|||||||
local mailbox = {}
|
local mailbox = {}
|
||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,5.25)
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
|
|
||||||
xdecor.register("mailbox", {
|
xdecor.register("mailbox", {
|
||||||
description = "Mailbox",
|
description = "Mailbox",
|
||||||
@ -38,9 +38,7 @@ xdecor.register("mailbox", {
|
|||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
if not inv:is_empty("main") or not player or
|
return inv:is_empty("main") and player and player:get_player_name() == owner
|
||||||
player:get_player_name() ~= owner then return false end
|
|
||||||
return true
|
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_put = function(pos, listname, _, stack, _)
|
on_metadata_inventory_put = function(pos, listname, _, stack, _)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
@ -50,26 +48,23 @@ xdecor.register("mailbox", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = function(pos, listname, _, stack, _)
|
allow_metadata_inventory_put = function(pos, listname, _, stack, _)
|
||||||
if listname == "main" then return 0 end
|
|
||||||
if listname == "drop" then
|
if listname == "drop" then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if inv:room_for_item("main", stack) then return -1
|
if inv:room_for_item("main", stack) then return -1 end
|
||||||
else return 0 end
|
|
||||||
end
|
end
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
function mailbox.get_formspec(pos)
|
function mailbox.get_formspec(pos)
|
||||||
local spos = pos.x..","..pos.y..","..pos.z
|
local spos = pos.x..","..pos.y..","..pos.z
|
||||||
local formspec = "size[8,9]"..xbg..
|
return "size[8,9]"..xbg..default.get_hotbar_bg(0,5.25)..
|
||||||
"label[0,0;You received...]list[nodemeta:"..spos..";main;0,0.75;8,4;]list[current_player;main;0,5.25;8,4;]"
|
"label[0,0;You received...]list[nodemeta:"..spos..";main;0,0.75;8,4;]list[current_player;main;0,5.25;8,4;]"
|
||||||
return formspec
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function mailbox.get_insert_formspec(pos, owner)
|
function mailbox.get_insert_formspec(pos, owner)
|
||||||
local spos = pos.x..","..pos.y..","..pos.z
|
local spos = pos.x..","..pos.y..","..pos.z
|
||||||
local formspec = "size[8,5]"..xbg..
|
return "size[8,5]"..xbg..default.get_hotbar_bg(0,1.25)..
|
||||||
"label[0.5,0;Send your goods\nto "..owner.." :]list[nodemeta:"..spos..";drop;3.5,0;1,1;]list[current_player;main;0,1.25;8,4;]"
|
"label[0.5,0;Send your goods\nto "..owner.." :]list[nodemeta:"..spos..";drop;3.5,0;1,1;]list[current_player;main;0,1.25;8,4;]"
|
||||||
return formspec
|
|
||||||
end
|
end
|
||||||
|
21
nodes.lua
21
nodes.lua
@ -1,4 +1,5 @@
|
|||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
|
|
||||||
local function sit(pos, node, clicker)
|
local function sit(pos, node, clicker)
|
||||||
local player = clicker:get_player_name()
|
local player = clicker:get_player_name()
|
||||||
@ -12,7 +13,7 @@ local function sit(pos, node, clicker)
|
|||||||
elseif default.player_attached[player] ~= true and
|
elseif default.player_attached[player] ~= true and
|
||||||
clicker:get_player_velocity().x == 0 and
|
clicker:get_player_velocity().x == 0 and
|
||||||
clicker:get_player_velocity().y == 0 and
|
clicker:get_player_velocity().y == 0 and
|
||||||
clicker:get_player_velocity().z == 0 then
|
clicker:get_player_velocity().z == 0 and node.param2 <= 3 then
|
||||||
|
|
||||||
clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
|
clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
|
||||||
clicker:set_physics_override(0, 0, 0)
|
clicker:set_physics_override(0, 0, 0)
|
||||||
@ -28,8 +29,8 @@ local function sit(pos, node, clicker)
|
|||||||
clicker:set_look_yaw(6.28)
|
clicker:set_look_yaw(6.28)
|
||||||
elseif node.param2 == 3 then
|
elseif node.param2 == 3 then
|
||||||
clicker:set_look_yaw(4.75)
|
clicker:set_look_yaw(4.75)
|
||||||
else return end
|
end
|
||||||
else return end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
xpanes.register_pane("bamboo_frame", {
|
xpanes.register_pane("bamboo_frame", {
|
||||||
@ -188,8 +189,7 @@ xdecor.register("chair", {
|
|||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
for _, p in pairs(objs) do
|
for _, p in pairs(objs) do
|
||||||
if p:get_player_name() ~= clicker:get_player_name() or
|
if p:get_player_name() ~= clicker:get_player_name() then return end
|
||||||
node.param2 > 3 then return end
|
|
||||||
end
|
end
|
||||||
pos.y = pos.y + 0
|
pos.y = pos.y + 0
|
||||||
sit(pos, node, clicker)
|
sit(pos, node, clicker)
|
||||||
@ -284,8 +284,7 @@ xdecor.register("cushion", {
|
|||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
local objs = minetest.get_objects_inside_radius(pos, 0.5)
|
||||||
for _, p in pairs(objs) do
|
for _, p in pairs(objs) do
|
||||||
if p:get_player_name() ~= clicker:get_player_name() or
|
if p:get_player_name() ~= clicker:get_player_name() then return end
|
||||||
node.param2 > 3 then return end
|
|
||||||
end
|
end
|
||||||
pos.y = pos.y + 0
|
pos.y = pos.y + 0
|
||||||
sit(pos, node, clicker)
|
sit(pos, node, clicker)
|
||||||
@ -306,8 +305,7 @@ xdecor.register("cushion", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
local function door_access(door)
|
local function door_access(door)
|
||||||
if door:find("prison") then return true end
|
return door:find("prison")
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local door_types = {
|
local door_types = {
|
||||||
@ -350,8 +348,7 @@ xdecor.register("enderchest", {
|
|||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots..default.get_hotbar_bg(0,5)
|
meta:set_string("formspec", "size[8,9]"..xbg..default.get_hotbar_bg(0,5)
|
||||||
meta:set_string("formspec", "size[8,9]"..xbg..
|
|
||||||
"list[current_player;enderchest;0,0;8,4;]"..
|
"list[current_player;enderchest;0,0;8,4;]"..
|
||||||
"list[current_player;main;0,5;8,4;]")
|
"list[current_player;main;0,5;8,4;]")
|
||||||
meta:set_string("infotext", "Ender Chest")
|
meta:set_string("infotext", "Ender Chest")
|
||||||
@ -395,7 +392,7 @@ minetest.register_tool("xdecor:flint_steel", {
|
|||||||
else
|
else
|
||||||
minetest.chat_send_player(player, "This area is protected.")
|
minetest.chat_send_player(player, "This area is protected.")
|
||||||
end
|
end
|
||||||
else return end
|
end
|
||||||
|
|
||||||
itemstack:add_wear(1000)
|
itemstack:add_wear(1000)
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -41,10 +41,8 @@ end
|
|||||||
|
|
||||||
function worktable.storage(pos)
|
function worktable.storage(pos)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
local f = "size[8,7]"..xbg..
|
|
||||||
"list[context;storage;0,0;8,2;]list[current_player;main;0,3.25;8,4;]"
|
|
||||||
inv:set_size("storage", 8*2)
|
inv:set_size("storage", 8*2)
|
||||||
return f
|
return "size[8,7]"..xbg.."list[context;storage;0,0;8,2;]list[current_player;main;0,3.25;8,4;]"
|
||||||
end
|
end
|
||||||
|
|
||||||
function worktable.construct(pos)
|
function worktable.construct(pos)
|
||||||
@ -76,11 +74,8 @@ end
|
|||||||
|
|
||||||
function worktable.dig(pos, _)
|
function worktable.dig(pos, _)
|
||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
if not inv:is_empty("input") or not inv:is_empty("hammer") or not
|
return inv:is_empty("input") and inv:is_empty("hammer") and
|
||||||
inv:is_empty("tool") or not inv:is_empty("storage") then
|
inv:is_empty("tool") and inv:is_empty("storage")
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function worktable.contains(table, element)
|
function worktable.contains(table, element)
|
||||||
@ -96,18 +91,17 @@ function worktable.put(_, listname, _, stack, _)
|
|||||||
local stn = stack:get_name()
|
local stn = stack:get_name()
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
local mod, node = stn:match("([%a_]+):([%a_]+)")
|
local mod, node = stn:match("([%a_]+):([%a_]+)")
|
||||||
|
local tdef = minetest.registered_tools[stn]
|
||||||
|
local twear = stack:get_wear()
|
||||||
|
|
||||||
if listname == "forms" then return 0
|
if listname == "input" and
|
||||||
elseif listname == "input" then
|
worktable.contains(nodes[mod], node) then return count
|
||||||
if not worktable.contains(nodes[mod], node) then return 0 end
|
elseif listname == "hammer" and
|
||||||
elseif listname == "hammer" then
|
stn == "xdecor:hammer" then return 1
|
||||||
if stn ~= "xdecor:hammer" then return 0 end
|
elseif listname == "tool" and tdef and twear > 0 then
|
||||||
elseif listname == "tool" then
|
return 1
|
||||||
local tdef = minetest.registered_tools[stn]
|
|
||||||
local twear = stack:get_wear()
|
|
||||||
if not (tdef and twear > 0) then return 0 end
|
|
||||||
end
|
end
|
||||||
return count
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function worktable.take(pos, listname, _, stack, _)
|
function worktable.take(pos, listname, _, stack, _)
|
||||||
@ -192,7 +186,8 @@ for _, name in pairs(n) do
|
|||||||
|
|
||||||
for k, v in pairs(ndef.groups) do
|
for k, v in pairs(ndef.groups) do
|
||||||
if k ~= "wood" and k ~= "stone" and k ~= "level" then
|
if k ~= "wood" and k ~= "stone" and k ~= "level" then
|
||||||
groups[k] = v end
|
groups[k] = v
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":"..mod..":"..name.."_"..d[1], {
|
minetest.register_node(":"..mod..":"..name.."_"..d[1], {
|
||||||
|
Loading…
Reference in New Issue
Block a user