Hoods: moved most things from HoodAI to SZHoodAI in preperation for CogHQ Hoods
This commit is contained in:
parent
f23574e4a0
commit
74ecdbb3f9
11 changed files with 97 additions and 81 deletions
|
@ -1,11 +1,11 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.toon import NPCToons
|
||||
|
||||
class BRHoodAI(HoodAI):
|
||||
class BRHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.TheBrrrgh
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -2,13 +2,13 @@ from toontown.toonbase import ToontownGlobals
|
|||
from toontown.safezone.DistributedFishingSpotAI import DistributedFishingSpotAI
|
||||
from toontown.safezone.DistributedBoatAI import DistributedBoatAI
|
||||
from toontown.toon import NPCToons
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
|
||||
class DDHoodAI(HoodAI):
|
||||
class DDHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.DonaldsDock
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
|
||||
self.spawnObjects()
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.safezone.DistributedDGFlowerAI import DistributedDGFlowerAI
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.toon import NPCToons
|
||||
from toontown.safezone import ButterflyGlobals
|
||||
from toontown.safezone.DistributedButterflyAI import DistributedButterflyAI
|
||||
|
||||
class DGHoodAI(HoodAI):
|
||||
class DGHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.DaisyGardens
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.toon import NPCToons
|
||||
|
||||
class DLHoodAI(HoodAI):
|
||||
class DLHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.DonaldsDreamland
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -17,5 +17,5 @@ class GSHoodAI(HoodAI.HoodAI):
|
|||
self.racepads = []
|
||||
self.viewpads = []
|
||||
|
||||
def createSafeZone(self):
|
||||
def createZone(self):
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -11,5 +11,5 @@ class GZHoodAI(HoodAI):
|
|||
|
||||
self.golfKarts = []
|
||||
|
||||
def createSafeZone(self):
|
||||
def createZone(self):
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -1,57 +1,23 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.safezone.DistributedTrolleyAI import DistributedTrolleyAI
|
||||
from toontown.building.DistributedDoorAI import DistributedDoorAI
|
||||
from toontown.building.DistributedHQInteriorAI import DistributedHQInteriorAI
|
||||
from toontown.safezone import TreasureGlobals
|
||||
from toontown.town.StreetAI import StreetAI
|
||||
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
||||
|
||||
class HoodAI:
|
||||
"""
|
||||
AI-side representation of everything in a single neighborhood.
|
||||
|
||||
One subclass of this class exists for every neighborhood in the game.
|
||||
HoodAIs are responsible for spawning all TreasurePlanners, SuitPlanners,
|
||||
ponds, and other safezone objects, etc.
|
||||
One subclass of this class exists for every type neighborhood(safezone, coghq)
|
||||
in the game.
|
||||
HoodAIs are responsible for spawning all SuitPlanners, BuildingMgrs,
|
||||
and other hood objects, etc.
|
||||
"""
|
||||
|
||||
HOOD = None
|
||||
|
||||
def __init__(self, air):
|
||||
self.air = air
|
||||
|
||||
self.spawnNpcsIn = [2000]
|
||||
|
||||
self.safezone = self.HOOD
|
||||
self.streets = {}
|
||||
|
||||
self.trolley = None
|
||||
self.pond = None
|
||||
|
||||
self.createSafeZone()
|
||||
self.createStreets()
|
||||
|
||||
def createSafeZone(self):
|
||||
self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData()
|
||||
self.createTrolley()
|
||||
self.createTreasurePlanner()
|
||||
|
||||
def createStreets(self):
|
||||
branchIds = ToontownGlobals.HoodHierarchy.get(self.HOOD, [])
|
||||
for branch in branchIds:
|
||||
street = StreetAI(self.air, branch)
|
||||
self.streets[branch] = street
|
||||
|
||||
def createTrolley(self):
|
||||
self.trolley = DistributedTrolleyAI(self.air)
|
||||
self.trolley.generateWithRequired(self.safezone)
|
||||
|
||||
def createTreasurePlanner(self):
|
||||
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[self.HOOD]
|
||||
self.treasurePlanner = SZTreasurePlannerAI(self.safezone, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
|
||||
self.treasurePlanner.start()
|
||||
def createZone(self):
|
||||
#overridable by subclass
|
||||
pass
|
||||
|
||||
def spawnObjects(self):
|
||||
filename = self.air.genDNAFileName(self.safezone)
|
||||
|
||||
self.air.dnaSpawner.spawnObjects(filename, self.safezone)
|
||||
#overridable by subclass
|
||||
pass
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.toon import NPCToons
|
||||
|
||||
class MMHoodAI(HoodAI):
|
||||
class MMHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.MinniesMelodyland
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
|
||||
self.spawnObjects()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.toonbase import ToontownGlobals
|
||||
from toontown.distributed.DistributedTimerAI import DistributedTimerAI
|
||||
|
||||
class OZHoodAI(HoodAI):
|
||||
class OZHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.OutdoorZone
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createTreasurePlanner(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createTreasurePlanner(self)
|
||||
self.timer = DistributedTimerAI(self.air)
|
||||
self.timer.generateWithRequired(self.HOOD)
|
||||
|
|
57
toontown/hood/SZHoodAI.py
Normal file
57
toontown/hood/SZHoodAI.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from HoodAI import HoodAI
|
||||
from toontown.building.DistributedBuildingMgrAI import DistributedBuildingMgrAI
|
||||
from toontown.safezone.DistributedTrolleyAI import DistributedTrolleyAI
|
||||
from toontown.building.DistributedDoorAI import DistributedDoorAI
|
||||
from toontown.building.DistributedHQInteriorAI import DistributedHQInteriorAI
|
||||
from toontown.safezone import TreasureGlobals
|
||||
from toontown.town.StreetAI import StreetAI
|
||||
from toontown.safezone.SZTreasurePlannerAI import SZTreasurePlannerAI
|
||||
|
||||
class SZHoodAI(HoodAI):
|
||||
"""
|
||||
AI-side representation of everything in a single safezone neighborhood.
|
||||
|
||||
One subclass of this class exists for every neighborhood in the game.
|
||||
HoodAIs are responsible for spawning all TreasurePlanners, ponds,
|
||||
and other hood objects, etc.
|
||||
"""
|
||||
|
||||
def __init__(self, air):
|
||||
HoodAI.__init__(self, air)
|
||||
|
||||
self.safezone = self.HOOD
|
||||
self.streets = {}
|
||||
|
||||
self.trolley = None
|
||||
self.pond = None
|
||||
self.buildingMgr = None
|
||||
|
||||
self.createZone()
|
||||
self.createStreets()
|
||||
|
||||
def createZone(self):
|
||||
HoodAI.createZone(self)
|
||||
self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData()
|
||||
self.createTrolley()
|
||||
self.createTreasurePlanner()
|
||||
self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr)
|
||||
|
||||
def createStreets(self):
|
||||
branchIds = ToontownGlobals.HoodHierarchy.get(self.HOOD, [])
|
||||
for branch in branchIds:
|
||||
street = StreetAI(self.air, branch)
|
||||
self.streets[branch] = street
|
||||
|
||||
def createTrolley(self):
|
||||
self.trolley = DistributedTrolleyAI(self.air)
|
||||
self.trolley.generateWithRequired(self.safezone)
|
||||
|
||||
def createTreasurePlanner(self):
|
||||
treasureType, healAmount, spawnPoints, spawnRate, maxTreasures = TreasureGlobals.SafeZoneTreasureSpawns[self.HOOD]
|
||||
self.treasurePlanner = SZTreasurePlannerAI(self.safezone, treasureType, healAmount, spawnPoints, spawnRate, maxTreasures)
|
||||
self.treasurePlanner.start()
|
||||
|
||||
def spawnObjects(self):
|
||||
filename = self.air.genDNAFileName(self.safezone)
|
||||
self.air.dnaSpawner.spawnObjects(filename, self.safezone)
|
|
@ -1,20 +1,15 @@
|
|||
from toontown.toonbase import ToontownGlobals
|
||||
from HoodAI import HoodAI
|
||||
from SZHoodAI import SZHoodAI
|
||||
from toontown.safezone import ButterflyGlobals
|
||||
from toontown.safezone.DistributedButterflyAI import DistributedButterflyAI
|
||||
from toontown.toon import NPCToons
|
||||
from toontown.election.DistributedElectionEventAI import DistributedElectionEventAI
|
||||
from toontown.building.HQBuildingAI import HQBuildingAI
|
||||
from toontown.toon import NPCToons
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from otp.ai.MagicWordGlobal import *
|
||||
from toontown.building.DistributedBuildingMgrAI import DistributedBuildingMgrAI
|
||||
|
||||
class TTHoodAI(HoodAI):
|
||||
class TTHoodAI(SZHoodAI):
|
||||
HOOD = ToontownGlobals.ToontownCentral
|
||||
|
||||
def createSafeZone(self):
|
||||
HoodAI.createSafeZone(self)
|
||||
def createZone(self):
|
||||
SZHoodAI.createZone(self)
|
||||
self.spawnObjects()
|
||||
self.butterflies = []
|
||||
# TODO: Re-enable butterflies. RIP, you will be missed.
|
||||
|
@ -23,8 +18,6 @@ class TTHoodAI(HoodAI):
|
|||
#beginhack disable election props
|
||||
#self.spawnElection()
|
||||
#endhack
|
||||
|
||||
self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr)
|
||||
|
||||
def spawnElection(self):
|
||||
event = self.air.doFind('ElectionEvent')
|
||||
|
|
Loading…
Reference in a new issue