1
0
forked from 0ad/0ad

# Made units that build a field start auto-gathering it. Also updated field foundation.

This was SVN commit r5347.
This commit is contained in:
Matei 2007-09-16 20:01:57 +00:00
parent 8bc57c24ba
commit 576a0aa421
3 changed files with 20 additions and 7 deletions

View File

@ -4,14 +4,14 @@
<Traits>
<Id>
<Generic>Foundation 6x6</Generic>
<Generic>Foundation Field</Generic>
<Classes>Foundation</Classes>
</Id>
<Footprint>
<Width>28.0</Width>
<Depth>28.0</Depth>
<Width>10.0</Width>
<Depth>10.0</Depth>
<Height>8.0</Height>
</Footprint>
@ -20,7 +20,7 @@
</Vision>
</Traits>
<Actor>structures/plot_field_fallow.xml</Actor>
<Actor>structures/plot_field_found.xml</Actor>
</Entity>

View File

@ -49,6 +49,10 @@
<Type>food</Type>
<SubType>grain</SubType>
</Supply>
<Vision>
<Los>9</Los>
</Vision>
</Traits>

View File

@ -1090,6 +1090,13 @@ function entityEventTargetExhausted( evt )
}
else if( evt.action == ACTION_BUILD )
{
// If the target was gatherable, try to gather it.
if( canGather(this, evt.target) )
{
this.order( ORDER_GENERIC, evt.target, ACTION_GATHER );
return;
}
// Look for other stuff to build
var visible = this.getVisibleEntities();
var bestDist = 1e20;
@ -1110,10 +1117,12 @@ function entityEventTargetExhausted( evt )
if( bestTarget != null )
{
this.order( ORDER_GENERIC, bestTarget, ACTION_BUILD );
return;
}
else if( evt.target.hasClass("Village") )
// Nothing to build, but try to gather any resource around us if this was a village object.
if( evt.target.hasClass("Village") )
{
// Nothing to build, but try to gather any resource around us
this.chooseGatherTarget( null, evt.target.getVisibleEntities() );
}
}