forked from 0ad/0ad
Slow down animals, so they don't pathfind quite so much.
Make farms a better size. This was SVN commit r7774.
This commit is contained in:
parent
4471d37ca5
commit
8a1aa101c1
@ -16,6 +16,18 @@ AnimalAI.prototype.Schema =
|
|||||||
"</element>" +
|
"</element>" +
|
||||||
"<element name='FleeDistance'>" +
|
"<element name='FleeDistance'>" +
|
||||||
"<ref name='positiveDecimal'/>" +
|
"<ref name='positiveDecimal'/>" +
|
||||||
|
"</element>" +
|
||||||
|
"<element name='RoamTimeMin'>" +
|
||||||
|
"<ref name='positiveDecimal'/>" +
|
||||||
|
"</element>" +
|
||||||
|
"<element name='RoamTimeMax'>" +
|
||||||
|
"<ref name='positiveDecimal'/>" +
|
||||||
|
"</element>" +
|
||||||
|
"<element name='FeedTimeMin'>" +
|
||||||
|
"<ref name='positiveDecimal'/>" +
|
||||||
|
"</element>" +
|
||||||
|
"<element name='FeedTimeMax'>" +
|
||||||
|
"<ref name='positiveDecimal'/>" +
|
||||||
"</element>";
|
"</element>";
|
||||||
|
|
||||||
var AnimalFsmSpec = {
|
var AnimalFsmSpec = {
|
||||||
@ -35,7 +47,7 @@ var AnimalFsmSpec = {
|
|||||||
this.SelectAnimation("walk", false, this.GetWalkSpeed());
|
this.SelectAnimation("walk", false, this.GetWalkSpeed());
|
||||||
this.MoveRandomly(+this.template.RoamDistance);
|
this.MoveRandomly(+this.template.RoamDistance);
|
||||||
// Set a random timer to switch to feeding state
|
// Set a random timer to switch to feeding state
|
||||||
this.StartTimer(RandomInt(2000, 8000));
|
this.StartTimer(RandomInt(+this.template.RoamTimeMin, +this.template.RoamTimeMax));
|
||||||
},
|
},
|
||||||
|
|
||||||
"leave": function() {
|
"leave": function() {
|
||||||
@ -56,7 +68,7 @@ var AnimalFsmSpec = {
|
|||||||
// Stop and eat for a while
|
// Stop and eat for a while
|
||||||
this.SelectAnimation("feeding");
|
this.SelectAnimation("feeding");
|
||||||
this.StopMoving();
|
this.StopMoving();
|
||||||
this.StartTimer(RandomInt(1000, 4000));
|
this.StartTimer(RandomInt(+this.template.FeedTimeMin, +this.template.FeedTimeMax));
|
||||||
},
|
},
|
||||||
|
|
||||||
"leave": function() {
|
"leave": function() {
|
||||||
@ -123,9 +135,12 @@ AnimalAI.prototype.PushMessage = function(msg)
|
|||||||
AnimalAI.prototype.OnUpdate = function()
|
AnimalAI.prototype.OnUpdate = function()
|
||||||
{
|
{
|
||||||
var mq = this.messageQueue;
|
var mq = this.messageQueue;
|
||||||
this.messageQueue = [];
|
if (mq.length)
|
||||||
for each (var msg in mq)
|
{
|
||||||
AnimalFsm.ProcessMessage(this, msg);
|
this.messageQueue = [];
|
||||||
|
for each (var msg in mq)
|
||||||
|
AnimalFsm.ProcessMessage(this, msg);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimalAI.prototype.OnMotionChanged = function(msg)
|
AnimalAI.prototype.OnMotionChanged = function(msg)
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
<AnimalAI>
|
<AnimalAI>
|
||||||
<RoamDistance>4.0</RoamDistance>
|
<RoamDistance>4.0</RoamDistance>
|
||||||
<FleeDistance>12.0</FleeDistance>
|
<FleeDistance>12.0</FleeDistance>
|
||||||
|
<RoamTimeMin>2000</RoamTimeMin>
|
||||||
|
<RoamTimeMax>8000</RoamTimeMax>
|
||||||
|
<FeedTimeMin>1000</FeedTimeMin>
|
||||||
|
<FeedTimeMax>4000</FeedTimeMax>
|
||||||
</AnimalAI>
|
</AnimalAI>
|
||||||
<UnitMotion>
|
<UnitMotion>
|
||||||
<WalkSpeed>1.0</WalkSpeed>
|
<WalkSpeed>1.0</WalkSpeed>
|
||||||
|
@ -15,8 +15,4 @@
|
|||||||
<VisualActor>
|
<VisualActor>
|
||||||
<Actor>fauna/deer.xml</Actor>
|
<Actor>fauna/deer.xml</Actor>
|
||||||
</VisualActor>
|
</VisualActor>
|
||||||
<AnimalAI>
|
|
||||||
<RoamDistance>8.0</RoamDistance>
|
|
||||||
<FleeDistance>32.0</FleeDistance>
|
|
||||||
</AnimalAI>
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
@ -31,9 +31,12 @@
|
|||||||
<FoundationActor>structures/plot_field_found.xml</FoundationActor>
|
<FoundationActor>structures/plot_field_found.xml</FoundationActor>
|
||||||
</VisualActor>
|
</VisualActor>
|
||||||
<Footprint>
|
<Footprint>
|
||||||
<Square width="10.0" depth="10.0"/>
|
<Square width="24.0" depth="24.0"/>
|
||||||
<Height>8.0</Height>
|
<Height>8.0</Height>
|
||||||
</Footprint>
|
</Footprint>
|
||||||
|
<Obstruction>
|
||||||
|
<Static width="12.0" depth="12.0"/>
|
||||||
|
</Obstruction>
|
||||||
<Vision>
|
<Vision>
|
||||||
<Range>7</Range>
|
<Range>7</Range>
|
||||||
</Vision>
|
</Vision>
|
||||||
|
@ -24,7 +24,11 @@
|
|||||||
</UnitMotion>
|
</UnitMotion>
|
||||||
<UnitAI disable=""/>
|
<UnitAI disable=""/>
|
||||||
<AnimalAI>
|
<AnimalAI>
|
||||||
<RoamDistance>4.0</RoamDistance>
|
<RoamDistance>8.0</RoamDistance>
|
||||||
<FleeDistance>12.0</FleeDistance>
|
<FleeDistance>32.0</FleeDistance>
|
||||||
|
<RoamTimeMin>2000</RoamTimeMin>
|
||||||
|
<RoamTimeMax>8000</RoamTimeMax>
|
||||||
|
<FeedTimeMin>5000</FeedTimeMin>
|
||||||
|
<FeedTimeMax>30000</FeedTimeMax>
|
||||||
</AnimalAI>
|
</AnimalAI>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
Loading…
Reference in New Issue
Block a user