Skip to content

Commit

Permalink
Enable house vehicles to be respawned with "/v respawn"
Browse files Browse the repository at this point in the history
Fixes #791
  • Loading branch information
RussellLVP committed Jul 24, 2020
1 parent 93be183 commit ac19ebf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
6 changes: 0 additions & 6 deletions javascript/features/vehicles/vehicle_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 2 additions & 5 deletions javascript/features/vehicles/vehicle_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}

Expand Down

0 comments on commit ac19ebf

Please sign in to comment.