Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from io.anuke.mindustry import Vars
- from io.anuke.mindustry.game import Team
- from io.anuke.mindustry.game.EventType import GameOverEvent
- from io.anuke.arc import Events
- from io.anuke.arc import Core
- def change_map(mapName, test):
- """
- A hacky way to change maps without kicking everyone,
- remove all maps from the map pool but the one we want,
- add them back after changing.
- """
- maps = Vars.maps.maps
- map_name = str(mapName[0])
- map_name = map_name.strip().replace("_"," ")
- def find_map():
- for (m in maps):
- if map_name.lower() == m.lower():
- return m
- return None
- next_map = find_map()
- if next_map != None:
- map_pool = maps.copy()
- maps.clear();
- maps.add(next_map);
- server_control.inExtraRound = False
- Events.fire(GameOverEvent(Team.sharded))
- maps.clear();
- for m in mapPool:
- maps.add(m)
- else:
- print "map " + map_name + " not found"
- serv_command("changemap", "<message...>", "changes the map", change_map)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement