From e31c704dfce2624da8c065da502fc2d05b3665a3 Mon Sep 17 00:00:00 2001 From: Giov4 Date: Sat, 28 Jan 2023 01:15:56 +0100 Subject: [PATCH] Now the bubblebeam has a lifetime --- _classes/mage/skills/bubble_beam.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/_classes/mage/skills/bubble_beam.lua b/_classes/mage/skills/bubble_beam.lua index dc1f122..47d5453 100644 --- a/_classes/mage/skills/bubble_beam.lua +++ b/_classes/mage/skills/bubble_beam.lua @@ -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()