mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 11:53:46 +01:00
Settings-related fixes
-moved to the cleaner way of obtaining settings values -disabled the anti-troll measures by default -made the wither per-dimension limit dependent on the settings -(anti-troll measures enabled required for wither counting and limit)
This commit is contained in:
parent
20b0f0748d
commit
924a6c1c47
@ -2,6 +2,8 @@ local dim = {"x", "z"}
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||
|
||||
local function load_schem(filename)
|
||||
local file = io.open(modpath .. "/schems/" .. filename, "r")
|
||||
local data = minetest.deserialize(file:read())
|
||||
@ -56,7 +58,7 @@ local function wither_spawn(pos, player)
|
||||
for i = 0, 2 do
|
||||
local p = vector.add(pos, {x = 0, y = -2, z = 0, [d] = -i})
|
||||
local schem = wither_spawn_schems[d]
|
||||
if check_schem(p, schem) and check_limit(pos) then
|
||||
if check_schem(p, schem) and (not anti_troll or check_limit(pos)) then
|
||||
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_ent = wither:get_luaentity()
|
||||
@ -88,12 +90,14 @@ function wither_head.on_place(itemstack, placer, pointed)
|
||||
return old_on_place(itemstack, placer, pointed)
|
||||
end
|
||||
|
||||
-- pull wither counts per dimension
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if anti_troll then
|
||||
-- pull wither counts per dimension
|
||||
minetest.register_globalstep(function(dtime)
|
||||
wboss_overworld = mobs_mc.wither_count_overworld
|
||||
wboss_nether = mobs_mc.wither_count_nether
|
||||
wboss_end = mobs_mc.wither_count_end
|
||||
mobs_mc.wither_count_overworld = 0
|
||||
mobs_mc.wither_count_nether = 0
|
||||
mobs_mc.wither_count_end = 0
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
@ -5,10 +5,10 @@
|
||||
--License for code WTFPL and otherwise stated in readmes
|
||||
|
||||
local S = minetest.get_translator("mobs_mc")
|
||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
||||
local follow_spawner = minetest.settings:get_bool("wither_follow_spawner") == true
|
||||
local w_strafes = minetest.settings:get_bool("wither_strafes") ~= false
|
||||
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures") ~= false
|
||||
local mobs_griefing = minetest.settings:get_bool("mobs_griefing", true)
|
||||
local follow_spawner = minetest.settings:get_bool("wither_follow_spawner", false)
|
||||
local w_strafes = minetest.settings:get_bool("wither_strafes", true)
|
||||
local anti_troll = minetest.settings:get_bool("wither_anti_troll_measures", false)
|
||||
|
||||
local WITHER_INIT_BOOM = 7
|
||||
|
||||
@ -170,7 +170,9 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||
self._custom_timer = self._custom_timer - 1
|
||||
end
|
||||
|
||||
if anti_troll and self._spawner then
|
||||
-- anti-troll measures
|
||||
if anti_troll then
|
||||
if self._spawner then
|
||||
local spawner = minetest.get_player_by_name(self._spawner)
|
||||
if follow_spawner and spawner then
|
||||
self._death_timer = 0
|
||||
@ -195,12 +197,12 @@ mcl_mobs.register_mob("mobs_mc:wither", {
|
||||
self._health_old = self.health
|
||||
end
|
||||
end
|
||||
|
||||
-- count withers per dimension
|
||||
local dim = mcl_worlds.pos_to_dimension(self.object:get_pos())
|
||||
if dim == "overworld" then mobs_mc.wither_count_overworld = mobs_mc.wither_count_overworld + 1
|
||||
elseif dim == "nether" then mobs_mc.wither_count_nether = mobs_mc.wither_count_nether + 1
|
||||
elseif dim == "end" then mobs_mc.wither_count_end = mobs_mc.wither_count_end + 1 end
|
||||
end
|
||||
|
||||
-- update things dependent on HP
|
||||
local rand_factor
|
||||
|
@ -182,7 +182,7 @@ wither_follow_spawner (Wither following his spawner) bool false
|
||||
wither_strafes (Wither strafes) bool true
|
||||
|
||||
#Wither anti-troll measures (escaping when stuck in a block, despawning when spawner goes offline, teleporting after the spawner). When this is OFF, wither_follow_spawner has no effect.
|
||||
wither_anti_troll_measures (Wither anti-troll measures) bool true
|
||||
wither_anti_troll_measures (Wither anti-troll measures) bool false
|
||||
|
||||
#Display mob icons in inventory instead of mc-like spawn eggs
|
||||
mcl_old_spawn_icons (Old spawn icons instead of eggs) bool false
|
||||
|
Loading…
Reference in New Issue
Block a user