force redraw of the whole boomer to assert reassignment of ownership; it's heavy-handed but it works

This commit is contained in:
Fate-JH 2024-08-09 10:07:40 -04:00
parent abfbf1c439
commit 3c4907c107
2 changed files with 15 additions and 4 deletions

View file

@ -13,6 +13,7 @@ import net.psforever.objects.vital.interaction.DamageInteraction
import net.psforever.objects.zones.Zone
import net.psforever.services.Service
import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
import net.psforever.types.PlanetSideEmpire
import scala.annotation.unused
@ -81,8 +82,14 @@ class BoomerDeployableControl(mine: BoomerDeployable)
}
override def gainOwnership(player: Player): Unit = {
mine.Faction = PlanetSideEmpire.NEUTRAL //force map icon redraw
val originalOwner = mine.OwnerName
super.gainOwnership(player, player.Faction)
val events = mine.Zone.LocalEvents
val msg = LocalAction.DeployItem(mine)
originalOwner.collect { name =>
events ! LocalServiceMessage(name, msg)
}
events ! LocalServiceMessage(player.Name, msg)
}
override def dismissDeployable() : Unit = {

View file

@ -1168,10 +1168,14 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
zone.GUID(trigger.Companion) match {
case Some(obj: BoomerDeployable) =>
val deployables = player.avatar.deployables
if (deployables.Valid(obj)) {
if (!deployables.Contains(obj) && deployables.Valid(obj)) {
events ! AvatarServiceMessage(toChannel, AvatarAction.SendResponse(
Service.defaultPlayerGUID,
GenericObjectAction2Message(1, player.GUID, trigger.GUID)
))
Players.gainDeployableOwnership(player, obj, deployables.AddOverLimit)
}
case _ => ;
case _ => ()
}
case citem: ConstructionItem
@ -1182,7 +1186,7 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
}
Deployables.initializeConstructionItem(player.avatar.certifications, citem)
case _ => ;
case _ => ()
}
events ! AvatarServiceMessage(
toChannel,