Add some mob debugging info

pull/18/head
Brandon 2015-08-16 22:19:53 -05:00
parent 7f2d622e5f
commit f5a4b3e935
2 changed files with 7 additions and 5 deletions

View File

@ -152,10 +152,10 @@ minetest.register_on_generated( function (minp, maxp, blockseed)
end
if notify.temple ~= nil then
print("Temple generated")
for k,v in ipairs(notify.temple) do
print(minetest.pos_to_string(v))
end
--print("Temple generated")
--for k,v in ipairs(notify.temple) do
-- print(minetest.pos_to_string(v))
-- end
end
end
end)

View File

@ -882,6 +882,7 @@ end
function mobs:spawn_mob(pos,name)
-- make sure the nodes above are walkable
minetest.log("action","Attempting to spawn "..name)
local nodename = minetest.get_node(pos).name
if minetest.registered_nodes[nodename] ~= nil then
if minetest.registered_nodes[nodename].walkable == true or minetest.registered_nodes[nodename].walkable == nil or nodename == "default:water_source" then
@ -898,9 +899,10 @@ function mobs:spawn_mob(pos,name)
local mob = minetest.add_entity(pos, name)
-- setup the hp, armor, drops, etc... for this specific mob
local distance_rating = ( ( get_distance({x=0,y=0,z=0},pos) ) / 15000 )
if mob ~= nil then
if mob ~= nil then
mob = mob:get_luaentity()
if mob ~= nil then
minetest.log("action",name.." spawned at "..minetest.pos_to_string(pos))
local newHP = mob.hp_min + math.floor( mob.hp_max * distance_rating )
mob.object:set_hp( newHP )
mob.state = "walk" -- make them walk when they spawn so they walk away from their original spawn position