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 name='FleeDistance'>" +
|
||||
"<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>";
|
||||
|
||||
var AnimalFsmSpec = {
|
||||
@ -35,7 +47,7 @@ var AnimalFsmSpec = {
|
||||
this.SelectAnimation("walk", false, this.GetWalkSpeed());
|
||||
this.MoveRandomly(+this.template.RoamDistance);
|
||||
// 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() {
|
||||
@ -56,7 +68,7 @@ var AnimalFsmSpec = {
|
||||
// Stop and eat for a while
|
||||
this.SelectAnimation("feeding");
|
||||
this.StopMoving();
|
||||
this.StartTimer(RandomInt(1000, 4000));
|
||||
this.StartTimer(RandomInt(+this.template.FeedTimeMin, +this.template.FeedTimeMax));
|
||||
},
|
||||
|
||||
"leave": function() {
|
||||
@ -123,9 +135,12 @@ AnimalAI.prototype.PushMessage = function(msg)
|
||||
AnimalAI.prototype.OnUpdate = function()
|
||||
{
|
||||
var mq = this.messageQueue;
|
||||
this.messageQueue = [];
|
||||
for each (var msg in mq)
|
||||
AnimalFsm.ProcessMessage(this, msg);
|
||||
if (mq.length)
|
||||
{
|
||||
this.messageQueue = [];
|
||||
for each (var msg in mq)
|
||||
AnimalFsm.ProcessMessage(this, msg);
|
||||
}
|
||||
};
|
||||
|
||||
AnimalAI.prototype.OnMotionChanged = function(msg)
|
||||
|
@ -18,6 +18,10 @@
|
||||
<AnimalAI>
|
||||
<RoamDistance>4.0</RoamDistance>
|
||||
<FleeDistance>12.0</FleeDistance>
|
||||
<RoamTimeMin>2000</RoamTimeMin>
|
||||
<RoamTimeMax>8000</RoamTimeMax>
|
||||
<FeedTimeMin>1000</FeedTimeMin>
|
||||
<FeedTimeMax>4000</FeedTimeMax>
|
||||
</AnimalAI>
|
||||
<UnitMotion>
|
||||
<WalkSpeed>1.0</WalkSpeed>
|
||||
|
@ -15,8 +15,4 @@
|
||||
<VisualActor>
|
||||
<Actor>fauna/deer.xml</Actor>
|
||||
</VisualActor>
|
||||
<AnimalAI>
|
||||
<RoamDistance>8.0</RoamDistance>
|
||||
<FleeDistance>32.0</FleeDistance>
|
||||
</AnimalAI>
|
||||
</Entity>
|
||||
|
@ -31,9 +31,12 @@
|
||||
<FoundationActor>structures/plot_field_found.xml</FoundationActor>
|
||||
</VisualActor>
|
||||
<Footprint>
|
||||
<Square width="10.0" depth="10.0"/>
|
||||
<Square width="24.0" depth="24.0"/>
|
||||
<Height>8.0</Height>
|
||||
</Footprint>
|
||||
<Obstruction>
|
||||
<Static width="12.0" depth="12.0"/>
|
||||
</Obstruction>
|
||||
<Vision>
|
||||
<Range>7</Range>
|
||||
</Vision>
|
||||
|
@ -24,7 +24,11 @@
|
||||
</UnitMotion>
|
||||
<UnitAI disable=""/>
|
||||
<AnimalAI>
|
||||
<RoamDistance>4.0</RoamDistance>
|
||||
<FleeDistance>12.0</FleeDistance>
|
||||
<RoamDistance>8.0</RoamDistance>
|
||||
<FleeDistance>32.0</FleeDistance>
|
||||
<RoamTimeMin>2000</RoamTimeMin>
|
||||
<RoamTimeMax>8000</RoamTimeMax>
|
||||
<FeedTimeMin>5000</FeedTimeMin>
|
||||
<FeedTimeMax>30000</FeedTimeMax>
|
||||
</AnimalAI>
|
||||
</Entity>
|
||||
|
Loading…
Reference in New Issue
Block a user