added collisions to pillow and new tunnel

This commit is contained in:
Zach 2015-05-25 13:12:27 -05:00
parent b8b9891c1e
commit d5595c3a74
5 changed files with 165 additions and 4 deletions

View file

@ -249,6 +249,7 @@ from toontown.ai import WelcomeValleyManager/AI
from toontown.building import DistributedAnimatedProp/AI
from toontown.toon import DistributedToon/AI/UD
from toontown.safezone import DistributedTrolley/AI
from toontown.safezone import DistributedPillow/AI
from toontown.safezone import DistributedPartyGate/AI
from toontown.suit import DistributedSuitPlanner/AI
from toontown.suit import DistributedSuitBase/AI
@ -858,6 +859,9 @@ dclass DistributedTrolley : DistributedObject {
setMinigameZone(uint32, uint16);
};
dclass DistributedPillow : DistributedObject {
};
dclass DistributedSuitPlanner : DistributedObject {
setZoneId(uint32) required broadcast ram;
suitListQuery() airecv clsend;

View file

@ -2,7 +2,7 @@
from pandac.PandaModules import *
hashVal = 1264053989
hashVal = 4186269798L
from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot
@ -21,7 +21,7 @@ from toontown.racing.DistributedStartingBlock import DistributedViewingBlock
from toontown.suit import DistributedSuitPlanner, DistributedSuitBase, DistributedSuit, DistributedTutorialSuit, DistributedFactorySuit, DistributedMintSuit, DistributedStageSuit, DistributedSellbotBoss, DistributedCashbotBoss, DistributedCashbotBossGoon, DistributedGoon, DistributedGridGoon, DistributedLawbotBoss, DistributedLawbotBossSuit, DistributedBossbotBoss
from toontown.distributed import ToontownDistrict, ToontownDistrictStats, DistributedTimer
from toontown.effects import DistributedFireworkShow
from toontown.safezone import DistributedTrolley, DistributedPartyGate, DistributedBoat, DistributedButterfly, DistributedMMPiano, DistributedDGFlower, DistributedFishingSpot, SafeZoneManager, DistributedTreasure, DistributedGolfKart, DistributedPicnicBasket, DistributedPicnicTable, DistributedChineseCheckers, DistributedCheckers, DistributedFindFour
from toontown.safezone import DistributedTrolley, DistributedPillow, DistributedPartyGate, DistributedBoat, DistributedButterfly, DistributedMMPiano, DistributedDGFlower, DistributedFishingSpot, SafeZoneManager, DistributedTreasure, DistributedGolfKart, DistributedPicnicBasket, DistributedPicnicTable, DistributedChineseCheckers, DistributedCheckers, DistributedFindFour
from toontown.fishing import DistributedFishingPond, DistributedFishingTarget, DistributedPondBingoManager
from toontown.minigame import DistributedMinigame, DistributedMinigameTemplate, DistributedRaceGame, DistributedCannonGame, DistributedPatternGame, DistributedRingGame, DistributedTagGame, DistributedMazeGame, DistributedTugOfWarGame, DistributedCatchGame, DistributedDivingGame, DistributedTargetGame, DistributedVineGame, DistributedIceGame, DistributedCogThiefGame, DistributedTwoDGame
from toontown.racing import DistributedVehicle, DistributedStartingBlock, DistributedRace, DistributedKartPad, DistributedRacePad, DistributedViewPad, DistributedStartingBlock, DistributedLeaderBoard, DistributedGag, DistributedProjectile

View file

@ -1,5 +1,5 @@
from toontown.hood import HoodAI
from toontown.safezone import DistributedTrolleyAI
from toontown.safezone import DistributedTrolleyAI, DistributedPillowAI
from toontown.toonbase import ToontownGlobals
from toontown.ai import DistributedResistanceEmoteMgrAI
from toontown.ai import DistributedTrickOrTreatTargetAI
@ -27,7 +27,13 @@ class DLHoodAI(HoodAI.HoodAI):
self.TrickOrTreatTargetManager = DistributedTrickOrTreatTargetAI.DistributedTrickOrTreatTargetAI(self.air)
self.TrickOrTreatTargetManager.generateWithRequired(9619)
self.createPillow()
def createTrolley(self):
self.trolley = DistributedTrolleyAI.DistributedTrolleyAI(self.air)
self.trolley.generateWithRequired(self.zoneId)
self.trolley.start()
def createPillow(self):
self.pillow = DistributedPillowAI.DistributedPillowAI(self.air)
self.pillow.generateWithRequired(self.zoneId)

View file

@ -0,0 +1,115 @@
from panda3d.core import Point3, NodePath
from pandac.PandaModules import CollisionPolygon
from otp.otpbase import OTPGlobals
from direct.distributed.DistributedObject import DistributedObject
from direct.fsm import ClassicFSM, State
class DistributedPillow(DistributedObject):
points = [
Point3(-62.2896, 59.2746, -6.0),
Point3(-119.969, 59.2746, -6.0),
Point3(-67.1297, 55.2920, -1.6),
Point3(-120.063, 55.2920, -1.6),
Point3(-64.9566, 35.6930, 1.0),
Point3(-119.993, 35.6930, 1.0),
Point3(-63.4717, 0.00000, 1.6),
Point3(-119.670, 0.00000, 1.6),
Point3(-64.9566, -35.6930, 1.0),
Point3(-119.993, -35.6930, 1.0),
Point3(-67.1297, -55.2920, -1.6),
Point3(-120.063, -55.2920, -1.6),
Point3(-62.2896, -58.3746, -6.0),
Point3(-119.969, -58.3746, -6.0),
Point3(-104.100, 59.2746, -6.0),
Point3(-104.100, -58.3746, -6.0),
Point3(-104.100, 55.2920, -6.0),
Point3(-104.100, -55.2920, -6.0),
]
polygons = [[0, 1, 3, 2], [2, 3, 5, 4], [4, 5, 7, 6],
[6, 7, 9, 8], [8, 9, 11, 10], [10, 11, 13, 12]]
walls = [[0, 2], [2, 4], [4, 6], [6, 8], [8, 10], [10, 12],
[3, 1], [5, 3], [7, 5], [9, 7], [11, 9], [13, 11],
[3, 16], [17, 11], [16, 14], [15, 17]]
def __init__(self, cr):
DistributedObject.__init__(self, cr)
self.floorpolys = []
self.wallpolys = []
self.npaths = []
self.np = None
self.fsm = ClassicFSM.ClassicFSM(
'DistributedPillow',
[
State.State('off', self.enterOff, self.exitOff,
['entering']),
State.State('bounce', self.enterBounce, self.exitBounce,
['off']),
], 'off', 'off')
self.fsm.enterInitialState()
def generate(self):
DistributedObject.generate(self)
self.loader = self.cr.playGame.hood.loader
self.np = NodePath('Pillow')
self.np.reparentTo(render)
for point in DistributedPillow.polygons:
orderedPoints = []
for index in point:
orderedPoints.append(DistributedPillow.points[index])
self.floorpolys.append(CollisionPolygon(*orderedPoints))
for n, p in enumerate(self.floorpolys):
polyNode = CollisionNode("FloorPoly-%d" % n)
polyNode.addSolid(p)
polyNode.setFromCollideMask(OTPGlobals.FloorBitmask)
polyNodePath = self.np.attachNewNode(polyNode)
self.npaths.append(polyNodePath)
self.accept("enterFloorPoly-%d" % n, self.printEntry)
for wall in DistributedPillow.walls:
ab = DistributedPillow.points[wall[0]]
bb = DistributedPillow.points[wall[1]]
cb = Point3(bb.getX(), bb.getY(), bb.getZ() + 15)
db = Point3(ab.getX(), ab.getY(), ab.getZ() + 15)
self.wallpolys.append(CollisionPolygon(ab, bb, cb, db))
for n, p in enumerate(self.wallpolys):
polyNode = CollisionNode("WallPoly-%d" % n)
polyNode.addSolid(p)
polyNode.setFromCollideMask(OTPGlobals.FloorBitmask)
polyNodePath = self.np.attachNewNode(polyNode)
self.npaths.append(polyNodePath)
def disable(self):
DistributedObject.disable(self)
self.floorpolys = []
self.wallpolys = []
self.npaths = []
if self.np:
self.np.removeNode()
self.np = None
if hasattr(self, 'loader'):
del self.loader
self.ignoreAll()
self.fsm.request('off')
def delete(self):
if self.np:
self.np.removeNode()
self.np = None
self.ignoreAll()
DistributedObject.delete(self)
del self.fsm
def enterOff(self):
pass
def exitOff(self):
pass
def enterBounce(self):
pass
def exitBounce(self):
pass
def printEntry(self, entry):
print(entry)

View file

@ -0,0 +1,36 @@
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.fsm import ClassicFSM, State
class DistributedPillowAI(DistributedObjectAI):
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
self.fsm = ClassicFSM.ClassicFSM(
'DistributedPillowAI',
[
State.State('off', self.enterOff, self.exitOff,
['bounce']),
State.State('bounce', self.enterBounce, self.exitBounce,
['off']),
], 'off', 'off')
self.fsm.enterInitialState()
def generate(self):
DistributedObjectAI.generate(self)
def delete(self):
self.fsm.requestFinalState()
del self.fsm
DistributedObjectAI.delete(self)
def enterOff(self):
pass
def exitOff(self):
pass
def enterBounce(self):
pass
def exitBounce(self):
pass