Page MenuHomeWildfire Games

Make the ai aware of invulnerable entities
ClosedPublic

Authored by mimo on Jan 28 2018, 7:42 PM.

Details

Summary

As the title say.
In the case of relics, there is ticket #5007 to remove the Health component of relics. but this solution is only fine for stable invulnerability, but we may still have temporary ones (as is already the case for cheering, and could be extended by mods).

This will be used in a next patch to prevent the ai to attack relics.

Test Plan

Checks that it works as expected.

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

mimo created this revision.Jan 28 2018, 7:42 PM
Vulcan added a subscriber: Vulcan.Jan 28 2018, 7:54 PM

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

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|  39|  39| 
|  40|  40| AIProxy.prototype.Serialize = null; // we have no dynamic state to save
|  41|  41| 
|  42|    |-AIProxy.prototype.Deserialize = function ()
|    |  42|+AIProxy.prototype.Deserialize = function()
|  43|  43| {
|  44|  44| 	this.Init();
|  45|  45| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
| 167| 167| 	// Send a message telling a unit garrisoned or ungarrisoned.
| 168| 168| 	// I won't check if the unit is still alive so it'll be up to the AI.
| 169| 169| 	for (let ent of msg.added)
| 170|    |-		this.cmpAIInterface.PushEvent("Garrison", {"entity" : ent, "holder": this.entity});
|    | 170|+		this.cmpAIInterface.PushEvent("Garrison", { "entity" : ent, "holder": this.entity});
| 171| 171| 	for (let ent of msg.removed)
| 172| 172| 		this.cmpAIInterface.PushEvent("UnGarrison", {"entity" : ent, "holder": this.entity});
| 173| 173| };
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'entity'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
| 167| 167| 	// Send a message telling a unit garrisoned or ungarrisoned.
| 168| 168| 	// I won't check if the unit is still alive so it'll be up to the AI.
| 169| 169| 	for (let ent of msg.added)
| 170|    |-		this.cmpAIInterface.PushEvent("Garrison", {"entity" : ent, "holder": this.entity});
|    | 170|+		this.cmpAIInterface.PushEvent("Garrison", {"entity": ent, "holder": this.entity});
| 171| 171| 	for (let ent of msg.removed)
| 172| 172| 		this.cmpAIInterface.PushEvent("UnGarrison", {"entity" : ent, "holder": this.entity});
| 173| 173| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
| 167| 167| 	// Send a message telling a unit garrisoned or ungarrisoned.
| 168| 168| 	// I won't check if the unit is still alive so it'll be up to the AI.
| 169| 169| 	for (let ent of msg.added)
| 170|    |-		this.cmpAIInterface.PushEvent("Garrison", {"entity" : ent, "holder": this.entity});
|    | 170|+		this.cmpAIInterface.PushEvent("Garrison", {"entity" : ent, "holder": this.entity });
| 171| 171| 	for (let ent of msg.removed)
| 172| 172| 		this.cmpAIInterface.PushEvent("UnGarrison", {"entity" : ent, "holder": this.entity});
| 173| 173| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/phabricator_lint/binaries/data/mods/public/simulation/components/AIProxy.js
| 169| 169| 	for (let ent of msg.added)
| 170| 170| 		this.cmpAIInterface.PushEvent("Garrison", {"entity" : ent, "holder": this.entity});
| 171| 171| 	for (let ent of msg.removed)
| 172|    |-		this.cmpAIInterface.PushEvent("UnGarrison", {"entity" : ent, "holder": this.entity});
|    | 172|+		this.cmpAIInterface.PushEvent("UnGarrison", { "entity"
elexis added a subscriber: elexis.Jan 28 2018, 8:31 PM

Ah, cheering. Otherwise I had claimed unlikelihood of temporary invulnerability
The other use case I forgot about were traders on silk road #3590, but those can use a special filter template.
(I just recall a strong desire to use special templates about 2 years ago, maybe rP17408 or rP18915 so that the AI doesnt have to pull this through the GUIInterface or AIInterface.)

If it works as advertized (message only sent to subscribing components, petra can read that information), then you should commit it.

binaries/data/mods/public/simulation/components/Armour.js
24 ↗(On Diff #5548)

is for boolean getters? i.e. IsInvulnerable, Get is fine too.
(For those interested in even more linting spam, there are 4 spaces the bot complained about)

This revision was not accepted when it landed; it landed in state Needs Review.Jan 28 2018, 8:53 PM
This revision was automatically updated to reflect the committed changes.