@@ -32,13 +32,13 @@ func addChar(_id:int):
3232 theChar .connect ("playAnim" , self , "onCharPlayAnim" )
3333 chars [_id ] = theChar
3434
35- func playAnimRaw (_charID :int , _animStanding :String , _animKnockedDown :String = "" ):
35+ func playAnimRaw (_charID :int , _animStanding :String , _animKnockedDown :String = "" , _customWeapon : String = "" , _customWeaponRight : String = "" , _fists : bool = false ):
3636 queue .append ([
37- QUEUE_ANIMRAW , _charID , _animStanding , _animKnockedDown ,
37+ QUEUE_ANIMRAW , _charID , _animStanding , _animKnockedDown , _customWeapon , _customWeaponRight , _fists ,
3838 ])
3939
40- func addAttackPayload (_attackID :String , _attackerID :int , _attackerStatus :int , _defenderStatus :int ):
41- playAttack (_attackID , _attackerID , _attackerStatus , _defenderStatus )
40+ func addAttackPayload (_attackID :String , _attackerID :int , _attackerStatus :int , _defenderStatus :int , _customWeapon : String = "" ):
41+ playAttack (_attackID , _attackerID , _attackerStatus , _defenderStatus , _customWeapon )
4242 playAttackReaction (_attackID , 1 - _attackerID , _attackerStatus , _defenderStatus )
4343 addBarrierNotBusy ()
4444
@@ -51,9 +51,9 @@ func addStatusCheckPayload(_attackerStatus:int, _defenderStatus:int):
5151 ])
5252 addBarrierNotBusy ()
5353
54- func playAttack (_attackID :String , _attackerID :int , _attackerStatus :int , _defenderStatus :int ):
54+ func playAttack (_attackID :String , _attackerID :int , _attackerStatus :int , _defenderStatus :int , _customWeapon : String = "" ):
5555 queue .append ([
56- QUEUE_ATTACK , _attackID , _attackerID , _attackerStatus , _defenderStatus ,
56+ QUEUE_ATTACK , _attackID , _attackerID , _attackerStatus , _defenderStatus , _customWeapon ,
5757 ])
5858
5959func playAttackReaction (_attackID :String , _receiver :int , _attackerStatus :int , _defenderStatus :int ):
@@ -85,17 +85,40 @@ func processQueue(_dt:float):
8585 return
8686
8787 elif (theType == QUEUE_ANIMRAW ): # Support for fists/weapons would be nice
88+ var theAttackAnim :String = theEntry [2 ]
8889 var theAttackerID :int = theEntry [1 ]
90+ var theCustomWeapon :String = theEntry [4 ]
8991 var theChar :CombatAnimPlayerChar = chars [theAttackerID ]
9092 var _isKnockedDown :bool = theChar .knockedDown
91- if (! _isKnockedDown ):
92- var theAnim :String = theEntry [2 ]
93- if (! theAnim .empty ()):
94- theChar .addAnim (theAnim )
95- else :
96- var theAnim :String = theEntry [3 ]
97- if (! theAnim .empty ()):
98- theChar .addAnim (theAnim )
93+
94+ if (GlobalRegistry .combatAnims .has (theAttackAnim )):
95+ var theAttack :CombatAnimBase = GlobalRegistry .getCombatAnim (theAttackAnim )
96+ var theWeaponLeft :String = theAttack .weaponLeft
97+ var theWeaponRight :String = theAttack .weaponRight
98+ var theFists :bool = theAttack .fists
99+ if (! theCustomWeapon .empty ()):
100+ if (theAttack .weaponOverrideLeft ):
101+ theWeaponLeft = theCustomWeapon
102+ else :
103+ theWeaponRight = theCustomWeapon
104+ if (! _isKnockedDown ):
105+ theChar .addAnim (theAttack .animName , [theFists , theWeaponLeft , theWeaponRight ])
106+ else :
107+ theChar .addAnim (theAttack .animNameKnockedDown , [theFists , theWeaponLeft , theWeaponRight ])
108+ else : # Just a normal anim
109+ var theCustomWeaponRight :String = theEntry [5 ]
110+ var theFists :bool = theEntry [6 ]
111+ if (! theCustomWeapon .empty () || ! theCustomWeaponRight .empty ()):
112+ theFists = true
113+
114+ if (! _isKnockedDown ):
115+ var theAnim :String = theEntry [2 ]
116+ if (! theAnim .empty ()):
117+ theChar .addAnim (theAnim , [theFists , theCustomWeapon , theCustomWeaponRight ])
118+ else :
119+ var theAnim :String = theEntry [3 ]
120+ if (! theAnim .empty ()):
121+ theChar .addAnim (theAnim , [theFists , theCustomWeapon , theCustomWeaponRight ])
99122
100123 elif (theType == QUEUE_STATUSCHECK ):
101124 var theAttackerID :int = theEntry [1 ]
@@ -110,21 +133,35 @@ func processQueue(_dt:float):
110133 theChar .knockedDown = _shouldBeKnockedDown
111134
112135 elif (theType == QUEUE_ATTACK ):
113- var theAttack :CombatAnimBase = GlobalRegistry .getCombatAnim (theEntry [1 ])
136+ var theAttackID :String = theEntry [1 ]
137+ if (theAttackID .empty ()):
138+ queue .pop_front ()
139+ return
140+ var theAttack :CombatAnimBase = GlobalRegistry .getCombatAnim (theAttackID )
114141 if (! theAttack ):
115142 queue .pop_front ()
116143 return
117144 var theAttackerID :int = theEntry [2 ]
118145 var _theAttackerStatus :int = theEntry [3 ]
146+ var theCustomWeapon :String = theEntry [5 ]
119147 var theChar :CombatAnimPlayerChar = chars [theAttackerID ]
120148
121149 var _shouldBeKnockedDown :bool = _theAttackerStatus & ST_KNOCKEDDOWN
122150 var _isKnockedDown :bool = theChar .knockedDown
123151
152+ var theWeaponLeft :String = theAttack .weaponLeft
153+ var theWeaponRight :String = theAttack .weaponRight
154+ var theFists :bool = theAttack .fists
155+ if (! theCustomWeapon .empty ()):
156+ if (theAttack .weaponOverrideLeft ):
157+ theWeaponLeft = theCustomWeapon
158+ else :
159+ theWeaponRight = theCustomWeapon
160+
124161 if (! _isKnockedDown ):
125- theChar .addAnim (theAttack .animName , [theAttack . fists , theAttack . weaponLeft , theAttack . weaponRight ])
162+ theChar .addAnim (theAttack .animName , [theFists , theWeaponLeft , theWeaponRight ])
126163 else :
127- theChar .addAnim (theAttack .animNameKnockedDown , [theAttack . fists , theAttack . weaponLeft , theAttack . weaponRight ])
164+ theChar .addAnim (theAttack .animNameKnockedDown , [theFists , theWeaponLeft , theWeaponRight ])
128165
129166 if (_isKnockedDown && ! _shouldBeKnockedDown ):
130167 theChar .addAnim ("KnockedDownToStanding" )
@@ -134,7 +171,11 @@ func processQueue(_dt:float):
134171 theChar .knockedDown = _shouldBeKnockedDown
135172
136173 elif (theType == QUEUE_ATTACKREACTION ):
137- var theAttack :CombatAnimBase = GlobalRegistry .getCombatAnim (theEntry [1 ])
174+ var theAttackID :String = theEntry [1 ]
175+ if (theAttackID .empty ()):
176+ queue .pop_front ()
177+ return
178+ var theAttack :CombatAnimBase = GlobalRegistry .getCombatAnim (theAttackID )
138179 if (! theAttack ):
139180 queue .pop_front ()
140181 return
@@ -152,12 +193,12 @@ func processQueue(_dt:float):
152193 var theHitDelay :float = theAttack .hitDelay if ! _shouldAttackerBeKnockedDown else theAttack .hitDelayKnockedDown
153194
154195 if (_theReceiverStatus & ST_DODGING ):
155- # Don't need any delay here
196+ theChar . addWait ( theHitDelay - 0.2 )
156197 if (! _isKnockedDown ):
157198 theChar .addAnim ("Dodge" )
158199 elif (_theReceiverStatus & ST_BLOCKING ):
159200 # Somehow guess the delay?
160- theChar .addWait (theHitDelay - 0.3 )
201+ theChar .addWait (theHitDelay - 0.4 )
161202 if (! _isKnockedDown ):
162203 theChar .addAnim ("Block" , [true ])
163204 else :
@@ -171,7 +212,12 @@ func processQueue(_dt:float):
171212 theChar .addAnim ("KnockedDownGetHit" )
172213 # ADD MORE HIT REACTIONS HERE IF YOU NEED THEM
173214
174- if (_isKnockedDown && ! _shouldBeKnockedDown ):
215+ if (_theReceiverStatus & ST_DEFEATED ):
216+ if (_isKnockedDown ):
217+ theChar .addAnim ("KnockedDownDefeat" )
218+ else :
219+ theChar .addAnim ("Defeat" )
220+ elif (_isKnockedDown && ! _shouldBeKnockedDown ):
175221 theChar .addAnim ("KnockedDownToStanding" )
176222 if (! _isKnockedDown && _shouldBeKnockedDown ):
177223 theChar .addAnim ("StandingToKnockedDown" )
0 commit comments