1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00
This commit is contained in:
danielmartin0 2022-02-26 23:33:19 +00:00
parent 20de9a40e0
commit 57713f55aa
25 changed files with 626 additions and 400 deletions

View File

@ -16,7 +16,7 @@ softmod_info_tips_1=Features of the game that are hard to work out alone
softmod_info_tips_2=• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo launches a rocket. This causes pollution and evo, but each launch gives a reward of fuel and coins.\n• Charging a silo drains power from everything else on its network.\n• Once a silo has launched a rocket, biters will ignore it.\n• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Lab productivity increases with each league.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (Technically the time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by roughly the amount it 'would have' made had it survived.) \n• At Abandoned Labs, biters don't care if you emit pollution. They only care how long you stay.\n• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.
softmod_info_updates_1=Development
softmod_info_updates_2=Pirate Ship 1.0.3 is currently in testing! The gameplay is reworked to center around a fuel mechanic. This should make for a clear central objective. Please play and help us tune the gameplay. \n\nRecent significant changes: Fuel mechanic replaces gold. Silo death is no longer a lose condition. Additional silos can appear to deconstrain power input. Weakened chest+furnace resistance to biters.
softmod_info_updates_2=Pirate Ship 1.0.3 is currently in testing! The gameplay is reworked to center around a fuel mechanic. This should make for a clear central objective. Please play and help us tune the gameplay. \n\nRecent significant changes: Fuel mechanic replaces gold. Silo death is no longer a lose condition. Additional silos can appear to deconstrain power input. Weakened chest+furnace resistance to biters. Dock trades revamped.
softmod_info_credits_1=Credits
softmod_info_credits_2=Softmod designed and written by thesixthroc. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Most island structure blueprints contributed by Mattisso.\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John
@ -36,9 +36,9 @@ capacity_tooltip=Capacity. Sets the maximum number of crewmembers allowed.\n\n(U
difficulty_tooltip=Difficulty.\n\nHigher difficulties have higher pollution and evo, higher biter damage, lower gold loot, but higher chest loot, along with small effects on the time per island, quest requirements, and silo position.\n\nDifficulty also determines the material the ship is made out of.
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.
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.
leave_anytime_tooltip=The captain chooses when to undock the ship.\n\nThey can undock by pressing this button.
resources_needed_tooltip_1=At the next destination, these resources will be needed in order to undock early.
resources_needed_tooltip_2=The captain can undock early, but only if enough resources have been stored in the captain's cabin.
resources_needed_tooltip_3=The captain can only undock if enough resources are stored in the captain's cabin.

View File

@ -250,7 +250,7 @@ function Public.apply_crew_buffs_per_x(force)
end
function Public.class_cost()
return 10000
return 8000
-- return Math.ceil(10000 / (Common.activecrewcount()/4)^(1/6))
end
@ -264,8 +264,7 @@ function Public.pistol_damage_multiplier() return 1.95 end
Public.kraken_spawns_base_extra_evo = 0.2
function Public.kraken_evo_increase_per_shot()
return 0
-- return 1/100 * 0.2
return 1/100 * 0.02
end
function Public.kraken_kill_reward()
@ -276,6 +275,8 @@ function Public.kraken_health()
return Math.ceil(2500 * Math.max(1, 1 + 0.1 * ((Common.overworldx()/40)^(13/10)-6)) * (Public.onthefly_scaling_with_players_rule()^(3/4)) * Math.sloped(Common.difficulty(), 1/2))
end
Public.kraken_regen_scale = 0.5
function Public.krakens_per_slot(overworldx)
local rng = Math.random()
if rng < 0.03 then

View File

@ -24,6 +24,7 @@ Public.lobby_spawnpoint = {x = -72, y = -8}
Public.fraction_of_map_loaded_atsea = 1
Public.map_loading_ticks_atsea = 70 * 60
Public.map_loading_ticks_atsea_dock = 30 * 60
Public.map_loading_ticks_onisland = 2 * 60 * 60
Public.loading_interval = 5

View File

@ -5,8 +5,8 @@ local inspect = require 'utils.inspect'.inspect
local Public = {}
Public.scenario_id_name = 'pirates'
Public.version_string = '1.0.3.6'
Public.version_float = 1.036
Public.version_string = '1.0.3.7'
Public.version_float = 1.037
Public.victory_x = 1000

View File

@ -24,9 +24,12 @@ Public.sufficient_font_color = {66, 220, 124}
Public.insufficient_font_color = {1, 0.62, 0.19}
Public.achieved_font_color = {255, 230, 192}
Public.rage_font_color_1 = {1, 1, 1}
Public.rage_font_color_2 = {1, 0.5, 0.1}
Public.rage_font_color_3 = {1, 0.1, 0.05}
Public.fuel_color_1 = {r=255, g=255, b=255}
Public.fuel_color_2 = {r=255, g=0, b=60}
Public.rage_font_color_1 = {r=1, g=1, b=1}
Public.rage_font_color_2 = {r=1, g=0.5, b=0.1}
Public.rage_font_color_3 = {r=1, g=0.1, b=0.05}
@ -37,8 +40,6 @@ Public.default_window_positions = {
fuel = {x = 468, y = 48},
minimap = {x = 10, y = 48},
color = {x = 160, y = 96},
spontaneous_camera = {x = 8, y = 48},
undock_shortcut_button = {x = 8, y = 48},
}
@ -117,7 +118,7 @@ function Public.flow_add_floating_button(flow1, button_name)
local flow2, flow3
flow2 = flow1.add({
name = button_name .. '_flow',
name = button_name .. '_flow_1',
type = 'flow',
direction = 'vertical',
})
@ -143,6 +144,16 @@ function Public.flow_add_floating_button(flow1, button_name)
flow3.style.natural_width = 40
flow3.style.horizontally_stretchable = true
flow3 = flow2.add({
name = button_name .. '_flow_2',
type = 'flow',
})
flow3.style.natural_width = 20
flow3.style.top_margin = -37
flow3.style.left_margin = 10
flow3.style.right_margin = 9
flow3.ignored_by_interaction=true
return flow3
end

View File

@ -112,7 +112,7 @@ function Public.toggle_window(player)
type = 'list-box',
})
flow3.style.margin = 2
flow3.style.maximal_height = 400
flow3.style.maximal_height = 350
flow3 = flow2.add({
name = 'class_renounce',
@ -225,7 +225,7 @@ function Public.toggle_window(player)
flow3 = flow2.add({
name = 'capn_pass',
type = 'button',
caption = 'Pass Title To',
caption = 'Pass Captain To',
})
flow3.style.minimal_width = 95
flow3.style.font = 'default-bold'
@ -249,10 +249,28 @@ function Public.toggle_window(player)
flow3.style.top_margin = 4
flow3.style.bottom_margin = 4
-- flow3 = flow2.add({
-- name = 'capn_undock_normal',
-- type = 'button',
-- caption = 'Undock Boat',
-- })
-- flow3.style.minimal_width = 95
-- flow3.style.font = 'default-bold'
-- flow3.style.font_color = {r=0.10, g=0.10, b=0.10}
flow3 = flow2.add({
name = 'capn_undock_normal',
name = 'make_officer',
type = 'button',
caption = 'Undock Boat',
caption = 'Make Officer',
})
flow3.style.minimal_width = 95
flow3.style.font = 'default-bold'
flow3.style.font_color = {r=0.10, g=0.10, b=0.10}
flow3 = flow2.add({
name = 'unmake_officer',
type = 'button',
caption = 'Unamake Officer',
})
flow3.style.minimal_width = 95
flow3.style.font = 'default-bold'
@ -276,6 +294,19 @@ function Public.toggle_window(player)
flow3.style.font = 'default-bold'
flow3.style.font_color = {r=0.10, g=0.10, b=0.10}
flow2 = flow.add({
name = 'undock_tip',
type = 'label',
})
flow2.style.left_margin = 5
flow2.style.top_margin = -8
flow2.style.bottom_margin = 7
flow2.style.single_line = false
flow2.style.maximal_width = 190
flow2.style.font = 'default'
flow2.caption = 'To undock, use the top toolbar.'
--
GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton')
@ -303,19 +334,21 @@ function Public.update(player)
flow.spare_classes.visible = memory.spare_classes and #memory.spare_classes > 0
local any_button = false
local other_player_selected = flow.members.body.members_listbox.selected_index ~= 0 and tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2]) ~= player.index
local any_class_button = false
for _, c in pairs(Classes.Class_List) do
if memory.spare_classes and Utils.contains(memory.spare_classes, c) and (not (player.controller_type == defines.controllers.spectator)) then
if (memory.playerindex_captain and player.index == memory.playerindex_captain) and memory.crewplayerindices and #memory.crewplayerindices > 1 then
if flow.members.body.members_listbox.selected_index ~= 0 and (not (memory.classes_table[tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])])) then
if other_player_selected and (not (memory.classes_table[tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])])) then
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = false
flow.spare_classes.body.assign_flow['assign_class_' .. c].visible = true
any_button = true
any_class_button = true
else
flow.spare_classes.body.assign_flow['assign_class_' .. c].visible = false
if (not memory.classes_table[player.index]) then
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = true
any_button = true
any_class_button = true
else
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = false
end
@ -324,7 +357,7 @@ function Public.update(player)
flow.spare_classes.body.assign_flow['assign_class_' .. c].visible = false
if (not memory.classes_table[player.index]) then
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = true
any_button = true
any_class_button = true
else
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = false
end
@ -334,14 +367,17 @@ function Public.update(player)
flow.spare_classes.body.assign_flow['selfassign_class_' .. c].visible = false
end
end
flow.spare_classes.body.assign_flow.visible = any_button
flow.spare_classes.body.assign_flow.visible = any_class_button
flow.captain.visible = (memory.playerindex_captain and player.index == memory.playerindex_captain)
flow.captain.body.capn_pass.visible = flow.members.body.members_listbox.selected_index ~= 0 and tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2]) ~= player.index
flow.captain.body.capn_pass.visible = other_player_selected
flow.captain.body.capn_plank.visible = flow.captain.body.capn_pass.visible
flow.captain.body.capn_undock_normal.visible = memory.boat and memory.boat.state and ((memory.boat.state == Boats.enum_state.LANDED) or (memory.boat.state == Boats.enum_state.APPROACHING) or (memory.boat.state == Boats.enum_state.DOCKED))
flow.captain.body.make_officer.visible = other_player_selected and (not (memory.officers_table and memory.officers_table[tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])]))
flow.captain.body.unmake_officer.visible = other_player_selected and ((memory.officers_table and memory.officers_table[tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])]))
-- flow.captain.body.capn_undock_normal.visible = memory.boat and memory.boat.state and ((memory.boat.state == Boats.enum_state.LANDED) or (memory.boat.state == Boats.enum_state.APPROACHING) or (memory.boat.state == Boats.enum_state.DOCKED))
flow.captain.body.capn_summon_crew.visible = false
flow.captain.body.capn_take_coins.visible = true
@ -417,9 +453,9 @@ function Public.update(player)
GuiCommon.update_listbox(flow.spectators.body.spectators_listbox, wrappedspectators)
end
if flow.captain.body.capn_undock_normal.visible then
flow.captain.body.capn_undock_normal.enabled = ((memory.boat.state == Boats.enum_state.LANDED) and Common.query_sufficient_resources_to_leave()) or (memory.boat.state == Boats.enum_state.DOCKED)
end
-- if flow.captain.body.capn_undock_normal.visible then
-- flow.captain.body.capn_undock_normal.enabled = ((memory.boat.state == Boats.enum_state.LANDED) and Common.query_sufficient_resources_to_leave()) or (memory.boat.state == Boats.enum_state.DOCKED)
-- end
end
@ -484,21 +520,21 @@ function Public.click(event)
end
if eventname == 'capn_undock_normal' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.CAPTAIN then
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock()
else
Progression.try_retreat_from_island()
end
end
return
end
-- if eventname == 'capn_undock_normal' then
-- --double check:
-- if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
-- if memory.boat.state == Boats.enum_state.DOCKED then
-- Progression.undock_from_dock()
-- else
-- Progression.try_retreat_from_island()
-- end
-- end
-- return
-- end
if eventname == 'capn_summon_crew' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.CAPTAIN then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
Crew.summon_crew()
end
return
@ -506,7 +542,7 @@ function Public.click(event)
if eventname == 'capn_take_coins' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.CAPTAIN then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
Roles.captain_requisition_coins(memory.playerindex_captain)
end
return
@ -524,7 +560,7 @@ function Public.click(event)
if eventname == 'capn_disband_crew' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.CAPTAIN then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
if not memory.disband_are_you_sure_ticks then memory.disband_are_you_sure_ticks = {} end
memory.disband_are_you_sure_ticks[player.index] = game.tick
end
@ -533,7 +569,7 @@ function Public.click(event)
if eventname == 'capn_disband_are_you_sure' then
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.CAPTAIN then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
local force = game.forces[memory.force_name]
if force and force.valid then
local message = player.name .. ' disbanded ' .. memory.name .. ', after ' .. Utils.time_longform((memory.real_age or 0)/60) .. '.'
@ -551,6 +587,18 @@ function Public.click(event)
return
end
if eventname == 'make_officer' then
local other_id = tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])
Roles.make_officer(player, game.players[other_id])
return
end
if eventname == 'unmake_officer' then
local other_id = tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])
Roles.unmake_officer(player, game.players[other_id])
return
end
if eventname == 'capn_plank' then
local other_id = tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])

View File

@ -79,7 +79,7 @@ function Public.update(player)
local evolution_silo
local evolution_nests
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
evolution_base = evo
evolution_base = evo - (memory.kraken_evo or 0)
-- here Kraken.kraken_slots
local krakens = false
if memory.active_sea_enemies and memory.active_sea_enemies.krakens then
@ -88,7 +88,7 @@ function Public.update(player)
end
end
if krakens then --@FIXME: somehow this isn't triggering?
button.tooltip = string.format('Local biter evolution\n\nBase: %.2f\nKraken: %.2f\nTotal: %.2f', evolution_base, Balance.kraken_spawns_base_extra_evo, Balance.kraken_spawns_base_extra_evo + evo)
button.tooltip = string.format('Local biter evolution\n\nBase: %.2f\nKraken: %.2f\nTotal: %.2f', evolution_base, Balance.kraken_spawns_base_extra_evo + (memory.kraken_evo or 0), Balance.kraken_spawns_base_extra_evo + evo)
button.number = Balance.kraken_spawns_base_extra_evo + evo
else
button.tooltip = string.format('Local biter evolution\n\nBase: %.2f\nTotal: %.2f', evolution_base, evo)

View File

@ -89,7 +89,7 @@ local function create_gui(player)
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'evo_piratebutton')
flow2.sprite = 'entity/small-biter'
flow2.mouse_button_filter = {'middle'}
flow2.mouse_button_filter = {'middle'} --hack to avoid press visual
flow2.show_percent_for_small_numbers = true
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'minimap_piratebutton')
@ -105,82 +105,72 @@ local function create_gui(player)
flow2 = GuiCommon.flow_add_floating_button(flow1, 'fuel_piratebutton')
-- flow2.style.right_padding = -100
flow3 = flow2.parent.add({
name = 'fuel_flow',
type = 'flow',
})
flow3.style.natural_width = 20
flow3.style.top_margin = -37
flow3.style.left_margin = 2
flow3.ignored_by_interaction=true
flow4 = flow3.add({
flow3 = flow2.add({
name = 'fuel_label_1',
type = 'label',
caption = ''
})
flow4.style.font = 'default-large-semibold'
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = GuiCommon.bold_font_color
-- flow3.style.font_color = GuiCommon.bold_font_color
-- flow4.style.top_margin = -36
flow4.style.left_margin = 4
-- flow4.style.left_margin = -100
-- flow3.style.horizontal_align = 'center'
-- flow4.style.left_padding = -5
flow4.ignored_by_interaction=true
flow3.style.left_margin = -1
flow4 = flow3.add({
flow3 = flow2.add({
name = 'fuel_label_2',
type = 'label',
caption = ''
})
flow4.style.font = 'default-large'
flow4.style.font_color = GuiCommon.bold_font_color
flow4.style.left_margin = 6
flow4.style.right_padding = 6
flow4.style.right_margin = 2
flow4.ignored_by_interaction=true
flow3.style.font = 'default-large'
flow3.style.left_margin = 6
tooltip = {'pirates.auto_undock_tooltip'}
flow2 = GuiCommon.flow_add_floating_button(flow1, 'etaframe_piratebutton')
-- flow2.style.right_padding = -100
-- flow2.enabled = false
flow3 = flow2.parent.add({
name = 'etaframe_flow',
type = 'flow',
})
flow3.style.natural_width = 20
flow3.style.top_margin = -37
flow3.style.left_margin = 2
flow3.ignored_by_interaction=true
flow4 = flow3.add({
flow3 = flow2.add({
name = 'etaframe_label_1',
type = 'label',
caption = 'Max Time:'
})
flow4.style.font = 'default-large-semibold'
flow4.style.font_color = GuiCommon.bold_font_color
flow4.tooltip = tooltip
flow4.style.left_margin = 4
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = GuiCommon.bold_font_color
flow4 = flow3.add({
flow3 = flow2.add({
name = 'etaframe_label_2',
type = 'label',
})
flow4.style.left_margin = 2
flow4.style.right_padding = 6
flow4.style.right_margin = 2
flow4.style.font = 'default-large'
flow4.style.font_color = GuiCommon.default_font_color
flow4.tooltip = tooltip
flow3.style.left_margin = 1
flow3.style.font = 'default-large'
flow3.style.font_color = GuiCommon.default_font_color
flow3 = flow2.add({
name = 'etaframe_label_3',
type = 'label',
})
flow3.style.left_margin = 3
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = GuiCommon.bold_font_color
flow3 = flow2.add({type = 'table', name = 'cost_table', column_count = 5})
for i = 1, 5 do
flow4 = flow3.add({type = 'sprite-button', name = 'cost_' .. i, number = 0})
-- flow4.mouse_button_filter = {'middle'}
flow4.enabled = false
flow4.style.top_margin = -6
flow4.style.right_margin = -6
flow4.style.maximal_height = 38
flow4.visible = false
end
flow3.style.left_margin = -1
flow3.style.right_margin = -2 --to get to the end of the button frame
-- flow2 = flow1.add({
@ -238,43 +228,43 @@ local function create_gui(player)
flow2 = flow1.add({
name = 'cost_frame',
type = 'frame',
})
flow2.style.minimal_width = 100
flow2.style.natural_width = 100
flow2.style.minimal_height = 40
flow2.style.maximal_height = 40
flow2.style.left_padding = 4
flow2.style.right_padding = 4
flow2.style.top_padding = 3
-- flow2 = flow1.add({
-- name = 'cost_frame',
-- type = 'frame',
-- })
-- flow2.style.minimal_width = 100
-- flow2.style.natural_width = 100
-- flow2.style.minimal_height = 40
-- flow2.style.maximal_height = 40
-- flow2.style.left_padding = 4
-- flow2.style.right_padding = 4
-- flow2.style.top_padding = 3
flow3 = flow2.add({
name = 'cost_label_1',
type = 'label',
})
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = GuiCommon.bold_font_color
-- -- flow3 = flow2.add({
-- -- name = 'cost_label_1',
-- -- type = 'label',
-- -- })
-- -- flow3.style.font = 'default-large-semibold'
-- -- flow3.style.font_color = GuiCommon.bold_font_color
flow3 = flow2.add({
name = 'cost_label_2',
type = 'label',
})
flow3.style.font = 'default-large'
flow3.style.font_color = GuiCommon.default_font_color
-- -- flow3 = flow2.add({
-- -- name = 'cost_label_2',
-- -- type = 'label',
-- -- })
-- -- flow3.style.font = 'default-large'
-- -- flow3.style.font_color = GuiCommon.default_font_color
flow3 = flow2.add({type = 'table', name = 'cost_table', column_count = 5})
for i = 1, 5 do
flow4 = flow3.add({type = 'sprite-button', name = 'cost_' .. i, number = 0})
-- flow4.mouse_button_filter = {'middle'}
flow4.enabled = false
flow4.style.top_margin = -6
flow4.style.right_margin = -6
flow4.style.maximal_height = 38
flow4.visible = false
end
flow3.style.right_margin = -3
-- flow3 = flow2.add({type = 'table', name = 'cost_table', column_count = 5})
-- for i = 1, 5 do
-- flow4 = flow3.add({type = 'sprite-button', name = 'cost_' .. i, number = 0})
-- -- flow4.mouse_button_filter = {'middle'}
-- flow4.enabled = false
-- flow4.style.top_margin = -6
-- flow4.style.right_margin = -6
-- flow4.style.maximal_height = 38
-- flow4.visible = false
-- end
-- flow3.style.right_margin = -3
@ -300,7 +290,7 @@ local function create_gui(player)
type = 'label',
})
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = Common.bold_font_color
flow3.style.font_color = GuiCommon.bold_font_color
flow3.style.right_margin = 2
flow3 = flow2.add({
@ -411,27 +401,30 @@ local function create_gui(player)
--== SCREEN STUFF
flow1 = player.gui.screen
flow2 = flow1.add({
name = 'pirates_undock_shortcut_button',
type = 'sprite-button',
enabled = false,
})
flow2.style.minimal_width = 80
flow2.style.natural_width = 80
flow2.style.maximal_width = 150
flow2.style.minimal_height = 40
flow2.style.maximal_height = 40
flow2.style.left_margin = 1
flow2.style.top_margin = 1
flow2.style.left_padding = 4
flow2.style.right_padding = 4
flow2.style.top_padding = 3
flow2.style.font = 'default-large-semibold'
flow2.style.font_color = GuiCommon.default_font_color
ComfyPanel.screen_to_bypass('pirates_undock_shortcut_button')
-- flow2 = flow1.add({
-- name = 'pirates_undock_shortcut_button',
-- type = 'sprite-button',
-- enabled = false,
-- })
-- flow2.style.minimal_width = 80
-- flow2.style.natural_width = 80
-- flow2.style.maximal_width = 150
-- flow2.style.minimal_height = 40
-- flow2.style.maximal_height = 40
-- flow2.style.left_margin = 1
-- flow2.style.top_margin = 1
-- flow2.style.left_padding = 4
-- flow2.style.right_padding = 4
-- flow2.style.top_padding = 3
-- flow2.style.font = 'default-large-semibold'
-- flow2.style.font_color = GuiCommon.default_font_color
-- ComfyPanel.screen_to_bypass('pirates_undock_shortcut_button')
@ -470,7 +463,7 @@ function Public.update_gui(player)
pirates_flow.crew_piratebutton_frame.crew_piratebutton.mouse_button_filter = {'left','right'}
else
pirates_flow.crew_piratebutton_frame.crew_piratebutton.tooltip = 'Crew\n\nYou\'re a free agent, so there\'s nothing to do here.'
pirates_flow.crew_piratebutton_frame.crew_piratebutton.mouse_button_filter = {'middle'}
pirates_flow.crew_piratebutton_frame.crew_piratebutton.mouse_button_filter = {'middle'} --hack to avoid press visual
if player.gui.screen['crew_piratewindow'] then
player.gui.screen['crew_piratewindow'].destroy()
end
@ -497,10 +490,18 @@ function Public.update_gui(player)
-- button.number = 3
-- end
pirates_flow.fuel_piratebutton_flow.fuel_flow.fuel_label_1.caption = '[item=coal] ' .. Utils.bignumber_abbrevform(memory.stored_fuel or 0)
pirates_flow.fuel_piratebutton_flow.fuel_flow.fuel_label_2.caption = Utils.negative_rate_abbrevform(Progression.fuel_depletion_rate() or 0)
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton_flow_2.fuel_label_1.caption = '[item=coal] ' .. Utils.bignumber_abbrevform(memory.stored_fuel or 0)
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton_flow_2.fuel_label_2.caption = Utils.negative_rate_abbrevform(Progression.fuel_depletion_rate() or 0)
local color_scale = Math.max(Math.min((- (Progression.fuel_depletion_rate() or 0))/35, 1),0)
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton_flow_2.fuel_label_2.style.font_color = {
r = GuiCommon.fuel_color_1.r * (1-color_scale) + GuiCommon.fuel_color_2.r * color_scale,
g = GuiCommon.fuel_color_1.g * (1-color_scale) + GuiCommon.fuel_color_2.g * color_scale,
b = GuiCommon.fuel_color_1.b * (1-color_scale) + GuiCommon.fuel_color_2.b * color_scale,
}
pirates_flow.fuel_piratebutton_flow.fuel_piratebutton.tooltip = {'pirates.fuel_tooltip', Math.floor(memory.stored_fuel or 0)}
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton.tooltip = {'pirates.fuel_tooltip', Math.floor(memory.stored_fuel or 0)}
pirates_flow.progress_piratebutton_frame.progress_piratebutton.number = (memory.overworldx or 0)
-- pirates_flow.destination_piratebutton_frame.destination_piratebutton.number = memory.destinationsvisited_indices and #memory.destinationsvisited_indices or 0
@ -538,171 +539,136 @@ function Public.update_gui(player)
local cost_bool = destination.static_params.cost_to_leave and (not atsea_sailing_bool) and (not retreating_bool)
local approaching_dock = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.APPROACHING
local leaving_dock = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.LEAVING_DOCK
local approaching_dock_bool = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.APPROACHING
local leaving_dock_bool = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.LEAVING_DOCK
local leave_anytime_bool = (landed_bool and not (eta_bool or cost_bool))
--== Update Gui ==--
flow1 = pirates_flow.fuel_piratebutton_flow
flow1 = pirates_flow.fuel_piratebutton_flow_1
if memory.crewstatus == nil then
flow1.visible = false
else
flow1.visible = true
end
flow1 = pirates_flow.cost_frame
if flow1 then
if cost_bool then
flow1.visible = true
local tooltip, caption
if atsea_loading_bool then
caption = 'Next escape cost:'
tooltip = {'pirates.resources_needed_tooltip_1'}
elseif (not eta_bool) then
caption = 'For escape:'
tooltip = {'pirates.resources_needed_tooltip_3'}
else
caption = 'For early escape:'
tooltip = {'pirates.resources_needed_tooltip_2'}
end
flow1.cost_label_1.caption = caption
flow1.tooltip = tooltip
flow1.cost_label_1.tooltip = tooltip
flow1.cost_table.tooltip = tooltip
local costs = destination.static_params.cost_to_leave
for i = 1, #CoreData.cost_items do
local item_name = CoreData.cost_items[i].name
if costs[item_name] then
local stored = (memory.boat.stored_resources and memory.boat.stored_resources[item_name]) or 0
flow1.cost_table['cost_' .. i].sprite = CoreData.cost_items[i].sprite_name
flow1.cost_table['cost_' .. i].number = Math.max(costs[item_name] - stored, 0)
flow1.cost_table['cost_' .. i].tooltip = CoreData.cost_items[i].display_name
flow1.cost_table['cost_' .. i].visible = true
else
flow1.cost_table['cost_' .. i].visible = false
end
end
flow1.cost_label_2.visible = false
-- local total_rage = time_rage + silo_rage
-- flow1.rage_label_2.caption = total_rage .. '/10'
-- if total_rage <= 4 then
-- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_1
-- flow1.rage_label_2.style.font = 'default-large'
-- elseif total_rage <= 7 then
-- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_2
-- flow1.rage_label_2.style.font = 'default-large-semibold'
-- else
-- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_3
-- flow1.rage_label_2.style.font = 'default-dialog-button'
-- end
-- -- flow1.rage_table.bar_1.value = time_rage >= 1 and 1 or 0
-- -- flow1.rage_table.bar_2.value = time_rage >= 2 and 1 or 0
-- -- flow1.rage_table.bar_3.value = time_rage >= 3 and 1 or 0
-- -- flow1.rage_table.bar_4.value = time_rage >= 4 and 1 or 0
-- -- flow1.rage_table.bar_5.value = silo_rage >= 1 and 1 or 0
-- -- flow1.rage_table.bar_6.value = silo_rage >= 2 and 1 or 0
else
flow1.visible = false
end
end
flow1 = player.gui.screen.pirates_undock_shortcut_button
flow1 = pirates_flow.etaframe_piratebutton_flow_1
if flow1 then
flow1.location = GuiCommon.default_window_positions.undock_shortcut_button
if captain_bool and landed_bool and (not memory.captain_acceptance_timer) then
if cost_bool or atsea_loading_bool or eta_bool or retreating_bool or leave_anytime_bool then
flow1.visible = true
local enabled = Common.query_sufficient_resources_to_leave()
flow1.enabled = enabled
if enabled then
flow1.tooltip = ''
else
flow1.tooltip = 'Store more resources in the captain\'s cabin before leaving.'
end
elseif captain_bool and destination and destination.type and destination.type == Surfaces.enum.DOCK and (not (memory.boat.state and memory.boat.state == Boats.enum_state.LEAVING_DOCK)) then
flow1.visible = true
flow1.enabled = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.DOCKED
flow1.tooltip = ''
else
flow1.visible = false
end
if flow1.visible then
if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4.5 then
flow1.caption = 'Are you sure?'
else
flow1.caption = 'Undock'
end
end
end
local tooltip = ''
flow2 = flow1.etaframe_piratebutton_flow_2
flow1 = pirates_flow.etaframe_piratebutton_flow
flow2.etaframe_label_1.visible = false --start off
flow2.etaframe_label_2.visible = false --start off
flow2.etaframe_label_3.visible = false --start off
flow2.cost_table.visible = false --start off
if flow1 then
if atsea_loading_bool or eta_bool or retreating_bool or leave_anytime_bool then
flow1.visible = true
flow1.etaframe_flow.etaframe_label_1.visible = true
if retreating_bool then
flow1.etaframe_flow.etaframe_label_2.visible = false
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_2.visible = false
local tooltip = 'Probably time to board...'
flow1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_2.tooltip = tooltip
tooltip = 'Probably time to board...'
flow1.etaframe_flow.etaframe_label_1.caption = 'RETURN TO SHIP'
flow2.etaframe_label_1.caption = 'RETURN TO SHIP'
elseif eta_bool then
flow1.etaframe_flow.etaframe_label_2.visible = true
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_2.visible = true
local tooltip = {'pirates.auto_undock_tooltip'}
flow1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_2.tooltip = tooltip
tooltip = {'pirates.auto_undock_tooltip'}
local passive_eta = destination.dynamic_data.time_remaining
flow1.etaframe_flow.etaframe_label_1.caption = 'Auto-undock:'
flow1.etaframe_flow.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(passive_eta)
flow2.etaframe_label_1.caption = 'Auto-undock:'
flow2.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(passive_eta)
elseif atsea_loading_bool then
flow1.etaframe_flow.etaframe_label_2.visible = true
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_2.visible = true
local tooltip = {'pirates.atsea_loading_tooltip'}
flow1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_2.tooltip = tooltip
tooltip = {'pirates.atsea_loading_tooltip'}
local total = Common.map_loading_ticks_atsea
if destination.type == Surfaces.enum.DOCK then
total = Common.map_loading_ticks_atsea_dock
end
local eta_ticks = Common.map_loading_ticks_atsea + (memory.extra_time_at_sea or 0) - memory.loadingticks
local eta_ticks = total + (memory.extra_time_at_sea or 0) - memory.loadingticks
flow1.etaframe_flow.etaframe_label_1.caption = 'Arriving in'
flow1.etaframe_flow.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(eta_ticks / 60)
flow2.etaframe_label_1.caption = 'Arriving in'
flow2.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(eta_ticks / 60)
elseif leave_anytime_bool then
flow1.etaframe_flow.etaframe_label_2.visible = true
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_2.visible = true
local tooltip = {'pirates.leave_anytime_tooltip'}
flow1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_1.tooltip = tooltip
flow1.etaframe_flow.etaframe_label_2.tooltip = tooltip
tooltip = {'pirates.leave_anytime_tooltip'}
flow1.etaframe_flow.etaframe_label_1.caption = 'Undock:'
flow1.etaframe_flow.etaframe_label_2.caption = 'Anytime'
flow2.etaframe_label_1.caption = 'Undock:'
flow2.etaframe_label_2.caption = 'Anytime'
end
if cost_bool then
flow2.etaframe_label_3.visible = true
flow2.cost_table.visible = true
if flow2.etaframe_label_2.visible then
flow2.etaframe_label_2.caption = flow2.etaframe_label_2.caption .. '.'
end
local caption
if atsea_loading_bool then
flow2.etaframe_label_3.caption = 'Next escape cost:'
tooltip = {'pirates.resources_needed_tooltip_1'}
elseif (not eta_bool) then
flow2.etaframe_label_3.visible = false
flow2.etaframe_label_1.visible = true
flow2.etaframe_label_1.caption = 'To escape, store'
tooltip = {'pirates.resources_needed_tooltip_3'}
else
flow2.etaframe_label_3.caption = 'Or store'
tooltip = {'pirates.resources_needed_tooltip_2'}
end
flow2.cost_table.visible = true
local costs = destination.static_params.cost_to_leave
for i = 1, #CoreData.cost_items do
local item_name = CoreData.cost_items[i].name
if costs[item_name] then
local stored = (memory.boat.stored_resources and memory.boat.stored_resources[item_name]) or 0
flow2.cost_table['cost_' .. i].sprite = CoreData.cost_items[i].sprite_name
if atsea_loading_bool then
flow2.cost_table['cost_' .. i].number = costs[item_name]
else --subtract off the amount we've stored
flow2.cost_table['cost_' .. i].number = Math.max(costs[item_name] - stored, 0)
end
flow2.cost_table['cost_' .. i].tooltip = CoreData.cost_items[i].display_name
flow2.cost_table['cost_' .. i].visible = true
else
flow2.cost_table['cost_' .. i].visible = false
end
end
end
flow1.etaframe_piratebutton.tooltip = tooltip
flow2.tooltip = tooltip
if captain_bool and (not retreating_bool) and (leave_anytime_bool or eta_bool or (cost_bool and (not 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
flow2.etaframe_label_1.caption = 'Undock — Are you sure?'
flow2.etaframe_label_2.visible = false
flow2.etaframe_label_3.visible = false
end
else
flow1.etaframe_piratebutton.mouse_button_filter = {'middle'} --hack to avoid press visual
end
else
flow1.visible = false
@ -711,6 +677,87 @@ function Public.update_gui(player)
-- flow1 = pirates_flow.cost_frame
-- if flow1 then
-- if cost_bool then
-- flow1.visible = true
-- -- local costs = destination.static_params.cost_to_leave
-- -- for i = 1, #CoreData.cost_items do
-- -- local item_name = CoreData.cost_items[i].name
-- -- if costs[item_name] then
-- -- local stored = (memory.boat.stored_resources and memory.boat.stored_resources[item_name]) or 0
-- -- flow1.cost_table['cost_' .. i].sprite = CoreData.cost_items[i].sprite_name
-- -- flow1.cost_table['cost_' .. i].number = Math.max(costs[item_name] - stored, 0)
-- -- flow1.cost_table['cost_' .. i].tooltip = CoreData.cost_items[i].display_name
-- -- flow1.cost_table['cost_' .. i].visible = true
-- -- else
-- -- flow1.cost_table['cost_' .. i].visible = false
-- -- end
-- -- end
-- -- local total_rage = time_rage + silo_rage
-- -- flow1.rage_label_2.caption = total_rage .. '/10'
-- -- if total_rage <= 4 then
-- -- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_1
-- -- flow1.rage_label_2.style.font = 'default-large'
-- -- elseif total_rage <= 7 then
-- -- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_2
-- -- flow1.rage_label_2.style.font = 'default-large-semibold'
-- -- else
-- -- flow1.rage_label_2.style.font_color = GuiCommon.rage_font_color_3
-- -- flow1.rage_label_2.style.font = 'default-dialog-button'
-- -- end
-- -- -- flow1.rage_table.bar_1.value = time_rage >= 1 and 1 or 0
-- -- -- flow1.rage_table.bar_2.value = time_rage >= 2 and 1 or 0
-- -- -- flow1.rage_table.bar_3.value = time_rage >= 3 and 1 or 0
-- -- -- flow1.rage_table.bar_4.value = time_rage >= 4 and 1 or 0
-- -- -- flow1.rage_table.bar_5.value = silo_rage >= 1 and 1 or 0
-- -- -- flow1.rage_table.bar_6.value = silo_rage >= 2 and 1 or 0
-- else
-- flow1.visible = false
-- end
-- end
-- flow1 = player.gui.screen.pirates_undock_shortcut_button
-- if flow1 then
-- flow1.location = GuiCommon.default_window_positions.undock_shortcut_button
-- if captain_bool and landed_bool and (not memory.captain_acceptance_timer) then
-- flow1.visible = true
-- local enabled = Common.query_sufficient_resources_to_leave()
-- flow1.enabled = enabled
-- if enabled then
-- flow1.tooltip = ''
-- else
-- flow1.tooltip = 'Store more resources in the captain\'s cabin before leaving.'
-- end
-- elseif captain_bool and destination and destination.type and destination.type == Surfaces.enum.DOCK and (not (memory.boat.state and memory.boat.state == Boats.enum_state.LEAVING_DOCK)) then
-- flow1.visible = true
-- flow1.enabled = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.DOCKED
-- flow1.tooltip = ''
-- else
-- flow1.visible = false
-- end
-- if flow1.visible then
-- if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
-- if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
-- flow1.caption = 'Are you sure?'
-- else
-- flow1.caption = 'Undock'
-- end
-- end
-- end
flow1 = pirates_flow.silo_frame
local active_eta
@ -739,7 +786,7 @@ function Public.update_gui(player)
flow1.silo_progressbar.tooltip = tooltip
flow1.silo_label_1.caption = 'Charge:'
flow1.silo_label_1.style.font_color = Common.bold_font_color
flow1.silo_label_1.style.font_color = GuiCommon.bold_font_color
flow1.silo_label_2.visible = false
flow1.silo_progressbar.visible = true
@ -748,7 +795,7 @@ function Public.update_gui(player)
else
flow1.silo_label_1.caption = 'Charge:'
flow1.silo_label_1.style.font_color = Common.bold_font_color
flow1.silo_label_1.style.font_color = GuiCommon.bold_font_color
flow1.silo_label_2.visible = true
flow1.silo_progressbar.visible = true
@ -891,7 +938,7 @@ function Public.update_gui(player)
flow1 = pirates_flow.covering_line_frame
if flow1 then
if not eta_bool and not retreating_bool and not quest_bool and not silo_bool and not atsea_loading_bool and not cost_bool and not leave_anytime_bool then
if not eta_bool and not retreating_bool and not quest_bool and not silo_bool and not atsea_loading_bool and not cost_bool and not leave_anytime_bool and not approaching_dock_bool and not leaving_dock_bool then
flow1.visible = true
else
flow1.visible = false
@ -912,8 +959,8 @@ function Public.update_gui(player)
flow1 = player.gui.screen.pirates_spontaneous_camera
if flow1 then
flow1.location = GuiCommon.default_window_positions.spontaneous_camera
flow1.visible = false
flow1.location = {x = 8, y = 48}
if on_deck_standing_near_loco_bool then
flow1.visible = true
flow1.surface_index = Hold.get_hold_surface(1).index
@ -964,46 +1011,34 @@ local function on_gui_click(event)
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
local memory = Memory.get_crew_memory()
if 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
Public[name].toggle_window(player)
Public[name].update(player)
end
-- elseif event.element.name == 'fuel_flow' or event.element.name == 'fuel_label_1' or event.element.name == 'fuel_label_2' then
-- Public.fuel.toggle_window(player)
-- Public.fuel.update(player)
elseif event.element.name and event.element.name == 'pirates_undock_shortcut_button' then
local memory = Memory.get_crew_memory()
--double check:
if Roles.player_privilege_level(player) >= Roles.privilege.OFFICER then
if event.element.name and event.element.name == 'etaframe_piratebutton' and (memory.boat.state == Boats.enum_state.DOCKED or memory.boat.state == Boats.enum_state.LANDED) then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock()
else
Progression.try_retreat_from_island()
elseif memory.boat.state == Boats.enum_state.LANDED then
if Common.query_sufficient_resources_to_leave() then
Progression.try_retreat_from_island()
else
Common.notify_player(player, 'Not enough stored resources.')
end
end
else
memory.undock_shortcut_are_you_sure_data[player.index] = game.tick
end
end
-- elseif event.element.name and event.element.name == 'etaframe_piratebutton' then
-- local memory = Memory.get_crew_memory()
-- --double check:
-- if Roles.player_privilege_level(player) >= Roles.privilege.OFFICER then
-- if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
-- if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
-- if memory.boat.state == Boats.enum_state.DOCKED then
-- Progression.undock_from_dock()
-- else
-- Progression.try_retreat_from_island()
-- end
-- else
-- memory.undock_shortcut_are_you_sure_data[player.index] = game.tick
-- end
-- 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
Public[name].toggle_window(player)
Public[name].update(player)
end
-- elseif event.element.name == 'fuel_label_1' or event.element.name == 'fuel_label_2' then
-- Public.fuel.toggle_window(player)
-- Public.fuel.update(player)
else
GuiRuns.click(event)
GuiCrew.click(event)

View File

@ -611,7 +611,7 @@ function Public.click(event)
global_memory.crewproposals[#global_memory.crewproposals + 1] = proposal
local message = player.name .. ' proposed the run ' .. proposal_name .. ' (capacity ' .. CoreData.capacity_options[capacity_option].text3 .. ').'
local message = player.name .. ' proposed the run ' .. proposal_name .. ' [capacity ' .. CoreData.capacity_options[capacity_option].text3 .. '].'
-- local message = player.name .. ' proposed the run ' .. proposal_name .. ' (difficulty ' .. CoreData.difficulty_options[difficulty_option].text .. ', capacity ' .. CoreData.capacity_options[capacity_option].text3 .. ').'
Common.notify_lobby(message)
return

View File

@ -94,7 +94,7 @@ function Public.update(player)
-- flow.close_button_flow.hflow.tospend.tooltip = string.format('The crew has %01d stored coal.', 0)
-- end
if Roles.player_privilege_level(player) >= Roles.privilege.OFFICER then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
flow.close_button_flow.hflow.tospend.visible = true
local inv = player.get_inventory(defines.inventory.character_main)
@ -119,7 +119,7 @@ function Public.update(player)
if availability_data and availability_data[k] == true then
flow.trades[k].visible = true
anything_in_shop_1 = true
if Roles.player_privilege_level(player) >= Roles.privilege.OFFICER then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
flow.trades[k].buy_button.visible = true
else
flow.trades[k].buy_button.visible = false
@ -132,7 +132,7 @@ function Public.update(player)
for k, _ in pairs(shop_data_2) do
if availability_data and availability_data[k] == true then
flow.trades[k].visible = true
if Roles.player_privilege_level(player) >= Roles.privilege.OFFICER then
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
flow.trades[k].buy_button.visible = true
else
flow.trades[k].buy_button.visible = false

View File

@ -620,6 +620,7 @@ local function event_on_entity_died(event)
if not crew_id and entity.valid then crew_id = tonumber(string.sub(entity.force.name, -3, -1)) or nil end
Memory.set_working_id(crew_id)
local memory = Memory.get_crew_memory()
if memory.id == 0 then return end
base_kill_rewards(event)

View File

@ -224,7 +224,7 @@ end
function Public.wooden_chest_loot()
local memory = Memory.get_crew_memory()
local overworldx = memory.overworldx or 0
local num = Math.random(1,2)
local num = 1
return Public.chest_loot(num, 40/100 * Math.sloped(Common.difficulty(),1/2) * Common.game_completion_progress())
end

View File

@ -342,19 +342,19 @@ event.on_nth_tick(1, instatick)
-- to help debug, comment this out, and instead use the command /chnk to generate some chunks manually
event.add(defines.events.on_chunk_generated, Interface.event_on_chunk_generated)
----- FOR DESYNC BUGFIXING -----
-- local gMeta = getmetatable(_ENV)
-- if not gMeta then
-- gMeta = {}
-- setmetatable(_ENV, gMeta)
-- end
local gMeta = getmetatable(_ENV)
if not gMeta then
gMeta = {}
setmetatable(_ENV, gMeta)
end
gMeta.__newindex = function(_, n, v)
log('Desync warning: attempt to write to undeclared var ' .. n)
global[n] = v
end
gMeta.__index = function(_, n)
return global[n]
end
-- gMeta.__newindex = function(_, n, v)
-- log('Desync warning: attempt to write to undeclared var ' .. n)
-- global[n] = v
-- end
-- gMeta.__index = function(_, n)
-- return global[n]
-- end
return Public

View File

@ -169,32 +169,35 @@ function Public.generate_overworld_destination(p)
static_params.scheduled_raft_raids = scheduled_raft_raids
-- halved all of them for now, whilst testing...
local normal_costitems = {'small-lamp', 'engine-unit', 'advanced-circuit'}
local base_cost_0 = {
['small-lamp'] = (macrop.x-2)*20,
['small-lamp'] = (macrop.x-2)*10,
}
local base_cost_1 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['small-lamp'] = (macrop.x-2)*10,
['engine-unit'] = (macrop.x-7)*8,
}
local base_cost_2 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['advanced-circuit'] = (macrop.x-10)*10,
['small-lamp'] = (macrop.x-2)*10,
['engine-unit'] = (macrop.x-7)*8,
['advanced-circuit'] = (macrop.x-10)*5,
}
local base_cost_3 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['advanced-circuit'] = (macrop.x-10)*10,
['small-lamp'] = (macrop.x-2)*10,
['engine-unit'] = (macrop.x-7)*8,
['advanced-circuit'] = (macrop.x-10)*5,
-- ['electric-engine-unit'] = (macrop.x-16)*10,
}
local base_cost_4 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['advanced-circuit'] = (macrop.x-10)*10,
['small-lamp'] = (macrop.x-2)*10,
['engine-unit'] = (macrop.x-7)*8,
['advanced-circuit'] = (macrop.x-10)*5,
-- ['electric-engine-unit'] = (macrop.x-16)*10,
}
if macrop.x <= 4 then
if macrop.x <= 5 then
-- cost_to_leave = {['small-lamp'] = 5}
cost_to_leave = nil
elseif macrop.x <= 8 then
cost_to_leave = base_cost_0
@ -222,7 +225,7 @@ function Public.generate_overworld_destination(p)
}
end
-- Multiplication by Balance.cost_to_leave_multiplier() happens later.
static_params.cost_to_leave = cost_to_leave -- Multiplication by Balance.cost_to_leave_multiplier() happens later.
class_for_sale = Classes.Class_List[Math.random(#Classes.Class_List)]
static_params.class_for_sale = class_for_sale

View File

@ -12,38 +12,65 @@ local Server = require 'utils.server'
local Classes = require 'maps.pirates.roles.classes'
local Public = {}
local privilege = {
local privilege_levels = {
NORMAL = 1,
OFFICER = 2,
CAPTAIN = 3
}
Public.privilege = privilege
Public.privilege_levels = privilege_levels
--== Roles — General ==--
function Public.reset_officers()
local memory = Memory.get_crew_memory()
memory.officers_table = {}
end
function Public.make_officer(captain, player)
local memory = Memory.get_crew_memory()
local force = game.forces[memory.force_name]
if Common.validate_player(player) and (not (captain.index == player.index)) then
memory.officers_table[player.index] = true
end
local message = (captain.name .. ' made ' .. player.name .. ' an officer.')
Common.notify_force(force, message)
end
function Public.unmake_officer(captain, player)
local memory = Memory.get_crew_memory()
local force = game.forces[memory.force_name]
if Common.validate_player(player) and (not (captain.index == player.index)) then
memory.officers_table[player.index] = nil
end
local message = (captain.name .. ' unmade ' .. player.name .. ' an officer.')
Common.notify_force(force, message)
end
function Public.tag_text(player)
local memory = Memory.get_crew_memory()
local str = ''
local tags = {}
if memory.id ~= 0 and memory.playerindex_captain and player.index == memory.playerindex_captain then
tags[#tags + 1] = "Cap'n"
tags[#tags + 1] = 'Cap\'n'
elseif player.controller_type == defines.controllers.spectator then
tags[#tags + 1] = 'Spectating'
elseif memory.officers_table and memory.officers_table[player.index] then
tags[#tags + 1] = "Officer"
tags[#tags + 1] = 'Officer'
end
if memory.classes_table and memory.classes_table[player.index] then
if not str == '' then str = str .. ' ' end
tags[#tags + 1] = Classes.display_form[memory.classes_table[player.index]]
end
local str = ''
for i, t in ipairs(tags) do
if i>1 then str = str .. ', ' end
str = str .. t
@ -64,11 +91,11 @@ function Public.player_privilege_level(player)
local memory = Memory.get_crew_memory()
if memory.id ~= 0 and memory.playerindex_captain and player.index == memory.playerindex_captain then
return Public.privilege.CAPTAIN
return Public.privilege_levels.CAPTAIN
elseif memory.officers_table and memory.officers_table[player.index] then
return Public.privilege.OFFICER
return Public.privilege_levels.OFFICER
else
return Public.privilege.NORMAL
return Public.privilege_levels.NORMAL
end
end
@ -96,9 +123,15 @@ end
function Public.player_left_so_redestribute_roles(player)
local memory = Memory.get_crew_memory()
if player and player.index and player.index == memory.playerindex_captain then
Public.assign_captain_based_on_priorities()
if player and player.index then
if player.index == memory.playerindex_captain then
Public.assign_captain_based_on_priorities()
end
if memory.officers_table and memory.officers_table[player.index] then
memory.officers_table[player.index] = nil
end
end
Public.try_renounce_class(player, "A %s class is now spare.")
@ -178,6 +211,8 @@ function Public.make_captain(player)
memory.playerindex_captain = player.index
global_memory.playerindex_to_priority[player.index] = nil
memory.captain_acceptance_timer = nil
Public.reset_officers()
end
function Public.pass_captainhood(player, player_to_pass_to)
@ -467,7 +502,7 @@ function Public.update_privileges(player)
end
if string.sub(player.surface.name, 9, 17) == 'Crowsnest' or string.sub(player.surface.name, 9, 13) == 'Cabin' then
if Public.player_privilege_level(player) >= Public.privilege.OFFICER then
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
return Public.add_player_to_permission_group(player, 'restricted_area_privileged')
else
return Public.add_player_to_permission_group(player, 'restricted_area')

View File

@ -29,9 +29,10 @@ Public.offers_loaders = {
}
Public.offers_default = {
{price = {{'coin', 1000}}, offer = {type = 'give-item', item = 'copper-plate', count = 250}},
{price = {{'coin', 1000}}, offer = {type = 'give-item', item = 'iron-plate', count = 250}},
{price = {{'coin', 1000}}, offer = {type = 'give-item', item = 'crude-oil-barrel', count = 7}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'copper-plate', count = 150}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'iron-plate', count = 150}},
{price = {{'coin', 1000}}, offer = {type = 'give-item', item = 'gun-turret', count = 1}},
{price = {{'coin', 1250}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}},
}
Public.offers_rockets = {

View File

@ -17,6 +17,7 @@ local Public = {}
Public.market_barters = {
{price = {{'iron-plate', 300}}, offer = {type = 'give-item', item = 'copper-plate', count = 500}},
{price = {{'copper-plate', 300}}, offer = {type = 'give-item', item = 'iron-plate', count = 500}},
@ -34,13 +35,56 @@ Public.market_barters = {
--TODO: add more complex trades
}
Public.market_permanent_offers = {
{price = {{'coin', 4000}}, offer = {type = 'give-item', item = 'iron-ore', count = 750}},
{price = {{'coin', 4000}}, offer = {type = 'give-item', item = 'copper-ore', count = 750}},
{price = {{'coin', 4000}}, offer = {type = 'give-item', item = 'stone', count = 750}},
{price = {{'coin', 4000}}, offer = {type = 'give-item', item = 'crude-oil-barrel', count = 750}},
}
-- cheap but one-off
Public.market_sales = {
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'firearm-magazine', count = 500}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine', count = 75}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine', count = 25}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 60}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'coal', count = 750}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'raw-fish', count = 300}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'laser-turret', count = 1}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'vehicle-machine-gun', count = 2}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'substation', count = 6}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'distractor-capsule', count = 6}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'destroyer-capsule', count = 3}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'coin', count = 5000}},
}
function Public.minimarket_generate_barters(how_many)
function Public.minimarket_generate_offers(how_many_barters, how_many_sales)
local ret = {}
local barterscopy = Utils.deepcopy(Public.market_barters)
local toaddcount = how_many
for _, offer in pairs(Public.market_permanent_offers) do
ret[#ret + 1] = offer
end
local toaddcount
local salescopy = Utils.deepcopy(Public.market_sales)
toaddcount = how_many_sales
while toaddcount>0 and #salescopy > 0 do
local index = Math.random(#salescopy)
local toadd = salescopy[index]
ret[#ret + 1] = toadd
for i = index, #salescopy - 1 do
salescopy[i] = salescopy[i+1]
end
salescopy[#salescopy] = nil
toaddcount = toaddcount - 1
end
local barterscopy = Utils.deepcopy(Public.market_barters)
toaddcount = how_many_barters
while toaddcount>0 and #barterscopy > 0 do
local index = Math.random(#barterscopy)
local toadd = barterscopy[index]
@ -51,6 +95,7 @@ function Public.minimarket_generate_barters(how_many)
barterscopy[#barterscopy] = nil
toaddcount = toaddcount - 1
end
return ret
end
@ -69,10 +114,9 @@ function Public.create_minimarket(surface, p)
e.rotatable = false
e.destructible = false
local barters = Public.minimarket_generate_barters(4)
local offers = Public.minimarket_generate_offers(2,2)
for _, barter in pairs(barters) do
local offer = barter
for _, offer in pairs(offers) do
e.add_market_item(offer)
end
end

View File

@ -10,6 +10,7 @@ local Common = require 'maps.pirates.common'
local Utils = require 'maps.pirates.utils_local'
local Math = require 'maps.pirates.math'
local inspect = require 'utils.inspect'.inspect
local SurfacesCommon = require 'maps.pirates.surfaces.common'
local Upgrades = require 'maps.pirates.boat_upgrades'
@ -317,6 +318,7 @@ function Public.event_on_market_item_purchased(event)
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
local alloffers = market.get_market_items()
local this_offer = alloffers[offer_index]
@ -345,31 +347,48 @@ function Public.event_on_market_item_purchased(event)
end
-- Here - check for BARTER vs CLASS PURCHASE vs STATIC
-- Class purchase is purchase for 'nothing'
-- Static is purchase via fuel
-- Barter is otherwise
-- Here - check for BARTER vs STATIC vs ONE-oFF
-- One-off becomes unavailable after purchase, such as class purchase
-- Static doesn't decay
-- Barter decays
local decay_type
if offer_type == 'nothing' then
decay_type = 'one-off'
elseif destination.type == SurfacesCommon.enum.DOCK and (price and price[1] and price[1].name and (price[1].name == 'coin')) and (offer_giveitem_name and not (offer_giveitem_name == 'stone' or offer_giveitem_name == 'iron-ore' or offer_giveitem_name == 'crude-oil-barrel' or offer_giveitem_name == 'copper-ore')) then
decay_type = 'one-off'
elseif (price and price[1] and price[1].name and (price[1].name == 'pistol' or price[1].name == 'burner-mining-drill')) or (offer_giveitem_name and (offer_giveitem_name == 'defender-capsule' or offer_giveitem_name == 'gun-turret')) then
decay_type = 'static'
else
decay_type = 'decay'
end
if decay_type == 'one-off' then
local force = player.force
local destination = Common.current_destination()
-- check if they have a role already - renounce it if so
if memory.classes_table and memory.classes_table[player.index] then
Roles.try_renounce_class(player)
end
memory.classes_table[player.index] = destination.static_params.class_for_sale
if force and force.valid then
Common.notify_force_light(force,string.format('%s is now a %s. ([font=scenario-message-dialog]%s[/font])', player.name, Classes.display_form[memory.classes_table[player.index]], Classes.explanation[memory.classes_table[player.index]]))
end
if offer_type == 'nothing' then
-- check if they have a role already - renounce it if so
if memory.classes_table and memory.classes_table[player.index] then
Roles.try_renounce_class(player)
end
memory.classes_table[player.index] = destination.static_params.class_for_sale
if destination.dynamic_data and destination.dynamic_data.market_class_offer_rendering then
rendering.destroy(destination.dynamic_data.market_class_offer_rendering)
if force and force.valid then
Common.notify_force_light(force,string.format('%s is now a %s. ([font=scenario-message-dialog]%s[/font])', player.name, Classes.display_form[memory.classes_table[player.index]], Classes.explanation[memory.classes_table[player.index]]))
end
if destination.dynamic_data and destination.dynamic_data.market_class_offer_rendering then
rendering.destroy(destination.dynamic_data.market_class_offer_rendering)
end
else
Common.notify_force_light(player.force, player.name .. ' bought ' .. this_offer.offer.count .. ' ' .. this_offer.offer.item .. ' for ' .. price[1].amount .. ' ' .. price[1].name .. '.')
end
market.remove_market_item(offer_index)
else
-- print:
if (price and price[1]) then
-- if (price and price[1] and price[1].name and ((price[1].name ~= 'coin' and price[1].name ~= 'pistol') or price[2])) then
if price[2] then
@ -380,7 +399,8 @@ function Public.event_on_market_item_purchased(event)
Common.notify_force_light(player.force, player.name .. ' is trading away ' .. price[1].amount .. ' ' .. price[1].name .. ' for ' .. this_offer.offer.count .. ' ' .. this_offer.offer.item .. '...')
end
end
if (price and price[1] and price[1].name and (price[1].name == 'pistol' or price[1].name == 'burner-mining-drill')) then
if decay_type == 'static' then
if not inv then return end
local flying_text_color = {r = 255, g = 255, b = 255}
local text1 = '[color=1,1,1]+' .. this_offer.offer.count .. '[/color] [item=' .. alloffers[offer_index].offer.item .. ']'

View File

@ -8,6 +8,7 @@ local Math = require 'maps.pirates.math'
local inspect = require 'utils.inspect'.inspect
local Token = require 'utils.token'
local Task = require 'utils.task'
local SurfacesCommon = require 'maps.pirates.surfaces.common'
@ -298,13 +299,23 @@ function Public.upgrade_chests(new_chest) --the fast replace doesn't work well o
end
end
-- just for debug purposes, might need to fire this again
local crowsnest_delayed = Token.register(
function(data)
Public.crowsnest_surface_delayed_init()
end
)
function Public.crowsnest_surface_delayed_init()
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Public.crowsnest_surface_name()]
local force = game.forces[memory.force_name]
if not (surface and surface.valid) then log('crowsnest_surface_delayed_init called when crowsnest surface wasn\'t valid...') end
if _DEBUG and (not (surface and surface.valid)) then
game.print('debug issue: crowsnest_surface_delayed_init called when crowsnest surface wasn\'t valid...')
Task.set_timeout_in_ticks(5, crowsnest_delayed, {})
return
end
surface.destroy_decoratives{area = {{-3, -4},{4, 4}}}

View File

@ -21,7 +21,7 @@ Public.Data.width = 296
Public.Data.height = 98
Public.Data.top_boat_bottom = -7
Public.Data.bottom_boat_top = 5
Public.Data.playerboat_starting_xcoord = 35
Public.Data.playerboat_starting_xcoord = 41
Public.Data.static_params_default = {
starting_time_of_day = 0,
@ -140,7 +140,6 @@ function Public.terrain(args)
if fishrng == 1 then
args.entities[#args.entities + 1] = {name = 'fish', position = args.p}
end
return
end
function Public.chunk_structures(args)

View File

@ -157,7 +157,7 @@ function Public.create_hold_surface(nth)
Common.build_small_loco(surface, Public.Data.loco_offset, game.forces[memory.force_name], {255, 106, 52})
local items = subtype == enum.INITIAL and Balance.starting_items_crew_downstairs() or {}
Public.place_random_obstacle_boxes(nth, 0, items, 14)
Public.place_random_obstacle_boxes(nth, 0, items, 15)
if subtype == enum.SECONDARY then
if Common.difficulty() == 1 then

View File

@ -47,6 +47,7 @@ function Public.kraken_tick(crew_id, kraken_id, step, substep)
local surface = game.surfaces[memory.sea_name]
local kraken_data = memory.active_sea_enemies.krakens[kraken_id]
if not kraken_data then return end --check if kraken died
local kraken_spawner_entity = kraken_data.spawner_entity
if step == 1 then
if substep == 1 then
@ -84,6 +85,14 @@ function Public.kraken_tick(crew_id, kraken_id, step, substep)
elseif step == 3 then
Public.kraken_move(kraken_id, kraken_data.position, substep % 4 + 1)
-- regen:
local healthbar = memory.healthbars and memory.healthbars[kraken_spawner_entity.unit_number]
if healthbar then
local new_health = Math.min(healthbar.health + Balance.kraken_regen_scale, kraken_data.max_health)
healthbar.health = new_health
Common.update_healthbar_rendering(healthbar, new_health)
end
if substep % 4 == 0 then
local crewmembers = Common.crew_get_crew_members()
local p_can_fire_at = {}
@ -154,15 +163,17 @@ local function on_entity_destroyed(event)
end
end
local p2 = surface.find_non_colliding_position('small-biter', p, 10, 0.2)
local p2 = surface.find_non_colliding_position('medium-biter', p, 10, 0.2)
if not p2 then return end
local name = Common.get_random_unit_type(game.forces[memory.enemy_force_name].evolution_factor + Balance.kraken_spawns_base_extra_evo)
surface.create_entity{name = name, position = p2, force = memory.enemy_force_name}
Effects.kraken_effect_2(surface, p2)
-- local evo_increase = Balance.kraken_evo_increase_per_shot()
-- memory.kraken_evo = memory.kraken_evo + evo_increase
-- game.forces[memory.enemy_force_name].evolution_factor = game.forces[memory.enemy_force_name].evolution_factor + evo_increase
local evo_increase = Balance.kraken_evo_increase_per_shot()
if not memory.kraken_evo then memory.kraken_evo = 0 end
memory.kraken_evo = memory.kraken_evo + evo_increase
game.forces[memory.enemy_force_name].evolution_factor = game.forces[memory.enemy_force_name].evolution_factor + evo_increase
end
end
@ -234,7 +245,7 @@ function Public.kraken_move(kraken_id, new_p, new_frame)
kraken_data.spawner_entity = surface.create_entity{name = 'biter-spawner', position = new_p_2, force = memory.enemy_force_name}
Common.new_healthbar(kraken_id, true, kraken_data.spawner_entity, kraken_data.max_health)
end
if old_frame then --cleanup old tiles
local old_tile_positions2 = Utils.exclude_position_arrays(old_tile_positions, new_tile_positions)
local tiles2 = {}

View File

@ -146,7 +146,7 @@ function Public.destination_on_collide(destination)
if item == 'uranium-235' then
replace[item] = count
else
replace[item] = Math.ceil(count * Public.cost_to_leave_multiplier())
replace[item] = Math.ceil(count * Balance.cost_to_leave_multiplier())
end
end
destination.static_params.cost_to_leave = replace
@ -281,7 +281,7 @@ function Public.destination_on_arrival(destination)
Server.to_discord_embed_raw((destination.static_params.discord_emoji or CoreData.comfy_emojis.wut) .. '[' .. memory.name .. '] ' .. message)
end
if destination.static_params.name == 'Dock' then
message = message .. ' ' .. 'Extra trades are available in the shop.'
message = message .. ' ' .. 'A special trade is available for the captain in the Main Store.'
end
Common.notify_force(game.forces[memory.force_name], message)

View File

@ -869,12 +869,17 @@ function Public.loading_update(tickinterval)
elseif memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then
local eta_ticks = Common.map_loading_ticks_atsea + (memory.extra_time_at_sea or 0) - memory.loadingticks
local total = Common.map_loading_ticks_atsea
if currentdestination.type == Surfaces.enum.DOCK then
total = Common.map_loading_ticks_atsea_dock
end
if eta_ticks < 60*30 and memory.active_sea_enemies and (memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens > 0) then
local eta_ticks = total + (memory.extra_time_at_sea or 0) - memory.loadingticks
if eta_ticks < 60*20 and memory.active_sea_enemies and (memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens > 0) then
memory.loadingticks = memory.loadingticks - tickinterval
else
local fraction = memory.loadingticks / (Common.map_loading_ticks_atsea + (memory.extra_time_at_sea or 0))
local fraction = memory.loadingticks / (total + (memory.extra_time_at_sea or 0))
if fraction > Common.fraction_of_map_loaded_atsea then
Progression.progress_to_destination(destination_index)

View File

@ -59,11 +59,11 @@ function Public.update_character_properties(tickinterval)
if memory.classes_table and memory.classes_table[player_index] then
local class = memory.classes_table[player_index]
if class == Classes.enum.SAMURAI then
health_boost = health_boost + 250
health_boost = health_boost + 225
end
end
if memory.playerindex_captain and memory.playerindex_captain == player_index then
health_boost = health_boost + 50
health_boost = health_boost + 25
end
character.character_health_bonus = health_boost