Skip to content
Permalink
Browse files
Enable house vehicles to be respawned with "/v respawn"
Fixes #791
  • Loading branch information
RussellLVP committed Jul 24, 2020
1 parent 93be183 commit ac19ebfec00ca5c8f802055bb8e3b7da4a43a08e
Showing 2 changed files with 2 additions and 11 deletions.
@@ -431,12 +431,6 @@ class VehicleCommands {
return;
}

// Bail out if the |subject| is not driving a vehicle, or it's not managed by this system.
if (!this.manager_.isManagedVehicle(vehicle)) {
player.sendMessage(Message.VEHICLE_NOT_DRIVING, subject.name);
return;
}

this.manager_.respawnVehicle(vehicle);

player.sendMessage(Message.VEHICLE_RESPAWNED, vehicle.model.name);
@@ -290,10 +290,7 @@ class VehicleManager {
// vehicle will be reset prior to the actual respawn.
respawnVehicle(vehicle) {
const result = this.findStreamableVehicle(vehicle);
if (!result)
throw new Error(`Unable to respawn vehicles not managed by the Vehicle Manager.`);

// Recursively respawn the vehicle and all trailers attached.

while (vehicle) {
const trailer = vehicle.trailer;

@@ -302,7 +299,7 @@ class VehicleManager {
}

// If the |vehicle| was an ephemeral vehicle, delete it from the server.
if (result.type === VehicleManager.kTypeEphemeral)
if (result && result.type === VehicleManager.kTypeEphemeral)
this.streamer_().deleteVehicle(result.streamableVehicle);
}

0 comments on commit ac19ebf

Please sign in to comment.