mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-30 23:03:45 +01:00
Use unique name for function. Add development flag to enable crashing locally
This commit is contained in:
parent
b47ef9275b
commit
5fc78bf6b0
@ -9,6 +9,8 @@ local CRASH_WARN_FREQUENCY = 60
|
|||||||
-- Localize
|
-- Localize
|
||||||
local S = minetest.get_translator("mcl_mobs")
|
local S = minetest.get_translator("mcl_mobs")
|
||||||
|
|
||||||
|
local DEVELOPMENT = minetest.settings:get_bool("mcl_development",false)
|
||||||
|
|
||||||
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false)
|
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_mobs_villager",false)
|
||||||
local function mcl_log (message)
|
local function mcl_log (message)
|
||||||
if LOGGING_ON then
|
if LOGGING_ON then
|
||||||
@ -415,7 +417,7 @@ local function on_step_work (self, dtime)
|
|||||||
self:env_danger_movement_checks (dtime)
|
self:env_danger_movement_checks (dtime)
|
||||||
|
|
||||||
-- Follow code is heavy and probably shouldn't run when not in range, but we need to extract the cancel follow stuff
|
-- Follow code is heavy and probably shouldn't run when not in range, but we need to extract the cancel follow stuff
|
||||||
self:follow()
|
self:check_follow()
|
||||||
self:flop()
|
self:flop()
|
||||||
|
|
||||||
self:check_smooth_rotation(dtime)
|
self:check_smooth_rotation(dtime)
|
||||||
@ -493,12 +495,19 @@ local on_step_error_handler = function ()
|
|||||||
minetest.log("action", "--- Bug report end ---")
|
minetest.log("action", "--- Bug report end ---")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- main mob function
|
-- main mob function
|
||||||
function mob_class:on_step(dtime)
|
function mob_class:on_step(dtime)
|
||||||
local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime)
|
if not DEVELOPMENT then
|
||||||
if status then
|
local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime)
|
||||||
return retVal
|
if status then
|
||||||
|
return retVal
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return on_step_work (self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
local timer = 0
|
||||||
|
@ -614,7 +614,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- follow player if owner or holding item, if fish outta water then flop
|
-- follow player if owner or holding item, if fish outta water then flop
|
||||||
function mob_class:follow()
|
function mob_class:check_follow()
|
||||||
-- find player to follow
|
-- find player to follow
|
||||||
if (self.follow ~= "" or self.order == "follow") and not self.following
|
if (self.follow ~= "" or self.order == "follow") and not self.following
|
||||||
and self.state ~= "attack"
|
and self.state ~= "attack"
|
||||||
|
Loading…
Reference in New Issue
Block a user