Had to make a few changes from the script BR made to get the map extensions to load. However in my map extensions I had 6 points but on the server it only showed 4. And the spawn logic seemed to be broken as well.
Code: Select all
http://pastebin.com/0KD1pKjC <- thepolm's updated code"""
thepolm3's revamped tow
with settable cps
"""
from pyspades.constants import *
from pyspades.server import Territory
class TugTerritory(Territory):
def add_player(self, player):
if self.team:
if self.team.id: move = -1
else: move = 1
try:
if self.protocol.entities[self.id+move].team==self.team:return
except Exception:
pass
Territory.add_player(self, player)
def apply_script(protocol, connection, config):
class TugProtocol(protocol):
game_mode = TC_MODE
def get_cp_entities(self):
terretories=[] #default
positions=[(0,0,63)] #default
#getting positions
extensions=self.map_info.extensions
if extensions.has_key("tow_locations"):
positions=extensions['tow_loccations']
l=len(positions)-1
#looping through positions
for i in range(l+1):
pos=positions[i]
if len(pos)>2: #if given the x,y and z
x,y,z=pos
else: #if given only x and y
x,y=pos
z=self.map.get_z(x,y)
cp=TugTerritory(i, self, x, y, z) #creates the territory
#sets the team
if i<float(l)/2:
cp.team=self.blue_team
elif i>float(l)/2:
cp.team=self.green_team
else:
cp.team=None
#add the teretory to the list
terretories.append(cp)
#the end!
return terretories
return TugProtocol, connection
http://pastebin.com/rDt8WG1W <- link to the code above
Also here is the map extension I used:
Code: Select all
http://pastebin.com/AY0xTefzName = 'Isthmos Edificans'
Author = 'Ki11aWi11'
Version = '1.0'
Description = 'Fight your way across the Isthmos!'
extensions = {
'tow_locations' : ((62, 256),(97, 256),(162, 256),(345, 256),(417, 256),(448, 256)),
'water_damage' : 20
}