From 5383104a4fbdb34ffafb8d6072c2424a23ae5a68 Mon Sep 17 00:00:00 2001 From: pyrolink Date: Sat, 21 Jan 2006 11:01:08 +0000 Subject: [PATCH] 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. --- .../mods/official/entities/template_entity.xml | 3 +++ .../official/entities/template_entity_script.js | 14 +++++++++++--- .../data/mods/official/entities/template_unit.xml | 3 ++- .../mods/official/gui/test/functions_sim_entity.js | 10 ++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/official/entities/template_entity.xml b/binaries/data/mods/official/entities/template_entity.xml index 5ee5f25d45..a86db51e5b 100755 --- a/binaries/data/mods/official/entities/template_entity.xml +++ b/binaries/data/mods/official/entities/template_entity.xml @@ -26,6 +26,9 @@ -1.0 20 + 30.0 + 15.0 + 30.0 -1.0 diff --git a/binaries/data/mods/official/entities/template_entity_script.js b/binaries/data/mods/official/entities/template_entity_script.js index 795d8397d2..e5f442b390 100644 --- a/binaries/data/mods/official/entities/template_entity_script.js +++ b/binaries/data/mods/official/entities/template_entity_script.js @@ -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 && diff --git a/binaries/data/mods/official/entities/template_unit.xml b/binaries/data/mods/official/entities/template_unit.xml index e99514f7a6..b4c6cc468b 100644 --- a/binaries/data/mods/official/entities/template_unit.xml +++ b/binaries/data/mods/official/entities/template_unit.xml @@ -31,11 +31,12 @@ 100 5.0 20 + 5.0 - 5.2 + 5.3 20 diff --git a/binaries/data/mods/official/gui/test/functions_sim_entity.js b/binaries/data/mods/official/gui/test/functions_sim_entity.js index afdfdf4593..e6556a9370 100644 --- a/binaries/data/mods/official/gui/test/functions_sim_entity.js +++ b/binaries/data/mods/official/gui/test/functions_sim_entity.js @@ -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 ); + } +} +