def createFishingPonds(self): self.fishingPonds = [] fishingPondGroups = [] for zoneId in self.getZoneTable(): dnaData = self.air.dnaDataMap.get(zoneId, None) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId) if dnaData.getName() == 'root': area = ZoneUtil.getCanonicalZoneId(zoneId) (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds( dnaData, zoneId, area) self.fishingPonds.extend(foundFishingPonds) fishingPondGroups.extend(foundFishingPondGroups) for fishingPond in self.fishingPonds: NPCToons.createNpcsInZone(self.air, fishingPond.zoneId) fishingSpots = [] for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds): fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond)) for fishingPond in self.fishingPonds: fishingPond.bingoMgr = DistributedPondBingoManagerAI(self.air) fishingPond.bingoMgr.setPondDoId(fishingPond.doId) fishingPond.bingoMgr.generateWithRequired( fishingPond.zoneId ) # Was using self.zoneId, this only generated the bingo managers in playgrounds, causing an exception when entering street ponds
def spawn(air, zone, element, match): if zone % 1000 != 0: # This should hopefully create the Fishermen NPCs on streets. NPCToons.createNpcsInZone(air, zone) pond = DistributedFishingPondAI(air) area = ZoneUtil.getBranchZone(zone) pond.setArea(area) pond.generateWithRequired(zone) bingoMgr = DistributedPondBingoManagerAI(air) bingoMgr.setPondDoId(pond.getDoId()) bingoMgr.generateWithRequired(zone) pond.bingoMgr = bingoMgr pond.bingoMgr.createGame() simbase.air.fishManager.ponds[zone] = pond for i in range(FishingTargetGlobals.getNumTargets(area)): target = DistributedFishingTargetAI(simbase.air) target.setPondDoId(pond.getDoId()) target.generateWithRequired(zone) for child in element.children: if isinstance(child, DNAProp) and 'fishing_spot' in child.code: spot = DistributedFishingSpotAI(air) spot.setPondDoId(pond.getDoId()) x, y, z = child.getPos() h, p, r = child.getHpr() spot.setPosHpr(x, y, z, h, p, r) spot.generateWithRequired(zone)
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) NPCToons.createNpcsInZone(self.air, self.HOOD)
def createZone(self, genTrolley = True): HoodAI.startup(self) self.air.dnaStoreMap[self.HOOD] = self.air.loadDNA(self.air.genDNAFileName(self.HOOD)).generateData() if genTrolley: self.createTrolley() self.createTreasurePlanner() self.buildingMgr = DistributedBuildingMgrAI(self.air, self.HOOD, self.air.dnaStoreMap[self.HOOD], self.air.trophyMgr) NPCToons.createNpcsInZone(self.air, self.HOOD)
def createFishingPonds(self): self.fishingPonds = [] fishingPondGroups = [] for zoneId in self.getZoneTable(): dnaData = self.air.dnaDataMap.get(zoneId, None) if dnaData.getName() == 'root': area = ZoneUtil.getCanonicalZoneId(zoneId) (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area) self.fishingPonds.extend(foundFishingPonds) fishingPondGroups.extend(foundFishingPondGroups) for fishingPond in self.fishingPonds: NPCToons.createNpcsInZone(self.air, fishingPond.zoneId) fishingSpots = [] for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds): fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond))
def createFishingPonds(self): self.fishingPonds = [] fishingPondGroups = [] for zoneId in self.getZoneTable(): dnaData = self.air.dnaDataMap.get(zoneId, None) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId) if dnaData.getName() == 'root': area = ZoneUtil.getCanonicalZoneId(zoneId) (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area) self.fishingPonds.extend(foundFishingPonds) fishingPondGroups.extend(foundFishingPondGroups) for fishingPond in self.fishingPonds: NPCToons.createNpcsInZone(self.air, fishingPond.zoneId) fishingSpots = [] for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds): fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond))
def createFishingPonds(self): self.fishingPonds = [] fishingPondGroups = [] for zone in self.air.zoneTable[self.canonicalHoodId]: zoneId = ZoneUtil.getTrueZoneId(zone[0], self.zoneId) dnaData = self.air.dnaDataMap.get(zone[0], None) if isinstance(dnaData, DNAData): area = ZoneUtil.getCanonicalZoneId(zoneId) foundFishingPonds, foundFishingPondGroups = self.air.findFishingPonds(dnaData, zoneId, area) self.fishingPonds += foundFishingPonds fishingPondGroups += foundFishingPondGroups for distObj in self.fishingPonds: self.addDistObj(distObj) npcs = NPCToons.createNpcsInZone(self.air, distObj.zoneId) for npc in npcs: self.addDistObj(npc) fishingSpots = [] for dnaGroup, distPond in zip(fishingPondGroups, self.fishingPonds): fishingSpots += self.air.findFishingSpots(dnaGroup, distPond) for distObj in fishingSpots: self.addDistObj(distObj) return
def startup(self): self.createLobbyManager() self.createLobbyElevator() self.extDoor = self.makeCogHQDoor(self.lobbyZoneId, 0, 0, self.lobbyFADoorCode) if simbase.config.GetBool('want-boarding-groups', True): self.createBoardingParty() self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
def setup(self, blockNumber): # The interior self.interior = DistributedGagshopInteriorAI.DistributedGagshopInteriorAI( blockNumber, self.air, self.interiorZone) #desc = (self.interiorZone, "HQ Officer", ('dls', 'ms', 'm', 'm', 6,0,6,6,40,8), "m", 1, 0) #self.npc = NPCToons.createNPC(self.air, Quests.ToonHQ, desc, self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) self.interior.generateWithRequired(self.interiorZone) # Outside door door = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_STANDARD) # Inside door insideDoor = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.INT_STANDARD) # Tell them about each other: door.setOtherDoor(insideDoor) insideDoor.setOtherDoor(door) # Put them in the right zones door.zoneId = self.exteriorZone insideDoor.zoneId = self.interiorZone # Now that they both now about each other, generate them: door.generateWithRequired(self.exteriorZone) insideDoor.generateWithRequired(self.interiorZone) # keep track of them: self.door = door self.insideDoor = insideDoor return
def setup(self, blockNumber): # The interior self.interior = DistributedPetshopInteriorAI.DistributedPetshopInteriorAI( blockNumber, self.air, self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) seeds = self.air.petMgr.getAvailablePets(1, len(self.npcs)) #for i in range(len(self.npcs)): # self.wanderingPets = self.createPet(self.npcs[i].doId, seeds[i]) self.interior.generateWithRequired(self.interiorZone) # Outside door door = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_STANDARD) # Inside door insideDoor = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.INT_STANDARD) # Tell them about each other: door.setOtherDoor(insideDoor) insideDoor.setOtherDoor(door) # Put them in the right zones door.zoneId = self.exteriorZone insideDoor.zoneId = self.interiorZone # Now that they both now about each other, generate them: door.generateWithRequired(self.exteriorZone) insideDoor.generateWithRequired(self.interiorZone) # keep track of them: self.door = door self.insideDoor = insideDoor return
def setup(self, blockNumber): self.interior = DistributedHQInteriorAI.DistributedHQInteriorAI( blockNumber, self.air, self.interiorZone) self.interior.generateWithRequired(self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) door0 = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=0) door1 = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=1) insideDoor0 = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=0) insideDoor1 = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=1) door0.setOtherDoor(insideDoor0) insideDoor0.setOtherDoor(door0) door1.setOtherDoor(insideDoor1) insideDoor1.setOtherDoor(door1) door0.zoneId = self.exteriorZone door1.zoneId = self.exteriorZone insideDoor0.zoneId = self.interiorZone insideDoor1.zoneId = self.interiorZone door0.generateWithRequired(self.exteriorZone) door1.generateWithRequired(self.exteriorZone) door0.sendUpdate('setDoorIndex', [door0.getDoorIndex()]) door1.sendUpdate('setDoorIndex', [door1.getDoorIndex()]) insideDoor0.generateWithRequired(self.interiorZone) insideDoor1.generateWithRequired(self.interiorZone) insideDoor0.sendUpdate('setDoorIndex', [insideDoor0.getDoorIndex()]) insideDoor1.sendUpdate('setDoorIndex', [insideDoor1.getDoorIndex()]) self.door0 = door0 self.door1 = door1 self.insideDoor0 = insideDoor0 self.insideDoor1 = insideDoor1
def __init__(self, block, air, zoneId, building): """blockNumber: the landmark building number (from the name)""" #self.air=air DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.block = block self.zoneId = zoneId self.building = building assert (self.debugPrint( "DistributedToonInteriorAI(air=%s, zoneId=%s, building=%s)" % (air, zoneId, building))) # Make any npcs that may be in this interior zone # If there are none specified, this will just be an empty list self.npcs = NPCToons.createNpcsInZone(air, zoneId) # TODO #for i in range(len(self.npcs)): # npc = self.npcs[i] # npc.d_setIndex(i) self.fsm = ClassicFSM.ClassicFSM( 'DistributedToonInteriorAI', [ State.State('toon', self.enterToon, self.exitToon, ['beingTakenOver']), State.State('beingTakenOver', self.enterBeingTakenOver, self.exitBeingTakenOver, []), State.State('off', self.enterOff, self.exitOff, []), ], # Initial State 'toon', # Final State 'off', ) self.fsm.enterInitialState()
def createFishingPonds(self): # Note: A list of fishing ponds is now maintanied for easier access # when generating Pond Bingo Managers for Bingo Night. # (JJT - 07/22/04) self.fishingPonds = [] fishingPondGroups = [] for zone in self.air.zoneTable[self.canonicalHoodId]: zoneId = ZoneUtil.getTrueZoneId(zone[0], self.zoneId) dnaData = self.air.dnaDataMap.get(zone[0], None) if isinstance(dnaData, DNAData): area = ZoneUtil.getCanonicalZoneId(zoneId) foundFishingPonds, foundFishingPondGroups = self.air.findFishingPonds( dnaData, zoneId, area) self.fishingPonds += foundFishingPonds fishingPondGroups += foundFishingPondGroups for distObj in self.fishingPonds: self.addDistObj(distObj) # Every pond gets a fisherman npcs = NPCToons.createNpcsInZone(self.air, distObj.zoneId) # TODO-parties : Ask for clarification on this. # Since this creates all the NPCs in the zone, this creates the # party people for the party hat as well... but what if there are # no fishing ponds?? for npc in npcs: self.addDistObj(npc) # Now look in the fishing pond DNAGroups for fishing spots fishingSpots = [] for dnaGroup, distPond in zip(fishingPondGroups, self.fishingPonds): fishingSpots += self.air.findFishingSpots(dnaGroup, distPond) for distObj in fishingSpots: self.addDistObj(distObj)
def setup(self, blockNumber): self.kartShopInterior = DistributedKartShopInteriorAI( blockNumber, self.air, self.interiorZone) self.kartShopInterior.generateWithRequired(self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, 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()])
def __init__(self, block, air, zoneId, building): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.block = block self.zoneId = zoneId self.building = building self.npcs = NPCToons.createNpcsInZone(air, zoneId) self.fsm = ClassicFSM.ClassicFSM('DistributedToonInteriorAI', [State.State('toon', self.enterToon, self.exitToon, ['beingTakenOver']), State.State('beingTakenOver', self.enterBeingTakenOver, self.exitBeingTakenOver, []), State.State('off', self.enterOff, self.exitOff, [])], 'toon', 'off') self.fsm.enterInitialState()
def setup(self, blockNumber): # The interior self.interior = DistributedHQInteriorAI.DistributedHQInteriorAI( blockNumber, self.air, self.interiorZone) #desc = (self.interiorZone, "HQ Officer", ('dls', 'ms', 'm', 'm', 6,0,6,6,40,8), "m", 1, 0) #self.npc = NPCToons.createNPC(self.air, Quests.ToonHQ, desc, self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) self.interior.generateWithRequired(self.interiorZone) # Outside door 0. door0 = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=0) # Outside door 1. door1 = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_HQ, doorIndex=1) # Inside door 0. insideDoor0 = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=0) # Inside door 1. insideDoor1 = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.INT_HQ, doorIndex=1) # Tell them about each other: door0.setOtherDoor(insideDoor0) insideDoor0.setOtherDoor(door0) door1.setOtherDoor(insideDoor1) insideDoor1.setOtherDoor(door1) # Put them in the right zones door0.zoneId = self.exteriorZone door1.zoneId = self.exteriorZone insideDoor0.zoneId = self.interiorZone insideDoor1.zoneId = self.interiorZone # Now that they both now about each other, generate them: door0.generateWithRequired(self.exteriorZone) door1.generateWithRequired(self.exteriorZone) door0.sendUpdate("setDoorIndex", [door0.getDoorIndex()]) door1.sendUpdate("setDoorIndex", [door1.getDoorIndex()]) insideDoor0.generateWithRequired(self.interiorZone) insideDoor1.generateWithRequired(self.interiorZone) insideDoor0.sendUpdate("setDoorIndex", [insideDoor0.getDoorIndex()]) insideDoor1.sendUpdate("setDoorIndex", [insideDoor1.getDoorIndex()]) # keep track of them: self.door0 = door0 self.door1 = door1 self.insideDoor0 = insideDoor0 self.insideDoor1 = insideDoor1 return
def setup(self, blockNumber): # Create the Interior Object on the AI Side self.kartShopInterior = DistributedKartShopInteriorAI( blockNumber, self.air, self.interiorZone) # Initialize the npc clerks. self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) # Tell the DistributedKartShopInteriorAI object to generate. self.kartShopInterior.generateWithRequired(self.interiorZone) # Handle the Door Generation. # TODO - NEED TO CHANGE THE DOOR DGG.TYPE AND HANDLE IT IN DistributedDoor.py 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) # Assign inside and outside doors to one another, respectively. self.outsideDoor0.setOtherDoor(self.insideDoor0) self.outsideDoor1.setOtherDoor(self.insideDoor1) self.insideDoor0.setOtherDoor(self.outsideDoor0) self.insideDoor1.setOtherDoor(self.outsideDoor1) # Place the doors in the proper zones. self.outsideDoor0.zoneId = self.exteriorZone self.outsideDoor1.zoneId = self.exteriorZone self.insideDoor0.zoneId = self.interiorZone self.insideDoor1.zoneId = self.interiorZone # Generate the Doors 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()])
def createFishingPonds(self): self.fishingPonds = [] fishingPondGroups = [] for zoneId in self.getZoneTable(): dnaData = self.air.dnaDataMap.get(zoneId, None) zoneId = ZoneUtil.getTrueZoneId(zoneId, self.zoneId) if dnaData.getName() == 'root': area = ZoneUtil.getCanonicalZoneId(zoneId) (foundFishingPonds, foundFishingPondGroups) = self.findFishingPonds(dnaData, zoneId, area) self.fishingPonds.extend(foundFishingPonds) fishingPondGroups.extend(foundFishingPondGroups) for fishingPond in self.fishingPonds: NPCToons.createNpcsInZone(self.air, fishingPond.zoneId) fishingSpots = [] for (dnaGroup, fishingPond) in zip(fishingPondGroups, self.fishingPonds): fishingSpots.extend(self.findFishingSpots(dnaGroup, fishingPond)) for fishingPond in self.fishingPonds: fishingPond.bingoMgr = DistributedPondBingoManagerAI(self.air) fishingPond.bingoMgr.setPondDoId(fishingPond.doId) fishingPond.bingoMgr.generateWithRequired(self.zoneId)
def __init__(self, block, air, zoneId, building, npcId): """blockNumber: the landmark building number (from the name)""" #self.air=air DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.block = block self.zoneId = zoneId self.building = building self.tutorialNpcId = npcId # Make any npcs that may be in this interior zone # If there are none specified, this will just be an empty list self.npcs = NPCToons.createNpcsInZone(air, zoneId)
def __init__(self, block, air, zoneId, building): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.block = block self.zoneId = zoneId self.building = building self.npcs = NPCToons.createNpcsInZone(air, zoneId) self.fsm = ClassicFSM.ClassicFSM('DistributedToonInteriorAI', [State.State('toon', self.enterToon, self.exitToon, ['beingTakenOver']), State.State('beingTakenOver', self.enterBeingTakenOver, self.exitBeingTakenOver, []), State.State('off', self.enterOff, self.exitOff, [])], 'toon', 'off') self.fsm.enterInitialState() if config.GetBool('want-toonhall-cats', False): if self.zoneId == 2513: from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI self.blackCatMgr = DistributedBlackCatMgrAI(air) self.blackCatMgr.generateWithRequired(self.zoneId)
def setup(self, blockNumber): self.interior = DistributedGagshopInteriorAI.DistributedGagshopInteriorAI(blockNumber, self.air, self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) self.interior.generateWithRequired(self.interiorZone) door = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_STANDARD) insideDoor = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.INT_STANDARD) door.setOtherDoor(insideDoor) insideDoor.setOtherDoor(door) door.zoneId = self.exteriorZone insideDoor.zoneId = self.interiorZone door.generateWithRequired(self.exteriorZone) insideDoor.generateWithRequired(self.interiorZone) self.door = door self.insideDoor = insideDoor
def __init__(self, block, air, zoneId, building): DistributedObjectAI.DistributedObjectAI.__init__(self, air) self.block = block self.zoneId = zoneId self.building = building self.npcs = NPCToons.createNpcsInZone(air, zoneId) self.fsm = ClassicFSM.ClassicFSM('DistributedToonInteriorAI', [ State.State('toon', self.enterToon, self.exitToon, ['beingTakenOver']), State.State('beingTakenOver', self.enterBeingTakenOver, self.exitBeingTakenOver, []), State.State('off', self.enterOff, self.exitOff, []) ], 'toon', 'off') self.fsm.enterInitialState() if config.GetBool('want-toonhall-cats', False): if self.zoneId == 2513: from toontown.ai.DistributedBlackCatMgrAI import DistributedBlackCatMgrAI self.blackCatMgr = DistributedBlackCatMgrAI(air) self.blackCatMgr.generateWithRequired(self.zoneId)
def setup(self, blockNumber): self.interior = DistributedPetshopInteriorAI.DistributedPetshopInteriorAI( blockNumber, self.air, self.interiorZone) self.interior.generateWithRequired(self.interiorZone) self.npcs = NPCToons.createNpcsInZone(self.air, self.interiorZone) seeds = self.air.petMgr.getAvailablePets(1, len(self.npcs)) door = DistributedDoorAI.DistributedDoorAI(self.air, blockNumber, DoorTypes.EXT_STANDARD) insideDoor = DistributedDoorAI.DistributedDoorAI( self.air, blockNumber, DoorTypes.INT_STANDARD) door.setOtherDoor(insideDoor) insideDoor.setOtherDoor(door) door.zoneId = self.exteriorZone insideDoor.zoneId = self.interiorZone door.setDoorLock(14) door.generateWithRequired(self.exteriorZone) insideDoor.generateWithRequired(self.interiorZone) self.door = door self.insideDoor = insideDoor
def _createObjects(self, group, zone): if group.getName()[:13] == "fishing_pond_": visGroup = group.getVisGroup() pondZone = 0 if visGroup is None: pondZone = zone else: pondZone = int(visGroup.getName().split(":")[0]) pondIndex = int(group.getName()[13:]) pond = DistributedFishingPondAI(simbase.air) pond.setArea(zone) pond.generateWithRequired(pondZone) bingoManager = DistributedPondBingoManagerAI(simbase.air) bingoManager.setPondDoId(pond.getDoId()) bingoManager.generateWithRequired(pondZone) # temporary, until we have scheduled stuff bingoManager.createGame() pond.bingoMgr = bingoManager simbase.air.fishManager.ponds[zone] = pond for i in range(FishingTargetGlobals.getNumTargets(zone)): target = DistributedFishingTargetAI(simbase.air) target.setPondDoId(pond.getDoId()) target.generateWithRequired(pondZone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:13] == "fishing_spot_": posSpot = group.atAsNode(i) spot = DistributedFishingSpotAI(simbase.air) spot.setPondDoId(pond.getDoId()) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() spot.setPosHpr(x, y, z, h, p, r) spot.generateWithRequired(pondZone) NPCToons.createNpcsInZone(simbase.air, pondZone) elif group.getName()[:10] == "racing_pad": index, dest = group.getName()[11:].split("_", 2) index = int(index) pad = DistributedRacePadAI(simbase.air) pad.setArea(zone) pad.nameType = dest pad.index = index nri = RaceGlobals.getNextRaceInfo(-1, dest, index) pad.setTrackInfo([nri[0], nri[1]]) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == "starting_block": spotIndex = int(posSpot.getName()[15:]) posSpot = group.atAsNode(i) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedStartingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(index) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) elif group.getName()[:11] == "viewing_pad": pad = DistributedViewPadAI(simbase.air) pad.setArea(zone) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == "starting_block": spotIndex = int(posSpot.getName()[15:]) posSpot = group.atAsNode(i) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedViewingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(0) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) elif group.getName()[:13] == "picnic_table_" and zone != 7000: pos = group.getPos() hpr = group.getHpr() nameInfo = group.getName().split("_") picnicTable = DistributedPicnicBasketAI.DistributedPicnicBasketAI( simbase.air, nameInfo[2], pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2] ) picnicTable.generateWithRequired(zone) picnicTable.start() elif group.getName() == "prop_game_table_DNARoot" and config.GetBool("want-oz-game-tables", True): pos = group.getPos() hpr = group.getHpr() nameInfo = group.getName().split("_") tableIndex = int(group.parent.getName().split("_")[-1]) picnicTable = DistributedPicnicTableAI.DistributedPicnicTableAI( simbase.air, zone, nameInfo[2], pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2] ) picnicTable.setTableIndex(tableIndex) picnicTable.generateOtpObject( simbase.air.districtId, zone, ["setX", "setY", "setZ", "setH", "setP", "setR"] ) elif group.getName()[:9] == "golf_kart" and config.GetBool("want-golf-karts", True): info = group.getName()[10:].split("_") golfCourse = int(info[0]) kartId = info[1] for i in range(group.getNumChildren()): prop = group.at(i) if prop.getName()[:15] == "starting_block_": pos, hpr = (prop.getPos(), prop.getHpr()) kart = DistributedGolfKartAI.DistributedGolfKartAI( simbase.air, golfCourse, pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2] ) kart.generateWithRequired(zone) kart.sendUpdate("setGolfCourse", [golfCourse]) kart.sendUpdate("setPosHpr", [pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]]) color = kart.getColor() kart.sendUpdate("setColor", [color[0], color[1], color[2]]) kart.start() if group.getName()[:15] == "prop_party_gate" and simbase.air.wantParties: gate = DistributedPartyGateAI(simbase.air) gate.setArea(zone) gate.generateWithRequired(zone) for i in range(group.getNumChildren()): child = group.at(i) self._createObjects(child, zone)
def announceGenerate(self): DistributedObjectAI.DistributedObjectAI.announceGenerate(self) self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
def _createObjects(self, group, zone): if group.getName()[:13] == 'fishing_pond_': visGroup = group.getVisGroup() pondZone = 0 if visGroup is None: pondZone = zone else: pondZone = int(visGroup.getName().split(':')[0]) pondIndex = int(group.getName()[13:]) pond = DistributedFishingPondAI(simbase.air) pond.setArea(zone) pond.generateWithRequired(pondZone) #self.ponds[pondIndex] = pond bingoManager = DistributedPondBingoManagerAI(simbase.air) bingoManager.setPondDoId(pond.getDoId()) bingoManager.generateWithRequired(pondZone) #temporary, until we have scheduled stuff bingoManager.createGame() pond.bingoMgr = bingoManager simbase.air.fishManager.ponds[zone] = pond for i in range(FishingTargetGlobals.getNumTargets(zone)): target = DistributedFishingTargetAI(simbase.air) target.setPondDoId(pond.getDoId()) target.generateWithRequired(pondZone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:13] == 'fishing_spot_': spot = DistributedFishingSpotAI(simbase.air) spot.setPondDoId(pond.getDoId()) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() spot.setPosHpr(x, y, z, h, p, r) spot.generateWithRequired(pondZone) NPCToons.createNpcsInZone(simbase.air, pondZone) elif group.getName()[:10] == 'racing_pad': index, dest = group.getName()[11:].split('_', 2) index = int(index) pad = DistributedRacePadAI(simbase.air) pad.setArea(zone) pad.nameType = dest pad.index = index nri = RaceGlobals.getNextRaceInfo(-1, dest, index) pad.setTrackInfo([nri[0], nri[1]]) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == 'starting_block': spotIndex = int(posSpot.getName()[15:]) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedStartingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(index) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) elif group.getName()[:11] == 'viewing_pad': pad = DistributedViewPadAI(simbase.air) pad.setArea(zone) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == 'starting_block': spotIndex = int(posSpot.getName()[15:]) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedViewingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(0) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) if group.getName()[:15] == 'prop_party_gate': gate = DistributedPartyGateAI(simbase.air) gate.setArea(zone) gate.generateWithRequired(zone) for i in range(group.getNumChildren()): self._createObjects(group.at(i), zone)
def announceGenerate(self): DistributedObjectAI.announceGenerate(self) self.npcs = NPCToons.createNpcsInZone(self.air, self.zoneId)
def _createObjects(self, group, zone): if group.getName()[:13] == 'fishing_pond_': visGroup = group.getVisGroup() pondZone = 0 if visGroup is None: pondZone = zone else: pondZone = int(visGroup.getName().split(':')[0]) pondIndex = int(group.getName()[13:]) pond = DistributedFishingPondAI(simbase.air) pond.setArea(zone) pond.generateWithRequired(pondZone) bingoManager = DistributedPondBingoManagerAI(simbase.air) bingoManager.setPondDoId(pond.getDoId()) bingoManager.generateWithRequired(pondZone) #temporary, until we have scheduled stuff bingoManager.createGame() pond.bingoMgr = bingoManager simbase.air.fishManager.ponds[zone] = pond for i in range(FishingTargetGlobals.getNumTargets(zone)): target = DistributedFishingTargetAI(simbase.air) target.setPondDoId(pond.getDoId()) target.generateWithRequired(pondZone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:13] == 'fishing_spot_': posSpot = group.atAsNode(i) spot = DistributedFishingSpotAI(simbase.air) spot.setPondDoId(pond.getDoId()) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() spot.setPosHpr(x, y, z, h, p, r) spot.generateWithRequired(pondZone) NPCToons.createNpcsInZone(simbase.air, pondZone) elif group.getName()[:10] == 'racing_pad': index, dest = group.getName()[11:].split('_', 2) index = int(index) pad = DistributedRacePadAI(simbase.air) pad.setArea(zone) pad.nameType = dest pad.index = index nri = RaceGlobals.getNextRaceInfo(-1, dest, index) pad.setTrackInfo([nri[0], nri[1]]) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == 'starting_block': spotIndex = int(posSpot.getName()[15:]) posSpot = group.atAsNode(i) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedStartingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(index) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) elif group.getName()[:11] == 'viewing_pad': pad = DistributedViewPadAI(simbase.air) pad.setArea(zone) pad.generateWithRequired(zone) for i in range(group.getNumChildren()): posSpot = group.at(i) if posSpot.getName()[:14] == 'starting_block': spotIndex = int(posSpot.getName()[15:]) posSpot = group.atAsNode(i) x, y, z = posSpot.getPos() h, p, r = posSpot.getHpr() startingBlock = DistributedViewingBlockAI(simbase.air) startingBlock.setPosHpr(x, y, z, h, p, r) startingBlock.setPadDoId(pad.getDoId()) startingBlock.setPadLocationId(0) startingBlock.generateWithRequired(zone) pad.addStartingBlock(startingBlock) elif group.getName()[:13] == 'picnic_table_' and zone != 7000: pos = group.getPos() hpr = group.getHpr() nameInfo = group.getName().split('_') picnicTable = DistributedPicnicBasketAI.DistributedPicnicBasketAI( simbase.air, nameInfo[2], pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]) picnicTable.generateWithRequired(zone) picnicTable.start() elif group.getName() == 'prop_game_table_DNARoot' and config.GetBool( 'want-oz-game-tables', True): pos = group.getPos() hpr = group.getHpr() nameInfo = group.getName().split('_') tableIndex = int(group.parent.getName().split('_')[-1]) picnicTable = DistributedPicnicTableAI.DistributedPicnicTableAI( simbase.air, zone, nameInfo[2], pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]) picnicTable.setTableIndex(tableIndex) picnicTable.generateOtpObject( simbase.air.districtId, zone, ['setX', 'setY', 'setZ', 'setH', 'setP', 'setR']) elif group.getName()[:9] == 'golf_kart' and config.GetBool( 'want-golf-karts', False): info = group.getName()[10:].split('_') golfCourse = int(info[0]) kartId = info[1] for i in range(group.getNumChildren()): prop = group.at(i) if prop.getName()[:15] == 'starting_block_': pos, hpr = (prop.getPos(), prop.getHpr()) kart = DistributedGolfKartAI.DistributedGolfKartAI( simbase.air, golfCourse, pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]) kart.generateWithRequired(zone) kart.sendUpdate('setGolfCourse', [golfCourse]) kart.sendUpdate('setPosHpr', [pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]]) color = kart.getColor() kart.sendUpdate('setColor', [color[0], color[1], color[2]]) kart.start() if group.getName()[:15] == 'prop_party_gate': gate = DistributedPartyGateAI(simbase.air) gate.setArea(zone) gate.generateWithRequired(zone) for i in range(group.getNumChildren()): child = group.at(i) self._createObjects(child, zone)