Page MenuHomeWildfire Games

Move TargetKilled from Attacking.js-helper to cmpHealth.
ClosedPublic

Authored by Freagarach on Aug 6 2020, 7:10 PM.

Details

Reviewers
Silier
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23964: Move TargetKilled function from Attacking.js-helper to KilledBy in cmpHealth.
Test Plan

Verify this is a more appropriate place for the function and there is no functional change.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Freagarach created this revision.Aug 6 2020, 7:10 PM
Vulcan added a comment.Aug 6 2020, 7:31 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2931/display/redirect

Freagarach requested review of this revision.Aug 6 2020, 7:47 PM
Silier added a subscriber: Silier.Aug 6 2020, 8:53 PM
Silier added inline comments.
binaries/data/mods/public/simulation/components/Health.js
184 ↗(On Diff #13117)

^ broken

191 ↗(On Diff #13117)

?^

235 ↗(On Diff #13117)

also ^

244 ↗(On Diff #13117)

missed

Silier requested changes to this revision.Aug 6 2020, 8:56 PM
Silier added inline comments.
binaries/data/mods/public/simulation/components/Health.js
202 ↗(On Diff #13117)

also you can kill same entity multiple times

This revision now requires changes to proceed.Aug 6 2020, 8:56 PM
Freagarach updated this revision to Diff 13120.Aug 6 2020, 9:07 PM
Freagarach marked 5 inline comments as done.

Erase "killed" and change change to healthChanged.

Vulcan added a comment.Aug 6 2020, 9:14 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2934/display/redirect

Silier added a comment.Aug 7 2020, 8:05 AM

when updating tests, you should update all

binaries/data/mods/public/simulation/components/tests/test_Damage.js
95 ↗(On Diff #13120)

^ -killed

221 ↗(On Diff #13120)

^

253 ↗(On Diff #13120)

^

316 ↗(On Diff #13120)

^

330 ↗(On Diff #13120)

^

343 ↗(On Diff #13120)

^

415 ↗(On Diff #13120)

^

472 ↗(On Diff #13120)

^

500 ↗(On Diff #13120)

^

515 ↗(On Diff #13120)

^

Freagarach planned changes to this revision.Aug 7 2020, 8:07 AM

It was late yesterday ^^'

Silier added a comment.Aug 7 2020, 8:10 AM

when you are removing killed already, it would be preferable to destroy the object and send just that one number

We need the object for the handling in Attacking.js.

Freagarach updated this revision to Diff 13140.Aug 7 2020, 8:09 PM
Freagarach marked 10 inline comments as done.

Kill.

Vulcan added a comment.Aug 7 2020, 8:14 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2948/display/redirect

Silier accepted this revision.Aug 8 2020, 2:09 PM

-we cannot tell if entity was killed by current attack without checking its health points, but this information was not used anywhere else.
+we can call takedamage from more places and statistics are covered

?TargetKilled might be renamed to something more appropriate as it is called on dying entity

This revision is now accepted and ready to land.Aug 8 2020, 2:09 PM
Freagarach updated this revision to Diff 13169.Aug 10 2020, 8:22 PM

Rename function.

Freagarach updated this revision to Diff 13171.Aug 11 2020, 4:53 PM
  • Fix typo.
  • Don't call GetOwner() twice.
Freagarach requested review of this revision.Aug 11 2020, 4:54 PM
Silier requested changes to this revision.Aug 13 2020, 7:59 PM
Silier added inline comments.
binaries/data/mods/public/simulation/components/Health.js
215 ↗(On Diff #13171)

why? this is redundant variable

This revision now requires changes to proceed.Aug 13 2020, 7:59 PM
Freagarach updated this revision to Diff 13185.Aug 14 2020, 9:39 AM
Freagarach marked an inline comment as done.
  • Remove redundant variable.
Freagarach added inline comments.Aug 14 2020, 9:40 AM
binaries/data/mods/public/simulation/components/Health.js
215–221 ↗(On Diff #13185)

Actually I would say we would need to take the attackerOwner when the attack was performed (i.e. when the projectile was fired) instead of after ownership transfer. But that is out of scope for sure.

Successful build - Chance fights ever on the side of the prudent.

builderr-debug-macos.txt
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:154:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
builderr-release-macos.txt
../../../source/simulation2/scripting/JSInterface_Simulation.cpp:154:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        CFixedVector2D(-halfSize.X, -halfSize.Y),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1334/display/redirect

Silier accepted this revision.Aug 15 2020, 10:13 AM
This revision is now accepted and ready to land.Aug 15 2020, 10:13 AM

Thanks for the review @Angen :)