-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Move Warheads from the engine to Mods.Common #8635
Conversation
@@ -40,7 +41,8 @@ public void Killed(Actor self, AttackInfo e) | |||
if (self.World.SharedRandom.Next(100) > info.Chance) | |||
return; | |||
|
|||
if (info.DeathType != null && e.Warhead != null && !info.DeathType.Intersect(e.Warhead.DamageTypes).Any()) | |||
var warhead = e.Warhead as DamageWarhead; | |||
if (info.DeathType != null && e.Warhead != null && !info.DeathType.Intersect(warhead.DamageTypes).Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and the other code like it) need to be checking warhead != null
to avoid a NRE if e.Warhead
isn't a DamageWarhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the warhead that killed the actor, so how can it not have dealt damage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"this won't happen in practice" is no excuse for incorrect code :)
Everything still shoots, gets damaged, spawns visceroids and deteriorate without concrete. ✅ |
Needs a rebase. |
Rebased. |
Code looks good to me and warheads still work (including special cases like spawning visceroid and changing owner). |
Move Warheads from the engine to Mods.Common
Introduces
IWarhead
to enable movingWarhead
andDamageWarhead
outside of the engine and intoOpenRA.Mods.Common.Warheads
, where they belong.Split into several commits to make reviewing easier.
This is the last step before
Armor
can be moved toMods.Common
and made upgradable.