mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-25 06:15:25 +00:00
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
This commit is contained in:
parent
d2d7c2e09b
commit
9708bf9beb
49 changed files with 593 additions and 502 deletions
30
src/test/scala/game/GenericObjectAction2MessageTest.scala
Normal file
30
src/test/scala/game/GenericObjectAction2MessageTest.scala
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.PlanetSideGUID
|
||||
import scodec.bits._
|
||||
|
||||
class GenericObjectAction2MessageTest extends Specification {
|
||||
val string = hex"80 38C139212 0"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.decodePacket(string).require match {
|
||||
case GenericObjectAction2Message(unk, guid1, guid2) =>
|
||||
unk mustEqual 1
|
||||
guid1 mustEqual PlanetSideGUID(2502)
|
||||
guid2 mustEqual PlanetSideGUID(2505)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = GenericObjectAction2Message(1, PlanetSideGUID(2502), PlanetSideGUID(2505))
|
||||
val pkt = PacketCoding.encodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
|
@ -32,9 +32,9 @@ class SmallTurretDataTest extends Specification {
|
|||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(false) mustEqual true
|
||||
deploy.v4.isEmpty mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(7742)
|
||||
deploy.guid mustEqual PlanetSideGUID(3871)
|
||||
|
||||
health mustEqual 0
|
||||
case _ =>
|
||||
|
|
@ -63,9 +63,9 @@ class SmallTurretDataTest extends Specification {
|
|||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(true) mustEqual true
|
||||
deploy.v4.isEmpty mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(8208)
|
||||
deploy.guid mustEqual PlanetSideGUID(4232)
|
||||
|
||||
health mustEqual 255
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ class SmallTurretDataTest extends Specification {
|
|||
val obj = SmallTurretData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3(4577.7812f, 5624.828f, 72.046875f), Vector3(0, 2.8125f, 264.375f)),
|
||||
CommonFieldData(PlanetSideEmpire.NC, false, true, true, None, false, Some(false), None, PlanetSideGUID(7742))
|
||||
CommonFieldData(PlanetSideEmpire.NC, bops = false, alternate = true, v1 = true, None, jammered = false, None, None, PlanetSideGUID(3871))
|
||||
),
|
||||
0
|
||||
)
|
||||
|
|
@ -137,7 +137,7 @@ class SmallTurretDataTest extends Specification {
|
|||
val obj = SmallTurretData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3(4527.633f, 6271.3594f, 70.265625f), Vector3(0, 0, 154.6875f)),
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, Some(true), None, PlanetSideGUID(8208))
|
||||
CommonFieldData(PlanetSideEmpire.VS, bops = false, alternate = false, v1 = true, None, jammered = false, None, None, PlanetSideGUID(4232))
|
||||
),
|
||||
255,
|
||||
InventoryData(
|
||||
|
|
@ -149,11 +149,11 @@ class SmallTurretDataTest extends Specification {
|
|||
WeaponData(
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
v1 = true,
|
||||
None,
|
||||
false,
|
||||
jammered = false,
|
||||
None,
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
|
|
@ -166,11 +166,11 @@ class SmallTurretDataTest extends Specification {
|
|||
0,
|
||||
CommonFieldData(
|
||||
PlanetSideEmpire.NEUTRAL,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
bops = false,
|
||||
alternate = false,
|
||||
v1 = true,
|
||||
None,
|
||||
false,
|
||||
jammered = false,
|
||||
Some(false),
|
||||
None,
|
||||
PlanetSideGUID(0)
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ class TRAPDataTest extends Specification {
|
|||
deploy.v1 mustEqual true
|
||||
deploy.v2.isEmpty mustEqual true
|
||||
deploy.jammered mustEqual false
|
||||
deploy.v4.contains(true) mustEqual true
|
||||
deploy.v4.isEmpty mustEqual true
|
||||
deploy.v5.isEmpty mustEqual true
|
||||
deploy.guid mustEqual PlanetSideGUID(4748)
|
||||
deploy.guid mustEqual PlanetSideGUID(2502)
|
||||
health mustEqual 255
|
||||
case _ =>
|
||||
ko
|
||||
|
|
@ -45,7 +45,7 @@ class TRAPDataTest extends Specification {
|
|||
val obj = TRAPData(
|
||||
CommonFieldDataWithPlacement(
|
||||
PlacementData(Vector3(3572.4453f, 3277.9766f, 114.0f), Vector3.z(90)),
|
||||
CommonFieldData(PlanetSideEmpire.VS, false, false, true, None, false, Some(true), None, PlanetSideGUID(4748))
|
||||
CommonFieldData(PlanetSideEmpire.VS, bops = false, alternate = false, v1 = true, None, jammered = false, None, None, PlanetSideGUID(2502))
|
||||
),
|
||||
255
|
||||
)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class DeployableBehaviorSetupTest extends ActorTest {
|
|||
case _ => assert(false, "self-setup test - no spawn fx")
|
||||
}
|
||||
eventsMsgs(1) match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq jmine, "self-setup test - not same mine")
|
||||
case _ =>
|
||||
assert( false, "self-setup test - wrong deploy message")
|
||||
|
|
@ -189,7 +189,7 @@ class DeployableBehaviorSetupOwnedP2Test extends FreedContextActorTest {
|
|||
case _ => assert(false, "owned setup test, 2 - no spawn fx")
|
||||
}
|
||||
eventsMsgs(3) match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq jmine, "owned setup test, 2 - not same mine")
|
||||
case _ =>
|
||||
assert( false, "owned setup test, 2 - wrong deploy message")
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class TelepadDeployableNoRouterTest extends ActorTest {
|
|||
|
||||
val eventsMsgs = eventsProbe.receiveN(4, 10.seconds)
|
||||
eventsMsgs.head match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq telepad, "no-router telepad deployable testt - not same telepad")
|
||||
case _ =>
|
||||
assert( false, "no-router telepad deployable test - wrong deploy message")
|
||||
|
|
@ -117,7 +117,7 @@ class TelepadDeployableNoActivationTest extends ActorTest {
|
|||
|
||||
val eventsMsgs = eventsProbe.receiveN(4, 10.seconds)
|
||||
eventsMsgs.head match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq telepad, "no-activate telepad deployable testt - not same telepad")
|
||||
case _ =>
|
||||
assert( false, "no-activate telepad deployable test - wrong deploy message")
|
||||
|
|
@ -190,7 +190,7 @@ class TelepadDeployableAttemptTest extends ActorTest {
|
|||
val eventsMsgs = eventsProbe.receiveN(2, 10.seconds)
|
||||
val routerMsgs = routerProbe.receiveN(1, 10.seconds)
|
||||
eventsMsgs.head match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq telepad, "link attempt telepad deployable testt - not same telepad")
|
||||
case _ =>
|
||||
assert( false, "link attempt telepad deployable test - wrong deploy message")
|
||||
|
|
@ -263,7 +263,7 @@ class TelepadDeployableResponseFromRouterTest extends FreedContextActorTest {
|
|||
|
||||
val eventsMsgs = eventsProbe.receiveN(9, 10.seconds)
|
||||
eventsMsgs.head match {
|
||||
case AvatarServiceMessage("test", AvatarAction.DeployItem(PlanetSideGUID(0), obj)) =>
|
||||
case LocalServiceMessage("test", LocalAction.DeployItem(obj)) =>
|
||||
assert(obj eq telepad, "link to router test - not same telepad")
|
||||
case _ =>
|
||||
assert( false, "link to router test - wrong deploy message")
|
||||
|
|
|
|||
|
|
@ -78,6 +78,31 @@ class LocalService5Test extends ActorTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class DeployItemTest extends ActorTest {
|
||||
ServiceManager.boot(system)
|
||||
val service = system.actorOf(Props(classOf[LocalService], Zone.Nowhere), "deploy-item-test-service")
|
||||
val objDef = GlobalDefinitions.motionalarmsensor
|
||||
val obj = new SensorDeployable(objDef)
|
||||
obj.Position = Vector3(1, 2, 3)
|
||||
obj.Orientation = Vector3(4, 5, 6)
|
||||
obj.GUID = PlanetSideGUID(40)
|
||||
val pkt = ObjectCreateMessage(
|
||||
objDef.ObjectId,
|
||||
obj.GUID,
|
||||
objDef.Packet.ConstructorData(obj).get
|
||||
)
|
||||
|
||||
"AvatarService" should {
|
||||
"pass DeployItem" in {
|
||||
service ! Service.Join("test")
|
||||
service ! LocalServiceMessage("test", LocalAction.DeployItem(obj))
|
||||
expectMsg(LocalServiceResponse("/test/Local", PlanetSideGUID(0), LocalResponse.SendResponse(pkt)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DeployableMapIconTest extends ActorTest {
|
||||
ServiceManager.boot(system)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue