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