コード例 #1
0
ファイル: ModeEditor.py プロジェクト: ihptru/aamms
def modeEditor(acl, player):
    if Global.state=="modeEditor":
        Armagetronad.PrintPlayerMessage(player, "0xff0000Already in mode editor state!")
    Armagetronad.SendCommand("INCLUDE settings.cfg")
    Armagetronad.SendCommand("SINCLUDE settings_custom.cfg")
    Armagetronad.SendCommand("DEFAULT_KICK_REASON Server\ under\ maintenance.")
    def setSettings():
        Armagetronad.SendCommand("ALLOW_TEAM_NAME_PLAYER 1")
        Armagetronad.SendCommand("FORTRESS_CONQUEST_TIMEOUT -1")
        Armagetronad.SendCommand("MAX_CLIENTS 1")
        Armagetronad.SendCommand("SP_TEAMS_MAX 1")
        Armagetronad.SendCommand("TEAMS_MAX 1")
        Armagetronad.SendCommand("SP_AUTO_AIS 0")
        Armagetronad.SendCommand("AUTO_AIS 0")
        Armagetronad.SendCommand("SP_NUM_AIS 0")
        Armagetronad.SendCommand("NUM_AIS 0")
        Armagetronad.SendCommand("CYCLE_SPEED_MIN 0")
        Armagetronad.SendCommand("CYCLE_RUBBER 10000000")
        Armagetronad.SendCommand("SP_WALLS_LENGTH 0.000001")
        Armagetronad.SendCommand("CYCLE_SPEED 5")
        Armagetronad.SendCommand("CYCLE_BRAKE -100")
        Armagetronad.SendCommand("CYCLE_BRAKE_DEPLETE 0")
        Armagetronad.SendCommand("CYCLE_SPEED_DECAY_ABOVE 1.5")
        Armagetronad.SendCommand("CYCLE_ACCEL 0")
        Armagetronad.SendCommand("SP_MIN_PLAYERS 0")
        Armagetronad.SendCommand("CYCLE_TURN_SPEED_FACTOR 1")
        Armagetronad.SendCommand("CYCLE_SPEED_DECAY_BELOW 2")
        Armagetronad.SendCommand("FORTRESS_SURVIVE_WIN 0")
    setSettings()
    Poll.Cancel()
    Mode.current_mode=None
    Armagetronad.SendCommand("NETWORK_AUTOBAN_FACTOR 0")
    Armagetronad.PrintPlayerMessage(player, "0xff0000Kicking other players ...")
    Armagetronad.PrintPlayerMessage(player, "\n"*4)
    for playero in Player.players.values():
        if playero.ip!=Player.players[player].ip:
            Armagetronad.SendCommand("KICK "+playero.getLadderName() )
        else:
            playero.kill()    
    Armagetronad.SendCommand("NETWORK_AUTOBAN_FACTOR 10")
    Armagetronad.SendCommand("LADDERLOG_WRITE_ADMIN_COMMAND 1")
    def HandleAdminCommand(player, ip, acl, *command):
        global data
        if Global.state!="modeeditor":
            LadderLogHandlers.unregister_handler("ADMIN_COMMAND", HandleAdminCommand)
        if(Armagetronad.IsSetting(command[0]) and len(command)>1):
            data["mode"].settings[command[0]]=" ".join(command[1:])
            Armagetronad.PrintMessage("0xff0000"+command[0]+" changed to "+" ".join(command[1:]))
            setSettings()
    LadderLogHandlers.register_handler("ADMIN_COMMAND", HandleAdminCommand)
    Global.state="modeeditor"
    global data
    data=dict()
    data["speed"]=5
    data["mode"]=Mode.Mode("Unsaved")
    data["stopped"]=False
    def PrintMessage():
        message="""0x00ffffWelcome to ModeEditor! 0xffffff
ModeEditor was made to help you creating new modes.
Use the /stop, /go, /lessSpeed, /moreSpeed and brake commands to controll the speed of the cycle.
To add a zone or a respawn point at the current position of your cycle use /makeZone and /makeRes.
If you want to go to a specific position, use /stop and then use /tele.
You can use /modeSetting to change settings like name and lives.
To change game settings like rubber you can use /admin (i.e. /admin CYCLE_RUBBER 5). Your changes will get recorded.
To save the mode use /saveMode to save the mode. 
If you want to go back to normal mode, use /normal."""
        for msg in message.split("\n"):
            Armagetronad.PrintMessage(msg)
            time.sleep(3)
    LadderLogHandlers.atRoundend.append(PrintMessage)
コード例 #2
0
ファイル: LadderHandlers.py プロジェクト: ihptru/aamms
            message=Messages.PlayerRespawned.format(player=Player.players[player].name, msg=res_msg)
        if not SimpleMode.current_lives==0:
            Armagetronad.PrintMessage(message)
    
def HandleCycleCreated(player_name, x, y, xdir, ydir):
    if SimpleMode.current_mode:
        if "respoint" not in Player.players[player_name].data:
            if SimpleMode.current_lives==None:
                Player.players[player_name].setLives(SimpleMode.current_mode.lives+1) #@UndefinedVariable
            else:
                Player.players[player_name].setLives(SimpleMode.current_lives+1)
            Player.players[player_name].data["respoint"]=tuple( map( float,(x,y,xdir,ydir) ) )

def DoInit(*args):
    if SimpleMode.current_mode:
        SimpleMode.current_mode.activate(kill=False) #@UndefinedVariable
        for player_name in Player.players:
            if "respoint" in Player.players[player_name].data:
                del Player.players[player_name].data["respoint"]

def CheckForNewMatch(cur_num, max_num):
    if cur_num=="1":
        if SimpleMode.current_mode:
            Armagetronad.SendCommand("CENTER_MESSAGE "+Messages.ModeMessage.format(mode=SimpleMode.current_mode.name)) #@UndefinedVariable

    
for respawn_event in RESPAWN_EVENTS:
    LadderLogHandlers.register_handler(respawn_event, HandlePlayerDied)
LadderLogHandlers.register_handler("CYCLE_CREATED", HandleCycleCreated)
LadderLogHandlers.register_handler("ROUND_COMMENCING", DoInit, CheckForNewMatch)