diff --git a/config/release/dev.prc b/config/release/dev.prc index 275b7fe8..d05ae509 100644 --- a/config/release/dev.prc +++ b/config/release/dev.prc @@ -21,7 +21,7 @@ dc-file astron/dclass/united.dc # Core features: want-pets #t want-parties #t -want-cogdominiums #f +want-cogdominiums #t want-achievements #f # Chat: diff --git a/findterm.py b/findterm.py new file mode 100644 index 00000000..513f7426 --- /dev/null +++ b/findterm.py @@ -0,0 +1,19 @@ +import glob + +def processFile(f,t): + data = open(f,'rb').read() + lines = data.replace('\r\n','\n').split('\n') + lines_found = [] + for i,x in enumerate(lines): + if t in x: + lines_found.append(i+1) + + return lines_found + +term = raw_input('>') +for x in glob.glob('toontown/*/*.py'): + r = processFile(x,term) + if r: + print x,r + +raw_input('*****') \ No newline at end of file diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index 73e2969f..7b93ee34 100644 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -19,6 +19,7 @@ from otp.ai.AIBaseGlobal import * from toontown.cogdominium.CogdoLayout import CogdoLayout from toontown.cogdominium.DistributedCogdoElevatorExtAI import DistributedCogdoElevatorExtAI from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI +from toontown.cogdominium.CogdoLayout import CogdoLayout from toontown.cogdominium.SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI from toontown.hood import ZoneUtil from toontown.toonbase.ToontownGlobals import ToonHall @@ -65,6 +66,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): ], 'off', 'off') self.fsm.enterInitialState() self.track = 'c' + self.realTrack = 'c' self.difficulty = 1 self.numFloors = 0 self.savedBy = None @@ -138,18 +140,15 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): self.becameSuitTime = time.time() self.fsm.request('clearOutToonInterior') - def cogdoTakeOver(self, difficulty, buildingHeight): + def cogdoTakeOver(self, difficulty, buildingHeight, track = 's'): + print 'Building %s (%s): cogdoTakeOver' % (self.doId, self.zoneId) if not self.isToonBlock(): - return + return None + self.updateSavedBy(None) - (minFloors, maxFloors) = self._getMinMaxFloors(difficulty) - if buildingHeight is None: - numFloors = random.randint(minFloors, maxFloors) - else: - numFloors = buildingHeight + 1 - if (numFloors < minFloors) or (numFloors > maxFloors): - numFloors = random.randint(minFloors, maxFloors) - self.track = 'c' + + self.track = track + self.realTrack = track self.difficulty = difficulty self.numFloors = numFloors self.becameSuitTime = time.time() @@ -473,7 +472,10 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): return Task.done def enterBecomingCogdo(self): - self.sendUpdate('setSuitData', [ord(self.track), self.difficulty, self.numFloors]) + self.sendUpdate('setSuitData', [ + ord(self.realTrack), + self.difficulty, + self.numFloors]) self.d_setState('becomingCogdo') name = self.taskName(str(self.block) + '_becomingCogdo-timer') taskMgr.doMethodLater(SuitBuildingGlobals.TO_SUIT_BLDG_TIME, self.becomingCogdoTask, name) @@ -497,7 +499,10 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): return Task.done def enterCogdo(self): - self.sendUpdate('setSuitData', [ord(self.track), self.difficulty, self.numFloors]) + self.sendUpdate('setSuitData', [ + ord(self.realTrack), + self.difficulty, + self.numFloors]) (zoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId() self._cogdoLayout = CogdoLayout(self.numFloors) self.planner = SuitPlannerCogdoInteriorAI(self._cogdoLayout, self.difficulty, self.track, interiorZoneId) @@ -505,7 +510,6 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): (exteriorZoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId() self.elevator = DistributedCogdoElevatorExtAI(self.air, self) self.elevator.generateWithRequired(exteriorZoneId) - self.air.writeServerEvent('building-cogdo', self.doId, '%s|%s|%s' % (self.zoneId, self.block, self.numFloors)) def exitCogdo(self): del self.planner @@ -520,7 +524,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): return DistributedSuitInteriorAI.DistributedSuitInteriorAI(self.air, self.elevator) def _createCogdoInterior(self): - return DistributedCogdoInteriorAI(self.air, self.elevator) + return DistributedCogdoInteriorAI(self.air, self) def createSuitInterior(self): self.interior = self._createSuitInterior() @@ -531,8 +535,8 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): def createCogdoInterior(self): self.interior = self._createCogdoInterior() (dummy, interiorZoneId) = self.getExteriorAndInteriorZoneId() - self.interior.fsm.request('WaitForAllToonsInside') self.interior.generateWithRequired(interiorZoneId) + self.interior.b_setState('WaitForAllToonsInside') def deleteSuitInterior(self): if hasattr(self, 'interior'): diff --git a/toontown/building/DistributedElevatorInt.py b/toontown/building/DistributedElevatorInt.py index b36b686e..16a242b7 100644 --- a/toontown/building/DistributedElevatorInt.py +++ b/toontown/building/DistributedElevatorInt.py @@ -11,6 +11,8 @@ from direct.fsm import State from toontown.hood import ZoneUtil from toontown.toonbase import TTLocalizer +from toontown.cogdominium.CogdoInterior import CogdoInterior + class DistributedElevatorInt(DistributedElevator.DistributedElevator): def __init__(self, cr): @@ -22,6 +24,9 @@ class DistributedElevatorInt(DistributedElevator.DistributedElevator): self.rightDoor = self.bldg.rightDoorOut DistributedElevator.DistributedElevator.setupElevator(self) + if isinstance(base.cr.playGame.getPlace(), CogdoInterior): + self.elevatorSphereNodePath.setY(self.elevatorSphereNodePath, -3) + def forcedExit(self, avId): target_sz = base.localAvatar.defaultZone base.cr.playGame.getPlace().fsm.request('teleportOut', [{'loader': ZoneUtil.getLoaderName(target_sz), diff --git a/toontown/suit/DistributedSuitAI.py b/toontown/suit/DistributedSuitAI.py index 0c34ab73..05635e6b 100644 --- a/toontown/suit/DistributedSuitAI.py +++ b/toontown/suit/DistributedSuitAI.py @@ -363,8 +363,9 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): if not self.sp.buildingMgr.isSuitBlock(blockNumber): self.notify.debug('Suit %s taking over building %s in %s' % (self.getDoId(), blockNumber, self.zoneId)) difficulty = self.getActualLevel() - 1 + + dept = SuitDNA.getSuitDept(self.dna.name) if self.buildingDestinationIsCogdo: - self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight) + self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight, dept) else: - dept = SuitDNA.getSuitDept(self.dna.name) self.sp.suitTakeOver(blockNumber, dept, difficulty, self.buildingHeight) diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index 7e8688e9..7e33d125 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -24,7 +24,7 @@ from toontown.toonbase import ToontownGlobals class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlannerBase.SuitPlannerBase): notify = directNotify.newCategory('DistributedSuitPlannerAI') CogdoPopFactor = config.GetFloat('cogdo-pop-factor', 1.5) - CogdoRatio = min(1.0, max(0.0, config.GetFloat('cogdo-ratio', 0.5))) + CogdoRatio = min(1.0, max(0.0, config.GetFloat('cogdo-ratio', DEFAULT_COGDO_RATIO))) MAX_SUIT_TYPES = 6 POP_UPKEEP_DELAY = 10 POP_ADJUST_DELAY = 300 @@ -55,8 +55,8 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if not hasattr(self.__class__, 'CogdoPopAdjusted'): self.__class__.CogdoPopAdjusted = True for index in xrange(len(self.SuitHoodInfo)): - SuitBuildingGlobals[self.zoneId][0] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][0]) - SuitBuildingGlobals[self.zoneId][1] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][1]) + SuitBuildingGlobals.buildingMinMax[self.zoneId][0] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals.buildingMinMax[self.zoneId][0]) + SuitBuildingGlobals.buildingMinMax[self.zoneId][1] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals.buildingMinMax[self.zoneId][1]) self.hoodInfoIdx = -1 for index in xrange(len(self.SuitHoodInfo)): currHoodInfo = self.SuitHoodInfo[index] @@ -370,8 +370,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan cogdoTakeover=None, minPathLen=None, maxPathLen=None): possibles = [] backup = [] - if cogdoTakeover is None: - cogdoTakeover = False + if toonBlockTakeover is not None: suit.attemptingTakeover = 1 blockNumber = toonBlockTakeover @@ -384,6 +383,9 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if not NPCToons.isZoneProtected(intZoneId): if blockNumber in self.buildingFrontDoors: possibles.append((blockNumber, self.buildingFrontDoors[blockNumber])) + if cogdoTakeover is None: + if suit.dna.dept in ALLOWED_FO_TRACKS: + cogdoTakeover = random.random() < self.CogdoRatio elif self.buildingMgr: for blockNumber in self.buildingMgr.getSuitBlocks(): track = self.buildingMgr.getBuildingTrack(blockNumber)