From 7e3bcf7f9ef8f84b6f1d105ef825fe1a566c3ac5 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 27 Jan 2013 23:03:21 +0000 Subject: [PATCH 1/3] fix crash in follow movegen when targetpos can't be determined --- mobf/README | 7 ++++++- mobf/init.lua | 2 +- mobf/mgen_follow/main_follow.lua | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mobf/README b/mobf/README index e583e77..6887d41 100644 --- a/mobf/README +++ b/mobf/README @@ -157,13 +157,18 @@ mobf_delete_disabled_mobs = true/false Changelog: ------------------------------------------------------------------------------- +Changes 2.0.2 +-fix crash with invalid targetpos in follow movgen + +Changes 2.0.1 +-fix crash on teleport of wolf + Changes 2.0.0 -documentation update -add more items for trader -fix price update bug in trader -new cow textures -improve sheep model --fix crash on teleport of wolf Changes 1.9.15 -fixed crash when mob got spawned at unloaded pos diff --git a/mobf/init.lua b/mobf/init.lua index b225b07..038debe 100644 --- a/mobf/init.lua +++ b/mobf/init.lua @@ -81,7 +81,7 @@ dofile (mobf_modpath .. "/mgen_rasterized/mgen_raster.lua") dofile (mobf_modpath .. "/mgen_jordan4ibanez/mgen_jordan4ibanez.lua") dofile (mobf_modpath .. "/mov_gen_none.lua") -mobf_version = "2.0.1" +mobf_version = "2.0.2" --! @brief define tools used for more than one mob function mobf_init_basic_tools() diff --git a/mobf/mgen_follow/main_follow.lua b/mobf/mgen_follow/main_follow.lua index 09f24f1..f02793d 100644 --- a/mobf/mgen_follow/main_follow.lua +++ b/mobf/mgen_follow/main_follow.lua @@ -198,6 +198,14 @@ function mgen_follow.callback(entity,now) targetpos = entity.dynamic_data.movement.target:getpos() end + if targetpos == nil then + minetest.log(LOGLEVEL_ERROR,"MOBF: " .. entity.data.name + .. " don't have targetpos " + .. "SP: " .. dump(entity.dynamic_data.spawning.spawnpoint) + .. " TGT: " .. dump(entity.dynamic_data.movement.target)) + return + end + local distance = mobf_calc_distance_2d(basepos,targetpos) local yaccel = environment.get_default_gravity(basepos, From 0682bb6ea8b9a713211408d91d10e1d35ff532b8 Mon Sep 17 00:00:00 2001 From: sapier Date: Mon, 28 Jan 2013 20:01:24 +0000 Subject: [PATCH 2/3] fix crash on missing typical state time --- mobf/README | 4 ++++ mobf/init.lua | 2 +- mobf/mob_state.lua | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mobf/README b/mobf/README index 6887d41..f44100c 100644 --- a/mobf/README +++ b/mobf/README @@ -157,6 +157,10 @@ mobf_delete_disabled_mobs = true/false Changelog: ------------------------------------------------------------------------------- +Changes 2.0.3 +-fixed crash on typical state time not available +-fixed bug mob_slime typical state time not set + Changes 2.0.2 -fix crash with invalid targetpos in follow movgen diff --git a/mobf/init.lua b/mobf/init.lua index 038debe..7181007 100644 --- a/mobf/init.lua +++ b/mobf/init.lua @@ -81,7 +81,7 @@ dofile (mobf_modpath .. "/mgen_rasterized/mgen_raster.lua") dofile (mobf_modpath .. "/mgen_jordan4ibanez/mgen_jordan4ibanez.lua") dofile (mobf_modpath .. "/mov_gen_none.lua") -mobf_version = "2.0.2" +mobf_version = "2.0.3" --! @brief define tools used for more than one mob function mobf_init_basic_tools() diff --git a/mobf/mob_state.lua b/mobf/mob_state.lua index ec58836..0462349 100644 --- a/mobf/mob_state.lua +++ b/mobf/mob_state.lua @@ -21,6 +21,7 @@ ------------------------------------------------------------------------------- mob_state = {} +mob_state.default_state_time = 30 ------------------------------------------------------------------------------- -- name: initialize(entity,now) @@ -392,6 +393,11 @@ end ------------------------------------------------------------------------------- function mob_state.getTimeToNextState(typical_state_time) + if typical_state_time == nil then + mobf_bug_warning(LOGLEVEL_WARNING,"MOBF MOB BUG!!! missing typical state time!") + typical_state_time = mob_state.default_state_time + end + local u1 = 2 * math.random() -1 local u2 = 2 * math.random() -1