diff --git a/binaries/data/mods/official/entities/formations/BoxForm2.xml b/binaries/data/mods/official/entities/formations/BoxForm2.xml
new file mode 100644
index 0000000000..c3606387b4
--- /dev/null
+++ b/binaries/data/mods/official/entities/formations/BoxForm2.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/binaries/data/mods/official/entities/template_entity.xml b/binaries/data/mods/official/entities/template_entity.xml
index 130f3f0015..2ea792391d 100755
--- a/binaries/data/mods/official/entities/template_entity.xml
+++ b/binaries/data/mods/official/entities/template_entity.xml
@@ -34,6 +34,11 @@
-1.0
20
+
+ 7.0
+ 17
+
+
diff --git a/binaries/data/mods/official/entities/template_entity_full.xml b/binaries/data/mods/official/entities/template_entity_full.xml
index 2986f1515b..3e3713de0a 100644
--- a/binaries/data/mods/official/entities/template_entity_full.xml
+++ b/binaries/data/mods/official/entities/template_entity_full.xml
@@ -20,5 +20,6 @@
+
\ No newline at end of file
diff --git a/binaries/data/mods/official/entities/template_entity_script.js b/binaries/data/mods/official/entities/template_entity_script.js
index 545187ff64..887e4b823e 100644
--- a/binaries/data/mods/official/entities/template_entity_script.js
+++ b/binaries/data/mods/official/entities/template_entity_script.js
@@ -742,6 +742,7 @@ function entityEventTargetChanged( evt )
// If we can gather, and the target supplies, gather. If it's our enemy, and we're armed, attack.
// If all else fails, move (or run on a right-click).
+
evt.defaultOrder = NMT_Goto;
evt.defaultCursor = "arrow-default";
evt.defaultAction = ACTION_NONE;
@@ -1312,3 +1313,32 @@ function GotoInRange( x, y, run )
else
this.order( ORDER_GOTO, x, y - this.actions.escort.distance, true);
}
+function entityEventFormation( evt )
+{
+ if ( evt.formationEvent == FORMATION_ENTER )
+ {
+ if ( this.getFormationBonus() && this.isInClass( this.getFormationBonusType() ) )
+ {
+ eval( this + this.getFormationBonus() ) += eval( this + this.getFormationBonus() ) *
+ this.getFormationBonusVal();
+ }
+ if ( this.getFormationPenalty() && this.isInClass( this.getFormationPenaltyType() ) )
+ {
+ eval( this + this.getFormationPenalty() ) -= eval( this + this.getFormationbonus() ) *
+ this.getFormationPenaltyVal();
+ }
+ }
+ //Reverse the bonuses
+ else if ( evt.formationEvent == FORMATION_LEAVE )
+ {
+ if ( this.getFormationBonus() && this.isInClass( this.getFormationBonusType() ) )
+ {
+ eval( this + this.getFormationBonus() ) -= eval( this + this.getFormationBonus() ) * this.getFormationBonusVal();
+ }
+ if ( this.getFormationPenalty() && this.isInClass( this.getFormationPenaltyType() ) )
+ {
+ eval( this + this.getFormationPenalty() ) += eval( this + this.getFormationbonus() ) *
+ this.getFormationPenaltyVal();
+ }
+ }
+}
\ No newline at end of file
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 840b568be5..e2c8d7f707 100644
--- a/binaries/data/mods/official/gui/test/functions_sim_entity.js
+++ b/binaries/data/mods/official/gui/test/functions_sim_entity.js
@@ -70,6 +70,7 @@ function worldClickHandler(event)
else
args[1]=event.secondaryAction;
break;
+ //TODO: get rid of order() calls.
case NMT_NotifyRequest:
if (event.clicks == 1)
action = event.action;
@@ -78,8 +79,10 @@ function worldClickHandler(event)
if (event.entity.isIdle())
{
- for (i=0; i