Adds new NaturalBehaviour "domestic" to UnitAI, useful for tame animals who should never flee an attacker. Fixes #971.

Renames herd_passive template to herd_domestic.

This was SVN commit r10333.
This commit is contained in:
historic_bruno 2011-09-27 18:03:58 +00:00
parent 71a482cfa3
commit d63947597c
7 changed files with 12 additions and 7 deletions

View File

@ -25,8 +25,9 @@ UnitAI.prototype.Schema =
"<value a:help='Will actively attack any unit it encounters, even if not threatened'>violent</value>" +
"<value a:help='Will attack nearby units if it feels threatened (if they linger within LOS for too long)'>aggressive</value>" +
"<value a:help='Will attack nearby units if attacked'>defensive</value>" +
"<value a:help='Will never attack units'>passive</value>" +
"<value a:help='Will never attack units but will attempt to flee when attacked'>passive</value>" +
"<value a:help='Will never attack units. Will typically attempt to flee for short distances when units approach'>skittish</value>" +
"<value a:help='Will never attack units and will not attempt to flee when attacked'>domestic</value>" +
"</choice>" +
"</element>" +
"<element name='RoamDistance'>" +
@ -1203,6 +1204,10 @@ var UnitFsmSpec = {
if (this.CanAttack(msg.data.attacker))
this.Attack(msg.data.attacker, false);
}
else if (this.template.NaturalBehaviour == "domestic")
{ // Never flee, stop what we were doing
this.SetNextState("IDLE");
}
},
"Order.LeaveFoundation": function(msg) {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<Entity parent="template_unit_fauna_herd_domestic">
<Footprint>
<Circle radius="0.75"/>
<Height>1.5</Height>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<Entity parent="template_unit_fauna_herd_domestic">
<Cost>
<BuildTime>50</BuildTime>
<Resources>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<Entity parent="template_unit_fauna_herd_domestic">
<Footprint>
<Circle radius="1.5"/>
<Height>2.5</Height>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<Entity parent="template_unit_fauna_herd_domestic">
<Identity>
<Civ>gaia</Civ>
<SpecificName>Pig</SpecificName>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_herd_passive">
<Entity parent="template_unit_fauna_herd_domestic">
<Cost>
<BuildTime>45</BuildTime>
<Resources>

View File

@ -3,6 +3,6 @@
<Identity>
</Identity>
<UnitAI>
<NaturalBehaviour>passive</NaturalBehaviour>
<NaturalBehaviour>domestic</NaturalBehaviour>
</UnitAI>
</Entity>