Revise, and add tnt.boom
This commit is contained in:
parent
6a5d66c3b5
commit
71bfe1b92e
26
init.lua
26
init.lua
@ -1,8 +1,13 @@
|
|||||||
local def = {
|
local def = {
|
||||||
name = "grenade:explosion",
|
name = "grenade:explosion",
|
||||||
description = "Grenade Explosion (you hacker you!)",
|
description = "Grenade Explosion (you hacker you!)",
|
||||||
radius = 6,
|
radius = 3,
|
||||||
radius_damage = 6,
|
tiles = {
|
||||||
|
side = "default_dirt.png",
|
||||||
|
top = "default_dirt.png",
|
||||||
|
bottom = "default_dirt.png",
|
||||||
|
burning = "default_dirt.png"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
tnt.register_tnt(def)
|
tnt.register_tnt(def)
|
||||||
@ -18,9 +23,11 @@ minetest.register_craftitem("grenade:grenade", {
|
|||||||
pos.y = pos.y + 1.2
|
pos.y = pos.y + 1.2
|
||||||
|
|
||||||
local obj = minetest.add_entity(pos, "grenade:grenade")
|
local obj = minetest.add_entity(pos, "grenade:grenade")
|
||||||
|
obj:setvelocity({x = v.x * 4, y = v.y * 2 + 4, z = v.z * 4})
|
||||||
|
obj:setacceleration({x = v.x / 4, y = v.y / 2 - 4, z = v.z / 4})
|
||||||
|
|
||||||
obj:setvelocity({x = v.x * 4, y = v.y * 4 + 4, z = v.z * 4})
|
itemstack:take_item()
|
||||||
obj:setacceleration({x = v.x / 16, y = v.y / 16 - 16, z = v.z / 16})
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -30,14 +37,15 @@ minetest.register_entity("grenade:grenade", {
|
|||||||
weight = 5,
|
weight = 5,
|
||||||
textures = {"default_coal_lump.png"},
|
textures = {"default_coal_lump.png"},
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
|
self.timer = 0
|
||||||
end,
|
end,
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
--[[
|
|
||||||
local acc = self.object:getacceleration()
|
local acc = self.object:getacceleration()
|
||||||
local vel = self.object:getvelocity()
|
self.object:setacceleration({x = acc.x * 2 / 4, y = acc.y, z = acc.z * 2 / 4})
|
||||||
|
|
||||||
self.object:setvelocity({x = vel.x, y = vel.y, z = vel.z})
|
self.timer = self.timer + dtime
|
||||||
self.object:setacceleration({x = acc.x, y = acc.y, z = acc.z})
|
if self.timer > 4 then
|
||||||
--]]
|
tnt.boom(self.object:getpos(), def)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user