mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
minor changes to some global functions
This commit is contained in:
parent
e793d827fa
commit
b508f37ff1
1643
.luacheckrc
1643
.luacheckrc
File diff suppressed because it is too large
Load Diff
@ -32,3 +32,27 @@ function is_loaded(module)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function is_game_modded()
|
||||
local i = 0
|
||||
for k, _ in pairs(game.active_mods) do
|
||||
i = i + 1
|
||||
if i > 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function is_mod_loaded(module)
|
||||
if not module then
|
||||
return false
|
||||
end
|
||||
|
||||
local res = script.active_mods[module]
|
||||
if res then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -24,17 +24,6 @@ Global.register(
|
||||
|
||||
local Public = {}
|
||||
|
||||
local function is_game_modded()
|
||||
local i = 0
|
||||
for k, _ in pairs(game.active_mods) do
|
||||
i = i + 1
|
||||
if i > 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function apply_stash(player)
|
||||
local stash = this.logistics[player.index]
|
||||
if stash then
|
||||
|
@ -18,17 +18,6 @@ Global.register(
|
||||
end
|
||||
)
|
||||
|
||||
local function is_game_modded()
|
||||
local i = 0
|
||||
for k, _ in pairs(game.active_mods) do
|
||||
i = i + 1
|
||||
if i > 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function custom_surface()
|
||||
local i = 0
|
||||
for k, _ in pairs(game.surfaces) do
|
||||
@ -131,7 +120,9 @@ local on_cutscene_waypoint_reached = function(event)
|
||||
player.exit_cutscene()
|
||||
|
||||
if custom_surface() then
|
||||
player.teleport(game.surfaces[3].find_non_colliding_position('character', {64, 64}, 50, 0.5), game.surfaces[3].name)
|
||||
if player.surface.name == 'nauvis' then
|
||||
player.teleport(game.surfaces[3].find_non_colliding_position('character', {64, 64}, 50, 0.5), game.surfaces[3].name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -152,7 +143,9 @@ local skip_crash_site_cutscene = function(event)
|
||||
player.exit_cutscene()
|
||||
end
|
||||
if custom_surface() then
|
||||
player.teleport(game.surfaces[3].find_non_colliding_position('character', {64, 64}, 50, 0.5), game.surfaces[3].name)
|
||||
if player.surface.name == 'nauvis' then
|
||||
player.teleport(game.surfaces[3].find_non_colliding_position('character', {64, 64}, 50, 0.5), game.surfaces[3].name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -220,7 +213,7 @@ Event.on_init(
|
||||
local game_has_mods = is_game_modded()
|
||||
if game_has_mods then
|
||||
this.modded = true
|
||||
this.disable_crashsite = false
|
||||
this.disable_crashsite = true
|
||||
this.created_items = created_items()
|
||||
this.respawn_items = respawn_items()
|
||||
this.crashed_ship_items = ship_items()
|
||||
|
Loading…
Reference in New Issue
Block a user