Add XP (#141)
This commit is contained in:
parent
22ccef8e1f
commit
1dc4d28264
@ -1,10 +1,10 @@
|
||||
HUD_SB_SIZE = {x = 24, y = 24}
|
||||
HUD_HEALTH_POS = {x = 0.5, y = 1}
|
||||
HUD_HEALTH_OFFSET = {x = -248, y = -93}
|
||||
HUD_HEALTH_OFFSET = {x = -248, y = -110}
|
||||
HUD_AIR_POS = {x = 0.5, y = 1}
|
||||
HUD_AIR_OFFSET = {x = 6, y = -124}
|
||||
HUD_HUNGER_POS = {x = 0.5, y = 1}
|
||||
HUD_HUNGER_OFFSET = {x = 6, y = -93}
|
||||
HUD_HUNGER_OFFSET = {x = 6, y = -110}
|
||||
HUD_ARMOR_POS = {x = 0.5, y = 1}
|
||||
HUD_ARMOR_OFFSET = {x = -248, y = -124}
|
||||
|
||||
|
@ -26,11 +26,18 @@ mobs:register_mob("mobs_animal:pig", {
|
||||
jump = true,
|
||||
follow = {"default:apple", "farming:potato"},
|
||||
view_range = 5,
|
||||
drops = {
|
||||
drops = function(pos)
|
||||
if rawget(_G, "experience") then
|
||||
--experience.add_orb(math.random(1,3), pos) -- random amount between 1 and 3
|
||||
experience.add_orb(3, pos)
|
||||
end
|
||||
|
||||
return {
|
||||
{name = "mobs:pork_raw", chance = 1, min = 1, max = 1},
|
||||
{name = "mobs:pork_raw", chance = 2, min = 1, max = 1},
|
||||
{name = "mobs:pork_raw", chance = 2, min = 1, max = 1}
|
||||
},
|
||||
}
|
||||
end,
|
||||
water_damage = 0,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
|
@ -665,6 +665,8 @@ end
|
||||
|
||||
-- drop items
|
||||
function mob_class:item_drop()
|
||||
local pos = self.object:get_pos()
|
||||
self.drops = type(self.drops) == "function" and self.drops(pos) or self.drops
|
||||
|
||||
-- check for nil or no drops
|
||||
if not self.drops or #self.drops == 0 then
|
||||
@ -682,7 +684,6 @@ function mob_class:item_drop()
|
||||
and self.cause_of_death.puncher:is_player() or nil
|
||||
|
||||
local obj, item, num
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
for n = 1, #self.drops do
|
||||
|
||||
|
@ -1 +1,2 @@
|
||||
default
|
||||
experience?
|
||||
|
Loading…
x
Reference in New Issue
Block a user