Browse Source

*** empty log message ***

Samir Naik 22 years ago
parent
commit
d37da1df2e

+ 18 - 0
direct/src/level/BasicEntities.py

@@ -17,6 +17,9 @@ class NodePathAttribs:
         if doReparent:
             self.callSetters('parentEntId')
 
+        if __debug__:
+            self.getNodePath().setTag('entity', '1')
+
     def setPos(self, *args): self.getNodePath().setPos(*args)
     def setX(self, *args): self.getNodePath().setX(*args)
     def setY(self, *args): self.getNodePath().setY(*args)
@@ -38,6 +41,21 @@ class NodePathAttribs:
         self.parentEntId = parentEntId
         self.level.requestReparent(self, self.parentEntId)
 
+# this is an abstract class, do not instantiate.
+class NodePathSelfAttribs:
+    """Derive from this class to give an entity that is already a Nodepath
+    the behavior of a NodePathEntity, with ability to reparent and be
+    picked from the Direct/FactoryEditor interface"""
+    def initNodePathSelfAttribs(self):
+        if __debug__:
+            self.setTag('entity', '1')
+        self.callSetters('parentEntId')
+            
+    def setParentEntId(self, parentEntId):
+        self.parentEntId = parentEntId
+        self.level.requestReparent(self, self.parentEntId)
+
+
 class privNodePathImpl(NodePath.NodePath):
     def __init__(self, name):
         node = hidden.attachNewNode(name)

+ 2 - 0
direct/src/level/EntityCreator.py

@@ -8,6 +8,7 @@ import EditMgr
 import LevelMgr
 import ZoneEntity
 import ModelEntity
+import PathEntity
 
 # some useful constructor functions
 # ctor functions must take (level, entId)
@@ -32,6 +33,7 @@ class EntityCreator(EntityCreatorBase.EntityCreatorBase):
             'logicGate': nothing,
             'model' : ModelEntity.ModelEntity,
             'nodepath': BasicEntities.NodePathEntity,
+            'path' : PathEntity.PathEntity,
             'zone': ZoneEntity.ZoneEntity,
             })
 

+ 1 - 0
direct/src/level/EntityCreatorAI.py

@@ -50,6 +50,7 @@ class EntityCreatorAI(EntityCreatorBase.EntityCreatorBase):
             'logicGate': Functor(cLE, LogicGateAI.LogicGateAI),
             'model' : nothing,
             'nodepath': nothing,
+            'path': nothing,
             'zone': Functor(cLE, ZoneEntityAI.ZoneEntityAI),
             })
 

+ 8 - 0
direct/src/level/EntityTypes.py

@@ -83,3 +83,11 @@ class Model(Nodepath):
         ('scale', 1, 'pos'),
         ('modelPath', None, 'bamfilename'),
         )
+
+class Path(Nodepath):
+    type = 'path'
+    attribs = (
+        ('scale', 1, 'pos'),
+        ('pathIndex', 0, 'int'),
+        )
+    

+ 6 - 0
direct/src/level/ModelEntity.py

@@ -23,6 +23,12 @@ class ModelEntity(BasicEntities.NodePathEntity):
             if self.model:
                 self.model.reparentTo(self)
 
+        # HACK SDN: special code for moving crate wall collisions down
+        # Uniquify the collision name
+        cNode = self.find("**/wall_collsion")
+        if not cNode.isEmpty():
+            cNode.setZ(-1.2)
+
     def setModelPath(self, path):
         self.modelPath = path
         self.loadModel()

+ 50 - 0
direct/src/level/PathEntity.py

@@ -0,0 +1,50 @@
+from ToontownGlobals import *
+import DirectNotifyGlobal
+import BasicEntities
+
+class PathEntity(BasicEntities.NodePathEntity):
+    pathData = [
+        [Vec3(10, 0, 0),
+         Vec3(10, 10,0),
+         Vec3(-10, 10, 0),
+         Vec3(-10, 0, 0),
+         ],
+        [Vec3(10, 5, 0),
+         Vec3(10, 0,0),
+         Vec3(-10, -5, 0),
+         ],
+        [Vec3(-8.29501342773,-9.22601318359,0.0),
+         Vec3(13.7590026855,-12.9730224609,0.0),
+         Vec3(16.7769775391,10.7899780273,0.0),
+         Vec3(-8.17102050781,14.1640014648,0.0),
+         ],
+        [Vec3(-47.9110107422,-6.86798095703,0.0),
+         Vec3(27.691986084,-5.68200683594,0.0),
+         Vec3(34.049987793,3.55303955078,0.0),
+         Vec3(-39.983001709,3.68499755859,0.0)
+         ],
+        [Vec3(1.25,21,0),
+         Vec3(-.2,7.9,0),
+         Vec3(-22.2,-12.1,0),
+         Vec3(-5.2,1.4,0),
+         ],
+        [Vec3(12.70, -51.9, 0.0),
+         Vec3(12.4, -33.0, 0.0),
+         Vec3(-1.16, -18.6, 0.0),
+         Vec3(9.27, -34.3, 0.0),
+         ],
+        ]
+    
+    def __init__(self, level, entId):
+        BasicEntities.NodePathEntity.__init__(self, level, entId)
+        self.path = self.pathData[self.pathIndex]
+            
+    def destroy(self):
+        BasicEntities.NodePathEntity.destroy(self)
+
+    def setPathIndex(self, pathIndex):
+        self.pathIndex = pathIndex
+        self.path = self.pathData[self.pathIndex]
+    
+    
+