Page MenuHomeWildfire Games

Do not send Attacked message on entities that have no attack effects receiver
ClosedPublic

Authored by wraitii on May 22 2020, 12:52 PM.

Details

Summary

Since rP22754, it is possible for units to be sent "Attacked" messages even though they cannot be attacked
(e.g. a non-capturable being the target of a Capture attack effect).

This seems bad for a few reasons:

  • performance. Messages get sent for no reason
  • likely source of bug.
  • general cleanliness of the code.

This fixes it and adds a test.


As noted by @Angen here.

Test Plan

Validate the behaviour.

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

wraitii created this revision.May 22 2020, 12:52 PM

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

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

One is attacked though? Just not hurt.
But I guess the definition of attacked in the game is that some effect is caused.

One is attacked though? Just not hurt.
But I guess the definition of attacked in the game is that some effect is caused.

For the record, this is returning to pre rP22754 behaviour. I think the messages are spurious and should be skipped, if only on performance grounds.

wraitii edited the summary of this revision. (Show Details)May 22 2020, 1:12 PM
This revision was not accepted when it landed; it landed in state Needs Review.May 25 2020, 9:15 PM
This revision was automatically updated to reflect the committed changes.