PSF-BotServer/src/test/scala/game/objectcreate/CommonFieldDataWithPlacementTest.scala
Fate-JH 6a349d0fe1
Repeating the Obvious (#1233)
* adding chat and event messages that have been neglected since; these are easy additions

* completely retooled water interactions for players and vehicles to handle a wading status, before drowning; when player with llu or vehicle with player with llu come into contact with water in this wading state, the llu is lost and the facility hack ends; adding messages to support this and differentiate from an llu facility capture timeout

* periodic message while the llu is active, whether or not there is a carrier, until the hack is finished

* message when inventory is full (assumes player inventory destination, but item winds up in hand due to lack of space, but it works)

* when changing exo-suits, complain if equipment has to be deleted; dropped equipment is limited to special equipment; report a player pointlessly

* announce ams decay to players who have just spawned on an ams, when they spawn on that ams, and for the last round of spawnees when the vehicle finally deconstructs; due to use of the word 'bound' this may be an incorrect application, but matrixing doesn't work anyway

* deconstruction message for would-be driver when vehicle is abandoned on spawn pad; tempo on message delivery is different than usual

* message when player is kicked from orbital shuttle gantry; message when player attempts to bail in a warp gate; message when player attempts to bail from a droppod; stop player from succeeding in bailing from a droppod

* vehicle pad deconstruction complete message; message when nc max shield deactivates when out of capacitor power or when max opens fire; message when ams can not deploy because it is blocked by other entities; message when facility capture requires ntu

* message for deployables being blocked; cleaning up dev test section

* Yellow Ownership (#1226)

* just some tinkering and clean-up

* converted DeployItem from AvatarService to LocalService; attempt at resolving missing overwhip yellow ring is complicated; vehicle ownership packet wqorks on deployables that are mountable, but is less successful on normal simple deployables

* restoration of yellow ring of ownership around deployables; changes to variant of CommonFieldData transcorder used on certain deployable transcoders; static values are assigned parameter names and public variables are given types for completion

* initial packet for GenericObjectAction2Message and tests; repaired transcoders and tests for TRAP and small turrets

* force redraw of the whole boomer to assert reassignment of ownership; it's heavy-handed but it works

* deployable ownership should be asserted during both re-zoning and revival; refactoring of code in ZoningOperations

* message when inventory is full (assumes player inventory destination, but item winds up in hand due to lack of space, but it works)

* vehicle deployment messages added in, then deployment was fixed to accommodate an explicit caller, and that changed a whole lot of the deployment loop for messages; environmental activity was modified to maointain a more responsible start/stop transition; many many test changes (still an issue with a lot of them)

* moving around conditions for losing the llu

* the question of one extra bit for small deployables; also, all tests pass successfully, tho resource silo use remains coin flip; what sorcery is this

* duplicate capture lost message eliminated; flag lost violently due to environment in general rather than just water interaction; flag lost violently due to warp gate envelope interaction; flag lost due to be dropped in an unsafe position

* vary the testing depth for water interaction

* darn tests

* fixed vehicle interference; added missing ArmorShieldOff message; clearing countdown after vehicle spawn should stop countdown from appearing in subsequent vehicle spawns

* the router needs 20m of clearance

* removing the shared group interference information from routers
2024-10-01 16:01:00 -04:00

58 lines
2.2 KiB
Scala

// Copyright (c) 2017 PSForever
package game.objectcreate
import net.psforever.packet.PacketCoding
import net.psforever.packet.game.ObjectCreateMessage
import net.psforever.packet.game.objectcreate._
import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID, Vector3}
import org.specs2.mutable._
import scodec.bits._
class CommonFieldDataWithPlacementTest extends Specification {
val string_boomer = hex"17 A5000000 CA0000F1630938D5A8F1400003F0031100"
"Boomer" should {
"decode" in {
PacketCoding.decodePacket(string_boomer).require match {
case ObjectCreateMessage(len, cls, guid, parent, data) =>
len mustEqual 165
cls mustEqual ObjectClass.boomer
guid mustEqual PlanetSideGUID(3840)
parent.isDefined mustEqual false
data match {
case SmallDeployableData(CommonFieldDataWithPlacement(pos, com)) =>
pos.coord mustEqual Vector3(4704.172f, 5546.4375f, 82.234375f)
pos.orient mustEqual Vector3.z(272.8125f)
com match {
case CommonFieldData(faction, bops, alternate, v1, v2, v3, v4, v5, fguid) =>
faction mustEqual PlanetSideEmpire.TR
bops mustEqual false
alternate mustEqual false
v1 mustEqual false
v2.isEmpty mustEqual true
v3 mustEqual false
v4.isEmpty mustEqual true
v5.isEmpty mustEqual true
fguid mustEqual PlanetSideGUID(4145)
case _ =>
ko
}
case _ =>
ko
}
case _ =>
ko
}
}
"encode" in {
val obj = SmallDeployableData(CommonFieldDataWithPlacement(
PlacementData(Vector3(4704.172f, 5546.4375f, 82.234375f), Vector3.z(272.8125f)),
CommonFieldData(PlanetSideEmpire.TR, bops = false, alternate = false, v1 = false, None, jammered = false, None, None, PlanetSideGUID(4145))
))
val msg = ObjectCreateMessage(ObjectClass.boomer, PlanetSideGUID(3840), obj)
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
pkt mustEqual string_boomer
}
}
}