Override LLU position to match player position if carried

This commit is contained in:
Mazo 2021-01-27 21:45:00 +00:00
parent 70d47c7731
commit f7caf2f880

View file

@ -20,15 +20,20 @@ class CaptureFlag(tDef: CaptureFlagDefinition) extends Amenity {
target
}
/**
* Since a LLU belongs to a base, but needs to be picked up by the enemy faction we need to be able to override the faction that owns the LLU to the hacker faction
*/
// Since a LLU belongs to a base, but needs to be picked up by the enemy faction we need to be able to override the faction that owns the LLU to the hacker faction
override def Faction: PlanetSideEmpire.Value = faction
override def Faction_=(new_faction: PlanetSideEmpire.Value): PlanetSideEmpire.Value = {
faction = new_faction
faction
}
// When the flag is carried by a player, the position returned should be that of the carrier not the flag
override def Position: Vector3 = if (Carrier.nonEmpty) {
carrier.get.Position
} else {
Entity.Position
}
def Carrier: Option[Player] = carrier
def Carrier_=(new_carrier: Option[Player]) : Option[Player] = {
carrier = new_carrier