- Treat units with health.max = 0 (the default when not defined as immortal and unattackable. This applies to Settlements, trees, etc. Should solve the problem of these things being killed by arrows by mistake.

- Better "unit X has killed unit Y" message - now includes player
number.

This was SVN commit r6213.
This commit is contained in:
Matei 2008-07-12 07:22:11 +00:00
parent 01dc8c3d72
commit 088f3b54be
2 changed files with 16 additions and 10 deletions

View File

@ -8,7 +8,7 @@
<Id>
<Internal_Only />
<Generic>Gaia Building</Generic>
<Generic>Settlement</Generic>
<Specific>Settlement</Specific>
<Civ>Gaia</Civ>

View File

@ -858,7 +858,10 @@ function performRepair( evt )
function damage( dmg, inflictor )
{
var arm = this.traits.armour;
if(!arm) return; // corpses have no armour, everything else should
if( !arm ) return; // corpses have no armour, everything else should
// Use traits.health.max = 0 to signify immortal things like settlements
if( this.traits.health.max == 0 ) return;
this.lastCombatTime = getGameTime();
@ -944,10 +947,13 @@ function damage( dmg, inflictor )
}
// Notify player.
if ( inflictor )
console.write( this.traits.id.generic + " got the point of " + inflictor.traits.id.generic + "'s weapon." );
else
console.write( this.traits.id.generic + " died in mysterious circumstances." );
if ( inflictor ) {
console.write( "P" + this.player.id + "'s " + this.traits.id.generic +
" got the point of " + inflictor.traits.id.generic + "'s weapon." );
} else {
console.write( "P" + this.player.id + "'s " + this.traits.id.generic +
" died in mysterious circumstances." );
}
// Make him cry out in pain.
if (this.traits.audio && this.traits.audio.path)
@ -1052,7 +1058,7 @@ function entityEventNotification( evt )
function getAttackAction( target )
{
if (!this.actions.attack)
if ( !this.actions.attack || target.traits.health.max == 0 )
return ACTION_NONE;
var attack = this.actions.attack;
if ( attack.melee )