From 576a0aa421a28e44a121f47532e63cdcc4b58612 Mon Sep 17 00:00:00 2001 From: Matei Date: Sun, 16 Sep 2007 20:01:57 +0000 Subject: [PATCH] # Made units that build a field start auto-gathering it. Also updated field foundation. This was SVN commit r5347. --- .../mods/official/entities/foundation_field.xml | 10 +++++----- .../entities/template_structure_resource_field.xml | 4 ++++ .../data/mods/official/scripts/entity_functions.js | 13 +++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/binaries/data/mods/official/entities/foundation_field.xml b/binaries/data/mods/official/entities/foundation_field.xml index ae820fb05f..d7479c4799 100644 --- a/binaries/data/mods/official/entities/foundation_field.xml +++ b/binaries/data/mods/official/entities/foundation_field.xml @@ -4,14 +4,14 @@ - Foundation 6x6 + Foundation Field Foundation - 28.0 - 28.0 + 10.0 + 10.0 8.0 @@ -20,7 +20,7 @@ - - structures/plot_field_fallow.xml + + structures/plot_field_found.xml \ No newline at end of file diff --git a/binaries/data/mods/official/entities/template_structure_resource_field.xml b/binaries/data/mods/official/entities/template_structure_resource_field.xml index 158f212de1..654575d434 100644 --- a/binaries/data/mods/official/entities/template_structure_resource_field.xml +++ b/binaries/data/mods/official/entities/template_structure_resource_field.xml @@ -49,6 +49,10 @@ food grain + + + 9 + diff --git a/binaries/data/mods/official/scripts/entity_functions.js b/binaries/data/mods/official/scripts/entity_functions.js index 9d52fb890f..5887d26a2a 100644 --- a/binaries/data/mods/official/scripts/entity_functions.js +++ b/binaries/data/mods/official/scripts/entity_functions.js @@ -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() ); } }