2022-12-16 18:40:57 -06:00
|
|
|
from panda3d.core import *
|
2019-11-02 17:27:54 -05:00
|
|
|
from direct.interval.IntervalGlobal import *
|
2019-12-30 00:07:56 -06:00
|
|
|
from . import DistributedCCharBase
|
|
|
|
from . import DistributedDonald
|
2019-11-02 17:27:54 -05:00
|
|
|
from direct.directnotify import DirectNotifyGlobal
|
|
|
|
from direct.fsm import ClassicFSM, State
|
|
|
|
from direct.fsm import State
|
2019-12-30 00:07:56 -06:00
|
|
|
from . import CharStateDatas
|
|
|
|
from . import CCharChatter
|
2019-11-02 17:27:54 -05:00
|
|
|
from toontown.toonbase import ToontownGlobals
|
|
|
|
from toontown.toonbase import TTLocalizer
|
|
|
|
from toontown.hood import GSHood
|
|
|
|
|
|
|
|
class DistributedFrankenDonald(DistributedDonald.DistributedDonald):
|
|
|
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFrankenDonald')
|
|
|
|
|
|
|
|
def __init__(self, cr):
|
|
|
|
try:
|
|
|
|
self.DistributedFrankenDonald_initialized
|
|
|
|
except:
|
|
|
|
self.DistributedFrankenDonald_initialized = 1
|
|
|
|
DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.FrankenDonald, 'fd')
|
|
|
|
self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off')
|
|
|
|
self.fsm.enterInitialState()
|
|
|
|
self.nametag.setName(TTLocalizer.Donald)
|
|
|
|
self.handleHolidays()
|
|
|
|
|
|
|
|
def disable(self):
|
|
|
|
self.fsm.requestFinalState()
|
|
|
|
DistributedCCharBase.DistributedCCharBase.disable(self)
|
|
|
|
del self.neutralDoneEvent
|
|
|
|
del self.neutral
|
|
|
|
del self.walkDoneEvent
|
|
|
|
del self.walk
|
|
|
|
self.fsm.requestFinalState()
|
|
|
|
|
|
|
|
def generate(self):
|
|
|
|
DistributedCCharBase.DistributedCCharBase.generate(self, self.diffPath)
|
|
|
|
name = self.getName()
|
|
|
|
self.neutralDoneEvent = self.taskName(name + '-neutral-done')
|
|
|
|
self.neutral = CharStateDatas.CharNeutralState(self.neutralDoneEvent, self)
|
|
|
|
self.walkDoneEvent = self.taskName(name + '-walk-done')
|
|
|
|
if self.diffPath == None:
|
|
|
|
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self)
|
|
|
|
else:
|
|
|
|
self.walk = CharStateDatas.CharWalkState(self.walkDoneEvent, self, self.diffPath)
|
|
|
|
self.fsm.request('Neutral')
|
|
|
|
return
|
|
|
|
|
|
|
|
def enterNeutral(self):
|
|
|
|
self.notify.debug('Neutral ' + self.getName() + '...')
|
|
|
|
self.neutral.enter()
|
|
|
|
self.acceptOnce(self.neutralDoneEvent, self.__decideNextState)
|
|
|
|
|
|
|
|
def enterWalk(self):
|
|
|
|
self.notify.debug('Walking ' + self.getName() + '...')
|
|
|
|
self.walk.enter()
|
|
|
|
self.acceptOnce(self.walkDoneEvent, self.__decideNextState)
|
|
|
|
|
|
|
|
def __decideNextState(self, doneStatus):
|
|
|
|
self.fsm.request('Neutral')
|
|
|
|
|
|
|
|
def walkSpeed(self):
|
|
|
|
return ToontownGlobals.FrankenDonaldSpeed
|