mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-10-31 00:37:54 +00:00
Add some more Cogdo AI that may be useful later on
This commit is contained in:
parent
d49c95731c
commit
a71ed6fc7b
4 changed files with 94 additions and 15 deletions
18
toontown/cogdominium/CogdoEntityCreatorAI.py
Normal file
18
toontown/cogdominium/CogdoEntityCreatorAI.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
from direct.showbase.PythonUtil import Functor
|
||||||
|
from otp.level import EntityCreatorAI
|
||||||
|
from toontown.cogdominium.CogdoLevelMgrAI import CogdoLevelMgrAI
|
||||||
|
from toontown.cogdominium import CogdoCraneGameConsts
|
||||||
|
|
||||||
|
class CogdoEntityCreatorAI(EntityCreatorAI.EntityCreatorAI):
|
||||||
|
|
||||||
|
def __init__(self, level):
|
||||||
|
EntityCreatorAI.EntityCreatorAI.__init__(self, level)
|
||||||
|
cDE = EntityCreatorAI.createDistributedEntity
|
||||||
|
cLE = EntityCreatorAI.createLocalEntity
|
||||||
|
nothing = EntityCreatorAI.nothing
|
||||||
|
self.privRegisterTypes({'levelMgr': Functor(cLE, CogdoLevelMgrAI),
|
||||||
|
'cogdoCraneGameSettings': Functor(cLE, self._createCogdoSettings)})
|
||||||
|
|
||||||
|
def _createCogdoSettings(self, level, entId):
|
||||||
|
CogdoCraneGameConsts.Settings.initializeEntity(level, entId)
|
||||||
|
return CogdoCraneGameConsts.Settings
|
4
toontown/cogdominium/CogdoLevelMgrAI.py
Normal file
4
toontown/cogdominium/CogdoLevelMgrAI.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
from otp.level import LevelMgrAI
|
||||||
|
|
||||||
|
class CogdoLevelMgrAI(LevelMgrAI.LevelMgrAI):
|
||||||
|
pass
|
|
@ -1,20 +1,50 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from pandac.PandaModules import *
|
||||||
from direct.distributed.DistributedObjectAI import DistributedObjectAI
|
from direct.distributed import DistributedObjectAI
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
from otp.otpbase import OTPGlobals
|
||||||
|
from direct.fsm import FSM
|
||||||
|
|
||||||
class DistCogdoCraneAI(DistributedObjectAI):
|
class DistCogdoCraneAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoCraneAI")
|
|
||||||
|
|
||||||
def setCraneGameId(self, todo0):
|
def __init__(self, air, craneGame, index):
|
||||||
|
DistributedObjectAI.DistributedObjectAI.__init__(self, air)
|
||||||
|
FSM.FSM.__init__(self, 'DistCogdoCraneAI')
|
||||||
|
self.craneGame = craneGame
|
||||||
|
self.index = index
|
||||||
|
self.avId = 0
|
||||||
|
self.objectId = 0
|
||||||
|
|
||||||
|
def getCraneGameId(self):
|
||||||
|
return self.craneGame.doId
|
||||||
|
|
||||||
|
def getIndex(self):
|
||||||
|
return self.index
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
DistributedObjectAI.DistributedObjectAI.generate(self)
|
||||||
|
self.request('Free')
|
||||||
|
|
||||||
|
def d_setState(self, state, avId):
|
||||||
|
self.sendUpdate('setState', [state, avId])
|
||||||
|
|
||||||
|
def enterOff(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def setIndex(self, todo0):
|
def exitOff(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def setState(self, todo0, todo1):
|
def enterControlled(self, avId):
|
||||||
pass
|
self.avId = avId
|
||||||
|
self.d_setState('C', avId)
|
||||||
|
|
||||||
def clearSmoothing(self, todo0):
|
def exitControlled(self):
|
||||||
pass
|
if self.objectId:
|
||||||
|
obj = self.air.doId2do[self.objectId]
|
||||||
|
obj.request('Dropped', self.avId, self.doId)
|
||||||
|
|
||||||
def setCablePos(self, todo0, todo1, todo2, todo3, todo4):
|
def enterFree(self):
|
||||||
|
self.avId = 0
|
||||||
|
self.d_setState('F', 0)
|
||||||
|
|
||||||
|
def exitFree(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,6 +1,33 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||||
from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI
|
|
||||||
from otp.level.DistributedLevelAI import DistributedLevelAI
|
from otp.level.DistributedLevelAI import DistributedLevelAI
|
||||||
|
from toontown.cogdominium.DistCogdoGameAI import DistCogdoGameAI
|
||||||
|
from toontown.cogdominium.CogdoEntityCreatorAI import CogdoEntityCreatorAI
|
||||||
|
|
||||||
class DistCogdoLevelGameAI(DistCogdoGameAI, DistributedLevelAI):
|
class DistCogdoLevelGameAI(DistributedLevelAI, DistCogdoGameAI):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("DistCogdoLevelGameAI")
|
notify = directNotify.newCategory('DistCogdoLevelGameAI')
|
||||||
|
|
||||||
|
def __init__(self, air, interior):
|
||||||
|
DistCogdoGameAI.__init__(self, air, interior)
|
||||||
|
DistributedLevelAI.__init__(self, air, self.zoneId, 0, self.getToonIds())
|
||||||
|
|
||||||
|
def createEntityCreator(self):
|
||||||
|
return CogdoEntityCreatorAI(level=self)
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
self.notify.info('loading spec')
|
||||||
|
spec = self.getLevelSpec()
|
||||||
|
if __dev__:
|
||||||
|
self.notify.info('creating entity type registry')
|
||||||
|
typeReg = self.getEntityTypeReg()
|
||||||
|
spec.setEntityTypeReg(typeReg)
|
||||||
|
DistributedLevelAI.generate(self, spec)
|
||||||
|
DistCogdoGameAI.generate(self)
|
||||||
|
self.startHandleEdits()
|
||||||
|
|
||||||
|
def requestDelete(self):
|
||||||
|
DistCogdoGameAI.requestDelete(self)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
self.stopHandleEdits()
|
||||||
|
DistCogdoGameAI.delete(self)
|
||||||
|
DistributedLevelAI.delete(self, deAllocZone=False)
|
||||||
|
|
Loading…
Reference in a new issue