From: <z-...@us...> - 2012-03-12 12:17:53
|
Revision: 10380 http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10380&view=rev Author: z-man Date: 2012-03-12 12:17:45 +0000 (Mon, 12 Mar 2012) Log Message: ----------- Merging branch 0.2.8 from revision 10374 to 10379: ------------------------------------------------------------------------ r10379 | bazaaarmagetron | 2012-03-11 07:48:54 +0100 (Sun, 11 Mar 2012) | 2 lines Daniel Lee Harple: Added FORCE_RESPAWN_SCRIPT command to make the development-cycle for scripts more simple. Also moved script documentation to settings_dedcaited.cfg. ------------------------------------------------------------------------ r10376 | bazaaarmagetron | 2012-03-03 00:46:15 +0100 (Sat, 03 Mar 2012) | 4 lines author: Manuel Moos Applying patch that fixes the mouse cursor freeze issue, source: http://bugzilla.libsdl.org/attachment.cgi?id=460&action=diff&context=patch&collapsed=&headers=1&format=raw ------------------------------------------------------------------------ Revision Links: -------------- http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10374&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10379&view=rev http://armagetronad.svn.sourceforge.net/armagetronad/?rev=10376&view=rev Modified Paths: -------------- armagetronad/branches/0.4/armagetronad/NEWS armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg armagetronad/branches/0.4/armagetronad/language/english_base.txt armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp Property Changed: ---------------- armagetronad/branches/0.4/ Property changes on: armagetronad/branches/0.4 ___________________________________________________________________ Modified: svn:mergeinfo - /armagetronad/branches/0.2.8:8751-8852,8855-9185,9192-9201,9220-9514,9529-10044,10054-10374 /armagetronad/branches/0.2.8.3:9309-10004 + /armagetronad/branches/0.2.8:8751-8852,8855-9185,9192-9201,9220-9514,9529-10044,10054-10379 /armagetronad/branches/0.2.8.3:9309-10004 Modified: armagetronad/branches/0.4/armagetronad/NEWS =================================================================== --- armagetronad/branches/0.4/armagetronad/NEWS 2012-03-11 06:48:54 UTC (rev 10379) +++ armagetronad/branches/0.4/armagetronad/NEWS 2012-03-12 12:17:45 UTC (rev 10380) @@ -163,13 +163,9 @@ TEAM_RENAMED <old team name> <new team name> TEAM_PLAYER_ADDED <team name> <player> TEAM_PLAYER_REMOVED <team name> <player> -- Manage external scripts on Unix dedicated servers: SPAWN_SCRIPT always - launches a script (the main script must be in the scripts subdirectory on the data - path), RESPAWN_SCRIPT only spawns it if a previous instance exited, KILL_SCRIPT - kills the script. - Scripts are fed the ladderlog on stdin (and need to read it) and their stdout - output is interpreted as console input on the server. Environment variables - are set so the script knows all about the server configuration at time of launch. +- Manage external scripts on Unix dedicated servers. New commands: + SPAWN_SCRIPT, RESPAWN_SCRIPT, FORCE_RESPAWN_SCRIPT, KILL_SCRIPT, + CHECK_SCRIPT. - Authentication is now enabled by default. Changes since 0.2.8.3.1: Modified: armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg =================================================================== --- armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg 2012-03-11 06:48:54 UTC (rev 10379) +++ armagetronad/branches/0.4/armagetronad/config/settings_dedicated.cfg 2012-03-12 12:17:45 UTC (rev 10380) @@ -228,7 +228,6 @@ CONSOLE_DECORATE_ID 1 # Decorates every line of console output with the client ID CONSOLE_DECORATE_IP 0 # Decorates every line of console output with the client IP -LADDERLOG_GAME_TIME_INTERVAL -1 # write a line to ladderlog.txt indicating how "old" the current game is at most every n seconds. Negative values disable this feature. SINCLUDE server_info.cfg # ping flood response DOS protection: if pings from a single machine are requested more often than this, @@ -327,9 +326,6 @@ MIN_PLAYERS 0 # minimum number of players; missing humans are filled up with AIs NUM_AIS 0 # minimum number of AIs -WAIT_FOR_EXTERNAL_SCRIPT 0 # set to 1 if you want the server to sleep between rounds until it is set back to 0 or -WAIT_FOR_EXTERNAL_SCRIPT_TIMEOUT 3 # seconds - # team name ALLOW_TEAM_NAME_COLOR 1 # allow teams to be named after a color ALLOW_TEAM_NAME_PLAYER 1 # allow teams to be named after the leading player @@ -404,6 +400,31 @@ ############################################################################################ # +# Scripting +# +############################################################################################ + +# Scripts are fed the ladderlog on stdin (and need to read it) and their +# stdout output is interpreted as console input on the server. Environment +# variables are set so the script knows all about the server configuration at +# time of launch. + +# SPAWN_SCRIPT Spawns an external script from a scripts/ subdirectory on the data path. +# RESPAWN_SCRIPT Spawns an external script from a scripts/ subdirectory on the data path if no already running instance is found. +# FORCE_RESPAWN_SCRIPT Spawns an external script from a scripts/ subdirectory on the data path after killing the other possibly running instance. +# KILL_SCRIPT Kills a script. Argument must match the SPAWN_SCRIPT argument. + +# Should safety checks be done on script commands? Very much recommended to leave this on. +CHECK_SCRIPT 1 + +LADDERLOG_GAME_TIME_INTERVAL -1 # write a line to ladderlog.txt indicating how "old" the current game is at most every n seconds. Negative values disable this feature. +WAIT_FOR_EXTERNAL_SCRIPT 0 # set to 1 if you want the server to sleep between rounds until it is set back to 0 or +WAIT_FOR_EXTERNAL_SCRIPT_TIMEOUT 3 # seconds + + + +############################################################################################ +# # Debugging (only available if compiled for debug) # ############################################################################################ Modified: armagetronad/branches/0.4/armagetronad/language/english_base.txt =================================================================== --- armagetronad/branches/0.4/armagetronad/language/english_base.txt 2012-03-11 06:48:54 UTC (rev 10379) +++ armagetronad/branches/0.4/armagetronad/language/english_base.txt 2012-03-12 12:17:45 UTC (rev 10380) @@ -352,6 +352,7 @@ spawn_script_help Spawns an external script from a scripts/ subdirectory on the data path. respawn_script_help Spawns an external script from a scripts/ subdirectory on the data path if no already running instance is found. +force_respawn_script_help Spawns an external script from a scripts/ subdirectory on the data path after killing the other possibly running instance. kill_script_help Kills a script. Argument must match the SPAWN_SCRIPT argument. check_script_help Should safety checks be done on script commands? Very much recommended to leave this on. Modified: armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp =================================================================== --- armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp 2012-03-11 06:48:54 UTC (rev 10379) +++ armagetronad/branches/0.4/armagetronad/src/render/rConsoleCout.cpp 2012-03-12 12:17:45 UTC (rev 10380) @@ -662,24 +662,42 @@ static tConfItemFunc sr_respawnScript( "RESPAWN_SCRIPT", sr_RespawnScriptCommand ); static tAccessLevelSetter sr_respawnScriptALS( sr_respawnScript, tAccessLevel_Owner ); -// respawns a script -static void sr_KillScriptCommand( std::istream & s ) +static void sr_KillScript( tString const & command, bool shouldWarn=true ) { - tString command; - command.ReadLine(s); - rScriptStream * stream = sr_FindScriptStream( command ); if( stream ) { con << "Killing script \'" << command << "\'.\n"; stream->Close(); } - else + else if ( shouldWarn ) { con << "No script named \'" << command << "\' running.\n"; } } +// force respawn a script +static void sr_ForceRespawnScriptCommand( std::istream & s ) +{ + tString command; + command.ReadLine(s); + + sr_KillScript( command, false ); + sr_SpawnScript( command ); +} + +static tConfItemFunc sr_forceRespawnScript( "FORCE_RESPAWN_SCRIPT", sr_ForceRespawnScriptCommand ); +static tAccessLevelSetter sr_forceRespawnScriptALS( sr_forceRespawnScript, tAccessLevel_Owner ); + +// kills a script +static void sr_KillScriptCommand( std::istream & s ) +{ + tString command; + command.ReadLine(s); + + sr_KillScript( command ); +} + static tConfItemFunc sr_killScript( "KILL_SCRIPT", sr_KillScriptCommand ); static tAccessLevelSetter sr_killScriptALS( sr_killScript, tAccessLevel_Owner ); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |