mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 15:04:39 +00:00
updated field name to more appropriately match status
This commit is contained in:
parent
17cfc1d626
commit
a1d9ad7ee4
2 changed files with 19 additions and 17 deletions
|
|
@ -9,15 +9,16 @@ import shapeless.{::, HNil}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alert the condition of a vehicle the player is using when going too far underwater.
|
* Alert the condition of a vehicle the player is using when going too far underwater.
|
||||||
* The player must be mounted to this vehicle at start time for this countdown to display.
|
* The player must be mounted in/on this vehicle at start time for this countdown to display.
|
||||||
* @param vehicle_guid the player's mounted vehicle
|
* @param vehicle_guid the player's mounted vehicle
|
||||||
* @param time the countdown's time, in seconds
|
* @param progress the remaining countdown;
|
||||||
|
* for vehicle waterlog condition, the progress per second rate is very high
|
||||||
* @param active show a new countdown if `true` (resets any active countdown);
|
* @param active show a new countdown if `true` (resets any active countdown);
|
||||||
* clear any active countdowns if `false`;
|
* clear any active countdowns if `false`;
|
||||||
* defaults to `true`
|
* defaults to `true`
|
||||||
*/
|
*/
|
||||||
final case class WaterloggedVehicleState(vehicle_guid : PlanetSideGUID,
|
final case class WaterloggedVehicleState(vehicle_guid : PlanetSideGUID,
|
||||||
time : Float,
|
progress : Float,
|
||||||
active : Boolean = true)
|
active : Boolean = true)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,22 +33,23 @@ final case class WaterloggedVehicleState(vehicle_guid : PlanetSideGUID,
|
||||||
* When it reaches zero, the vehicle will become disabled.
|
* When it reaches zero, the vehicle will become disabled.
|
||||||
* All players in the vehicle's seats will be kicked and they will not be allowed back in.<br>
|
* All players in the vehicle's seats will be kicked and they will not be allowed back in.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* Normally, the countdowns should be set to begin at 100.0s.
|
* Normally, the countdowns should be set to begin at 100 (100.0).
|
||||||
* This is the earliest the drowning GUI will appear for either blue or red indicators.
|
* This is the earliest the drowning GUI will appear for either blue or red indicators.
|
||||||
* Passing greater intervals - up to 204.8s - will start the countdown silently but the GUI will be hidden until 100.0s.
|
* Passing greater intervals - up to 204.8 - will start the countdown silently but the GUI will be hidden until 100.0.
|
||||||
* (The progress indicators will actually appear to start counting from 98%.)
|
* (The progress indicators will actually appear to start counting from 98.)
|
||||||
* Managing the secondary vehicle countdown independent of the primary player countdown requires updating with the correct times.
|
* Managing the secondary vehicle countdown independent of the primary player countdown requires updating with the correct levels.
|
||||||
* The countdown can be cancelled by instructing it to be `active = false`.<br>
|
* The countdown can be cancelled by instructing it to be `active = false`.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* Except for updating the indicators, all other functionality of "drowning" is automated by the server.
|
* Except for updating the indicators, all other functionality of "drowning" is automated by the server.
|
||||||
* @param player_guid the player
|
* @param player_guid the player
|
||||||
* @param time the countdown's time, in seconds
|
* @param progress the remaining countdown;
|
||||||
|
* for character oxygen, the progress per second rate is about 1
|
||||||
* @param active show a new countdown if `true` (resets any active countdown);
|
* @param active show a new countdown if `true` (resets any active countdown);
|
||||||
* clear any active countdowns if `false`
|
* clear any active countdowns if `false`
|
||||||
* @param vehicle_state optional state of the vehicle the player is driving
|
* @param vehicle_state optional state of the vehicle the player is driving
|
||||||
*/
|
*/
|
||||||
final case class OxygenStateMessage(player_guid : PlanetSideGUID,
|
final case class OxygenStateMessage(player_guid : PlanetSideGUID,
|
||||||
time : Float,
|
progress : Float,
|
||||||
active : Boolean,
|
active : Boolean,
|
||||||
vehicle_state : Option[WaterloggedVehicleState] = None)
|
vehicle_state : Option[WaterloggedVehicleState] = None)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
|
|
@ -60,13 +62,13 @@ object OxygenStateMessage extends Marshallable[OxygenStateMessage] {
|
||||||
/**
|
/**
|
||||||
* Overloaded constructor that removes the optional state of the `WaterloggedVehicleState` parameter.
|
* Overloaded constructor that removes the optional state of the `WaterloggedVehicleState` parameter.
|
||||||
* @param player_guid the player
|
* @param player_guid the player
|
||||||
* @param time the countdown's time upon start
|
* @param progress the remaining countdown
|
||||||
* @param active show or clear the countdown
|
* @param active show or clear the countdown
|
||||||
* @param vehicle_state state of the vehicle the player is driving
|
* @param vehicle_state state of the vehicle the player is driving
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def apply(player_guid : PlanetSideGUID, time : Float, active : Boolean, vehicle_state : WaterloggedVehicleState) : OxygenStateMessage =
|
def apply(player_guid : PlanetSideGUID, progress : Float, active : Boolean, vehicle_state : WaterloggedVehicleState) : OxygenStateMessage =
|
||||||
OxygenStateMessage(player_guid, time, active, Some(vehicle_state))
|
OxygenStateMessage(player_guid, progress, active, Some(vehicle_state))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple pattern that expands the datatypes of the packet's basic `Codec`.
|
* A simple pattern that expands the datatypes of the packet's basic `Codec`.
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ class OxygenStateMessageTest extends Specification {
|
||||||
|
|
||||||
"decode (self)" in {
|
"decode (self)" in {
|
||||||
PacketCoding.DecodePacket(string_self).require match {
|
PacketCoding.DecodePacket(string_self).require match {
|
||||||
case OxygenStateMessage(guid, time, active, veh_state) =>
|
case OxygenStateMessage(guid, progress, active, veh_state) =>
|
||||||
guid mustEqual PlanetSideGUID(75)
|
guid mustEqual PlanetSideGUID(75)
|
||||||
time mustEqual 50.0
|
progress mustEqual 50.0
|
||||||
active mustEqual true
|
active mustEqual true
|
||||||
veh_state.isDefined mustEqual false
|
veh_state.isDefined mustEqual false
|
||||||
case _ =>
|
case _ =>
|
||||||
|
|
@ -24,13 +24,13 @@ class OxygenStateMessageTest extends Specification {
|
||||||
|
|
||||||
"decode (vehicle)" in {
|
"decode (vehicle)" in {
|
||||||
PacketCoding.DecodePacket(string_vehicle).require match {
|
PacketCoding.DecodePacket(string_vehicle).require match {
|
||||||
case OxygenStateMessage(guid, time, active, veh_state) =>
|
case OxygenStateMessage(guid, progress, active, veh_state) =>
|
||||||
guid mustEqual PlanetSideGUID(75)
|
guid mustEqual PlanetSideGUID(75)
|
||||||
time mustEqual 50.0f
|
progress mustEqual 50.0f
|
||||||
active mustEqual true
|
active mustEqual true
|
||||||
veh_state.isDefined mustEqual true
|
veh_state.isDefined mustEqual true
|
||||||
veh_state.get.vehicle_guid mustEqual PlanetSideGUID(1546)
|
veh_state.get.vehicle_guid mustEqual PlanetSideGUID(1546)
|
||||||
veh_state.get.time mustEqual 50.0f
|
veh_state.get.progress mustEqual 50.0f
|
||||||
veh_state.get.active mustEqual true
|
veh_state.get.active mustEqual true
|
||||||
case _ =>
|
case _ =>
|
||||||
ko
|
ko
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue