mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2025-01-09 17:53:50 +00:00
Some AI cleanup
This commit is contained in:
parent
ad7c327752
commit
3c853dbc00
6 changed files with 24 additions and 22 deletions
|
@ -1,26 +1,24 @@
|
||||||
from toontown.coghq import CogDisguiseGlobals
|
from toontown.coghq import CogDisguiseGlobals
|
||||||
|
from toontown.suit import SuitDNA
|
||||||
suitTrackIndex = {
|
|
||||||
's' : 3,
|
|
||||||
'm' : 2,
|
|
||||||
'l' : 1,
|
|
||||||
'c' : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
class CogSuitManagerAI:
|
class CogSuitManagerAI:
|
||||||
def __init__(self, air):
|
|
||||||
self.air = air
|
|
||||||
|
|
||||||
def recoverPart(self, toon, factoryType, suitTrack, zoneId, toons):
|
def recoverPart(self, toon, factoryType, suitTrack):
|
||||||
|
if suitTrack not in SuitDNA.suitDepts:
|
||||||
|
return
|
||||||
|
|
||||||
recoveredParts = [0, 0, 0, 0]
|
recoveredParts = [0, 0, 0, 0]
|
||||||
parts = toon.getCogParts()
|
parts = toon.getCogParts()
|
||||||
suitTrack = suitTrackIndex[suitTrack]
|
suitTrack = SuitDNA.suitDepts.index(suitTrack)
|
||||||
|
|
||||||
if CogDisguiseGlobals.isSuitComplete(parts, suitTrack):
|
if CogDisguiseGlobals.isSuitComplete(parts, suitTrack):
|
||||||
return recoveredParts
|
return recoveredParts
|
||||||
|
|
||||||
recoveredParts[suitTrack] = toon.giveGenericCogPart(factoryType, suitTrack)
|
recoveredParts[suitTrack] = toon.giveGenericCogPart(factoryType, suitTrack)
|
||||||
return recoveredParts
|
return recoveredParts
|
||||||
|
|
||||||
def removeParts(self, toon, suitDept):
|
def removeParts(self, toon, suitDept):
|
||||||
parts = toon.getCogParts()
|
parts = toon.getCogParts()
|
||||||
|
|
||||||
if CogDisguiseGlobals.isSuitComplete(parts, suitDept):
|
if CogDisguiseGlobals.isSuitComplete(parts, suitDept):
|
||||||
toon.loseCogParts(suitDept)
|
toon.loseCogParts(suitDept)
|
|
@ -1,20 +1,24 @@
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.distributed import DistributedObject
|
from direct.distributed.DistributedObject import DistributedObject
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
class DistributedBlackCatMgr(DistributedObject.DistributedObject):
|
|
||||||
|
class DistributedBlackCatMgr(DistributedObject):
|
||||||
neverDisable = 1
|
neverDisable = 1
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBlackCatMgr')
|
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBlackCatMgr')
|
||||||
|
|
||||||
def announceGenerate(self):
|
def announceGenerate(self):
|
||||||
DistributedObject.DistributedObject.announceGenerate(self)
|
DistributedObject.announceGenerate(self)
|
||||||
base.cr.blackCatMgr = self
|
base.cr.blackCatMgr = self
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
base.cr.blackCatMgr = None
|
base.cr.blackCatMgr = None
|
||||||
DistributedObject.DistributedObject.delete(self)
|
DistributedObject.delete(self)
|
||||||
|
|
||||||
def requestBlackCatTransformation(self):
|
def requestBlackCatTransformation(self):
|
||||||
|
if not base.cr.newsManager.isHolidayRunning(ToontownGlobals.BLACK_CAT_DAY):
|
||||||
|
return
|
||||||
|
|
||||||
self.sendUpdate('requestBlackCatTransformation')
|
self.sendUpdate('requestBlackCatTransformation')
|
||||||
|
|
||||||
def doBlackCatTransformation(self):
|
def doBlackCatTransformation(self):
|
||||||
getDustCloudIval(base.localAvatar, color=base.localAvatar.style.getBlackColor()).start()
|
base.localAvatar.getDustCloud(0.0, color=base.localAvatar.style.getBlackColor()).start()
|
|
@ -20,4 +20,4 @@ class DistributedBlackCatMgrAI(DistributedObjectAI):
|
||||||
newDNA.makeFromNetString(av.getDNAString())
|
newDNA.makeFromNetString(av.getDNAString())
|
||||||
newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
|
newDNA.updateToonProperties(armColor=26, legColor=26, headColor=26)
|
||||||
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
taskMgr.doMethodLater(1.0, lambda task: av.b_setDNAString(newDNA.makeNetString()), 'transform-%d' % avId)
|
||||||
self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])
|
self.sendUpdateToAvatarId(avId, 'doBlackCatTransformation', [])
|
|
@ -7,4 +7,4 @@ def isValidCategoryName(value):
|
||||||
return value in categories
|
return value in categories
|
||||||
|
|
||||||
def getCategory(value):
|
def getCategory(value):
|
||||||
return categories[value]
|
return categories[value]
|
|
@ -116,7 +116,7 @@ class ToontownAIRepository(ToontownInternalRepository):
|
||||||
self.reportMgr.generateWithRequired(2)
|
self.reportMgr.generateWithRequired(2)
|
||||||
self.trophyMgr = DistributedTrophyMgrAI(self)
|
self.trophyMgr = DistributedTrophyMgrAI(self)
|
||||||
self.trophyMgr.generateWithRequired(2)
|
self.trophyMgr.generateWithRequired(2)
|
||||||
self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI(self)
|
self.cogSuitMgr = CogSuitManagerAI.CogSuitManagerAI()
|
||||||
self.promotionMgr = PromotionManagerAI.PromotionManagerAI(self)
|
self.promotionMgr = PromotionManagerAI.PromotionManagerAI(self)
|
||||||
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
|
self.cogPageManager = CogPageManagerAI.CogPageManagerAI()
|
||||||
self.holidayManager = HolidayManagerAI(self)
|
self.holidayManager = HolidayManagerAI(self)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattle
|
||||||
else:
|
else:
|
||||||
self.notify.debug('toon %d not helpful, skipping merits' % toon.doId)
|
self.notify.debug('toon %d not helpful, skipping merits' % toon.doId)
|
||||||
if self.bossBattle:
|
if self.bossBattle:
|
||||||
self.toonParts[toon.doId] = self.air.cogSuitMgr.recoverPart(toon, self.level.factoryType, self.suitTrack, self.getTaskZoneId(), toons)
|
self.toonParts[toon.doId] = self.air.cogSuitMgr.recoverPart(toon, self.level.factoryType, self.suitTrack)
|
||||||
self.notify.debug('toonParts = %s' % self.toonParts)
|
self.notify.debug('toonParts = %s' % self.toonParts)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue