Hopefully fix PeekCam

This commit is contained in:
Jackz 2022-07-26 20:10:37 -05:00
parent c2e446750c
commit e473cbe3ee
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
4 changed files with 71 additions and 33 deletions

View file

@ -197,8 +197,6 @@ methodmap PeekCamera {
AcceptEntityInput(seekerCam, "Enable", client); // Need to always activate before deactivating to fix a semi-common bug
if(!active) {
AcceptEntityInput(seekerCam, "Disable", client);
AcceptEntityInput(seekerCam, "Kill");
seekerCam = INVALID_ENT_REFERENCE;
}
} else {
PrintToServer("WARN: SetPeekCamActive(%d, %b) when seekerCam invalid", client, active);
@ -206,6 +204,19 @@ methodmap PeekCamera {
isViewingCam[client] = active;
}
public void Enable(int client = -1) {
AcceptEntityInput(seekerCam, "Enable", client);
if(client > 0) {
isViewingCam[client] = true;
}
}
public void Disable(int client = -1) {
AcceptEntityInput(seekerCam, "Disable", client);
if(client > 0) {
isViewingCam[client] = false;
}
}
public bool IsViewing(int client) {
return isViewingCam[client];
}