Fix for hackable entities not resetting their hack state when resecured by the empire that owns the hackable (#238)

This commit is contained in:
Mazo 2018-11-22 01:02:41 +00:00 committed by Fate-JH
parent 6445883ccf
commit 7cec0bb577

View file

@ -1,10 +1,11 @@
package net.psforever.objects.serverobject.hackable package net.psforever.objects.serverobject.hackable
import net.psforever.objects.Player import net.psforever.objects.Player
import net.psforever.objects.serverobject.affinity.FactionAffinity
import net.psforever.packet.game.{PlanetSideGUID, TriggeredSound} import net.psforever.packet.game.{PlanetSideGUID, TriggeredSound}
import net.psforever.types.Vector3 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. */ /** 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 private var hackedBy : Option[(Player, PlanetSideGUID, Vector3)] = None
def HackedBy : Option[(Player, PlanetSideGUID, Vector3)] = hackedBy def HackedBy : Option[(Player, PlanetSideGUID, Vector3)] = hackedBy
@ -24,8 +25,8 @@ trait Hackable {
hackedBy = Some(agent.get, agent.get.GUID, agent.get.Position) hackedBy = Some(agent.get, agent.get.GUID, agent.get.Position)
} }
case Some(_) => case Some(_) =>
//clear the hack state //clear the hack state if no agent is provided or the agent's faction matches the object faction
if(agent.isEmpty) { if(agent.isEmpty || agent.get.Faction == this.Faction) {
hackedBy = None hackedBy = None
} }
//override the hack state with a new hack state if the new user has different faction affiliation //override the hack state with a new hack state if the new user has different faction affiliation