From 7cec0bb5779615b04bf2eb765a445a4fda406565 Mon Sep 17 00:00:00 2001 From: Mazo Date: Thu, 22 Nov 2018 01:02:41 +0000 Subject: [PATCH] Fix for hackable entities not resetting their hack state when resecured by the empire that owns the hackable (#238) --- .../psforever/objects/serverobject/hackable/Hackable.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/main/scala/net/psforever/objects/serverobject/hackable/Hackable.scala b/common/src/main/scala/net/psforever/objects/serverobject/hackable/Hackable.scala index e51f0804c..dc6fbd962 100644 --- a/common/src/main/scala/net/psforever/objects/serverobject/hackable/Hackable.scala +++ b/common/src/main/scala/net/psforever/objects/serverobject/hackable/Hackable.scala @@ -1,10 +1,11 @@ package net.psforever.objects.serverobject.hackable import net.psforever.objects.Player +import net.psforever.objects.serverobject.affinity.FactionAffinity import net.psforever.packet.game.{PlanetSideGUID, TriggeredSound} import net.psforever.types.Vector3 -trait Hackable { +trait Hackable extends FactionAffinity { /** An entry that maintains a reference to the `Player`, and the player's GUID and location when the message was received. */ private var hackedBy : Option[(Player, PlanetSideGUID, Vector3)] = None def HackedBy : Option[(Player, PlanetSideGUID, Vector3)] = hackedBy @@ -24,8 +25,8 @@ trait Hackable { hackedBy = Some(agent.get, agent.get.GUID, agent.get.Position) } case Some(_) => - //clear the hack state - if(agent.isEmpty) { + //clear the hack state if no agent is provided or the agent's faction matches the object faction + if(agent.isEmpty || agent.get.Faction == this.Faction) { hackedBy = None } //override the hack state with a new hack state if the new user has different faction affiliation