Code: Select all
defineObject {
name = "exploding_barrel_block",
baseObject = "barrel_crate_block",
components = {
{
class = "Health",
health = 30,
onDie = function(c)
if ( c.property ~= nil ) then
--print("BLOCKED")
return
end
c.property = 1;
local i, j;
for i = -1, 1 do
for j = -1, 1 do
spawn("fireburst", c.go.level, c.go.x + i, c.go.y + j, 0, c.go.elevation)
end
end
end
}
}
}
defineObject {
name = "nour_barrel_block",
baseObject = "barrel_crate_block",
components = {
{
class = "Health",
health = 15,
onDie = function(c)
if ( c.property ~= nil ) then
--print("BLOCKED")
return
end
c.property = 1;
spawn("nour_barrel_crate_block_damaged", c.go.level, c.go.x, c.go.y, 0, c.go.elevation)
end
}
}
}
defineObject {
name = "nour_barrel_crate_block_damaged",
baseObject = "barrel_crate_block_damaged",
components = {
{
class = "Health",
health = 15,
onDie = function(self)
local foodList = {"ice_lizard_steak", "baked_maggot", "boiled_beetle", "rat_shank", "pitroot_bread", "herder_cap"}
local many = math.random(1, 4)
local facing = (party.facing + 2)%4
for i = 1, many do
spawn(foodList[math.random(1, #foodList)], self.go.level, self.go.x, self.go.y, math.random(0, 3), self.go.elevation)
end
end
}
}
}