mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-07 13:31:40 +02:00
boat now pauses after each destination
This commit is contained in:
parent
098e0bf2b6
commit
88d4da397e
@ -57,7 +57,7 @@ location_displayname_lobby_1=Starting Dock
|
||||
|
||||
|
||||
|
||||
|
||||
parrot_set_sail_advice=Ready to sail to the next island? Click up top!
|
||||
parrot_hard_praise=Steel chests for steel players! Squawk!
|
||||
parrot_normal_praise=Iron chests for iron players! Squawk!
|
||||
parrot_fuel_warning=Fuel is low!
|
||||
@ -95,6 +95,8 @@ ship_undocked_1=[font=heading-1]Ship undocked[/font] by captain.
|
||||
ship_undocked_2=[font=heading-1]Ship auto-undocked[/font]. Return to ship.
|
||||
ship_undocked_3=[font=heading-1]Ship auto-undocked[/font].
|
||||
|
||||
ship_set_off_to_next_island=[font=heading-1]Ship set sail[/font] for the next destination.
|
||||
|
||||
plank=__1__ planked __2__!
|
||||
plank_error_invalid_player=Command error: Player is not a crewmember.
|
||||
plank_error_self=Command error: Can't plank yourself.
|
||||
@ -354,6 +356,7 @@ mode_tooltip=Mode.
|
||||
auto_undock_tooltip=The maximum time to stay at this location.\n\nOnce this time is reached, the boat undocks automatically. The captain can choose to leave earlier by pressing this button.
|
||||
atsea_loading_tooltip=The next destination is loading.
|
||||
leave_anytime_tooltip=The captain chooses when to undock the ship.\n\nThey can undock by pressing this button.
|
||||
atsea_waiting_tooltip=The ship pauses after each destination. When the captain is ready, they can click this button to proceed.
|
||||
|
||||
resources_needed_tooltip_0=At the next destination, these resources will be needed in order to undock.
|
||||
resources_needed_tooltip_1=At the next destination, these resources will be needed in order to undock early.\n\nFewer resources will be needed the longer you stay, eventually dropping to zero.
|
||||
@ -475,6 +478,7 @@ gui_etaframe_board_warning=RETURN TO SHIP
|
||||
gui_etaframe_board_warning_tooltip=Probably time to board...
|
||||
gui_etaframe_autoundock=Auto-undock:
|
||||
gui_etaframe_arriving_in=Arriving in
|
||||
gui_etaframe_atsea_waiting=Captain — Click here to Sail
|
||||
gui_etaframe_undock=Undock:
|
||||
gui_etaframe_anytime=Anytime
|
||||
gui_etaframe_nest_escape_cost=Next escape cost:
|
||||
|
@ -723,7 +723,7 @@ local function event_on_player_mined_entity(event)
|
||||
local baseamount = 4
|
||||
--minimum 1 wood
|
||||
local amount = Math.clamp(1, Math.ceil(available), Math.ceil(baseamount * available/starting))
|
||||
|
||||
|
||||
destination.dynamic_data.wood_remaining = destination.dynamic_data.wood_remaining - amount
|
||||
|
||||
if memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.LUMBERJACK then
|
||||
@ -1773,7 +1773,7 @@ local function event_on_player_respawned(event)
|
||||
local boat = memory.boat
|
||||
|
||||
if player.surface == game.surfaces[Common.current_destination().surface_name] then
|
||||
if boat and boat.state == Boats.enum_state.ATSEA_SAILING then
|
||||
if boat and boat.state == Boats.enum_state.ATSEA_SAILING or boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL or boat.state == Boats.enum_state.ATSEA_LOADING_MAP then
|
||||
-- assuming sea is always default:
|
||||
local seasurface = game.surfaces[memory.sea_name]
|
||||
player.teleport(memory.spawnpoint, seasurface)
|
||||
|
@ -7,7 +7,7 @@ local _inspect = require 'utils.inspect'.inspect
|
||||
local Public = {}
|
||||
|
||||
Public.scenario_id_name = 'pirates'
|
||||
Public.version_string = '1.2.10' --major.minor.patch versioning, to match factorio mod portal
|
||||
Public.version_string = '1.2.11' --major.minor.patch versioning, to match factorio mod portal
|
||||
|
||||
Public.blueprint_library_allowed = true
|
||||
Public.blueprint_importing_allowed = true
|
||||
|
@ -407,7 +407,7 @@ function Public.player_and_crew_state_bools(player)
|
||||
local destination = Common.current_destination()
|
||||
local dynamic_data = destination.dynamic_data --assumes this always exists
|
||||
|
||||
local in_crowsnest_bool, in_hold_bool, in_cabin_bool, onmap_bool, eta_bool, approaching_bool, retreating_bool, atsea_sailing_bool, landed_bool, quest_bool, silo_bool, charged_bool, launched_bool, captain_bool, atsea_loading_bool, character_on_deck_bool, on_deck_standing_near_loco_bool, on_deck_standing_near_cabin_bool, on_deck_standing_near_crowsnest_bool, cost_bool, cost_includes_rocket_launch_bool, approaching_dock_bool, leaving_dock_bool, leave_anytime_bool
|
||||
local in_crowsnest_bool, in_hold_bool, in_cabin_bool, onmap_bool, eta_bool, approaching_bool, retreating_bool, atsea_sailing_bool, landed_bool, quest_bool, silo_bool, charged_bool, launched_bool, captain_bool, atsea_loading_bool, atsea_waiting_bool, character_on_deck_bool, on_deck_standing_near_loco_bool, on_deck_standing_near_cabin_bool, on_deck_standing_near_crowsnest_bool, cost_bool, cost_includes_rocket_launch_bool, approaching_dock_bool, leaving_dock_bool, leave_anytime_bool
|
||||
|
||||
captain_bool = Common.is_captain(player)
|
||||
|
||||
@ -425,13 +425,14 @@ function Public.player_and_crew_state_bools(player)
|
||||
retreating_bool = memory.boat and memory.boat.state == Boats.enum_state.RETREATING and onmap_bool
|
||||
-- approaching_bool = memory.boat and memory.boat.state == Boats.enum_state.APPROACHING
|
||||
atsea_sailing_bool = memory.boat and memory.boat.state == Boats.enum_state.ATSEA_SAILING
|
||||
atsea_waiting_bool = memory.boat and memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL
|
||||
landed_bool = memory.boat and memory.boat.state == Boats.enum_state.LANDED
|
||||
quest_bool = (dynamic_data.quest_type ~= nil) and onmap_bool
|
||||
charged_bool = dynamic_data.silocharged
|
||||
silo_bool = dynamic_data.rocketsilos and onmap_bool and ((dynamic_data.rocketsilos[1] and dynamic_data.rocketsilos[1].valid) or charged_bool)
|
||||
launched_bool = dynamic_data.rocketlaunched
|
||||
|
||||
cost_bool = destination.static_params.base_cost_to_undock and (not atsea_sailing_bool) and (not retreating_bool)
|
||||
cost_bool = destination.static_params.base_cost_to_undock and (not atsea_sailing_bool) and (not atsea_waiting_bool) and (not retreating_bool)
|
||||
cost_includes_rocket_launch_bool = cost_bool and destination.static_params.base_cost_to_undock['launch_rocket']
|
||||
|
||||
leave_anytime_bool = (landed_bool and not (eta_bool or cost_bool))
|
||||
@ -465,6 +466,7 @@ function Public.player_and_crew_state_bools(player)
|
||||
approaching_bool = approaching_bool,
|
||||
retreating_bool = retreating_bool,
|
||||
atsea_sailing_bool = atsea_sailing_bool,
|
||||
atsea_waiting_bool = atsea_waiting_bool,
|
||||
-- landed_bool = landed_bool,
|
||||
quest_bool = quest_bool,
|
||||
silo_bool = silo_bool,
|
||||
|
@ -81,7 +81,7 @@ function Public.full_update(player)
|
||||
|
||||
local types = {'leagues', 'kraken', 'time', 'silo', 'nests', 'sandwurms'}
|
||||
|
||||
if memory.boat and memory.boat.state and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
if memory.boat and memory.boat.state and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
evolution_leagues = evo - (memory.kraken_evo or 0)
|
||||
local krakens = false
|
||||
if memory.active_sea_enemies and memory.active_sea_enemies.krakens then
|
||||
|
@ -517,7 +517,7 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
|
||||
local flow2
|
||||
|
||||
if bools.cost_bool or bools.atsea_loading_bool or bools.eta_bool or bools.retreating_bool or bools.leave_anytime_bool then
|
||||
if bools.cost_bool or bools.atsea_loading_bool or bools.atsea_waiting_bool or bools.eta_bool or bools.retreating_bool or bools.leave_anytime_bool then
|
||||
flow1.visible = true
|
||||
local tooltip = ''
|
||||
|
||||
@ -564,6 +564,15 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_arriving_in'}
|
||||
flow2.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(eta_ticks / 60)
|
||||
|
||||
elseif bools.atsea_waiting_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = false
|
||||
|
||||
tooltip = {'pirates.atsea_waiting_tooltip'}
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_atsea_waiting'}
|
||||
|
||||
elseif bools.leave_anytime_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = true
|
||||
@ -659,7 +668,7 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
flow1.etaframe_piratebutton.tooltip = tooltip
|
||||
flow2.tooltip = tooltip
|
||||
|
||||
if bools.captain_bool and (not bools.retreating_bool) and (bools.leave_anytime_bool or bools.eta_bool or (bools.cost_bool and (not bools.atsea_loading_bool))) then
|
||||
if bools.captain_bool and (not bools.retreating_bool) and (bools.leave_anytime_bool or bools.atsea_waiting_bool or bools.eta_bool or (bools.cost_bool and (not bools.atsea_loading_bool))) then
|
||||
flow1.etaframe_piratebutton.mouse_button_filter = {'left'}
|
||||
if memory.undock_shortcut_are_you_sure_data and memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
@ -1070,7 +1079,7 @@ function Public.update_gui(player)
|
||||
|
||||
if flow1 then
|
||||
-- if not bools.eta_bool and not bools.retreating_bool and not bools.quest_bool and not bools.silo_bool and not bools.atsea_loading_bool and not bools.leave_anytime_bool and not bools.cost_bool and not bools.approaching_dock_bool and not bools.leaving_dock_bool then
|
||||
if not bools.eta_bool and not bools.retreating_bool and not bools.quest_bool and not bools.silo_bool and not bools.atsea_loading_bool and not bools.leave_anytime_bool and not bools.cost_bool and not bools.approaching_dock_bool and not bools.leaving_dock_bool and not bools.atsea_sailing_bool then
|
||||
if not (bools.eta_bool or bools.retreating_bool or bools.quest_bool or bools.silo_bool or bools.atsea_loading_bool or bools.leave_anytime_bool or bools.cost_bool or bools.approaching_dock_bool or bools.leaving_dock_bool or bools.atsea_sailing_bool or bools.atsea_waiting_bool) then
|
||||
flow1.visible = true
|
||||
else
|
||||
flow1.visible = false
|
||||
@ -1172,6 +1181,11 @@ local function on_gui_click(event)
|
||||
memory.undock_shortcut_are_you_sure_data[player.index] = game.tick
|
||||
end
|
||||
end
|
||||
elseif memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL then
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
Progression.at_sea_begin_to_set_sail()
|
||||
end
|
||||
|
||||
elseif string.sub(event.element.name, -13, -1) and string.sub(event.element.name, -13, -1) == '_piratebutton' then
|
||||
local name = string.sub(event.element.name, 1, -14)
|
||||
if Public[name] then
|
||||
|
@ -521,6 +521,42 @@ function Public.undock_from_dock(manual)
|
||||
end
|
||||
|
||||
|
||||
function Public.at_sea_begin_to_set_sail()
|
||||
local memory = Memory.get_crew_memory()
|
||||
local boat = memory.boat
|
||||
|
||||
boat.state = Boats.enum_state.ATSEA_SAILING
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
|
||||
Crew.summon_crew()
|
||||
|
||||
local force = memory.force
|
||||
if not (force and force.valid) then return end
|
||||
Common.notify_force(force, {'pirates.ship_set_off_to_next_island'})
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local parrot_set_sail_advice =
|
||||
Token.register(
|
||||
function(data)
|
||||
local crew_id = data.crew_id
|
||||
Memory.set_working_id(crew_id)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not (memory.id and memory.id > 0) then return end --check if crew disbanded
|
||||
|
||||
if memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_set_sail_advice'})
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function Public.go_from_currentdestination_to_sea()
|
||||
local memory = Memory.get_crew_memory()
|
||||
@ -553,10 +589,12 @@ function Public.go_from_currentdestination_to_sea()
|
||||
Crowsnest.upgrade_chests('iron-chest')
|
||||
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_normal_praise'})
|
||||
|
||||
Task.set_timeout_in_ticks(60 * 10, parrot_set_sail_advice, {crew_id = memory.id})
|
||||
end
|
||||
end
|
||||
|
||||
memory.boat.state = Boats.enum_state.ATSEA_SAILING
|
||||
memory.boat.state = Boats.enum_state.ATSEA_WAITING_TO_SAIL
|
||||
memory.boat.speed = 0
|
||||
memory.boat.position = new_boatposition
|
||||
memory.boat.surface_name = seaname
|
||||
|
@ -27,12 +27,13 @@ Public[enum.RAFTLARGE] = require 'maps.pirates.structures.boats.raft_large.raft_
|
||||
Public[enum.MERCHANT] = require 'maps.pirates.structures.boats.merchant_1.merchant_1'
|
||||
Public.enum = enum
|
||||
local enum_state = {
|
||||
ATSEA_SAILING = 'at_sea',
|
||||
APPROACHING = 'approaching',
|
||||
LANDED = 'landed',
|
||||
RETREATING = 'retreating',
|
||||
LEAVING_DOCK = 'leaving',
|
||||
ATSEA_SAILING = 'at_sea',
|
||||
ATSEA_LOADING_MAP = 'waiting_for_load',
|
||||
ATSEA_WAITING_TO_SAIL = 'waiting_for_sail',
|
||||
DOCKED = 'docked',
|
||||
}
|
||||
Public.enum_state = enum_state
|
||||
|
@ -110,10 +110,11 @@ Public.cabin_shop_data = {
|
||||
price = {{'coin', 2000}, {'stone-brick', 30}},
|
||||
offer = {type='give-item', item = 'uranium-238', count = 10},
|
||||
},
|
||||
{
|
||||
price = {{'coin', 25}},
|
||||
offer = {type='nothing', effect_description={'pirates.market_description_extra_time_at_sea'}},
|
||||
},
|
||||
--disabled now that we can wait after any destination:
|
||||
-- {
|
||||
-- price = {{'coin', 25}},
|
||||
-- offer = {type='nothing', effect_description={'pirates.market_description_extra_time_at_sea'}},
|
||||
-- },
|
||||
}
|
||||
|
||||
function Public.get_cabin_surface_name()
|
||||
|
@ -783,7 +783,7 @@ function Public.player_exit_crows_nest(player, player_relative_pos)
|
||||
local memory = Memory.get_crew_memory()
|
||||
local surface
|
||||
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
surface = game.surfaces[SurfacesCommon.encode_surface_name(memory.id, 0, Public.enum.SEA, Public.Sea.enum.DEFAULT)]
|
||||
else
|
||||
surface = game.surfaces[Common.current_destination().surface_name]
|
||||
@ -822,7 +822,7 @@ function Public.player_exit_hold(player, relative_pos)
|
||||
local memory = Memory.get_crew_memory()
|
||||
local surface
|
||||
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
surface = game.surfaces[SurfacesCommon.encode_surface_name(memory.id, 0, Public.enum.SEA, Public.Sea.enum.DEFAULT)]
|
||||
else
|
||||
surface = game.surfaces[Common.current_destination().surface_name]
|
||||
@ -860,7 +860,7 @@ function Public.player_exit_cabin(player, relative_pos)
|
||||
local memory = Memory.get_crew_memory()
|
||||
local surface
|
||||
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
if memory.boat and (memory.boat.state == Boats.enum_state.ATSEA_SAILING or memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP) then
|
||||
surface = game.surfaces[SurfacesCommon.encode_surface_name(memory.id, 0, Public.enum.SEA, Public.Sea.enum.DEFAULT)]
|
||||
else
|
||||
surface = game.surfaces[Common.current_destination().surface_name]
|
||||
|
Loading…
x
Reference in New Issue
Block a user