Watch Only Mode

This commit is contained in:
ChocoTaco 2023-04-16 16:12:36 -04:00
parent 9e87ca02a0
commit 0127da46b4
4 changed files with 36 additions and 20 deletions

View file

@ -86,7 +86,9 @@ function Observer::onTrigger(%data, %obj, %trigger, %state)
if(%client.observeClient != -1)
{
observerFollowUpdate(%client, -1, false);
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
if(!%client.isAdmin && !%client.isWatchOnly){
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
}
%client.observeClient = -1;
}
%obj.mode = "observerFly";
@ -219,7 +221,9 @@ function observeFlag(%client, %target, %type, %flagTeam)
if(%client.observeClient != -1)
{
observerFollowUpdate(%client, -1, false);
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
if(!%client.isAdmin && !%client.isWatchOnly){
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
}
%client.observeClient = -1;
}
}
@ -246,10 +250,12 @@ function observeFlag(%client, %target, %type, %flagTeam)
observerFollowUpdate(%client, %target, true);
displayObserverHud(%client, %target);
messageClient(%target, 'Observer', '\c1%1 is now observing you.', %client.name);
if(!%client.isAdmin && !%client.isWatchOnly){
messageClient(%target, 'Observer', '\c1%1 is now observing you.', %client.name);
}
// was the client observing a player before?
if(%client.observeClient != -1)
if(%client.observeClient != -1 && !%client.isAdmin && !%client.isWatchOnly)
messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
%client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player);

View file

@ -2340,7 +2340,7 @@ function dtGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5){
serverCmdObserveClient(%client, %targetClient);
displayObserverHud(%client, %targetClient);
if (%targetClient != %prevObsClient)
if (!%client.isAdmin && !%client.isWatchOnly && %targetClient != %prevObsClient)
{
messageClient(%targetClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
@ -3596,9 +3596,9 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini
%dtStats.skin = getTaggedString(%client.skin);
%dtStats.race = %client.race;
%dtStats.sex = %client.sex;
%dtStats.voice = %client.voice;
%dtStats.sex = %client.sex;
%dtStats.voice = %client.voice;
%dtStats.joinPCT = (isGameRun() == 1) ? %game.getGamePct() : 0;
updateTeamTime(%dtStats, -1);
%dtStats.team = %client.team;// should be 0
@ -4403,7 +4403,7 @@ function incGameStats(%dtStats,%game) {// record that games stats and inc by one
case "Min":
%val = getDynamicField(%dtStats,%varName);
setValueField(%dtStats,%varNameType,"g",%game,%c,%val);
for(%x = 1; %x <= 9; %x+=2){
%t = getField(%dtStats.gameStats[%varNameType,"t",%game],%x);
if(%val < %t && %val != 0 || !%t){ setValueField(%dtStats,%varNameType,"t",%game,%x,%val);}
@ -9522,7 +9522,7 @@ function testVarsRandomAll(%max){
//
// 9.5
// Removed Map Stats
// Removed all stat menus other then leaderboard stuff and server panel
// Removed all stat menus other then leaderboard stuff and server panel
// Made Live Stats Admin only its useful for testing stats
// Changed stats compile speed to 64ms with map stats gone
// Extra stats for player model

View file

@ -80,7 +80,7 @@ function Observer::onTrigger(%data,%obj,%trigger,%state)
serverCmdObserveClient(%client, -1);
displayObserverHud(%client, %client.observeClient);
if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
if(!%client.isAdmin && !%client.isWatchOnly) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
@ -172,7 +172,7 @@ function Observer::onTrigger(%data,%obj,%trigger,%state)
observerFollowUpdate( %client, %client.observeClient, false );
displayObserverHud(%client, %client.observeClient);
if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
if(!%client.isAdmin && !%client.isWatchOnly) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
@ -224,7 +224,7 @@ function Observer::onTrigger(%data,%obj,%trigger,%state)
observerFollowUpdate( %client, %client.observeClient, false );
displayObserverHud(%client, %client.observeClient);
if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
if(!%client.isAdmin && !%client.isWatchOnly) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name);
}
@ -265,7 +265,7 @@ function Observer::onTrigger(%data,%obj,%trigger,%state)
//send the message(s)
displayObserverHud(%client, %nextClient);
if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
if(!%client.isAdmin && !%client.isWatchOnly) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
{
messageClient(%nextClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);
@ -305,7 +305,7 @@ function Observer::onTrigger(%data,%obj,%trigger,%state)
}
//send the message(s)
displayObserverHud(%client, %prevClient);
if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
if(!%client.isAdmin && !%client.isWatchOnly) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching.
{
messageClient(%prevClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);

20
Classic/scripts/defaultGame.cs Executable file → Normal file
View file

@ -1162,7 +1162,7 @@ function DefaultGame::forceObserver( %game, %client, %reason )
%scheduleAutoKick = true;
}
if(%scheduleAutoKick && !%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout)
if(%scheduleAutoKick && !%client.isAdmin && !%client.isWatchOnly && !$Host::TournamentMode && $Host::KickObserverTimeout)
{
if(isEventPending(%client.okschedule))
cancel(%client.okschedule);
@ -1204,11 +1204,21 @@ function DefaultGame::forceObserver( %game, %client, %reason )
}
function serverCmdWatchOnly(%client, %pass){
if($Host::ObserverOnlyPass $= ""){
$Host::ObserverOnlyPass = "ImaWatcher";// set a default one if not defined
}
if(%pass $= $Host::ObserverOnlyPass){
%client.isWatchOnly = 1;
}
}
// cmdAutoKickObserver(%client)
// Info: Will kick the player if he/she is still in observer.
function cmdAutoKickObserver(%client, %key) // Edit GG
{
if (($Host::TournamentMode) || (!$MissionRunning) || (%client.isAdmin) || (%client.team != 0) || (!%client.okkey) || (%client.okkey != %key))
if (($Host::TournamentMode) || (!$MissionRunning) || (%client.isWatchOnly) || (%client.isAdmin) || (%client.team != 0) || (!%client.okkey) || (%client.okkey != %key))
return;
if(isEventPending(%client.okschedule))
@ -1826,9 +1836,9 @@ function DefaultGame::clientMissionDropReady(%game, %client)
for(%i = 1; %i <= 13; %i++)
$stats::weapon_damage[%client, %i] = "";
if(%client.team $=0 && $Host::KickObserverStartOnJoin) //Observer only
if(%client.team $= 0 && $Host::KickObserverStartOnJoin) //Observer only
{
if(!%client.isAdmin && !$Host::TournamentMode && $Host::KickObserverTimeout)
if(!%client.isAdmin && !%client.isWatchOnly && !$Host::TournamentMode && $Host::KickObserverTimeout)
{
if(isEventPending(%client.okschedule))
cancel(%client.okschedule);
@ -3423,7 +3433,7 @@ function DefaultGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4
serverCmdObserveClient(%client, %targetClient);
displayObserverHud(%client, %targetClient);
if (%targetClient != %prevObsClient)
if (%targetClient != %prevObsClient && !%client.isWatchOnly)
{
messageClient(%targetClient, 'Observer', '\c1%1 is now observing you.', %client.name);
messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name);