Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement