1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-16 02:47:48 +02:00

v1.0.3.9.6

This commit is contained in:
danielmartin0 2022-03-01 21:59:48 +00:00
parent 2e0b514889
commit cf6cc52c4d
32 changed files with 333 additions and 171 deletions

View File

@ -1,6 +1,6 @@
require 'utils.data_stages'
_LIFECYCLE = _STAGE.control -- Control stage
_DEBUG = false
_DEBUG = true
_DUMP_ENV = false

View File

@ -13,7 +13,7 @@ softmod_info_new_players_1=For New Players
softmod_info_new_players_2=Mine coal and other resources and bring them to the ship to keep things going, or try asking the captain for more specific tasks.
softmod_info_tips_1=Features of the game that are hard to work out alone
softmod_info_tips_2=• 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• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.\n• Help commands: /class
softmod_info_tips_2=• Resources granted to the ship appear in the captain's cabin.\n• The way in which you break rocks does not affect the total ore that spawns on an island.\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• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.\n• Help commands: /class
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/pipe resistance to biters. Dock trades revamped. Game made much easier for small crews.
@ -40,6 +40,6 @@ auto_undock_tooltip=The maximum time to stay at this location.\n\nOnce this time
atsea_loading_tooltip=The next destination is loading.
leave_anytime_tooltip=The captain chooses when to undock the ship.\n\nThey can undock by pressing this button.
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.
resources_needed_tooltip_2=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.
resources_needed_tooltip_3=The captain can undock by clicking this button, but only if enough resources are stored in the captain's cabin.
fuel_tooltip=__1__ stored fuel. If the ship runs out of fuel, you lose.\n\nClick to open the Captain's Store, which only the captain and their officers are authorised to use.

View File

@ -51,9 +51,8 @@ function Public.Tick_actions(tickinterval)
if (memory.gamelost or memory.gamewon) or (not destination.dynamic_data.timeratlandingtime) or destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + Common.seconds_after_landing_to_enable_AI then return end
if memory.boat.state == Boats.enum_state.LANDED then
local ef = game.forces[memory.enemy_force_name]
local extra_evo = tickinterval/60 * Balance.evolution_per_second()
ef.evolution_factor = ef.evolution_factor + extra_evo
Common.increment_evo(extra_evo)
destination.dynamic_data.evolution_accrued_time = destination.dynamic_data.evolution_accrued_time + extra_evo
end
@ -220,7 +219,7 @@ function Public.tell_biters_near_silo_to_attack_it()
surface.set_multi_command(
{
command = attackcommand,
unit_count = Math.random(1, Math.floor(1 + game.forces[enemy_force_name].evolution_factor * 100)),
unit_count = Math.random(1, Math.floor(1 + memory.evolution_factor * 100)),
force = enemy_force_name,
unit_search_distance = 10
}
@ -357,7 +356,7 @@ function Public.try_spawner_spend_fraction_of_available_pollution_on_biters(spaw
local spawnerposition = spawner.position
local difficulty = memory.difficulty
local enemy_force_name = memory.enemy_force_name
local evolution = game.forces[enemy_force_name].evolution_factor
local evolution = memory.evolution_factor
local units_created_count = 0
local units_created = {}
@ -449,7 +448,7 @@ function Public.try_spawner_spend_fraction_of_available_pollution_on_biters(spaw
if units_created_count > 0 then
--@TEMP: Logging attack spending
log('Spent ' .. 100 * (initialpollution - temp_floating_pollution) / initialpollution .. '% of ' .. (initialpollution - temp_floating_pollution) .. ' pollution budget on biters, at ' .. base_pollution_cost_multiplier .. 'x price.')
log('Spent ' .. Math.floor(100 * (initialpollution - temp_floating_pollution) / initialpollution) .. '% of ' .. Math.ceil(initialpollution - temp_floating_pollution) .. ' pollution budget on biters, at ' .. Math.ceil(base_pollution_cost_multiplier*100)/100 .. 'x price.')
end
return units_created
@ -684,7 +683,7 @@ function Public.revenge_group(surface, p, target, type, bonus_evo, amount_multip
local name, count
if type == 'biter' then
name = Common.get_random_biter_type(game.forces[memory.enemy_force_name].evolution_factor + bonus_evo)
name = Common.get_random_biter_type(memory.evolution_factor + bonus_evo)
if name == 'small-biter' then
count = 6
@ -696,7 +695,7 @@ function Public.revenge_group(surface, p, target, type, bonus_evo, amount_multip
count = 1
end
elseif type == 'spitter' then
name = Common.get_random_spitter_type(game.forces[memory.enemy_force_name].evolution_factor + bonus_evo)
name = Common.get_random_spitter_type(memory.evolution_factor + bonus_evo)
if name == 'small-spitter' then
count = 10
@ -747,7 +746,7 @@ function Public.spawn_boat_biters(boat, max_evo, count, width)
local surface = game.surfaces[boat.surface_name]
local difficulty = memory.difficulty
local enemy_force_name = boat.force_name
-- local evolution = game.forces[enemy_force_name].evolution_factor
-- local evolution = memory.evolution_factor
local p = {boat.position.x - width/2, boat.position.y}

View File

@ -69,12 +69,6 @@ function Public.silo_count()
return Math.ceil(E/(16.8*150)) --no more than 2.5 minutes to charge it
end
function Public.silo_total_pollution()
return (
400 * (Common.difficulty()^(1.2)) * Public.crew_scale()^(2/5) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.5)) --shape of the curve with x is tuned
)
end
function Public.max_time_on_island_formula() --always >0 --tuned
return 60 * (
@ -116,6 +110,12 @@ function Public.fuel_depletion_rate_sailing()
return - 8 * (1 + 0.13 * (Common.overworldx()/40)^(10/10))
end
function Public.silo_total_pollution()
return (
400 * (Common.difficulty()^(1.2)) * Public.crew_scale()^(2/5) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned
)
end
function Public.boat_passive_pollution_per_minute(time)
local boost = 1
local T = Public.max_time_on_island_formula()
@ -138,7 +138,7 @@ function Public.boat_passive_pollution_per_minute(time)
end
return boost * (
6 * Common.difficulty() * (Common.overworldx()/40)^(16/10) * (Public.crew_scale())^(60/100)
6 * Common.difficulty() * (Common.overworldx()/40)^(1.6) * (Public.crew_scale())^(60/100)
) -- No T dependence! Is that the right idea? I wrote it this way earlier, and it can make sense, but I'm not 100% sure.
end
@ -334,10 +334,15 @@ end
Public.research_buffs = {
-- these already give .1 productivity so we're adding .1 to get to 20%
['mining-productivity-1'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
['mining-productivity-2'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
['mining-productivity-3'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
['mining-productivity-4'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
['mining-productivity-1'] = {['mining-drill-productivity-bonus'] = .1},
['mining-productivity-2'] = {['mining-drill-productivity-bonus'] = .1},
['mining-productivity-3'] = {['mining-drill-productivity-bonus'] = .1},
['mining-productivity-4'] = {['mining-drill-productivity-bonus'] = .1},
-- -- these already give .1 productivity so we're adding .1 to get to 20%
-- ['mining-productivity-1'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
-- ['mining-productivity-2'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
-- ['mining-productivity-3'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
-- ['mining-productivity-4'] = {['mining-drill-productivity-bonus'] = .1, ['character-inventory-slots-bonus'] = 5},
}
@ -399,21 +404,22 @@ function Public.starting_items_crew_upstairs()
{['steel-plate'] = 38},
{['stone-brick'] = 60},
{['grenade'] = 3},
{['solar-panel'] = 4},
{['shotgun'] = 2, ['shotgun-shell'] = 36},
{['raw-fish'] = 5},
{['coin'] = 1000},
}
end
function Public.starting_items_crew_downstairs()
return {
{['transport-belt'] = Math.random(500,600)},
{['transport-belt'] = Math.random(600,650)},
{['underground-belt'] = 80},
{['splitter'] = Math.random(40,48)},
{['inserter'] = Math.random(100,120)},
{['splitter'] = Math.random(50,56)},
{['inserter'] = Math.random(120,140)},
{['storage-tank'] = 4},
{['medium-electric-pole'] = Math.random(15,21)},
{['coin'] = 3000},
{['coin'] = 2000},
{['solar-panel'] = 4},
}
end

View File

@ -229,6 +229,34 @@ function(cmd)
end)
commands.add_command(
'summoncrew',
'summoncrew',
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
Crew.summon_crew()
end
end)
commands.add_command(
'setevo',
'setevo',
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
Common.set_evo(tonumber(param))
end
end)
commands.add_command(
'chnk',
'genchunk',

View File

@ -6,6 +6,7 @@ local Memory = require 'maps.pirates.memory'
local inspect = require 'utils.inspect'.inspect
local simplex_noise = require 'utils.simplex_noise'.d2
local perlin_noise = require 'utils.perlin_noise'
local Force_health_booster = require 'modules.force_health_booster'
local Public = {}
@ -295,15 +296,23 @@ function Public.give(player, stacks, spill_position, spill_surface)
text1 = text1 .. -itemcount_remember .. '[/color] [item=' .. itemname .. ']'
end
if inv then
if #stacks2 > 1 then
text2 = text2 .. '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. ']' .. inv.get_item_count(itemname) .. '[/color]'
else
text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(itemname) .. ')[/color]'
end
if j < #stacks2 then
text2 = text2 .. ', '
end
-- count total of that item they have:
local new_total_count = 0
local cursor_stack = player.cursor_stack
if cursor_stack and cursor_stack.valid_for_read and cursor_stack.name == itemname and cursor_stack.count and cursor_stack.count > 0 then
new_total_count = new_total_count + cursor_stack.count
end
if inv and inv.get_item_count(itemname) and inv.get_item_count(itemname) > 0 then
new_total_count = new_total_count + inv.get_item_count(itemname)
end
if #stacks2 > 1 then
text2 = text2 .. '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. ']' .. new_total_count .. '[/color]'
else
text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. new_total_count .. ')[/color]'
end
if j < #stacks2 then
text2 = text2 .. ', '
end
if j < #stacks2 then
@ -323,6 +332,69 @@ end
function Public.is_captain(player)
local memory = Memory.get_crew_memory()
if memory.playerindex_captain and memory.playerindex_captain == player.index then
return true
else
return false
end
end
function Public.endgame_biter_damage_modifier(surplus_evo)
return Math.floor(surplus_evo/2*1000)/1000
end
function Public.endgame_biter_health_modifier(surplus_evo)
return Math.floor(surplus_evo*3*1000)/1000 + 1
end
function Public.set_biter_endgame_modifiers()
local memory = Memory.get_crew_memory()
local enemy_force = game.forces[memory.enemy_force_name]
if not (memory.evolution_factor and memory.evolution_factor > 1 and enemy_force and enemy_force.valid) then
return nil
end
local surplus = memory.evolution_factor - 1
local damage_mod = Public.endgame_biter_damage_modifier(surplus)
enemy_force.set_ammo_damage_modifier('melee', damage_mod)
enemy_force.set_ammo_damage_modifier('biological', damage_mod)
enemy_force.set_ammo_damage_modifier('artillery-shell', damage_mod)
enemy_force.set_ammo_damage_modifier('flamethrower', damage_mod)
local health_mod = Public.endgame_biter_health_modifier(surplus)
Force_health_booster.set_health_modifier(enemy_force.index, health_mod)
end
function Public.set_evo(evolution)
local memory = Memory.get_crew_memory()
memory.evolution_factor = evolution
if memory.enemy_force_name then
local ef = game.forces[memory.enemy_force_name]
if ef and ef.valid then
ef.evolution_factor = memory.evolution_factor
Public.set_biter_endgame_modifiers()
end
end
end
function Public.increment_evo(evolution)
local memory = Memory.get_crew_memory()
memory.evolution_factor = memory.evolution_factor + evolution
if memory.enemy_force_name then
local ef = game.forces[memory.enemy_force_name]
if ef and ef.valid then
ef.evolution_factor = memory.evolution_factor
Public.set_biter_endgame_modifiers()
end
end
end
function Public.current_destination()
local memory = Memory.get_crew_memory()

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.9.4'
Public.version_float = 1.0394
Public.version_string = '1.0.3.9.6'
Public.version_float = 1.0396
Public.blueprint_library_allowed = false
Public.blueprint_importing_allowed = true

View File

@ -31,18 +31,23 @@ Public.enum = enum
function Public.difficulty_vote(player_index, difficulty_id)
local memory = Memory.get_crew_memory()
if not (memory.difficulty_votes) then memory.difficulty_votes = {} end
local player = game.players[player_index]
if not (player and player.valid) then return end
local option = CoreData.difficulty_options[difficulty_id]
if not option then return end
local color = option.associated_color
Common.notify_force(game.forces[memory.force_name], player.name .. ' voted [color=' .. color.r .. ',' .. color.g .. ',' .. color.b .. ']for difficulty ' .. option.text .. '[/color]')
if not (memory.difficulty_votes) then memory.difficulty_votes = {} end
memory.difficulty_votes[player_index] = difficulty_id
Public.update_difficulty()
if memory.difficulty_votes[player_index] and memory.difficulty_votes[player_index] == difficulty_id then
return nil
else
local option = CoreData.difficulty_options[difficulty_id]
if not option then return end
local color = option.associated_color
Common.notify_force(game.forces[memory.force_name], player.name .. ' voted [color=' .. color.r .. ',' .. color.g .. ',' .. color.b .. ']for difficulty ' .. option.text .. '[/color]')
memory.difficulty_votes[player_index] = difficulty_id
Public.update_difficulty()
end
end
@ -93,21 +98,58 @@ function Public.try_add_extra_time_at_sea(ticks)
return true
end
function Public.get_crewmembers_printable_string()
local crewmembers_string = ''
for _, player in pairs(Common.crew_get_crew_members()) do
if player.valid then
if crewmembers_string ~= '' then crewmembers_string = crewmembers_string .. ', ' end
crewmembers_string = crewmembers_string .. player.name
end
end
if crewmembers_string ~= '' then crewmembers_string = crewmembers_string .. '.' end
return crewmembers_string
end
function Public.try_lose(reason)
local memory = Memory.get_crew_memory()
if (not memory.game_lost) then
if (not memory.game_lost) and (not memory.game_won) then
memory.game_lost = true
memory.crew_disband_tick = game.tick + 360
local playtimetext = Utils.time_longform((memory.age or 0)/60)
Server.to_discord_embed_raw(CoreData.comfy_emojis.trashbin .. '[' .. memory.name .. '] Game over — ' .. reason ..'. Playtime: ' .. playtimetext .. ' since 1st island.')
Server.to_discord_embed_raw(CoreData.comfy_emojis.trashbin .. '[' .. memory.name .. '] Game over — ' .. reason ..'. Playtime: ' .. playtimetext .. ' since 1st island. Crewmembers: ' .. Public.get_crewmembers_printable_string())
Common.notify_game('[' .. memory.name .. '] Game over — ' .. reason ..'. Playtime: [font=default-large-semibold]' .. playtimetext .. '[/font] since 1st island.', CoreData.colors.notify_gameover)
local force = game.forces[memory.force_name]
if not (force and force.valid) then return end
force.play_sound{path='utility/game_lost', volume_modifier=0.75}
force.play_sound{path='utility/game_lost', volume_modifier=0.75} --playing to the whole game might scare ppl
end
end
function Public.try_win()
local memory = Memory.get_crew_memory()
if (not memory.game_lost) and (not memory.game_won) then
memory.completion_time = Math.floor((memory.age or 0)/60)
local speedrun_time = (memory.age or 0)/60
local speedrun_time_str = Utils.time_longform(speedrun_time)
memory.game_won = true
-- memory.crew_disband_tick = game.tick + 1200
Server.to_discord_embed_raw(CoreData.comfy_emojis.goldenobese .. '[' .. memory.name .. '] Victory, on v' .. CoreData.version_string .. ', ' .. CoreData.difficulty_options[memory.difficulty_option].text .. ', cap ' .. CoreData.capacity_options[memory.capacity_option].text3 .. '. Playtime: ' .. speedrun_time_str .. '[/font] since 1st island. Crewmembers: ' .. Public.get_crewmembers_printable_string())
Common.notify_game('[' .. memory.name .. '] Victory, on v' .. CoreData.version_string .. ', ' .. CoreData.difficulty_options[memory.difficulty_option].text .. ', cap ' .. CoreData.capacity_options[memory.capacity_option].text3 .. '. Playtime: [font=default-large-semibold]' .. speedrun_time_str .. '[/font] since 1st island. Crewmembers: ' .. Public.get_crewmembers_printable_string(), CoreData.colors.notify_victory)
game.play_sound{path='utility/game_won', volume_modifier=0.9}
memory.victory_pause_until_tick = game.tick + 60*5
memory.victory_continue_message = true
end
end
@ -548,7 +590,6 @@ function Public.initialise_crowsnest_2()
Crowsnest.crowsnest_surface_delayed_init()
end
function Public.initialise_crew(accepted_proposal)
local global_memory = Memory.get_global_memory()
@ -568,6 +609,7 @@ function Public.initialise_crew(accepted_proposal)
memory.id = new_id
memory.force_name = string.format('crew-%03d', new_id)
memory.enemy_force_name = string.format('enemy-%03d', new_id)
memory.evolution_factor = 0
memory.delayed_tasks = {}
memory.buffered_tasks = {}

View File

@ -365,7 +365,7 @@ function Public.update(player)
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 Common.is_captain(player) and memory.crewplayerindices and #memory.crewplayerindices > 1 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
@ -395,8 +395,8 @@ function Public.update(player)
end
flow.spare_classes.body.assign_flow.visible = any_class_button
flow.captain.visible = (memory.playerindex_captain and player.index == memory.playerindex_captain)
flow.undock_tip.visible = (memory.playerindex_captain and player.index == memory.playerindex_captain)
flow.captain.visible = Common.is_captain(player)
flow.undock_tip.visible = Common.is_captain(player)
flow.captain.body.capn_pass.visible = other_player_selected
flow.captain.body.capn_plank.visible = flow.captain.body.capn_pass.visible

View File

@ -24,14 +24,8 @@ local GuiCommon = require 'maps.pirates.gui.common'
local function get_evolution_percentage()
local memory = Memory.get_crew_memory()
if (not memory.enemy_force_name) then return 0 end
local value = Math.floor(game.forces[memory.enemy_force_name].evolution_factor * 1000) * 0.001
-- if value < 0.001 then
-- -- 0.00 won't be shown on the button as value
-- return 0.001
-- end
local value = Math.floor((memory.evolution_factor or 0) * 1000) * 0.001
return value
end

View File

@ -520,7 +520,7 @@ function Public.update_gui(player)
local charged_bool = destination.dynamic_data.silocharged
local launched_bool = destination.dynamic_data.rocketlaunched
local captain_bool = (memory.playerindex_captain and player.index == memory.playerindex_captain)
local captain_bool = Common.is_captain(player)
local atsea_loading_bool = memory.boat and memory.boat.state and memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP and memory.loadingticks
@ -798,7 +798,7 @@ function Public.update_gui(player)
flow1.silo_progressbar.value = consumed/needed
local tooltip = string.format('Rocket silo charge\n\nCharge the silo to launch a rocket, gaining both coins and fuel.\n\nCurrent charge: %.1f', consumed / 1000000000) .. '/' .. Math.floor(needed / 100000000)/10 .. ' GJ'
local tooltip = string.format('Rocket silo charge\n\nCharge the silo to launch a rocket, gaining both coins and fuel.\n\nCurrent charge: %.1f/%.1f GJ', Math.floor(consumed / 100000000)/10, Math.floor(needed / 100000000)/10)
flow1.tooltip = tooltip
flow1.silo_label_1.tooltip = tooltip
flow1.silo_label_2.tooltip = tooltip
@ -931,7 +931,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 leave_anytime_bool and not approaching_dock_bool and not leaving_dock_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 leave_anytime_bool and not cost_bool and not approaching_dock_bool and not leaving_dock_bool then
flow1.visible = true
else
flow1.visible = false

View File

@ -202,7 +202,7 @@ function Public.update(player)
elseif flow2.selected_tab_index == 2 then
flow2.style.height = 420
elseif flow2.selected_tab_index == 3 then
flow2.style.height = 590
flow2.style.height = 610
elseif flow2.selected_tab_index == 4 then
flow2.style.height = 280
end

View File

@ -447,17 +447,23 @@ local function event_on_player_mined_entity(event)
local give = {}
if memory.overworldx >= 0 then
local baseamount = 4
--minimum 1 wood
local amount = Math.max(Math.ceil(Math.min(available, baseamount * available/starting)),1)
destination.dynamic_data.wood_remaining = destination.dynamic_data.wood_remaining - amount
if memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.LUMBERJACK then
give[#give + 1] = {name = 'wood', count = amount + 3}
if Math.random(7) == 1 then
give[#give + 1] = {name = 'coin', count = 20}
end
else
give[#give + 1] = {name = 'wood', count = amount}
if Math.random(7) == 1 then --tuned
give[#give + 1] = {name = 'coin', count = 5}
end
end
local baseamount = 4
local amount = Math.max(Math.ceil(Math.min(available, baseamount * available/starting)),1) --minimum 1 wood
give[#give + 1] = {name = 'wood', count = amount}
destination.dynamic_data.wood_remaining = destination.dynamic_data.wood_remaining - amount
Common.give(player, give, entity.position)
end
event.buffer.clear()
@ -478,7 +484,7 @@ local function event_on_player_mined_entity(event)
if memory.overworldx > 0 then
if memory.classes_table and memory.classes_table[event.player_index] and memory.classes_table[event.player_index] == Classes.enum.PROSPECTOR then
give[#give + 1] = {name = 'coin', count = 4}
give[#give + 1] = {name = entity.name, count = 5}
give[#give + 1] = {name = entity.name, count = 6}
else
if memory.overworldx > 0 then
give[#give + 1] = {name = 'coin', count = 1}
@ -539,7 +545,7 @@ end
local function shred_nearby_simple_entities(entity)
local memory = Memory.get_crew_memory()
if game.forces[memory.enemy_force_name].evolution_factor < 0.25 then return end
if memory.evolution_factor < 0.25 then return end
local simple_entities = entity.surface.find_entities_filtered({type = {'simple-entity', 'tree'}, area = {{entity.position.x - 3, entity.position.y - 3},{entity.position.x + 3, entity.position.y + 3}}})
if #simple_entities == 0 then return end
for i = 1, #simple_entities, 1 do
@ -573,8 +579,8 @@ local function base_kill_rewards(event)
coin_amount = 90
elseif entity.name == 'biter-spawner' or entity.name == 'spitter-spawner'
then
iron_amount = 25
coin_amount = 50
iron_amount = 30
coin_amount = 75
elseif entity.name == 'big-worm-turret'
then
iron_amount = 30
@ -623,7 +629,7 @@ local function spawner_died(event)
local destination = Common.current_destination()
local extra_evo = Balance.evolution_per_biter_base_kill()
game.forces[memory.enemy_force_name].evolution_factor = game.forces[memory.enemy_force_name].evolution_factor + extra_evo
Common.increment_evo(extra_evo)
destination.dynamic_data.evolution_accrued_nests = destination.dynamic_data.evolution_accrued_nests + extra_evo
end
@ -682,9 +688,10 @@ function Public.research_apply_buffs(event)
if Balance.research_buffs[event.research.name] then
local tech = Balance.research_buffs[event.research.name]
for k, v in pairs(tech) do
force[k] = force[k] + v
end
-- @FIXME: This code is from another scenario but doesn't work
-- for k, v in pairs(tech) do
-- force[k] = force[k] + v
-- end
end
end

View File

@ -57,7 +57,7 @@ Public.chest_loot_data_raw = {
-- {10, 0, 1, false, 'fast-underground-belt', 2, 5},
{10, 0, 1, false, 'fast-splitter', 2, 5},
{12, 0, 1, false, 'artillery-shell', 1, 1},
{40, 0, 1, false, 'rail-signal', 20, 70},
{40, 0, 1, false, 'rail-signal', 25, 100},
{40, 0, 1, false, 'medium-electric-pole', 2, 5},
{2, 0.2, 1, false, 'electric-engine-unit', 1, 1},

View File

@ -101,6 +101,7 @@ function Public.reset_crew_memory(id) --also serves as a dev reference of memory
memory.stored_fuel = nil
memory.spawnpoint = nil
memory.evolution_factor = nil
memory.scripted_biters = nil
memory.scripted_unit_groups = nil
memory.floating_pollution = nil

View File

@ -173,28 +173,28 @@ function Public.generate_overworld_destination(p)
local normal_costitems = {'small-lamp', 'engine-unit', 'advanced-circuit'}
local base_cost_0 = {
['small-lamp'] = (macrop.x-2)*20,
['small-lamp'] = (macrop.x-2)*15,
}
local base_cost_1 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['small-lamp'] = (macrop.x-2)*15,
['engine-unit'] = (macrop.x-7)*10,
}
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)*15,
['engine-unit'] = (macrop.x-7)*10,
['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-15)*10,
['electric-engine-unit'] = (macrop.x-20)*10,
['small-lamp'] = (macrop.x-2)*15,
['engine-unit'] = (macrop.x-7)*10,
['advanced-circuit'] = (macrop.x-15)*5,
['electric-engine-unit'] = (macrop.x-20)*5,
}
local base_cost_4 = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['advanced-circuit'] = (macrop.x-15)*10,
['electric-engine-unit'] = (macrop.x-20)*10,
['small-lamp'] = (macrop.x-2)*15,
['engine-unit'] = (macrop.x-7)*10,
['advanced-circuit'] = (macrop.x-15)*5,
['electric-engine-unit'] = (macrop.x-20)*5,
}
if macrop.x == 0 then
-- if _DEBUG then
@ -215,8 +215,8 @@ function Public.generate_overworld_destination(p)
cost_to_leave = base_cost_1
elseif macrop.x == 18 then --a super small amount of electric-engine-unit on a relatively early level so that they see they need lubricant
cost_to_leave = {
['small-lamp'] = (macrop.x-2)*20,
['engine-unit'] = (macrop.x-7)*15,
['small-lamp'] = (macrop.x-2)*15,
['engine-unit'] = (macrop.x-7)*10,
['electric-engine-unit'] = 2,
}
elseif macrop.x <= 22 then
@ -586,21 +586,8 @@ function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves
end
if memory.overworldx >= CoreData.victory_x and (not (memory.game_lost or memory.game_won)) then
memory.completion_time = Math.ceil((memory.age or 0)/60)
local speedrun_time = (memory.age or 0)/60
local speedrun_time_str = Utils.time_longform(speedrun_time)
memory.game_won = true
-- memory.crew_disband_tick = game.tick + 1200
local message = '[' .. memory.name .. '] Victory, on v' .. CoreData.version_string .. ', ' .. CoreData.difficulty_options[memory.difficulty_option].text .. ', cap ' .. CoreData.capacity_options[memory.capacity_option].text3 .. '. Playtime: '
Server.to_discord_embed_raw(CoreData.comfy_emojis.goldenobese .. message .. speedrun_time_str)
game.play_sound{path='utility/game_won', volume_modifier=0.9}
Common.notify_game(message .. '[font=default-large-semibold]' .. speedrun_time_str .. '[/font] since 1st island.', CoreData.colors.notify_victory)
memory.victory_pause_until_tick = game.tick + 60*5
memory.victory_continue_message = true
if memory.overworldx >= CoreData.victory_x then
Crew.try_win()
end
if memory.overworldx % 40 == 0 then

View File

@ -221,6 +221,8 @@ function Public.progress_to_destination(destination_index)
end
end
memory.mainshop_availability_bools.repair_cannons = true
-- Delay.add(Delay.enum.PLACE_DOCK_JETTY_AND_BOATS)
Task.set_timeout_in_ticks(2, place_dock_jetty_and_boats, {})
else
@ -378,6 +380,7 @@ function Public.check_for_end_of_boat_movement(boat)
memory.mainshop_availability_bools.buy_copper = false
-- memory.mainshop_availability_bools.buy_fast_loader = false
-- memory.mainshop_availability_bools.sell_copper = false
memory.mainshop_availability_bools.repair_cannons = false
memory.mainshop_availability_bools.extra_hold = false
memory.mainshop_availability_bools.upgrade_power = false

View File

@ -18,6 +18,7 @@ local enum = {
SHORESMAN = 6,
BOATSWAIN = 7,
PROSPECTOR = 8,
LUMBERJACK = 9,
}
Public.enum = enum
@ -30,6 +31,7 @@ Public.Class_List = {
enum.SHORESMAN,
enum.BOATSWAIN,
enum.PROSPECTOR,
enum.LUMBERJACK,
}
Public.display_form = {
@ -41,6 +43,7 @@ Public.display_form = {
[enum.SHORESMAN] = 'Shoresman',
[enum.BOATSWAIN] = 'Boatswain',
[enum.PROSPECTOR] = 'Prospector',
[enum.LUMBERJACK] = 'Lumberjack',
}
Public.explanation = {
[enum.DECKHAND] = 'They move faster and generate iron ore for the ship whilst onboard above deck, but move slower offboard.',
@ -51,6 +54,7 @@ Public.explanation = {
[enum.SHORESMAN] = 'They move slightly faster and generate iron ore for the ship whilst offboard, but move slower onboard.',
[enum.BOATSWAIN] = 'They move faster and generate lots of ore for the ship whilst below deck, but move slower offboard.',
[enum.PROSPECTOR] = 'They find more resources when handmining ore.',
[enum.LUMBERJACK] = 'They find more resources when chopping trees.',
}
return Public

View File

@ -60,7 +60,7 @@ function Public.tag_text(player)
local str = ''
local tags = {}
if memory.id ~= 0 and memory.playerindex_captain and player.index == memory.playerindex_captain then
if memory.id ~= 0 and Common.is_captain(player) then
tags[#tags + 1] = 'Cap\'n'
elseif player.controller_type == defines.controllers.spectator then
tags[#tags + 1] = 'Spectating'
@ -122,7 +122,7 @@ end
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
if memory.id ~= 0 and Common.is_captain(player) then
return Public.privilege_levels.CAPTAIN
elseif memory.officers_table and memory.officers_table[player.index] then
return Public.privilege_levels.OFFICER
@ -173,7 +173,7 @@ function Public.player_left_so_redestribute_roles(player)
local memory = Memory.get_crew_memory()
if player and player.index then
if player.index == memory.playerindex_captain then
if Common.is_captain(player) then
Public.assign_captain_based_on_priorities()
end
@ -300,7 +300,7 @@ function Public.afk_player_tick(player)
local global_memory = Memory.get_global_memory()
local memory = Memory.get_crew_memory()
if player.index == memory.playerindex_captain and #Common.crew_get_nonafk_crew_members() > 0 then
if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() > 0 then
local force = game.forces[memory.force_name]
if force and force.valid then

View File

@ -29,14 +29,14 @@ Public.offers_loaders = {
}
Public.offers_default = {
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'copper-plate', count = 200}},
{price = {{'coin', 2000}}, offer = {type = 'give-item', item = 'iron-plate', count = 200}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'copper-plate', count = 200}},
{price = {{'coin', 2500}}, offer = {type = 'give-item', item = 'iron-plate', count = 200}},
{price = {{'coin', 800}}, offer = {type = 'give-item', item = 'gun-turret', count = 1}},
{price = {{'coin', 1250}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}},
}
Public.offers_rockets = {
{price = {{'coin', 200}, {'electronic-circuit', 50}}, offer = {type = 'give-item', item = 'rocket-launcher', count = 1}},
{price = {{'coin', 200}, {'electronic-circuit', 80}}, offer = {type = 'give-item', item = 'rocket-launcher', count = 1}},
{price = {{'coin', 1000}, {'explosives', 20}, {'electronic-circuit', 20}}, offer = {type = 'give-item', item = 'rocket', count = 20}},
}

View File

@ -36,27 +36,27 @@ Public.market_barters = {
}
Public.market_permanent_offers = {
{price = {{'coin', 5000}}, offer = {type = 'give-item', item = 'iron-ore', count = 900}},
{price = {{'coin', 5000}}, offer = {type = 'give-item', item = 'copper-ore', count = 900}},
{price = {{'coin', 5000}}, offer = {type = 'give-item', item = 'crude-oil-barrel', count = 150}},
{price = {{'coin', 5000}}, offer = {type = 'give-item', item = 'beacon', count = 2}},
{price = {{'coin', 4999}}, offer = {type = 'give-item', item = 'iron-ore', count = 900}},
{price = {{'coin', 4999}}, offer = {type = 'give-item', item = 'copper-ore', count = 900}},
{price = {{'coin', 4999}}, offer = {type = 'give-item', item = 'crude-oil-barrel', count = 150}},
{price = {{'coin', 4999}}, offer = {type = 'give-item', item = 'beacon', count = 2}},
}
-- 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}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'coal', count = 900}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'firearm-magazine', count = 500}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine', count = 75}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine', count = 25}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 60}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'raw-fish', count = 300}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'laser-turret', count = 1}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'vehicle-machine-gun', count = 2}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'substation', count = 6}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'distractor-capsule', count = 10}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'destroyer-capsule', count = 5}},
{price = {{'coin', 2499}}, offer = {type = 'give-item', item = 'coin', count = 4000}},
}

View File

@ -16,8 +16,14 @@ local Upgrades = require 'maps.pirates.boat_upgrades'
local Public = {}
--== Warning: If something only costs fuel, then we need to check the player can't buy it whilst they're dead
Public.main_shop_data_1 = {
repair_cannons = {
tooltip = 'Repair the cannons.',
what_you_get_sprite_buttons = {['item/artillery-turret'] = false},
base_cost = {coins = 800},
},
new_boat_cutter = {
tooltip = 'Purchase a cutter.',
what_you_get_sprite_buttons = {['utility/spawn_flag'] = false},
@ -124,6 +130,7 @@ function Public.initialise_main_shop()
new_boat_cutter_with_hold = false,
new_boat_cutter = false,
buy_iron = false,
repair_cannons = false,
-- sell_iron = false,
-- buy_fast_loader = true,
-- sell_copper = false,
@ -132,6 +139,7 @@ end
function Public.main_shop_try_purchase(player, purchase_name)
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
local shop_data_1 = Public.main_shop_data_1
local shop_data_2 = Public.main_shop_data_2
local trade_data = shop_data_1[purchase_name] or shop_data_2[purchase_name]
@ -235,6 +243,15 @@ function Public.main_shop_try_purchase(player, purchase_name)
Dock.execute_boat_purchase()
Common.notify_force_light(force,string.format('[font=heading-1]%s bought a %s.[/font]', player.name, Boats[Common.current_destination().static_params.boat_for_sale_type].Data.display_name))
elseif purchase_name == 'repair_cannons' then
-- heal all cannons:
local cannons = game.surfaces[destination.surface_name].find_entities_filtered({type = 'artillery-turret'})
for _, c in pairs(cannons) do
c.health = c.prototype.max_health
end
Common.notify_force_light(force,string.format('%s repaired the ship\'s cannons.', player.name))
memory.mainshop_availability_bools[purchase_name] = false
elseif purchase_name == Upgrades.enum.MORE_POWER then
Upgrades.execute_upgade(Upgrades.enum.MORE_POWER)
Common.notify_force_light(force,string.format('[font=heading-1]%s upgraded the ship\'s power.[/font]', player.name))

View File

@ -189,7 +189,7 @@ function Public.enemies_1(args, spec, no_worms, worm_evo_bonus)
elseif rng >= 3 then
args.entities[#args.entities + 1] = {name = 'spitter-spawner', position = p, force = enemy_force_name, indestructible = spec2.spawners_indestructible or false}
elseif not no_worms then
local evolution = game.forces[enemy_force_name].evolution_factor + worm_evo_bonus
local evolution = memory.evolution_factor + worm_evo_bonus
args.entities[#args.entities + 1] = {name = Common.get_random_worm_type(evolution + 0.05), position = p, force = enemy_force_name}
end

View File

@ -42,29 +42,29 @@ function Public.silo_setup_position(x_fractional_offset, x_absolute_offset)
local tries = 0
local p_ret = nil
local p2 = nil
while p_ret == nil and tries < 80 do
while p_ret == nil and tries < 200 do
p2 = {x = p.x + Math.random(-30, 0), y = p.y + Math.random(-70, 70)}
if p2.x >= boatposition.x+5 and Common.can_place_silo_setup(surface, p2, silo_count) then p_ret = p2 end
tries = tries + 1
end
while p_ret == nil and tries < 240 do
while p_ret == nil and tries < 400 do
p2 = {x = p.x + Math.random(-60, 10), y = p.y + Math.random(-90, 90)}
if p2.x >= boatposition.x+5 and Common.can_place_silo_setup(surface, p2, silo_count) then p_ret = p2 end
tries = tries + 1
end
while p_ret == nil and tries < 560 do
while p_ret == nil and tries < 1200 do
p2 = {x = p.x + Math.random(-90, 20), y = p.y + Math.random(-130, 130)}
if p2.x >= boatposition.x+5 and Common.can_place_silo_setup(surface, p2, silo_count) then p_ret = p2 end
tries = tries + 1
end
if _DEBUG then
-- if _DEBUG then
if p_ret == nil then
log("No good position found after 500 tries")
log("No good position found after 1200 tries")
p_ret = p
else
log(string.format("Silo position generated after %f tries: %f, %f", tries, p_ret.x, p_ret.y))
end
end
-- end
Common.ensure_chunks_at(surface, p_ret, 1)
return p_ret

View File

@ -266,7 +266,7 @@ local function radioactive_tick()
local ef = game.forces[memory.enemy_force_name]
-- faster evo (doesn't need difficulty scaling as higher difficulties have higher base evo):
local extra_evo = 0.22 * tickinterval/60 / Balance.expected_time_on_island()
ef.evolution_factor = ef.evolution_factor + extra_evo
Common.increment_evo(extra_evo)
if (not destination.dynamic_data.evolution_accrued_time) then
destination.dynamic_data.evolution_accrued_time = 0
end

View File

@ -250,7 +250,7 @@ function Public.underground_worms_ai()
local surface = game.surfaces[destination.surface_name]
local player_force = game.forces[memory.force_name]
local enemy_force_name = memory.enemy_force_name
local evolution = game.forces[enemy_force_name].evolution_factor
local evolution = memory.evolution_factor
if not destination.dynamic_data.worms_table then destination.dynamic_data.worms_table = {} end
@ -359,7 +359,7 @@ function Public.custom_biter_ai()
local surface = game.surfaces[destination.surface_name]
local difficulty = memory.difficulty
local enemy_force_name = memory.enemy_force_name
local evolution = game.forces[enemy_force_name].evolution_factor
local evolution = memory.evolution_factor
local fraction_of_floating_pollution = 1/2
local minimum_avg_units = 30

View File

@ -26,7 +26,7 @@ function Public.base_ores()
['iron-ore'] = 2.0,
['coal'] = 6.8,
['stone'] = 0.5,
['crude-oil'] = 15,
['crude-oil'] = 40,
}
end

View File

@ -22,7 +22,7 @@ function Public.base_ores()
['copper-ore'] = 1.7,
['iron-ore'] = 2.2,
['coal'] = 4,
['crude-oil'] = 35,
['crude-oil'] = 80,
}
end

View File

@ -165,7 +165,7 @@ local function on_entity_destroyed(event)
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)
local name = Common.get_random_unit_type(memory.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)
@ -173,7 +173,7 @@ local function on_entity_destroyed(event)
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
Common.increment_evo(evo_increase)
end
end

View File

@ -229,7 +229,7 @@ function Public.destination_on_arrival(destination)
game.forces[memory.enemy_force_name].reset_evolution()
local base_evo = Balance.base_evolution()
game.forces[memory.enemy_force_name].evolution_factor = base_evo
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
@ -268,11 +268,6 @@ function Public.destination_on_arrival(destination)
-- end
-- end
-- heal all cannons:
local cannons = game.surfaces[destination.surface_name].find_entities_filtered({type = 'artillery-turret'})
for _, c in pairs(cannons) do
c.health = c.prototype.max_health
end
end
local name = destination.static_params.name and destination.static_params.name or 'NameNotFound'
@ -281,7 +276,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 .. ' ' .. 'A special offer is available in the Captain\'s Store.'
message = message .. ' ' .. 'New trades are in the Captain\'s Store.'
end
Common.notify_force(game.forces[memory.force_name], message)
@ -462,10 +457,11 @@ function Public.generate_detailed_island_data(destination)
if #positions_free_to_hold_resources > 0 then
local orestoadd = {}
for k, v in pairs(destination.static_params.abstract_ore_amounts) do
local count = Math.ceil(v^(1/2))
if k == 'crude-oil' then
local count = Math.ceil((v/20)^(1/2)) --assuming the abstract values are about 20 times as big as for other ores
orestoadd[k] = {count = count, sizing_each = Common.oil_abstract_to_real(v)/count}
else
local count = Math.ceil(v^(1/2))
orestoadd[k] = {count = count, sizing_each = Common.ore_abstract_to_real(v)/count}
end
end
@ -633,7 +629,7 @@ function Public.clean_up(destination)
if ef and ef.valid then
game.forces[memory.enemy_force_name].reset_evolution()
local base_evo = Balance.base_evolution()
game.forces[memory.enemy_force_name].evolution_factor = base_evo
Common.set_evo(base_evo)
end
end

View File

@ -92,7 +92,7 @@ function Public.prevent_disembark(tickinterval)
end
for _, player in pairs(game.connected_players) do
if player.surface and player.surface.valid and boat.surface_name and player.surface.name == boat.surface_name and ps[player.index] and (not Boats.on_boat(boat, player.position)) then
if player.surface and player.surface.valid and boat.surface_name and player.surface.name == boat.surface_name and ps[player.index] and (not Boats.on_boat(boat, player.position)) and (not (player.controller_type == defines.controllers.spectator)) then
Common.notify_player_error(player, 'Now is no time to disembark.')
-- player.teleport(memory.spawnpoint)
local p = player.surface.find_non_colliding_position('character', memory.spawnpoint, 5, 0.1)
@ -207,7 +207,7 @@ function Public.captain_warn_afk(tickinterval)
if memory.playerindex_captain then
for _, player in pairs(game.connected_players) do
if player.index == memory.playerindex_captain and #Common.crew_get_nonafk_crew_members() > 1 and player.afk_time >= Common.afk_time - 20*60 - 60 - tickinterval and player.afk_time < Common.afk_time - 20*60 then
if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() > 1 and player.afk_time >= Common.afk_time - 20*60 - 60 - tickinterval and player.afk_time < Common.afk_time - 20*60 then
Common.notify_player_expected(player, 'Note: If you go idle as captain for too long, the role passes to another crewmember.')
player.play_sound{path = 'utility/scenario_message'}
end
@ -981,7 +981,7 @@ function Public.silo_update(tickinterval)
local ef = game.forces[memory.enemy_force_name]
if ef and ef.valid then
local extra_evo = Balance.evolution_per_full_silo_charge() * e/destination.dynamic_data.rocketsiloenergyneeded
ef.evolution_factor = ef.evolution_factor + extra_evo
Common.increment_evo(extra_evo)
destination.dynamic_data.evolution_accrued_silo = destination.dynamic_data.evolution_accrued_silo + extra_evo
end
end
@ -1237,17 +1237,23 @@ function Public.update_players_second()
end
for _, player in pairs(connected_players) do
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
if player.afk_time < Common.afk_time then
playerindex_to_time_played_continuously[player.index] = playerindex_to_time_played_continuously[player.index] or 0
playerindex_to_time_played_continuously[player.index] = playerindex_to_time_played_continuously[player.index] + 1
playerindex_to_captainhood_priority[player.index] = playerindex_to_captainhood_priority[player.index] or 0
playerindex_to_captainhood_priority[player.index] = playerindex_to_captainhood_priority[player.index] + 1
if Common.is_captain(player) then
playerindex_to_captainhood_priority[player.index] = 0
else
playerindex_to_captainhood_priority[player.index] = playerindex_to_captainhood_priority[player.index] or 0
playerindex_to_captainhood_priority[player.index] = playerindex_to_captainhood_priority[player.index] + 1
end
else
playerindex_to_time_played_continuously[player.index] = nil
playerindex_to_captainhood_priority[player.index] = nil
playerindex_to_time_played_continuously[player.index] = 0
playerindex_to_captainhood_priority[player.index] = 0
end
end
global_memory.playerindex_to_captainhood_priority = playerindex_to_captainhood_priority
@ -1267,8 +1273,8 @@ function Public.update_players_second()
for _, index in pairs(afk_player_indices) do
local player = game.players[index]
local crew_id = tonumber(string.sub(player.force.name, -3, -1)) or nil
Memory.set_working_id(crew_id)
Roles.afk_player_tick(player)
Memory.set_working_id(crew_id)
Roles.afk_player_tick(player)
end
end

View File

@ -63,7 +63,7 @@ function Public.update_character_properties(tickinterval)
health_boost = health_boost + 800
end
end
if memory.playerindex_captain and memory.playerindex_captain == player_index then
if Common.is_captain(player) then
health_boost = health_boost + 50
end
character.character_health_bonus = health_boost