PSF-BotServer/src/main/scala/net/psforever/objects/OwnableByPlayer.scala
Fate-JH ea77d4728f
Turret Automation (#1166)
* zone interaction for turret discovery, players only so far; minor field value change for small turret data; automated turret target recognition; grammatical and linter fixes

* initial AIDamage packet and tests; wrote handling code for the AIDamage packet that transforms it into actionable projectile damage

* thoroughly reorganized code in behavior; added code for turret-specific interactions for deployable construction, deployable destruction, jamming, and for weaponfire retribution; killing is currently disable for testing turnaround

* introduced definition properties to configure auto fire; interspersed properties into relevant files; non-squared velocity check for isMoving

* separated overworld facility turrets from cavern facility turrets, called vanu sentry turrets; tightened functionality inheritance between turret deployables and facility turrets; corrected issue where recharging vehicle weapons didn't work

* adjust mounting code to betterhandle automation with the facility turrets; basic operation of automation has also been changed, adding a variety of ranges to test against, and cylindrical distance checks

* attempted cleanup of previous test fire condition; division of turret callbacks between generic targets and vehicle targets; facility turret stops automatic fire when being mounted and resumes automatic mode when being dismounted

* self-reported firing mode for targets that go stationary and then use a 'clever trick' to avoid taking damage while in full exposure to the automated turret; documentation on the automated turret operations (it needs it!)

* making specific target validation conditions for different auto turrets, also target blanking, and clarification of how the self-reporting mode cleansup after itself; wrote function documentation to make it all make sense (it doesn't)

* secondary queue that keeps track of the previous test shot subjects when none have been tested, allowing for a packet to be skipped during subsequent test shots

* reactivating turret deployable destruction; clarifying the validation and clearing conditions for different kinds of auto turrets; extending self-reporting auto turret behavior to other auto-turrets

* overhaul of the auto turret target selection process; conditions for MAX detection; rewired self-reporting to address the its issue a bit more specifically; ATDispatch is no longer useless as differences between facility turrets and deployable turrets have been identified, shifting the method to implementing and overriding in subclass control agencies

* turret detection methods accounting for specific targets and considerations such as silent running; various turret interactions with other turrets and radiation clouds; proper management of retaliation and jamming; facility turrets have play in the lifecycle in the power structure and capture mechanics of the facility

* uniqueness can be generated without having to having to go through source entries; made certain turret upgrading cooperates with turret automation; other targets for turret misaimed aggression; turrets sychronize better on zone load; target validation and blankinghas changed again

* starting the target validation timer when dealing with retaliation if it should come from beyond the maximum detection range

* stop assuming mountable turrets have places to mount; AMS and AEGIS blocking detection of vehicles; deployable sensors and small robotics turrets are allergic to vehicles

* AEGIS and AMS cloak bubbles more proactive
2024-03-02 23:16:10 -05:00

73 lines
1.9 KiB
Scala

// Copyright (c) 2019 PSForever
package net.psforever.objects
import net.psforever.objects.sourcing.UniquePlayer
import net.psforever.types.PlanetSideGUID
trait OwnableByPlayer {
private var owner: Option[UniquePlayer] = None
private var ownerGuid: Option[PlanetSideGUID] = None
private var originalOwnerName: Option[String] = None
def Owners: Option[UniquePlayer] = owner
def OwnerGuid: Option[PlanetSideGUID] = ownerGuid
def OwnerGuid_=(owner: PlanetSideGUID): Option[PlanetSideGUID] = OwnerGuid_=(Some(owner))
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
}
def OwnerName: Option[String] = owner.map { _.name }
def OriginalOwnerName: Option[String] = originalOwnerName
/**
* na
* @param player na
* @return na
*/
def AssignOwnership(player: Player): OwnableByPlayer = AssignOwnership(Some(player))
/**
* na
* @param playerOpt na
* @return na
*/
def AssignOwnership(playerOpt: Option[Player]): OwnableByPlayer = {
(originalOwnerName, playerOpt) match {
case (None, Some(player)) =>
owner = Some(UniquePlayer(player))
originalOwnerName = originalOwnerName.orElse { Some(player.Name) }
OwnerGuid = player
case (_, Some(player)) =>
owner = Some(UniquePlayer(player))
OwnerGuid = player
case (_, None) =>
owner = None
OwnerGuid = None
}
this
}
/**
* na
* @param ownable na
* @return na
*/
def AssignOwnership(ownable: OwnableByPlayer): OwnableByPlayer = {
owner = ownable.owner
originalOwnerName = originalOwnerName.orElse { ownable.originalOwnerName }
OwnerGuid = ownable.OwnerGuid
this
}
}