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:
parent
8929e27ace
commit
2d1543b93b
@ -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>
|
BIN
binaries/data/mods/official/maps/scenarios/test_autogather.pmp
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/official/maps/scenarios/test_autogather.pmp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
binaries/data/mods/official/maps/scenarios/test_autogather.xml
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/official/maps/scenarios/test_autogather.xml
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -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
|
// Setup entity's next rank
|
||||||
function setupRank()
|
function setupRank()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user