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

various fixes to modules

This commit is contained in:
Gerkiz 2021-07-07 12:22:22 +02:00
parent 3ed0199b2b
commit 0396c40e76
6 changed files with 39 additions and 5 deletions

View File

@ -1224,7 +1224,13 @@ function Public.on_player_joined_game(event)
local p = {x = player.position.x, y = player.position.y}
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
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)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos, surface)
end
end
end

View File

@ -332,7 +332,13 @@ local function check_if_players_are_in_nauvis(ic)
for _, player in pairs(game.connected_players) do
local main_surface = game.surfaces[ic.allowed_surface]
if player.surface.name == 'nauvis' then
player.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface)
local pos = main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5)
if pos then
player.teleport(pos, main_surface)
else
pos = game.forces.player.get_spawn_position(main_surface)
player.teleport(pos, main_surface)
end
end
end
end

View File

@ -849,6 +849,10 @@ function Public.use_cargo_wagon_door_with_entity(icw, player, door)
return
end
if not wagon.entity or not wagon.entity.valid then
return
end
player_data.fallback_surface = wagon.entity.surface.index
player_data.fallback_position = {wagon.entity.position.x, wagon.entity.position.y}

View File

@ -1128,7 +1128,7 @@ local function gui_click(event)
}
)
this.locomotive_max_health = this.locomotive_max_health + 10000
this.locomotive_max_health = this.locomotive_max_health + 20000
--[[
this.locomotive_max_health = this.locomotive_max_health + (this.locomotive_max_health * 0.5)
@ -1836,7 +1836,13 @@ local function on_player_changed_surface(event)
if not surface or not surface.valid then
return
end
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
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)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos, surface)
end
end
if string.sub(player.surface.name, 0, #map_name) ~= map_name then

View File

@ -1117,7 +1117,13 @@ local function on_player_used_capsule(event)
end
end
elseif obj_name == 'warp-gate' then
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)
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)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos, surface)
end
rpg_t.mana = 0
Public.damage_player_over_time(player, math.random(8, 16))
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}

View File

@ -790,6 +790,12 @@ local function command_to_main_target(group, bypass)
debug_print('get_main_command - got commands')
local surface_index = WD.get('surface_index')
if group.surface.index ~= surface_index then
return
end
group.set_command(
{
type = defines.command.compound,