general: Remove the rest of PandaModules imports.

This commit is contained in:
Little Cat 2022-12-29 02:09:26 -04:00
parent d40ac6840b
commit 0072059a41
No known key found for this signature in database
GPG key ID: 96455BD9C4399BE8
6 changed files with 36 additions and 34 deletions

View file

@ -1,4 +1,4 @@
from pandac import PandaModules as PM
from panda3d.core import *
from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import *
from direct.distributed import DistributedObjectAI

View file

@ -1,4 +1,4 @@
from pandac import PandaModules as PM
from panda3d.core import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase.PythonUtil import list2dict, uniqueElements
import string
@ -409,7 +409,7 @@ class LevelSpec:
return
def stringHash(self):
h = PM.HashVal()
h = HashVal()
h.hashString(repr(self))
return h.asHex()

View file

@ -1,4 +1,4 @@
from pandac.PandaModules import *
from panda3d.core import *
from direct.directnotify import DirectNotifyGlobal
from . import DistributedDoorAI
from . import DistributedTutorialInteriorAI

View file

@ -1,4 +1,4 @@
from pandac import PandaModules as PM
from panda3d.core import *
from direct.distributed.ClockDelta import globalClockDelta
from direct.distributed.DistributedObject import DistributedObject
from direct.interval import IntervalGlobal as IG
@ -24,10 +24,10 @@ class DistCogdoCraneCog(Suit, DistributedObject):
def _startMoveIval(self, entranceId, startT):
self._stopMoveIval()
unitVecs = (PM.Vec3(1, 0, 0),
PM.Vec3(0, 1, 0),
PM.Vec3(-1, 0, 0),
PM.Vec3(0, -1, 0))
unitVecs = (Vec3(1, 0, 0),
Vec3(0, 1, 0),
Vec3(-1, 0, 0),
Vec3(0, -1, 0))
machineDistance = 4
entranceDistance = 60
startPos = unitVecs[entranceId] * entranceDistance
@ -41,7 +41,7 @@ class DistCogdoCraneCog(Suit, DistributedObject):
self._moveIval.start(globalClock.getFrameTime() - startT)
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):
if self._moveIval:

View file

@ -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.task.Task import Task
from otp.level import LevelConstants
@ -46,15 +47,15 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
self.stick = loader.loadModel('phase_10/models/cogHQ/CBCraneStick.bam')
self.cableTex = self.craneArm.findTexture('MagnetControl')
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.setPos(35.84, -115.46, 6.46)
self.physicsMgr = PM.PhysicsManager()
integrator = PM.LinearEulerIntegrator()
self.physicsMgr = PhysicsManager()
integrator = LinearEulerIntegrator()
self.physicsMgr.attachLinearIntegrator(integrator)
fn = PM.ForceNode('gravity')
fn = ForceNode('gravity')
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)
self.physicsMgr.addLinearForce(gravity)
self._gravityForce = gravity
@ -72,7 +73,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
self.endVault.findAllMatches('**/Safes').detach()
self.endVault.findAllMatches('**/MagnetControlsAll').detach()
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.detachNode()
self.evWalls = self.replaceCollisionPolysWithPlanes(walls)
@ -83,29 +84,29 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
self.evFloor = self.replaceCollisionPolysWithPlanes(floor)
self.evFloor.reparentTo(self.endVault)
self.evFloor.setName('floor')
plane = PM.CollisionPlane(PM.Plane(PM.Vec3(0, 0, 1), PM.Point3(0, 0, -50)))
planeNode = PM.CollisionNode('dropPlane')
plane = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, -50)))
planeNode = CollisionNode('dropPlane')
planeNode.addSolid(plane)
planeNode.setCollideMask(ToontownGlobals.PieBitmask)
self.geomRoot.attachNewNode(planeNode)
def replaceCollisionPolysWithPlanes(self, model):
newCollisionNode = PM.CollisionNode('collisions')
newCollideMask = PM.BitMask32(0)
newCollisionNode = CollisionNode('collisions')
newCollideMask = BitMask32(0)
planes = []
collList = model.findAllMatches('**/+CollisionNode')
if not collList:
collList = [model]
for cnp in collList:
cn = cnp.node()
if not isinstance(cn, PM.CollisionNode):
if not isinstance(cn, CollisionNode):
self.notify.warning('Not a collision node: %s' % repr(cnp))
break
newCollideMask = newCollideMask | cn.getIntoCollideMask()
for i in range(cn.getNumSolids()):
solid = cn.getSolid(i)
if isinstance(solid, PM.CollisionPolygon):
plane = PM.Plane(solid.getPlane())
if isinstance(solid, CollisionPolygon):
plane = Plane(solid.getPlane())
planes.append(plane)
else:
self.notify.warning('Unexpected collision solid: %s' % repr(solid))
@ -117,11 +118,11 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
lastPlane = None
for plane in planes:
if lastPlane == None or plane.compareTo(lastPlane, threshold) != 0:
cp = PM.CollisionPlane(plane)
cp = CollisionPlane(plane)
newCollisionNode.addSolid(cp)
lastPlane = plane
return PM.NodePath(newCollisionNode)
return NodePath(newCollisionNode)
def exitLoaded(self):
self.fnp.removeNode()
@ -190,7 +191,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
def _handleGravityChanged(self, gravity):
self.physicsMgr.removeLinearForce(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._gravityForceNode.addForce(self._gravityForce)

View file

@ -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 toontown.cogdominium.DistCogdoLevelGameAI import DistCogdoLevelGameAI
from toontown.cogdominium.DistCogdoCraneAI import DistCogdoCraneAI
@ -10,11 +11,11 @@ from toontown.cogdominium.DistCogdoCraneCogAI import DistCogdoCraneCogAI
from toontown.suit.SuitDNA import SuitDNA
import random
class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath):
class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, NodePath):
notify = directNotify.newCategory('DistCogdoCraneGameAI')
def __init__(self, air, interior):
PM.NodePath.__init__(self, uniqueName('CraneGameAI'))
NodePath.__init__(self, uniqueName('CraneGameAI'))
DistCogdoLevelGameAI.__init__(self, air, interior)
self._cranes = [
None] * CogdoGameConsts.MaxPlayers
@ -27,11 +28,11 @@ class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath
def enterLoaded(self):
DistCogdoLevelGameAI.enterLoaded(self)
self.scene = PM.NodePath('scene')
cn = PM.CollisionNode('walls')
cs = PM.CollisionSphere(0, 0, 0, 13)
self.scene = NodePath('scene')
cn = CollisionNode('walls')
cs = CollisionSphere(0, 0, 0, 13)
cn.addSolid(cs)
cs = PM.CollisionInvSphere(0, 0, 0, 42)
cs = CollisionInvSphere(0, 0, 0, 42)
cn.addSolid(cs)
self.attachNewNode(cn)
for i in range(CogdoGameConsts.MaxPlayers):