mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-03-07 06:20:29 +00:00
Class and Actor mixins for Deployment state. The logic is surprisingly self-contained, mostly. DriveState: This is not the former DriveState Enumeration of /packet/game/objectcreate/. This is now a /types/ Enumeration shared across /common/ objects and serves the functionality of both, at least to the extent that it is understood. Functions are includes that define the logic order or state changes and divides states into (two) groups. VehicleService: The directory /pslogin/src/test has been created and tests have been migrated there. Originally, the tests were located in the wrong place and were being skipped when not executed manually. They should now appear in coverage reports and be run as a part of continuous integration.
41 lines
1.1 KiB
Scala
41 lines
1.1 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.{DriveState, Vector3}
|
|
import scodec.bits._
|
|
|
|
class DeployRequestMessageTest extends Specification {
|
|
val string = hex"4b 4b00 7c01 40 0cf73b52aa6a9300"
|
|
|
|
"decode" in {
|
|
PacketCoding.DecodePacket(string).require match {
|
|
case DeployRequestMessage(player_guid, vehicle_guid, deploy_state, unk2, unk3, pos) =>
|
|
player_guid mustEqual PlanetSideGUID(75)
|
|
vehicle_guid mustEqual PlanetSideGUID(380)
|
|
deploy_state mustEqual DriveState.Deploying
|
|
unk2 mustEqual 0
|
|
unk3 mustEqual false
|
|
pos.x mustEqual 4060.1953f
|
|
pos.y mustEqual 2218.8281f
|
|
pos.z mustEqual 155.32812f
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = DeployRequestMessage(
|
|
PlanetSideGUID(75),
|
|
PlanetSideGUID(380),
|
|
DriveState.Deploying,
|
|
0, false,
|
|
Vector3(4060.1953f, 2218.8281f, 155.32812f)
|
|
)
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|