Protect: add bottles, mobspawner, fix repeater

This commit is contained in:
Wuzzy 2019-02-08 22:17:51 +01:00
parent 312b17a958
commit 9a3c6a3fd7
3 changed files with 46 additions and 25 deletions

View file

@ -3577,6 +3577,10 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
local name = placer:get_player_name()
local privs = minetest.get_player_privs(name)
if mod_mobspawners and under.name == "mcl_mobspawners:spawner" then
if minetest.is_protected(pointed_thing.under, name) then
minetest.record_protection_violation(pointed_thing.under, name)
return itemstack
end
if not privs.maphack then
minetest.chat_send_player(name, "You need the “maphack” privilege to change the mob spawner.")
return itemstack

View file

@ -257,7 +257,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
minetest.report_protection_violation(pos, protname)
minetest.record_protection_violation(pos, protname)
return
end
if node.name=="mesecons_delayer:delayer_off_1" then
@ -325,7 +325,7 @@ minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), {
on_rightclick = function (pos, node, clicker)
local protname = clicker:get_player_name()
if minetest.is_protected(pos, protname) then
minetest.report_protection_violation(pos, protname)
minetest.record_protection_violation(pos, protname)
return
end
if node.name=="mesecons_delayer:delayer_on_1" then

View file

@ -46,27 +46,34 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
get_water = true
river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1
elseif node.name == "mcl_cauldrons:cauldron_3" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
elseif node.name == "mcl_cauldrons:cauldron_2" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
elseif node.name == "mcl_cauldrons:cauldron_1" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
elseif node.name == "mcl_cauldrons:cauldron_3r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
elseif node.name == "mcl_cauldrons:cauldron_2r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
elseif node.name == "mcl_cauldrons:cauldron_1r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
if node.name == "mcl_cauldrons:cauldron_3" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
elseif node.name == "mcl_cauldrons:cauldron_2" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
elseif node.name == "mcl_cauldrons:cauldron_1" then
get_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
elseif node.name == "mcl_cauldrons:cauldron_3r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
elseif node.name == "mcl_cauldrons:cauldron_2r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
elseif node.name == "mcl_cauldrons:cauldron_1r" then
get_water = true
river_water = true
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
end
end
if get_water then
-- Replace with water bottle, if possible, otherwise
@ -160,7 +167,12 @@ minetest.register_craftitem("mcl_potions:potion_water", {
local cauldron = fill_cauldron(node.name, "mcl_core:water_source")
if cauldron then
-- Increase water level of cauldron by 1
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
-- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"
@ -195,7 +207,12 @@ minetest.register_craftitem("mcl_potions:potion_river_water", {
local cauldron = fill_cauldron(node.name, "mclx_core:river_water_source")
if cauldron then
-- Increase water level of cauldron by 1
local pname = placer:get_player_name()
if minetest.is_protected(pointed_thing.under, pname) then
minetest.record_protection_violation(pointed_thing.under, pname)
return itemstack
end
-- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
return "mcl_potions:glass_bottle"