Compare commits

..

1 Commits

Author SHA1 Message Date
ancientmarinerdev adcb0b76fd Fix wither crash on certain version of Lua. 2023-01-27 01:55:29 +00:00
3 changed files with 8 additions and 32 deletions

View File

@ -24,11 +24,6 @@ local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= fa
local mobs_debug = minetest.settings:get_bool("mobs_debug", false) -- Shows helpful debug info above each mob
local spawn_logging = minetest.settings:get_bool("mcl_logging_mobs_spawn",true)
local MAPGEN_LIMIT = mcl_vars.mapgen_limit
local MAPGEN_MOB_LIMIT = MAPGEN_LIMIT - 90
-- 30927 seems to be the edge of the world, so could be closer, but this is safer
-- Peaceful mode message so players will know there are no monsters
if minetest.settings:get_bool("only_peaceful_mobs", false) then
minetest.register_on_joinplayer(function(player)
@ -333,37 +328,12 @@ local function update_timers (self, dtime)
end
end
function mob_class:outside_limits()
local pos = self.object:get_pos()
if pos then
local posx = math.abs(pos.x)
local posy = math.abs(pos.y)
local posz = math.abs(pos.z)
if posx > MAPGEN_MOB_LIMIT or posy > MAPGEN_MOB_LIMIT or posz > MAPGEN_MOB_LIMIT then
--minetest.log("action", "Getting close to limits of worldgen: " .. minetest.pos_to_string(pos))
if posx > MAPGEN_LIMIT or posy > MAPGEN_LIMIT or posz > MAPGEN_LIMIT then
minetest.log("action", "Warning mob past limits of worldgen: " .. minetest.pos_to_string(pos))
else
if self.state ~= "stand" then
minetest.log("action", "Warning mob close to limits of worldgen: " .. minetest.pos_to_string(pos))
self.state = "stand"
self:set_animation("stand")
self.object:set_acceleration(vector.zero())
self.object:set_velocity(vector.zero())
end
end
return true
end
end
end
-- main mob function
function mob_class:on_step(dtime)
local pos = self.object:get_pos()
if not pos then return end
if self:check_despawn(pos, dtime) then return true end
if self:outside_limits() then return end
if self:check_death_and_slow_mob() then
--minetest.log("action", "Mob is dying: ".. tostring(self.name))

View File

@ -298,7 +298,14 @@ local function who_are_you_looking_at (self)
elseif not self._locked_object then
if math.random(1, 30) then
--minetest.log("Change look check: ".. self.name)
local look_at_player_chance = math.random(20/self.curiosity)
-- For the wither this was 20/60=0.33, so probably need to rebalance and divide rates.
-- but frequency of check isn't good as it is costly. Making others too infrequent requires testing
local chance = 20/self.curiosity
if chance < 1 then chance = 1 end
local look_at_player_chance = math.random(chance)
-- was 5000 but called in loop based on entities. so div by 12 as estimate avg of entities found,
-- then div by 20 as less freq lookup

View File

@ -172,7 +172,6 @@ local professions = {
{ { "mcl_mobitems:string", 15, 20 }, E1 },
{ E1, { "mcl_bows:arrow", 8, 12 } },
{ { "mcl_core:gravel", 10, 10, "mcl_core:emerald", 1, 1 }, { "mcl_core:flint", 6, 10 } },
{ { "mcl_core:stick", 32, 32 }, E1 },
},
{
{ { "mcl_core:flint", 26, 26 }, E1 },