mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Removed specific functions and added usage examples.
The specific functions didnt end up adding much simplicity, but did add some degree of confusion.
This commit is contained in:
parent
685a7ff256
commit
b0d9eed3e1
5 changed files with 5 additions and 52 deletions
|
@ -780,43 +780,3 @@ function mcl_util.check_position_protection(position, player, create_log)
|
|||
|
||||
return false
|
||||
end
|
||||
|
||||
--[[Check protection violation for a planting action.
|
||||
--
|
||||
-- @param pointed_thing The pointed_thing table for the object the action was pointed at.
|
||||
-- @param player See mcl_util.check_positions_protection.
|
||||
-- @param create_log See mcl_util.check_positions_protection.
|
||||
--
|
||||
-- @return See mcl_util.check_positions_protection.
|
||||
]]
|
||||
function mcl_util.check_planting_protection(pointed_thing, player, create_log)
|
||||
-- We dont want to allow planting on top of protected positions, even if the air is unprotected.
|
||||
return mcl_util.check_positions_protection({pointed_thing.above, pointed_thing.under}, player,
|
||||
create_log)
|
||||
end
|
||||
|
||||
--[[Check protection violation for a node placement action.
|
||||
--
|
||||
-- @param pointed_thing The pointed_thing table for the object the action was pointed at.
|
||||
-- @param player See mcl_util.check_positions_protection.
|
||||
-- @param create_log See mcl_util.check_positions_protection.
|
||||
--
|
||||
-- @return See mcl_util.check_positions_protection.
|
||||
]]
|
||||
function mcl_util.check_placement_protection(pointed_thing, player, create_log)
|
||||
return mcl_util.check_position_protection(pointed_thing.above, player, create_log)
|
||||
end
|
||||
|
||||
--[[Check protection violation for a node modification action.
|
||||
--
|
||||
-- Such as using a shovel or a hoe on dirt, destroying a block or using a chest.
|
||||
--
|
||||
-- @param pointed_thing The pointed_thing table for the object the action was pointed at.
|
||||
-- @param player See mcl_util.check_positions_protection.
|
||||
-- @param create_log See mcl_util.check_positions_protection.
|
||||
--
|
||||
-- @return See mcl_util.check_positions_protection.
|
||||
]]
|
||||
function mcl_util.check_node_modification_protection(pointed_thing, player, create_log)
|
||||
return mcl_util.check_position_protection(pointed_thing.under, player, create_log)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_ocean
|
||||
description = Includes various ocean nodes
|
||||
depends = mcl_core, mcl_sounds, mcl_dye
|
||||
depends = mcl_core, mcl_sounds, mcl_dye, mcl_util
|
||||
optional_depends = doc, doc_items, screwdriver
|
||||
|
|
|
@ -39,13 +39,7 @@ local function seagrass_on_place(itemstack, placer, pointed_thing)
|
|||
return itemstack
|
||||
end
|
||||
|
||||
if minetest.is_protected(pos_under, player_name) or
|
||||
minetest.is_protected(pos_above, player_name) then
|
||||
minetest.log("action", player_name
|
||||
.. " tried to place " .. itemstack:get_name()
|
||||
.. " at protected position "
|
||||
.. minetest.pos_to_string(pos_under))
|
||||
minetest.record_protection_violation(pos_under, player_name)
|
||||
if mcl_util.check_positions_protection({pos_under, pos_above}, placer, true) then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
|
|
@ -88,11 +88,10 @@ end
|
|||
--
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.is_protected(pos, name) then
|
||||
minetest.record_protection_violation(pos, name)
|
||||
if mcl_util.check_position_protection(pos, player) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "fuel" then
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = mcl_smoker
|
||||
depends = mcl_init, mcl_formspec, mcl_core, mcl_furnaces, mcl_sounds, mcl_craftguide, mcl_achievements, mcl_particles
|
||||
depends = mcl_init, mcl_formspec, mcl_core, mcl_furnaces, mcl_sounds, mcl_craftguide, mcl_achievements, mcl_particles, mcl_util
|
||||
optional_depends = doc, screwdriver
|
||||
|
|
Loading…
Reference in a new issue