Exemplo n.º 1
0
	def createSpawnPointDatas(self):
		"""
		"""
		res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % (self.spaceResName.replace("\\", "/").split("/")[-1])
		if(len(self.spaceResName) == 0 or not KBEngine.hasRes(res)):
			return
			
		res = KBEngine.getResFullPath(res)
			
		tree = etree.parse(res) 
		root = tree.getroot()
		
		DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res))
		
		for child in root:
			positionNode = child[0][0]
			directionNode = child[0][1]
			scaleNode = child[0][2]
			
			scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10)
			position = (float(positionNode[0].text), float(positionNode[1].text), float(positionNode[2].text))
			direction = [float(directionNode[0].text) / 360 * (math.pi * 2), float(directionNode[1].text) / 360 * (math.pi * 2), float(directionNode[2].text) / 360 * (math.pi * 2)]
			
			if direction[0] - math.pi > 0.0:
				direction[0] -= math.pi * 2
			if direction[1] - math.pi > 0.0:
				direction[1] -= math.pi * 2
			if direction[2] - math.pi > 0.0:
				direction[2] -= math.pi * 2
				
			self.tmpCreateEntityDatas.append([int(child.attrib['name']), \
			position, \
			direction, \
			scale, \
			])
Exemplo n.º 2
0
    def createSpawnPointDatas(self):
        """
		"""
        res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % self.spaceResName
        if (len(self.spaceResName) == 0 or not KBEngine.hasRes(res)):
            return

        res = KBEngine.getResFullPath(res)

        tree = etree.parse(res)
        root = tree.getroot()

        DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res))

        for child in root:
            position = child[0][0]
            direction = child[0][1]
            scaleNode = child[0][2]
            scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) +
                          float(scaleNode[2].text)) / 3.0) * 10)
            self.tmpCreateEntityDatas.append([int(child.attrib['name']), \
            (float(position[0].text), float(position[1].text), float(position[2].text)), \
            (float(direction[0].text) * ((math.pi * 2) / 360), float(direction[1].text) * ((math.pi * 2) / 360), float(direction[2].text) * ((math.pi * 2) / 360)), \
            scale, \
            ])
Exemplo n.º 3
0
	def createSpawnPointDatas(self):
		"""
		"""
		res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % (self.spaceResName.replace("\\", "/").split("/")[-1])
		if(len(self.spaceResName) == 0 or not KBEngine.hasRes(res)):
			return
			
		res = KBEngine.getResFullPath(res)
			
		tree = etree.parse(res) 
		root = tree.getroot()
		
		DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res))
		
		for child in root:
			positionNode = child[0][0]
			directionNode = child[0][1]
			scaleNode = child[0][2]
			
			scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10)
			position = (float(positionNode[0].text), float(positionNode[1].text), float(positionNode[2].text))
			direction = [float(directionNode[0].text) / 360 * (math.pi * 2), float(directionNode[1].text) / 360 * (math.pi * 2), float(directionNode[2].text) / 360 * (math.pi * 2)]
			
			if direction[0] - math.pi > 0.0:
				direction[0] -= math.pi * 2
			if direction[1] - math.pi > 0.0:
				direction[1] -= math.pi * 2
			if direction[2] - math.pi > 0.0:
				direction[2] -= math.pi * 2
				
			self.tmpCreateEntityDatas.append([int(child.attrib['name']), \
			position, \
			direction, \
			scale, \
			])
Exemplo n.º 4
0
	def createSpawnPointDatas(self):
		"""
		"""

		res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % self.spaceResName
		
		if(len(self.spaceResName) == 0 or not KBEngine.hasRes(res)):
			return
			
		res = KBEngine.getResFullPath(res)
			
		tree = etree.parse(res) 
		root = tree.getroot()
		
		DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res))
		
		for child in root:
			position = child[0][0]
			direction = child[0][1]
			scaleNode = child[0][2]
			scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10)
			self.tmpCreateEntityDatas.append([int(child.attrib['name']), \
			(float(position[0].text), float(position[1].text), float(position[2].text)), \
			(float(direction[0].text) * ((math.pi * 2) / 360), float(direction[1].text) * ((math.pi * 2) / 360), float(direction[2].text) * ((math.pi * 2) / 360)), \
			scale, \
			])
 def onRespStaticRes(self, req, resp):
     filePath = '%s%s' % (self._resPath, req.url if req.url[-1] != '/' else
                          ('%sindex.html' % req.url))
     if KBEngine.hasRes(filePath):
         file = KBEngine.open(filePath, 'rb')
         resp.body = file.read()
         file.close()
     else:
         resp.body = b'File Not Found...'
     resp.end()
Exemplo n.º 6
0
def load_whitelists():
    try:
        import KBEngine
        import KBEDebug
        p = './scripts/data/whitelists.txt'
        if KBEngine.hasRes(p):
            fs = KBEngine.open(p, 'r')
            lines = fs.readlines()
            for line in lines:
                if line.strip() != '':
                    whitelists.append(int(line.strip()))
        KBEDebug.DEBUG_MSG("whitelists: {}".format(whitelists))
    except:
        pass