forked from MineClone5/MineClone5
Protect: add bottles, mobspawner, fix repeater
This commit is contained in:
parent
312b17a958
commit
9a3c6a3fd7
|
@ -3577,6 +3577,10 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
local privs = minetest.get_player_privs(name)
|
local privs = minetest.get_player_privs(name)
|
||||||
if mod_mobspawners and under.name == "mcl_mobspawners:spawner" then
|
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
|
if not privs.maphack then
|
||||||
minetest.chat_send_player(name, "You need the “maphack” privilege to change the mob spawner.")
|
minetest.chat_send_player(name, "You need the “maphack” privilege to change the mob spawner.")
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -257,7 +257,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), {
|
||||||
on_rightclick = function (pos, node, clicker)
|
on_rightclick = function (pos, node, clicker)
|
||||||
local protname = clicker:get_player_name()
|
local protname = clicker:get_player_name()
|
||||||
if minetest.is_protected(pos, protname) then
|
if minetest.is_protected(pos, protname) then
|
||||||
minetest.report_protection_violation(pos, protname)
|
minetest.record_protection_violation(pos, protname)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if node.name=="mesecons_delayer:delayer_off_1" then
|
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)
|
on_rightclick = function (pos, node, clicker)
|
||||||
local protname = clicker:get_player_name()
|
local protname = clicker:get_player_name()
|
||||||
if minetest.is_protected(pos, protname) then
|
if minetest.is_protected(pos, protname) then
|
||||||
minetest.report_protection_violation(pos, protname)
|
minetest.record_protection_violation(pos, protname)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if node.name=="mesecons_delayer:delayer_on_1" then
|
if node.name=="mesecons_delayer:delayer_on_1" then
|
||||||
|
|
|
@ -46,27 +46,34 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
get_water = true
|
get_water = true
|
||||||
river_water = node.name == "mclx_core:river_water_source"
|
river_water = node.name == "mclx_core:river_water_source"
|
||||||
-- Or reduce water level of cauldron by 1
|
-- Or reduce water level of cauldron by 1
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_3" then
|
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then
|
||||||
get_water = true
|
local pname = placer:get_player_name()
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
|
if minetest.is_protected(pointed_thing.under, pname) then
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_2" then
|
minetest.record_protection_violation(pointed_thing.under, pname)
|
||||||
get_water = true
|
return itemstack
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
|
end
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_1" then
|
if node.name == "mcl_cauldrons:cauldron_3" then
|
||||||
get_water = true
|
get_water = true
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_3r" then
|
elseif node.name == "mcl_cauldrons:cauldron_2" then
|
||||||
get_water = true
|
get_water = true
|
||||||
river_water = true
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
|
elseif node.name == "mcl_cauldrons:cauldron_1" then
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_2r" then
|
get_water = true
|
||||||
get_water = true
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
||||||
river_water = true
|
elseif node.name == "mcl_cauldrons:cauldron_3r" then
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
|
get_water = true
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_1r" then
|
river_water = true
|
||||||
get_water = true
|
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
|
||||||
river_water = true
|
elseif node.name == "mcl_cauldrons:cauldron_2r" then
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
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
|
end
|
||||||
if get_water then
|
if get_water then
|
||||||
-- Replace with water bottle, if possible, otherwise
|
-- 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")
|
local cauldron = fill_cauldron(node.name, "mcl_core:water_source")
|
||||||
if cauldron then
|
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.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})
|
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
|
||||||
return "mcl_potions:glass_bottle"
|
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")
|
local cauldron = fill_cauldron(node.name, "mclx_core:river_water_source")
|
||||||
if cauldron then
|
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.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})
|
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
|
||||||
return "mcl_potions:glass_bottle"
|
return "mcl_potions:glass_bottle"
|
||||||
|
|
Loading…
Reference in New Issue