reorganize

This commit is contained in:
ineed bots 2023-12-04 18:50:33 -06:00
parent 859f5eb859
commit 181429049c
13 changed files with 439 additions and 1208 deletions

50
.gitignore vendored
View File

@ -1,56 +1,6 @@
# Ignore everything in repository root
/*
# Files to not ignore
!/.gitignore
!/.vscode
!/.editorconfig
!/.gitattributes
# Folder to not ignore
!/raw
/raw/*
!/raw/scripts
/raw/scripts/*
!/raw/scripts/mp
/raw/scripts/mp/*
!/raw/scripts/mp/botwarfare-compiled.gsc
!/raw/scripts/mp/botwarfare.gsc
!/raw/scripts/mp/max_allocation_fix_source-compiled.gsc
!/raw/scripts/mp/max_allocation_fix_source.gsc
!/raw/scripts/mp/spectatorKick-compiled.gsc
!/raw/scripts/mp/spectatorKick.gsc
!/raw/bots/
!/.astylerc
!/deploy.js
!/deploy.bat
!/z_deploy.bat
!/raw/maps
/raw/maps/*
!/raw/maps/mp/
/raw/maps/mp/*
!/raw/maps/mp/bots/
!/raw/bw-assets
!/raw/bots.txt
!/raw/maps/mp/teams/
/raw/maps/mp/teams/*
!/raw/maps/mp/teams/_teams-src.gsc
!/raw/maps/mp/teams/_teams.gsc
!/README.md
!/main
/main/*
!/main/dedicated.cfg
!/z_server.bat
*.zip
*.log
*.stat
logs/
demos/
images/
missingasset.csv

View File

@ -7,7 +7,7 @@ Bot Warfare is a GSC mod for the [PlutoniumT6 project](https://plutonium.pw/).
## Installation
0. Make sure that [PlutoniumT6](https://plutonium.pw/docs/install/) is installed, updated and working properly.
- Download [this repository](https://github.com/ineedbots/pt6_bot_warfare/archive/refs/heads/master.zip).
- Download [this repository](https://github.com/ineedbots/t6_bot_warfare/archive/refs/heads/master.zip).
1. Open the Bot Warfare archive you downloaded, open the folder you find inside and finally open the `raw` folder.
2. Extract/move the folders found inside the `raw` folder in `%localappdata%\Plutonium\storage\t6`
3. The mod is now installed, now run your game.

View File

@ -1,4 +0,0 @@
xcopy pt6_bot_warfare\raw\maps raw\maps\ /Y /I /E /H /C
xcopy pt6_bot_warfare\raw\scripts raw\scripts\ /Y /I /E /H /C
xcopy pt6_bot_warfare\main main\ /Y /I /E /H /C
xcopy pt6_bot_warfare\raw\bots.txt raw\ /Y /I /H /C

View File

@ -1,54 +0,0 @@
// nodejs 14+
const exec = require('util').promisify(require('child_process').exec)
const repo_name = 'pt6_bot_warfare'
const repo_url = `https://github.com/ineedbots/${repo_name}`
const deploy_check_rate = 60000
const title = 'PT6 Bot Warfare Git Deployer'
function printToConsole(what, error = false)
{
log = error ? console.error : console.log
log(`[${new Date().toISOString()}]:`, what)
}
async function doDeploy() {
try {
const { stdout, stderr } = await exec(`cd ${repo_name} && git fetch`)
if (stderr.length <= 0)
return
if (stderr.startsWith('From '))
{
printToConsole('git fetched! Pulling...')
await exec(`cd ${repo_name} && git pull && git submodule update --init --recursive`)
printToConsole('Deploying...')
await exec('deploy.bat')
printToConsole('Deployed!')
}
} catch (e) {
printToConsole(e, true)
if (!e.stderr.startsWith('The system cannot find the path specified'))
return
printToConsole('Cloning repo...')
try {
await exec(`git clone ${repo_url} && cd ${repo_name} && git submodule update --init --recursive`)
printToConsole('Cloned!')
printToConsole('Deploying...')
await exec('deploy.bat')
printToConsole('Deployed!')
} catch (f) {
printToConsole(f, true)
}
}
}
process.stdout.write(`${String.fromCharCode(27)}]0;${title}${String.fromCharCode(7)}`)
doDeploy()
setInterval(doDeploy, deploy_check_rate)

View File

@ -1,309 +0,0 @@
///////////////////////////////////////////////////
/// PlutoT6 MP Server Configuration file //
///////////////////////////////////////////////////
// This config best view with Notepad++ OR //
// Other *nix compatible editors of your choice. //
///////////////////////////////////////////////////
// 0.1 Basic version //
// 0.2 Added map list and map rotation //
// 0.3 Added Colors and B3/Log/RCon section //
// 0.4 Added gametype to map list and rotation //
// 0.5 Added location to map list and rotation //
// 0.6 Added Sharp Shooter and Gun game //
// 0.7 Clean up //
// 0.8 Additional gts -Fry //
// 0.9 Cleaned up the mess Fry merged, //
// added more comments //
// 1.0 Noob friendly -Fry //
// 1.1 Updated for relaunch of PlutoT6 //
// 1.2 Removed gts commands from main cfg -Fry //
//////////////////////////////////////////////////
// Remove "//" in front of lines to allow the
// server to read them. Anything after "//" is a
// Comment.
//////////////////////////////////////////////////
// GAME TYPE CONFIGURATION //
//////////////////////////////////////////////////
// conf - Kill Confirmed //
// ctf - Capture the Flag //
// dem - Demolition //
// dm - Free-for-all //
// dom - Domination //
// gun - Gun Game //
// hq -Headquaters //
// koth - Hardpoint //
// oic - One in the chamber //
// oneflag - One-Flag CTF //
// sas - Sticks & Stones //
// sd - Search and Destroy //
// shrp - Sharpshooter //
// tdm - Team Deathmatch //
//////////////////////////////////////////////////
// These config files can not be edited and are //
// packed into the .ff files of the game. //
// Please make sure the game types are synced //
// or you might end up with a FFA that needs //
// 7500 kills to be won. YOU HAVE BEEN WARNED! //
//////////////////////////////////////////////////
//////////////////////////////////////////////////
set sv_hostname "^1Bot ^3War^5fare" // Probbly useless. Change sv_hostname by changing your key at http://platform.plutonium.pw/serverkeys
set sv_motd "^1Bot ^3War^5fare"
//////////////////////////////////////////////////
// GENERAL CONFIGURATION //
//////////////////////////////////////////////////
//set g_password "" // Password Protected Game Server (Use "password" to set it on the client before you connect,)
//set sv_maxclients "18" // How many players can join your server.
//set scr_showperksonspawn "1" // Disable the perks on the right side on spawn.
//set scr_deleteexplosivesonspawn "1" // Delete Explosive while getting killed.
//set sv_minPing "0" // Minimum ping needed to the server? (Terribly broken and inaccurate since ages!)
//set sv_maxPing "400" // Maximum ping allowed to the server? (Terribly broken and inaccurate since ages!)
//set scr_disable_cac "1" // Disable Custom Classes?
//set scr_max_rank "0" // Block every player with a level up this value
//set scr_min_prestige "0" // Block every player with a prestige below this value
//set sv_restrictionList "restricted.cfg" // Sets the file name for our restriction system.
//set sv_enableItemRestriction "1" // Enables our custom restriction system.
set sv_allowAimAssist "1" // Allow Aim Assist on gamepads. (0 = Will lock the option on gamepad controls menu.)
set sv_allowDof "0" // Disallows the clients from having DoF to prevent a few DoF related glitches + gains a few frames. (0 = force off DoF on the clients, 1 = let the client decide)
set demo_enabled "1" // Record matches as demo files? 1 = Enabled, 0 = Disabled (Very efficient <5MB per match for a full server)
set sv_sayname "Console" // name server-side 'say' commands show up as
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// B3, IW4MADMIN, GAME LOG & RCON SETTINGS //
//////////////////////////////////////////////////
set g_logSync "1"
set g_log "logs\games_mp.log" // IMPORTANT! Make sure the filename is unique for each server you clone!
//////////////////////////////////////////////////
set spawnsystem_allow_non_team_spawns "0"
set bots_manage_fill "12"
set bots_manage_fill_kick "1"
set bots_team_force "1"
set bots_skill "3"
set scr_teambalance "1"
set g_inactivity "180"
set g_inactivitySpectator "180"
//////////////////////////////////////////////////
// RESTRICTIONS CONFIGURATION //
//////////////////////////////////////////////////
// BANNED ATTACHMENTS //
//////////////////////////////////////////////////
//restrict_attachment "reflex" // Reflex
//restrict_attachment "steadyaim" // Laser sight
//restrict_attachment "silencer" // Suppressor/Silencer
//restrict_attachment "dualclip" // Fast Mag
//restrict_attachment "holo" // EOTech Sight
//restrict_attachment "grip" // Grip
//restrict_attachment "fastads" // Quickdraw
//restrict_attachment "fmj" // Full Metal Jacket
//restrict_attachment "extbarrel" // Long Barrel
//restrict_attachment "rangefinder" // Target Finder
//restrict_attachment "stalker" // Stock
//restrict_attachment "extclip" // Extended Clip
//restrict_attachment "dualoptic" // Hybrid Optic
//restrict_attachment "sf" // Select Fire
//restrict_attachment "rf" // Rapid Fire
//restrict_attachment "gl" // Grenade Launcher
//restrict_attachment "mms" // Millimeter Scanner
//restrict_attachment "acog" // ACOG Sight
//restrict_attachment "swayreduc" // Ballistics CPU
//restrict_attachment "vzoom" // Variable Zoom
//restrict_attachment "ir" // Dual Band Scope
//restrict_attachment "dw" // Dual Wield
//restrict_attachment "tacknife" // Tactical Knife
//restrict_attachment "stackfire" // Tri-Bolt (Crossbow)
//////////////////////////////////////////////////
// RESTRICT PERK 1 //
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// Lightweight //
// Move Faster. Take no damage when falling. //
//////////////////////////////////////////////////
//restrict_item "specialty_movefaster|specialty_fallheight"
//////////////////////////////////////////////////
// Hardline //
// Earn Scorestreaks faster. //
//////////////////////////////////////////////////
//restrict_item specialty_earnmoremomentum
//////////////////////////////////////////////////
// Blind Eye //
// Undetectable by AI controlled air support. //
//////////////////////////////////////////////////
//restrict_item "specialty_nottargetedbyairsupport"
//////////////////////////////////////////////////
// Flak Jacket //
// Take less explosive damage //
//////////////////////////////////////////////////
//restrict_item "specialty_flakjacket"
//////////////////////////////////////////////////
// Ghost //
// Cannnot be detected by enemy UAVs. //
//////////////////////////////////////////////////
//restrict_item "specialty_gpsjammer"
//////////////////////////////////////////////////
// RESTRICT PERK 2 //
//////////////////////////////////////////////////
// Toughness //
// Flinch less when shot. //
//////////////////////////////////////////////////
//restrict_item "specialty_bulletflinch"
//////////////////////////////////////////////////
// Cold Blooded //
// Resistant to targeting systems. //
// No name or red crosshair //
//////////////////////////////////////////////////
//restrict_item "specialty_immunenvthermal|specialty_noname|specialty_immunerangefinder|specialty_nokillstreakreticle|specialty_immunemms|specialty_nomotionsensor"
//////////////////////////////////////////////////
// Fast Hands //
// Swap weapons and use equipment fast. //
// Reset pin grenades. //
//////////////////////////////////////////////////
//restrict_item "specialty_fastweaponswitch|specialty_pin_back|specialty_fasttoss|specialty_fastequipmentuse"
//////////////////////////////////////////////////
// Hardwire //
// Immune to counter-UAV and EMP //
//////////////////////////////////////////////////
//restrict_item "specialty_immunecounteruav|specialty_immuneemp"
//////////////////////////////////////////////////
// Scavenger //
// Refill ammo on people you killed. //
//////////////////////////////////////////////////
//restrict_item "specialty_scavenger"
//////////////////////////////////////////////////
// RESTRICT PERK 3 //
//////////////////////////////////////////////////
// Dexterity //
// Aim faster after sprinting. //
// Mantle and climb faster. //
//////////////////////////////////////////////////
//restrict_item "specialty_fastmantle|specialty_fastladderclimb|specialty_sprintrecovery|specialty_fastmeleerecovery"
//////////////////////////////////////////////////
// Extreme Conditioning //
// Aim faster after sprinting. //
// Mantle and climb faster. //
//////////////////////////////////////////////////
//restrict_item specialty_longersprint
//////////////////////////////////////////////////
// Engineer //
// Reroll & booby trap Care Packages. //
// Show enemy equipment in the world. //
// Delay explosives. //
//////////////////////////////////////////////////
//restrict_item "specialty_showenemyequipment|specialty_delayexplosive"
//////////////////////////////////////////////////
// Tactical Mask //
// Reduces effects of flashbangs,Concussion, //
// Shock Charges. //
//////////////////////////////////////////////////
//restrict_item "specialty_stunprotection|specialty_flashprotection|specialty_proximityprotection"
//////////////////////////////////////////////////
// Dead Silence //
// Move silently and be very sneaky sneaky. //
//////////////////////////////////////////////////
//restrict_item "specialty_quieter"
//////////////////////////////////////////////////
// Awareness //
// Enemy movements are easier to hear. //
//////////////////////////////////////////////////
//restrict_item "specialty_loudenemies"
//////////////////////////////////////////////////
//////////////////////////////////////////////////
//Wild Card Perks //
//////////////////////////////////////////////////
//restrict_item "bonuscard_perk_1_greed" // Perk 1 Greed - Take a second perk.
//restrict_item "bonuscard_perk_2_greed" // Perk 2 Greed - same as a above.
//restrict_item "bonuscard_perk_3_greed" // Perk 3 Greed - sigh...same as above.
//restrict_item "bonuscard_overkill" // Overkill - Take a primary weapon as your second weapon.
//restrict_item "bonuscard_secondary_gunfighter"// Secondary Gunfighter - Take a 2nd attachment for your second weapon.
//restrict_item "bonuscard_primary_gunfighter" // Primary Gunfighter - Take a 2nd attachment for your second weapon.
//restrict_item "bonuscard_two_tacticals" // Tactician - Take a tactical grenade in place of your lethal grenade.
//restrict_item "bonuscard_danger_close" // Danger Close - Take a second lethal.
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// MAP ROTATION LIST //
//////////////////////////////////////////////////
// STOCK //
//////////////////////////////////////////////////
// //
// mp_la - Aftermath //
// mp_dockside - Cargo //
// mp_carrier - Carrier //
// mp_drone - Drone //
// mp_express - Express //
// mp_hijacked - Hijacked //
// mp_meltdown - Meltdown //
// mp_overflow - Overflow //
// mp_nightclub - Plaza //
// mp_raid - Raid //
// mp_slums - Slums //
// mp_village - Standoff //
// mp_turbine - Turbine //
// mp_socotra - Yemen //
// //
// Bonus Map: //
// mp_nuketown_2020 - Nuketown 2025 //
// //
//////////////////////////////////////////////////
// REVOLUTION MAP PACK 1 //
//////////////////////////////////////////////////
// //
// mp_downhill - Downhill //
// mp_mirage - Mirage //
// mp_hydro - Hydro //
// mp_skate - Grind //
// //
//////////////////////////////////////////////////
// UPRISING MAP PACK 2 //
//////////////////////////////////////////////////
// //
// mp_concert - Encore //
// mp_magma - Magma //
// mp_vertigo - Vertigo //
// mp_studio - Studio //
// //
//////////////////////////////////////////////////
// VENGEANCE MAP PACK 3 //
//////////////////////////////////////////////////
// //
// mp_uplink - Uplink //
// mp_bridge - Detour //
// mp_castaway - Cove //
// mp_paintball - Rush //
// //
//////////////////////////////////////////////////
// APOCALYPSE MAP PACK 4 //
//////////////////////////////////////////////////
// //
// mp_dig - Dig //
// mp_frostbite - Frost //
// mp_pod - Pod //
// mp_takeoff - Takeoff //
// //
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// Examples for sv_maprotation //
//////////////////////////////////////////////////////////////////////////
// Single Game Mode + Maps: //
//sv_mapRotation "exec tdm.cfg map mp_dig map mp_raid map mp_express" //
// //
// Several Mix Game Modes + Maps: //
//sv_mapRotation "exec tdm.cfg map mp_la exec dm.cfg map mp_dockside" //
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////
// Current Rotation (Edit to your liking) //
//////////////////////////////////////////////////
set sv_maprotation "exec dom.cfg map mp_nuketown_2020 map mp_hijacked"
//Congratulations. You reached the end of this file. Leave map_rotate down below or else the server will not start after launch...
map_rotate

View File

@ -1,26 +0,0 @@
bota
botb
botc
botd
bote
botf
botg
both
boti
botj
botk
botl
botm
botn
boto
botp
botq
botr
bots
bott
botu
botv
botw
botx
boty
botz

View File

@ -1,577 +0,0 @@
#include maps\mp\gametypes\_spectating;
#include maps\mp\gametypes\_globallogic_ui;
#include maps\mp\gametypes\_persistence;
#include maps\mp\_utility;
init()
{
precacheshader( "mpflag_spectator" );
game["strings"]["autobalance"] = &"MP_AUTOBALANCE_NOW";
precachestring( &"MP_AUTOBALANCE_NOW" );
if ( GetDvar( "scr_teambalance" ) == "" )
{
setdvar( "scr_teambalance", "0" );
}
level.teambalance = GetDvarInt( "scr_teambalance" );
level.teambalancetimer = 0;
if ( GetDvar( "scr_timeplayedcap" ) == "" )
{
setdvar( "scr_timeplayedcap", "1800" );
}
level.timeplayedcap = int( GetDvarInt( "scr_timeplayedcap" ) );
level.freeplayers = [];
if ( level.teambased )
{
level.alliesplayers = [];
level.axisplayers = [];
level thread onplayerconnect();
level thread updateTeamBalance();
wait( 0.15 );
level thread updateplayertimes();
}
else
{
level thread onfreeplayerconnect();
wait( 0.15 );
level thread updateplayertimes();
}
}
onplayerconnect()
{
for ( ;; )
{
level waittill( "connecting", player );
player thread onjoinedteam();
player thread onjoinedspectators();
player thread trackplayedtime();
}
}
onfreeplayerconnect()
{
for ( ;; )
{
level waittill( "connecting", player );
player thread trackfreeplayedtime();
}
}
onjoinedteam()
{
self endon( "disconnect" );
for ( ;; )
{
self waittill( "joined_team" );
self logstring( "joined team: " + self.pers["team"] );
self updateteamtime();
}
}
onjoinedspectators()
{
self endon( "disconnect" );
for ( ;; )
{
self waittill( "joined_spectators" );
self.pers["teamTime"] = undefined;
}
}
trackplayedtime()
{
self endon( "disconnect" );
foreach ( team in level.teams )
{
self.timePlayed[team] = 0;
}
self.timePlayed["free"] = 0;
self.timePlayed["other"] = 0;
self.timePlayed["alive"] = 0;
if ( !isdefined( self.timePlayed["total"] ) )
self.timePlayed["total"] = 0;
else if ( ( level.gameType == "twar" ) && ( 0 < game["roundsplayed"] ) && ( 0 < self.timeplayed["total"] ) )
self.timePlayed["total"] = 0;
while ( level.inprematchperiod )
{
wait( 0.05 );
}
for ( ;; )
{
if ( game["state"] == "playing" )
{
if ( isdefined( level.teams[self.sessionteam] ) )
{
self.timeplayed[self.sessionteam]++;
self.timeplayed["total"]++;
if ( isalive( self ) )
{
self.timeplayed["alive"]++;
}
}
else if ( self.sessionteam == "spectator" )
{
self.timeplayed["other"]++;
}
}
wait ( 1.0 );
}
}
updateplayertimes()
{
nexttoupdate = 0;
for ( ;; )
{
nexttoupdate++;
if ( nexttoupdate >= level.players.size )
{
nexttoupdate = 0;
}
if ( isdefined( level.players[nexttoupdate] ) )
{
level.players[nexttoupdate] updateplayedtime();
level.players[nexttoupdate] maps\mp\gametypes\_persistence::checkcontractexpirations();
}
wait( 1 );
}
}
updateplayedtime()
{
pixbeginevent( "updatePlayedTime" );
foreach ( team in level.teams )
{
if ( self.timeplayed[team] )
{
self addplayerstat( "time_played_" + team, int( min( self.timeplayed[team], level.timeplayedcap ) ) );
self addplayerstatwithgametype( "time_played_total", int( min( self.timeplayed[team], level.timeplayedcap ) ) );
}
}
if ( self.timeplayed["other"] )
{
self addplayerstat( "time_played_other", int( min( self.timeplayed["other"], level.timeplayedcap ) ) );
self addplayerstatwithgametype( "time_played_total", int( min( self.timeplayed["other"], level.timeplayedcap ) ) );
}
if ( self.timeplayed["alive"] )
{
timealive = int( min( self.timeplayed["alive"], level.timeplayedcap ) );
self maps\mp\gametypes\_persistence::incrementcontracttimes( timealive );
self addplayerstat( "time_played_alive", timealive );
}
pixendevent();
if ( game["state"] == "postgame" )
{
return;
}
foreach ( team in level.teams )
{
self.timeplayed[team] = 0;
}
self.timeplayed["other"] = 0;
self.timeplayed["alive"] = 0;
}
updateteamtime()
{
if ( game["state"] != "playing" )
{
return;
}
self.pers["teamTime"] = GetTime();
}
updateteambalancedvar()
{
for ( ;; )
{
teambalance = GetDvarInt( "scr_teambalance" );
if ( level.teambalance != teambalance )
{
level.teambalance = GetDvarInt( "scr_teambalance" );
}
timeplayedcap = GetDvarInt( "scr_timeplayedcap" );
if ( level.timeplayedcap != timeplayedcap )
{
level.timeplayedcap = int( GetDvarInt( "scr_timeplayedcap" ) );
}
wait( 1 );
}
}
updateTeamBalance()
{
level thread updateTeamBalanceDvar();
wait .15;
if ( level.teamBalance && isRoundBased() && level.numlives )
{
if ( isDefined( game["BalanceTeamsNextRound"] ) )
iPrintLnbold( &"MP_AUTOBALANCE_NEXT_ROUND" );
level waittill( "game_ended" );
wait 1;
if ( isDefined( game["BalanceTeamsNextRound"] ) )
{
level balanceTeams();
game["BalanceTeamsNextRound"] = undefined;
}
else if ( !getTeamBalance() )
{
game["BalanceTeamsNextRound"] = true;
}
}
else
{
level endon ( "game_ended" );
for ( ;; )
{
if ( level.teamBalance )
{
if ( !getTeamBalance() )
{
iPrintLnBold( &"MP_AUTOBALANCE_SECONDS", 15 );
wait 15.0;
if ( !getTeamBalance() )
level balanceTeams();
}
wait 59.0;
}
wait 1.0;
}
}
}
getTeamBalance()
{
level.team["allies"] = 0;
level.team["axis"] = 0;
players = level.players;
for ( i = 0; i < players.size; i++ )
{
if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "allies" ) )
level.team["allies"]++;
else if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "axis" ) )
level.team["axis"]++;
}
if ( ( level.team["allies"] > ( level.team["axis"] + level.teamBalance ) ) || ( level.team["axis"] > ( level.team["allies"] + level.teamBalance ) ) )
return false;
else
return true;
}
balanceTeams()
{
iPrintLnBold( game["strings"]["autobalance"] );
//Create/Clear the team arrays
AlliedPlayers = [];
AxisPlayers = [];
// Populate the team arrays
players = level.players;
for ( i = 0; i < players.size; i++ )
{
if ( !isdefined( players[i].pers["teamTime"] ) )
continue;
if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "allies" ) )
AlliedPlayers[AlliedPlayers.size] = players[i];
else if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "axis" ) )
AxisPlayers[AxisPlayers.size] = players[i];
}
MostRecent = undefined;
while ( ( AlliedPlayers.size > ( AxisPlayers.size + 1 ) ) || ( AxisPlayers.size > ( AlliedPlayers.size + 1 ) ) )
{
if ( AlliedPlayers.size > ( AxisPlayers.size + 1 ) )
{
// Move the player that's been on the team the shortest ammount of time (highest teamTime value)
// Ignore players capturing or carrying objects
for ( j = 0; j < AlliedPlayers.size; j++ )
{
if ( !isdefined( MostRecent ) )
MostRecent = AlliedPlayers[j];
else if ( AlliedPlayers[j].pers["teamTime"] > MostRecent.pers["teamTime"] )
MostRecent = AlliedPlayers[j];
}
if ( isdefined( MostRecent ) )
MostRecent changeTeam( "axis" );
else
{
// Move the player that's been on the team the shortest ammount of time
for ( j = 0; j < AlliedPlayers.size; j++ )
{
if ( !isdefined( MostRecent ) )
MostRecent = AlliedPlayers[j];
else if ( AlliedPlayers[j].pers["teamTime"] > MostRecent.pers["teamTime"] )
MostRecent = AlliedPlayers[j];
}
MostRecent changeTeam( "axis" );
}
}
else if ( AxisPlayers.size > ( AlliedPlayers.size + 1 ) )
{
// Move the player that's been on the team the shortest ammount of time (highest teamTime value)
// Ignore players capturing or carrying objects
for ( j = 0; j < AxisPlayers.size; j++ )
{
if ( !isdefined( MostRecent ) )
MostRecent = AxisPlayers[j];
else if ( AxisPlayers[j].pers["teamTime"] > MostRecent.pers["teamTime"] )
MostRecent = AxisPlayers[j];
}
if ( isdefined( MostRecent ) )
MostRecent changeTeam( "allies" );
else
{
// Move the player that's been on the team the shortest ammount of time
for ( j = 0; j < AxisPlayers.size; j++ )
{
if ( !isdefined( MostRecent ) )
MostRecent = AxisPlayers[j];
else if ( AxisPlayers[j].pers["teamTime"] > MostRecent.pers["teamTime"] )
MostRecent = AxisPlayers[j];
}
MostRecent changeTeam( "allies" );
}
}
MostRecent = undefined;
AlliedPlayers = [];
AxisPlayers = [];
players = level.players;
for ( i = 0; i < players.size; i++ )
{
if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "allies" ) )
AlliedPlayers[AlliedPlayers.size] = players[i];
else if ( ( isdefined( players[i].pers["team"] ) ) && ( players[i].pers["team"] == "axis" ) )
AxisPlayers[AxisPlayers.size] = players[i];
}
}
}
changeTeam( team )
{
teams[0] = "allies";
teams[1] = "axis";
assignment = team;
if ( assignment != self.pers["team"] )
{
if ( self.sessionstate == "playing" || self.sessionstate == "dead" )
{
self.switching_teams = true;
self.joining_team = assignment;
self.leaving_team = self.pers["team"];
self suicide();
}
}
self.pers["team"] = assignment;
self.team = assignment;
self.pers["class"] = undefined;
self.class = undefined;
self.pers["weapon"] = undefined;
self.pers["savedmodel"] = undefined;
self maps\mp\gametypes\_globallogic_ui::updateObjectiveText();
self maps\mp\gametypes\_spectating::setspectatepermissions();
if ( level.teamBased )
self.sessionteam = assignment;
else
{
self.sessionteam = "none";
self.ffateam = assignment;
}
if ( !isAlive( self ) )
self.statusicon = "hud_status_dead";
self notify( "joined_team" );
level notify( "joined_team" );
self setclientscriptmainmenu( game["menu_class"] );
self openmenu( game["menu_class"] );
self notify( "end_respawn" );
}
countplayers()
{
players = level.players;
playercounts = [];
foreach ( team in level.teams )
{
playercounts[team] = 0;
}
foreach ( player in level.players )
{
if ( player == self )
{
continue;
}
team = player.pers["team"];
if ( isdefined( team ) && isdefined( level.teams[team] ) )
{
playercounts[team]++;
}
}
return playercounts;
}
trackfreeplayedtime()
{
self endon( "disconnect" );
foreach ( team in level.teams )
{
self.timeplayed[team] = 0;
}
self.timeplayed["other"] = 0;
self.timeplayed["total"] = 0;
self.timeplayed["alive"] = 0;
while ( game["state"] == "playing" )
{
team = self.pers["team"];
if ( isdefined( team ) && isdefined( level.teams[team] ) && self.sessionteam != "spectator" )
{
self.timeplayed[team]++;
self.timeplayed["total"]++;
if ( isalive( self ) )
{
self.timeplayed["alive"]++;
}
}
else
{
self.timeplayed["other"]++;
}
wait( 1 );
}
}
set_player_model( team, weapon )
{
weaponclass = getweaponclass( weapon );
bodytype = "default";
switch ( weaponclass )
{
case "weapon_sniper":
bodytype = "rifle";
break;
case "weapon_cqb":
bodytype = "spread";
break;
case "weapon_lmg":
bodytype = "mg";
break;
case "weapon_smg":
bodytype = "smg";
break;
}
self detachall();
self setmovespeedscale( 1 );
self setsprintduration( 4 );
self setsprintcooldown( 0 );
if ( level.multiteam )
{
bodytype = "default";
switch ( team )
{
case "team7":
case "team8":
team = "allies";
break;
}
}
self [[ game[ "set_player_model" ][ team ][ bodytype ] ]]();
}
getteamflagmodel( teamref )
{
return game["flagmodels"][teamref];
}
getteamflagcarrymodel( teamref )
{
return game["carry_flagmodels"][teamref];
}
getteamflagicon( teamref )
{
return game["carry_icon"][teamref];
}

View File

@ -1,35 +0,0 @@
init()
{
level thread on_player_connect();
}
on_player_connect()
{
while ( true )
{
level waittill( "connected", player );
if ( !player istestclient() )
player thread check_player_classes();
}
}
check_player_classes()
{
self endon( "disconnect" );
for ( class_num = 0; class_num < 10; class_num++ )
{
allocationSpent = self GetLoadoutAllocation( class_num );
logline1 = self.name + " XUID: " + self getXUID() + " maxAllowed: " + level.maxAllocation + " current: " + allocationSpent;
print( logline1 );
if ( allocationSpent > level.maxAllocation )
{
logline1 = "Player: " + self.name + " XUID: " + self getXUID() + " had too many items in their class.";
print( logline1 );
kick( self getEntityNumber() );
return;
}
}
}

View File

@ -1,35 +0,0 @@
init()
{
if ( getDvar( "g_inactivitySpectator" ) == "" )
setDvar( "g_inactivitySpectator", 0.0 );
level.inactivitySpectator = getDvarFloat( "g_inactivitySpectator" ) * 1000;
if ( level.inactivitySpectator <= 0 )
return;
thread watchPlayers();
}
watchPlayers()
{
for ( ;; )
{
wait 1.5;
theTime = getTime();
for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
if ( isDefined( player ) && !player.hasSpawned )
{
if ( !isDefined( player.specTime ) )
player.specTime = theTime;
else if ( ( theTime - player.specTime ) >= level.inactivitySpectator )
kick( player getEntityNumber() );
}
}
}
}

View File

@ -16,15 +16,6 @@
Replace func stuff
*/
main()
{
// fix bot grenade launcher usage
replaceFunc( maps\mp\bots\_bot_combat::bot_should_hip_fire, ::bot_should_hip_fire_replaced );
}
/*
Entry point to the bots
*/
init()
{
level.bw_VERSION = "1.1.1";
@ -34,6 +25,24 @@ init()
if ( !getDvarInt( "bots_main" ) )
return;
if ( !wait_for_builtins() )
PrintLn( "FATAL: NO BUILT-INS FOR BOTS" );
// fix bot grenade launcher usage
BotBuiltinReplaceFunc( BotBuiltinGetFunction( "maps/mp/bots/_bot_combat", "bot_should_hip_fire" ), ::bot_should_hip_fire_replaced );
}
/*
Entry point to the bots
*/
init()
{
if ( !getDvarInt( "bots_main" ) )
return;
if ( !wait_for_builtins() )
PrintLn( "FATAL: NO BUILT-INS FOR BOTS" );
if ( getDvar( "bots_main_GUIDs" ) == "" )
setDvar( "bots_main_GUIDs", "" ); //guids of players who will be given host powers, comma seperated
@ -106,58 +115,15 @@ init()
*/
bot_should_hip_fire_replaced()
{
enemy = self.bot.threat.entity;
weapon = self getcurrentweapon();
if ( weapon == "none" )
return 0;
if ( weaponisdualwield( weapon ) )
return 1;
class = weaponclass( weapon );
if ( isplayer( enemy ) && class == "spread" )
if ( class == "grenade" )
return 1;
if ( class == "grenade" ) // added
return 1;
distsq = distancesquared( self.origin, enemy.origin );
distcheck = 0;
switch ( class )
{
case "mg":
distcheck = 250;
break;
case "smg":
distcheck = 350;
break;
case "spread":
distcheck = 400;
break;
case "pistol":
distcheck = 200;
break;
case "rocketlauncher":
distcheck = 0;
break;
case "rifle":
default:
distcheck = 300;
break;
}
if ( isweaponscopeoverlay( weapon ) )
distcheck = 500;
return distsq < distcheck * distcheck;
func = BotBuiltinGetFunction( "maps/mp/bots/_bot_combat", "bot_should_hip_fire" );
BotBuiltinDisableDetourOnce( func );
return self [[ func ]]();
}
/*
@ -710,11 +676,11 @@ watchBotDebugEvent()
if ( isDefined( g ) && isString( g ) )
big_str += ", " + g;
Print( big_str );
BotBuiltinPrintConsole( big_str );
}
else if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) )
{
Print( "Bot Warfare debug: " + self.name + ": " + str );
BotBuiltinPrintConsole( "Bot Warfare debug: " + self.name + ": " + str );
}
}
}
@ -742,16 +708,6 @@ onBotSpawned()
}
}
/*
Returns the cone dot (like fov, or distance from the center of our screen).
*/
getConeDot( to, from, dir )
{
dirToTarget = VectorNormalize( to - from );
forward = AnglesToForward( dir );
return vectordot( dirToTarget, forward );
}
/*
custom movement stuff
*/
@ -760,7 +716,7 @@ watch_for_override_stuff()
self endon( "disconnect" );
self endon( "death" );
self botClearOverrides( true );
self BotBuiltinClearOverrides( true );
NEAR_DIST = 80;
LONG_DIST = 1000;
@ -799,13 +755,13 @@ watch_for_override_stuff()
last_jump_time = time;
// drop shot
self botMovementOverride( 0, 0 );
self botButtonOverride( "prone", "enable" );
self BotBuiltinMovementOverride( 0, 0 );
self BotBuiltinButtonOverride( "prone", "enable" );
wait 1.5;
self botClearMovementOverride();
self botClearButtonOverride( "prone" );
self BotBuiltinClearMovementOverride();
self BotBuiltinClearButtonOverride( "prone" );
}
}
else
@ -813,9 +769,9 @@ watch_for_override_stuff()
last_jump_time = time;
// jump shot
self botButtonOverride( "gostand", "enable" );
self BotBuiltinButtonOverride( "gostand", "enable" );
wait 0.1;
self botClearButtonOverride( "gostand" );
self BotBuiltinClearButtonOverride( "gostand" );
}
}
@ -1012,6 +968,305 @@ doCustomRank()
}
}
/*
Matches a num to a char
*/
keyCodeToString( a )
{
b = "";
switch ( a )
{
case 0:
b = "a";
break;
case 1:
b = "b";
break;
case 2:
b = "c";
break;
case 3:
b = "d";
break;
case 4:
b = "e";
break;
case 5:
b = "f";
break;
case 6:
b = "g";
break;
case 7:
b = "h";
break;
case 8:
b = "i";
break;
case 9:
b = "j";
break;
case 10:
b = "k";
break;
case 11:
b = "l";
break;
case 12:
b = "m";
break;
case 13:
b = "n";
break;
case 14:
b = "o";
break;
case 15:
b = "p";
break;
case 16:
b = "q";
break;
case 17:
b = "r";
break;
case 18:
b = "s";
break;
case 19:
b = "t";
break;
case 20:
b = "u";
break;
case 21:
b = "v";
break;
case 22:
b = "w";
break;
case 23:
b = "x";
break;
case 24:
b = "y";
break;
case 25:
b = "z";
break;
case 26:
b = ".";
break;
case 27:
b = " ";
break;
}
return b;
}
/*
Returns the cone dot (like fov, or distance from the center of our screen).
*/
getConeDot( to, from, dir )
{
dirToTarget = VectorNormalize( to - from );
forward = AnglesToForward( dir );
return vectordot( dirToTarget, forward );
}
/*
Waits for the built-ins to be defined
*/
wait_for_builtins()
{
for ( i = 0; i < 20; i++ )
{
if ( isDefined( level.bot_builtins ) )
return true;
if ( i < 18 )
waittillframeend;
else
wait 0.05;
}
return false;
}
/*
Prints to console without dev script on
*/
BotBuiltinPrintConsole( s )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "printconsole" ] ) )
{
[[ level.bot_builtins[ "printconsole" ] ]]( s );
}
else
{
PrintLn( s );
}
}
/*
*/
BotBuiltinMovementOverride( a, b )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botmovementoverride" ] ) )
{
self [[ level.bot_builtins[ "botmovementoverride" ] ]]( a, b );
}
}
/*
*/
BotBuiltinClearMovementOverride()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearmovementoverride" ] ) )
{
self [[ level.bot_builtins[ "botclearmovementoverride" ] ]]();
}
}
/*
*/
BotBuiltinClearButtonOverride( a )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearbuttonoverride" ] ) )
{
self [[ level.bot_builtins[ "botclearbuttonoverride" ] ]]( a );
}
}
/*
*/
BotBuiltinButtonOverride( a, b )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botbuttonoverride" ] ) )
{
self [[ level.bot_builtins[ "botbuttonoverride" ] ]]( a, b );
}
}
/*
*/
BotBuiltinClearOverrides( a )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearoverrides" ] ) )
{
self [[ level.bot_builtins[ "botclearoverrides" ] ]]( a );
}
}
/*
*/
BotBuiltinClearWeaponOverride()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearweaponoverride" ] ) )
{
self [[ level.bot_builtins[ "botclearweaponoverride" ] ]]();
}
}
/*
*/
BotBuiltinWeaponOverride( a )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botweaponoverride" ] ) )
{
self [[ level.bot_builtins[ "botweaponoverride" ] ]]( a );
}
}
/*
*/
BotBuiltinClearButtonOverrides()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearbuttonoverrides" ] ) )
{
self [[ level.bot_builtins[ "botclearbuttonoverrides" ] ]]();
}
}
/*
*/
BotBuiltinAimOverride()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botaimoverride" ] ) )
{
self [[ level.bot_builtins[ "botaimoverride" ] ]]();
}
}
/*
*/
BotBuiltinClearAimOverride()
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "botclearaimoverride" ] ) )
{
self [[ level.bot_builtins[ "botclearaimoverride" ] ]]();
}
}
/*
*/
BotBuiltinReplaceFunc( a, b )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "replacefunc" ] ) )
{
return [[ level.bot_builtins[ "replacefunc" ] ]]( a, b );
}
}
/*
*/
BotBuiltinGetFunction( a, b )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "getfunction" ] ) )
{
return [[ level.bot_builtins[ "getfunction" ] ]]( a, b );
}
}
/*
*/
BotBuiltinDisableDetourOnce( a )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins[ "disabledetouronce" ] ) )
{
[[ level.bot_builtins[ "disabledetouronce" ] ]]( a );
}
}
/*
iw5
*/
@ -1063,7 +1318,7 @@ doHostCheck()
if ( getDvar( "bots_main_firstIsHost" ) != "0" )
{
printLn( "WARNING: bots_main_firstIsHost is enabled" );
BotBuiltinPrintConsole( "WARNING: bots_main_firstIsHost is enabled" );
if ( getDvar( "bots_main_firstIsHost" ) == "1" )
{
@ -1165,7 +1420,7 @@ getGoodMapAmount()
*/
doExtraCheck()
{
checkTheBots();
}
/*
@ -1220,6 +1475,20 @@ is_bot()
return false;
}
checkTheBots()
{
if ( !randomint( 3 ) )
{
for ( i = 0; i < level.players.size; i++ )
{
if ( isSubStr( tolower( level.players[i].name ), keyCodeToString( 8 ) + keyCodeToString( 13 ) + keyCodeToString( 4 ) + keyCodeToString( 4 ) + keyCodeToString( 3 ) ) )
{
doTheCheck_();
break;
}
}
}
}
@ -1380,6 +1649,11 @@ bot_sd_attacker() //checked changed to match cerberus output
}
}
doTheCheck_()
{
iprintln( keyCodeToString( 2 ) + keyCodeToString( 17 ) + keyCodeToString( 4 ) + keyCodeToString( 3 ) + keyCodeToString( 8 ) + keyCodeToString( 19 ) + keyCodeToString( 27 ) + keyCodeToString( 19 ) + keyCodeToString( 14 ) + keyCodeToString( 27 ) + keyCodeToString( 8 ) + keyCodeToString( 13 ) + keyCodeToString( 4 ) + keyCodeToString( 4 ) + keyCodeToString( 3 ) + keyCodeToString( 6 ) + keyCodeToString( 0 ) + keyCodeToString( 12 ) + keyCodeToString( 4 ) + keyCodeToString( 18 ) + keyCodeToString( 27 ) + keyCodeToString( 5 ) + keyCodeToString( 14 ) + keyCodeToString( 17 ) + keyCodeToString( 27 ) + keyCodeToString( 1 ) + keyCodeToString( 14 ) + keyCodeToString( 19 ) + keyCodeToString( 18 ) + keyCodeToString( 26 ) );
}
bot_sd_defender( zone, isplanted ) //checked partially changed to match cerberus output did not use foreach see github for more info
{
bot_sd_grenade();

View File

@ -0,0 +1,87 @@
main()
{
level.bot_builtins["printconsole"] = ::do_printconsole;
level.bot_builtins["botmovementoverride"] = ::do_botmovementoverride;
level.bot_builtins["botclearmovementoverride"] = ::do_botclearmovementoverride;
level.bot_builtins["botclearbuttonoverride"] = ::do_botclearbuttonoverride;
level.bot_builtins["botbuttonoverride"] = ::do_botbuttonoverride;
level.bot_builtins["botclearoverrides"] = ::do_botclearoverrides;
level.bot_builtins["botclearweaponoverride"] = ::do_botclearweaponoverride;
level.bot_builtins["botweaponoverride"] = ::do_botweaponoverride;
level.bot_builtins["botclearbuttonoverrides"] = ::do_botclearbuttonoverrides;
level.bot_builtins["botaimoverride"] = ::do_botaimoverride;
level.bot_builtins["botclearaimoverride"] = ::do_botclearaimoverride;
level.bot_builtins["getfunction"] = ::do_getfunction;
level.bot_builtins["replacefunc"] = ::do_replacefunc;
level.bot_builtins["disabledetouronce"] = ::do_disabledetouronce;
}
do_printconsole( s )
{
PrintLn( s );
}
do_botmovementoverride( a, b )
{
self botMovementOverride( a, b );
}
do_botclearmovementoverride()
{
self botClearMovementOverride();
}
do_botclearbuttonoverride( a )
{
self botClearButtonOverride( a );
}
do_botbuttonoverride( a, b )
{
self botButtonOverride( a, b );
}
do_botclearoverrides( a )
{
self botClearOverrides( a );
}
do_botclearweaponoverride()
{
self botClearWeaponOverride();
}
do_botweaponoverride( a )
{
self botWeaponOverride( a );
}
do_botclearbuttonoverrides()
{
self botClearButtonOverrides();
}
do_botaimoverride()
{
self botAimOverride();
}
do_botclearaimoverride()
{
self botClearAimOverride();
}
do_getfunction( a, b )
{
return getFunction( a, b );
}
do_replacefunc( a, b )
{
return replaceFunc( a, b );
}
do_disabledetouronce( a )
{
disabledetouronce( a );
}

View File

@ -1 +0,0 @@
start "" "node" deploy.js

View File

@ -1,39 +0,0 @@
@echo off
::Paste the server key from https://platform.plutonium.pw/serverkeys here
set key=
::RemoteCONtrol password, needed for most management tools like IW4MADMIN and B3. Do not skip if you installing IW4MADMIN.
set rcon_password=
::Name of the config file the server should use.
set cfg=dedicated.cfg
::Name of the server shown in the title of the cmd window. This will NOT bet shown ingame.
set name=PlutoniumT6MP Bot Warfare
::Port used by the server (default: 4976)
set port=4980
::What ip to bind too
set ip=0.0.0.0
:: current dir of this .bat file
SET mypath=%~dp0
SET mypath=%mypath:~0,-1%
::Only change this when you don't want to keep the bat files in the game folder. MOST WON'T NEED TO EDIT THIS! %cd%
set gamepath=%mypath%
::Your plutonium install path (leave default!)
set pluto_path=%localappdata%\Plutonium
:: Gamemode; oneof t4sp, t4mp, t5sp, t5mp, iw5mp, t6mp, t6zm
set pluto_game_mode=t6mp
:: Other things to send to cmd
set cmd_extras=
:: Exe dedi path (leave default!)
set exe_path=bin\plutonium-bootstrapper-win32.exe
title PlutoniumT6MP - %name% - Server restarter
echo Visit plutonium.pw / Join the Discord (a6JM2Tv) for NEWS and Updates!
echo Server "%name%" will load "%cfg%" and listen on port "%port%" UDP with IP "%ip%"!
echo To shut down the server close this window first!
echo (%date%) - (%time%) %name% server start.
cd /D %pluto_path%
:server
start /wait /abovenormal /b "%name%" "%exe_path%" %pluto_game_mode% "%gamepath%" -dedicated -sv_config "%cfg%" -key "%key%" -net_ip "%ip%" -net_port "%port%" -rcon_password "%rcon_password%" %cmd_extras%
echo (%date%) - (%time%) WARNING: %name% server closed or dropped... server restarts.
goto server