mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-24 03:47:58 +02:00
Merge branch 'develop' of https://github.com/danielmartin0/ComfyFactorio-Pirates into develop
This commit is contained in:
commit
0dd1904b3b
@ -24,6 +24,18 @@ local bottom_guis_frame = Gui.uid_name()
|
||||
local clear_corpse_button_name = Gui.uid_name()
|
||||
local bottom_quickbar_button_name = Gui.uid_name()
|
||||
|
||||
function Public.toggle_player_frame(player, state)
|
||||
local gui = player.gui
|
||||
local frame = gui.screen[bottom_guis_frame]
|
||||
if frame and frame.valid then
|
||||
if state then
|
||||
frame.visible = true
|
||||
else
|
||||
frame.visible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.get_player_data(player, remove_user_data)
|
||||
if remove_user_data then
|
||||
if this.players[player.index] then
|
||||
@ -32,7 +44,9 @@ function Public.get_player_data(player, remove_user_data)
|
||||
return
|
||||
end
|
||||
if not this.players[player.index] then
|
||||
this.players[player.index] = {}
|
||||
this.players[player.index] = {
|
||||
hidden = false
|
||||
}
|
||||
end
|
||||
return this.players[player.index]
|
||||
end
|
||||
@ -84,7 +98,7 @@ local function destroy_frame(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function create_frame(player, alignment, location, portable)
|
||||
local function create_frame(player, alignment, location, portable, hidden)
|
||||
local gui = player.gui
|
||||
local frame = gui.screen[bottom_guis_frame]
|
||||
if frame and frame.valid then
|
||||
@ -100,6 +114,12 @@ local function create_frame(player, alignment, location, portable)
|
||||
direction = alignment
|
||||
}
|
||||
|
||||
if hidden then
|
||||
frame.visible = false
|
||||
else
|
||||
frame.visible = true
|
||||
end
|
||||
|
||||
frame.style.padding = 3
|
||||
frame.style.top_padding = 4
|
||||
|
||||
@ -188,7 +208,7 @@ local function set_location(player, state)
|
||||
}
|
||||
end
|
||||
|
||||
create_frame(player, alignment, location, data.portable)
|
||||
create_frame(player, alignment, location, data.portable, data.hidden)
|
||||
end
|
||||
|
||||
--- Activates the custom buttons
|
||||
@ -220,7 +240,7 @@ Gui.on_click(
|
||||
Event.add(
|
||||
defines.events.on_player_joined_game,
|
||||
function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local player = game.get_player(event.player_index)
|
||||
if this.activate_custom_buttons then
|
||||
set_location(player)
|
||||
end
|
||||
|
@ -13,10 +13,47 @@ local Event = require 'utils.event'
|
||||
local Server = require 'utils.server'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
local Token = require 'utils.token'
|
||||
local Global = require 'utils.global'
|
||||
local Gui = require 'utils.gui'
|
||||
|
||||
local main_gui_tabs = {}
|
||||
local Public = {}
|
||||
local screen_elements = {}
|
||||
local this = {
|
||||
settings = {
|
||||
mod_gui_top_frame = false
|
||||
}
|
||||
}
|
||||
|
||||
Global.register(
|
||||
this,
|
||||
function(tbl)
|
||||
this = tbl
|
||||
end
|
||||
)
|
||||
|
||||
--- This adds the given gui to the top gui.
|
||||
---@param player <userdata>
|
||||
---@param frame <object>
|
||||
---@param name <string>
|
||||
function Public.add_mod_button(player, frame, name)
|
||||
if Gui.get_button_flow(player)[name] then
|
||||
return
|
||||
end
|
||||
|
||||
Gui.get_button_flow(player).add(frame)
|
||||
end
|
||||
|
||||
---@param state <bool>
|
||||
--- If we should use the new mod gui or not
|
||||
function Public.set_mod_gui_top_frame(state)
|
||||
this.settings.mod_gui_top_frame = state or false
|
||||
end
|
||||
|
||||
--- Get mod_gui_top_frame
|
||||
function Public.get_mod_gui_top_frame()
|
||||
return this.settings.mod_gui_top_frame
|
||||
end
|
||||
|
||||
--- This adds the given gui to the main gui.
|
||||
---@param tbl
|
||||
@ -108,14 +145,18 @@ function Public.comfy_panel_refresh_active_tab(player)
|
||||
end
|
||||
|
||||
local function top_button(player)
|
||||
if player.gui.top['comfy_panel_top_button'] then
|
||||
return
|
||||
if this.settings.mod_gui_top_frame then
|
||||
Public.add_mod_button(player, {type = 'sprite-button', name = 'comfy_panel_top_button', sprite = 'item/raw-fish'}, 'comfy_panel_top_button')
|
||||
else
|
||||
if player.gui.top['comfy_panel_top_button'] then
|
||||
return
|
||||
end
|
||||
local button = player.gui.top.add({type = 'sprite-button', name = 'comfy_panel_top_button', sprite = 'item/raw-fish'})
|
||||
button.style.minimal_height = 38
|
||||
button.style.maximal_height = 38
|
||||
button.style.minimal_width = 40
|
||||
button.style.padding = -2
|
||||
end
|
||||
local button = player.gui.top.add({type = 'sprite-button', name = 'comfy_panel_top_button', sprite = 'item/raw-fish'})
|
||||
button.style.minimal_height = 38
|
||||
button.style.maximal_height = 38
|
||||
button.style.minimal_width = 40
|
||||
button.style.padding = -2
|
||||
end
|
||||
|
||||
local function main_frame(player)
|
||||
|
@ -3,7 +3,7 @@ local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
local Server = require 'utils.server'
|
||||
local Tabs = require 'comfy_panel.main'
|
||||
local ComfyGui = require 'comfy_panel.main'
|
||||
local session = require 'utils.datastore.session_data'
|
||||
local Config = require 'comfy_panel.config'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
@ -403,7 +403,7 @@ local function toggle(event)
|
||||
if main_frame then
|
||||
remove_main_frame(main_frame, left, event.player)
|
||||
else
|
||||
Tabs.comfy_panel_clear_gui(event.player)
|
||||
ComfyGui.comfy_panel_clear_gui(event.player)
|
||||
draw_main_frame(left, event.player)
|
||||
end
|
||||
end
|
||||
@ -766,21 +766,34 @@ local function player_joined(event)
|
||||
return
|
||||
end
|
||||
|
||||
if player.gui.top[main_button_name] ~= nil then
|
||||
local frame = player.gui.top[main_frame_name]
|
||||
if frame and frame.valid then
|
||||
local data = Gui.get_data(frame)
|
||||
update_poll_viewer(data)
|
||||
end
|
||||
if ComfyGui.get_mod_gui_top_frame() then
|
||||
ComfyGui.add_mod_button(
|
||||
player,
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/programmable-speaker',
|
||||
tooltip = 'Let your question be heard!'
|
||||
},
|
||||
'main_button_name'
|
||||
)
|
||||
else
|
||||
local b =
|
||||
player.gui.top.add {
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/programmable-speaker',
|
||||
tooltip = 'Let your question be heard!'
|
||||
}
|
||||
b.style.maximal_height = 38
|
||||
if player.gui.top[main_button_name] ~= nil then
|
||||
local frame = player.gui.top[main_frame_name]
|
||||
if frame and frame.valid then
|
||||
local data = Gui.get_data(frame)
|
||||
update_poll_viewer(data)
|
||||
end
|
||||
else
|
||||
local b =
|
||||
player.gui.top.add {
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'item/programmable-speaker',
|
||||
tooltip = 'Let your question be heard!'
|
||||
}
|
||||
b.style.maximal_height = 38
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
local Event = require 'utils.event'
|
||||
local Gui = require 'utils.gui'
|
||||
local Server = require 'utils.server'
|
||||
local ComfyGui = require 'comfy_panel.main'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
|
||||
local main_frame_name = Gui.uid_name()
|
||||
@ -140,25 +141,38 @@ end
|
||||
|
||||
local function create_main_button(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
local main_button = player.gui.top[main_button_name]
|
||||
if not main_button or not main_button.valid then
|
||||
main_button =
|
||||
player.gui.top.add(
|
||||
if ComfyGui.get_mod_gui_top_frame() then
|
||||
ComfyGui.add_mod_button(
|
||||
player,
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = main_button_name,
|
||||
sprite = 'utility/surface_editor_icon',
|
||||
tooltip = 'Connect to another Comfy server!',
|
||||
name = main_button_name
|
||||
}
|
||||
tooltip = 'Connect to another Comfy server!'
|
||||
},
|
||||
main_button_name
|
||||
)
|
||||
main_button.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
main_button.style.font = 'heading-1'
|
||||
main_button.style.minimal_height = 40
|
||||
main_button.style.maximal_width = 40
|
||||
main_button.style.minimal_width = 38
|
||||
main_button.style.maximal_height = 38
|
||||
main_button.style.padding = 1
|
||||
main_button.style.margin = 0
|
||||
else
|
||||
local main_button = player.gui.top[main_button_name]
|
||||
if not main_button or not main_button.valid then
|
||||
main_button =
|
||||
player.gui.top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
sprite = 'utility/surface_editor_icon',
|
||||
tooltip = 'Connect to another Comfy server!',
|
||||
name = main_button_name
|
||||
}
|
||||
)
|
||||
main_button.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
main_button.style.font = 'heading-1'
|
||||
main_button.style.minimal_height = 40
|
||||
main_button.style.maximal_width = 40
|
||||
main_button.style.minimal_width = 38
|
||||
main_button.style.maximal_height = 38
|
||||
main_button.style.padding = 1
|
||||
main_button.style.margin = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -9,7 +9,6 @@ require 'utils.command_handler'
|
||||
require 'utils.utils'
|
||||
require 'utils.pause_game'
|
||||
require 'utils.table'
|
||||
require 'utils.freeplay'
|
||||
require 'utils.datastore.server_ups_data'
|
||||
require 'utils.datastore.current_time_data'
|
||||
require 'utils.datastore.color_data'
|
||||
@ -37,6 +36,7 @@ require 'comfy_panel.admin'
|
||||
-- require 'comfy_panel.score'
|
||||
require 'comfy_panel.config'
|
||||
require 'comfy_panel.server_select'
|
||||
require 'utils.freeplay'
|
||||
|
||||
---------------- !ENABLE MODULES HERE ----------------
|
||||
--require 'modules.admins_operate_biters'
|
||||
|
@ -1526,7 +1526,7 @@ function Public.reset_game()
|
||||
goal = 250000,
|
||||
rank = 'Anti-matter',
|
||||
color = {r = 100, g = 100, b = 245},
|
||||
msg = 'The obese cat colapses and forms a black hole!',
|
||||
msg = 'The obese cat collapses and forms a black hole!',
|
||||
msg2 = ':obese:',
|
||||
achieved = false
|
||||
},
|
||||
@ -1590,6 +1590,7 @@ local function on_tick()
|
||||
if wave_count >= wave_limit then
|
||||
if market and market.valid then
|
||||
market.die()
|
||||
game.print('Game won!', {r = 0.22, g = 0.88, b = 0.22})
|
||||
game.print('Game wave limit reached! Game will soft-reset shortly.', {r = 0.22, g = 0.88, b = 0.22})
|
||||
end
|
||||
end
|
||||
|
@ -49,18 +49,43 @@ function Public.reset_table()
|
||||
this.boss_biters = {}
|
||||
this.acid_lines_delay = {}
|
||||
this.entity_limits = {
|
||||
['gun-turret'] = {placed = 1, limit = 3, str = 'gun turret', slot_price = 70},
|
||||
['gun-turret'] = {placed = 1, limit = 6, str = 'gun turret', slot_price = 70},
|
||||
['laser-turret'] = {placed = 0, limit = 1, str = 'laser turret', slot_price = 300},
|
||||
['artillery-turret'] = {placed = 0, limit = 1, str = 'artillery turret', slot_price = 500},
|
||||
['flamethrower-turret'] = {placed = 0, limit = 0, str = 'flamethrower turret', slot_price = 50000},
|
||||
['land-mine'] = {placed = 0, limit = 1, str = 'mine', slot_price = 20}
|
||||
}
|
||||
this.difficulties_votes = {
|
||||
[1] = {wave_interval = 3800, amount_modifier = 0.90, strength_modifier = 0.90, boss_modifier = 5.0},
|
||||
[2] = {wave_interval = 3600, amount_modifier = 1.00, strength_modifier = 1.00, boss_modifier = 6.0},
|
||||
[3] = {wave_interval = 3400, amount_modifier = 1.10, strength_modifier = 1.30, boss_modifier = 7.0},
|
||||
[4] = {wave_interval = 3200, amount_modifier = 1.20, strength_modifier = 1.60, boss_modifier = 8.0},
|
||||
[5] = {wave_interval = 3000, amount_modifier = 1.40, strength_modifier = 2.20, boss_modifier = 9.0}
|
||||
[1] = {
|
||||
wave_interval = 5000,
|
||||
amount_modifier = 0.90,
|
||||
strength_modifier = 0.90,
|
||||
boss_modifier = 5.0
|
||||
},
|
||||
[2] = {
|
||||
wave_interval = 3500,
|
||||
amount_modifier = 1.00,
|
||||
strength_modifier = 1.00,
|
||||
boss_modifier = 6.0
|
||||
},
|
||||
[3] = {
|
||||
wave_interval = 3400,
|
||||
amount_modifier = 1.10,
|
||||
strength_modifier = 1.30,
|
||||
boss_modifier = 7.0
|
||||
},
|
||||
[4] = {
|
||||
wave_interval = 3200,
|
||||
amount_modifier = 1.20,
|
||||
strength_modifier = 1.60,
|
||||
boss_modifier = 8.0
|
||||
},
|
||||
[5] = {
|
||||
wave_interval = 3000,
|
||||
amount_modifier = 1.40,
|
||||
strength_modifier = 2.20,
|
||||
boss_modifier = 9.0
|
||||
}
|
||||
}
|
||||
this.boss_waves = {
|
||||
[50] = {{name = 'big-biter', count = 3}},
|
||||
|
@ -5,6 +5,7 @@ local Global = require 'utils.global'
|
||||
local SpamProtection = require 'utils.spam_protection'
|
||||
local Event = require 'utils.event'
|
||||
local BottomFrame = require 'comfy_panel.bottom_frame'
|
||||
local ComfyGui = require 'comfy_panel.main'
|
||||
local floor = math.floor
|
||||
local print_color = {r = 120, g = 255, b = 0}
|
||||
|
||||
@ -537,22 +538,19 @@ local function auto_stash(player, event)
|
||||
end
|
||||
|
||||
local function create_gui_button(player)
|
||||
if player.gui.top.auto_stash then
|
||||
return
|
||||
end
|
||||
local tooltip
|
||||
if this.insert_into_furnace and this.insert_into_wagon then
|
||||
tooltip =
|
||||
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nCTRL+RMB: Fill nearby furnaces.\nSHIFT+LMB: Everything onto filtered slots to wagon.\nSHIFT+RMB: Only ores to wagon'
|
||||
elseif this.insert_into_furnace then
|
||||
tooltip =
|
||||
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nCTRL+RMB: Fill nearby furnaces.'
|
||||
tooltip = 'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nCTRL+RMB: Fill nearby furnaces.'
|
||||
elseif this.insert_into_wagon then
|
||||
tooltip =
|
||||
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nSHIFT+LMB: Everything onto filtered slots to wagon.\nSHIFT+RMB: Only ores to wagon'
|
||||
tooltip = 'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.\nSHIFT+LMB: Everything onto filtered slots to wagon.\nSHIFT+RMB: Only ores to wagon'
|
||||
else
|
||||
tooltip =
|
||||
'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.'
|
||||
tooltip = 'Sort your inventory into nearby chests.\nLMB: Everything, excluding quickbar items.\nRMB: Only ores to nearby chests, excluding quickbar items.'
|
||||
end
|
||||
if player.gui.top.auto_stash then
|
||||
return
|
||||
end
|
||||
if this.bottom_button then
|
||||
local data = BottomFrame.get('bottom_quickbar_button')
|
||||
@ -568,23 +566,36 @@ local function create_gui_button(player)
|
||||
end
|
||||
end
|
||||
else
|
||||
local b =
|
||||
player.gui.top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/wooden-chest',
|
||||
name = 'auto_stash',
|
||||
tooltip = tooltip
|
||||
}
|
||||
)
|
||||
b.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
b.style.font = 'heading-1'
|
||||
b.style.minimal_height = 40
|
||||
b.style.maximal_width = 40
|
||||
b.style.minimal_width = 38
|
||||
b.style.maximal_height = 38
|
||||
b.style.padding = 1
|
||||
b.style.margin = 0
|
||||
if ComfyGui.get_mod_gui_top_frame() then
|
||||
ComfyGui.add_mod_button(
|
||||
player,
|
||||
{
|
||||
type = 'sprite-button',
|
||||
name = 'auto_stash',
|
||||
sprite = 'item/wooden-chest',
|
||||
tooltip = tooltip
|
||||
},
|
||||
'auto_stash'
|
||||
)
|
||||
else
|
||||
local b =
|
||||
player.gui.top.add(
|
||||
{
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/wooden-chest',
|
||||
name = 'auto_stash',
|
||||
tooltip = tooltip
|
||||
}
|
||||
)
|
||||
b.style.font_color = {r = 0.11, g = 0.8, b = 0.44}
|
||||
b.style.font = 'heading-1'
|
||||
b.style.minimal_height = 40
|
||||
b.style.maximal_width = 40
|
||||
b.style.minimal_width = 38
|
||||
b.style.maximal_height = 38
|
||||
b.style.padding = 1
|
||||
b.style.margin = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local BottomFrame = require 'comfy_panel.bottom_frame'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -7,11 +10,12 @@ local this = {
|
||||
created_items = {},
|
||||
respawn_items = {},
|
||||
disabled = false,
|
||||
skip_intro = true,
|
||||
skip_intro = false,
|
||||
chart_distance = 0,
|
||||
disable_crashsite = true,
|
||||
disable_crashsite = false,
|
||||
crashed_ship_items = {},
|
||||
crashed_debris_items = {}
|
||||
crashed_debris_items = {},
|
||||
custom_surface_name = nil
|
||||
}
|
||||
|
||||
Global.register(
|
||||
@ -21,20 +25,26 @@ Global.register(
|
||||
end
|
||||
)
|
||||
|
||||
local function custom_surface()
|
||||
local i = 0
|
||||
for k, _ in pairs(game.surfaces) do
|
||||
i = i + 1
|
||||
if i > 2 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local util = require('util')
|
||||
local crash_site = require('crash-site')
|
||||
|
||||
local toggle_screen_for_player_token =
|
||||
Token.register(
|
||||
function(data)
|
||||
local index = data.index
|
||||
local state = data.state
|
||||
local player = game.get_player(index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
if state then
|
||||
BottomFrame.toggle_player_frame(player, true)
|
||||
else
|
||||
BottomFrame.toggle_player_frame(player, false)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local created_items = function()
|
||||
return {
|
||||
['iron-plate'] = 8,
|
||||
@ -53,6 +63,10 @@ local respawn_items = function()
|
||||
}
|
||||
end
|
||||
|
||||
local ship_parts = function()
|
||||
return crash_site.default_ship_parts()
|
||||
end
|
||||
|
||||
local ship_items = function()
|
||||
return {
|
||||
['firearm-magazine'] = 8
|
||||
@ -92,14 +106,21 @@ local on_player_created = function(event)
|
||||
if not this.disable_crashsite then
|
||||
local surface = player.surface
|
||||
surface.daytime = 0.7
|
||||
crash_site.create_crash_site(surface, {-5, -6}, util.copy(this.crashed_ship_items), util.copy(this.crashed_debris_items))
|
||||
crash_site.create_crash_site(surface, {-5, -6}, util.copy(this.crashed_ship_items), util.copy(this.crashed_debris_items), util.copy(this.crashed_ship_parts))
|
||||
|
||||
util.remove_safe(player, this.crashed_ship_items)
|
||||
util.remove_safe(player, this.crashed_debris_items)
|
||||
player.get_main_inventory().sort_and_merge()
|
||||
|
||||
if player.character then
|
||||
player.character.destructible = false
|
||||
end
|
||||
crash_site.create_cutscene(player, {-5, -4})
|
||||
|
||||
if not this.skip_intro then
|
||||
BottomFrame.toggle_player_frame(player, false)
|
||||
Task.set_timeout_in_ticks(1, toggle_screen_for_player_token, {index = player.index, state = false})
|
||||
crash_site.create_cutscene(player, {-5, -4})
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -120,9 +141,6 @@ local on_cutscene_waypoint_reached = function(event)
|
||||
if not this.modded then
|
||||
return
|
||||
end
|
||||
if this.disabled then
|
||||
return
|
||||
end
|
||||
if not crash_site.is_crash_site_cutscene(event) then
|
||||
return
|
||||
end
|
||||
@ -130,10 +148,16 @@ local on_cutscene_waypoint_reached = function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
player.exit_cutscene()
|
||||
BottomFrame.toggle_player_frame(player, true)
|
||||
Task.set_timeout_in_ticks(5, toggle_screen_for_player_token, {index = player.index, state = true})
|
||||
|
||||
if custom_surface() then
|
||||
if this.custom_surface_name then
|
||||
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)
|
||||
local get_custom_surface = game.get_surface(this.custom_surface_name)
|
||||
if not get_custom_surface or not get_custom_surface.valid then
|
||||
return
|
||||
end
|
||||
player.teleport(get_custom_surface.find_non_colliding_position('character', {64, 64}, 50, 0.5), get_custom_surface.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -143,10 +167,6 @@ local skip_crash_site_cutscene = function(event)
|
||||
return
|
||||
end
|
||||
|
||||
if this.disabled then
|
||||
return
|
||||
end
|
||||
|
||||
if event.player_index ~= 1 then
|
||||
return
|
||||
end
|
||||
@ -157,10 +177,16 @@ local skip_crash_site_cutscene = function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if player.controller_type == defines.controllers.cutscene then
|
||||
player.exit_cutscene()
|
||||
BottomFrame.toggle_player_frame(player, true)
|
||||
Task.set_timeout_in_ticks(5, toggle_screen_for_player_token, {index = player.index, state = true})
|
||||
end
|
||||
if custom_surface() then
|
||||
if this.custom_surface_name then
|
||||
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)
|
||||
local get_custom_surface = game.get_surface(this.custom_surface_name)
|
||||
if not get_custom_surface or not get_custom_surface.valid then
|
||||
return
|
||||
end
|
||||
player.teleport(get_custom_surface.find_non_colliding_position('character', {64, 64}, 50, 0.5), get_custom_surface.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -181,8 +207,16 @@ local on_cutscene_cancelled = function(event)
|
||||
if player.character then
|
||||
player.character.destructible = true
|
||||
end
|
||||
if custom_surface() then
|
||||
player.teleport(game.surfaces[3].find_non_colliding_position('character', {64, 64}, 50, 0.5), game.surfaces[3].name)
|
||||
BottomFrame.toggle_player_frame(player, true)
|
||||
Task.set_timeout_in_ticks(5, toggle_screen_for_player_token, {index = player.index, state = true})
|
||||
if this.custom_surface_name then
|
||||
if player.surface.name == 'nauvis' then
|
||||
local get_custom_surface = game.get_surface(this.custom_surface_name)
|
||||
if not get_custom_surface or not get_custom_surface.valid then
|
||||
return
|
||||
end
|
||||
player.teleport(get_custom_surface.find_non_colliding_position('character', {64, 64}, 50, 0.5), get_custom_surface.name)
|
||||
end
|
||||
end
|
||||
|
||||
player.zoom = 1.5
|
||||
@ -204,6 +238,12 @@ local freeplay_interface = {
|
||||
set_skip_intro = function(bool)
|
||||
this.skip_intro = bool
|
||||
end,
|
||||
set_disabled = function(bool)
|
||||
this.disabled = bool
|
||||
end,
|
||||
set_custom_surface_name = function(str)
|
||||
this.custom_surface_name = str or error('Remote call parameter to freeplay set custom_surface_name must be string')
|
||||
end,
|
||||
set_chart_distance = function(value)
|
||||
this.chart_distance = tonumber(value) or error('Remote call parameter to freeplay set chart distance must be a number')
|
||||
end,
|
||||
@ -252,11 +292,11 @@ Event.on_init(
|
||||
local game_has_mods = is_game_modded()
|
||||
if game_has_mods then
|
||||
this.modded = true
|
||||
this.disable_crashsite = true
|
||||
this.created_items = created_items()
|
||||
this.respawn_items = respawn_items()
|
||||
this.crashed_ship_items = ship_items()
|
||||
this.crashed_debris_items = debris_items()
|
||||
this.crashed_ship_parts = this.crashed_ship_parts or ship_parts()
|
||||
end
|
||||
end
|
||||
)
|
||||
@ -266,6 +306,7 @@ local on_configuration_changed = function()
|
||||
this.respawn_items = this.respawn_items or respawn_items()
|
||||
this.crashed_ship_items = this.crashed_ship_items or ship_items()
|
||||
this.crashed_debris_items = this.crashed_debris_items or debris_items()
|
||||
this.crashed_ship_parts = this.crashed_ship_parts or ship_parts()
|
||||
|
||||
if not this.init_ran then
|
||||
this.init_ran = #game.players > 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user