1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-26 01:30:29 +01:00

Updated pipeworks : HUD bug apparently fixed

- Automatic systems simulating players now check if the player they imitate exists
This commit is contained in:
LeMagnesium 2015-03-17 20:50:58 +01:00
parent e2bc63b91f
commit 547aae51c8
9 changed files with 48 additions and 19 deletions

View File

@ -1,7 +1,7 @@
This mod uses nodeboxes to supply a complete set of 3D pipes and tubes, This mod uses nodeboxes to supply a complete set of 3D pipes and tubes,
along devices that work with them. along devices that work with them.
See http://vanessae.github.io/pipeworks/ for detailed information about usage of this mod. See https://github.com/VanessaE/pipeworks/wiki/ for detailed information about usage of this mod.
Unlike the previous version of this mod, these pipes are rounded, and when Unlike the previous version of this mod, these pipes are rounded, and when
placed, they'll automatically join together as needed. Pipes can go vertically placed, they'll automatically join together as needed. Pipes can go vertically

View File

@ -266,6 +266,7 @@ minetest.register_node("pipeworks:autocrafter", {
update_meta(meta, false) update_meta(meta, false)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not pipeworks.may_configure(pos, sender) then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields.on then if fields.on then
update_meta(meta, false) update_meta(meta, false)
@ -290,6 +291,7 @@ minetest.register_node("pipeworks:autocrafter", {
autocrafterCache[minetest.hash_node_position(pos)] = nil autocrafterCache[minetest.hash_node_position(pos)] = nil
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then return 0 end
upgrade_autocrafter(pos) upgrade_autocrafter(pos)
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
if listname == "recipe" then if listname == "recipe" then
@ -305,6 +307,10 @@ minetest.register_node("pipeworks:autocrafter", {
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then
minetest.log("action", string.format("%s attempted to take from autocrafter at %s", player:get_player_name(), minetest.pos_to_string(pos)))
return 0
end
upgrade_autocrafter(pos) upgrade_autocrafter(pos)
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
if listname == "recipe" then if listname == "recipe" then
@ -319,6 +325,7 @@ minetest.register_node("pipeworks:autocrafter", {
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if not pipeworks.may_configure(pos, player) then return 0 end
upgrade_autocrafter(pos) upgrade_autocrafter(pos)
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
local stack = inv:get_stack(from_list, from_index) local stack = inv:get_stack(from_list, from_index)

View File

@ -567,4 +567,5 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
}) })
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty") minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")

View File

@ -181,12 +181,25 @@ for _, data in ipairs({
end, end,
after_dig_node = pipeworks.after_dig, after_dig_node = pipeworks.after_dig,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not pipeworks.may_configure(pos, sender) then return end
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("slotseq_index", 1) meta:set_int("slotseq_index", 1)
set_filter_formspec(data, meta) set_filter_formspec(data, meta)
set_filter_infotext(data, meta) set_filter_infotext(data, meta)
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then return 0 end
return stack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then return 0 end
return stack:get_count()
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if not pipeworks.may_configure(pos, player) then return 0 end
return count
end,
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()

View File

@ -57,6 +57,17 @@ function pipeworks.add_node_box(t, b)
end end
end end
function pipeworks.may_configure(pos, player)
local name = player:get_player_name()
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if owner ~= "" then -- wielders and filters
return owner == name
end
return not minetest.is_protected(pos, name)
end
function pipeworks.node_is_owned(pos, placer) function pipeworks.node_is_owned(pos, placer)
local ownername = false local ownername = false
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod

View File

@ -91,6 +91,7 @@ if pipeworks.enable_mese_tube then
end, end,
on_punch = update_formspec, on_punch = update_formspec,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if not pipeworks.may_configure(pos, sender) then return end
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
update_formspec(pos) update_formspec(pos)
end, end,
@ -99,6 +100,7 @@ if pipeworks.enable_mese_tube then
return true return true
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then return 0 end
update_formspec(pos) -- For old tubes update_formspec(pos) -- For old tubes
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
local stack_copy = ItemStack(stack) local stack_copy = ItemStack(stack)
@ -107,12 +109,14 @@ if pipeworks.enable_mese_tube then
return 0 return 0
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if not pipeworks.may_configure(pos, player) then return 0 end
update_formspec(pos) -- For old tubes update_formspec(pos) -- For old tubes
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
inv:set_stack(listname, index, ItemStack("")) inv:set_stack(listname, index, ItemStack(""))
return 0 return 0
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if not pipeworks.may_configure(pos, player) then return 0 end
update_formspec(pos) -- For old tubes update_formspec(pos) -- For old tubes
local inv = minetest.get_meta(pos):get_inventory() local inv = minetest.get_meta(pos):get_inventory()
inv:set_stack(from_list, from_index, ItemStack("")) inv:set_stack(from_list, from_index, ItemStack(""))

View File

@ -154,8 +154,9 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
meta:set_string("infotext", "unconfigured Teleportation Tube") meta:set_string("infotext", "unconfigured Teleportation Tube")
end, end,
on_receive_fields = function(pos,formname,fields,sender) on_receive_fields = function(pos,formname,fields,sender)
if not fields.channel then if not fields.channel -- ignore escaping or clientside manipulation of the form
return -- ignore escaping or clientside manipulation of the form or not pipeworks.may_configure(pos, sender) then
return
end end
local new_channel = tostring(fields.channel):trim() local new_channel = tostring(fields.channel):trim()
@ -226,7 +227,7 @@ minetest.register_craft( {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:desert_stone", "default:mese_block", "default:desert_stone" }, { "default:desert_stone", "default:mese_block", "default:desert_stone" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
}, }, -- MODIFICATION MADE FOR MFF ^
}) })
if minetest.get_modpath("mesecons_mvps") ~= nil then if minetest.get_modpath("mesecons_mvps") ~= nil then

View File

@ -47,6 +47,7 @@ if pipeworks.enable_mese_sand_tube then
meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment") meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment")
end, end,
on_receive_fields = function(pos,formname,fields,sender) on_receive_fields = function(pos,formname,fields,sender)
if not pipeworks.may_configure(pos, sender) then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local dist = tonumber(fields.dist) local dist = tonumber(fields.dist)
if dist then if dist then

View File

@ -230,27 +230,18 @@ local function register_wielder(data)
pipeworks.scan_for_tube_objects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
on_punch = data.fixup_node, on_punch = data.fixup_node,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos)
if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then
return 0
end
return count
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) if not pipeworks.may_configure(pos, player) then return 0 end
if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then
return 0
end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) if not pipeworks.may_configure(pos, player) then return 0 end
if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then
return 0
end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if not pipeworks.may_configure(pos, player) then return 0 end
return count
end
}) })
end end
end end