mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-03-09 15:30:31 +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
71 lines
1.7 KiB
Scala
71 lines
1.7 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 PlayerStateMessageUpstreamTest extends Specification {
|
|
val string = hex"BD 4B000 E377BA575B616C640A70004014060110007000000"
|
|
|
|
"decode" in {
|
|
PacketCoding.decodePacket(string).require match {
|
|
case PlayerStateMessageUpstream(
|
|
avatar_guid,
|
|
pos,
|
|
vel,
|
|
facingYaw,
|
|
facingPitch,
|
|
facingYawUpper,
|
|
seq_time,
|
|
unk1,
|
|
is_crouching,
|
|
is_jumping,
|
|
jump_thrust,
|
|
is_cloaked,
|
|
unk2,
|
|
unk3
|
|
) =>
|
|
avatar_guid mustEqual PlanetSideGUID(75)
|
|
pos mustEqual Vector3(3694.1094f, 2735.4531f, 90.84375f)
|
|
vel.contains(Vector3(15.75f, 9.3375f, 0.0f)) mustEqual true
|
|
facingYaw mustEqual 61.875f
|
|
facingPitch mustEqual -8.4375f
|
|
facingYawUpper mustEqual 0.0f
|
|
seq_time mustEqual 136
|
|
unk1 mustEqual 0
|
|
is_crouching mustEqual false
|
|
is_jumping mustEqual false
|
|
jump_thrust mustEqual false
|
|
is_cloaked mustEqual false
|
|
unk2 mustEqual 112
|
|
unk3 mustEqual 0
|
|
case _ =>
|
|
ko
|
|
}
|
|
}
|
|
|
|
"encode" in {
|
|
val msg = PlayerStateMessageUpstream(
|
|
PlanetSideGUID(75),
|
|
Vector3(3694.1094f, 2735.4531f, 90.84375f),
|
|
Some(Vector3(15.75f, 9.3375f, 0.0f)),
|
|
61.875f,
|
|
-8.4375f,
|
|
0.0f,
|
|
136,
|
|
0,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
112,
|
|
0
|
|
)
|
|
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
|
|
|
pkt mustEqual string
|
|
}
|
|
}
|