2017-03-06 19:30:45 -05:00
|
|
|
// Copyright (c) 2017 PSForever
|
2017-03-04 10:06:10 -05:00
|
|
|
package game
|
|
|
|
|
|
|
|
|
|
import org.specs2.mutable._
|
|
|
|
|
import net.psforever.packet._
|
|
|
|
|
import net.psforever.packet.game._
|
Destroy and repair (#346)
* bog-standard order_terminal amenities now take damage up to the point of destruction and can be repaired from destruction to functional to the point of being fully repaired; this is mostly proof fo concept
* restored proper destruction to FacilityTurrets; extended proper rrepairs to FacilityTurrets; co-opted terminal hacking into TerminalControl; started to expand on hacking protocol, but chose restraint
* changes made thus that a clear Definition hierarchy is established; all of this is in line with making future changes to repair/destroy variables, and making generic the repair code
* all meaningful facility amenities take damage and can be repaired; spawn tubes can be destroyed and the base will properly lose spawns (and show it on the map); some hack logic has been redistributed into the appropriate control objects, following in the wake of repair/damage logic
* deployables are repairable; the TRAP has been converted into a ComplexDeployable; changed the nature of the Repairable traits
* player bank repair and medapp heal has been moved out from WSA into PlayerControl
* overhaul of Progress callback system and the inclusion of player revival as a Progress activity
* begun relocating functionality for hacking outside of WSA; set up behavoir mixin for cargo operations, in order to move vehicle hack function, but did not yet integrate
* integration of the actor behavior mixin for vehicle cargo operations to support the integration of vehicle hacking finalization
* establishing inheritance/override potential of Damageable activity; Generator and SpawnTube map behavior behavior (currently inactive)
* ImplantTerminalMech objects now have a 'with-coordinates' constructor and a deprecated 'no-coordinates' constructor; implants mechs and interfaces are now damageable and repairable, and their damage state can also block mounting
* generators are destroyed and repaired properly, and even explode, killing a radius-worth of players
* destroy and repair pass on deployables, except for explosive types
* Damageable pass; client synchronization pass
* helpful comments
* some tests for damageable and repairable; refined output and repaired existing tests
* enabled friendly fire check and recovery
* handled friendly fire against allied mines; moved jammer code to common damageable behavior
* tweaks to damageability, infantry heal and repair, and sensor and explosive animations
* animations; framework for future vitals events; closing database connections
* adding some deployable tests; fixing a bunch of other tests; History is back
* testing for basic Damageable functions; removing a log message
* finicky animation stuff
* event messages to the Generator to represent health changes
* damage against BFR's is now only used against mythical creatures
* test fix
2020-04-14 15:17:32 -04:00
|
|
|
import net.psforever.types.{PlanetSideEmpire, PlanetSideGeneratorState}
|
2017-03-04 10:06:10 -05:00
|
|
|
import scodec.bits._
|
|
|
|
|
|
|
|
|
|
class BuildingInfoUpdateMessageTest extends Specification {
|
|
|
|
|
val string = hex"a0 04 00 09 00 16 00 00 00 00 80 00 00 00 17 00 00 00 00 00 00 40"
|
|
|
|
|
|
|
|
|
|
"decode" in {
|
|
|
|
|
PacketCoding.DecodePacket(string).require match {
|
2020-07-14 05:54:05 +02:00
|
|
|
case BuildingInfoUpdateMessage(
|
|
|
|
|
continent_guid,
|
|
|
|
|
building_guid,
|
|
|
|
|
ntu_level,
|
|
|
|
|
is_hacked,
|
|
|
|
|
empire_hack,
|
|
|
|
|
hack_time_remaining,
|
|
|
|
|
empire_own,
|
|
|
|
|
unk1,
|
|
|
|
|
unk1x,
|
|
|
|
|
generator_state,
|
|
|
|
|
spawn_tubes_normal,
|
|
|
|
|
force_dome_active,
|
|
|
|
|
lattice_benefit,
|
|
|
|
|
unk3,
|
|
|
|
|
unk4,
|
|
|
|
|
unk5,
|
|
|
|
|
unk6,
|
|
|
|
|
unk7,
|
|
|
|
|
unk7x,
|
|
|
|
|
boost_spawn_pain,
|
|
|
|
|
boost_generator_pain
|
|
|
|
|
) =>
|
2018-03-05 23:26:38 -05:00
|
|
|
continent_guid mustEqual 4
|
|
|
|
|
building_guid mustEqual 9
|
2017-03-04 10:06:10 -05:00
|
|
|
ntu_level mustEqual 1
|
|
|
|
|
is_hacked mustEqual false
|
|
|
|
|
empire_hack mustEqual PlanetSideEmpire.NEUTRAL
|
|
|
|
|
hack_time_remaining mustEqual 0
|
|
|
|
|
empire_own mustEqual PlanetSideEmpire.NC
|
|
|
|
|
unk1 mustEqual 0
|
|
|
|
|
unk1x mustEqual None
|
|
|
|
|
generator_state mustEqual PlanetSideGeneratorState.Normal
|
|
|
|
|
spawn_tubes_normal mustEqual true
|
|
|
|
|
force_dome_active mustEqual false
|
|
|
|
|
lattice_benefit mustEqual 28
|
|
|
|
|
unk3 mustEqual 0
|
|
|
|
|
unk4.size mustEqual 0
|
|
|
|
|
unk4.isEmpty mustEqual true
|
|
|
|
|
unk5 mustEqual 0
|
|
|
|
|
unk6 mustEqual false
|
|
|
|
|
unk7 mustEqual 8
|
|
|
|
|
unk7x mustEqual None
|
|
|
|
|
boost_spawn_pain mustEqual false
|
|
|
|
|
boost_generator_pain mustEqual false
|
|
|
|
|
case _ =>
|
|
|
|
|
ko
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"encode" in {
|
2020-07-14 05:54:05 +02:00
|
|
|
val msg = BuildingInfoUpdateMessage(
|
|
|
|
|
4,
|
2018-03-05 23:26:38 -05:00
|
|
|
9,
|
2017-03-04 10:06:10 -05:00
|
|
|
1,
|
|
|
|
|
false,
|
|
|
|
|
PlanetSideEmpire.NEUTRAL,
|
|
|
|
|
0,
|
|
|
|
|
PlanetSideEmpire.NC,
|
|
|
|
|
0,
|
|
|
|
|
None,
|
|
|
|
|
PlanetSideGeneratorState.Normal,
|
|
|
|
|
true,
|
|
|
|
|
false,
|
|
|
|
|
28,
|
|
|
|
|
0,
|
|
|
|
|
Nil,
|
|
|
|
|
0,
|
|
|
|
|
false,
|
|
|
|
|
8,
|
|
|
|
|
None,
|
|
|
|
|
false,
|
2020-07-14 05:54:05 +02:00
|
|
|
false
|
|
|
|
|
)
|
2017-03-04 10:06:10 -05:00
|
|
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
|
|
|
|
|
|
|
|
|
pkt mustEqual string
|
|
|
|
|
}
|
|
|
|
|
}
|