1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-30 04:30:58 +02:00

Fixed jail bug when player in spidertron

As per issue #1102.
- Checks if player is in spidertron
- Sets autopilot destination to position when jail used.
- Tried using similar to the train check but it didn't work for spidertron.
This commit is contained in:
Jayefuu 2020-11-13 19:36:20 +00:00
parent b2f5cfb7c4
commit 9a2fcd03d5

View File

@ -195,7 +195,6 @@ function Module.jail(target_player, player)
-- Add player to jail group
permission_group.add_player(target_player)
-- If in vehicle, kick them out and set the speed to 0.
local vehicle = target_player.vehicle
if vehicle then
@ -203,6 +202,11 @@ function Module.jail(target_player, player)
-- Trains can't have their speed set via ent.speed and instead need ent.train.speed
if train then
train.speed = 0
elseif vehicle.name == "spidertron" then
-- spidertron's can't have their speed set and will stop if a player is driving and exits
-- if the player uses spidertron remote then the spidertron will continue without the player
-- so set the spidertron autopilot position to its current position before kicking hte player
vehicle.autopilot_destination = vehicle.position
else
vehicle.speed = 0
end