mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-26 01:33:35 +00:00
* planar classes to describe levels of water and other fluid parallel to the ground * corrected purpose of field in OxygenStateMessage and adjusted the structure of the packet; the environment is now 'regions filled with stuff'; messaging pathways to facilitate drowning and drown recovery in SessionActor, WorldSession, and PlayerControl, as well as the avatar event system * drowning height is now a featur - recommend going through GlobalDefinitions; fixed lava pool collision to work on pool entry rather than drown level; lava now burns; painbox damage now is directed towards players control agency first * drowning timer works correctly for both player and vehicle targets; timing and dive depth information for targets defined, but currently originates from a generic location (ObjectDefinition); packet OSM has been modified for efficiency; classes for environment features previously exclusive to drowning mechanics have been pushed towards generic naming conventions * added sea and pools for z4, z5, z8, and z10 * vehicles now take damage (to the point of destruction) when exposed to lava due the expansion of environmental damage reasons and environmental damage modifiers; modification of the environment exposure lingo; streamlining of vital activity record system * added basic drown params to flying vehicle definitions; object trait and control mixin for environment interaction, code moved from SessionActor and WorldSession * separated environmental classes; handled waterlogged flying vehicles, in properties and code; wrote comments and tests * players mounting vehicles and players subjected to the vehicle transfer process should receive updated drown-state status of the vehicle; drowning should suspend while in the middle of vehicle transfer, in the case the process is long * increased damage performed to vehicles by lava
58 lines
1.6 KiB
Scala
58 lines
1.6 KiB
Scala
// Copyright (c) 2017 PSForever
|
|
package game
|
|
|
|
import org.specs2.mutable._
|
|
import net.psforever.packet._
|
|
import net.psforever.packet.game._
|
|
import net.psforever.types.{OxygenState, PlanetSideGUID}
|
|
import scodec.bits._
|
|
|
|
class OxygenStateMessageTest extends Specification {
|
|
val string_self = hex"78 4b00f430"
|
|
val string_vehicle = hex"78 4b00f4385037a180"
|
|
|
|
"decode (self)" in {
|
|
PacketCoding.decodePacket(string_self).require match {
|
|
case OxygenStateMessage(player, vehicle) =>
|
|
player.guid mustEqual PlanetSideGUID(75)
|
|
player.progress mustEqual 50.0
|
|
player.condition mustEqual OxygenState.Suffocation
|
|
|
|
vehicle.isDefined mustEqual false
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"decode (vehicle)" in {
|
|
PacketCoding.decodePacket(string_vehicle).require match {
|
|
case OxygenStateMessage(player, vehicle) =>
|
|
player.guid mustEqual PlanetSideGUID(75)
|
|
player.progress mustEqual 50.0f
|
|
player.condition mustEqual OxygenState.Suffocation
|
|
|
|
vehicle.isDefined mustEqual true
|
|
val v = vehicle.get
|
|
v.guid mustEqual PlanetSideGUID(1546)
|
|
v.progress mustEqual 50.0f
|
|
v.condition mustEqual OxygenState.Suffocation
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode (self)" in {
|
|
val msg = OxygenStateMessage(PlanetSideGUID(75), 50.0f)
|
|
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string_self
|
|
}
|
|
|
|
"encode (vehicle)" in {
|
|
val msg =
|
|
OxygenStateMessage(PlanetSideGUID(75), 50.0f, PlanetSideGUID(1546), 50.0f)
|
|
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string_vehicle
|
|
}
|
|
}
|