Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace self:GetLauncher() #6594

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion effects/Entities/SCUDeath01/SCUDeath01_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SCUDeath01 = Class(NullShell) {
---@param damageData table
PassDamageData = function(self, damageData)
NullShell.PassMetaDamage(self, damageData)
local instigator = self:GetLauncher()
local instigator = self.Launcher
if instigator == nil then
instigator = self
end
Expand Down
4 changes: 2 additions & 2 deletions lua/sim/CollisionBeam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ CollisionBeam = Class(moho.CollisionBeamEntity) {
-- 'Shield'

if impactType == 'Unit' or impactType == 'UnitAir' or impactType == 'UnitUnderwater' then
if not self:GetLauncher() then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this? I do not think the launcher is stored in the collision beam. And therefore self.Launcher may always be nil.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i just did fined and replace with vscode

Copy link
Member

@Garanas Garanas Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is fine, but you need to verify the changes. Did you do the same for #6592 and #6593?

If so, please test and verify the changes. If you do not have the time to do so, then in my opinion it is better to close the pull requests.

if not self.Launcher then
return
end

Expand All @@ -316,7 +316,7 @@ CollisionBeam = Class(moho.CollisionBeamEntity) {
end

-- Do Damage
self:DoDamage(self:GetLauncher(), damageData, targetEntity)
self:DoDamage(self.Launcher, damageData, targetEntity)

local ImpactEffects = {}
local ImpactEffectScale = 1
Expand Down
4 changes: 2 additions & 2 deletions lua/sim/Projectile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
self.Blueprint = blueprint
self.Trash = trash
self.Army = EntityGetArmy(self) --[[@as number]]
self.Launcher = self:GetLauncher() --[[@as Unit]]
self.Launcher = self.Launcher --[[@as Unit]]

-- set some health, if we have some
local maxHealth = blueprint.Defense.MaxHealth
Expand Down Expand Up @@ -760,7 +760,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) {
for k, v in data.Buffs do
if v.Add.OnImpact == true then
if v.AppliedToTarget ~= true or (v.Radius and v.Radius > 0) then
target = self:GetLauncher()
target = self.Launcher
end
-- Check for target validity
if target and IsUnit(target) then
Expand Down
2 changes: 1 addition & 1 deletion lua/sim/projectiles/OverchargeProjectile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ OverchargeProjectile = ClassSimple {
-- Stop us doing blueprint damage in the other OnImpact call if we ditch this one without resetting self.DamageData
self.DamageData.DamageAmount = 0

local launcher = self:GetLauncher()
local launcher = self.Launcher
if not launcher then
return
end
Expand Down
2 changes: 1 addition & 1 deletion projectiles/X1Mercy_proj/X1Mercy_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ X1Mercy = Class(AMiasmaProjectile) {
OnCreate = function(self)
AMiasmaProjectile.OnCreate(self)

local launcher = self:GetLauncher()
local launcher = self.Launcher
if launcher and not launcher:IsDead() then
launcher:ProjectileFired()
end
Expand Down
Loading