Merge pull request #35 from rubenwardy/mobs_crash_Fix
Fix mobs crash on no XP found
This commit is contained in:
commit
494b061dbe
@ -135,8 +135,8 @@ function mobs.register_mob(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function mobs.get_mob(lvl)
|
function mobs.get_mob(lvl)
|
||||||
a = {}
|
local a = {}
|
||||||
found_mob = false
|
local found_mob = false
|
||||||
for i,n in ipairs(mobs.mobs) do
|
for i,n in ipairs(mobs.mobs) do
|
||||||
if n[2] < lvl +5 and n[2] > lvl-5 then
|
if n[2] < lvl +5 and n[2] > lvl-5 then
|
||||||
found_mob = true
|
found_mob = true
|
||||||
@ -380,4 +380,3 @@ mobs.register_mob("mobs:lava_flower", {
|
|||||||
range = 2,
|
range = 2,
|
||||||
drops = {"money:coin 2"}
|
drops = {"money:coin 2"}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
offset = {x=0, y=-(48*2+16)},
|
offset = {x=0, y=-(48*2+16)},
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
|
xp.player_xp[player:get_player_name()] = 0
|
||||||
|
xp.player_levels[player:get_player_name()] = 1
|
||||||
xp.xp_hud[player:get_player_name()] = player:hud_add({
|
xp.xp_hud[player:get_player_name()] = player:hud_add({
|
||||||
hud_elem_type = "statbar",
|
hud_elem_type = "statbar",
|
||||||
position = {x=0.5,y=1.0},
|
position = {x=0.5,y=1.0},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user