1
0
forked from 0ad/0ad

Added health regen/decay with time delay, corrected continual run bug (once running, disregards reorders to walk until destination reached).

This was SVN commit r3377.
This commit is contained in:
pyrolink 2006-01-21 11:01:08 +00:00
parent c2c5e87c61
commit 5383104a4f
4 changed files with 26 additions and 4 deletions

View File

@ -26,6 +26,9 @@
<Health>
<Bar_Height>-1.0</Bar_Height>
<Bar_Size>20</Bar_Size>
<Regen_Rate>30.0</Regen_Rate>
<Regen_Start>15.0</Regen_Start>
<Decay_Rate>30.0</Decay_Rate>
</Health>
<Stamina>
<Bar_Height>-1.0</Bar_Height>

View File

@ -557,14 +557,19 @@ function entityEventNotification( evt )
{
case NOTIFY_GOTO:
this.Order( ORDER_GENERIC, evt.location.x, evt.location.y );
break;
case NOTIFY_ATTACK:
case NOTIFY_DAMAGE:
this.Order( ORDER_GENERIC, evt.target, ACTION_ATTACK);
break;
case NOTIFY_HEAL:
this.Order( ORDER_GENERIC, evt.target, ACTION_HEAL );
break;
case NOTIFY_GATHER:
this.Order( ORDER_GENERIC, evt.target, ACTION_GATHER );
break;
default:
console.wrote( "Unknown notification request" + evt.type );
}
}
// ====================================================================
@ -580,9 +585,12 @@ function entityEventTargetChanged( evt )
evt.defaultOrder = NMT_Goto;
evt.defaultCursor = "arrow-default";
evt.secondaryOrder = NMT_Run;
evt.secondaryCursor = "arrow-default";
if ( this.actions.run && this.actions.run.speed > 0 )
{
evt.secondaryOrder = NMT_Run;
}
if( evt.target && this.actions )
{
if( this.actions.attack &&

View File

@ -31,11 +31,12 @@
<Max>100</Max>
<Bar_Height>5.0</Bar_Height>
<Bar_Size>20</Bar_Size>
</Health>
<Stamina>
<Max>5.0</Max>
<Bar_Height>5.2</Bar_Height>
<Bar_Height>5.3</Bar_Height>
<Bar_Size>20</Bar_Size>
</Stamina>

View File

@ -78,6 +78,8 @@ function worldClickHandler(event)
if (event.clicks == 2)
triggerSelectionRun();
else
setSelectionRun();
issueCommand (selection, cmd, args[0], args[1]);
}
@ -174,6 +176,14 @@ function triggerSelectionRun()
selection[i].triggerRun();
}
}
function setSelectionRun()
{
for ( i=0; i< selection.length; i++ )
{
selection[i].setRun( false );
}
}