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

View File

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

View File

@ -1090,6 +1090,13 @@ function entityEventTargetExhausted( evt )
} }
else if( evt.action == ACTION_BUILD ) 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 // Look for other stuff to build
var visible = this.getVisibleEntities(); var visible = this.getVisibleEntities();
var bestDist = 1e20; var bestDist = 1e20;
@ -1110,10 +1117,12 @@ function entityEventTargetExhausted( evt )
if( bestTarget != null ) if( bestTarget != null )
{ {
this.order( ORDER_GENERIC, bestTarget, ACTION_BUILD ); 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() ); this.chooseGatherTarget( null, evt.target.getVisibleEntities() );
} }
} }