1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-16 02:47:48 +02:00
This commit is contained in:
danielmartin0 2022-03-13 01:44:32 +00:00
parent 221455c27b
commit d2ecd38764
42 changed files with 380 additions and 238 deletions

View File

@ -23,7 +23,7 @@ function Public.starting_boatEEIelectric_buffer_size_MJ() --maybe needs to be at
return 3/2
end
Public.EEI_stages = { --multipliers
1,2,5,8,12
1,2,4,7,11
}
@ -40,7 +40,7 @@ Public.rocket_launch_coin_reward = 5000
function Public.crew_scale()
local ret = Common.activecrewcount()/10
if ret == 0 then ret = 1/10 end --if all players are afk
if ret > 3 then ret = 3 end --cap
if ret > 2.4 then ret = 2.4 end --we have to cap this because you need time to mine the ore... and big crews are a mess anyway. currently this value matches the 24 player cap
return ret
end
@ -109,7 +109,7 @@ function Public.fuel_depletion_rate_static()
local rate
if Common.overworldx() > 0 then
rate = 560 * (0 + (Common.overworldx()/40)^(9/10)) * Public.crew_scale()^(1/6) * Math.sloped(Common.difficulty(), 4/5) / T --most of the crewsize dependence is through T, i.e. the coal cost per island stays the same... but the extra player dependency accounts for the fact that even in compressed time, more players seem to get more resources per island
rate = 570 * (0 + (Common.overworldx()/40)^(9/10)) * Public.crew_scale()^(1/6) * Math.sloped(Common.difficulty(), 4/5) / T --most of the crewsize dependence is through T, i.e. the coal cost per island stays the same... but the extra player dependency accounts for the fact that even in compressed time, more players seem to get more resources per island
else
rate = 0
end
@ -159,7 +159,14 @@ end
function Public.base_evolution()
local slope = 0.0201
local evo = (0.0201 * (Common.overworldx()/40)) * Math.sloped(Common.difficulty(), 1/5)
if Common.overworldx() > 600 then
evo = evo + (0.005 * (Math.min(Common.overworldx()/40,25) - 600)) * Math.sloped(Common.difficulty(), 1/5)
end
if Common.overworldx() > 1000 then --undo this ramp:
evo = evo + (-0.005 * (Math.min(Common.overworldx()/40,25) - 1000)) * Math.sloped(Common.difficulty(), 1/5)
end
if Common.overworldx()/40 == 0 then evo = 0 end
return evo
end
@ -221,10 +228,10 @@ function Public.evolution_per_full_silo_charge()
end
function Public.bonus_damage_to_humans()
local ret = 0.125
local ret = 0.050
local diff = Common.difficulty()
if diff <= 0.7 then ret = 0.1 end
if diff >= 1.3 then ret = 0.15 end
if diff <= 0.7 then ret = 0.025 end
if diff >= 1.3 then ret = 0.075 end
return ret
end
@ -271,8 +278,13 @@ function Public.quest_reward_multiplier()
end
function Public.island_richness_avg_multiplier()
return 0.7 + 0.1 * (Common.overworldx()/40)^(7/10)
end --tuned tbh
local ret
local base = 0.7 + 0.1 * (Common.overworldx()/40)^(7/10) --tuned tbh
ret = base * Math.sloped(Public.crew_scale(), 1/20) --we don't really have resources scaling by player count in this resource-constrained scenario, but we scale a little, to accommodate each player filling their inventory with useful tools. also, I would do 1/14, but we go even slightly lower because we're applying this somewhat sooner than players actually get there.
return ret
end
function Public.resource_quest_multiplier()
return (1.0 + 0.075 * (Common.overworldx()/40)^(8/10)) * Math.sloped(Common.difficulty(), 1/3) * (Public.crew_scale())^(1/8)

View File

@ -31,6 +31,7 @@ local simplex_noise = require 'utils.simplex_noise'.d2
local Token = require 'utils.token'
local Task = require 'utils.task'
local Highscore = require 'maps.pirates.highscore'
local CustomEvents = require 'maps.pirates.custom_events'
local GUIcolor = require 'maps.pirates.gui.color'
@ -101,7 +102,7 @@ function(cmd)
if not rgb then return end
player.color = rgb
player.chat_color = rgb
local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color became ' .. color .. '[/color] (via /ccolor).'
local message = '[color=' .. rgb.r .. ',' .. rgb.g .. ',' .. rgb.b .. ']' .. player.name .. '\'s color randomly became ' .. color .. '[/color] (via /ccolor).'
Common.notify_game(message)
-- disabled due to lag:
-- GUIcolor.toggle_window(player)
@ -135,6 +136,7 @@ local go_1 = Token.register(
Overworld.ensure_lane_generated_up_to(24, Crowsnest.Data.visibilitywidth/2)
Overworld.ensure_lane_generated_up_to(-24, Crowsnest.Data.visibilitywidth/2)
memory.currentdestination_index = 1
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
Surfaces.create_surface(Common.current_destination())
Task.set_timeout_in_ticks(60, go_2, {})
end

View File

@ -1034,14 +1034,14 @@ end
function Public.validate_player(player)
local ret = false
if player and player.valid and player.connected and game.players[player.name] then
ret = true
end
if not ret and _DEBUG then
return true
else
if _DEBUG then
log('player validation fail: ' .. (player.name or 'noname'))
end
return ret
return false
end
end
@ -1125,11 +1125,13 @@ function Public.give_items_to_crew(items)
Public.notify_force(force, 'Warning: captain\'s cabin chests are full!')
end
else
if _DEBUG then
log('give_items_to_crew: i2.name is nil. inspect:')
log(inspect(items))
log(inspect(i2))
end
end
end
else
for _, i in pairs(items) do
if not (i.count and i.count>0) then return end

View File

@ -5,8 +5,8 @@ local inspect = require 'utils.inspect'.inspect
local Public = {}
Public.scenario_id_name = 'pirates'
Public.version_string = '1.1.0.0'
Public.version_float = 1.1
Public.version_string = '1.1.0.2'
Public.version_float = 1.102
Public.blueprint_library_allowed = true
Public.blueprint_importing_allowed = true

View File

@ -0,0 +1,13 @@
local Event = require 'utils.event'
local Public = {}
-- gotta finish reformulating the gui updates in terms of events:
local enum = {
update_crew_progress_gui = Event.generate_event_name('update_crew_progress_gui'),
update_crew_fuel_gui = Event.generate_event_name('update_crew_fuel_gui'),
}
Public.enum = enum
return Public

View File

@ -45,7 +45,11 @@ end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
end

View File

@ -113,6 +113,8 @@ function Public.flow_add_floating_sprite_button(flow1, button_name, width)
end
function Public.flow_add_floating_button(flow1, button_name)
local flow2, flow3

View File

@ -351,7 +351,11 @@ end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
if not player.gui.screen[window_name .. '_piratewindow'] then return end
local flow = player.gui.screen[window_name .. '_piratewindow']

View File

@ -43,7 +43,13 @@ local GuiCommon = require 'maps.pirates.gui.common'
-- return last_match
-- end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
local memory = Memory.get_crew_memory()
local pirates_flow = player.gui.top
@ -60,10 +66,10 @@ function Public.update(player)
-- else
local destination = Common.current_destination()
local evolution_base
local evolution_time
local evolution_silo
local evolution_nests
local evolution_base = 0
local evolution_time = 0
local evolution_silo = 0
local evolution_nests = 0
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 - (memory.kraken_evo or 0)
-- here Kraken.kraken_slots
@ -81,10 +87,12 @@ function Public.update(player)
button.number = evo
end
else
evolution_base = (destination and destination.dynamic_data and destination.dynamic_data.evolution_accrued_leagues) or 0
evolution_time = (destination and destination.dynamic_data and destination.dynamic_data.evolution_accrued_time) or 0
evolution_nests = (destination and destination.dynamic_data and destination.dynamic_data.evolution_accrued_nests) or 0
evolution_silo = (destination and destination.dynamic_data and destination.dynamic_data.evolution_accrued_silo) or 0
if destination and destination.dynamic_data then
evolution_base = destination.dynamic_data.evolution_accrued_leagues or 0
evolution_time = destination.dynamic_data.evolution_accrued_time or 0
evolution_nests = destination.dynamic_data.evolution_accrued_nests or 0
evolution_silo = destination.dynamic_data.evolution_accrued_silo or 0
end
button.tooltip = string.format('Local biter evolution\n\nLeagues: %.2f\nTime: %.2f\nNests: %.2f\nSilo: %.2f\nTotal: %.2f', evolution_base, evolution_time, evolution_nests, evolution_silo, evo)
button.number = evo
end

View File

@ -67,10 +67,31 @@ function Public.toggle_window(player)
end
function Public.regular_update(player)
local flow, flow2, flow3, flow4, flow5, flow6
local memory = Memory.get_crew_memory()
if not player.gui.screen[window_name .. '_piratewindow'] then return end
flow = player.gui.screen[window_name .. '_piratewindow']
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)
if inv and inv.valid then
local coin_amount = inv.get_item_count('coin') or 0
flow.close_button_flow.hflow.tospend.number = coin_amount
flow.close_button_flow.hflow.tospend.tooltip = string.format("You're holding " .. Utils.bignumber_abbrevform2(coin_amount) .. " doubloons.")
end
else
flow.close_button_flow.hflow.tospend.visible = false
end
end
function Public.update(player)
function Public.full_update(player)
local flow, flow2, flow3, flow4, flow5, flow6
local memory = Memory.get_crew_memory()
@ -94,20 +115,6 @@ 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_levels.OFFICER then
flow.close_button_flow.hflow.tospend.visible = true
local inv = player.get_inventory(defines.inventory.character_main)
if inv and inv.valid then
local coin_amount = inv.get_item_count('coin') or 0
flow.close_button_flow.hflow.tospend.number = coin_amount
flow.close_button_flow.hflow.tospend.tooltip = string.format("You're holding " .. Utils.bignumber_abbrevform2(coin_amount) .. " doubloons.")
end
else
flow.close_button_flow.hflow.tospend.visible = false
end
if memory.crewstatus == Crew.enum.ADVENTURING then
@ -159,7 +166,6 @@ function Public.update(player)
end
end
end

View File

@ -8,7 +8,7 @@ local GuiEvo = require 'maps.pirates.gui.evo'
local GuiProgress = require 'maps.pirates.gui.progress'
local GuiRuns = require 'maps.pirates.gui.runs'
local GuiCrew = require 'maps.pirates.gui.crew'
local GuiShop = require 'maps.pirates.gui.shop'
local GuiFuel = require 'maps.pirates.gui.fuel'
local GuiMinimap = require 'maps.pirates.gui.minimap'
local GuiInfo = require 'maps.pirates.gui.info'
local Quest = require 'maps.pirates.quest'
@ -22,21 +22,49 @@ local Crowsnest = require 'maps.pirates.surfaces.crowsnest'
local Progression = require 'maps.pirates.progression'
local Surfaces = require 'maps.pirates.surfaces.surfaces'
local Roles = require 'maps.pirates.roles.roles'
local Event = require 'utils.event'
local CustomEvents = require 'maps.pirates.custom_events'
local ComfyPanel = require 'comfy_panel.main'
local Public = {}
local enum = {
PROGRESS = 'progress',
RUNS = 'runs',
CREW = 'crew',
FUEL = 'fuel',
MINIMAP = 'minimap',
INFO = 'info',
COLOR = 'color',
}
Public.enum = enum
Public.progress = require 'maps.pirates.gui.progress'
Public.runs = require 'maps.pirates.gui.runs'
Public.crew = require 'maps.pirates.gui.crew'
Public.fuel = require 'maps.pirates.gui.shop'
Public.fuel = require 'maps.pirates.gui.fuel'
Public.minimap = require 'maps.pirates.gui.minimap'
Public.info = require 'maps.pirates.gui.info'
Public.color = require 'maps.pirates.gui.color'
function Public.update_crew_gui(which_gui)
local players = Common.crew_get_crew_members_and_spectators()
for _, player in pairs(players) do
Public[which_gui].full_update(player)
end
end
function Public.update_crew_progress_gui()
return Public.update_crew_gui('progress')
end
Event.add(CustomEvents.enum['update_crew_progress_gui'], Public.update_crew_progress_gui)
-- script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
function Public.update_crew_fuel_gui()
return Public.update_crew_gui('fuel')
end
Event.add(CustomEvents.enum['update_crew_fuel_gui'], Public.update_crew_fuel_gui)
local function create_gui(player)
@ -362,7 +390,6 @@ local function create_gui(player)
type = 'label',
})
flow3.style.font = 'default-large-semibold'
flow3.style.font_color = GuiCommon.bold_font_color
flow3.style.right_margin = 2
flow3 = flow2.add({
@ -479,13 +506,13 @@ function Public.update_gui(player)
end
end
GuiEvo.update(player)
GuiProgress.update(player)
GuiRuns.update(player)
GuiCrew.update(player)
GuiShop.update(player)
GuiMinimap.update(player)
GuiInfo.update(player)
GuiEvo.regular_update(player)
GuiProgress.regular_update(player) --moved to event
GuiRuns.regular_update(player)
GuiCrew.regular_update(player)
GuiFuel.regular_update(player)
GuiMinimap.regular_update(player)
GuiInfo.regular_update(player)
-- local lives = memory.lives or 1
-- local button = pirates_flow.lives_piratebutton_frame.lives_piratebutton
@ -500,9 +527,9 @@ function Public.update_gui(player)
-- button.number = 3
-- end
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))/50, 1),0)
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton_flow_2.fuel_label_1.caption = 'Fuel: ' .. Utils.bignumber_abbrevform(memory.stored_fuel or 0) .. '[item=coal]'
pirates_flow.fuel_piratebutton_flow_1.fuel_piratebutton_flow_2.fuel_label_2.caption = Utils.negative_rate_abbrevform(memory.fuel_depletion_rate_memoized or 0)
local color_scale = Math.max(Math.min((- (memory.fuel_depletion_rate_memoized or 0))/50, 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,
@ -520,41 +547,55 @@ function Public.update_gui(player)
--== State-checking bools ==--
local in_crowsnest_bool = string.sub(player.surface.name, 9, 17) == 'Crowsnest'
local in_hold_bool = string.sub(player.surface.name, 9, 12) == 'Hold'
local in_cabin_bool = string.sub(player.surface.name, 9, 13) == 'Cabin'
local onmap_bool = destination.surface_name and (player.surface.name == destination.surface_name or (memory.boat and memory.boat.surface_name and
local in_crowsnest_bool, in_hold_bool, in_cabin_bool, onmap_bool, eta_bool, retreating_bool, approaching_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, approaching_dock_bool, leaving_dock_bool, leave_anytime_bool
captain_bool = Common.is_captain(player)
in_crowsnest_bool = string.sub(player.surface.name, 9, 17) == 'Crowsnest'
in_hold_bool = string.sub(player.surface.name, 9, 12) == 'Hold'
in_cabin_bool = string.sub(player.surface.name, 9, 13) == 'Cabin'
if destination and destination.dynamic_data then
eta_bool = destination.dynamic_data.time_remaining and destination.dynamic_data.time_remaining > 0 and onmap_bool
retreating_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.RETREATING and onmap_bool
approaching_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.APPROACHING
atsea_sailing_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.ATSEA_SAILING
landed_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.LANDED
quest_bool = (destination.dynamic_data.quest_type ~= nil) and onmap_bool
silo_bool = destination.dynamic_data.rocketsilos and destination.dynamic_data.rocketsilos[1] and destination.dynamic_data.rocketsilos[1].valid and onmap_bool
charged_bool = destination.dynamic_data.silocharged
launched_bool = destination.dynamic_data.rocketlaunched
cost_bool = destination.static_params.cost_to_leave and (not atsea_sailing_bool) and (not retreating_bool)
cost_includes_rocket_launch = cost_bool and destination.static_params.cost_to_leave['launch_rocket']
leave_anytime_bool = (landed_bool and not (eta_bool or cost_bool))
end
if memory.boat then
onmap_bool = destination.surface_name and (player.surface.name == destination.surface_name or (
memory.boat.surface_name == destination.surface_name and (in_crowsnest_bool or in_hold_bool or in_cabin_bool)
))
local eta_bool = destination.dynamic_data.time_remaining and destination.dynamic_data.time_remaining > 0 and onmap_bool
local retreating_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.RETREATING and onmap_bool
local approaching_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.APPROACHING
local atsea_sailing_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.ATSEA_SAILING
local landed_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.LANDED
local quest_bool = (destination.dynamic_data.quest_type ~= nil) and onmap_bool
local silo_bool = destination.dynamic_data.rocketsilos and destination.dynamic_data.rocketsilos[1] and destination.dynamic_data.rocketsilos[1].valid and onmap_bool
local charged_bool = destination.dynamic_data.silocharged
local launched_bool = destination.dynamic_data.rocketlaunched
atsea_loading_bool = memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP and memory.loadingticks
local captain_bool = Common.is_captain(player)
character_on_deck_bool = player.character and player.character.position and player.surface.name and player.surface.name == memory.boat.surface_name
local atsea_loading_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP and memory.loadingticks
if character_on_deck_bool then
local BoatData = Boats.get_scope(memory.boat).Data
local character_on_deck_bool = player.character and player.character.position and memory.boat and memory.boat.position and memory.boat.surface_name and player.surface.name and player.surface.name == memory.boat.surface_name
on_deck_standing_near_loco_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.loco_pos)) < 3
local on_deck_standing_near_loco_bool = character_on_deck_bool and Boats.get_scope(memory.boat) and Math.distance(player.character.position, Math.vector_sum(memory.boat.position, Boats.get_scope(memory.boat).Data.loco_pos)) < 3
local on_deck_standing_near_cabin_bool = character_on_deck_bool and Boats.get_scope(memory.boat) and Math.distance(player.character.position, Math.vector_sum(memory.boat.position, Boats.get_scope(memory.boat).Data.cabin_car)) < 2.5
local on_deck_standing_near_crowsnest_bool = character_on_deck_bool and Boats.get_scope(memory.boat) and Math.distance(player.character.position, Math.vector_sum(memory.boat.position, Boats.get_scope(memory.boat).Data.crowsnest_center)) < 2.7
on_deck_standing_near_cabin_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.cabin_car)) < 2.5
local cost_bool = destination.static_params.cost_to_leave and (not atsea_sailing_bool) and (not retreating_bool)
local cost_includes_rocket_launch = cost_bool and destination.static_params.cost_to_leave['launch_rocket']
on_deck_standing_near_crowsnest_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.crowsnest_center)) < 2.7
end
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))
approaching_dock_bool = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.APPROACHING
leaving_dock_bool = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.LEAVING_DOCK
end
--== Update Gui ==--
@ -813,11 +854,11 @@ function Public.update_gui(player)
flow1.silo_label_3.visible = true
-- flow1.silo_label_1.caption = string.format('[achievement=there-is-no-spoon]: +%.0f[item=sulfur]', destination.dynamic_data.rocketcoalreward)
flow1.silo_label_1.caption = string.format('Launched')
flow1.silo_label_1.caption = string.format('Launched:')
-- flow1.silo_label_1.caption = string.format('Launched for %.0f[item=coal] , ' .. Balance.rocket_launch_coin_reward .. '[item=coin]', destination.dynamic_data.rocketcoalreward)
flow1.silo_label_1.style.font_color = GuiCommon.achieved_font_color
flow1.silo_label_3.caption = 'for ' .. Math.floor(destination.dynamic_data.rocketcoalreward/100)/10 .. 'k[item=coal], ' .. Math.floor(Balance.rocket_launch_coin_reward/100)/10 .. 'k[item=coin]'
flow1.silo_label_3.caption = Math.floor(destination.dynamic_data.rocketcoalreward/100)/10 .. 'k[item=coal], ' .. Math.floor(Balance.rocket_launch_coin_reward/100)/10 .. 'k[item=coin]'
local tooltip = 'The rocket has launched, and this is the reward.'
flow1.tooltip = tooltip
@ -896,6 +937,7 @@ function Public.update_gui(player)
if quest_complete then
tooltip = 'The quest is complete, and this is the reward.'
flow1.quest_label_1.caption = 'Quest:'
flow1.quest_label_1.style.font_color = GuiCommon.achieved_font_color
flow1.quest_label_2.visible = true
flow1.quest_label_3.visible = false
flow1.quest_label_4.visible = false
@ -903,6 +945,7 @@ function Public.update_gui(player)
else
if quest_progress < quest_progressneeded then
flow1.quest_label_1.caption = 'Quest:'
flow1.quest_label_1.style.font_color = GuiCommon.bold_font_color
flow1.quest_label_2.visible = true
flow1.quest_label_3.visible = true
flow1.quest_label_4.visible = true
@ -1097,15 +1140,15 @@ local function on_gui_click(event)
local name = string.sub(event.element.name, 1, -14)
if Public[name] then
Public[name].toggle_window(player)
Public[name].update(player)
Public[name].full_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)
-- Public.fuel.full_update(player)
else
GuiRuns.click(event)
GuiCrew.click(event)
GuiShop.click(event)
GuiFuel.click(event)
GuiMinimap.click(event)
GuiInfo.click(event)
end
@ -1122,6 +1165,9 @@ local function on_gui_location_changed(event)
end
end
local event = require 'utils.event'
event.add(defines.events.on_gui_click, on_gui_click)
event.add(defines.events.on_gui_location_changed, on_gui_location_changed)

View File

@ -206,7 +206,13 @@ function Public.click(event)
end
end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
if not player.gui.screen[window_name .. '_piratewindow'] then return end
local flow = player.gui.screen[window_name .. '_piratewindow']

View File

@ -114,7 +114,11 @@ end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
local flow, flow2, flow3, flow4, flow5, flow6
local memory = Memory.get_crew_memory()

View File

@ -48,22 +48,22 @@ function Public.toggle_window(player)
-- flow3.style.maximal_width = 160
-- flow3.style.font = 'default-dropdown'
flow3 = flow2.add({type = 'label', name = 'hidden_ores_yes', caption = 'Ores detected:'})
-- flow3 = flow2.add({type = 'label', name = 'hidden_ores_yes', caption = 'Ores detected:'})
flow3 = flow2.add({type = 'table', name = 'hidden_ores_yes_table', column_count = 3})
flow3.style.left_margin = 5
flow3.style.bottom_margin = 4
-- flow3 = flow2.add({type = 'table', name = 'hidden_ores_yes_table', column_count = 3})
-- flow3.style.left_margin = 5
-- flow3.style.bottom_margin = 4
for _, ore in ipairs(CoreData.ore_types) do
flow3.add({type = 'sprite-button', name = ore.name, sprite = ore.sprite_name, enabled = false, number = 0})
end
-- for _, ore in ipairs(CoreData.ore_types) do
-- flow3.add({type = 'sprite-button', name = ore.name, sprite = ore.sprite_name, enabled = false, number = 0})
-- end
flow3 = flow2.add({type = 'label', name = 'hidden_ores_no', caption = 'Ores detected: None'})
-- flow3 = flow2.add({type = 'label', name = 'hidden_ores_no', caption = 'Ores detected: None'})
-- flow3 = flow2.add({type = 'label', name = 'daynight', caption = ''})
-- -- flow3 = flow2.add({type = 'label', name = 'daynight', caption = ''})
flow3 = flow2.add({type = 'label', name = 'patch_size', caption = ''})
flow3.style.top_margin = -3
-- flow3 = flow2.add({type = 'label', name = 'patch_size', caption = ''})
-- flow3.style.top_margin = -3
flow3 = flow2.add({type = 'label', name = 'daynight', caption = ''})
flow3.style.top_margin = -3
@ -83,7 +83,11 @@ function Public.toggle_window(player)
end
function Public.update(player)
function Public.regular_update(player)
end
function Public.full_update(player)
if not player.gui.screen[window_name .. '_piratewindow'] then return end
local flow = player.gui.screen[window_name .. '_piratewindow']
@ -113,21 +117,21 @@ function Public.update(player)
-- end
-- flow.current_location.body.daynight.caption = string.format('Day/night cycle: %s', CoreData.daynightcycle_types[daynighttype].displayname)
if destination.static_params and destination.static_params.radius_squared_modifier then
local radius_squared_modifier = destination.static_params.radius_squared_modifier
flow.current_location.body.patch_size.visible = true
if radius_squared_modifier <= 0.65 then
flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Nano'
elseif radius_squared_modifier <= 0.85 then
flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Small'
elseif radius_squared_modifier <= 1.5 then
flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Normal'
else
flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Large'
end
else
flow.current_location.body.patch_size.visible = false
end
-- if destination.static_params and destination.static_params.radius_squared_modifier then
-- local radius_squared_modifier = destination.static_params.radius_squared_modifier
-- flow.current_location.body.patch_size.visible = true
-- if radius_squared_modifier <= 0.65 then
-- flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Nano'
-- elseif radius_squared_modifier <= 0.85 then
-- flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Small'
-- elseif radius_squared_modifier <= 1.5 then
-- flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Normal'
-- else
-- flow.current_location.body.patch_size.caption = 'Patch sizing: ' .. 'Large'
-- end
-- else
-- flow.current_location.body.patch_size.visible = false
-- end
-- if destination.static_params and destination.static_params.daynightcycletype then
-- flow.current_location.body.daynight.visible = true
@ -141,29 +145,29 @@ function Public.update(player)
flow.current_location.body.daynight.caption = 'Time of day: ' .. CoreData.daynightcycle_types[daynightcycletype].displayname
local ores
-- if destination.static_params and destination.static_params.abstract_ore_amounts then ores = destination.static_params.abstract_ore_amounts end
if destination.dynamic_data and destination.dynamic_data.hidden_ore_remaining_abstract then ores = destination.dynamic_data.hidden_ore_remaining_abstract end
-- local ores
-- -- if destination.static_params and destination.static_params.abstract_ore_amounts then ores = destination.static_params.abstract_ore_amounts end
-- if destination.dynamic_data and destination.dynamic_data.hidden_ore_remaining_abstract then ores = destination.dynamic_data.hidden_ore_remaining_abstract end
if ores then
flow.current_location.body.hidden_ores_yes.visible = true
flow.current_location.body.hidden_ores_yes_table.visible = true
flow.current_location.body.patch_size.visible = true
flow.current_location.body.hidden_ores_no.visible = false
-- if ores then
-- flow.current_location.body.hidden_ores_yes.visible = true
-- flow.current_location.body.hidden_ores_yes_table.visible = true
-- flow.current_location.body.patch_size.visible = true
-- flow.current_location.body.hidden_ores_no.visible = false
for _, ore in ipairs(CoreData.ore_types) do
if ores[ore.name] then
flow.current_location.body.hidden_ores_yes_table[ore.name].number = Math.ceil(ores[ore.name])
else
flow.current_location.body.hidden_ores_yes_table[ore.name].number = 0
end
end
else
flow.current_location.body.hidden_ores_yes.visible = false
flow.current_location.body.hidden_ores_yes_table.visible = false
flow.current_location.body.patch_size.visible = false
flow.current_location.body.hidden_ores_no.visible = true
end
-- for _, ore in ipairs(CoreData.ore_types) do
-- if ores[ore.name] then
-- flow.current_location.body.hidden_ores_yes_table[ore.name].number = Math.ceil(ores[ore.name])
-- else
-- flow.current_location.body.hidden_ores_yes_table[ore.name].number = 0
-- end
-- end
-- else
-- flow.current_location.body.hidden_ores_yes.visible = false
-- flow.current_location.body.hidden_ores_yes_table.visible = false
-- flow.current_location.body.patch_size.visible = false
-- flow.current_location.body.hidden_ores_no.visible = true
-- end
end

View File

@ -402,8 +402,12 @@ end
function Public.regular_update(player)
function Public.update(player)
end
function Public.full_update(player)
local global_memory = Memory.get_global_memory()
local memory = Memory.get_crew_memory()

View File

@ -204,8 +204,8 @@ local function kraken_damage(event)
if event.damage_type.name and (event.damage_type.name == 'explosion' or event.damage_type.name == 'poison') then
-- if event.cause.name == 'artillery-turret' then
adjusted_damage = adjusted_damage / 2.5
elseif event.damage_type.name and (event.damage_type.name == 'fire') then
adjusted_damage = adjusted_damage / 1.1
-- elseif event.damage_type.name and (event.damage_type.name == 'fire') then
-- adjusted_damage = adjusted_damage
end
-- and additionally:
if event.cause.name == 'artillery-turret' then
@ -253,8 +253,8 @@ local function extra_damage_to_players(event)
local inv = event.entity.get_inventory(defines.inventory.character_main)
if not (inv and inv.valid) then return end
local count = inv.get_item_count('iron-ore')
if count and count >= 2500 then
event.entity.health = event.entity.health + event.final_damage_amount * 0.8
if count and count >= 3500 then
event.entity.health = event.entity.health + event.final_damage_amount * 0.87
end
end --samurai health buff is elsewhere
end
@ -781,7 +781,7 @@ local function base_kill_rewards(event)
local iron_amount = 0
local coin_amount = 0
if memory.overworldx > 0 then
if memory.overworldx >= 0 then
if entity.name == 'small-worm-turret' then
iron_amount = 5
coin_amount = 40
@ -1530,19 +1530,19 @@ local remove_boost_movement_speed_on_respawn =
function(data)
local player = data.player
local crew_id = data.crew_id
if not (player and player.valid and player.character and player.character.valid) then
if not (player and player.valid) then
return
end
-- their color was strobing, so now reset it to their chat color:
player.color = player.chat_color
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.game_lost then return end
memory.speed_boost_characters[player.index] = nil
-- their color was strobing, so now reset it to their chat color:
player.color = player.chat_color
Common.notify_player_expected(player, 'Respawn speed bonus removed.')
end
)
@ -1556,9 +1556,6 @@ local boost_movement_speed_on_respawn =
if not player or not player.valid then
return
end
if not player.character or not player.character.valid and player.character and player.character.valid then
return
end
Memory.set_working_id(crew_id)
local memory = Memory.get_crew_memory()

View File

@ -103,9 +103,9 @@ Public.chest_loot_data_raw = {
{4, 0, 2, true, 'electric-furnace', 1, 3},
{3, 0.2, 1, true, 'chemical-plant', 1, 3},
{40, -1, 0.5, true, 'speed-module', 1, 3},
{20, 0, 1.5, true, 'speed-module-2', 1, 2},
{10, 0, 2, true, 'speed-module-3', 1, 1},
{50, -1, 0.5, true, 'speed-module', 1, 3},
{25, 0, 1.5, true, 'speed-module-2', 1, 2},
{12, 0, 2, true, 'speed-module-3', 1, 1},
{4, -1, 1, true, 'effectivity-module', 1, 3},
-- {4, 0, 1, true, 'effectivity-module-2', 1, 3}, --disabled to reduce 'avalanche of crap' effect
{4, 0, 2, true, 'effectivity-module-3', 1, 1},
@ -314,12 +314,12 @@ function Public.maze_camp_loot()
end
Public.maze_lab_loot_data_raw = {
{8, -0.5, 0.5, true, 'automation-science-pack', 5, 18},
{8, -0.6, 0.6, true, 'logistic-science-pack', 5, 18},
{6, -0.1, 1, true, 'military-science-pack', 5, 15},
{6, -0.5, 1.5, true, 'chemical-science-pack', 4, 10},
{6, 0, 1.5, true, 'production-science-pack', 3, 9},
{2, 0, 2, true, 'utility-science-pack', 2, 2},
{8, -0.5, 0.5, true, 'automation-science-pack', 5, 20},
{8, -0.6, 0.6, true, 'logistic-science-pack', 5, 20},
{6, -0.1, 1, true, 'military-science-pack', 5, 18},
{6, -0.5, 1.5, true, 'chemical-science-pack', 4, 12},
{6, 0, 1.5, true, 'production-science-pack', 3, 11},
{2, 0, 2, true, 'utility-science-pack', 2, 3},
-- {4, 0.4, 1.5, true, 'utility-science-pack', 16, 32},
-- {10, 0.5, 1.5, true, 'space-science-pack', 16, 32},
}

View File

@ -18,6 +18,8 @@ The scenario is quite complex, but there are ways to get started, even if you do
require 'modules.biter_noms_you'
require 'modules.no_deconstruction_of_neutral_entities'
local CustomEvents = require 'maps.pirates.custom_events' --it might be necessary to do this before anything
local Server = require 'utils.server'
local inspect = require 'utils.inspect'.inspect
-- local Modifers = require 'player_modifiers'
@ -204,8 +206,8 @@ local function crew_tick()
TickFunctions.update_boat_stored_resources(10)
end
if tick % 15 == 0 then
TickFunctions.covered_requirement_check(15)
if tick % 10 == 0 then
TickFunctions.covered_requirement_check(10)
end
if tick % 30 == 0 then
@ -271,8 +273,6 @@ local function crew_tick()
end
end
if tick % 240 == 0 then
TickFunctions.Kraken_Destroyed_Backup_check(240)
end

View File

@ -40,7 +40,9 @@ end
function Public.reset_crew_memory(id) --also serves as a dev reference of memory entries
function Public.reset_crew_memory(id) --mostly serves as a dev reference of memory entries
-- but not _everything_ is stored here, it's just a guide to the most important things
pirates_global_memory.crew_memories[id] = {}
local memory = pirates_global_memory.crew_memories[id]
@ -109,7 +111,7 @@ function Public.reset_crew_memory(id) --also serves as a dev reference of memory
memory.floating_pollution = nil
end
function Public.fallthrough_crew_memory() --could make this a metatable
function Public.fallthrough_crew_memory() --could make this a metatable, but metatables and factorio global seem not to play nicely
return {
id = 0,
difficulty = 1,

View File

@ -7,6 +7,8 @@ local inspect = require 'utils.inspect'.inspect
local Common = require 'maps.pirates.common'
local Utils = require 'maps.pirates.utils_local'
local simplex_noise = require 'utils.simplex_noise'.d2
local CustomEvents = require 'maps.pirates.custom_events'
local Public = {}
@ -20,6 +22,8 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus)
local destination = Common.current_destination()
local choices = destination.dynamic_data.hidden_ore_remaining_abstract
local ret = false
if choices and Utils.length(choices) > 0 then
local choices_possible = {}
local choices_to_prioitise = {}
@ -59,7 +63,7 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus)
if placed > 0 and not destination.dynamic_data.ore_types_spawned[choice] then
destination.dynamic_data.ore_types_spawned[choice] = true
end
return true
ret = true
end
else
local real_amount = Math.max(Common.minimum_ore_placed_per_tile, Common.ore_abstract_to_real(choices[choice]))
@ -79,13 +83,15 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus)
if placed > 0 and not destination.dynamic_data.ore_types_spawned[choice] then
destination.dynamic_data.ore_types_spawned[choice] = true
end
return true
ret = true
end
end
end
end
return false
-- script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
return ret
end

View File

@ -28,6 +28,7 @@ local Shop = require 'maps.pirates.shop.shop'
local Upgrades = require 'maps.pirates.boat_upgrades'
local Kraken = require 'maps.pirates.surfaces.sea.kraken'
local Highscore = require 'maps.pirates.highscore'
local CustomEvents = require 'maps.pirates.custom_events'
local infront_positions = {}
@ -106,6 +107,9 @@ function Public.generate_overworld_destination(p)
elseif (macrop.x > 25 and (macrop.x - 22) % 18 == 14) then --we want this to overwrite dock, so putting it here
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.WALKWAYS
elseif macrop.x == 23 then --overwrite dock. rocket launch cost
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.MAZE
elseif macrop.y == -1 and (((macrop.x % 4) == 3 and macrop.x ~= 15) or macrop.x == 14) then --avoid x=15 because radioactive is there
type = Surfaces.enum.DOCK
elseif macrop.x == 5 then --biter boats appear. large island works well so players run off
@ -144,9 +148,6 @@ function Public.generate_overworld_destination(p)
subtype = Surfaces.Island.enum.SWAMP
elseif macrop.x == 22 then --game length decrease, pending more content. also kinda fun to have to steer in realtime due to double space
type = nil
elseif macrop.x == 23 then --rocket launch cost
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.MAZE
elseif macrop.x == 24 then --rocket launch cost
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.WALKWAYS
@ -310,9 +311,9 @@ function Public.generate_overworld_destination(p)
end
static_params.abstract_ore_amounts = abstract_ore_amounts
static_params.radius_squared_modifier = (1 + 1 * Math.random())^2
static_params.radius_squared_modifier = (2 + 2 * Math.random())
if macrop.x == 0 then static_params.radius_squared_modifier = 1 end
if macrop.x == 0 then static_params.radius_squared_modifier = 2 end
static_params.discord_emoji = scope.Data.discord_emoji
@ -572,6 +573,8 @@ function Public.check_for_destination_collisions()
memory.currentdestination_index = index
memory.boat.state = Boats.enum_state.ATSEA_LOADING_MAP
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
local destination = Common.current_destination()
Surfaces.destination_on_collide(destination)

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ local Common = require 'maps.pirates.common'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
local inspect = require 'utils.inspect'.inspect
local CustomEvents = require 'maps.pirates.custom_events'
local Structures = require 'maps.pirates.structures.structures'
local Boats = require 'maps.pirates.structures.boats.boats'
@ -229,6 +230,8 @@ function Public.progress_to_destination(destination_index)
end
end
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
-- Delay.add(Delay.enum.PLACE_DOCK_JETTY_AND_BOATS)
Task.set_timeout_in_ticks(2, place_dock_jetty_and_boats, {crew_id = memory.id})
else
@ -268,9 +271,11 @@ function Public.progress_to_destination(destination_index)
memory.destinationsvisited_indices[#memory.destinationsvisited_indices + 1] = destination_index
memory.currentdestination_index = destination_index
memory.currentdestination_index = destination_index --already done when we collide with it typically
local destination = Common.current_destination()
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
destination.dynamic_data.timer = 0
destination.dynamic_data.timeratlandingtime = nil
@ -389,6 +394,8 @@ function Public.check_for_end_of_boat_movement(boat)
memory.mainshop_availability_bools.unlock_merchants = false
memory.mainshop_availability_bools.rockets_for_sale = false
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
Public.go_from_currentdestination_to_sea()
return true
@ -498,6 +505,8 @@ function Public.undock_from_dock(manual)
memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
Crew.summon_crew()
local force = memory.force
@ -549,10 +558,6 @@ function Public.go_from_currentdestination_to_sea()
memory.enemy_force.reset_evolution()
local base_evo = Balance.base_evolution()
Common.set_evo(base_evo)
destination.dynamic_data.evolution_accrued_leagues = base_evo
destination.dynamic_data.evolution_accrued_time = 0
destination.dynamic_data.evolution_accrued_nests = 0
destination.dynamic_data.evolution_accrued_silo = 0
memory.kraken_evo = 0
memory.loadingticks = nil

View File

@ -38,13 +38,13 @@ function Public.quest_reward()
local rng = Math.random()
if rng <= 0.3 then
ret = {name = 'iron-plate', count = Math.ceil(2000 * multiplier), display_sprite = '[item=iron-plate]', display_amount = string.format('%.0fk', 2 * multiplier)}
ret = {name = 'iron-plate', count = Math.ceil(2000 * multiplier), display_sprite = '[item=iron-plate]', display_amount = string.format('%.1fk', 2 * multiplier)}
elseif rng <= 0.5 then
ret = {name = 'copper-plate', count = Math.ceil(2000 * multiplier), display_sprite = '[item=copper-plate]', display_amount = string.format('%.0fk', 2 * multiplier)}
ret = {name = 'copper-plate', count = Math.ceil(2000 * multiplier), display_sprite = '[item=copper-plate]', display_amount = string.format('%.1fk', 2 * multiplier)}
elseif rng <= 0.7 then
ret = {name = 'solid-fuel', count = Math.ceil(450 * multiplier), display_sprite = '[item=solid-fuel]', display_amount = string.format('%.0f', Math.ceil(450 * multiplier))}
elseif rng <= 0.9 then
ret = {name = 'coin', count = Math.ceil(6000 * (multiplier^(1/2))), display_sprite = '[item=coin]', display_amount = string.format('%.0fk', Math.ceil(6 * (multiplier^(1/2))))}
ret = {name = 'coin', count = Math.ceil(6000 * (multiplier^(1/2))), display_sprite = '[item=coin]', display_amount = string.format('%.1fk', Math.ceil(6 * (multiplier^(1/2))))}
else
ret = {name = 'piercing-rounds-magazine', count = Math.ceil(250 * multiplier), display_sprite = '[item=piercing-rounds-magazine]', display_amount = string.format('%.0f', Math.ceil(250 * multiplier))}
end

View File

@ -86,10 +86,10 @@ Public.explanation = {
[enum.WOOD_LORD] = 'They find many more resources when chopping trees.',
[enum.CHIEF_EXCAVATOR] = 'They find many more resources when handmining ore.',
[enum.HATAMOTO] = 'They are very tough, and *with no weapon equipped* fight well by melee, but poorly otherwise.',
[enum.IRON_LEG] = 'They are very resistant to damage when carrying 2500 iron ore.',
[enum.IRON_LEG] = 'They are very resistant to damage when carrying 3500 iron ore.',
[enum.QUARTERMASTER] = 'They give nearby crewmates extra physical attack, and generate ore for the captain\'s cabin for each one.',
[enum.DREDGER] = 'They find surprising items when they fish.',
[enum.SMOLDERING] = 'They periodically convert wood into coal, if they have less than 25 coal.',
[enum.SMOLDERING] = 'They periodically convert wood into coal, if they have less than 50 coal.',
[enum.GOURMET] = 'They generate ore for the captain\'s cabin by eating fish in fancy locations.',
}
@ -201,7 +201,7 @@ function Public.class_ore_grant(player, how_much, disable_scaling)
else
count = Math.ceil(how_much * Balance.class_resource_scale())
end
if Math.random(3) == 1 then
if Math.random(4) == 1 then
Common.flying_text_small(player.surface, player.position, '[color=0.85,0.58,0.37]+' .. count .. '[/color]')
Common.give_items_to_crew{{name = 'copper-ore', count = count}}
else

View File

@ -12,6 +12,7 @@ local Hold = require 'maps.pirates.surfaces.hold'
local Crew = require 'maps.pirates.crew'
local Boats = require 'maps.pirates.structures.boats.boats'
local Dock = require 'maps.pirates.surfaces.dock'
local CustomEvents = require 'maps.pirates.custom_events'
local Public = {}
@ -137,6 +138,8 @@ function Public.initialise_captains_shop()
-- buy_fast_loader = true,
-- sell_copper = false,
}
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
end
function Public.main_shop_try_purchase(player, purchase_name)
@ -301,6 +304,7 @@ function Public.main_shop_try_purchase(player, purchase_name)
end
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
-- memory.mainshop_rate_limit_ticker = Common.mainshop_rate_limit_ticks
else

View File

@ -25,8 +25,8 @@ Public.market_barters = {
--repeating these:
{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}},
{price = {{'steel-plate', 50}}, offer = {type = 'give-item', item = 'copper-plate', count = 500}},
{price = {{'steel-plate', 50}}, offer = {type = 'give-item', item = 'iron-plate', count = 500}},
{price = {{'steel-plate', 40}}, offer = {type = 'give-item', item = 'copper-plate', count = 500}},
{price = {{'steel-plate', 40}}, offer = {type = 'give-item', item = 'iron-plate', count = 500}},
{price = {{'raw-fish', 50}}, offer = {type = 'give-item', item = 'coal', count = 500}},
{price = {{'raw-fish', 50}}, offer = {type = 'give-item', item = 'iron-plate', count = 750}},
{price = {{'raw-fish', 50}}, offer = {type = 'give-item', item = 'copper-plate', count = 750}},
@ -52,9 +52,9 @@ Public.market_sales = {
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine', count = 30}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 50}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'raw-fish', count = 300}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'laser-turret', count = 2}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'laser-turret', count = 1}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'vehicle-machine-gun', count = 3}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'substation', count = 6}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'substation', count = 5}},
{price = {{'coin', 3000}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'distractor-capsule', count = 20}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'poison-capsule', count = 20}},

View File

@ -96,7 +96,7 @@ function Public.event_on_market_item_purchased(event)
if required_class then
if not (memory.classes_table and memory.classes_table[player.index] and memory.classes_table[player.index] == required_class) then
ok = false
Common.notify_force_error(force, string.format('Class purchase error: you need to be a %s to buy this.', Classes.display_form[required_class]))
Common.notify_force_error(force, string.format('Class purchase error: You need to be a %s to buy this.', Classes.display_form[required_class]))
end
end

View File

@ -291,7 +291,6 @@ function Public.place_boat(boat, floor_tile, place_entities_bool, correct_tiles,
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
if i == 1 then
boat.upstairs_pole = e
Public.try_connect_upstairs_and_downstairs_poles(boat)

View File

@ -168,15 +168,15 @@ Public.maze_defended_camp = {
force = 'ancient-hostile',
offset = {x = 0, y = 0},
count = 30,
large_r = 9,
small_r = 6,
large_r = 10,
small_r = 7,
},
{
type = 'entities_randomlyplaced',
name = 'wooden-chest',
force = 'ancient-friendly',
offset = {x = 0, y = 0},
count = 12,
count = 13,
r = 5,
},
},
@ -194,15 +194,15 @@ Public.maze_undefended_camp = {
force = 'ancient-hostile',
offset = {x = 0, y = 0},
count = 10,
large_r = 9,
small_r = 6,
large_r = 10,
small_r = 7,
},
{
type = 'entities_randomlyplaced',
name = 'wooden-chest',
force = 'ancient-friendly',
offset = {x = 0, y = 0},
count = 6,
count = 7,
r = 5,
},
},

View File

@ -174,7 +174,7 @@ function Public.create_cabin_surface()
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
-- e.operable = false
boat.output_chest = e
end
@ -184,7 +184,7 @@ function Public.create_cabin_surface()
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
-- e.operable = false
boat.backup_output_chest = e
end

View File

@ -5,6 +5,7 @@ local Common = require 'maps.pirates.common'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
local Math = require 'maps.pirates.math'
local CustomEvents = require 'maps.pirates.custom_events'
local inspect = require 'utils.inspect'.inspect
local Token = require 'utils.token'
@ -117,6 +118,8 @@ function Public.move_crowsnest(vectorx, vectory)
-- crew_force.clear_chart(surface)
crew_force.chart(surface, area)
end
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
end

View File

@ -10,6 +10,7 @@ local Cabin = require 'maps.pirates.surfaces.cabin'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
local inspect = require 'utils.inspect'.inspect
local CustomEvents = require 'maps.pirates.custom_events'
local Public = {}
@ -72,6 +73,8 @@ function Public.execute_boat_purchase()
memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
memory.mainshop_availability_bools.new_boat_cutter = false
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
end

View File

@ -172,7 +172,6 @@ function Public.create_hold_surface(nth)
e.destructible = false
e.minable = false
e.rotatable = false
e.operable = false
boat.downstairs_poles[nth][i] = e
end
end

View File

@ -23,7 +23,7 @@ function Public.base_ores()
return {
['copper-ore'] = 3.5,
['iron-ore'] = 6.5,
['coal'] = 4.4,
['coal'] = 4.0,
['stone'] = 2.0,
['crude-oil'] = 15,
}

View File

@ -139,8 +139,8 @@ local free_labyrinth_cell_raffle = {
maze_defended_camp = 1,
maze_undefended_camp = 0.25,
maze_worms = 0.8,
small_abandoned_refinery = 0.1,
small_roboport_base = 0.1,
small_abandoned_refinery = 0.05,
small_roboport_base = 0.05,
maze_belts_1 = 0.2,
maze_belts_2 = 0.2,
maze_belts_3 = 0.2,

View File

@ -25,7 +25,7 @@ function Public.base_ores()
return {
['copper-ore'] = 0.4,
['iron-ore'] = 5.7,
['coal'] = 4.4,
['coal'] = 4,
['stone'] = 0.6,
}
end

View File

@ -23,9 +23,9 @@ Public.static_params_default = {
function Public.base_ores()
return {
['copper-ore'] = 3.8,
['iron-ore'] = 4.0,
['coal'] = 4.5,
['copper-ore'] = 3.0,
['iron-ore'] = 4.9,
['coal'] = 4,
['stone'] = 1.6,
}
end

View File

@ -22,9 +22,9 @@ Public.static_params_default = {
function Public.base_ores()
return {
['copper-ore'] = 1.4,
['iron-ore'] = 2.6,
['coal'] = 6.8,
['copper-ore'] = 1.8,
['iron-ore'] = 3.8,
['coal'] = 5.5,
['stone'] = 0.5,
['crude-oil'] = 50,
}

View File

@ -203,6 +203,8 @@ function Public.destination_on_collide(destination)
times = {1, 5, 10, 15, 20, 25}
elseif playercount <= 15 then
times = {1, 5, 10, 15, 20, 25, 30}
elseif playercount <= 21 then
times = {1, 5, 10, 15, 20, 25, 30, 35}
else
times = {1, 5, 10, 15, 20, 25, 30, 35, 40}
end

View File

@ -38,7 +38,7 @@ function Public.strobe_player_colors(tickinterval)
local strobing_players = memory.speed_boost_characters
if strobing_players and #strobing_players > 0 then
if #strobing_players > 0 then
local col = Utils.rgb_from_hsv((game.tick*6) % 360, 0.7, 0.9)
for index, val in pairs(strobing_players) do
if val then
@ -69,7 +69,7 @@ function Public.prevent_unbarreling_off_ship(tickinterval)
local r = a.get_recipe()
if r and r.subgroup and r.subgroup.name and r.subgroup.name == 'fill-barrel' and (not (r.name and r.name == 'fill-water-barrel')) then
if not Boats.on_boat(boat, a.position) then
Common.notify_force_error(memory.force, 'Recipe error: barrels are too heavy to carry back to the ship. Try another way.')
Common.notify_force_error(memory.force, 'Recipe error: Barrels are too heavy to carry back to the ship. Try another way.')
a.set_recipe('fill-water-barrel')
end
end
@ -163,6 +163,8 @@ function Public.ship_deplete_fuel(tickinterval)
local rate = Progression.fuel_depletion_rate()
memory.fuel_depletion_rate_memoized = rate
local boat = memory.boat
local input_chests = boat.input_chests
@ -198,7 +200,6 @@ function Public.transfer_pollution(tickinterval)
end
function Public.shop_ratelimit_tick(tickinterval)
local memory = Memory.get_crew_memory()
-- if memory.mainshop_rate_limit_ticker and memory.mainshop_rate_limit_ticker > 0 then
-- memory.mainshop_rate_limit_ticker = memory.mainshop_rate_limit_ticker - tickinterval
@ -283,7 +284,6 @@ function Public.periodic_free_resources(tickinterval)
end
function Public.pick_up_tick(tickinterval)
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
if not destination then return end
local surface_name = destination.surface_name
@ -947,10 +947,10 @@ end
function Public.loading_update(tickinterval)
local memory = Memory.get_crew_memory()
if memory.game_lost then return end
local currentdestination = Common.current_destination()
if not memory.loadingticks then return end
local destination = Common.current_destination()
local destination_index = memory.mapbeingloadeddestination_index
if not destination_index then memory.loadingticks = nil return end
@ -960,9 +960,8 @@ function Public.loading_update(tickinterval)
-- if memory.loadingticks % 100 == 0 then game.print(memory.loadingticks) end
local destination_data = memory.destinations[destination_index]
if (not destination_data) then
if memory.boat and currentdestination.type == Surfaces.enum.LOBBY then
if (not destination) then
if memory.boat and destination.type == Surfaces.enum.LOBBY then
if memory.loadingticks >= 350 - Common.loading_interval then
if Boats.players_on_boat_count(memory.boat) > 0 then
if memory.loadingticks < 350 then
@ -988,13 +987,13 @@ function Public.loading_update(tickinterval)
end
return
else
local surface_name = destination_data.surface_name
local surface_name = destination.surface_name
if not surface_name then return end
local surface = game.surfaces[surface_name]
if not surface then return end
if currentdestination.type == Surfaces.enum.LOBBY then
if destination.type == Surfaces.enum.LOBBY then
if memory.loadingticks >= 1260 then
@ -1039,9 +1038,9 @@ function Public.loading_update(tickinterval)
elseif memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then
local total = Common.map_loading_ticks_atsea
if currentdestination.type == Surfaces.enum.DOCK then
if destination.type == Surfaces.enum.DOCK then
total = Common.map_loading_ticks_atsea_dock
elseif currentdestination.type == Surfaces.enum.ISLAND and currentdestination.subtype == Surfaces.Island.enum.MAZE then
elseif destination.type == Surfaces.enum.ISLAND and destination.subtype == Surfaces.Island.enum.MAZE then
total = Common.map_loading_ticks_atsea_maze
end
@ -1223,9 +1222,10 @@ end
function Public.minimap_jam(tickinterval)
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
if destination.type == Surfaces.enum.ISLAND and destination.subtype == Surfaces.Island.enum.MAZE and memory.overworldx >= Common.maze_minimap_jam_start_league and memory.boat and memory.boat.state == Boats.enum_state.LANDED then
if memory.overworldx >= Common.maze_minimap_jam_start_league and memory.boat and memory.boat.state == Boats.enum_state.LANDED then
local destination = Common.current_destination()
if destination.type == Surfaces.enum.ISLAND and destination.subtype == Surfaces.Island.enum.MAZE then
if not destination.surface_name then return end
local surface = game.surfaces[destination.surface_name]
local force = memory.force
@ -1233,6 +1233,8 @@ function Public.minimap_jam(tickinterval)
end
end
end
-- function Public.crewtick_handle_delayed_tasks(tickinterval)
-- local memory = Memory.get_crew_memory()
@ -1266,7 +1268,7 @@ function Public.Kraken_Destroyed_Backup_check(tickinterval) -- a server became b
for i = 1, Kraken.kraken_slots do
if memory.active_sea_enemies.krakens[i] then
local kraken_data = memory.active_sea_enemies.krakens[i]
if kraken_data.step >= 3 then
if kraken_data.step and kraken_data.step >= 3 then
some_spawners_should_be_alive = true
end
end
@ -1314,9 +1316,10 @@ end
function Public.silo_insta_update()
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
if memory.game_lost then return end
local destination = Common.current_destination()
local silos = destination.dynamic_data.rocketsilos
if silos and silos[1] and silos[1].valid then --need the first silo to be alive in order to charge any others

View File

@ -178,7 +178,7 @@ function Public.class_rewards_tick(tickinterval)
if memory.classes_table[player.index] == Classes.enum.SMOLDERING then
local inv = player.get_inventory(defines.inventory.character_main)
if not (inv and inv.valid) then return end
local max_coal = 25
local max_coal = 50
-- local max_transfer = 1
local wood_count = inv.get_item_count('wood')
local coal_count = inv.get_item_count('coal')