Few more small vehicle related tweaks (#320)

* Revert back to using vehicle GUID for target gone check when jacking, as GUIDs are now retained when an object is removed from the world

* Don't allow dead vehicles to be repaired

* Don't show repair bar on dead vehicles

* Add IsDead flag to Vehicle
This commit is contained in:
Mazo 2020-01-17 18:20:33 +00:00 committed by Fate-JH
parent db82b9f01f
commit d0bd823e9e
3 changed files with 46 additions and 8 deletions

View file

@ -861,7 +861,7 @@ class WorldSessionActor extends Actor
case Zone.Lattice.SpawnPoint(zone_id, spawn_tube) =>
var (pos, ori) = spawn_tube.SpecificPoint(continent.GUID(player.VehicleSeated) match {
case Some(obj : Vehicle) if obj.Health > 0 =>
case Some(obj : Vehicle) if !obj.IsDead =>
obj
case _ =>
player
@ -3172,8 +3172,7 @@ class WorldSessionActor extends Actor
if(!target.HasGUID) {
// Target is gone, cancel the hack.
// Note: I couldn't find any examples of an object that no longer has a GUID in packet captures, but sending the hacking player's GUID as the target to cancel the hack seems to work
sendResponse(HackMessage(progressType, player.GUID, player.GUID, 0, 0L, HackState.Cancelled, 8L))
sendResponse(HackMessage(progressType, target.GUID, player.GUID, 0, 0L, HackState.Cancelled, 8L))
}
else if(vis == HackState.Cancelled) {
// Object moved. Cancel the hack (e.g. vehicle drove away)
@ -5171,9 +5170,8 @@ class WorldSessionActor extends Actor
else if(equipment.isDefined) {
equipment.get.Definition match {
case GlobalDefinitions.nano_dispenser =>
//TODO repairing behavior
if (!player.isMoving && Vector3.Distance(player.Position, obj.Position) < 5) {
if (obj.Health < obj.MaxHealth) {
if (obj.Health < obj.MaxHealth && !obj.IsDead) {
obj.Health += 48
// sendResponse(QuantityUpdateMessage(PlanetSideGUID(8214),ammo_quantity_left))
val RepairPercent: Int = obj.Health * 100 / obj.MaxHealth
@ -5918,7 +5916,7 @@ class WorldSessionActor extends Actor
case Some(vehicleGUID) =>
continent.GUID(vehicleGUID) match {
case Some(obj : Vehicle) =>
if(obj.Health > 0) { //vehicle will try to charge even if destroyed
if(!obj.IsDead) { //vehicle will try to charge even if destroyed
obj.Actor ! Vehicle.ChargeShields(15)
}
case _ =>
@ -8311,7 +8309,7 @@ class WorldSessionActor extends Actor
}
else {
continent.GUID(player.VehicleSeated) match {
case Some(obj : Vehicle) if obj.Health > 0 =>
case Some(obj : Vehicle) if !obj.IsDead =>
cluster ! Zone.Lattice.RequestSpawnPoint(sanctNumber, tplayer, 12) //warp gates for functioning vehicles
case None =>
cluster ! Zone.Lattice.RequestSpawnPoint(sanctNumber, tplayer, 7) //player character spawns