mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-07 13:31:40 +02:00
organize commands
This commit is contained in:
parent
64779b0afd
commit
ee50871aea
@ -13,7 +13,7 @@ softmod_info_new_players_1=For New Players
|
||||
softmod_info_new_players_2=Mine coal and other resources and bring them to the ship to keep things going, or try asking the captain for more specific tasks.
|
||||
|
||||
softmod_info_tips_1=Features of the game that are hard to work out alone
|
||||
softmod_info_tips_2=• The captain (or officers) can steer the boat from the crow's nest by placing 50 rail signals in one of the blue boxes.\n• The quantity on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• Items dropped on the deck are transferred to the cabin when the boat moves for performance reasons.\n• When waiting for the captain's order to set sail, the free power supply is disabled.\n• Productivity modules can't be used in machines.\n• Resources granted to the ship appear in the captain's cabin.\n• Useful commands: /classinfo {classname} command, /take {classname}, /giveup, /plank {player}, /officer {player}, /undock, /ccolor, /clear_north_tanks, /clear_south_tanks, /tax
|
||||
softmod_info_tips_2=• The captain (or officers) can steer the boat from the crow's nest by placing 50 rail signals in one of the blue boxes.\n• The quantity on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• Items dropped on the deck are transferred to the cabin when the boat moves for performance reasons.\n• When waiting for the captain's order to set sail, the free power supply is disabled.\n• Productivity modules can't be used in machines.\n• Resources granted to the ship appear in the captain's cabin.\n• Useful commands: /classinfo {classname} command, /plank {player}, /officer {player}, /undock, /ccolor, /clear_north_tanks, /clear_south_tanks, /tax
|
||||
|
||||
softmod_info_updates_1=v1.6.0
|
||||
softmod_info_updates_2=• 7 simultaneous crews supported. Surface loading is paused if other crews are loading or fighting krakens.\n• New runs begin on the top lane so that beginners are more likely to encounter docks.\n• Disconnecting players once again have their items temporarily saved (though returned to the crew if they don't reconnect quickly.)\n• Island surfaces are now always deleted after the boat leaves, fixing issues with marooned players.\n• New class added. Melee classes can no longer hold weapons.\n• Spectators can now change surfaces.\n• Crew proposal endorsements system removed.\n• Balance tweaks: difficulty of Nightmare increased; biter nighttime damage bonus nerfed; mining productivity increases naturally with leagues traveled; tweaks to radioactive islands; Kovarex enrichment no longer researched at start of game; land mines drop your speed when placed; flamers nerfed further.
|
||||
@ -79,7 +79,7 @@ parrot_buried_treasure_tip=Squawk! If X marks the spot - use an item to dig!
|
||||
parrot_captain_left_protected_run=The captain has disconnected. Since this crew is captain-protected, the captain role will not be redistributed for __1__ hours. Squawk!
|
||||
parrot_player_joins_protected_run_with_no_captain=Hello there! Since this crew is captain-protected, you will have to wait for captain to return in order to control the ship.
|
||||
parrot_create_new_crew_tip=You can always create or join another crew. To do this, press the red flag on top, click 'Quit Crew', then press 'Crews'.
|
||||
parrot_crafters_disabled=Our machines have stopped whilst we're waiting at sea. Gotta keep moving! Squawk!
|
||||
parrot_crafters_disabled=Our machines have paused whilst we're waiting at sea.
|
||||
|
||||
difficulty_easy=Easy
|
||||
difficulty_normal=Normal
|
||||
@ -608,8 +608,8 @@ gui_close_button=Close
|
||||
|
||||
cmd_notify_set_max_crews=The maximum number of concurrent crews has been set to __1__.
|
||||
|
||||
cmd_error_not_admin=[ERROR] Only admins are allowed to run this command!
|
||||
cmd_error_not_captain=[ERROR] Only captains are allowed to run this command!
|
||||
cmd_error_not_admin=[ERROR] Only admins can run this command.
|
||||
cmd_error_not_captain=[ERROR] Only captains can run this command.
|
||||
cmd_error_invalid_player_name=[ERROR] Player __1__ not found.
|
||||
cmd_error_invalid_class_name=[ERROR] Class __1__ not found.
|
||||
cmd_error_color_not_found=[ERROR] Color __1__ not found.
|
||||
@ -621,8 +621,6 @@ cmd_explain_summoncrew=is an admin command to summon the crew to the ship.
|
||||
cmd_explain_ok=is used to accept captainhood.
|
||||
cmd_explain_classinfo={class name} returns the definition of the named class.
|
||||
# cmd_explain_classinfofull={class name} returns detailed definition of the named class.
|
||||
cmd_explain_take={class name} takes a spare class with the given name for yourself.
|
||||
cmd_explain_giveup=gives up your current class, making it available for others.
|
||||
cmd_explain_ccolor=is an extension to the built-in /color command, with more colors.
|
||||
cmd_explain_fixpower=attempts to reconnect power poles between deck and holds
|
||||
cmd_explain_plank={player} is a captain command to remove a player by making them a spectator.
|
||||
|
@ -114,7 +114,7 @@ function Public.apply_restrictions_to_machines(tickinterval)
|
||||
else
|
||||
if memory.crafters_disabled and Common.activecrewcount() == 0 then
|
||||
return
|
||||
elseif game.tick > memory.at_sea_waiting_game_tick + Balance.max_time_crafting_while_waiting_seconds() * 60 then
|
||||
elseif game.tick > memory.at_sea_waiting_game_tick + Balance.seconds_until_machines_shut_down_at_sea() * 60 then
|
||||
memory.crafters_disabled = true
|
||||
Boats.update_EEIs(boat)
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_crafters_disabled'})
|
||||
|
@ -181,7 +181,8 @@ function Public.max_time_on_island_formula_seconds() --always >0 --tuned
|
||||
return Math.ceil(60 * minimum_mins * Public.game_slowness_scale())
|
||||
end
|
||||
|
||||
function Public.max_time_crafting_while_waiting_seconds()
|
||||
-- Waiting at sea forever isn't generally fun for your teammates, so we encourage keeping the action moving:
|
||||
function Public.seconds_until_machines_shut_down_at_sea()
|
||||
local minimum_mins = 3
|
||||
return Math.ceil(60 * minimum_mins * Public.game_slowness_scale())
|
||||
end
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
local Color = require 'utils.color_presets'
|
||||
local Server = require 'utils.server'
|
||||
|
||||
local Math = require 'maps.pirates.math'
|
||||
local Ai = require 'maps.pirates.ai'
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
@ -13,7 +12,6 @@ local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local PlayerColors = require 'maps.pirates.player_colors'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
|
||||
local Crew = require 'maps.pirates.crew'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
local Boats = require 'maps.pirates.structures.boats.boats'
|
||||
@ -33,12 +31,12 @@ local Task = require 'utils.task'
|
||||
local Highscore = require 'maps.pirates.highscore'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
local Classes = require 'maps.pirates.roles.classes'
|
||||
|
||||
local Gui = require 'maps.pirates.gui.gui'
|
||||
|
||||
-- local Session = require 'utils.datastore.session_data'
|
||||
|
||||
|
||||
-- *** *** --
|
||||
--*** HELPERS ***--
|
||||
-- *** *** --
|
||||
|
||||
local function cmd_set_memory(cmd)
|
||||
local player = game.players[cmd.player_index]
|
||||
@ -46,7 +44,6 @@ local function cmd_set_memory(cmd)
|
||||
Memory.set_working_id(crew_id)
|
||||
end
|
||||
|
||||
|
||||
local function check_admin(cmd)
|
||||
local player = game.players[cmd.player_index]
|
||||
--local trusted = Session.get_trusted_table()
|
||||
@ -69,8 +66,6 @@ local function check_admin(cmd)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function check_captain(cmd)
|
||||
local player = game.players[cmd.player_index]
|
||||
local p
|
||||
@ -89,8 +84,6 @@ local function check_captain(cmd)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function check_captain_or_admin(cmd)
|
||||
local player = game.players[cmd.player_index]
|
||||
local p
|
||||
@ -130,7 +123,221 @@ end
|
||||
-- return true
|
||||
-- end
|
||||
|
||||
-- *** *** --
|
||||
--*** PUBLIC COMMANDS ***--
|
||||
-- *** *** --
|
||||
|
||||
commands.add_command(
|
||||
'ok',
|
||||
{'pirates.cmd_explain_ok'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
--local memory = Memory.get_crew_memory()
|
||||
Roles.player_confirm_captainhood(player)
|
||||
end)
|
||||
|
||||
-- Disabled, better to find these out through gameplay:
|
||||
-- commands.add_command(
|
||||
-- 'classes',
|
||||
-- 'Prints the available classes in the game.',
|
||||
-- function(cmd)
|
||||
-- local player = game.players[cmd.player_index]
|
||||
-- if not Common.validate_player(player) then return end
|
||||
-- player.print('[color=gray]' .. Roles.get_classes_print_string() .. '[/color]')
|
||||
-- end)
|
||||
|
||||
commands.add_command(
|
||||
'classinfo',
|
||||
{'pirates.cmd_explain_classinfo'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
local param = tostring(cmd.parameter)
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
if param and param ~= 'nil' then
|
||||
local string = Roles.get_class_print_string(param, true)
|
||||
if string then
|
||||
Common.notify_player_expected(player, {'', {'pirates.class_definition_for'}, ' ', string})
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_class_name', param})
|
||||
end
|
||||
else
|
||||
Common.notify_player_expected(player, {'', '/classinfo ', {'pirates.cmd_explain_classinfo'}})
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'ccolor',
|
||||
{'pirates.cmd_explain_ccolor'},
|
||||
function(cmd)
|
||||
local param = tostring(cmd.parameter)
|
||||
local player_index = cmd.player_index
|
||||
if player_index then
|
||||
local player = game.players[player_index]
|
||||
if player and player.valid then
|
||||
if cmd.parameter then
|
||||
if PlayerColors.colors[param] then
|
||||
local rgb = PlayerColors.colors[param]
|
||||
player.color = rgb
|
||||
player.chat_color = rgb
|
||||
local message = {'', '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']',{'pirates.choose_chat_color', player.name, param}, '[/color] (via /ccolor).'}
|
||||
-- local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. ' chose the color ' .. param .. '[/color] (via /ccolor).'
|
||||
Common.notify_game(message)
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_color_not_found', param})
|
||||
end
|
||||
else
|
||||
local color = PlayerColors.bright_color_names[Math.random(#PlayerColors.bright_color_names)]
|
||||
local rgb = PlayerColors.colors[color]
|
||||
if not rgb then return end
|
||||
player.color = rgb
|
||||
player.chat_color = rgb
|
||||
local message = {'', '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']', {'pirates.randomize_chat_color', player.name, color}, '[/color] (via /ccolor).'} --'randomly became' was amusing, but let's not
|
||||
-- local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color randomized to ' .. color .. '[/color] (via /ccolor).' --'randomly became' was amusing, but let's not
|
||||
Common.notify_game(message)
|
||||
-- disabled due to lag:
|
||||
-- GUIcolor.toggle_window(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'fixpower',
|
||||
{'pirates.cmd_explain_fixpower'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
Boats.force_reconnect_boat_poles()
|
||||
end)
|
||||
|
||||
-- *** *** --
|
||||
--*** CAPTAIN COMMANDS ***--
|
||||
-- *** *** --
|
||||
|
||||
commands.add_command(
|
||||
'plank',
|
||||
{'pirates.cmd_explain_plank'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
if param and game.players[param] and game.players[param].index then
|
||||
Crew.plank(player, game.players[param])
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_player_name', param})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'officer',
|
||||
{'pirates.cmd_explain_officer'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
if param and game.players[param] and game.players[param].index then
|
||||
if Common.is_officer(game.players[param].index) then
|
||||
Roles.unmake_officer(player, game.players[param])
|
||||
else
|
||||
Roles.make_officer(player, game.players[param])
|
||||
end
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_player_name', param})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'tax',
|
||||
{'pirates.cmd_explain_tax'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
--local param = tostring(cmd.parameter)
|
||||
if check_captain(cmd) then
|
||||
--local player = game.players[cmd.player_index]
|
||||
Roles.captain_tax(memory.playerindex_captain)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Try undock from an island or dock
|
||||
commands.add_command(
|
||||
'undock',
|
||||
{'pirates.cmd_explain_undock'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
--local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
if memory.boat.state == Boats.enum_state.DOCKED then
|
||||
Progression.undock_from_dock(true)
|
||||
elseif memory.boat.state == Boats.enum_state.LANDED then
|
||||
Progression.try_retreat_from_island(player, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'clear_north_tanks',
|
||||
{'pirates.cmd_explain_clear_north_tanks'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
if check_captain_or_admin(cmd) then
|
||||
Boats.clear_fluid_from_ship_tanks(1)
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'clear_south_tanks',
|
||||
{'pirates.cmd_explain_clear_south_tanks'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
if check_captain(cmd) then
|
||||
Boats.clear_fluid_from_ship_tanks(2)
|
||||
end
|
||||
end)
|
||||
|
||||
-- *** *** --
|
||||
--*** ADMIN COMMANDS ***--
|
||||
-- *** *** --
|
||||
|
||||
commands.add_command(
|
||||
'set_max_crews',
|
||||
@ -183,241 +390,6 @@ function(cmd)
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'ok',
|
||||
{'pirates.cmd_explain_ok'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
--local memory = Memory.get_crew_memory()
|
||||
Roles.player_confirm_captainhood(player)
|
||||
end)
|
||||
|
||||
-- Disabled for information-flow reasons:
|
||||
-- commands.add_command(
|
||||
-- 'classes',
|
||||
-- 'Prints the available classes in the game.',
|
||||
-- function(cmd)
|
||||
-- local player = game.players[cmd.player_index]
|
||||
-- if not Common.validate_player(player) then return end
|
||||
-- player.print('[color=gray]' .. Roles.get_classes_print_string() .. '[/color]')
|
||||
-- end)
|
||||
|
||||
commands.add_command(
|
||||
'classinfo',
|
||||
{'pirates.cmd_explain_classinfo'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
local param = tostring(cmd.parameter)
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
if param and param ~= 'nil' then
|
||||
local string = Roles.get_class_print_string(param, true)
|
||||
if string then
|
||||
Common.notify_player_expected(player, {'', {'pirates.class_definition_for'}, ' ', string})
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_class_name', param})
|
||||
end
|
||||
else
|
||||
Common.notify_player_expected(player, {'', '/classinfo ', {'pirates.cmd_explain_classinfo'}})
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'take',
|
||||
{'pirates.cmd_explain_take'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
if param and param ~= 'nil' then
|
||||
for _, class in pairs(Classes.enum) do
|
||||
if Classes.eng_form[class]:lower() == param:lower() then
|
||||
Classes.assign_class(player.index, class)
|
||||
return true
|
||||
end
|
||||
end
|
||||
--fallthrough:
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_class_name', param})
|
||||
return false
|
||||
else
|
||||
Common.notify_player_expected(player, {'', '/take ', {'pirates.cmd_explain_take'}})
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'giveup',
|
||||
{'pirates.cmd_explain_giveup'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
--local param = tostring(cmd.parameter)
|
||||
local player = game.players[cmd.player_index]
|
||||
if not Common.validate_player(player) then return end
|
||||
|
||||
Classes.assign_class(player.index, nil)
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'ccolor',
|
||||
{'pirates.cmd_explain_ccolor'},
|
||||
function(cmd)
|
||||
local param = tostring(cmd.parameter)
|
||||
local player_index = cmd.player_index
|
||||
if player_index then
|
||||
local player = game.players[player_index]
|
||||
if player and player.valid then
|
||||
if cmd.parameter then
|
||||
if PlayerColors.colors[param] then
|
||||
local rgb = PlayerColors.colors[param]
|
||||
player.color = rgb
|
||||
player.chat_color = rgb
|
||||
local message = {'', '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']',{'pirates.choose_chat_color', player.name, param}, '[/color] (via /ccolor).'}
|
||||
-- local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. ' chose the color ' .. param .. '[/color] (via /ccolor).'
|
||||
Common.notify_game(message)
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_color_not_found', param})
|
||||
end
|
||||
else
|
||||
local color = PlayerColors.bright_color_names[Math.random(#PlayerColors.bright_color_names)]
|
||||
local rgb = PlayerColors.colors[color]
|
||||
if not rgb then return end
|
||||
player.color = rgb
|
||||
player.chat_color = rgb
|
||||
local message = {'', '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']', {'pirates.randomize_chat_color', player.name, color}, '[/color] (via /ccolor).'} --'randomly became' was amusing, but let's not
|
||||
-- local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color randomized to ' .. color .. '[/color] (via /ccolor).' --'randomly became' was amusing, but let's not
|
||||
Common.notify_game(message)
|
||||
-- disabled due to lag:
|
||||
-- GUIcolor.toggle_window(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'fixpower',
|
||||
{'pirates.cmd_explain_fixpower'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
Boats.force_reconnect_boat_poles()
|
||||
end)
|
||||
|
||||
|
||||
local go_2 = Token.register(
|
||||
function(data)
|
||||
Memory.set_working_id(data.id)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
memory.mapbeingloadeddestination_index = CoreData.first_destination_index
|
||||
memory.loadingticks = 0
|
||||
|
||||
-- local surface = game.surfaces[Common.current_destination().surface_name]
|
||||
-- surface.request_to_generate_chunks({x = 0, y = 0}, 10)
|
||||
-- surface.force_generate_chunk_requests()
|
||||
Progression.go_from_starting_dock_to_first_destination()
|
||||
end
|
||||
)
|
||||
local go_1 = Token.register(
|
||||
function(data)
|
||||
Memory.set_working_id(data.id)
|
||||
local memory = Memory.get_crew_memory()
|
||||
Overworld.ensure_lane_generated_up_to(0, 10)
|
||||
Overworld.ensure_lane_generated_up_to(24, 10)
|
||||
Overworld.ensure_lane_generated_up_to(-24, 10)
|
||||
memory.currentdestination_index = CoreData.first_destination_index
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
Surfaces.create_surface(Common.current_destination())
|
||||
Task.set_timeout_in_ticks(60, go_2, {id = data.id})
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
|
||||
commands.add_command(
|
||||
'plank',
|
||||
{'pirates.cmd_explain_plank'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
if param and game.players[param] and game.players[param].index then
|
||||
Crew.plank(player, game.players[param])
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_player_name', param})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'officer',
|
||||
{'pirates.cmd_explain_officer'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local player = game.players[cmd.player_index]
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
if param and game.players[param] and game.players[param].index then
|
||||
if Common.is_officer(game.players[param].index) then
|
||||
Roles.unmake_officer(player, game.players[param])
|
||||
else
|
||||
Roles.make_officer(player, game.players[param])
|
||||
end
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.cmd_error_invalid_player_name', param})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Try undock from an island or dock
|
||||
commands.add_command(
|
||||
'undock',
|
||||
{'pirates.cmd_explain_undock'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
--local param = tostring(cmd.parameter)
|
||||
if check_captain_or_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
if memory.boat.state == Boats.enum_state.DOCKED then
|
||||
Progression.undock_from_dock(true)
|
||||
elseif memory.boat.state == Boats.enum_state.LANDED then
|
||||
Progression.try_retreat_from_island(player, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Force undock from an island or dock
|
||||
commands.add_command(
|
||||
'ret',
|
||||
@ -438,51 +410,6 @@ function(cmd)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
commands.add_command(
|
||||
'tax',
|
||||
{'pirates.cmd_explain_tax'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
--local param = tostring(cmd.parameter)
|
||||
if check_captain(cmd) then
|
||||
--local player = game.players[cmd.player_index]
|
||||
Roles.captain_tax(memory.playerindex_captain)
|
||||
end --@TODO: else
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'clear_north_tanks',
|
||||
{'pirates.cmd_explain_clear_north_tanks'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
if check_captain(cmd) then
|
||||
Boats.clear_fluid_from_ship_tanks(1)
|
||||
end --@TODO: else
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'clear_south_tanks',
|
||||
{'pirates.cmd_explain_clear_south_tanks'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
if check_captain(cmd) then
|
||||
Boats.clear_fluid_from_ship_tanks(2)
|
||||
end --@TODO: else
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'dump_highscores',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
@ -545,49 +472,6 @@ function(cmd)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Move overworld boat right by a lot (you can jump over islands that way to skip them)
|
||||
commands.add_command(
|
||||
'jump',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2({x = 40, y = 0})
|
||||
end
|
||||
end)
|
||||
|
||||
-- Move overworld boat up
|
||||
commands.add_command(
|
||||
'advu',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2{x = 0, y = -24}
|
||||
end
|
||||
end)
|
||||
|
||||
-- Move overworld boat down
|
||||
commands.add_command(
|
||||
'advd',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2{x = 0, y = 24}
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
commands.add_command(
|
||||
'overwrite_scores_specific',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
@ -647,7 +531,80 @@ function(cmd)
|
||||
end
|
||||
end)
|
||||
|
||||
-- *** *** --
|
||||
--*** DEVELOPER COMMANDS ***--
|
||||
-- *** *** --
|
||||
|
||||
if _DEBUG then
|
||||
local go_2 = Token.register(
|
||||
function(data)
|
||||
Memory.set_working_id(data.id)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
memory.mapbeingloadeddestination_index = CoreData.first_destination_index
|
||||
memory.loadingticks = 0
|
||||
|
||||
-- local surface = game.surfaces[Common.current_destination().surface_name]
|
||||
-- surface.request_to_generate_chunks({x = 0, y = 0}, 10)
|
||||
-- surface.force_generate_chunk_requests()
|
||||
Progression.go_from_starting_dock_to_first_destination()
|
||||
end
|
||||
)
|
||||
local go_1 = Token.register(
|
||||
function(data)
|
||||
Memory.set_working_id(data.id)
|
||||
local memory = Memory.get_crew_memory()
|
||||
Overworld.ensure_lane_generated_up_to(0, 10)
|
||||
Overworld.ensure_lane_generated_up_to(24, 10)
|
||||
Overworld.ensure_lane_generated_up_to(-24, 10)
|
||||
memory.currentdestination_index = CoreData.first_destination_index
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
Surfaces.create_surface(Common.current_destination())
|
||||
Task.set_timeout_in_ticks(60, go_2, {id = data.id})
|
||||
end
|
||||
)
|
||||
|
||||
-- Move overworld boat right by a lot (you can jump over islands that way to skip them)
|
||||
commands.add_command(
|
||||
'jump',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2({x = 40, y = 0})
|
||||
end
|
||||
end)
|
||||
|
||||
-- Move overworld boat up
|
||||
commands.add_command(
|
||||
'advu',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2{x = 0, y = -24}
|
||||
end
|
||||
end)
|
||||
|
||||
-- Move overworld boat down
|
||||
commands.add_command(
|
||||
'advd',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
Overworld.try_overworld_move_v2{x = 0, y = 24}
|
||||
end
|
||||
end)
|
||||
|
||||
-- Teleport player to available boat in lobby, automatically start journey and arrive at sea faster
|
||||
commands.add_command(
|
||||
|
Loading…
x
Reference in New Issue
Block a user