1
0
forked from 0ad/0ad

Created a sample unit which automatically starts gathering the nearest object, for use in cinematics. Auto-gatherer versions of other units can be created by copying temp_hele_infantry_javelinist_b_gatherer.xml and changing the parent to the appropriate unit.

This was SVN commit r4727.
This commit is contained in:
Matei 2006-12-31 06:23:33 +00:00
parent 8929e27ace
commit 2d1543b93b
4 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<Entity
Parent="hele_infantry_javelinist_b"
>
<Script File="scripts/entity_functions.js" />
<Event On="Initialize" Function="entityInitGatherer" />
</Entity>

Binary file not shown.

Binary file not shown.

View File

@ -405,6 +405,26 @@ function entityInitQuasi()
// ====================================================================
// A special version of the entity init function that causes the unit to automatically start gathering
// nearby resources, for use in gameplay cinematics before full CPU player AI is implemented.
function entityInitGatherer( evt )
{
// Call the original entityInit function
this.entityInit = entityInit;
this.entityInit( evt );
// After initialization is complete, start gatherering the nearest thing we can;
// this has to be done later using setTimeout to ensure that other entities are initialized
setTimeout(
function() {
this.chooseGatherTarget( null, this.getVisibleEntities() );
},
100, this
);
}
// ====================================================================
// Setup entity's next rank
function setupRank()
{