ramshackle merge conflict resolution; fixing interference for non-interference deploying vehicles

This commit is contained in:
Fate-JH 2024-05-11 00:23:14 -04:00
parent a46643f5be
commit a198bb130a
4 changed files with 29 additions and 17 deletions

View file

@ -533,7 +533,7 @@ class GeneralLogic(val ops: GeneralOperations, implicit val context: ActorContex
case _ => case _ =>
GUIDTask.registerObject(continent.GUID, dObj) GUIDTask.registerObject(continent.GUID, dObj)
} }
TaskWorkflow.execute(CallBackForTask(tasking, continent.Deployables, Zone.Deployable.BuildByOwner(dObj, player, obj))) TaskWorkflow.execute(CallBackForTask(tasking, continent.Deployables, Zone.Deployable.BuildByOwner(dObj, player, obj), context.self))
case Some(obj) => case Some(obj) =>
log.warn(s"DeployObject: what is $obj, ${player.Name}? It's not a construction tool!") log.warn(s"DeployObject: what is $obj, ${player.Name}? It's not a construction tool!")
case None => case None =>

View file

@ -4,6 +4,7 @@ package net.psforever.actors.session.normal
import akka.actor.Actor.Receive import akka.actor.Actor.Receive
import akka.actor.ActorRef import akka.actor.ActorRef
import net.psforever.actors.session.support.{ChatFunctions, GeneralFunctions, LocalHandlerFunctions, MountHandlerFunctions, SquadHandlerFunctions, TerminalHandlerFunctions, VehicleFunctions, VehicleHandlerFunctions, WeaponAndProjectileFunctions} import net.psforever.actors.session.support.{ChatFunctions, GeneralFunctions, LocalHandlerFunctions, MountHandlerFunctions, SquadHandlerFunctions, TerminalHandlerFunctions, VehicleFunctions, VehicleHandlerFunctions, WeaponAndProjectileFunctions}
import net.psforever.objects.Players
import net.psforever.packet.game.UplinkRequest import net.psforever.packet.game.UplinkRequest
import net.psforever.services.chat.ChatService import net.psforever.services.chat.ChatService
// //
@ -248,9 +249,11 @@ class NormalModeLogic(data: SessionData) extends ModeLogic {
case _: Zone.Vehicle.HasDespawned => ; case _: Zone.Vehicle.HasDespawned => ;
case Zone.Deployable.IsDismissed(obj: TurretDeployable) => //only if target deployable was never fully introduced case Zone.Deployable.IsDismissed(obj: TurretDeployable) => //only if target deployable was never fully introduced
Players.buildCooldownReset(data.continent, data.player.Name, obj)
TaskWorkflow.execute(GUIDTask.unregisterDeployableTurret(data.continent.GUID, obj)) TaskWorkflow.execute(GUIDTask.unregisterDeployableTurret(data.continent.GUID, obj))
case Zone.Deployable.IsDismissed(obj) => //only if target deployable was never fully introduced case Zone.Deployable.IsDismissed(obj) => //only if target deployable was never fully introduced
Players.buildCooldownReset(data.continent, data.player.Name, obj)
TaskWorkflow.execute(GUIDTask.unregisterObject(data.continent.GUID, obj)) TaskWorkflow.execute(GUIDTask.unregisterObject(data.continent.GUID, obj))
case msg: Containable.ItemPutInSlot => case msg: Containable.ItemPutInSlot =>

View file

@ -272,24 +272,29 @@ class VehicleLogic(val ops: VehicleOperations, implicit val context: ActorContex
def handleDeployRequest(pkt: DeployRequestMessage): Unit = { def handleDeployRequest(pkt: DeployRequestMessage): Unit = {
val DeployRequestMessage(_, vehicle_guid, deploy_state, _, _, _) = pkt val DeployRequestMessage(_, vehicle_guid, deploy_state, _, _, _) = pkt
val vehicle = player.avatar.vehicle continent.GUID(vehicle_guid)
if (vehicle.contains(vehicle_guid)) { .collect {
if (vehicle == player.VehicleSeated) { case obj: Vehicle =>
continent.GUID(vehicle_guid) match { val vehicle = player.avatar.vehicle
case Some(obj: Vehicle) => if (!vehicle.contains(vehicle_guid)) {
log.warn(s"DeployRequest: ${player.Name} does not own the would-be-deploying ${obj.Definition.Name}")
} else if (vehicle != player.VehicleSeated) {
log.warn(s"${player.Name} must be mounted as the driver to request a deployment change")
} else {
log.info(s"${player.Name} is requesting a deployment change for ${obj.Definition.Name} - $deploy_state") log.info(s"${player.Name} is requesting a deployment change for ${obj.Definition.Name} - $deploy_state")
obj.Actor ! Deployment.TryDeploymentChange(deploy_state) obj.Actor ! Deployment.TryDeploymentChange(deploy_state)
continent.Transport ! Zone.Vehicle.TryDeploymentChange(obj, deploy_state)
case _ => }
log.error(s"DeployRequest: ${player.Name} can not find vehicle $vehicle_guid") obj
avatarActor ! AvatarActor.SetVehicle(None) case obj =>
} log.error(s"DeployRequest: ${player.Name} expected a vehicle, but found a ${obj.Definition.Name} instead")
} else { obj
log.warn(s"${player.Name} must be mounted to request a deployment change") }
.orElse {
log.error(s"DeployRequest: ${player.Name} can not find entity $vehicle_guid")
avatarActor ! AvatarActor.SetVehicle(None) //todo is this safe
None
} }
} else {
log.warn(s"DeployRequest: ${player.Name} does not own the deploying $vehicle_guid object")
}
} }
/* messages */ /* messages */

View file

@ -20,6 +20,8 @@ class ZoneVehicleActor(
vehicleList: mutable.ListBuffer[Vehicle], vehicleList: mutable.ListBuffer[Vehicle],
turretToMount: mutable.HashMap[Int, Int] turretToMount: mutable.HashMap[Int, Int]
) extends Actor { ) extends Actor {
private val log = org.log4s.getLogger(s"${zone.id}-vehicles")
private var temporaryInterference: Seq[(Vector3, PlanetSideEmpire.Value, VehicleDefinition)] = Seq() private var temporaryInterference: Seq[(Vector3, PlanetSideEmpire.Value, VehicleDefinition)] = Seq()
def receive: Receive = { def receive: Receive = {
@ -81,8 +83,10 @@ class ZoneVehicleActor(
case Zone.Vehicle.CanNotDespawn(_, _, _) => () case Zone.Vehicle.CanNotDespawn(_, _, _) => ()
case Zone.Vehicle.CanNotDeploy(_, vehicle, _, _) => () case Zone.Vehicle.CanNotDeploy(_, vehicle, _, reason) => ()
val pos = vehicle.Position val pos = vehicle.Position
val driverMoniker = vehicle.Seats.headOption.flatMap(_._2.occupant).map(_.Name).getOrElse("Driver")
log.warn(s"$driverMoniker's ${vehicle.Definition.Name} can not deploy in ${zone.id} because $reason")
temporaryInterference = temporaryInterference.filterNot(_._1 == pos) temporaryInterference = temporaryInterference.filterNot(_._1 == pos)
case ZoneVehicleActor.ClearInterference(pos) => case ZoneVehicleActor.ClearInterference(pos) =>