dna/racing/building: spawn GSW objects again

This commit is contained in:
Aidan Noll 2014-04-28 03:27:24 -04:00
parent 13967d5256
commit e856d19fbe
6 changed files with 121 additions and 17 deletions

View file

@ -6,7 +6,7 @@ import DistributedBuildingAI
import HQBuildingAI
import GagshopBuildingAI
#import PetshopBuildingAI
#from toontown.building.KartShopBuildingAI import KartShopBuildingAI
from toontown.building.KartShopBuildingAI import KartShopBuildingAI
#from toontown.building import DistributedAnimBuildingAI
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import ZoneUtil
@ -223,7 +223,6 @@ class DistributedBuildingMgrAI:
return building
def newKartShopBuilding(self, blockNumber):
return
dnaStore = self.air.dnaStoreMap[self.canonicalBranchID]
exteriorZoneId = dnaStore.getBlock(blockNumber).zone
exteriorZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.branchID)

View file

@ -4,10 +4,10 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedKartShopInteriorAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedKartShopInteriorAI")
def __init__(self, air):
def __init__(self, blockNumber, air, interiorZone):
DistributedObjectAI.__init__(self, air)
self.zone = None
self.block = None
self.zone = interiorZone
self.block = blockNumber
def setZoneIdAndBlock(self, zone, block):
self.zone = zone

View file

@ -0,0 +1,60 @@
from direct.directnotify import DirectNotifyGlobal
from pandac.PandaModules import *
from toontown.building import FADoorCodes, DoorTypes
from toontown.building.DistributedDoorAI import DistributedDoorAI
from toontown.building.DistributedKartShopInteriorAI import DistributedKartShopInteriorAI
from toontown.hood import ZoneUtil
from toontown.toon import NPCToons
from toontown.toonbase import ToontownGlobals
if __debug__:
import pdb
class KartShopBuildingAI:
notify = DirectNotifyGlobal.directNotify.newCategory('KartShopBuildingAI')
def __init__(self, air, exteriorZone, interiorZone, blockNumber):
self.air = air
self.exteriorZone = exteriorZone
self.interiorZone = interiorZone
self.setup(blockNumber)
def cleanup(self):
for npc in self.npcs:
npc.requestDelete()
del self.npcs
self.outsideDoor0.requestDelete()
self.outsideDoor1.requestDelete()
self.insideDoor0.requestDelete()
self.insideDoor1.requestDelete()
del self.outsideDoor0
del self.insideDoor0
del self.outsideDoor1
del self.insideDoor1
self.kartShopInterior.requestDelete()
del self.kartShopInterior
def setup(self, blockNumber):
self.kartShopInterior = DistributedKartShopInteriorAI(blockNumber, self.air, self.interiorZone)
self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone)
self.kartShopInterior.generateWithRequired(self.interiorZone)
self.outsideDoor0 = DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=1)
self.outsideDoor1 = DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_KS, doorIndex=2)
self.insideDoor0 = DistributedDoorAI(self.air, blockNumber, DoorTypes.INT_KS, doorIndex=1)
self.insideDoor1 = DistributedDoorAI(self.air, blockNumber, DoorTypes.INT_KS, doorIndex=2)
self.outsideDoor0.setOtherDoor(self.insideDoor0)
self.outsideDoor1.setOtherDoor(self.insideDoor1)
self.insideDoor0.setOtherDoor(self.outsideDoor0)
self.insideDoor1.setOtherDoor(self.outsideDoor1)
self.outsideDoor0.zoneId = self.exteriorZone
self.outsideDoor1.zoneId = self.exteriorZone
self.insideDoor0.zoneId = self.interiorZone
self.insideDoor1.zoneId = self.interiorZone
self.outsideDoor0.generateWithRequired(self.exteriorZone)
self.outsideDoor1.generateWithRequired(self.exteriorZone)
self.insideDoor0.generateWithRequired(self.interiorZone)
self.insideDoor1.generateWithRequired(self.interiorZone)
self.outsideDoor0.sendUpdate('setDoorIndex', [self.outsideDoor0.getDoorIndex()])
self.outsideDoor1.sendUpdate('setDoorIndex', [self.outsideDoor1.getDoorIndex()])
self.insideDoor0.sendUpdate('setDoorIndex', [self.insideDoor0.getDoorIndex()])
self.insideDoor1.sendUpdate('setDoorIndex', [self.insideDoor1.getDoorIndex()])

View file

@ -1,21 +1,20 @@
from toontown.hood import HoodAI
from toontown.racing.DistributedRacePadAI import DistributedRacePadAI
from toontown.racing.DistributedViewPadAI import DistributedViewPadAI
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI, DistributedViewingBlockAI
from toontown.building.DistributedDoorAI import DistributedDoorAI
from toontown.building.DistributedKartShopInteriorAI import DistributedKartShopInteriorAI
from toontown.toon import NPCToons
from toontown.building import DoorTypes
from toontown.racing import RaceGlobals
from otp.ai.MagicWordGlobal import *
from toontown.building.DistributedBuildingMgrAI import DistributedBuildingMgrAI
class GSHoodAI(HoodAI.HoodAI):
HOOD = 8000
def __init__(self, air):
HoodAI.HoodAI.__init__(self, air)
self.racepads = []
self.viewpads = []
self.createZone()
self.spawnObjects()
def createZone(self):
self.spawnObjects()
HoodAI.HoodAI.createZone(self)
self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData()
self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr)
def spawnObjects(self):
HoodAI.HoodAI.spawnObjects(self)
filename = self.air.genDNAFileName(self.HOOD)
self.air.dnaSpawner.spawnObjects(filename, self.HOOD)

View file

@ -6,6 +6,10 @@ from direct.fsm.FSM import FSM
from direct.distributed.ClockDelta import *
from direct.task import *
from toontown.racing.KartShopGlobals import KartGlobals
from toontown.dna.DNASpawnerAI import *
from toontown.dna.DNANode import DNANode
from toontown.dna.DNAProp import DNAProp
from toontown.racing.DistributedStartingBlockAI import DistributedStartingBlockAI
#TODO - change race type
@ -170,3 +174,26 @@ class DistributedRacePadAI(DistributedKartPadAI, FSM):
self.setTrackInfo(trackInfo)
self.d_setTrackInfo(trackInfo)
@dnaSpawn(DNANode, 'racing_pad_([0-9]+)_(.*)')
def spawn(air, zone, element, match):
index = int(match.group(1))
dest = match.group(2)
pad = DistributedRacePadAI(air)
pad.setArea(zone)
pad.nameType = dest
pad.index = index
nri = RaceGlobals.getNextRaceInfo(-1, dest, index)
pad.setTrackInfo(nri[:2])
pad.generateWithRequired(zone)
for child in element.children:
if isinstance(child, DNAProp) and child.code == 'gs_parkingspot':
index = int(child.name[15:])
x, y, z = child.getPos()
h, p, r = child.getHpr()
startingBlock = DistributedStartingBlockAI(air)
startingBlock.setPosHpr(x, y, z, h, p, r)
startingBlock.setPadDoId(pad.getDoId())
startingBlock.setPadLocationId(index)
startingBlock.generateWithRequired(zone)
pad.addStartingBlock(startingBlock)

View file

@ -1,6 +1,10 @@
from direct.directnotify import DirectNotifyGlobal
from toontown.racing.DistributedKartPadAI import DistributedKartPadAI
from toontown.racing.DistributedStartingBlockAI import DistributedViewingBlockAI
from direct.distributed.ClockDelta import *
from toontown.dna.DNASpawnerAI import *
from toontown.dna.DNANode import DNANode
from toontown.dna.DNAProp import DNAProp
class DistributedViewPadAI(DistributedKartPadAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedViewPadAI")
@ -25,3 +29,18 @@ class DistributedViewPadAI(DistributedKartPadAI):
def updateTimer(self):
self.b_setLastEntered(globalClockDelta.getRealNetworkTime())
@dnaSpawn(DNANode, 'viewing_pad')
def spawn(air, zone, element, match):
pad = DistributedViewPadAI(air)
pad.setArea(zone)
pad.generateWithRequired(zone)
for child in element.children:
if isinstance(child, DNAProp) and child.code == 'gs_showblock':
x, y, z = child.getPos()
h, p, r = child.getHpr()
startingBlock = DistributedViewingBlockAI(air)
startingBlock.setPosHpr(x, y, z, h, p, r)
startingBlock.setPadDoId(pad.getDoId())
startingBlock.setPadLocationId(0)
startingBlock.generateWithRequired(zone)
pad.addStartingBlock(startingBlock)