-fix bug tamed wolf removed immediatly

-fix bug ostich_f can't be spawned
-revert accidentaly changed wolf to be not agressive
-fix mobs following don't jump
-fix height level check for flying mobs not working
-stop movement of inactive mobs
This commit is contained in:
sapier 2013-01-20 13:29:25 +00:00
parent 2d3ee2e3fb
commit f221c919e3
6 changed files with 85 additions and 58 deletions

View File

@ -146,6 +146,15 @@ mobf_animal_spawning_secondary = true/false
Changelog:
-------------------------------------------------------------------------------
Changes 1.9.13
-add gull 3d mesh
-fix bug tamed wolf removed immediatly
-fix bug ostich_f can't be spawned
-revert accidentaly changed wolf to be not agressive
-fix mobs following don't jump
-fix height level check for flying mobs not working
-stop movement of inactive mobs
Changes 1.9.12
-rename debug class to avoid naming conflicts
-improve environment definition

View File

@ -184,7 +184,7 @@ function environment.is_media_element( nodename, media )
dbg_mobf.environment_lvl2("MOBF: " .. nodename .. " is not within environment list:")
for i,v in ipairs(media) do
dbg_mobf.environment_lvl3("MOBF: " .. v)
dbg_mobf.environment_lvl3("MOBF: \t" .. v)
end
return false
@ -333,6 +333,7 @@ end
--
--! @param pos position to check
--! @param entity mob to check
--! @param dont_do_jumpcheck
--! @return suitability of position for mob values:
--! -ok -@>position is ok
--! -collision -@>position is within a node
@ -347,7 +348,7 @@ end
--! -wrong_surface -@>position is above surface mob shouldn't be
--! -invalid -@>unable to check position
-------------------------------------------------------------------------------
function environment.pos_is_ok(pos,entity,jumpcheck)
function environment.pos_is_ok(pos,entity,dont_do_jumpcheck)
local min_ground_distance,max_ground_distance = environment.get_min_max_ground_dist(entity)
@ -355,10 +356,10 @@ function environment.pos_is_ok(pos,entity,jumpcheck)
table.insert(cornerpositions,pos)
--read positions at corners
table.insert(cornerpositions,mobf_round_pos({x=pos.x + entity.collisionbox[4],y=pos.y,z=pos.z + entity.collisionbox[6]}))
table.insert(cornerpositions,mobf_round_pos({x=pos.x + entity.collisionbox[4],y=pos.y,z=pos.z + entity.collisionbox[3]}))
table.insert(cornerpositions,mobf_round_pos({x=pos.x + entity.collisionbox[1],y=pos.y,z=pos.z + entity.collisionbox[6]}))
table.insert(cornerpositions,mobf_round_pos({x=pos.x + entity.collisionbox[1],y=pos.y,z=pos.z + entity.collisionbox[3]}))
table.insert(cornerpositions,{x=pos.x + entity.collisionbox[4] -0.01,y=pos.y,z=pos.z + entity.collisionbox[6] -0.01})
table.insert(cornerpositions,{x=pos.x + entity.collisionbox[4] -0.01,y=pos.y,z=pos.z + entity.collisionbox[3] +0.01})
table.insert(cornerpositions,{x=pos.x + entity.collisionbox[1] +0.01,y=pos.y,z=pos.z + entity.collisionbox[6] -0.01})
table.insert(cornerpositions,{x=pos.x + entity.collisionbox[1] +0.01,y=pos.y,z=pos.z + entity.collisionbox[3] +0.01})
local lastpos = nil
@ -376,7 +377,9 @@ function environment.pos_is_ok(pos,entity,jumpcheck)
end
if not environment.is_media_element(node_to_check.name,entity.environment.media) == true then
dbg_mobf.environment_lvl3("MOBF: at pos " .. printpos(cornerpositions[i]) .. " not within environment")
dbg_mobf.environment_lvl3("MOBF: " .. i .. ": " ..
printpos(cornerpositions[i]) .. " -- " .. printpos(pos) ..
" not within environment")
if mobf_pos_is_same(pos,cornerpositions[i]) then
if node_to_check.name == "default:water_source" or
@ -428,31 +431,32 @@ function environment.pos_is_ok(pos,entity,jumpcheck)
end
else
local miny,maxy = environment.get_absolute_min_max_pos(entity.environment,pos)
dbg_mobf.environment_lvl2("MOBF: \tflying mob detected, min: "
.. miny .. " max: " .. maxy .. " current: " .. pos.y)
if pos.y < miny then
retval = "below_limit"
end
if pos.y > maxy then
else if pos.y > maxy then
retval = "above_limit"
end
retval = environment.checksurface(pos,entity.environment.surfaces)
else
retval = environment.checksurface(pos,entity.environment.surfaces)
end end
end
end
if retval == "collision" and jumpcheck then
if environment.extended_pos_is_ok(pos,entity,false) == "ok" then
if retval == "collision" and not dont_do_jumpcheck then
dbg_mobf.environment_lvl2("MOBF: check if pos is jumpable")
local upper_pos_state = environment.pos_is_ok({x=pos.x,
y=pos.y+1,
z=pos.z},
entity,true)
if upper_pos_state == "ok" then
retval = "collision_jumpable"
else
dbg_mobf.environment_lvl2("MOBF: upper pos state was: " .. upper_pos_state)
end
end
return retval
end
function environment.state_prio(oldstate,newstate)
end
-------------------------------------------------------------------------------

View File

@ -73,7 +73,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 = "1.9.12"
mobf_version = "1.9.13"
LOGLEVEL_INFO = "verbose"
LOGLEVEL_NOTICE = "info"

View File

@ -84,7 +84,7 @@ function mgen_follow.callback(entity,now)
state == "above_water" or
state == "in_air" or
state == "drop_above_water" then
print("followed to wrong place")
dbg_mobf.fmovement_lvl1("MOBF: followed to wrong place " .. state)
if entity.dynamic_data.movement.last_pos_in_env ~= nil then
entity.object:moveto(entity.dynamic_data.movement.last_pos_in_env)
else
@ -169,7 +169,7 @@ function mgen_follow.callback(entity,now)
--TODO check if movement in this direction is possible or if we need to jump
local accel_to_set = movement_generic.get_accel_to(targetpos,entity)
accel_to_set.y = yaccel
dbg_mobf.fmovement_lvl3("MOBF: setting acceleration to: " .. printpos(accel_to_set));
local current_velocity = entity.object:getvelocity()
local predicted_pos = movement_generic.predict_next_block(basepos,current_velocity,accel_to_set)
local pos_state = environment.pos_is_ok(predicted_pos,entity)
@ -179,6 +179,9 @@ function mgen_follow.callback(entity,now)
pos_to_set.y = pos_to_set.y + 1.1
entity.object:moveto(pos_to_set)
end
dbg_mobf.fmovement_lvl3("MOBF: setting acceleration to: "
.. printpos(accel_to_set) .. " predicted_state: "
.. pos_state);
mgen_follow.set_acceleration(entity,accel_to_set,follow_speedup)
end
end

View File

@ -615,45 +615,56 @@ end
-------------------------------------------------------------------------------
function mobf.blacklisthandling(mob)
local blacklisted = minetest.registered_entities[mob.modname.. ":"..mob.name]
local on_activate_fct = nil
--remove unknown animal objects
if minetest.setting_getbool("mobf_delete_disabled_mobs") then
if minetest.registered_entities[mob.modname.. ":"..mob.name] == nil then
on_activate_fct = function(self,staticdata)
self.object:remove()
end
--cleanup mob entities
minetest.register_entity(mob.modname.. ":"..mob.name .. "__default",
{
on_activate = function(self,staticdata)
self.object:remove()
end
})
if mob.states ~= nil then
for s = 1, #mob.states , 1 do
minetest.register_entity(":".. mob_state.get_entity_name(mob,mob.states[s]),
{
on_activate = function(self,staticdata)
self.object:remove()
end
})
end
end
--cleanup spawners too
if minetest.registered_entities[mob.modname.. ":"..mob.name] == nil and
environment_list[mob.generic.envid] ~= nil and
mobf_spawn_algorithms[mob.spawning.algorithm] ~= nil and
type(mobf_spawn_algorithms[mob.spawning.algorithm].register_cleanup) == "function" then
--cleanup spawners too
if environment_list[mob.generic.envid] ~= nil and
mobf_spawn_algorithms[mob.spawning.algorithm] ~= nil and
type(mobf_spawn_algorithms[mob.spawning.algorithm].register_cleanup) == "function" then
mobf_spawn_algorithms[mob.spawning.algorithm].register_cleanup(mob.modname.. ":" .. mob.name)
if mob.spawning.algorithm_secondary ~= nil and
type(mobf_spawn_algorithms.register_spawn[mob.spawning.algorithm_secondary].register_cleanup) == "function" then
mobf_spawn_algorithms.register_spawn[mob.spawning.algorithm_secondary].register_cleanup(mob.modname.. ":" .. mob.name)
end
mobf_spawn_algorithms[mob.spawning.algorithm].register_cleanup(mob.modname.. ":" .. mob.name)
if mob.spawning.algorithm_secondary ~= nil and
type(mobf_spawn_algorithms.register_spawn[mob.spawning.algorithm_secondary].register_cleanup) == "function" then
mobf_spawn_algorithms.register_spawn[mob.spawning.algorithm_secondary].register_cleanup(mob.modname.. ":" .. mob.name)
end
end
else
on_activate_fct = function(self,staticdata)
self.object:setacceleration({x=0,y=0,z=0})
self.object:setvelocity({x=0,y=0,z=0})
end
end
if minetest.registered_entities[mob.modname.. ":"..mob.name] == nil then
--cleanup mob entities
minetest.register_entity(mob.modname.. ":"..mob.name .. "__default",
{
on_activate = on_activate_fct
})
if mob.states ~= nil then
for s = 1, #mob.states , 1 do
minetest.register_entity(":".. mob_state.get_entity_name(mob,mob.states[s]),
{
on_activate = on_activate_fct
})
end
end
end
if blacklisted == nil then
minetest.log(LOGLEVEL_INFO,"MOBF: " .. mob.modname.. ":"..mob.name .. " was blacklisted")

View File

@ -15,7 +15,7 @@
-------------------------------------------------------------------------------
mobf_settings = {}
mobf_settings.version = "0.0.14"
mobf_settings.version = "0.0.15"
mobf_settings.max_list_page_num = 5
mobf_settings.buttons = {}
mobf_settings.menubutton = "button_exit[11,9.5;2,0.5;main; Exit]"
@ -24,7 +24,7 @@ mobf_settings.formspechandler = function(player,formspec)
minetest.show_formspec(name,"mobf_settings:mainform",formspec)
end
mobf_settings_debug = print
mobf_settings_debug = function () end
------------------------------------------------------------------------------
-- name: save
--