Animated props AI

This commit is contained in:
DenialMC 2015-04-10 11:59:34 +03:00
parent 4cfa6e89e7
commit 8d8c131bad
2 changed files with 22 additions and 10 deletions

View file

@ -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,

View file

@ -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()