From 8d8c131bad528c421c9404c1f7bc68db2f598f95 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Fri, 10 Apr 2015 11:59:34 +0300 Subject: [PATCH] Animated props AI --- toontown/suit/DistributedSuitPlannerAI.py | 6 ++++-- toontown/suit/SuitPlannerBase.py | 26 ++++++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index 7648da69..b9a4f980 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -851,11 +851,13 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if toon: if hasattr(toon, 'doId'): toon.b_setBattleId(toonId) + pos = self.battlePosDict[canonicalZoneId] - # TODO interactivePropTrackBonus = -1 - # TODO + + if simbase.config.GetBool('props-buff-battles', True) and canonicalZoneId in self.cellToGagBonusDict: + interactivePropTrackBonus = self.cellToGagBonusDict[canonicalZoneId] self.battleMgr.newBattle( zoneId, zoneId, pos, suit, toonId, self.__battleFinished, diff --git a/toontown/suit/SuitPlannerBase.py b/toontown/suit/SuitPlannerBase.py index e1f64506..762ac16a 100644 --- a/toontown/suit/SuitPlannerBase.py +++ b/toontown/suit/SuitPlannerBase.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * from direct.directnotify.DirectNotifyGlobal import * -from toontown.hood import ZoneUtil -from toontown.toonbase import ToontownGlobals +from toontown.hood import ZoneUtil, HoodUtil +from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals from toontown.building import SuitBuildingGlobals -from toontown.dna.DNAParser import DNASuitPoint, DNAStorage, loadDNAFileAI +from toontown.dna.DNAParser import DNASuitPoint, DNAInteractiveProp, DNAStorage, loadDNAFileAI class SuitPlannerBase: notify = directNotify.newCategory('SuitPlannerBase') @@ -539,14 +539,24 @@ class SuitPlannerBase: self.notify.info('zone %s has %s disconnected suit paths.' % (self.zoneId, numGraphs)) self.battlePosDict = {} self.cellToGagBonusDict = {} + for i in xrange(self.dnaStore.getNumDNAVisGroupsAI()): vg = self.dnaStore.getDNAVisGroupAI(i) zoneId = int(self.extractGroupName(vg.getName())) - if vg.getNumBattleCells() == 1: - self.battlePosDict[zoneId] = vg.getBattleCell(0).getPos() - elif vg.getNumBattleCells() > 1: - self.notify.warning('multiple battle cells for zone: %d' % zoneId) - self.battlePosDict[zoneId] = vg.getBattleCell(0).getPos() + + if vg.getNumBattleCells() >= 1: + battleCell = vg.getBattleCell(0) + self.battlePosDict[zoneId] = battleCell.getPos() + + for i in xrange(vg.getNumChildren()): + childDnaGroup = vg.at(i) + + if isinstance(childDnaGroup, DNAInteractiveProp) and not zoneId in self.cellToGagBonusDict: + propType = HoodUtil.calcPropType(childDnaGroup.getName()) + + if propType in ToontownBattleGlobals.PropTypeToTrackBonus: + self.cellToGagBonusDict[zoneId] = ToontownBattleGlobals.PropTypeToTrackBonus[propType] + self.dnaStore.resetDNAGroups() self.dnaStore.resetDNAVisGroups() self.dnaStore.resetDNAVisGroupsAI()