mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
just some tinkering and clean-up
This commit is contained in:
parent
02f95a293e
commit
698a5609ab
|
|
@ -18,16 +18,11 @@ trait OwnableByPlayer {
|
|||
def OwnerGuid_=(owner: Player): Option[PlanetSideGUID] = OwnerGuid_=(Some(owner.GUID))
|
||||
|
||||
def OwnerGuid_=(owner: Option[PlanetSideGUID]): Option[PlanetSideGUID] = {
|
||||
owner match {
|
||||
case Some(_) =>
|
||||
ownerGuid = owner
|
||||
case None =>
|
||||
ownerGuid = None
|
||||
}
|
||||
ownerGuid = owner
|
||||
OwnerGuid
|
||||
}
|
||||
|
||||
def OwnerName: Option[String] = owner.map { _.name }
|
||||
def OwnerName: Option[String] = owner.map(_.name)
|
||||
|
||||
def OriginalOwnerName: Option[String] = originalOwnerName
|
||||
|
||||
|
|
@ -47,7 +42,7 @@ trait OwnableByPlayer {
|
|||
(originalOwnerName, playerOpt) match {
|
||||
case (None, Some(player)) =>
|
||||
owner = Some(UniquePlayer(player))
|
||||
originalOwnerName = originalOwnerName.orElse { Some(player.Name) }
|
||||
originalOwnerName = originalOwnerName.orElse(Some(player.Name))
|
||||
OwnerGuid = player
|
||||
case (_, Some(player)) =>
|
||||
owner = Some(UniquePlayer(player))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ trait DeployableBehavior {
|
|||
}
|
||||
|
||||
case Deployable.Ownership(Some(player))
|
||||
if !DeployableObject.Destroyed && DeployableObject.OwnerGuid.isEmpty =>
|
||||
if !DeployableObject.Destroyed /*&& DeployableObject.OwnerGuid.isEmpty*/ =>
|
||||
if (constructed.contains(true)) {
|
||||
gainOwnership(player)
|
||||
} else {
|
||||
|
|
@ -143,7 +143,7 @@ trait DeployableBehavior {
|
|||
DeployableBehavior.changeOwnership(
|
||||
obj,
|
||||
toFaction,
|
||||
DeployableInfo(obj.GUID, Deployable.Icon.apply(obj.Definition.Item), obj.Position, obj.OwnerGuid.get)
|
||||
DeployableInfo(obj.GUID, Deployable.Icon.apply(obj.Definition.Item), obj.Position, player.GUID)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -292,26 +292,25 @@ object DeployableBehavior {
|
|||
*/
|
||||
def changeOwnership(obj: Deployable, toFaction: PlanetSideEmpire.Value, info: DeployableInfo): Unit = {
|
||||
val originalFaction = obj.Faction
|
||||
val zone = obj.Zone
|
||||
val localEvents = zone.LocalEvents
|
||||
if (originalFaction != toFaction) {
|
||||
val guid = obj.GUID
|
||||
val zone = obj.Zone
|
||||
val localEvents = zone.LocalEvents
|
||||
obj.Faction = toFaction
|
||||
//visual tells in regards to ownership by faction
|
||||
zone.AvatarEvents ! AvatarServiceMessage(
|
||||
zone.id,
|
||||
AvatarAction.SetEmpire(Service.defaultPlayerGUID, guid, toFaction)
|
||||
AvatarAction.SetEmpire(Service.defaultPlayerGUID, obj.GUID, toFaction)
|
||||
)
|
||||
//remove knowledge by the previous owner's faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
originalFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Dismiss, info)
|
||||
)
|
||||
//display to the given faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
toFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Build, info)
|
||||
)
|
||||
}
|
||||
//display to the given faction
|
||||
localEvents ! LocalServiceMessage(
|
||||
toFaction.toString,
|
||||
LocalAction.DeployableMapIcon(Service.defaultPlayerGUID, DeploymentAction.Build, info)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue