mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-10 22:14:36 +00:00
Advanced medical + other bits (#287)
* Allow medical applicator to revive players * Allow dead players to be repaired * Refactoring medapp + bank usage * Make bank + medapp use charges from magazine * Don't try to heal/repair other players with MaxHealth/MaxArmor <= 0 * Ignore tool use on SpawnTube objects (for example; don't deconstruct from using a medical applicator on a spawn tube)
This commit is contained in:
parent
53d677dc5d
commit
aec9c15bdd
6 changed files with 92 additions and 86 deletions
|
|
@ -99,6 +99,11 @@ class Player(private val core : Avatar) extends PlanetSideGameObject
|
|||
false
|
||||
}
|
||||
|
||||
def Revive : Boolean = {
|
||||
alive = true
|
||||
true
|
||||
}
|
||||
|
||||
def Release : Boolean = {
|
||||
if(!isAlive) {
|
||||
backpack = true
|
||||
|
|
@ -112,7 +117,7 @@ class Player(private val core : Avatar) extends PlanetSideGameObject
|
|||
def Health : Int = health
|
||||
|
||||
def Health_=(assignHealth : Int) : Int = {
|
||||
health = if(isAlive) { math.min(math.max(0, assignHealth), MaxHealth) } else { 0 }
|
||||
health = math.min(math.max(0, assignHealth), MaxHealth)
|
||||
Health
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +145,7 @@ class Player(private val core : Avatar) extends PlanetSideGameObject
|
|||
def Armor : Int = armor
|
||||
|
||||
def Armor_=(assignArmor : Int) : Int = {
|
||||
armor = if(isAlive) { math.min(math.max(0, assignArmor), MaxArmor) } else { 0 }
|
||||
armor = math.min(math.max(0, assignArmor), MaxArmor)
|
||||
Armor
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ object AvatarDeadStateMessage extends Marshallable[AvatarDeadStateMessage] {
|
|||
("timer_max" | uint32L) ::
|
||||
("timer" | uint32L) ::
|
||||
("pos" | Vector3.codec_pos) ::
|
||||
("unk4" | factionLongCodec) ::
|
||||
("faction" | factionLongCodec) ::
|
||||
("unk5" | bool)
|
||||
).as[AvatarDeadStateMessage]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ class AvatarService extends Actor {
|
|||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", guid, AvatarResponse.PlanetsideAttribute(attribute_type, attribute_value))
|
||||
)
|
||||
case AvatarAction.PlanetsideAttributeToAll(guid, attribute_type, attribute_value) =>
|
||||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", guid, AvatarResponse.PlanetsideAttributeToAll(attribute_type, attribute_value))
|
||||
)
|
||||
case AvatarAction.PlanetsideAttributeSelf(guid, attribute_type, attribute_value) =>
|
||||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", guid, AvatarResponse.PlanetsideAttributeSelf(attribute_type, attribute_value))
|
||||
|
|
@ -192,6 +196,14 @@ class AvatarService extends Actor {
|
|||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", player_guid, AvatarResponse.SendResponse(msg))
|
||||
)
|
||||
case AvatarAction.SendResponseTargeted(target_guid, msg) =>
|
||||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", target_guid, AvatarResponse.SendResponseTargeted(target_guid, msg))
|
||||
)
|
||||
case AvatarAction.Revive(target_guid) =>
|
||||
AvatarEvents.publish(
|
||||
AvatarServiceResponse(s"/$forChannel/Avatar", target_guid, AvatarResponse.Revive(target_guid))
|
||||
)
|
||||
|
||||
case _ => ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,17 +43,20 @@ object AvatarAction {
|
|||
final case class ObjectDelete(player_guid : PlanetSideGUID, item_guid : PlanetSideGUID, unk : Int = 0) extends Action
|
||||
final case class ObjectHeld(player_guid : PlanetSideGUID, slot : Int) extends Action
|
||||
final case class PlanetsideAttribute(player_guid : PlanetSideGUID, attribute_type : Int, attribute_value : Long) extends Action
|
||||
final case class PlanetsideAttributeToAll(player_guid : PlanetSideGUID, attribute_type : Int, attribute_value : Long) extends Action
|
||||
final case class PlanetsideAttributeSelf(player_guid : PlanetSideGUID, attribute_type : Int, attribute_value : Long) extends Action
|
||||
final case class PlayerState(player_guid : PlanetSideGUID, pos : Vector3, vel : Option[Vector3], facingYaw : Float, facingPitch : Float, facingYawUpper : Float, timestamp : Int, is_crouching : Boolean, is_jumping : Boolean, jump_thrust : Boolean, is_cloaked : Boolean, spectator : Boolean, weaponInHand : Boolean) extends Action
|
||||
final case class PickupItem(player_guid : PlanetSideGUID, zone : Zone, target : PlanetSideGameObject with Container, slot : Int, item : Equipment, unk : Int = 0) extends Action
|
||||
final case class PutDownFDU(player_guid : PlanetSideGUID) extends Action
|
||||
final case class Release(player : Player, zone : Zone, time : Option[FiniteDuration] = None) extends Action
|
||||
final case class Revive(target_guid: PlanetSideGUID) extends Action
|
||||
final case class Reload(player_guid : PlanetSideGUID, weapon_guid : PlanetSideGUID) extends Action
|
||||
final case class SetEmpire(player_guid : PlanetSideGUID, object_guid : PlanetSideGUID, faction : PlanetSideEmpire.Value) extends Action
|
||||
final case class StowEquipment(player_guid : PlanetSideGUID, target_guid : PlanetSideGUID, slot : Int, item : Equipment) extends Action
|
||||
final case class WeaponDryFire(player_guid : PlanetSideGUID, weapon_guid : PlanetSideGUID) extends Action
|
||||
|
||||
final case class SendResponse(player_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends Action
|
||||
final case class SendResponseTargeted(target_guid: PlanetSideGUID, msg: PlanetSideGamePacket) extends Action
|
||||
|
||||
// final case class PlayerStateShift(killer : PlanetSideGUID, victim : PlanetSideGUID) extends Action
|
||||
// final case class DestroyDisplay(killer : PlanetSideGUID, victim : PlanetSideGUID) extends Action
|
||||
|
|
|
|||
|
|
@ -36,15 +36,18 @@ object AvatarResponse {
|
|||
final case class ObjectDelete(item_guid : PlanetSideGUID, unk : Int) extends Response
|
||||
final case class ObjectHeld(slot : Int) extends Response
|
||||
final case class PlanetsideAttribute(attribute_type : Int, attribute_value : Long) extends Response
|
||||
final case class PlanetsideAttributeToAll(attribute_type : Int, attribute_value : Long) extends Response
|
||||
final case class PlanetsideAttributeSelf(attribute_type : Int, attribute_value : Long) extends Response
|
||||
final case class PlayerState(pos : Vector3, vel : Option[Vector3], facingYaw : Float, facingPitch : Float, facingYawUpper : Float, timestamp : Int, is_crouching : Boolean, is_jumping : Boolean, jump_thrust : Boolean, is_cloaked : Boolean, spectator : Boolean, weaponInHand : Boolean) extends Response
|
||||
final case class PutDownFDU(target_guid : PlanetSideGUID) extends Response
|
||||
final case class Release(player : Player) extends Response
|
||||
final case class Reload(weapon_guid : PlanetSideGUID) extends Response
|
||||
final case class Revive(target_guid: PlanetSideGUID) extends Response
|
||||
final case class SetEmpire(object_guid : PlanetSideGUID, faction : PlanetSideEmpire.Value) extends Response
|
||||
final case class StowEquipment(target_guid : PlanetSideGUID, slot : Int, item : Equipment) extends Response
|
||||
final case class WeaponDryFire(weapon_guid : PlanetSideGUID) extends Response
|
||||
|
||||
final case class SendResponse(msg: PlanetSideGamePacket) extends Response
|
||||
final case class SendResponseTargeted(target_guid : PlanetSideGUID, msg: PlanetSideGamePacket) extends Response
|
||||
// final case class PlayerStateShift(itemID : PlanetSideGUID) extends Response
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue