PK &?\<progs/PK ˆ c<progs/gametypes/PK Ç“d<ùG;µQLQLprogs/gametypes/rocketchef.as int[] movespeed( maxClients ); int[] dashspeed( maxClients ); int prcYesIcon; int prcShockIcon; int prcShellIcon; //cVar tdmAllowPowerupDrop( "tdm_powerupDrop", "0", CVAR_ARCHIVE ); ///***************************************************************** /// NEW MAP ENTITY DEFINITIONS ///***************************************************************** ///***************************************************************** /// LOCAL FUNCTIONS ///***************************************************************** int TDM_SCORE_NET( cStats @stats ) { if ( @stats == null ) return 0; return ( stats.frags - ( stats.teamFrags + stats.suicides ) ) - stats.deaths; } // a player has just died. The script is warned about it so it can account scores void TDM_playerKilled( cEntity @target, cEntity @attacker, cEntity @inflicter ) { movespeed[ attacker.client.playerNum() ] += 80; dashspeed[ attacker.client.playerNum() ] += 150; attacker.client.setPMoveMaxSpeed( movespeed[ attacker.client.playerNum() ] ); attacker.client.setPMoveDashSpeed( dashspeed[ attacker.client.playerNum() ] ); G_PrintMsg( attacker, "Speed gained!\n" ); if ( match.getState() != MATCH_STATE_PLAYTIME ) return; if ( @target.client == null ) return; // update player and team scores based on player stats if ( @attacker != null && @attacker.client != null ) attacker.client.stats.setScore( TDM_SCORE_NET( attacker.client.stats ) ); target.client.stats.setScore( TDM_SCORE_NET( target.client.stats ) ); cTeam @team; @team = @G_GetTeam( target.team ); team.stats.setScore( team.stats.frags - ( team.stats.teamFrags + team.stats.suicides ) ); @team = @G_GetTeam( target.team == TEAM_ALPHA ? TEAM_BETA : TEAM_ALPHA ); team.stats.setScore( team.stats.frags - ( team.stats.teamFrags + team.stats.suicides ) ); // drop items // if ( ( G_PointContents( target.getOrigin() ) & CONTENTS_NODROP ) == 0 ) // { // drop the weapon // if ( target.client.weapon > WEAP_GUNBLADE ) // { // GENERIC_DropCurrentWeapon( target.client, true ); // } // // // drop ammo pack (won't drop anything if player doesn't have any ammo) // target.dropItem( AMMO_PACK_WEAK ); // // if ( tdmAllowPowerupDrop.getBool() ) // { // if ( target.client.inventoryCount( POWERUP_QUAD ) > 0 ) // { // target.dropItem( POWERUP_QUAD ); // target.client.inventorySetCount( POWERUP_QUAD, 0 ); // } // // if ( target.client.inventoryCount( POWERUP_SHELL ) > 0 ) // { // target.dropItem( POWERUP_SHELL ); // target.client.inventorySetCount( POWERUP_SHELL, 0 ); // } } // } //} ///***************************************************************** /// MODULE SCRIPT CALLS ///***************************************************************** bool GT_Command( cClient @client, cString &cmdString, cString &argsString, int argc ) { if ( cmdString == "drop" ) { //cString token; // //for ( int i = 0; i < argc; i++ ) //{ // token = argsString.getToken( i ); // if ( token.len() == 0 ) // break; // // if ( token == "fullweapon" ) // { // GENERIC_DropCurrentWeapon( client, true ); // GENERIC_DropCurrentAmmoStrong( client ); // } // else if ( token == "weapon" ) // { // GENERIC_DropCurrentWeapon( client, true ); // } // else if ( token == "strong" ) // { // GENERIC_DropCurrentAmmoStrong( client ); // } // else // { // GENERIC_CommandDropItem( client, token ); // } //} return true; } // example of registered command else if ( cmdString == "gametype" ) { cString response = ""; cVar fs_game( "fs_game", "", 0 ); cString manifest = gametype.getManifest(); response += "\n"; response += "Gametype " + gametype.getName() + " : " + gametype.getTitle() + "\n"; response += "----------------\n"; response += "Version: " + gametype.getVersion() + "\n"; response += "Author: " + gametype.getAuthor() + "\n"; response += "Mod: " + fs_game.getString() + (manifest.length() > 0 ? " (manifest: " + manifest + ")" : "") + "\n"; response += "----------------\n"; G_PrintMsg( client.getEnt(), response ); return true; } else if ( cmdString == "callvotevalidate" ) { cString votename = argsString.getToken( 0 ); // if ( votename == "tdm_powerup_drop" ) // { // cString voteArg = argsString.getToken( 1 ); // if ( voteArg.len() < 1 ) // { // client.printMessage( "Callvote " + votename + " requires at least one argument\n" ); // return false; // } // // int value = voteArg.toInt(); // if ( voteArg != "0" && voteArg != "1" ) // { // client.printMessage( "Callvote " + votename + " expects a 1 or a 0 as argument\n" ); // return false; // } // // if ( voteArg == "0" && !tdmAllowPowerupDrop.getBool() ) // { // client.printMessage( "Powerup drop is already disallowed\n" ); // return false; // } // // if ( voteArg == "1" && tdmAllowPowerupDrop.getBool() ) // { // client.printMessage( "Powerup drop is already allowed\n" ); // return false; // } // // return true; // } client.printMessage( "Unknown callvote " + votename + "\n" ); return false; } else if ( cmdString == "callvotepassed" ) { cString votename = argsString.getToken( 0 ); // // if ( votename == "tdm_powerup_drop" ) // { // if ( argsString.getToken( 1 ).toInt() > 0 ) // tdmAllowPowerupDrop.set( 1 ); // else // tdmAllowPowerupDrop.set( 0 ); // } return true; } return false; } // When this function is called the weights of items have been reset to their default values, // this means, the weights *are set*, and what this function does is scaling them depending // on the current bot status. // Player, and non-item entities don't have any weight set. So they will be ignored by the bot // unless a weight is assigned here. bool GT_UpdateBotStatus( cEntity @ent ) { return GENERIC_UpdateBotStatus( ent ); } // select a spawning point for a player cEntity @GT_SelectSpawnPoint( cEntity @self ) { return GENERIC_SelectBestRandomSpawnPoint( self, "info_player_deathmatch" ); } cString @GT_ScoreboardMessage( int maxlen ) { cString scoreboardMessage = ""; cString entry; cTeam @team; cEntity @ent; int i, t, carrierIcon, readyIcon; for ( t = TEAM_ALPHA; t < GS_MAX_TEAMS; t++ ) { @team = @G_GetTeam( t ); // &t = team tab, team tag, team score, team ping entry = "&t " + t + " " + team.stats.score + " " + team.ping + " "; if ( scoreboardMessage.len() + entry.len() < maxlen ) scoreboardMessage += entry; for ( i = 0; @team.ent( i ) != null; i++ ) { @ent = @team.ent( i ); if ( ( ent.effects & EF_QUAD ) != 0 ) carrierIcon = prcShockIcon; else if ( ( ent.effects & EF_SHELL ) != 0 ) carrierIcon = prcShellIcon; else carrierIcon = 0; if ( ent.client.isReady() ) readyIcon = prcYesIcon; else readyIcon = 0; int playerID = ( ent.isGhosting() && ( match.getState() == MATCH_STATE_PLAYTIME ) ) ? -( ent.playerNum() + 1 ) : ent.playerNum(); // "Name Score Frags TKs Ping C R" entry = "&p " + playerID + " " + ent.client.getClanName() + " " + ent.client.stats.score + " " + ent.client.stats.frags + " " + ent.client.stats.deaths + " " + ent.client.stats.teamFrags + " " + ent.client.ping + " " + carrierIcon + " " + readyIcon + " "; if ( scoreboardMessage.len() + entry.len() < maxlen ) scoreboardMessage += entry; } } return scoreboardMessage; } // Some game actions trigger score events. These are events not related to killing // oponents, like capturing a flag void GT_scoreEvent( cClient @client, cString &score_event, cString &args ) { if ( score_event == "dmg" ) { } else if ( score_event == "kill" ) { cEntity @attacker = null; if ( @client != null ) @attacker = @client.getEnt(); int arg1 = args.getToken( 0 ).toInt(); int arg2 = args.getToken( 1 ).toInt(); // target, attacker, inflictor TDM_playerKilled( G_GetEntity( arg1 ), attacker, G_GetEntity( arg2 ) ); } else if ( score_event == "award" ) { } } // a player is being respawned. This can happen from several ways, as dying, changing team, // being moved to ghost state, be placed in respawn queue, being spawned from spawn queue, etc void GT_playerRespawn( cEntity @ent, int old_team, int new_team ) { movespeed[ ent.client.playerNum() ] = 320; dashspeed[ ent.client.playerNum() ] = 474; if ( ent.isGhosting() ) return; if ( gametype.isInstagib() ) { ent.client.inventoryGiveItem( WEAP_ROCKETLAUNCHER ); ent.client.inventorySetCount( AMMO_ROCKETS, 1 ); ent.client.inventorySetCount( AMMO_WEAK_ROCKETS, 1 ); } else { cItem @item; cItem @ammoItem; // the gunblade can't be given (because it can't be dropped) ent.client.inventorySetCount( WEAP_GUNBLADE, 1 ); @item = @G_GetItem( WEAP_GUNBLADE ); // HACK for TDM: Don't let gunblades charge more than half the way @ammoItem = @G_GetItem( item.ammoTag ); if ( @ammoItem != null ) ent.client.inventorySetCount( ammoItem.tag, ammoItem.inventoryMax / 2 ); @ammoItem = @G_GetItem( item.weakAmmoTag ); if ( @ammoItem != null ) ent.client.inventorySetCount( ammoItem.tag, ammoItem.inventoryMax ); if ( match.getState() <= MATCH_STATE_WARMUP ) { for ( int i = WEAP_GUNBLADE + 1; i < WEAP_TOTAL; i++ ) { if ( i == WEAP_INSTAGUN ) // dont add instagun... continue; ent.client.inventoryGiveItem( i ); @item = @G_GetItem( i ); @ammoItem = @G_GetItem( item.ammoTag ); if ( @ammoItem != null ) ent.client.inventorySetCount( ammoItem.tag, ammoItem.inventoryMax ); @ammoItem = @G_GetItem( item.weakAmmoTag ); if ( @ammoItem != null ) ent.client.inventorySetCount( ammoItem.tag, ammoItem.inventoryMax ); } // give armor ent.client.inventoryGiveItem( ARMOR_RA ); } } // select rocket launcher if available if ( ent.client.canSelectWeapon( WEAP_ROCKETLAUNCHER ) ) ent.client.selectWeapon( WEAP_ROCKETLAUNCHER ); else ent.client.selectWeapon( -1 ); // auto-select best weapon in the inventory // add a teleportation effect ent.respawnEffect(); } // Thinking function. Called each frame void GT_ThinkRules() { if ( match.scoreLimitHit() || match.timeLimitHit() || match.suddenDeathFinished() ) { if ( !match.checkExtendPlayTime() ) match.launchState( match.getState() + 1 ); } GENERIC_DetectTeamsAndMatchNames(); if ( match.getState() >= MATCH_STATE_POSTMATCH ) return; // check maxHealth rule for ( int i = 0; i < maxClients; i++ ) { cEntity @ent = @G_GetClient( i ).getEnt(); if ( ent.client.state() >= CS_SPAWNED && ent.team != TEAM_SPECTATOR ) { if ( ent.health > ent.maxHealth ) ent.health -= ( frameTime * 0.001f ); GENERIC_ChargeGunblade( ent.client ); // HACK for TDM: Don't let gunblades charge more than half the way cItem @ammoItem = @G_GetItem( AMMO_GUNBLADE ); if ( @ammoItem != null ) { if ( ent.client.inventoryCount( AMMO_GUNBLADE ) > ( ammoItem.inventoryMax / 2 ) ) ent.client.inventorySetCount( AMMO_GUNBLADE, ammoItem.inventoryMax / 2 ); } } } } // The game has detected the end of the match state, but it // doesn't advance it before calling this function. // This function must give permission to move into the next // state by returning true. bool GT_MatchStateFinished( int incomingMatchState ) { if ( match.getState() <= MATCH_STATE_WARMUP && incomingMatchState > MATCH_STATE_WARMUP && incomingMatchState < MATCH_STATE_POSTMATCH ) match.startAutorecord(); if ( match.getState() == MATCH_STATE_POSTMATCH ) match.stopAutorecord(); return true; } // the match state has just moved into a new state. Here is the // place to set up the new state rules void GT_MatchStateStarted() { switch ( match.getState() ) { case MATCH_STATE_WARMUP: //gametype.pickableItemsMask = 0; //gametype.dropableItemsMask = 0; GENERIC_SetUpWarmup(); break; case MATCH_STATE_COUNTDOWN: //gametype.pickableItemsMask = 0; // disallow item pickup //gametype.dropableItemsMask = 0; // disallow item drop GENERIC_SetUpCountdown(); break; case MATCH_STATE_PLAYTIME: //gametype.pickableItemsMask = 0; //gametype.dropableItemsMask = 0; GENERIC_SetUpMatch(); break; case MATCH_STATE_POSTMATCH: //gametype.pickableItemsMask = 0; // disallow item pickup //gametype.dropableItemsMask = 0; // disallow item drop GENERIC_SetUpEndMatch(); break; default: break; } } // the gametype is shutting down cause of a match restart or map change void GT_Shutdown() { } // The map entities have just been spawned. The level is initialized for // playing, but nothing has yet started. void GT_SpawnGametype() { } // Important: This function is called before any entity is spawned, and // spawning entities from it is forbidden. If you want to make any entity // spawning at initialization do it in GT_SpawnGametype, which is called // right after the map entities spawning. void GT_InitGametype() { gametype.setTitle( "Rocketchef" ); gametype.setVersion( "0.02" ); gametype.setAuthor( "Der, Der mitgemacht hat!" ); // if the gametype doesn't have a config file, create it if ( !G_FileExists( "configs/server/gametypes/" + gametype.getName() + ".cfg" ) ) { cString config; // the config file doesn't exist or it's empty, create it config = "// '" + gametype.getTitle() + "' gametype configuration file\n" + "// This config will be executed each time the gametype is started\n" + "\n\n// map rotation\n" + "set g_maplist \"\" // list of maps in automatic rotation\n" + "set g_maprotation \"0\" // 0 = same map, 1 = in order, 2 = random\n" + "\n// game settings\n" + "set g_scorelimit \"0\"\n" + "set g_timelimit \"20\"\n" + "set g_warmup_enabled \"1\"\n" + "set g_warmup_timelimit \"0\"\n" + "set g_match_extendedtime \"5\"\n" + "set g_allow_falldamage \"0\"\n" + "set g_allow_selfdamage \"0\"\n" + "set g_allow_teamdamage \"0\"\n" + "set g_allow_stun \"0\"\n" + "set g_teams_maxplayers \"0\"\n" + "set g_teams_allow_uneven \"0\"\n" + "set g_countdown_time \"5\"\n" + "set g_maxtimeouts \"3\" // -1 = unlimited\n" + "set g_challengers_queue \"0\"\n" + "\necho \"" + gametype.getName() + ".cfg executed\"\n"; G_WriteFile( "configs/server/gametypes/" + gametype.getName() + ".cfg", config ); G_Print( "Created default config file for '" + gametype.getName() + "'\n" ); G_CmdExecute( "exec configs/server/gametypes/" + gametype.getName() + ".cfg silent" ); } // gametype.spawnableItemsMask = ( IT_WEAPON | IT_AMMO | IT_ARMOR | IT_POWERUP | IT_HEALTH ); // if ( gametype.isInstagib() ) // gametype.spawnableItemsMask &= ~uint(G_INSTAGIB_NEGATE_ITEMMASK); gametype.spawnableItemsMask = 0; gametype.respawnableItemsMask = 0; gametype.dropableItemsMask = 0; gametype.pickableItemsMask = 0; gametype.isTeamBased = true; gametype.isRace = false; gametype.hasChallengersQueue = false; gametype.maxPlayersPerTeam = 0; gametype.ammoRespawn = 0; gametype.armorRespawn = 0; gametype.weaponRespawn = 0; gametype.healthRespawn = 0; gametype.powerupRespawn = 0; gametype.megahealthRespawn = 0; gametype.ultrahealthRespawn = 0; gametype.readyAnnouncementEnabled = false; gametype.scoreAnnouncementEnabled = false; gametype.countdownEnabled = false; gametype.mathAbortDisabled = false; gametype.shootingDisabled = false; gametype.infiniteAmmo = false; gametype.canForceModels = true; gametype.canShowMinimap = false; gametype.teamOnlyMinimap = true; gametype.spawnpointRadius = 256; if ( gametype.isInstagib() ) gametype.spawnpointRadius *= 2; // set spawnsystem type for ( int team = TEAM_PLAYERS; team < GS_MAX_TEAMS; team++ ) gametype.setTeamSpawnsystem( team, SPAWNSYSTEM_INSTANT, 0, 0, false ); // define the scoreboard layout G_ConfigString( CS_SCB_PLAYERTAB_LAYOUT, "%n 112 %s 52 %i 36 %i 30 %i 30 %i 30 %l 40 %p 18 %p 18" ); G_ConfigString( CS_SCB_PLAYERTAB_TITLES, "Name Clan Sco Ki De TK Ping C R" ); // precache images that can be used by the scoreboard prcYesIcon = G_ImageIndex( "gfx/hud/icons/vsay/yes" ); prcShockIcon = G_ImageIndex( "gfx/hud/icons/powerup/quad" ); prcShellIcon = G_ImageIndex( "gfx/hud/icons/powerup/warshell" ); // add commands G_RegisterCommand( "drop" ); G_RegisterCommand( "gametype" ); //G_RegisterCallvote( "tdm_powerup_drop", "1 or 0", "Anables or disables the dropping of powerups at dying in tdm." ); G_Print( "Gametype '" + gametype.getTitle() + "' initialized\n" ); } PK ˆ”c<¸sÎKððprogs/gametypes/rocketchef.gt/shared/constants.as; /shared/files.as; generic/matchstates.as; generic/bots.as; generic/items.as; rocketchef.as; legacy/quake1.as; legacy/quake1_items.as; legacy/quake2_items.as; legacy/quake3_items.as; legacy_items.as; PK &?\<progs/PK ˆ c<$progs/gametypes/PK Ç“d<ùG;µQLQL Rprogs/gametypes/rocketchef.asPK ˆ”c<¸sÎKðð ÞLprogs/gametypes/rocketchef.gtPK N