Flashlight fixes: dead players and spectators may no longer toggle the flashlight, spectating other players while dead will keep your flashlight off
This commit is contained in:
parent
3143e561c0
commit
358800f260
@ -617,7 +617,8 @@ namespace spades {
|
|||||||
eyeMatrix.GetOrigin() + Vector3(20.f, 20.f, 20.f)));
|
eyeMatrix.GetOrigin() + Vector3(20.f, 20.f, 20.f)));
|
||||||
sandboxedRenderer->SetAllowDepthHack(true);
|
sandboxedRenderer->SetAllowDepthHack(true);
|
||||||
|
|
||||||
if (client->flashlightOn) {
|
// no flashlight if spectating other players while dead
|
||||||
|
if (client->flashlightOn && world->GetLocalPlayer()->IsAlive()) {
|
||||||
float brightness;
|
float brightness;
|
||||||
brightness = client->time - client->flashlightOnTime;
|
brightness = client->time - client->flashlightOnTime;
|
||||||
brightness = 1.f - expf(-brightness * 5.f);
|
brightness = 1.f - expf(-brightness * 5.f);
|
||||||
|
@ -558,6 +558,9 @@ namespace spades {
|
|||||||
} else if (CheckKey(cg_keySaveMap, name) && down) {
|
} else if (CheckKey(cg_keySaveMap, name) && down) {
|
||||||
TakeMapShot();
|
TakeMapShot();
|
||||||
} else if (CheckKey(cg_keyFlashlight, name) && down) {
|
} else if (CheckKey(cg_keyFlashlight, name) && down) {
|
||||||
|
// spectators and dead players should not be able to toggle the flashlight
|
||||||
|
if (world->GetLocalPlayer()->IsSpectator() || !world->GetLocalPlayer()->IsAlive())
|
||||||
|
return;
|
||||||
flashlightOn = !flashlightOn;
|
flashlightOn = !flashlightOn;
|
||||||
flashlightOnTime = time;
|
flashlightOnTime = time;
|
||||||
Handle<IAudioChunk> chunk =
|
Handle<IAudioChunk> chunk =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user