Merge branch 'master' into mcl_bamboo_too
commit
27a487195a
|
@ -728,3 +728,48 @@ function mcl_util.set_bone_position(obj, bone, pos, rot)
|
|||
obj:set_bone_position(bone, pos or current_pos, rot or current_rot)
|
||||
end
|
||||
end
|
||||
|
||||
--[[Check for a protection violation in a given area.
|
||||
--
|
||||
-- Applies is_protected() to a 3D lattice of points in the defined volume. The points are spaced
|
||||
-- evenly throughout the volume and have a spacing similar to, but no larger than, "interval".
|
||||
--
|
||||
-- @param pos1 A position table of the area volume's first edge.
|
||||
-- @param pos2 A position table of the area volume's second edge.
|
||||
-- @param player The player performing the action.
|
||||
-- @param interval Optional. Max spacing between checked points at the volume.
|
||||
-- Default: Same as minetest.is_area_protected.
|
||||
--
|
||||
-- @return true on protection violation detection. false otherwise.
|
||||
--
|
||||
-- @notes *All corners and edges of the defined volume are checked.
|
||||
]]
|
||||
function mcl_util.check_area_protection(pos1, pos2, player, interval)
|
||||
local name = player and player:get_player_name() or ""
|
||||
|
||||
local protected_pos = minetest.is_area_protected(pos1, pos2, name, interval)
|
||||
if protected_pos then
|
||||
minetest.record_protection_violation(protected_pos, name)
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--[[Check for a protection violation on a single position.
|
||||
--
|
||||
-- @param position A position table to check for protection violation.
|
||||
-- @param player The player performing the action.
|
||||
--
|
||||
-- @return true on protection violation detection. false otherwise.
|
||||
]]
|
||||
function mcl_util.check_position_protection(position, player)
|
||||
local name = player and player:get_player_name() or ""
|
||||
|
||||
if minetest.is_protected(position, name) then
|
||||
minetest.record_protection_violation(position, name)
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -102,15 +102,27 @@ minetest.register_node("mcl_farming:beetroot", {
|
|||
0 seeds: 42.18%
|
||||
1 seed: 14.06%
|
||||
2 seeds: 18.75%
|
||||
3 seeds: 25% ]]
|
||||
3 seeds: 25%
|
||||
|
||||
correction: should always drop at least 1 seed. (1-4 seeds, per the minecraft wiki)
|
||||
--]]
|
||||
max_items = 2,
|
||||
items = {
|
||||
{ items = {"mcl_farming:beetroot_item"}, rarity = 1 },
|
||||
{items = {"mcl_farming:beetroot_item"}},
|
||||
{items = {"mcl_farming:beetroot_seeds 4"}, rarity = 6},
|
||||
{items = {"mcl_farming:beetroot_seeds 3"}, rarity = 4},
|
||||
{ items = {"mcl_farming:beetroot_seeds 2"}, rarity = 4 },
|
||||
{ items = {"mcl_farming:beetroot_seeds 1"}, rarity = 4 },
|
||||
{items = {"mcl_farming:beetroot_seeds 2"}, rarity = 3},
|
||||
{items = {"mcl_farming:beetroot_seeds"}, rarity = 1},
|
||||
},
|
||||
},
|
||||
|
||||
_mcl_fortune_drop = {
|
||||
discrete_uniform_distribution = true,
|
||||
items = {"mcl_farming:beetroot_item", "mcl_farming:beetroot_seeds"},
|
||||
min_count = 1,
|
||||
max_count = 3,
|
||||
cap = 5,
|
||||
},
|
||||
tiles = {"mcl_farming_beetroot_3.png"},
|
||||
inventory_image = "mcl_farming_beetroot_3.png",
|
||||
wield_image = "mcl_farming_beetroot_3.png",
|
||||
|
@ -165,3 +177,6 @@ if minetest.get_modpath("doc") then
|
|||
doc.add_entry_alias("nodes", "mcl_farming:beetroot_0", "nodes", "mcl_farming:beetroot_" .. i)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_alias("beetroot_seeds", "mcl_farming:beetroot_seeds")
|
||||
minetest.register_alias("beetroot", "mcl_farming:beetroot_item")
|
||||
|
|
|
@ -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_area_protection(pos_under, pos_above, placer) 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 New Issue