Merge pull request #755 from davicr/issue-731

Flashlight fixes
This commit is contained in:
YVT 2018-08-02 16:26:36 +09:00 committed by GitHub
commit 995e7f2ffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -617,7 +617,8 @@ namespace spades {
eyeMatrix.GetOrigin() + Vector3(20.f, 20.f, 20.f)));
sandboxedRenderer->SetAllowDepthHack(true);
if (client->flashlightOn) {
// no flashlight if spectating other players while dead
if (client->flashlightOn && world->GetLocalPlayer()->IsAlive()) {
float brightness;
brightness = client->time - client->flashlightOnTime;
brightness = 1.f - expf(-brightness * 5.f);

View File

@ -558,6 +558,9 @@ namespace spades {
} else if (CheckKey(cg_keySaveMap, name) && down) {
TakeMapShot();
} 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;
flashlightOnTime = time;
Handle<IAudioChunk> chunk =