From 8046fbe0ba426709a4b673950d4d7ee0155c45cb Mon Sep 17 00:00:00 2001 From: Mazo Date: Mon, 4 May 2020 04:45:45 +0100 Subject: [PATCH] Fix implant stamina draining permanently when the client tries to activate an already active implant (#415) --- .../net/psforever/objects/avatar/PlayerControl.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/src/main/scala/net/psforever/objects/avatar/PlayerControl.scala b/common/src/main/scala/net/psforever/objects/avatar/PlayerControl.scala index c5a0a437..4588b083 100644 --- a/common/src/main/scala/net/psforever/objects/avatar/PlayerControl.scala +++ b/common/src/main/scala/net/psforever/objects/avatar/PlayerControl.scala @@ -22,10 +22,7 @@ import scala.concurrent.duration._ import scala.collection.mutable import scala.concurrent.ExecutionContext.Implicits.global -/** - * na; - * stub for future development - */ + class PlayerControl(player : Player) extends Actor with JammableBehavior with Damageable { @@ -58,7 +55,12 @@ class PlayerControl(player : Player) extends Actor implantSlot.Installed match { case Some(implant: ImplantDefinition) => if(implantSlot.Active) { + // Some events such as zoning will reset the implant on the client side without sending a deactivation packet + // But the implant will remain in an active state server side. For now, allow reactivation of the implant. + // todo: Deactivate implants server side when actions like zoning happen. (Other actions?) log.warn(s"Implant ${slot} is already active, but activating again") + implantSlotStaminaDrainTimers(slot).cancel() + implantSlotStaminaDrainTimers(slot) = DefaultCancellable.obj } implantSlot.Active = true