fix crash on wolf teleport

This commit is contained in:
sapier 2013-01-27 18:49:38 +00:00
parent ba706bb34e
commit 6d19e80d8e
3 changed files with 6 additions and 4 deletions

View File

@ -163,6 +163,7 @@ Changes 2.0.0
-fix price update bug in trader -fix price update bug in trader
-new cow textures -new cow textures
-improve sheep model -improve sheep model
-fix crash on teleport of wolf
Changes 1.9.15 Changes 1.9.15
-fixed crash when mob got spawned at unloaded pos -fixed crash when mob got spawned at unloaded pos

View File

@ -81,7 +81,7 @@ dofile (mobf_modpath .. "/mgen_rasterized/mgen_raster.lua")
dofile (mobf_modpath .. "/mgen_jordan4ibanez/mgen_jordan4ibanez.lua") dofile (mobf_modpath .. "/mgen_jordan4ibanez/mgen_jordan4ibanez.lua")
dofile (mobf_modpath .. "/mov_gen_none.lua") dofile (mobf_modpath .. "/mov_gen_none.lua")
mobf_version = "2.0.0" mobf_version = "2.0.1"
--! @brief define tools used for more than one mob --! @brief define tools used for more than one mob
function mobf_init_basic_tools() function mobf_init_basic_tools()

View File

@ -88,10 +88,11 @@ end
-- --
--! @param entity mob to check for teleport --! @param entity mob to check for teleport
--! @param now current time --! @param now current time
--! @param targetpos position of target
--! --!
--! @return true/false finish processing --! @return true/false finish processing
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function mgen_follow.handleteleport(entity,now) function mgen_follow.handleteleport(entity,now,targetpos)
if (entity.dynamic_data.movement.last_next_to_target ~= nil ) then if (entity.dynamic_data.movement.last_next_to_target ~= nil ) then
local time_since_next_to_target = local time_since_next_to_target =
@ -189,9 +190,9 @@ function mgen_follow.callback(entity,now)
entity.dynamic_data.movement.guardspawnpoint then entity.dynamic_data.movement.guardspawnpoint then
dbg_mobf.fmovement_lvl3("MOBF: Target available") dbg_mobf.fmovement_lvl3("MOBF: Target available")
--calculate distance to target --calculate distance to target
local targetpos = entity.dynamic_data.spawning.spawnpoint
local targetpos = entity.dynamic_data.spawning.spawnpoint
if entity.dynamic_data.movement.guardspawnpoint ~= true then if entity.dynamic_data.movement.guardspawnpoint ~= true then
dbg_mobf.fmovement_lvl3("MOBF: moving target selected") dbg_mobf.fmovement_lvl3("MOBF: moving target selected")
targetpos = entity.dynamic_data.movement.target:getpos() targetpos = entity.dynamic_data.movement.target:getpos()
@ -223,7 +224,7 @@ function mgen_follow.callback(entity,now)
dbg_mobf.fmovement_lvl3("MOBF: max distance is set to : " .. max_distance) dbg_mobf.fmovement_lvl3("MOBF: max distance is set to : " .. max_distance)
if distance > max_distance then if distance > max_distance then
if mgen_follow.handleteleport(entity,now) then if mgen_follow.handleteleport(entity,now,targetpos) then
return return
end end