mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-11 22:44:37 +00:00
re-initialized vehicle utility actors properly depending in regards to what zone the vehicle belongs; this affects pretty much every utility (initially observed in AMS terminals specifically); touch-up on pickup and drop item ops (#271)
This commit is contained in:
parent
4fe871455d
commit
612bceb440
2 changed files with 17 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2017 PSForever
|
// Copyright (c) 2017 PSForever
|
||||||
package net.psforever.objects.vehicles
|
package net.psforever.objects.vehicles
|
||||||
|
|
||||||
import akka.actor.Actor
|
import akka.actor.{Actor, ActorRef}
|
||||||
import net.psforever.objects.Vehicle
|
import net.psforever.objects.Vehicle
|
||||||
import net.psforever.objects.ballistics.VehicleSource
|
import net.psforever.objects.ballistics.VehicleSource
|
||||||
import net.psforever.objects.serverobject.mount.{Mountable, MountableBehavior}
|
import net.psforever.objects.serverobject.mount.{Mountable, MountableBehavior}
|
||||||
|
|
@ -33,6 +33,14 @@ class VehicleControl(vehicle : Vehicle) extends Actor
|
||||||
|
|
||||||
def receive : Receive = Enabled
|
def receive : Receive = Enabled
|
||||||
|
|
||||||
|
override def postStop() : Unit = {
|
||||||
|
super.postStop()
|
||||||
|
vehicle.Utilities.values.foreach { util =>
|
||||||
|
util().Actor ! akka.actor.PoisonPill
|
||||||
|
util().Actor = ActorRef.noSender
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def Enabled : Receive = checkBehavior
|
def Enabled : Receive = checkBehavior
|
||||||
.orElse(deployBehavior)
|
.orElse(deployBehavior)
|
||||||
.orElse(dismountBehavior)
|
.orElse(dismountBehavior)
|
||||||
|
|
|
||||||
|
|
@ -607,6 +607,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
|
|
||||||
case Zone.Ground.CanNotDropItem(zone, item, reason) =>
|
case Zone.Ground.CanNotDropItem(zone, item, reason) =>
|
||||||
log.warn(s"DropItem: $player tried to drop a $item on the ground, but $reason")
|
log.warn(s"DropItem: $player tried to drop a $item on the ground, but $reason")
|
||||||
|
if(!item.HasGUID) {
|
||||||
|
log.warn(s"DropItem: zone ${continent.Id} contents may be in disarray")
|
||||||
|
}
|
||||||
|
|
||||||
case Zone.Ground.ItemInHand(item : BoomerTrigger) =>
|
case Zone.Ground.ItemInHand(item : BoomerTrigger) =>
|
||||||
if(PutItemInHand(item)) {
|
if(PutItemInHand(item)) {
|
||||||
|
|
@ -640,6 +643,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
log.warn(s"DropItem: finding a $item on the ground was suggested, but $player can not reach it")
|
log.warn(s"DropItem: finding a $item on the ground was suggested, but $player can not reach it")
|
||||||
case None =>
|
case None =>
|
||||||
log.warn(s"DropItem: finding an item ($item_guid) on the ground was suggested, but $player can not see it")
|
log.warn(s"DropItem: finding an item ($item_guid) on the ground was suggested, but $player can not see it")
|
||||||
|
sendResponse(ObjectDeleteMessage(item_guid, 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
case Zone.Deployable.DeployableIsBuilt(obj, tool) =>
|
case Zone.Deployable.DeployableIsBuilt(obj, tool) =>
|
||||||
|
|
@ -3653,18 +3657,19 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case msg @ DropItemMessage(item_guid) =>
|
case msg @ DropItemMessage(item_guid) =>
|
||||||
log.info(s"DropItem: $msg")
|
log.info(s"DropItem: $msg")
|
||||||
continent.GUID(item_guid) match {
|
continent.GUID(item_guid) match {
|
||||||
case Some(item : Equipment) =>
|
case Some(anItem : Equipment) =>
|
||||||
player.FreeHand.Equipment match {
|
player.FreeHand.Equipment match {
|
||||||
case Some(_) =>
|
case Some(item) =>
|
||||||
if(item.GUID == item_guid) {
|
if(item.GUID == item_guid) {
|
||||||
continent.Ground ! Zone.Ground.DropItem(item, player.Position, player.Orientation)
|
continent.Ground ! Zone.Ground.DropItem(item, player.Position, player.Orientation)
|
||||||
}
|
}
|
||||||
case None =>
|
case None =>
|
||||||
log.warn(s"DropItem: $player wanted to drop a $item, but it wasn't at hand")
|
log.warn(s"DropItem: $player wanted to drop a $anItem, but it wasn't at hand")
|
||||||
}
|
}
|
||||||
case Some(obj) => //TODO LLU
|
case Some(obj) => //TODO LLU
|
||||||
log.warn(s"DropItem: $player wanted to drop a $obj, but that isn't possible")
|
log.warn(s"DropItem: $player wanted to drop a $obj, but that isn't possible")
|
||||||
case None =>
|
case None =>
|
||||||
|
sendResponse(ObjectDeleteMessage(item_guid, 0)) //this is fine; item doesn't exist to the server anyway
|
||||||
log.warn(s"DropItem: $player wanted to drop an item ($item_guid), but it was nowhere to be found")
|
log.warn(s"DropItem: $player wanted to drop an item ($item_guid), but it was nowhere to be found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue