Morlu now gives back what he has stollen on dying
This commit is contained in:
parent
ca11787904
commit
0710944d8f
@ -52,8 +52,9 @@ mobs:register_mob("nssm:morlu", {
|
|||||||
|
|
||||||
if self.inv_flag ~= 1 then
|
if self.inv_flag ~= 1 then
|
||||||
self.inventory = {}
|
self.inventory = {}
|
||||||
for i=1,32 do
|
self.invnum = 0
|
||||||
self.inventory[i]={name = '', num = 0}
|
for i=1,6 do
|
||||||
|
self.inventory[i]={name = ''}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.inv_flag = (self.inv_flag or 1)
|
self.inv_flag = (self.inv_flag or 1)
|
||||||
@ -102,7 +103,7 @@ mobs:register_mob("nssm:morlu", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if armor_num > 0 then
|
if armor_num > 0 then
|
||||||
minetest.chat_send_all("Numero di pezzi: "..armor_num)
|
--minetest.chat_send_all("Numero di pezzi: "..armor_num)
|
||||||
steal_pos = math.random(1,armor_num)
|
steal_pos = math.random(1,armor_num)
|
||||||
steal_pos = steal_pos-1
|
steal_pos = steal_pos-1
|
||||||
--[[for i=0,armor_num-1 do
|
--[[for i=0,armor_num-1 do
|
||||||
@ -159,6 +160,14 @@ mobs:register_mob("nssm:morlu", {
|
|||||||
armor:update_inventory(self.attack)
|
armor:update_inventory(self.attack)
|
||||||
--armor:update_player_visuals(self.attack)
|
--armor:update_player_visuals(self.attack)
|
||||||
|
|
||||||
|
--Update personal inventory of armors:
|
||||||
|
if (self.invnum ~= nil) and (self.invnum <= 5) then
|
||||||
|
minetest.chat_send_all("Invnum: "..self.invnum)
|
||||||
|
minetest.chat_send_all("Salvo: "..armor_elements[steal_pos].name)
|
||||||
|
self.invnum = self.invnum + 1
|
||||||
|
self.inventory[self.invnum].name = armor_elements[steal_pos].name
|
||||||
|
end
|
||||||
|
|
||||||
set_animation(self, "run")
|
set_animation(self, "run")
|
||||||
self.flag = 1
|
self.flag = 1
|
||||||
self.morlu_timer = os.time()
|
self.morlu_timer = os.time()
|
||||||
@ -178,14 +187,12 @@ mobs:register_mob("nssm:morlu", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
--[[
|
|
||||||
on_die = function(self)
|
on_die = function(self)
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
if (self.inventory ~= nil) then
|
if (self.inventory ~= nil) then
|
||||||
local elem
|
if self.invnum > 0 then
|
||||||
for i = 1,32 do
|
for i=1,self.invnum do
|
||||||
if self.inventory[i].num~=0 then
|
local items = ItemStack(self.inventory[i].name.." 1")
|
||||||
local items = ItemStack(self.inventory[i].name.." "..self.inventory[i].num)
|
|
||||||
local obj = minetest.add_item(pos, items)
|
local obj = minetest.add_item(pos, items)
|
||||||
obj:setvelocity({
|
obj:setvelocity({
|
||||||
x = math.random(-1, 1),
|
x = math.random(-1, 1),
|
||||||
@ -196,5 +203,4 @@ mobs:register_mob("nssm:morlu", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
]]
|
|
||||||
})
|
})
|
||||||
|
@ -326,7 +326,8 @@ function webber_ability( --puts randomly around the block defined as w_block
|
|||||||
w_block, --definition of the block to use
|
w_block, --definition of the block to use
|
||||||
radius --max distance the block can be put
|
radius --max distance the block can be put
|
||||||
)
|
)
|
||||||
if math.random(1,nssm:virulence(self)) ~= 1 then return end
|
|
||||||
|
if (nssm:virulence(self)~=0) and (math.random(1,nssm:virulence(self)) ~= 1) then return end
|
||||||
|
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
if (math.random(1,55)==1) then
|
if (math.random(1,55)==1) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user