Merge branch 'NoEvo'

This commit is contained in:
ChocoTaco 2022-04-05 13:28:29 -04:00
commit b34564237b
10 changed files with 1668 additions and 511 deletions

View file

@ -8,6 +8,7 @@ $Host::AllowAdminStopVote = 1;
$Host::AllowAdminStopVotes = 1;
$Host::AllowAdminVotes = 1;
$Host::AllowMapScript = "True";
$Host::AllowPlayerTournamentModeVotekick = 0;
$Host::AllowPlayerVoteChangeMission = 1;
$Host::AllowPlayerVoteSkipMission = 1;
$Host::AllowPlayerVoteTeamDamage = 0;
@ -139,6 +140,8 @@ $Host::LoadScreenShowLogo = 0;
$Host::LoadScreenShowLogoName = "dpub/DPUB_logo";
$Host::LogIntentionalQuit = 1;
$Host::Map = "VaubanLak";
$Host::MapChangeMSG = 0;
$Host::MapChangeMSGContent = "<color:3cb4b4><font:Sui Generis:22>Pickup Night\n<color:3cb4b4><font:Univers:18>Saturday, March 5th\n<color:3cb4b4><font:Univers:16>Join discord for details";
$Host::MarkDnDObjectives = 1;
$Host::MaxBotDifficulty = 0;
$Host::MaxMessageLen = 140;

View file

@ -503,10 +503,10 @@ function CTFGame::playerTouchEnemyFlag(%game, %player, %flag)
if(%grabspeed)
{
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed);
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (Speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed);
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
if(%grabspeed > 300)
messageAll('', "~wfx/Bonuses/high-level4-blazing.wav");
@ -620,41 +620,32 @@ function CTFGame::flagCap(%game, %player)
}
}
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag?
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag?
%game.playerLostFlagTarget(%player);
if($Host::ClassicEvoStats)
{
%record = false;
%mincheck = false;
if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount)
%recordit = true;
%mincheck = true;
if(%game.totalFlagHeldTime[%flag])
{
%held2 = getSimTime() - %game.totalFlagHeldTime[%flag];
%realtime = %game.formatTime(%held2, true);
if(%client.team == 1)
%tm = %client.team;
if(%tm == 1 || %tm == 2)
{
if((%held2 < $flagstats::heldTeam1) || $flagstats::heldTeam1 == 0)
if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0)
{
if(%recordit)
if(%mincheck)
{
$flagstats::heldTeam1 = %held2;
$flagstats::realTeam1 = %realTime;
$flagstats::nickTeam1 = %client.nameBase;
}
%record = true;
}
}
else if(%client.team == 2)
{
if((%held2 < $flagstats::heldTeam2) || $flagstats::heldTeam2 == 0)
{
if(%recordit)
{
$flagstats::heldTeam2 = %held2;
$flagstats::realTeam2 = %realTime;
$flagstats::nickTeam2 = %client.nameBase;
%prevheld2 = $flagstats::heldTeam[%tm];
$flagstats::heldTeam[%tm] = %held2;
$flagstats::realTeam[%tm] = %realTime;
$flagstats::nickTeam[%tm] = %client.nameBase;
}
%record = true;
}
@ -662,18 +653,19 @@ function CTFGame::flagCap(%game, %player)
if(%record == true)
{
if(%recordit)
if(%mincheck)
{
%fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt";
export("$flagstats::*", %fileOut, false);
schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2.~wfx/misc/hunters_horde.wav");
if(%prevheld2)
%saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2";
schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav");
}
else
schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players.");
}
if(!$Host::TournamentMode)
bottomprint(%client, "You captured the flag in " @ %realTime @ " seconds", 3);
bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1);
$stats::caps[%client]++;
if($stats::caps[%client] > $stats::caps_counter)

View file

@ -730,10 +730,10 @@ function SCtFGame::playerTouchEnemyFlag(%game, %player, %flag)
if(%grabspeed)
{
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed);
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeamExcept(%client, 'MsgCTFFlagTaken', '\c2Teammate %1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageTeam(%flag.team, 'MsgCTFFlagTaken', '\c2Your flag has been taken by %1! (Speed: %5Kph)~wfx/misc/flag_taken.wav',%client.name, 0, %flag.team, %client.nameBase, %grabspeed);
messageTeam(0, 'MsgCTFFlagTaken', '\c2%1 took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
messageClient(%client, 'MsgCTFFlagTaken', '\c2You took the %2 flag. (Speed: %5Kph)~wfx/misc/flag_snatch.wav', %client.name, %teamName, %flag.team, %client.nameBase, %grabspeed);
if(%grabspeed > 300)
messageAll('', "~wfx/Bonuses/high-level4-blazing.wav");
@ -845,39 +845,32 @@ function SCtFGame::flagCap(%game, %player)
}
}
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], false); // z0dd - ZOD, 8/15/02. How long did player hold flag?
%held = %game.formatTime(getSimTime() - %game.flagHeldTime[%flag], true); // z0dd - ZOD, 8/15/02. How long did player hold flag?
%game.playerLostFlagTarget(%player);
if($Host::ClassicEvoStats)
{
%held2 = getSimTime() - %game.totalFlagHeldTime[%flag];
%realtime = %game.formatTime(%held2, true);
%record = false;
%mincheck = false;
if($TotalTeamPlayerCount >= $Host::MinFlagRecordPlayerCount)
%mincheck = true;
if(%game.totalFlagHeldTime[%flag])
{
if(%client.team == 1)
%held2 = getSimTime() - %game.totalFlagHeldTime[%flag];
%realtime = %game.formatTime(%held2, true);
%tm = %client.team;
if(%tm == 1 || %tm == 2)
{
if((%held2 < $flagstats::heldTeam1) || $flagstats::heldTeam1 == 0)
if((%held2 < $flagstats::heldTeam[%tm]) || $flagstats::heldTeam[%tm] == 0)
{
if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount)
if(%mincheck)
{
$flagstats::heldTeam1 = %held2;
$flagstats::realTeam1 = %realTime;
$flagstats::nickTeam1 = %client.nameBase;
}
%record = true;
}
}
else if(%client.team == 2)
{
if((%held2 < $flagstats::heldTeam2) || $flagstats::heldTeam2 == 0)
{
if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount)
{
$flagstats::heldTeam2 = %held2;
$flagstats::realTeam2 = %realTime;
$flagstats::nickTeam2 = %client.nameBase;
%prevheld2 = $flagstats::heldTeam[%tm];
$flagstats::heldTeam[%tm] = %held2;
$flagstats::realTeam[%tm] = %realTime;
$flagstats::nickTeam[%tm] = %client.nameBase;
}
%record = true;
}
@ -885,19 +878,19 @@ function SCtFGame::flagCap(%game, %player)
if(%record == true)
{
if($HostGamePlayerCount >= $Host::MinFlagRecordPlayerCount)
if(%mincheck)
{
%fileOut = "stats/maps/classic/" @ $CurrentMissionType @ "/" @ $CurrentMission @ ".txt";
export("$flagstats::*", %fileOut, false);
schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2.~wfx/misc/hunters_horde.wav");
if(%prevheld2)
%saved = "\c2Saved: \c3-" @ %game.formatTime(%prevheld2 - %held2, true) @ "\c2";
schedule(4000, 0, "messageAll", 'MsgCTFNewRecord', "\c2It's a new record! Time: \c3"@%realtime@"\c2 " @ %saved @ "~wfx/misc/hunters_horde.wav");
}
else
schedule(4000, 0, "messageClient", %client, '', "\c2New flag records are disabled until" SPC $Host::MinFlagRecordPlayerCount SPC "players.");
}
}
if(!$Host::TournamentMode)
bottomprint(%client, "You captured the flag in " @ %realTime @ " seconds", 3);
bottomprint(%client, "You captured the flag in" SPC %realTime SPC "seconds.", 10, 1);
$stats::caps[%client]++;
if($stats::caps[%client] > $stats::caps_counter)
@ -913,6 +906,7 @@ function SCtFGame::flagCap(%game, %player)
$stats::fastcap_client = getTaggedString(%client.name);
}
}
}
//award points to player and team
%teamName = %game.getTeamName(%flag.team);

View file

@ -11,6 +11,10 @@
// $Host::PUGPassword = "pickup";
// PUG Password is always on no matter what
// $Host::$PUGpasswordAlwaysOn = 1;
// Enable a center print between map changes
// $Host::MapChangeMSG = 0;
// Message Content
// $Host::MapChangeMSGContent = "<color:3cb4b4><font:Sui Generis:22>Pickup Night\n<color:3cb4b4><font:Univers:18>Saturday, March 5th\n<color:3cb4b4><font:Univers:16>Join discord for details";
package MissionTypeOptions
{
@ -62,6 +66,9 @@ function loadMissionStage2()
deactivatePackage(LockedTeams);
parent::loadMissionStage2();
if($Host::MapChangeMSG)
centerPrintAll($Host::MapChangeMSGContent, 12, 3);
}
};

View file

@ -4,12 +4,12 @@
//$Host::AllowAdminVotes = 1;
//$Host::AllowAdminStopVote = 1;
//$Host::AllowAdminPassVote = 1;
//$Host::AllowMapScript = "True";
//$Host::AllowPlayerVoteChangeMission = 1;
//$Host::AllowPlayerVoteSkipMission = 1;
//$Host::AllowPlayerVoteTimeLimit = 1;
//$Host::AllowPlayerVoteTournamentMode = 1;
//$Host::AllowPlayerVoteTeamDamage = 0;
//$Host::AllowPlayerTournamentModeVotekick = 0;
//Vote Delay
//Delay the ability to vote (For everyone) at the beginning of the match
@ -157,7 +157,7 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key)
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode');
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit');
if(%multipleTeams)
if(%multipleTeams && $Host::AllowPlayerVoteTeamDamage)
{
if($teamDamage)
messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage');
@ -258,6 +258,12 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
switch$(%typeName)
{
case "VoteKickPlayer":
if($Host::TournamentMode && !$Host::AllowPlayerTournamentModeVotekick) // Dont allow Votekicks in Tournament Mode
{
messageClient(%client, "", "\c2No votekicks in Tournament Mode.");
return;
}
if(%client == %arg1) // client is trying to votekick himself
return; // Use the leave button instead, pal.
@ -428,6 +434,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
%msg = %client.nameBase @ " initiated a vote to change the time limit to " @ %time SPC "minutes.";
// VoteOvertime
StartVOTimeVote(%game);
$CMHasVoted[%client.guid]++;
}
@ -494,7 +501,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
}
case "stopRunningVote":
if($VOStatus !$="InProgress") //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime
if($VOStatus !$="InProgress" || $Host::TournamentMode) //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime
{
if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote))
{
@ -1538,6 +1545,7 @@ function serverCmdClientPickedTeam(%client, %option)
if($Host::TournamentMode && %client.team !$= 0) //Added
{
messageClient( %client, '', "Teams are locked. Ask an admin to set your team." );
schedule(1000, 0, "ClearCenterPrint", %client); //So Press FIRE when ready is cleared, later down the pipe
serverCmdClientMakeObserver( %client );
}
return;

View file

@ -76,6 +76,7 @@ function DefaultGame::gameOver(%game)
// Starting a TimeVote - Sets flags so the game wont end during this vote
function StartVOTimeVote(%game)
{
if(!$Host::TournamentMode)
$VOStatus = "Starting";
}

View file

@ -15,6 +15,7 @@ $discordBot::cmdSubSplit = "%t%";
//These are set via the bot
$discordBot::monitorChannel = 0;
$discordBot::serverFeed = 1;
package discordPackage
{
@ -202,6 +203,7 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6)
sendToDiscordEmote(%msg, $discordBot::serverFeed);
}
}
function sendToDiscord(%msg,%channel)
{
if(isObject(discord) && %msg !$= "")
@ -223,14 +225,16 @@ function sendToDiscordEmote(%msg,%channel)//emote filter will be applyed used in
}
}
function discordCon(){
if(discord.lastState !$= "Connected"){
if(discord.lastState !$= "Connected" && discord.lastState !$= "Connecting"){
if(isEventPending($discordBot::reconnectEvent))
cancel($discordBot::reconnectEvent);
if(isObject(discord))
discord.delete();
new TCPObject(discord);
discord.lastState = "Connecting";
discord.connect($discordBot::IP);
//discord.connect($discordBot::IP);
discord.schedule(1000, "connect", $discordBot::IP);
//discord.schedule(5000, "send", "AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n");
}
}
function discordKill(){
@ -241,36 +245,39 @@ function discordKill(){
function discord::onDNSFailed(%this){
%this.lastState = "DNSFailed";
error(%this.lastState);
error("Discord" SPC %this.lastState);
}
function discord::onConnectFailed(%this){
%this.lastState = "ConnectFailed";
error(%this.lastState);
discord.delete();
if(isEventPending($discordBot::reconnectEvent))
cancel($discordBot::reconnectEvent);
$discordBot::reconnectEvent = schedule($discordBot::reconnectTimeout,0,"discordCon");
%this.lastState = "ConnectFailed";
error("Discord" SPC %this.lastState);
discord.delete();
}
function discord::onDNSResolved(%this){
%this.lastState = "DNSResolved";
error(%this.lastState);
error("Discord" SPC %this.lastState);
}
function discord::onConnected(%this){
discord.schedule(1000, "send", "AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n");
%this.lastState = "Connected";
error(%this.lastState);
discord.send("AUTH" @ $discordBot::cmdSplit @ $discordBot::cmdSplit @ $Host::GameName @ "\r\n");
error("Discord" SPC %this.lastState);
}
function discord::onDisconnect(%this){
%this.lastState = "Disconnected";
error(%this.lastState);
discord.delete();
if(%this.lastState $= "Connecting" && $discordBot::failCon++ < 20){
schedule(5000,0,"discordCon");
}
if(isEventPending($discordBot::reconnectEvent))
cancel($discordBot::reconnectEvent);
$discordBot::reconnectEvent = schedule($discordBot::reconnectTimeout,0,"discordCon");
%this.lastState = "Disconnected";
error("Discord" SPC %this.lastState);
discord.delete();
}
function discord::onLine(%this, %line){
@ -279,6 +286,34 @@ function discord::onLine(%this, %line){
switch$(%cmd){
//case "Discord":
//messageAll( 'MsgDiscord', '\c3Discord: \c4%1 %2',getWord(%lineStrip,1),getWords(%lineStrip,2,getWordCount(%lineStrip) -1));
case "PLOTSTOP":
$pathMaps::running = 0;
case "PLOTPLAYER":
startPlayerPlot(getWord(%lineStrip,1));
case "GETSTAT":
%var = getWord(%lineStrip,1);
%mon = getWord(%lineStrip,2);
%year = getWord(%lineStrip,3);
%game = getWord(%lineStrip,4);
%returnIndex = getWord(%lineStrip,5);
%nameList = $lData::name[%var,%game,"month",%mon,%year];
%dataList = $lData::data[%var,%game,"month",%mon,%year];
%nameList = strreplace(%nameList,"\t","%t");
%dataList = strreplace(%dataList,"\t","%t");
error("Discord" SPC "GETSTAT" SPC %var SPC %mon SPC %year SPC %game SPC %returnIndex);
discord.schedule(32,"send","SINSTAT" @ "%c%" @ %nameList @ "%c%" @ %dataList @ "%c%" @ %returnIndex @ "%c%" @ %var @ "\r\n");
case "GENSTATS":
if(!$genStatsLockout){
$genStatsLockout = 1;
%month = getWord(%lineStrip,1);
%year = getWord(%lineStrip,2);
if(%month > 0 && %year > 0){
schedule(1000, 0, "sendLDATA", %month, %year, "CTFGame");
}
}
else{
sendToDiscord("Already Building Please Wait", $discordBot::monitorChannel);
}
case "PING":
discord.send("PONG" @ $discordBot::cmdSplit @ "\r\n");
case "PINGAVG":
@ -308,20 +343,143 @@ function discord::onLine(%this, %line){
}
case "PINGLIST":
if(isObject(discord) && discord.lastState $= "Connected"){
%channel = 1;
if(ClientGroup.getCount() > 0){
for(%i = 0; %i < ClientGroup.getCount(); %i++){
%cl = ClientGroup.getObject(%i);
%ping = %cl.isAIControlled() ? 0 : %cl.getPing();
%msg = %cl.namebase @ $discordBot::cmdSubSplit @ %ping @ $discordBot::cmdSubSplit @ %i;
discord.schedule(%i*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ (%channel-1) @ $discordBot::cmdSplit @ %msg @ "\r\n");
discord.schedule(%i*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ %msg @ "\r\n");
}
discord.schedule((%i+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ (%channel-1) @ $discordBot::cmdSplit @ "msgList" @ "\r\n");
discord.schedule((%i+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "msgList" @ "\r\n");
}
}
default:
error("Bad Command" SPC %line);
error("Discord Bad Command" SPC %line);
}
}
if(!isObject(discord) && $discordBot::autoStart)
if(!isObject(discord) && $discordBot::autoStart){
discordCon();
}
function sendLDATA(%month, %year, %type){
%file = new FileObject();
RootGroup.add(%file);
%folderPath = "serverStats/LData/*.cs";
%count = getFileCount(%folderPath);
%found = 0;
for (%i = 0; %i < %count; %i++){
%filepath = findNextfile(%folderPath);
%fieldPath =strreplace(%filePath,"-","\t");
%game = getField(%fieldPath,1);
%m = getField(%fieldPath,2); // 0 path / 1 game / 2 mon / 3 year / 4 type / 5 .cs
%y = getField(%fieldPath,3);
//%lType = getField(%fieldPath,4);
if(%month $= %m && %y $= %year && %game $= %type){
%found = 1;
break;
}
}
$dtSendDataMon = %month;
$dtSendDataYear = %year;
$dtSendDataType = %type;
if(isFile(%filepath) && %found){
sendToDiscord("Building Big Stats", $discordBot::monitorChannel);
%file.OpenForRead(%filepath);
%i = 0;
while(!%file.isEOF()){
%line = %file.readLine();
if(strPos(%line,"%tguid") == -1){
discord.schedule((%i++)*32,"send","STATSDATA" @ "%c%" @ $dtSendDataMon @ "%c%" @ $dtSendDataType @ "%c%" @ %line @ "\r\n");
}
}
error("Sent LData To Discord" SPC %month SPC %year SPC %type SPC %i);
discord.schedule((%i++*32)+1000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildStats" @ $discordBot::cmdSplit @ %month @ $discordBot::cmdSplit @ %year @ $discordBot::cmdSplit @ %type @ $discordBot::cmdSplit @ "\r\n");
schedule((%i++*32)+1000, 0, "unlockStatGen");
}
else{
sendToDiscord("Error no file found", $discordBot::monitorChannel);
$genStatsLockout = 0;
}
%file.close();
%file.delete();
}
function unlockStatGen(){
$genStatsLockout = 0;
}
////////////////////////////////////////////////////////////////////////////////
//Player Path Maps
////////////////////////////////////////////////////////////////////////////////
$pathMaps::maxCount = 32000;// default point count
$pathMaps::speed = 500;
function sendPrx(%x){
for(%i = %x; %i < $prx::count && (%i - %x) < 50; %i++){
%line = $prx::data[%i];
%msg = "CDATA" @ "%c%" @ %i @ "%c%" @ %line @ "\r\n";
if(isObject(discord))
discord.send(%msg);
//discord.schedule(%i,"send",%msg);
}
if(%i < $prx::count)
schedule(128, 0, "sendPrx", %i);
else
discord.schedule(5000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildprx" @ $discordBot::cmdSplit @ $prx::terFile @ $discordBot::cmdSplit @ $prx::misFile @ "\r\n");
}
function startPlayerPlot(%count){
if(!$pathMaps::running && (($MatchStarted + $missionRunning) == 2)){
if(%count > 1000){
$pathMaps::maxCount = %count;
}
$prx::terFile = Terrain.terrainFile;
$prx::misFile = $missionName;
$prx::count = 0;
$pathMaps::running = 1;
pathMapData();
sendToDiscord("Player Plot Started" SPC $pathMaps::maxCount, $discordBot::monitorChannel);
error("Player Plot Started");
}
else{
sendToDiscord("Game Has Not Started Yet", $discordBot::monitorChannel);
}
}
function floorVector(%vec){
return mFloor(getWord(%vec,0)) SPC mFloor(getWord(%vec,1)) SPC mFloor(getWord(%vec,2));
}
function pathDataPoint(%client){
%player = %client.player;
if(isObject(%player)){
%veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0;
$prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime();
$prx::count++;
}
}
function pathMapData(){ //loop to collect player position data
for(%x = 0; %x < ClientGroup.getCount(); %x++){
%client = ClientGroup.getObject(%x);
%player = %client.player;
if(isObject(%player)){
%pos = %player.getPosition();
%fpos = floorVector(%pos);
if(%player.lpm !$= %fpos){
%veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0;
$prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime();
$prx::count++;
}
%player.lpm = %fpos;
}
}
if(!($prx::eCount++ % 10)){error("pathMapData" SPC $prx::Count);}
if($pathMaps::running && (($MatchStarted + $missionRunning) == 2) && $prx::Count < $pathMaps::maxCount){// note will stop at end of mission
schedule($pathMaps::speed, 0,"pathMapData");
}
else{
$pathMaps::running = 0;
sendToDiscord("Player Plot Processing", $discordBot::monitorChannel);
error("Player Plot Tracking Has Ended");
sendPrx(0);
}
}

View file

@ -1782,7 +1782,7 @@ function DefaultGame::clientMissionDropReady(%game, %client)
%nickTeam2 = ($flagstats::heldTeam2 ? $flagstats::nickTeam2 : "N/A");
%realTeam2 = ($flagstats::heldTeam2 ? $flagstats::realTeam2 : "N/A");
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 10, 3);
BottomPrint(%client, "Best caps on " @ $CurrentMission @ ":\n" @ getTaggedString(%game.getTeamName(1)) @ ":" SPC %nickTeam1 @ " in " @ %realTeam1 @ " seconds\n" @ getTaggedString(%game.getTeamName(2)) @ ":" SPC %nickTeam2 @ " in " @ %realTeam2 @ " seconds", 20, 3);
}
}
else

View file

@ -186,8 +186,9 @@ $Host::AllowAdminVotes = 1;
$Host::AllowPlayerVoteChangeMission = 1;
$Host::AllowPlayerVoteSkipMission = 1;
$Host::AllowPlayerVoteTimeLimit = 1;
$Host::AllowPlayerVoteTournamentMode = 0;
$Host::AllowPlayerVoteTeamDamage = 0;
$Host::AllowPlayerVoteTournamentMode = 1;
$Host::AllowPlayerVoteTeamDamage = 1;
$Host::AllowPlayerTournamentModeVotekick = 1;
$Host::NoBaseRapeEnabled = 1; //Enable or Disable No Base Rape
$Host::NoBaseRapePlayerCount = 14; //Min number players the turn off No Base Rape
$Host::AveragePings = 1; //Show Average ping in F2 menu
@ -209,6 +210,8 @@ $Host::ClassicDailyHardRestart = 0;
$Host::ClassicDailyHardRestartTime = "10\t00\tam"; //Hard Restart Server Time Ex:10am
$Host::LoadScreenShowLogo = 0; //Special Logo on LoadScreen
$Host::LoadScreenShowLogoName = "dpub/DPUB_logo"; //Logo location Filename
$Host::MapChangeMSG = 0; //Center Print between mapchanges
$Host::MapChangeMSGContent = "<color:3cb4b4><font:Sui Generis:22>Pickup Night\n<color:3cb4b4><font:Univers:16>Saturday, March 5th\n<color:3cb4b4><font:Univers:16>Join discord for details";
//LakRabbit
$Host::LakRabbitUnlimitedDJ = 1; //Unlimited disc-jumps if enabled

View file

@ -0,0 +1,991 @@
//-------------------------------------- Ammo functions
function Ammo::onCollision(%data, %obj, %col)
{
// %data = datablock of object; %obj = object number
// %col = thing that collided with object (hopefully a player)
if (%col.getDataBlock().className $= Armor)
{
%ammoName = %data.getName();
%ammoStore = %col.inv[%ammoName];
// if player has ammo pack, increase max amount of ammo
if(%col.getMountedImage($BackpackSlot) != 0)
{
if(%col.getMountedImage($BackpackSlot).getName() $= "AmmoPackImage")
%aMax = (%col.getDataBlock().max[%ammoName]) + AmmoPack.max[%ammoName];
else
%aMax = %col.getDataBlock().max[%ammoName];
}
else
%aMax = %col.getDataBlock().max[%ammoName];
if(%col.inv[%ammoName] < %aMax)
{
if( %obj.ammoStore $= "" )
%obj.ammoStore = $AmmoIncrement[ %ammoName ];
%col.incInventory(%ammoName, %obj.ammoStore);
serverPlay3D(ItemPickupSound, %col.getTransform());
%obj.respawn();
if (%col.client > 0)
messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName);
}
}
}
function GrenadeThrown::onCollision(%data, %obj, %col)
{
// nothing you can do now...
}
function HandInventory::onCollision(%data, %obj, %col)
{
// %data = datablock of object; %obj = object number
// %col = thing that collided with object (hopefully a player)
if (%col.getDataBlock().className $= Armor)
{
%ammoName = %data.getName();
%ammoStore = %col.inv[%ammoName];
// if player has ammo pack, increase max amount of ammo
if(%col.getMountedImage($BackpackSlot) != 0)
{
if(%col.getMountedImage($BackpackSlot).getName() $= "AmmoPackImage")
%aMax = (%col.getDataBlock().max[%ammoName]) + AmmoPack.max[%ammoName];
else
%aMax = %col.getDataBlock().max[%ammoName];
}
else
%aMax = %col.getDataBlock().max[%ammoName];
if(%data.isGrenade)
{
// it's a grenade -- see if it matches the type the player is carrying
%pgType = "None";
for(%x = 0; $InvGrenade[%x] !$= ""; %x++)
{
%gren = $NameToInv[$InvGrenade[%x]];
if(%col.inv[%gren] > 0)
{
%pgType = %gren;
break;
}
}
if((%pgType $= "None") || (%pgType $= %ammoName))
{
// player either has no grenades or this type of grenades -- OK to pick up more
%canPickup = true;
}
else
{
// player has a different kind of grenade -- don't pick this kind up
%canPickup = false;
}
}
else if(%data.isMine) // z0dd - ZOD, 5/19/03. Check mines too!
{
// it's a mine -- see if it matches the type the player is carrying
%pmType = "None";
for(%y = 0; $InvMine[%y] !$= ""; %y++)
{
%mine = $NameToInv[$InvMine[%y]];
if(%col.inv[%mine] > 0)
{
%pmType = %mine;
break;
}
}
if((%pmType $= "None") || (%pmType $= %ammoName))
{
// player either has no mines or this type of mine -- OK to pick up more
%canPickup = true;
}
else
{
// player has a different kind of mine -- don't pick this kind up
%canPickup = false;
}
}
else
%canPickup = true;
if(%canPickup)
{
if(%col.inv[%ammoName] < %aMax)
{
//-------------------------------------------------------------------------------------------
// z0dd - ZOD, 4/17/02. Don't allow player to pickup full ammo if they tossed less than full.
if( %obj.ammoStore $= "" )
%obj.ammoStore = $AmmoIncrement[ %ammoName ];
%col.incInventory(%ammoName, %obj.ammoStore);
//-------------------------------------------------------------------------------------------
serverPlay3D(ItemPickupSound, %col.getTransform());
//Item respawn fix
if (%obj.isStatic())
%obj.respawn();
else
%obj.delete();
if (%col.client > 0)
messageClient(%col.client, 'MsgItemPickup', '\c0You picked up %1.', %data.pickUpName);
}
}
}
}
//-------------------------------------- Specific turret functions
function SentryTurret::onAdd(%data, %obj)
{
Parent::onAdd(%data, %obj);
//error("error");
%obj.mountImage(%data.barrel, 0, true);
}
function TurretDeployedCamera::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.mountImage(DeployableCameraBarrel, 0, true);
%obj.setRechargeRate(%this.rechargeRate);
%obj.setAutoFire(false); // z0dd - ZOD, 4/17/02. Server crash fix related to controlable cameras
}
function TurretDeployedCamera::onDestroyed(%this, %obj, %prevState)
{
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, DeployedCamera]--;
// doesn't seem to delete itself, so...
%obj.schedule(500, "delete");
}
function ScoutFlyer::onTrigger(%data, %obj, %trigger, %state)
{
// data = ScoutFlyer datablock
// obj = ScoutFlyer object number
// trigger = 0 for "fire", 1 for "jump", 3 for "thrust"
// state = 1 for firing, 0 for not firing
if(%trigger == 0)
{
switch (%state) {
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
case 1:
%obj.fireWeapon = true;
if(%obj.nextWeaponFire == 2) {
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(3, false);
}
else {
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, true);
}
}
}
}
function ScoutFlyer::playerDismounted(%data, %obj, %player)
{
%obj.fireWeapon = false;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
setTargetSensorGroup(%obj.getTarget(), %obj.team);
if( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, true );
}
function ScoutChaingunImage::onFire(%data,%obj,%slot)
{
// obj = ScoutFlyer object number
// slot = 2
Parent::onFire(%data,%obj,%slot);
%obj.nextWeaponFire = 3;
schedule(%data.fireTimeout, 0, "fireNextGun", %obj);
}
function ScoutChaingunPairImage::onFire(%data,%obj,%slot)
{
// obj = ScoutFlyer object number
// slot = 3
Parent::onFire(%data,%obj,%slot);
%obj.nextWeaponFire = 2;
schedule(%data.fireTimeout, 0, "fireNextGun", %obj);
}
function fireNextGun(%obj)
{
if(%obj.fireWeapon)
{
if(%obj.nextWeaponFire == 2)
{
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(3, false);
}
else
{
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, true);
}
}
else
{
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
}
}
function ScoutChaingunImage::onTriggerDown(%this, %obj, %slot)
{
}
function ScoutChaingunImage::onTriggerUp(%this, %obj, %slot)
{
}
function ScoutChaingunImage::onMount(%this, %obj, %slot)
{
// %obj.setImageAmmo(%slot,true);
}
function ScoutChaingunPairImage::onMount(%this, %obj, %slot)
{
// %obj.setImageAmmo(%slot,true);
}
function ScoutChaingunImage::onUnmount(%this,%obj,%slot)
{
}
function ScoutChaingunPairImage::onUnmount(%this,%obj,%slot)
{
}
function BomberTurret::onDamage(%data, %obj)
{
%newDamageVal = %obj.getDamageLevel();
if(%obj.lastDamageVal !$= "")
if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
%obj.getObjectMount().setDamageLevel(%newDamageVal);
%obj.lastDamageVal = %newDamageVal;
}
function BomberTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
{
//If vehicle turret is hit then apply damage to the vehicle
%vehicle = %targetObject.getObjectMount();
if(%vehicle)
%vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
}
function VehicleTurret::onEndSequence(%data, %obj, %thread)
{
if($DeployThread == %thread)
%obj.stopThread($DeployThread);
}
function BomberTurret::onTrigger(%data, %obj, %trigger, %state)
{
//error("onTrigger: trigger = " @ %trigger @ ", state = " @ %state);
//error("obj = " @ %obj @ ", class " @ %obj.getClassName());
switch (%trigger)
{
case 0:
%obj.fireTrigger = %state;
if(%obj.selectedWeapon == 1)
{
%obj.setImageTrigger(4, false);
if(%obj.getImageTrigger(6))
{
%obj.setImageTrigger(6, false);
ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj);
}
if(%state)
%obj.setImageTrigger(2, true);
else
%obj.setImageTrigger(2, false);
}
else if(%obj.selectedWeapon == 2)
{
%obj.setImageTrigger(2, false);
if(%obj.getImageTrigger(6))
{
%obj.setImageTrigger(6, false);
ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj);
}
if(%state)
%obj.setImageTrigger(4, true);
else
%obj.setImageTrigger(4, false);
}
else
{
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, false);
if(%state)
%obj.setImageTrigger(6, true);
else
{
%obj.setImageTrigger(6, false);
BomberTargetingImage::deconstruct(%obj.getMountedImage(6), %obj);
}
}
case 2:
if(%state)
{
%obj.getDataBlock().playerDismount(%obj);
}
}
}
function BomberTurret::playerDismount(%data, %obj)
{
//Passenger Exiting
%obj.fireTrigger = 0;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, false);
if(%obj.getImageTrigger(6))
{
%obj.setImageTrigger(6, false);
ShapeBaseImageData::deconstruct(%obj.getMountedImage(6), %obj);
}
%client = %obj.getControllingClient();
%client.player.isBomber = false;
commandToClient(%client, 'endBomberSight');
// %client.player.setControlObject(%client.player);
%client.player.mountVehicle = false;
// %client.player.getDataBlock().doDismount(%client.player);
//turret auto fire if ai mounted, if ai, %client = -1 - Lagg...
if (%client > 0)
{
if(%client.player.getState() !$= "Dead")
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
}
setTargetSensorGroup(%obj.getTarget(), 0);
setTargetNeverVisMask(%obj.getTarget(), 0xffffffff);
}
//function BomberTurret::getHudNum(%data, %num)
//{
// if(%num == 1)
// return 0;
// else
// return 4;
//}
function AIAimingTurretBarrel::onFire(%this,%obj,%slot)
{
}
function BomberBombImage::onUnmount(%this,%obj,%slot)
{
}
function BomberBombPairImage::onUnmount(%this,%obj,%slot)
{
}
function BomberTurretBarrel::firePair(%this, %obj, %slot)
{
%obj.setImageTrigger( 3, true);
}
function BomberTurretBarrelPair::stopFire(%this, %obj, %slot)
{
%obj.setImageTrigger( 3, false);
}
function BomberTurretBarrelPair::onMount(%this, %obj, %slot)
{
// %obj.setImageAmmo(%slot,true);
}
function BomberTurretBarrel::onMount(%this, %obj, %slot)
{
// %obj.setImageAmmo(%slot,true);
}
function BomberBombImage::firePair(%this, %obj, %slot)
{
%obj.setImageTrigger( 5, true);
}
function BomberBombPairImage::stopFire(%this, %obj, %slot)
{
%obj.setImageTrigger( 5, false);
}
function BomberBombPairImage::onMount(%this, %obj, %slot)
{
// %obj.setImageAmmo(%slot,true);
}
function BomberBombImage::onMount(%this, %obj, %slot)
{
}
function BomberBombImage::onUnmount(%this,%obj,%slot)
{
}
function BomberBombPairImage::onUnmount(%this,%obj,%slot)
{
}
function MobileTurretBase::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
setTargetSensorGroup(%obj.target, %obj.team);
// setTargetNeverVisMask(%obj.target, 0xffffffff); // z0dd - ZOD, 4/17/02. Causes mpb sensor to be shown in middle of map on cmd screen instead of MPB as origin. no idea why
}
function MobileTurretBase::onDamage(%data, %obj)
{
%newDamageVal = %obj.getDamageLevel();
if(%obj.lastDamageVal !$= "")
if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
%obj.getObjectMount().setDamageLevel(%newDamageVal);
%obj.lastDamageVal = %newDamageVal;
}
function MobileTurretBase::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
{
//If vehicle turret is hit then apply damage to the vehicle
%vehicle = %targetObject.getObjectMount();
if(%vehicle)
%vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
}
function MobileTurretBase::onEndSequence(%data, %obj, %thread)
{
//Used so that the parent wont be called..
}
function AssaultPlasmaTurret::onDamage(%data, %obj)
{
%newDamageVal = %obj.getDamageLevel();
if(%obj.lastDamageVal !$= "")
if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
%obj.getObjectMount().setDamageLevel(%newDamageVal);
%obj.lastDamageVal = %newDamageVal;
}
function AssaultPlasmaTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
{
//If vehicle turret is hit then apply damage to the vehicle
%vehicle = %targetObject.getObjectMount();
if(%vehicle)
%vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
}
function AssaultPlasmaTurret::onTrigger(%data, %obj, %trigger, %state)
{
switch (%trigger) {
case 0:
%obj.fireTrigger = %state;
if(%obj.selectedWeapon == 1)
{
%obj.setImageTrigger(4, false);
if(%state)
%obj.setImageTrigger(2, true);
else
%obj.setImageTrigger(2, false);
}
else
{
%obj.setImageTrigger(2, false);
if(%state)
%obj.setImageTrigger(4, true);
else
%obj.setImageTrigger(4, false);
}
case 2:
if(%state)
{
%obj.getDataBlock().playerDismount(%obj);
}
}
}
function AssaultPlasmaTurret::playerDismount(%data, %obj)
{
//Passenger Exiting
%obj.fireTrigger = 0;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, false);
%client = %obj.getControllingClient();
// %client.setControlObject(%client.player);
//turret auto fire if ai mounted, if ai, %client = -1 - Lagg...
if (%client > 0)
{
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
}
%client.player.mountVehicle = false;
setTargetSensorGroup(%obj.getTarget(), 0);
setTargetNeverVisMask(%obj.getTarget(), 0xffffffff);
// %client.player.getDataBlock().doDismount(%client.player);
}
//function AssaultPlasmaTurret::getHudNum(%data, %num)
//{
// if(%num == 1)
// return 1;
// else
// return 3;
//}
// ------------------------------------------
// camera functions
// ------------------------------------------
$CameraDeployTime = 1000;
$CameraDeployCheckMax = 6;
$CameraMinVelocity = 0.1;
function CameraGrenadeThrown::onThrow(%this, %gren)
{
// schedule a check to see if the camera is at rest but not deployed
%gren.checkCount = 0;
%gren.velocCheck = %this.schedule($CameraDeployTime, "checkCameraDeploy", %gren);
}
function CameraGrenadeThrown::onStickyCollision(%data, %obj)
{
cancel(%obj.velocCheck);
%pos = %obj.getLastStickyPos();
%norm = %obj.getLastStickyNormal();
%intAngle = getTerrainAngle(%norm); // staticShape.cs
%rotAxis = vectorNormalize(vectorCross(%norm, "0 0 1"));
if (getWord(%norm, 2) == 1 || getWord(%norm, 2) == -1)
%rotAxis = vectorNormalize(vectorCross(%norm, "0 1 0"));
%rotation = %rotAxis @ " " @ %intAngle;
%dcSucc = activateCamera(%pos, %rotation, %obj.sourceObject, %obj.sourceObject.team);
if(%dcSucc == 0)
messageClient(%obj.sourceObject.client, 'MsgDeployFailed', '\c2Your team\'s control network has reached its capacity for this item.~wfx/misc/misc.error.wav');
%obj.schedule(50,"delete");
}
function CameraGrenadeThrown::checkCameraDeploy(%this, %gren)
{
%gren.checkCount++;
if(VectorLen(%gren.getVelocity()) < $CameraMinVelocity)
{
// camera has come to rest but not deployed -- probably on a staticshape (station, gen, etc)
// no resolution, so get rid of it
%gren.schedule(50, "delete");
}
else if(%gren.checkCount >= $CameraDeployCheckMax)
{
// camera's still moving but it's been check several times -- it was thrown from too great
// a height or off the edge of the world -- delete it
%gren.schedule(50, "delete");
}
else
{
// check back in a little while
%gren.velocCheck = %this.schedule($CameraDeployTime, "checkCameraDeploy", %gren);
}
}
function activateCamera(%position, %rotation, %sourceObj, %team)
{
if($TeamDeployedCount[%team, DeployedCamera] >= $TeamDeployableMax[DeployedCamera])
{
// team has too many cameras deployed already, don't deploy this one
return 0;
}
%dCam = new Turret()
{
dataBlock = "TurretDeployedCamera";
team = %team;
needsNoPower = true;
owner = %sourceObj.client;
ownerHandle = %sourceObj.client.handle;
position = %position;
rotation = %rotation;
};
addToDeployGroup(%dCam);
if(%dCam.getTarget() != -1)
setTargetSensorGroup(%dCam.getTarget(), %team);
%dCam.playAudio($DeploySound, CameraGrenadeAttachSound);
%dCam.deploy();
%dCam.playThread($AmbientThread, "ambient");
// increment team's deployed count for cameras
$TeamDeployedCount[%team, DeployedCamera]++;
return 1;
}
function FlareGrenade::onUse(%this, %obj)
{
// a stripped-down version of HandInventory::onUse from weapons.cs
if(Game.handInvOnUse(%data, %obj)) {
%obj.decInventory(%this, 1);
%p = new FlareProjectile() {
dataBlock = FlareGrenadeProj;
initialDirection = %obj.getEyeVector();
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%p.schedule(6000, "delete");
// miscellaneous grenade-throwing cleanup stuff
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
// uncomment when explosion type can be set from script (dont want underwater explosion here)
//function grenadeOnEnterLiquid(%data, %obj, %coverage, %type, %flash)
//{
// // 4: Lava
// // 5: Hot Lava
// // 6: Crusty Lava
// if(%type >=4 && %type <= 6)
// {
// if(%obj.getDamageState() !$= "Destroyed")
// {
// cancel(%obj.detThread);
// if(%flash)
// detonateFlashGrenade(%obj);
// else
// detonateGrenade(%obj);
// return(true);
// }
// }
//
// // flash grenades do not ignore quicksand
// if((%type == 7) && !%flash)
// return(true);
//
// return(false);
//}
function GrenadeThrown::onThrow(%this, %gren)
{
AIGrenadeThrown(%gren);
%gren.detThread = schedule(1500, %gren, "detonateGrenade", %gren);
}
//function GrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
//{
// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, false))
// Parent::onEnterLiquid(%data, %obj, %coverage, %type);
//}
function ConcussionGrenadeThrown::onThrow(%this, %gren)
{
AIGrenadeThrown(%gren);
%gren.detThread = schedule(2000, %gren, "detonateGrenade", %gren);
}
//function ConcussionGrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
//{
// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, false))
// Parent::onEnterLiquid(%data, %obj, %coverage, %type);
//}
function detonateGrenade(%obj)
{
%obj.setDamageState(Destroyed);
%data = %obj.getDataBlock();
RadiusExplosion( %obj, %obj.getPosition(), %data.damageRadius, %data.indirectDamage,
%data.kickBackStrength, %obj.sourceObject, %data.radiusDamageType);
%obj.schedule(500,"delete");
}
function FlashGrenadeThrown::onThrow(%this, %gren)
{
%gren.detThread = schedule(2000, %gren, "detonateFlashGrenade", %gren);
}
//function FlashGrenadeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
//{
// if(!grenadeOnEnterLiquid(%data, %obj, %coverage, %type, true))
// Parent::onEnterLiquid(%data, %obj, %coverage, %type);
//}
function detonateFlashGrenade(%hg)
{
%maxWhiteout = %hg.getDataBlock().maxWhiteout;
%thrower = %hg.sourceObject.client;
%hg.setDamageState(Destroyed);
%hgt = %hg.getTransform();
%plX = firstword(%hgt);
%plY = getWord(%hgt, 1);
%plZ = getWord(%hgt, 2);
%pos = %plX @ " " @ %plY @ " " @ %plZ;
//all this stuff below ripped from projectiles.cs
InitContainerRadiusSearch(%pos, 100.0, $TypeMasks::PlayerObjectType |
$TypeMasks::TurretObjectType);
while ((%damage = containerSearchNext()) != 0)
{
%dist = containerSearchCurrDist();
%eyeXF = %damage.getEyeTransform();
%epX = firstword(%eyeXF);
%epY = getWord(%eyeXF, 1);
%epZ = getWord(%eyeXF, 2);
%eyePos = %epX @ " " @ %epY @ " " @ %epZ;
%eyeVec = %damage.getEyeVector();
// Make sure we can see the thing...
if (ContainerRayCast(%eyePos, %pos, $TypeMasks::TerrainObjectType |
$TypeMasks::InteriorObjectType |
$TypeMasks::StaticObjectType, %damage) !$= "0")
{
continue;
}
%distFactor = 1.0;
if (%dist >= 100)
%distFactor = 0.0;
else if (%dist >= 20) {
%distFactor = 1.0 - ((%dist - 20.0) / 80.0);
}
%dif = VectorNormalize(VectorSub(%pos, %eyePos));
%dot = VectorDot(%eyeVec, %dif);
%difAcos = mRadToDeg(mAcos(%dot));
%dotFactor = 1.0;
if (%difAcos > 60)
%dotFactor = ((1.0 - ((%difAcos - 60.0) / 120.0)) * 0.2) + 0.3;
else if (%difAcos > 45)
%dotFactor = ((1.0 - ((%difAcos - 45.0) / 15.0)) * 0.5) + 0.5;
%totalFactor = %dotFactor * %distFactor;
%prevWhiteOut = %damage.getWhiteOut();
if(!%prevWhiteOut)
if(!$teamDamage)
{
if(%damage.client != %thrower && %damage.client.team == %thrower.team)
messageClient(%damage.client, 'teamWhiteOut', '\c1You were hit by %1\'s whiteout grenade.', getTaggedString(%thrower.name));
}
%whiteoutVal = %prevWhiteOut + %totalFactor;
if(%whiteoutVal > %maxWhiteout)
{
//error("whitout at max");
%whiteoutVal = %maxWhiteout;
}
//bot cheat! don't blind the thrower - Lagg... 1-8-2004
if (%damage.client == %thrower && %thrower.isAIControlled())
continue;
%damage.setWhiteOut( %whiteoutVal );
}
%hg.schedule( 500, "delete" );
}
// ----------------------------------------------
// mine functions
// ----------------------------------------------
function MineDeployed::onThrow(%this, %mine, %thrower)
{
%mine.armed = false;
%mine.damaged = 0;
%mine.detonated = false;
%mine.depCount = 0;
%mine.theClient = %thrower.client;
$TeamDeployedCount[%mine.sourceObject.team, MineDeployed]++; // z0dd - ZOD, 8/13/02, Moved this from deployMineCheck to here. Fixes mine count bug
schedule(1500, %mine, "deployMineCheck", %mine, %thrower);
}
function deployMineCheck(%mineObj, %player)
{
if(%mineObj.depCount > %mineObj.getDatablock().maxDepCount)
explodeMine(%mineObj, true);
// wait until the mine comes to rest
if(%mineObj.getVelocity() $= "0 0 0")
{
// 2-second delay before mine is armed -- let deploy thread play out etc.
schedule(%mineObj.getDatablock().armTime, %mineObj, "armDeployedMine", %mineObj);
// check for other deployed mines in the vicinity
InitContainerRadiusSearch(%mineObj.getWorldBoxCenter(), %mineObj.getDatablock().spacing, $TypeMasks::ItemObjectType);
while((%itemObj = containerSearchNext()) != 0)
{
if(%itemObj == %mineObj)
continue;
%ioType = %itemObj.getDatablock().getName();
if(%ioType $= "MineDeployed")
schedule(100, %mineObj, "explodeMine", %mineObj, true);
else
continue;
}
// play "deploy" thread
%mineObj.playThread(0, "deploy");
serverPlay3D(MineDeploySound, %mineObj.getTransform());
%mineTeam = %mineObj.sourceObject.team;
//$TeamDeployedCount[%mineTeam, MineDeployed]++; // z0dd - ZOD, 8/13/02, Moved the increment to MineDeployed::onThrow. Fixes mine count bug
if($TeamDeployedCount[%mineTeam, MineDeployed] > $TeamDeployableMax[MineDeployed])
{
messageClient( %player.client, '', 'Maximum allowable mines deployed.' );
schedule(100, %mineObj, "explodeMine", %mineObj, true);
}
else
{
//start the thread that keeps checking for objects near the mine...
mineCheckVicinity(%mineObj);
//let the AI know *after* it's come to rest...
AIDeployMine(%mineObj);
//let the game know there's a deployed mine
Game.notifyMineDeployed(%mineObj);
}
}
else
{
//schedule this deploy check again a little later
%mineObj.depCount++;
schedule(500, %mineObj, "deployMineCheck", %mineObj, %player);
}
}
function armDeployedMine(%mine)
{
%mine.armed = true;
}
function mineCheckVicinity(%mine)
{
// this function is called after the mine has been deployed. It will check the
// immediate area around the mine (2.5 meters at present) for players or vehicles
// passing by, and detonate if any are found. This is to extend the range of the
// mine so players don't have to collide with them to set them off.
// don't bother to check if mine isn't armed yet
if(%mine.armed)
{
// don't keep checking if mine is already detonating
if(!%mine.boom)
{
// the actual check for objects in the area
%mineLoc = %mine.getWorldBoxCenter();
%masks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType;
%detonateRange = %mine.getDatablock().proximity;
%noExplode = 0;
InitContainerRadiusSearch(%mineLoc, %detonateRange, %masks);
while((%tgt = containerSearchNext()) != 0)
{
if(!$TeamDamage)
{
if(%mine.team == %tgt.team)
%noExplode = 1;
}
if(%noExplode == 0)
{
%mine.detonated = true;
schedule(50, %mine, "explodeMine", %mine, false);
break;
}
}
}
}
// if nothing set off the mine, schedule another check
if(!%mine.detonated)
schedule(300, %mine, "mineCheckVicinity", %mine);
}
function MineDeployed::onCollision(%data, %obj, %col)
{
// don't detonate if mine isn't armed yet
if(!%obj.armed)
return;
// don't detonate if mine is already detonating
if(%obj.boom)
return;
%noExplode = 0;
//check to see what it is that collided with the mine
%struck = %col.getClassName();
if(%struck $= "Player" || %struck $= "WheeledVehicle" || %struck $= "FlyingVehicle")
{
if(!$teamDamage)
{
if(%obj.team == %col.getOwnerClient().team)
%noExplode = 1;
}
if(%noExplode == 0)
{
//error("Mine detonated due to collision with #"@%col@" ("@%struck@"); armed = "@%obj.armed);
explodeMine(%obj, false);
}
}
}
function explodeMine(%mo, %noDamage)
{
%mo.noDamage = %noDamage;
%mo.setDamageState(Destroyed);
}
function MineDeployed::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
// -----------------------------
// z0dd - ZOD, 5/09/04. If gameplay changes in affect, no mine disc
if($Host::ClassicLoadMineChanges)
{
if(!%targetObject.armed)
return;
}
// -----------------------------
if(%targetObject.boom)
return;
%targetObject.damaged += %amount;
if(%targetObject.damaged >= %data.maxDamage)
{
%targetObject.setDamageState(Destroyed);
}
}
function MineDeployed::onDestroyed(%data, %obj, %lastState)
{
%obj.boom = true;
%mineTeam = %obj.team;
$TeamDeployedCount[%mineTeam, MineDeployed]--;
// %noDamage is a boolean flag -- don't want to set off all other mines in
// vicinity if there's a "mine overload", so apply no damage/impulse if true
if(!%obj.noDamage)
RadiusExplosion(%obj,
%obj.getPosition(),
%data.damageRadius,
%data.indirectDamage,
%data.kickBackStrength,
%obj.sourceObject,
%data.radiusDamageType);
%obj.schedule(600, "delete");
}