mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-03-11 16:30:36 +00:00
* pattern for applying damage to player avatar and player-controlled vehicle collisions * pattern for applying damage to targets due to collisions, falling damage and crashing damage individually; fields to support these calculations are provided * modifiers to translate 'small step velocity' to real game velocity, as reported by the HUD; corrections for velocity; corrections for velocity in other packets * fall damage calculations moved to function * basic two-body collisions between GUID-identified game entities and a ward against too many collisions in a short amount of time * bailing mechanics * vssm for non-driven vehicles * comment about vehicle state message field * comments and minor refactoring for current collision damage calc; tank_traps modifier; potential fix for blockmap indexing issue * fixed cargo/carrier vehicle ops * corrections to initialization of ce construction items; adjustments to handling of modifiers for collision damage * modifier change, protection against flight speed and spectator crashes; submerged status is once again known only to the actor * appeasing the automated tests * hopefully paced collisions better; re-did how Infantry collisions are calculated, incorporating mass and exo-suit data; kill feed reporting should be better * adjusted damage values again, focusing on the lesser of or middling results; collision killfeed attribution attempt * kicking offers bail protection; lowered the artificial modifier for one kind of collision damage calculation * correction to the local reference map functions * fixed tests; attempt to zero fall damage distance based on velocity; attempt to block mine damage when spectating
63 lines
1.8 KiB
Scala
63 lines
1.8 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.{PlanetSideGUID, Vector3}
|
|
import scodec.bits._
|
|
|
|
class FireHintMessageTest extends Specification {
|
|
val string = hex"a1 0117 23cd63f1d7480d 000077ff9d1d00"
|
|
val string2 = hex"a1 080e 65af5705074411 0000cffee0fc7b08899f5580"
|
|
|
|
"decode" in {
|
|
PacketCoding.decodePacket(string).require match {
|
|
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
|
weapon_guid mustEqual PlanetSideGUID(5889)
|
|
pos mustEqual Vector3(3482.2734f, 3642.4922f, 53.125f)
|
|
u1 mustEqual 0
|
|
u2 mustEqual 65399
|
|
u3 mustEqual 7581
|
|
u4 mustEqual 0
|
|
u5.isEmpty mustEqual true
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
"decode string2" in {
|
|
PacketCoding.decodePacket(string2).require match {
|
|
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
|
weapon_guid mustEqual PlanetSideGUID(3592)
|
|
pos mustEqual Vector3(2910.789f, 3744.875f, 69.0625f)
|
|
u1 mustEqual 0
|
|
u2 mustEqual 65231
|
|
u3 mustEqual 64736
|
|
u4 mustEqual 3
|
|
u5.contains(Vector3(77.4f, -24.525f, 9.5625f)) mustEqual true
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = FireHintMessage(PlanetSideGUID(5889), Vector3(3482.2734f, 3642.4922f, 53.125f), 0, 65399, 7581, 0)
|
|
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
"encode (string2)" in {
|
|
val msg = FireHintMessage(
|
|
PlanetSideGUID(3592),
|
|
Vector3(2910.789f, 3744.875f, 69.0625f),
|
|
0,
|
|
65231,
|
|
64736,
|
|
3,
|
|
Some(Vector3(77.4f, -24.525f, 9.5625f))
|
|
)
|
|
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string2
|
|
}
|
|
}
|