Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/snippets/fix.7077.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- (#7077) Cybran T1 Bomber (URA0103):

- Fixed an issue where bombs would linger after impact, cluttering the screen.
- Fixed an issue where bombs failed to be destroyed upon water impact.
34 changes: 25 additions & 9 deletions lua/cybranprojectiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,16 @@ CNeutronClusterBombProjectile = ClassProjectile(SinglePolyTrailProjectile) {
OnCreate = function(self)
SinglePolyTrailProjectile.OnCreate(self)
self.Impacted = false
self.Trash:Add(ForkThread(self.FailsafeDestroyThread, self))
end,

--- Destroys the projectile in rare cases where no impact callback happens
---@param self CNeutronClusterBombProjectile
FailsafeDestroyThread = function(self)
WaitTicks(120)
if not self:BeenDestroyed() then
self:Destroy()
end
end,

--- Note: Damage is done once in AOE by main projectile. Secondary projectiles
Expand All @@ -491,16 +501,22 @@ CNeutronClusterBombProjectile = ClassProjectile(SinglePolyTrailProjectile) {
---@param targetType string
---@param targetEntity Unit
OnImpact = function(self, targetType, targetEntity)
if self.Impacted == false and targetType ~= 'Air' then
if self.Impacted == false then
self.Impacted = true
local Random = Random
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(0,Random(1,3),Random(1.5,3))
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(Random(1,2),Random(1,3),Random(1,2))
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(0,Random(1,3),-Random(1.5,3))
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(Random(1.5,3),Random(1,3),0)
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(-Random(1,2),Random(1,3),-Random(1,2))
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(-Random(1.5,2.5),Random(1,3),0)
self:CreateChildProjectile(self.ChildProjectile):SetVelocity(-Random(1,2),Random(1,3),Random(2,4))

if targetType ~= 'Air' then
local Random = Random
local child = self.ChildProjectile

self:CreateChildProjectile(child):SetVelocity(0, Random(1,3), Random(1.5,3))
self:CreateChildProjectile(child):SetVelocity(Random(1,2), Random(1,3), Random(1,2))
self:CreateChildProjectile(child):SetVelocity(0, Random(1,3), -Random(1.5,3))
self:CreateChildProjectile(child):SetVelocity(Random(1.5,3), Random(1,3), 0)
self:CreateChildProjectile(child):SetVelocity(-Random(1,2), Random(1,3), -Random(1,2))
self:CreateChildProjectile(child):SetVelocity(-Random(1.5,2.5), Random(1,3), 0)
self:CreateChildProjectile(child):SetVelocity(-Random(1,2), Random(1,3), Random(2,4))
end

SinglePolyTrailProjectile.OnImpact(self, targetType, targetEntity)
end
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ProjectileBlueprint{
Interface = { HelpText = 0 },
Physics = {
Acceleration = 2,
DestroyOnWater = true,
InitialSpeed = 1,
InitialSpeedRange = 0,
MaxSpeed = 105,
Expand Down
Loading