election: Scale invading suits' walk speeds by suit size.

This commit is contained in:
Sam Edwards 2014-02-17 03:32:22 -07:00
parent 38e3ff250a
commit 5ce9a3df81
3 changed files with 11 additions and 1 deletions

View file

@ -34,6 +34,9 @@ class DistributedInvasionSuit(DistributedSuitBase, InvasionSuitBase, FSM):
self.healthBar.show()
self.updateHealthBar(0, 1)
self.walkSpeed = (ToontownGlobals.SuitWalkSpeed *
SuitBattleGlobals.SuitSizes[self.dna.name] / 4.0)
# Set ourselves up for a good pieing:
colNode = self.find('**/distAvatarCollNode*')
colNode.setTag('pieCode', str(ToontownGlobals.PieCodeInvasionSuit))

View file

@ -1,8 +1,10 @@
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import *
from direct.fsm.FSM import FSM
from toontown.toonbase import ToontownGlobals
from toontown.suit.DistributedSuitBaseAI import DistributedSuitBaseAI
from toontown.suit import SuitTimings
from toontown.battle import SuitBattleGlobals
import SafezoneInvasionGlobals
from InvasionSuitBase import InvasionSuitBase
from InvasionSuitBrainAI import InvasionSuitBrainAI
@ -28,6 +30,9 @@ class DistributedInvasionSuitAI(DistributedSuitBaseAI, InvasionSuitBase, FSM):
x, y, z, h = SafezoneInvasionGlobals.SuitSpawnPoints[self.spawnPointId]
self.freezeLerp(x, y)
self.walkSpeed = (ToontownGlobals.SuitWalkSpeed *
SuitBattleGlobals.SuitSizes[self.dna.name] / 4.0)
def delete(self):
DistributedSuitBaseAI.delete(self)
self.demand('Off')

View file

@ -6,6 +6,8 @@ class InvasionSuitBase:
# move the invading suits around.
def __init__(self):
self.walkSpeed = ToontownGlobals.SuitWalkSpeed
# This is a fine way to reset all values to defaults:
self.freezeLerp(0, 0)
@ -20,7 +22,7 @@ class InvasionSuitBase:
# Calculate how long it takes the suit to march along this lerp:
vectorLength = self._lerpVector.length()
self._lerpDelay = vectorLength / ToontownGlobals.SuitWalkSpeed
self._lerpDelay = vectorLength / self.walkSpeed
# Avoid divisions by zero:
self._lerpDelay = max(self._lerpDelay, 0.01)