Now the bubblebeam has a lifetime
This commit is contained in:
parent
aeb1ab8244
commit
e31c704dfc
@ -29,15 +29,17 @@ local bubble_beam = {
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
visual = "sprite",
|
||||
visual_size = {x = 1.5, y = 1.5},
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = {"fbrawl_bubble_entity.png"},
|
||||
initial_sprite_basepos = {x = 0, y = 0},
|
||||
speed = 50,
|
||||
range = 1.8,
|
||||
damage = 1.5
|
||||
},
|
||||
time_passed = 0,
|
||||
lifetime = 0.8,
|
||||
pl_name = "",
|
||||
hit = false,
|
||||
hit = false
|
||||
}
|
||||
|
||||
|
||||
@ -118,12 +120,18 @@ end
|
||||
function bubble_beam:on_step(dtime, moveresult)
|
||||
local player = minetest.get_player_by_name(self.pl_name)
|
||||
local props = self.initial_properties
|
||||
self.time_passed = self.time_passed + dtime
|
||||
|
||||
if not player or moveresult.collides == true then
|
||||
self:remove()
|
||||
return
|
||||
end
|
||||
|
||||
if self.time_passed >= self.lifetime then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
fbrawl.damage_players_near(player, self.object:get_pos(), props.range, props.damage, nil, function ()
|
||||
if self and self.remove then
|
||||
self:remove()
|
||||
|
Loading…
x
Reference in New Issue
Block a user