mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -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:
|
||||
want-pets #t
|
||||
want-parties #t
|
||||
want-cogdominiums #f
|
||||
want-cogdominiums #t
|
||||
want-achievements #f
|
||||
|
||||
# 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.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'):
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue