From cf14a7bc15d93038d9cb93d5104251a5ebe6660b Mon Sep 17 00:00:00 2001 From: pyrolink Date: Fri, 31 Mar 2006 03:37:36 +0000 Subject: [PATCH] -rank/formation stuff and fixes. To give a unit a rank texture, just set rank.name in the entity's XML to the filename of the texture e.g. elite.dds or advanced.dds This was SVN commit r3711. --- .../official/entities/formations/BoxForm2.xml | 51 +++++++++++++++++++ .../official/entities/template_entity.xml | 5 ++ .../entities/template_entity_full.xml | 1 + .../entities/template_entity_script.js | 30 +++++++++++ .../official/gui/test/functions_sim_entity.js | 9 +++- 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 binaries/data/mods/official/entities/formations/BoxForm2.xml 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