SHARE
TWEET

Untitled

a guest Jun 22nd, 2013 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """
  2. thepolm3's revamped tow
  3. with settable cps
  4. """
  5.  
  6. from pyspades.constants import *
  7. from pyspades.server import Territory
  8.  
  9. class TugTerritory(Territory):
  10.     def add_player(self, player):
  11.         if self.team:
  12.             if self.team.id: move = -1
  13.             else: move = 1
  14.             try:
  15.                 if self.protocol.entities[self.id+move].team==self.team:return
  16.             except Exception:
  17.                 pass
  18.         Territory.add_player(self, player)
  19.  
  20. def apply_script(protocol, connection, config):
  21.            
  22.     class TugProtocol(protocol):
  23.         game_mode = TC_MODE
  24.         def get_cp_entities(self):
  25.             terretories=[] #default
  26.             positions=[(0,0,63)] #default
  27.  
  28.             #getting positions
  29.             extensions=self.map_info.extensions
  30.             if extensions.has_key("tow_locations"):
  31.                 positions=extensions['tow_loccations']
  32.             l=len(positions)-1
  33.  
  34.             #looping through positions
  35.             for i in range(l+1):
  36.                 pos=positions[i]
  37.  
  38.                 if len(pos)>2: #if given the x,y and z
  39.                     x,y,z=pos
  40.  
  41.                 else: #if given only x and y
  42.                     x,y=pos
  43.                     z=self.map.get_z(x,y)
  44.  
  45.                 cp=TugTerritory(i, self, x, y, z) #creates the territory
  46.  
  47.                 #sets the team
  48.                 if i<float(l)/2:
  49.                     cp.team=self.blue_team
  50.                 elif i>float(l)/2:
  51.                     cp.team=self.green_team
  52.                 else:
  53.                     cp.team=None
  54.  
  55.                 #add the teretory to the list
  56.                 terretories.append(cp)
  57.  
  58.             #the end!
  59.             return terretories
  60.  
  61.     return TugProtocol, connection
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top