SHARE
TWEET

Untitled

a guest Nov 18th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from io.anuke.mindustry import Vars
  2. from io.anuke.mindustry.game import Team
  3. from io.anuke.mindustry.game.EventType import GameOverEvent
  4. from io.anuke.arc import Events
  5. from io.anuke.arc import Core
  6.  
  7. def change_map(mapName, test):
  8.   """
  9.  A hacky way to change maps without kicking everyone,
  10.  remove all maps from the map pool but the one we want,
  11.  add them back after changing.
  12.  """
  13.   maps = Vars.maps.maps
  14.   map_name = str(mapName[0])
  15.   map_name = map_name.strip().replace("_"," ")
  16.  
  17.   def find_map():
  18.     for (m in maps):
  19.       if map_name.lower() == m.lower():
  20.         return m
  21.     return None
  22.  
  23.   next_map = find_map()
  24.   if next_map != None:
  25.     map_pool = maps.copy()
  26.     maps.clear();
  27.     maps.add(next_map);
  28.     server_control.inExtraRound = False
  29.     Events.fire(GameOverEvent(Team.sharded))
  30.     maps.clear();
  31.     for m in mapPool:
  32.       maps.add(m)
  33.   else:
  34.     print "map " + map_name + " not found"
  35.  
  36. serv_command("changemap", "<message...>", "changes the map", change_map)
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top