From: Elias Fleckenstein Date: Mon, 15 Jun 2020 14:24:06 +0000 (+0200) Subject: Fixed Spawners X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=165071e2aa050ab3228cd8fe20dd41c1f850a5eb;p=skycraft.git Fixed Spawners --- diff --git a/modules.txt b/modules.txt index 45e60c3..e5ca0be 100644 --- a/modules.txt +++ b/modules.txt @@ -1 +1 @@ -return {common={"common","group_lists","random","request","schems",},main={"alpha","armor_stand","commands","flower_spread","god_stick","join_skyblock_entity","lobby","lucky_block","mapgen","money","netherrack_fix","plots","ranks","shopping","spawns","tpa","trade","wither_spawn",},onload={"grasstype","lava_cooling","load_group_lists","monster_egg_stone_block","nether_portal","remove_heads_from_armor","sapling_mutation","shop_signs","spawn","void",},} \ No newline at end of file +return {common={"common","group_lists","random","request","schems",},main={"alpha","armor_stand","commands","flower_spread","god_stick","join_skyblock_entity","lobby","lucky_block","mapgen","money","netherrack_fix","plots","ranks","shopping","spawns","tpa","trade","wither_spawn",},onload={"grasstype","lava_cooling","load_group_lists","mob_spawner","monster_egg_stone_block","nether_portal","remove_heads_from_armor","sapling_mutation","shop_signs","spawn","void",},} \ No newline at end of file diff --git a/src/main/plots.lua b/src/main/plots.lua index 2d6c67e..6ac909f 100644 --- a/src/main/plots.lua +++ b/src/main/plots.lua @@ -58,6 +58,7 @@ local plot_commands = { gui = function(name, message) message = message or "" local plot = skycraft.get_plot_by_player(name) + if not plot then return false, "You don't have a plot yet" end local esc = minetest.formspec_escape local formspec = "size[8,10]" .. "label[2.5,0;" .. esc("-- Plot interface --") .. "]" @@ -172,7 +173,7 @@ end) local old_is_protected = minetest.is_protected function minetest.is_protected(pos, name) local plot = skycraft.get_plot_at_pos(pos) or {members = {}} - if pos.y > 5000 or (pos.y < 1000 and pos.y > -100) or plot.owner ~= name and table.indexof(plot.members, name) == -1 then + if pos.y > 5000 or (pos.y < 1000 and pos.y > -100) or (plot.owner ~= name and table.indexof(plot.members, name) == -1) then return not minetest.check_player_privs(name, {protection_bypass = true}) else return old_is_protected(pos, name) diff --git a/src/onload/mob_spawner.lua b/src/onload/mob_spawner.lua new file mode 100644 index 0000000..10e39e0 --- /dev/null +++ b/src/onload/mob_spawner.lua @@ -0,0 +1,14 @@ +local spawner_def = minetest.registered_nodes["mcl_mobspawners:spawner"] +local old_on_place = spawner_def.on_place + +function spawner_def.on_place(itemstack, placer, pointed_thing) + local name = placer:get_player_name() + local privs = minetest.get_player_privs(name) + privs.maphack = true + minetest.set_player_privs(name, privs) + old_on_place(itemstack, placer, pointed_thing) + privs.maphack = nil + minetest.set_player_privs(name, privs) +end + +spawner_def.drop = "mcl_mobspawners:spawner"