1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-30 04:40:54 +02:00

Mtn v3 - check if player is below train in reverse mode

This commit is contained in:
Gerkiz 2024-04-08 01:06:08 +02:00
parent 11a0fb2353
commit 5eb610ff9e

View File

@ -1395,7 +1395,16 @@ function Public.on_player_joined_game(event)
if not locomotive or not locomotive.valid then
return
end
if player.position.y > locomotive.position.y then
local adjusted_zones = Public.get('adjusted_zones')
local distance_from_train
if adjusted_zones.reversed then
distance_from_train = player.position.y < locomotive.position.y
else
distance_from_train = player.position.y > locomotive.position.y
end
if distance_from_train then
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
if pos then
player.teleport(pos, surface)