mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 04:02:40 -06:00
Began work on Cogdos.
This commit is contained in:
parent
4a787248e9
commit
bced66317b
6 changed files with 54 additions and 23 deletions
|
@ -21,7 +21,7 @@ dc-file astron/dclass/united.dc
|
||||||
# Core features:
|
# Core features:
|
||||||
want-pets #t
|
want-pets #t
|
||||||
want-parties #t
|
want-parties #t
|
||||||
want-cogdominiums #f
|
want-cogdominiums #t
|
||||||
want-achievements #f
|
want-achievements #f
|
||||||
|
|
||||||
# Chat:
|
# Chat:
|
||||||
|
|
19
findterm.py
Normal file
19
findterm.py
Normal file
|
@ -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('*****')
|
|
@ -19,6 +19,7 @@ from otp.ai.AIBaseGlobal import *
|
||||||
from toontown.cogdominium.CogdoLayout import CogdoLayout
|
from toontown.cogdominium.CogdoLayout import CogdoLayout
|
||||||
from toontown.cogdominium.DistributedCogdoElevatorExtAI import DistributedCogdoElevatorExtAI
|
from toontown.cogdominium.DistributedCogdoElevatorExtAI import DistributedCogdoElevatorExtAI
|
||||||
from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI
|
from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI
|
||||||
|
from toontown.cogdominium.CogdoLayout import CogdoLayout
|
||||||
from toontown.cogdominium.SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI
|
from toontown.cogdominium.SuitPlannerCogdoInteriorAI import SuitPlannerCogdoInteriorAI
|
||||||
from toontown.hood import ZoneUtil
|
from toontown.hood import ZoneUtil
|
||||||
from toontown.toonbase.ToontownGlobals import ToonHall
|
from toontown.toonbase.ToontownGlobals import ToonHall
|
||||||
|
@ -65,6 +66,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
], 'off', 'off')
|
], 'off', 'off')
|
||||||
self.fsm.enterInitialState()
|
self.fsm.enterInitialState()
|
||||||
self.track = 'c'
|
self.track = 'c'
|
||||||
|
self.realTrack = 'c'
|
||||||
self.difficulty = 1
|
self.difficulty = 1
|
||||||
self.numFloors = 0
|
self.numFloors = 0
|
||||||
self.savedBy = None
|
self.savedBy = None
|
||||||
|
@ -138,18 +140,15 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
self.becameSuitTime = time.time()
|
self.becameSuitTime = time.time()
|
||||||
self.fsm.request('clearOutToonInterior')
|
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():
|
if not self.isToonBlock():
|
||||||
return
|
return None
|
||||||
|
|
||||||
self.updateSavedBy(None)
|
self.updateSavedBy(None)
|
||||||
(minFloors, maxFloors) = self._getMinMaxFloors(difficulty)
|
|
||||||
if buildingHeight is None:
|
self.track = track
|
||||||
numFloors = random.randint(minFloors, maxFloors)
|
self.realTrack = track
|
||||||
else:
|
|
||||||
numFloors = buildingHeight + 1
|
|
||||||
if (numFloors < minFloors) or (numFloors > maxFloors):
|
|
||||||
numFloors = random.randint(minFloors, maxFloors)
|
|
||||||
self.track = 'c'
|
|
||||||
self.difficulty = difficulty
|
self.difficulty = difficulty
|
||||||
self.numFloors = numFloors
|
self.numFloors = numFloors
|
||||||
self.becameSuitTime = time.time()
|
self.becameSuitTime = time.time()
|
||||||
|
@ -473,7 +472,10 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
return Task.done
|
return Task.done
|
||||||
|
|
||||||
def enterBecomingCogdo(self):
|
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')
|
self.d_setState('becomingCogdo')
|
||||||
name = self.taskName(str(self.block) + '_becomingCogdo-timer')
|
name = self.taskName(str(self.block) + '_becomingCogdo-timer')
|
||||||
taskMgr.doMethodLater(SuitBuildingGlobals.TO_SUIT_BLDG_TIME, self.becomingCogdoTask, name)
|
taskMgr.doMethodLater(SuitBuildingGlobals.TO_SUIT_BLDG_TIME, self.becomingCogdoTask, name)
|
||||||
|
@ -497,7 +499,10 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
return Task.done
|
return Task.done
|
||||||
|
|
||||||
def enterCogdo(self):
|
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()
|
(zoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId()
|
||||||
self._cogdoLayout = CogdoLayout(self.numFloors)
|
self._cogdoLayout = CogdoLayout(self.numFloors)
|
||||||
self.planner = SuitPlannerCogdoInteriorAI(self._cogdoLayout, self.difficulty, self.track, interiorZoneId)
|
self.planner = SuitPlannerCogdoInteriorAI(self._cogdoLayout, self.difficulty, self.track, interiorZoneId)
|
||||||
|
@ -505,7 +510,6 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
(exteriorZoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId()
|
(exteriorZoneId, interiorZoneId) = self.getExteriorAndInteriorZoneId()
|
||||||
self.elevator = DistributedCogdoElevatorExtAI(self.air, self)
|
self.elevator = DistributedCogdoElevatorExtAI(self.air, self)
|
||||||
self.elevator.generateWithRequired(exteriorZoneId)
|
self.elevator.generateWithRequired(exteriorZoneId)
|
||||||
self.air.writeServerEvent('building-cogdo', self.doId, '%s|%s|%s' % (self.zoneId, self.block, self.numFloors))
|
|
||||||
|
|
||||||
def exitCogdo(self):
|
def exitCogdo(self):
|
||||||
del self.planner
|
del self.planner
|
||||||
|
@ -520,7 +524,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
return DistributedSuitInteriorAI.DistributedSuitInteriorAI(self.air, self.elevator)
|
return DistributedSuitInteriorAI.DistributedSuitInteriorAI(self.air, self.elevator)
|
||||||
|
|
||||||
def _createCogdoInterior(self):
|
def _createCogdoInterior(self):
|
||||||
return DistributedCogdoInteriorAI(self.air, self.elevator)
|
return DistributedCogdoInteriorAI(self.air, self)
|
||||||
|
|
||||||
def createSuitInterior(self):
|
def createSuitInterior(self):
|
||||||
self.interior = self._createSuitInterior()
|
self.interior = self._createSuitInterior()
|
||||||
|
@ -531,8 +535,8 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
def createCogdoInterior(self):
|
def createCogdoInterior(self):
|
||||||
self.interior = self._createCogdoInterior()
|
self.interior = self._createCogdoInterior()
|
||||||
(dummy, interiorZoneId) = self.getExteriorAndInteriorZoneId()
|
(dummy, interiorZoneId) = self.getExteriorAndInteriorZoneId()
|
||||||
self.interior.fsm.request('WaitForAllToonsInside')
|
|
||||||
self.interior.generateWithRequired(interiorZoneId)
|
self.interior.generateWithRequired(interiorZoneId)
|
||||||
|
self.interior.b_setState('WaitForAllToonsInside')
|
||||||
|
|
||||||
def deleteSuitInterior(self):
|
def deleteSuitInterior(self):
|
||||||
if hasattr(self, 'interior'):
|
if hasattr(self, 'interior'):
|
||||||
|
|
|
@ -11,6 +11,8 @@ from direct.fsm import State
|
||||||
from toontown.hood import ZoneUtil
|
from toontown.hood import ZoneUtil
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
|
|
||||||
|
from toontown.cogdominium.CogdoInterior import CogdoInterior
|
||||||
|
|
||||||
class DistributedElevatorInt(DistributedElevator.DistributedElevator):
|
class DistributedElevatorInt(DistributedElevator.DistributedElevator):
|
||||||
|
|
||||||
def __init__(self, cr):
|
def __init__(self, cr):
|
||||||
|
@ -22,6 +24,9 @@ class DistributedElevatorInt(DistributedElevator.DistributedElevator):
|
||||||
self.rightDoor = self.bldg.rightDoorOut
|
self.rightDoor = self.bldg.rightDoorOut
|
||||||
DistributedElevator.DistributedElevator.setupElevator(self)
|
DistributedElevator.DistributedElevator.setupElevator(self)
|
||||||
|
|
||||||
|
if isinstance(base.cr.playGame.getPlace(), CogdoInterior):
|
||||||
|
self.elevatorSphereNodePath.setY(self.elevatorSphereNodePath, -3)
|
||||||
|
|
||||||
def forcedExit(self, avId):
|
def forcedExit(self, avId):
|
||||||
target_sz = base.localAvatar.defaultZone
|
target_sz = base.localAvatar.defaultZone
|
||||||
base.cr.playGame.getPlace().fsm.request('teleportOut', [{'loader': ZoneUtil.getLoaderName(target_sz),
|
base.cr.playGame.getPlace().fsm.request('teleportOut', [{'loader': ZoneUtil.getLoaderName(target_sz),
|
||||||
|
|
|
@ -363,8 +363,9 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI):
|
||||||
if not self.sp.buildingMgr.isSuitBlock(blockNumber):
|
if not self.sp.buildingMgr.isSuitBlock(blockNumber):
|
||||||
self.notify.debug('Suit %s taking over building %s in %s' % (self.getDoId(), blockNumber, self.zoneId))
|
self.notify.debug('Suit %s taking over building %s in %s' % (self.getDoId(), blockNumber, self.zoneId))
|
||||||
difficulty = self.getActualLevel() - 1
|
difficulty = self.getActualLevel() - 1
|
||||||
if self.buildingDestinationIsCogdo:
|
|
||||||
self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight)
|
|
||||||
else:
|
|
||||||
dept = SuitDNA.getSuitDept(self.dna.name)
|
dept = SuitDNA.getSuitDept(self.dna.name)
|
||||||
|
if self.buildingDestinationIsCogdo:
|
||||||
|
self.sp.cogdoTakeOver(blockNumber, difficulty, self.buildingHeight, dept)
|
||||||
|
else:
|
||||||
self.sp.suitTakeOver(blockNumber, dept, difficulty, self.buildingHeight)
|
self.sp.suitTakeOver(blockNumber, dept, difficulty, self.buildingHeight)
|
||||||
|
|
|
@ -24,7 +24,7 @@ from toontown.toonbase import ToontownGlobals
|
||||||
class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlannerBase.SuitPlannerBase):
|
class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlannerBase.SuitPlannerBase):
|
||||||
notify = directNotify.newCategory('DistributedSuitPlannerAI')
|
notify = directNotify.newCategory('DistributedSuitPlannerAI')
|
||||||
CogdoPopFactor = config.GetFloat('cogdo-pop-factor', 1.5)
|
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
|
MAX_SUIT_TYPES = 6
|
||||||
POP_UPKEEP_DELAY = 10
|
POP_UPKEEP_DELAY = 10
|
||||||
POP_ADJUST_DELAY = 300
|
POP_ADJUST_DELAY = 300
|
||||||
|
@ -55,8 +55,8 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
|
||||||
if not hasattr(self.__class__, 'CogdoPopAdjusted'):
|
if not hasattr(self.__class__, 'CogdoPopAdjusted'):
|
||||||
self.__class__.CogdoPopAdjusted = True
|
self.__class__.CogdoPopAdjusted = True
|
||||||
for index in xrange(len(self.SuitHoodInfo)):
|
for index in xrange(len(self.SuitHoodInfo)):
|
||||||
SuitBuildingGlobals[self.zoneId][0] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][0])
|
SuitBuildingGlobals.buildingMinMax[self.zoneId][0] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals.buildingMinMax[self.zoneId][0])
|
||||||
SuitBuildingGlobals[self.zoneId][1] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals[self.zoneId][1])
|
SuitBuildingGlobals.buildingMinMax[self.zoneId][1] = int(0.5 + self.CogdoPopFactor * SuitBuildingGlobals.buildingMinMax[self.zoneId][1])
|
||||||
self.hoodInfoIdx = -1
|
self.hoodInfoIdx = -1
|
||||||
for index in xrange(len(self.SuitHoodInfo)):
|
for index in xrange(len(self.SuitHoodInfo)):
|
||||||
currHoodInfo = self.SuitHoodInfo[index]
|
currHoodInfo = self.SuitHoodInfo[index]
|
||||||
|
@ -370,8 +370,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
|
||||||
cogdoTakeover=None, minPathLen=None, maxPathLen=None):
|
cogdoTakeover=None, minPathLen=None, maxPathLen=None):
|
||||||
possibles = []
|
possibles = []
|
||||||
backup = []
|
backup = []
|
||||||
if cogdoTakeover is None:
|
|
||||||
cogdoTakeover = False
|
|
||||||
if toonBlockTakeover is not None:
|
if toonBlockTakeover is not None:
|
||||||
suit.attemptingTakeover = 1
|
suit.attemptingTakeover = 1
|
||||||
blockNumber = toonBlockTakeover
|
blockNumber = toonBlockTakeover
|
||||||
|
@ -384,6 +383,9 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
|
||||||
if not NPCToons.isZoneProtected(intZoneId):
|
if not NPCToons.isZoneProtected(intZoneId):
|
||||||
if blockNumber in self.buildingFrontDoors:
|
if blockNumber in self.buildingFrontDoors:
|
||||||
possibles.append((blockNumber, self.buildingFrontDoors[blockNumber]))
|
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:
|
elif self.buildingMgr:
|
||||||
for blockNumber in self.buildingMgr.getSuitBlocks():
|
for blockNumber in self.buildingMgr.getSuitBlocks():
|
||||||
track = self.buildingMgr.getBuildingTrack(blockNumber)
|
track = self.buildingMgr.getBuildingTrack(blockNumber)
|
||||||
|
|
Loading…
Reference in a new issue