# More work on territories - Settlements are now claimable.

This was SVN commit r4074.
This commit is contained in:
Matei 2006-07-09 23:13:20 +00:00
parent 1034a980fe
commit 590086571b
3 changed files with 42 additions and 4 deletions

View File

@ -13,13 +13,15 @@
<Icon_Cell>47</Icon_Cell>
<Classes>Housing, Village</Classes>
<Classes>Housing, Village, CivilCentre</Classes>
<Rollover>The heart of the player's empire. Trains economic units, and can only be built on settlements.</Rollover>
</Id>
<Foundation>foundation_5x5</Foundation>
<Socket>Settlement</Socket>
<Footprint>
<Width>24.0</Width>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<Entity
Parent="template_structure"
Parent="template_entity_full"
>
<Traits>
@ -24,8 +24,6 @@
<Is_Territory_Centre>true</Is_Territory_Centre>
<Foundation>foundation_5x5</Foundation>
<Footprint>
<Width>24.0</Width>
<Depth>24.0</Depth>

View File

@ -417,6 +417,11 @@ function attachAuras()
this.addAura ( "trample", a.radius, a.speed, new TrampleAura( this ) );
}
}
if( this.hasClass("Settlement") )
{
this.addAura ( "settlement", 0.1, 0, new SettlementAura( this ) );
}
}
// ====================================================================
@ -1848,6 +1853,39 @@ function TrampleAura( source )
// ====================================================================
function SettlementAura( source )
{
// Defines the effects of the Settlement Aura. Changes ownership of entity when a civil center is on it.
this.source = source;
this.affects = function( e )
{
return ( e.hasClass("CivilCentre") );
}
this.onEnter = function( e )
{
if( this.affects( e ) )
{
// If a new Civ Centre has entered our radius, it must mean it's on us; switch player and become invisible
source.player = e.player;
source.visible = false;
}
};
this.onExit = function( e )
{
if( this.affects( e ) )
{
// If a Civ Centre has entered our radius, it must mean the one on us died; become visible again
source.visible = true;
}
}
}
// ====================================================================
function GotoInRange( x, y, run )
{
if ( !this.actions || !this.actions.move )