1
0
forked from mirrors/0ad

Fix units not reentering FORMATIONMEMBER.IDLE when they are promoted or stopped

When unit is idle in formation and promoted, it enters INDIVIDUAL.IDLE
incorrectly.
When unit is moving as part of formation and formation is ordered to
stop, unit enters INDIVIDUAL.IDLE but should keep FORMATIONMEMBER.IDLE.

Differential Revision: https://code.wildfiregames.com/D2468
This was SVN commit r23236.
This commit is contained in:
Angen
2019-12-14 15:47:26 +00:00
parent df524c31d1
commit 425fb6d93a
20 changed files with 39 additions and 10 deletions
@@ -5,5 +5,6 @@
<animation file="biped/formations/anti_cavalry/back_idle.dae" name="Idle" speed="50"/>
<animation file="biped/infantry/spearman/walk_relax.dae" name="Walk" id="walk1" speed="30"/>
<animation file="biped/infantry/spearman/walk_relax.dae" name="Walk" id="walk2" speed="32"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/anti_cavalry/front_idle.dae" name="Idle" speed="50"/>
<animation file="biped/infantry/spearman/walk_relax.dae" name="Walk" id="walk1" speed="30"/>
<animation file="biped/infantry/spearman/walk_relax.dae" name="Walk" id="walk2" speed="32"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<variant name="line_closed_front" frequency="0">
<animations>
<animation file="biped/formations/line_closed/idle_ready_sword.dae" name="Idle" speed="50"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk3" speed="17"/>
</animations>
</variant>
<?xml version="1.0" encoding="UTF-8"?>
<variant name="line_closed_front" frequency="0">
<animations>
<animation file="biped/formations/line_closed/idle_ready_sword.dae" name="Idle" speed="50"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/line_closed/walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/infantry/hoplite/idle_ready_back.dae" name="Idle" id="phalanxbacktidle" speed="30"/>
<animation file="biped/infantry/hoplite/walk_ready.dae" name="Walk" id="phalanxbackwalk" speed="30"/>
<animation file="biped/infantry/hoplite/jog_ready.dae" name="Run" id="phalanxbackrun" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/infantry/hoplite/idle_ready_front.dae" name="Idle" id="phalanxfrontidle" speed="30"/>
<animation file="biped/infantry/hoplite/walk_ready_front.dae" name="Walk" id="phalanxfrontwalk" speed="30"/>
<animation file="biped/infantry/hoplite/run_ready.dae" name="Run" id="phalanxfrontrun" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/infantry/hoplite/idle_ready_01.dae" name="Idle" id="phalanxmididle" speed="30"/>
<animation file="biped/infantry/hoplite/walk_ready.dae" name="Walk" id="phalanxmidwalk" speed="30"/>
<animation file="biped/infantry/hoplite/run_ready.dae" name="Run" id="phalanxmidrun" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_01.dae" name="Idle" speed="30"/>
<animation file="biped/formations/syntagma/walk_ready_01.dae" name="Walk" id="syntagwalk1" speed="30"/>
<animation file="biped/infantry/pikeman/run_ready.dae" name="Run" id="syntagmarun1" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_02.dae" name="Idle" speed="30"/>
<animation file="biped/formations/syntagma/walk_ready_02.dae" name="Walk" id="syntagwalk1" speed="30"/>
<animation file="biped/infantry/pikeman/run_ready.dae" name="Run" id="syntagmarun1" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_03.dae" name="Idle" speed="30"/>
<animation file="biped/formations/syntagma/walk_ready_03.dae" name="Walk" id="syntagwalk1" speed="30"/>
<animation file="biped/infantry/pikeman/run_ready.dae" name="Run" id="syntagmarun1" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_04.dae" name="Idle" speed="30"/>
<animation file="biped/formations/syntagma/walk_ready_04.dae" name="Walk" id="syntagwalk1" speed="30"/>
<animation file="biped/infantry/pikeman/run_ready.dae" name="Run" id="syntagmarun1" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_back.dae" name="Idle" id="syntagmaidle" speed="30"/>
<animation file="biped/formations/syntagma/walk_relax_back.dae" name="walk" id="syntagmawalk" speed="30"/>
<animation file="biped/infantry/pikeman/jog_ready.dae" name="run" id="syntagmarun" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -4,5 +4,6 @@
<animation file="biped/formations/syntagma/idle_ready_front.dae" name="Idle" speed="30"/>
<animation file="biped/infantry/pikeman/walk_ready.dae" name="Walk" id="syntagwalk1" speed="30"/>
<animation file="biped/infantry/pikeman/run_ready.dae" name="Run" id="syntagmarun1" speed="10"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/testudo/front_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/front_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/front_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/testudo/front_left_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/front_left_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/front_left_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/testudo/front_right_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/front_right_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/front_right_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/testudo/left_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/left_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/left_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,5 +5,6 @@
<animation file="biped/formations/testudo/right_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/right_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/right_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
</variant>
@@ -5,6 +5,7 @@
<animation file="biped/formations/testudo/top_walk.dae" name="Walk" id="testwalk1" speed="15"/>
<animation file="biped/formations/testudo/top_walk.dae" name="Walk" id="testwalk2" speed="16"/>
<animation file="biped/formations/testudo/top_walk.dae" name="Walk" id="testwalk3" speed="17"/>
<animation file="biped/infantry/promotion.dae" name="promotion" speed="80"/>
</animations>
<props>
<prop actor="" attachpoint="weapon_R"/>
@@ -936,7 +936,11 @@ Formation.prototype.OnGlobalEntityRenamed = function(msg)
cmpOldUnitAI.SetFormationController(INVALID_ENTITY);
if (cmpNewUnitAI)
{
cmpNewUnitAI.SetFormationController(this.entity);
if (!cmpNewUnitAI.GetOrders().length)
cmpNewUnitAI.SetNextState("FORMATIONMEMBER.IDLE");
}
// Because the renamed entity might have different characteristics,
// (e.g. packed vs. unpacked siege), we need to recompute motion parameters
@@ -248,6 +248,8 @@ UnitAI.prototype.UnitFsmSpec = {
// No orders left, we're an individual now
if (this.IsAnimal())
this.SetNextState("ANIMAL.IDLE");
else if (this.IsFormationMember())
this.SetNextState("FORMATIONMEMBER.IDLE");
else
this.SetNextState("INDIVIDUAL.IDLE");
@@ -637,7 +639,10 @@ UnitAI.prototype.UnitFsmSpec = {
},
"Order.Cheering": function(msg) {
this.SetNextState("INDIVIDUAL.CHEERING");
if (this.IsFormationMember())
this.SetNextState("FORMATIONMEMBER.CHEERING");
else
this.SetNextState("INDIVIDUAL.CHEERING");
},
"Order.Pack": function(msg) {
@@ -1301,6 +1306,8 @@ UnitAI.prototype.UnitFsmSpec = {
"IDLE": "INDIVIDUAL.IDLE",
"CHEERING": "INDIVIDUAL.CHEERING",
"WALKING": {
"enter": function() {
this.formationOffset = { "x": this.order.data.x, "z": this.order.data.z };