diff --git a/binaries/data/mods/official/entities/template_entity.xml b/binaries/data/mods/official/entities/template_entity.xml
index a0217ac3ac..5ee5f25d45 100755
--- a/binaries/data/mods/official/entities/template_entity.xml
+++ b/binaries/data/mods/official/entities/template_entity.xml
@@ -25,7 +25,12 @@
-1.0
+ 20
+
+ -1.0
+ 20
+
diff --git a/binaries/data/mods/official/entities/template_entity_script.js b/binaries/data/mods/official/entities/template_entity_script.js
index 7d811e1f3a..60ea3d59b9 100644
--- a/binaries/data/mods/official/entities/template_entity_script.js
+++ b/binaries/data/mods/official/entities/template_entity_script.js
@@ -48,6 +48,10 @@ function entityInit()
if (this.traits.health && this.traits.health.max)
this.traits.health.curr = this.traits.health.max
+ // If entity has health, set current to same.
+ if (this.traits.stamina && this.traits.stamina.max)
+ this.traits.stamina.curr = this.traits.stamina.max
+
if (this.traits.supply)
{
// If entity has supply, set current to same.
@@ -545,6 +549,9 @@ function entityEventGeneric( evt )
console.write( "Unknown generic action: " + evt.action );
}
}
+
+//======================================================================
+
function entityEventNotification( evt )
{
switch( evt.type )
@@ -554,11 +561,10 @@ function entityEventNotification( evt )
case NOTIFY_ATTACK:
case NOTIFY_DAMAGE:
this.Order( ORDER_GENERIC, evt.target, ACTION_ATTACK);
- this.Order( ORDER_GENERIC, evt.target, ACTION_ATTACK);
case NOTIFY_HEAL:
- this.Order( ORDER_GENERIC, evt.target, ACTION_HEAL);
+ this.Order( ORDER_GENERIC, evt.target, ACTION_HEAL );
case NOTIFY_GATHER:
- this.Order( ORDER_GENERIC, evt.target, ACTION_GATHER);
+ this.Order( ORDER_GENERIC, evt.target, ACTION_GATHER );
}
}
@@ -579,6 +585,9 @@ function entityEventTargetChanged( evt )
evt.defaultOrder = NMT_Goto;
evt.defaultCursor = "arrow-default";
+ evt.secondaryOrder = NMT_Run;
+ evt.secondaryCursor = "arrow-default";
+
if( evt.target && this.actions )
{
/*
@@ -597,6 +606,7 @@ function entityEventTargetChanged( evt )
evt.defaultCursor = "action-gather-" + evt.target.traits.supply.subtype;
}
*/
+
if( this.actions.attack &&
evt.target.player != this.player &&
evt.target.traits.health &&
@@ -605,13 +615,22 @@ function entityEventTargetChanged( evt )
evt.defaultOrder = NMT_Generic;
evt.defaultAction = ACTION_ATTACK;
evt.defaultCursor = "action-attack";
+
+ evt.secondaryOrder = NMT_Generic;
+ evt.secondaryAction = ACTION_ATTACK;
+ evt.secondaryCursor = "action-attack";
}
if( canGather( this, evt.target ) )
{
evt.defaultOrder = NMT_Generic;
evt.defaultAction = ACTION_GATHER;
- // Set cursor (eg "action-gather-fruit").
- evt.defaultCursor = "action-gather-" + evt.target.traits.supply.subtype;
+ // Set cursor (eg "action-gather-fruit").
+ evt.defaultCursor = "action-gather-" + evt.target.traits.supply.subtype;
+
+ evt.secondaryOrder = NMT_Generic;
+ evt.secondaryAction = ACTION_GATHER;
+ // Set cursor (eg "action-gather-fruit").
+ evt.secondaryCursor = "action-gather-" + evt.target.traits.supply.subtype;
}
}
}
@@ -636,6 +655,10 @@ function entityEventPrepareOrder( evt )
if( !this.actions.move )
evt.preventDefault();
break;
+ case ORDER_RUN:
+ if( !this.actions.move.run )
+ evt.preventDefault();
+ break;
case ORDER_PATROL:
if( !this.actions.patrol )
evt.preventDefault();
diff --git a/binaries/data/mods/official/entities/template_unit.xml b/binaries/data/mods/official/entities/template_unit.xml
index 2491302b7b..a70cad4f02 100644
--- a/binaries/data/mods/official/entities/template_unit.xml
+++ b/binaries/data/mods/official/entities/template_unit.xml
@@ -26,11 +26,18 @@
0.5
4.0
-
+
100
5.0
+ 20
+
+
+ 5.0
+ 5.2
+ 20
+
Unit
@@ -48,6 +55,8 @@
0.0
0.0
+ 10.0
+ 5.0
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 79311ecd9c..afdfdf4593 100644
--- a/binaries/data/mods/official/gui/test/functions_sim_entity.js
+++ b/binaries/data/mods/official/gui/test/functions_sim_entity.js
@@ -2,7 +2,6 @@
DESCRIPTION : Functions for the world click handler and manipulating entities.
NOTES :
*/
-
// ====================================================================
addGlobalHandler ("worldClick", worldClickHandler);
@@ -43,6 +42,7 @@ function worldClickHandler(event)
{
// location target commands
case NMT_Goto:
+ case NMT_Run:
case NMT_Patrol:
if (event.queued)
{
@@ -65,13 +65,19 @@ function worldClickHandler(event)
// break;
case NMT_Generic:
args[0]=event.entity;
- args[1]=event.action;
+ if ( event.clicks == 1)
+ args[1]=event.action;
+ else
+ args[1]=event.secondaryAction;
break;
default:
console.write("worldClickHandler: Unknown order: "+cmd);
return;
break;
}
+
+ if (event.clicks == 2)
+ triggerSelectionRun();
issueCommand (selection, cmd, args[0], args[1]);
}
@@ -161,6 +167,13 @@ function selected()
// ====================================================================
-
+function triggerSelectionRun()
+{
+ for ( i=0; i< selection.length; i++ )
+ {
+ selection[i].triggerRun();
+ }
+}
+