mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Peaceful crash fixed
This commit is contained in:
parent
645072507f
commit
7ce82b9dcb
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,7 @@ local dim = {"x", "z"}
|
||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||||
|
local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
|
||||||
|
|
||||||
local function load_schem(filename)
|
local function load_schem(filename)
|
||||||
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
||||||
|
@ -54,6 +55,7 @@ local function check_limit(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wither_spawn(pos, player)
|
local function wither_spawn(pos, player)
|
||||||
|
if peaceful then return end
|
||||||
for _, d in pairs(dim) do
|
for _, d in pairs(dim) do
|
||||||
for i = 0, 2 do
|
for i = 0, 2 do
|
||||||
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
||||||
|
@ -61,6 +63,7 @@ local function wither_spawn(pos, player)
|
||||||
if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then
|
if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then
|
||||||
remove_schem(p, schem)
|
remove_schem(p, schem)
|
||||||
local wither = minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
local wither = minetest.add_entity(vector.add(p, {x = 0, y = 1, z = 0, [d] = 1}), "mobs_mc:wither")
|
||||||
|
if not wither then return end
|
||||||
local wither_ent = wither:get_luaentity()
|
local wither_ent = wither:get_luaentity()
|
||||||
wither_ent._spawner = player:get_player_name()
|
wither_ent._spawner = player:get_player_name()
|
||||||
local dim = mcl_worlds.pos_to_dimension(pos)
|
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||||
|
|
Loading…
Reference in a new issue