general: Remove the rest of PandaModules imports.
This commit is contained in:
parent
d40ac6840b
commit
0072059a41
6 changed files with 36 additions and 34 deletions
|
@ -1,4 +1,4 @@
|
||||||
from pandac import PandaModules as PM
|
from panda3d.core import *
|
||||||
from otp.ai.AIBaseGlobal import *
|
from otp.ai.AIBaseGlobal import *
|
||||||
from direct.distributed.ClockDelta import *
|
from direct.distributed.ClockDelta import *
|
||||||
from direct.distributed import DistributedObjectAI
|
from direct.distributed import DistributedObjectAI
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from pandac import PandaModules as PM
|
from panda3d.core import *
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.showbase.PythonUtil import list2dict, uniqueElements
|
from direct.showbase.PythonUtil import list2dict, uniqueElements
|
||||||
import string
|
import string
|
||||||
|
@ -409,7 +409,7 @@ class LevelSpec:
|
||||||
return
|
return
|
||||||
|
|
||||||
def stringHash(self):
|
def stringHash(self):
|
||||||
h = PM.HashVal()
|
h = HashVal()
|
||||||
h.hashString(repr(self))
|
h.hashString(repr(self))
|
||||||
return h.asHex()
|
return h.asHex()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from pandac.PandaModules import *
|
from panda3d.core import *
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from . import DistributedDoorAI
|
from . import DistributedDoorAI
|
||||||
from . import DistributedTutorialInteriorAI
|
from . import DistributedTutorialInteriorAI
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from pandac import PandaModules as PM
|
from panda3d.core import *
|
||||||
from direct.distributed.ClockDelta import globalClockDelta
|
from direct.distributed.ClockDelta import globalClockDelta
|
||||||
from direct.distributed.DistributedObject import DistributedObject
|
from direct.distributed.DistributedObject import DistributedObject
|
||||||
from direct.interval import IntervalGlobal as IG
|
from direct.interval import IntervalGlobal as IG
|
||||||
|
@ -24,10 +24,10 @@ class DistCogdoCraneCog(Suit, DistributedObject):
|
||||||
|
|
||||||
def _startMoveIval(self, entranceId, startT):
|
def _startMoveIval(self, entranceId, startT):
|
||||||
self._stopMoveIval()
|
self._stopMoveIval()
|
||||||
unitVecs = (PM.Vec3(1, 0, 0),
|
unitVecs = (Vec3(1, 0, 0),
|
||||||
PM.Vec3(0, 1, 0),
|
Vec3(0, 1, 0),
|
||||||
PM.Vec3(-1, 0, 0),
|
Vec3(-1, 0, 0),
|
||||||
PM.Vec3(0, -1, 0))
|
Vec3(0, -1, 0))
|
||||||
machineDistance = 4
|
machineDistance = 4
|
||||||
entranceDistance = 60
|
entranceDistance = 60
|
||||||
startPos = unitVecs[entranceId] * entranceDistance
|
startPos = unitVecs[entranceId] * entranceDistance
|
||||||
|
@ -41,7 +41,7 @@ class DistCogdoCraneCog(Suit, DistributedObject):
|
||||||
self._moveIval.start(globalClock.getFrameTime() - startT)
|
self._moveIval.start(globalClock.getFrameTime() - startT)
|
||||||
|
|
||||||
def _getFlyAwayDest(self):
|
def _getFlyAwayDest(self):
|
||||||
return self.getPos() + PM.Vec3(0, 0, GameConsts.CogSettings.CogFlyAwayHeight.get())
|
return self.getPos() + Vec3(0, 0, GameConsts.CogSettings.CogFlyAwayHeight.get())
|
||||||
|
|
||||||
def _stopMoveIval(self):
|
def _stopMoveIval(self):
|
||||||
if self._moveIval:
|
if self._moveIval:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac import PandaModules as PM
|
from panda3d.core import *
|
||||||
|
from panda3d.physics import *
|
||||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||||
from direct.task.Task import Task
|
from direct.task.Task import Task
|
||||||
from otp.level import LevelConstants
|
from otp.level import LevelConstants
|
||||||
|
@ -46,15 +47,15 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
||||||
self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
|
self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
|
||||||
self.cableTex = self.craneArm.findTexture('MagnetControl')
|
self.cableTex = self.craneArm.findTexture('MagnetControl')
|
||||||
self.moneyBag = loader.loadModel('phase_10/models/cashbotHQ/MoneyBag')
|
self.moneyBag = loader.loadModel('phase_10/models/cashbotHQ/MoneyBag')
|
||||||
self.geomRoot = PM.NodePath('geom')
|
self.geomRoot = NodePath('geom')
|
||||||
self.sceneRoot = self.geomRoot.attachNewNode('sceneRoot')
|
self.sceneRoot = self.geomRoot.attachNewNode('sceneRoot')
|
||||||
self.sceneRoot.setPos(35.84, -115.46, 6.46)
|
self.sceneRoot.setPos(35.84, -115.46, 6.46)
|
||||||
self.physicsMgr = PM.PhysicsManager()
|
self.physicsMgr = PhysicsManager()
|
||||||
integrator = PM.LinearEulerIntegrator()
|
integrator = LinearEulerIntegrator()
|
||||||
self.physicsMgr.attachLinearIntegrator(integrator)
|
self.physicsMgr.attachLinearIntegrator(integrator)
|
||||||
fn = PM.ForceNode('gravity')
|
fn = ForceNode('gravity')
|
||||||
self.fnp = self.geomRoot.attachNewNode(fn)
|
self.fnp = self.geomRoot.attachNewNode(fn)
|
||||||
gravity = PM.LinearVectorForce(0, 0, GameConsts.Settings.Gravity.get())
|
gravity = LinearVectorForce(0, 0, GameConsts.Settings.Gravity.get())
|
||||||
fn.addForce(gravity)
|
fn.addForce(gravity)
|
||||||
self.physicsMgr.addLinearForce(gravity)
|
self.physicsMgr.addLinearForce(gravity)
|
||||||
self._gravityForce = gravity
|
self._gravityForce = gravity
|
||||||
|
@ -72,7 +73,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
||||||
self.endVault.findAllMatches('**/Safes').detach()
|
self.endVault.findAllMatches('**/Safes').detach()
|
||||||
self.endVault.findAllMatches('**/MagnetControlsAll').detach()
|
self.endVault.findAllMatches('**/MagnetControlsAll').detach()
|
||||||
cn = self.endVault.find('**/wallsCollision').node()
|
cn = self.endVault.find('**/wallsCollision').node()
|
||||||
cn.setIntoCollideMask(OTPGlobals.WallBitmask | ToontownGlobals.PieBitmask | PM.BitMask32.lowerOn(3) << 21)
|
cn.setIntoCollideMask(OTPGlobals.WallBitmask | ToontownGlobals.PieBitmask | BitMask32.lowerOn(3) << 21)
|
||||||
walls = self.endVault.find('**/RollUpFrameCillison')
|
walls = self.endVault.find('**/RollUpFrameCillison')
|
||||||
walls.detachNode()
|
walls.detachNode()
|
||||||
self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
|
self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
|
||||||
|
@ -83,29 +84,29 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
||||||
self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
|
self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
|
||||||
self.evFloor.reparentTo(self.endVault)
|
self.evFloor.reparentTo(self.endVault)
|
||||||
self.evFloor.setName('floor')
|
self.evFloor.setName('floor')
|
||||||
plane = PM.CollisionPlane(PM.Plane(PM.Vec3(0, 0, 1), PM.Point3(0, 0, -50)))
|
plane = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, -50)))
|
||||||
planeNode = PM.CollisionNode('dropPlane')
|
planeNode = CollisionNode('dropPlane')
|
||||||
planeNode.addSolid(plane)
|
planeNode.addSolid(plane)
|
||||||
planeNode.setCollideMask(ToontownGlobals.PieBitmask)
|
planeNode.setCollideMask(ToontownGlobals.PieBitmask)
|
||||||
self.geomRoot.attachNewNode(planeNode)
|
self.geomRoot.attachNewNode(planeNode)
|
||||||
|
|
||||||
def replaceCollisionPolysWithPlanes(self, model):
|
def replaceCollisionPolysWithPlanes(self, model):
|
||||||
newCollisionNode = PM.CollisionNode('collisions')
|
newCollisionNode = CollisionNode('collisions')
|
||||||
newCollideMask = PM.BitMask32(0)
|
newCollideMask = BitMask32(0)
|
||||||
planes = []
|
planes = []
|
||||||
collList = model.findAllMatches('**/+CollisionNode')
|
collList = model.findAllMatches('**/+CollisionNode')
|
||||||
if not collList:
|
if not collList:
|
||||||
collList = [model]
|
collList = [model]
|
||||||
for cnp in collList:
|
for cnp in collList:
|
||||||
cn = cnp.node()
|
cn = cnp.node()
|
||||||
if not isinstance(cn, PM.CollisionNode):
|
if not isinstance(cn, CollisionNode):
|
||||||
self.notify.warning('Not a collision node: %s' % repr(cnp))
|
self.notify.warning('Not a collision node: %s' % repr(cnp))
|
||||||
break
|
break
|
||||||
newCollideMask = newCollideMask | cn.getIntoCollideMask()
|
newCollideMask = newCollideMask | cn.getIntoCollideMask()
|
||||||
for i in range(cn.getNumSolids()):
|
for i in range(cn.getNumSolids()):
|
||||||
solid = cn.getSolid(i)
|
solid = cn.getSolid(i)
|
||||||
if isinstance(solid, PM.CollisionPolygon):
|
if isinstance(solid, CollisionPolygon):
|
||||||
plane = PM.Plane(solid.getPlane())
|
plane = Plane(solid.getPlane())
|
||||||
planes.append(plane)
|
planes.append(plane)
|
||||||
else:
|
else:
|
||||||
self.notify.warning('Unexpected collision solid: %s' % repr(solid))
|
self.notify.warning('Unexpected collision solid: %s' % repr(solid))
|
||||||
|
@ -117,11 +118,11 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
||||||
lastPlane = None
|
lastPlane = None
|
||||||
for plane in planes:
|
for plane in planes:
|
||||||
if lastPlane == None or plane.compareTo(lastPlane, threshold) != 0:
|
if lastPlane == None or plane.compareTo(lastPlane, threshold) != 0:
|
||||||
cp = PM.CollisionPlane(plane)
|
cp = CollisionPlane(plane)
|
||||||
newCollisionNode.addSolid(cp)
|
newCollisionNode.addSolid(cp)
|
||||||
lastPlane = plane
|
lastPlane = plane
|
||||||
|
|
||||||
return PM.NodePath(newCollisionNode)
|
return NodePath(newCollisionNode)
|
||||||
|
|
||||||
def exitLoaded(self):
|
def exitLoaded(self):
|
||||||
self.fnp.removeNode()
|
self.fnp.removeNode()
|
||||||
|
@ -190,7 +191,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
||||||
def _handleGravityChanged(self, gravity):
|
def _handleGravityChanged(self, gravity):
|
||||||
self.physicsMgr.removeLinearForce(self._gravityForce)
|
self.physicsMgr.removeLinearForce(self._gravityForce)
|
||||||
self._gravityForceNode.removeForce(self._gravityForce)
|
self._gravityForceNode.removeForce(self._gravityForce)
|
||||||
self._gravityForce = PM.LinearVectorForce(0, 0, gravity)
|
self._gravityForce = LinearVectorForce(0, 0, gravity)
|
||||||
self.physicsMgr.addLinearForce(self._gravityForce)
|
self.physicsMgr.addLinearForce(self._gravityForce)
|
||||||
self._gravityForceNode.addForce(self._gravityForce)
|
self._gravityForceNode.addForce(self._gravityForce)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pandac import PandaModules as PM
|
from panda3d.core import *
|
||||||
|
from panda3d.physics import *
|
||||||
from direct.directnotify.DirectNotifyGlobal import directNotify
|
from direct.directnotify.DirectNotifyGlobal import directNotify
|
||||||
from toontown.cogdominium.DistCogdoLevelGameAI import DistCogdoLevelGameAI
|
from toontown.cogdominium.DistCogdoLevelGameAI import DistCogdoLevelGameAI
|
||||||
from toontown.cogdominium.DistCogdoCraneAI import DistCogdoCraneAI
|
from toontown.cogdominium.DistCogdoCraneAI import DistCogdoCraneAI
|
||||||
|
@ -10,11 +11,11 @@ from toontown.cogdominium.DistCogdoCraneCogAI import DistCogdoCraneCogAI
|
||||||
from toontown.suit.SuitDNA import SuitDNA
|
from toontown.suit.SuitDNA import SuitDNA
|
||||||
import random
|
import random
|
||||||
|
|
||||||
class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath):
|
class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, NodePath):
|
||||||
notify = directNotify.newCategory('DistCogdoCraneGameAI')
|
notify = directNotify.newCategory('DistCogdoCraneGameAI')
|
||||||
|
|
||||||
def __init__(self, air, interior):
|
def __init__(self, air, interior):
|
||||||
PM.NodePath.__init__(self, uniqueName('CraneGameAI'))
|
NodePath.__init__(self, uniqueName('CraneGameAI'))
|
||||||
DistCogdoLevelGameAI.__init__(self, air, interior)
|
DistCogdoLevelGameAI.__init__(self, air, interior)
|
||||||
self._cranes = [
|
self._cranes = [
|
||||||
None] * CogdoGameConsts.MaxPlayers
|
None] * CogdoGameConsts.MaxPlayers
|
||||||
|
@ -27,11 +28,11 @@ class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath
|
||||||
|
|
||||||
def enterLoaded(self):
|
def enterLoaded(self):
|
||||||
DistCogdoLevelGameAI.enterLoaded(self)
|
DistCogdoLevelGameAI.enterLoaded(self)
|
||||||
self.scene = PM.NodePath('scene')
|
self.scene = NodePath('scene')
|
||||||
cn = PM.CollisionNode('walls')
|
cn = CollisionNode('walls')
|
||||||
cs = PM.CollisionSphere(0, 0, 0, 13)
|
cs = CollisionSphere(0, 0, 0, 13)
|
||||||
cn.addSolid(cs)
|
cn.addSolid(cs)
|
||||||
cs = PM.CollisionInvSphere(0, 0, 0, 42)
|
cs = CollisionInvSphere(0, 0, 0, 42)
|
||||||
cn.addSolid(cs)
|
cn.addSolid(cs)
|
||||||
self.attachNewNode(cn)
|
self.attachNewNode(cn)
|
||||||
for i in range(CogdoGameConsts.MaxPlayers):
|
for i in range(CogdoGameConsts.MaxPlayers):
|
||||||
|
|
Loading…
Reference in a new issue