mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-06 13:40:21 +00:00
Vehicles can now be pulled from assigned and initialized terminals. The vehicle's chosen spawn pad controls (or paces) all aspects of the spawning process. Support Actors ensure that a fully-realized Vehicle will be unloaded and unregistered if left alone, either right after spawning on the pad or after an extended period of time. The latter half of the procedure used for spawning vehicles is a temporary workaround until future analysis and functionality of the server vehicle override packet is incorporated. Weapons: Weapons will now construct their own default magazines thanks to a switch from Ammo.Value to AmmoBoxDefinition in the ToolDefinition. GenericObjectActionMessage : The only thing this packet does, at the moment, is obscure the player when he is being promoted into the owner of a vehicle.
47 lines
2.1 KiB
Scala
47 lines
2.1 KiB
Scala
// Copyright (c) 2017 PSForever
|
|
package objects.terminal
|
|
|
|
import akka.actor.ActorRef
|
|
import net.psforever.objects.{GlobalDefinitions, Player}
|
|
import net.psforever.objects.serverobject.terminals.Terminal
|
|
import net.psforever.packet.game.{ItemTransactionMessage, PlanetSideGUID}
|
|
import net.psforever.types.{CharacterGender, PlanetSideEmpire, TransactionType}
|
|
import org.specs2.mutable.Specification
|
|
|
|
class VehicleTerminalCombinedTest extends Specification {
|
|
"Ground_Vehicle_Terminal" should {
|
|
val player = Player("test", PlanetSideEmpire.TR, CharacterGender.Male, 0, 0)
|
|
|
|
"construct" in {
|
|
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
|
terminal.Actor mustEqual ActorRef.noSender
|
|
}
|
|
|
|
"player can buy a ground vehicle, the harasser ('two_man_assault_buggy')" in {
|
|
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
|
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "two_man_assault_buggy", 0, PlanetSideGUID(0))
|
|
val reply = terminal.Request(player, msg)
|
|
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
|
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
|
reply2.vehicle.Definition mustEqual GlobalDefinitions.two_man_assault_buggy
|
|
reply2.loadout mustEqual Nil //TODO
|
|
}
|
|
|
|
"player can buy a flying vehicle, the reaver ('lightgunship')" in {
|
|
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
|
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "lightgunship", 0, PlanetSideGUID(0))
|
|
val reply = terminal.Request(player, msg)
|
|
reply.isInstanceOf[Terminal.BuyVehicle] mustEqual true
|
|
val reply2 = reply.asInstanceOf[Terminal.BuyVehicle]
|
|
reply2.vehicle.Definition mustEqual GlobalDefinitions.lightgunship
|
|
reply2.loadout mustEqual Nil //TODO
|
|
}
|
|
|
|
"player can not buy a fake vehicle ('harasser')" in {
|
|
val terminal = Terminal(GlobalDefinitions.vehicle_terminal_combined)
|
|
val msg = ItemTransactionMessage(PlanetSideGUID(1), TransactionType.Buy, 0, "harasser", 0, PlanetSideGUID(0))
|
|
|
|
terminal.Request(player, msg) mustEqual Terminal.NoDeal()
|
|
}
|
|
}
|
|
}
|