1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-11 14:49:24 +02:00
This commit is contained in:
danielmartin0 2022-02-25 00:01:28 +00:00
parent c59e80161a
commit 80de04709c
21 changed files with 862 additions and 97 deletions

View File

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

View File

@ -13,10 +13,10 @@ 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• After the first island, the ship makes ore over time.\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• Time increase in evolution, and the strength of attacks, are both proportional to the number of remaining nests. However, destroying a nest will immediately jump evolution by roughly the amount it 'would have' made had it survived. \n• At Abandoned Labs, biters don't care if you emit pollution. They only care how long you stay.\n• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.
softmod_info_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• Time increase in evolution, and the strength of attacks, are both proportional to the number of remaining nests. However, destroying a nest will immediately jump evolution by roughly the amount it 'would have' made had it survived. \n• At Abandoned Labs, biters don't care if you emit pollution. They only care how long you stay.\n• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.
softmod_info_updates_1=Development
softmod_info_updates_2=Pirate Ship 1.0.3 is released! The gameplay is reworked to center around a fuel mechanic. This should make for a clear central objective. We're currently in a testing phase... please play and help us tune the numbers :)
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 :)
softmod_info_credits_1=Credits
softmod_info_credits_2=Softmod designed and written by thesixthroc. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Most island structure blueprints contributed by Mattisso.\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John

View File

@ -78,7 +78,7 @@ end
function Public.max_time_on_island_formula()
return 60 * (
(31 + 2 * (Common.overworldx()/40)^(1/3))
(33 + 2 * (Common.overworldx()/40)^(1/3))
) / Public.onthefly_scaling_with_players_rule()^(2/3) / Math.sloped(Common.difficulty(), 1/4)
end
@ -100,13 +100,13 @@ function Public.fuel_depletion_rate_static()
local T = Public.expected_time_on_island() --always >0
return - 1000 * (Common.overworldx()/40)^(2/5) / T
return - 1200 * (Common.overworldx()/40)^(1/2) / T * Public.onthefly_scaling_with_players_rule()^(1/3) --the extra player dependency accounts for the fact that even in compressed time, more players get more resources...
end
function Public.fuel_depletion_rate_sailing()
if (not Common.overworldx()) then return 0 end
return - 10 * (1 + (Common.overworldx()/40)^(1/5))
return - 10 * (1 + (Common.overworldx()/40)^(4/5))
end
function Public.boat_passive_pollution_per_minute(time)
@ -197,18 +197,19 @@ end
function Public.periodic_free_resources_per_x(x)
-- return {
-- {name = 'iron-plate', count = Math.ceil(6 * (Common.overworldx()/40)^(2/3) * Math.sloped(Common.capacity_scale(), 1/2))},
-- {name = 'copper-plate', count = Math.ceil(1 * (Common.overworldx()/40)^(2/3) * Math.sloped(Common.capacity_scale(), 1/2))},
-- }
return {}
return {
{name = 'iron-plate', count = Math.ceil(5 * (Common.overworldx()/40)^(2/3))},
{name = 'copper-plate', count = Math.ceil(1 * (Common.overworldx()/40)^(2/3))},
}
end
function Public.periodic_free_resources_per_destination_5_seconds(x)
return {
{name = 'iron-ore', count = Math.ceil(7 * (Common.overworldx()/40)^(0.6))},
{name = 'copper-ore', count = Math.ceil(3 * (Common.overworldx()/40)^(0.6))},
}
-- return {
-- {name = 'iron-ore', count = Math.ceil(7 * (Common.overworldx()/40)^(0.6))},
-- {name = 'copper-ore', count = Math.ceil(3 * (Common.overworldx()/40)^(0.6))},
-- }
end
function Public.class_resource_scale()

View File

@ -32,7 +32,7 @@ local Token = require 'utils.token'
local Task = require 'utils.task'
local Highscore = require 'maps.pirates.highscore'
local GUIcolor = require 'maps.pirates.gui.color'
commands.add_command(
'ok',
@ -55,17 +55,17 @@ function(cmd)
if player_index then
local player = game.players[player_index]
if player and player.valid then
game.print(param)
if cmd.parameter then
if PlayerColors[param] then
player.color = PlayerColors[param]
player.chat_color = PlayerColors[param]
game.print(player.name .. '\'s color is now ' .. param .. ' (via /ccolor).', PlayerColors[param])
if PlayerColors.colors[param] then
player.color = PlayerColors.colors[param]
player.chat_color = PlayerColors.colors[param]
game.print(player.name .. '\'s color is now ' .. param .. ' (via /ccolor).', PlayerColors.colors[param])
else
player.print('Color not found.')
end
else
player.print('Try going to https://github.com/danielmartin0/ComfyFactorio-Pirates/blob/develop/maps/pirates/player_colors.lua')
-- disabled due to lag:
-- GUIcolor.toggle_window(player)
end
end
end

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.0'
Public.version_float = 1.030
Public.version_string = '1.0.3.1'
Public.version_float = 1.031
Public.victory_x = 1000

View File

@ -0,0 +1,55 @@
local Memory = require 'maps.pirates.memory'
local Utils = require 'maps.pirates.utils_local'
local Math = require 'maps.pirates.math'
local GuiCommon = require 'maps.pirates.gui.common'
local PlayerColors = require 'maps.pirates.player_colors'
local Public = {}
local window_name = 'color'
function Public.toggle_window(player)
local flow, flow2, flow3, flow4, flow5, flow6
if player.gui.screen[window_name .. '_piratewindow'] then player.gui.screen[window_name .. '_piratewindow'].destroy() return end
flow = GuiCommon.new_window(player, window_name)
flow.caption = 'Colors!'
flow.style.width = 500
flow.style.height = 500
-- local label = ''
-- for i, v in ipairs(PlayerColors.names) do
-- if i>1 then label = label .. ', ' end
-- local c = PlayerColors.colors[v]
-- label = label .. ', [color=' .. c.r .. ',' .. c.g .. ',' .. c.b .. ']' .. v .. '[/color]'
-- -- label = label .. v
-- end
-- log(label)
flow2 = flow.add({
name = 'colors',
type = 'text-box',
text = PlayerColors.printable,
})
flow2.word_wrap = true
flow2.read_only = true
flow2.selectable = true
flow2.style.width = 450
flow2.style.height = 400
flow2 = GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton')
end
function Public.update(player)
end
function Public.click(event)
end
return Public

View File

@ -36,6 +36,7 @@ Public.default_window_positions = {
progress = {x = 250, y = 48},
fuel = {x = 468, y = 48},
minimap = {x = 10, y = 48},
color = {x = 160, y = 96},
}

View File

@ -456,6 +456,17 @@ function Public.click(event)
end
-- if eventname == 'promote_officer' then
-- Roles.promote_to_officer(player)
-- return
-- end
-- if eventname == 'demote_officer' then
-- Roles.demote_to_officer(player)
-- return
-- end
if string.sub(eventname, 1, 13) and string.sub(eventname, 1, 13) == 'assign_class_' then
local other_id = tonumber(flow.members.body.members_listbox.get_item(flow.members.body.members_listbox.selected_index)[2])
Roles.assign_class(other_id, tonumber(string.sub(eventname, 14, -1)))

View File

@ -30,6 +30,7 @@ Public.crew = require 'maps.pirates.gui.crew'
Public.fuel = require 'maps.pirates.gui.shop'
Public.minimap = require 'maps.pirates.gui.minimap'
Public.info = require 'maps.pirates.gui.info'
Public.color = require 'maps.pirates.gui.color'
@ -681,7 +682,7 @@ function Public.update_gui(player)
flow1.silo_progressbar.visible = false
-- 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('Launch: %.0f[item=sulfur] , ' .. Balance.rocket_launch_coin_reward .. '[item=coin]', destination.dynamic_data.rocketcoalreward)
flow1.silo_label_1.caption = string.format('Launch: %.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
else
local tooltip = 'The rocket is launching...'

View File

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

View File

@ -29,7 +29,7 @@ local Crew = require 'maps.pirates.crew'
local Quest = require 'maps.pirates.quest'
local Shop = require 'maps.pirates.shop.shop'
local Loot = require 'maps.pirates.loot'
local Antigrief = require 'antigrief'
local Antigrief = require 'utils.antigrief'
local Task = require 'utils.task'
local Token = require 'utils.token'
local Classes = require 'maps.pirates.roles.classes'
@ -47,7 +47,7 @@ function Public.silo_died()
destination.dynamic_data.rocketsilohp = 0
if destination.dynamic_data.rocketsilos and destination.dynamic_data.rocketsilos[1] and destination.dynamic_data.rocketsilos[1].valid then
local surface = destination.dynamic_data.rocketsilos[1].surface
surface.create_entity({name = 'big-artillery-explosion', position = destination.dynamic_data.rocketsilo.position})
surface.create_entity({name = 'big-artillery-explosion', position = destination.dynamic_data.rocketsilos[1].position})
if memory.boat and memory.boat.surface_name and surface.name == memory.boat.surface_name then
-- Crew.lose_life()
@ -96,9 +96,9 @@ local function biters_chew_stuff_faster(event)
if (event.entity.force.index == 3 or event.entity.force.name == 'environment') then
event.entity.health = event.entity.health - event.final_damage_amount * 5
elseif event.entity.name == 'stone-furnace' then
event.entity.health = event.entity.health - event.final_damage_amount * 1
event.entity.health = event.entity.health - event.final_damage_amount * 0.75
elseif event.entity.name == 'wooden-chest' or event.entity.name == 'stone-chest' or event.entity.name == 'steel-chest' then
event.entity.health = event.entity.health - event.final_damage_amount * 0.25
event.entity.health = event.entity.health - event.final_damage_amount * 0.75
end
end
@ -443,7 +443,7 @@ local function event_on_player_mined_entity(event)
if memory.overworldx >= 0 then
if Math.random(6) == 1 then
give[#give + 1] = {name = 'coin', count = 8}
give[#give + 1] = {name = 'coin', count = 5}
end
end

View File

@ -7,7 +7,8 @@ local Server = require 'utils.server'
local inspect = require 'utils.inspect'.inspect
-- local Modifers = require 'player_modifiers'
local BottomFrame = require 'comfy_panel.bottom_frame'
local Autostash = require 'maps.pirates.from_comfy.autostash'
local Autostash = require 'modules.autostash'
-- local Autostash = require 'maps.pirates.from_comfy.autostash'
local TickFunctions = require 'maps.pirates.tick_functions'
local ClassTickFunctions = require 'maps.pirates.tick_functions_classes'

View File

@ -84,9 +84,12 @@ function Public.generate_overworld_destination(p)
subtype = Surfaces.Island.enum.STANDARD_VARIANT
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
elseif macrop.x == 4 then --biter boats appear
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.STANDARD
elseif macrop.x == 5 then
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.RED_DESERT
elseif macrop.x == 9 then --just before krakens
type = Surfaces.enum.ISLAND
subtype = Surfaces.Island.enum.HORSESHOE
@ -134,7 +137,7 @@ function Public.generate_overworld_destination(p)
local playercount = Common.activecrewcount()
local max_evo = 0.85
if Common.difficulty() < 1 then max_evo = 0.68 end
if macrop.x > 5 then
if macrop.x > 4 then
scheduled_raft_raids = {}
local times = {600, 360, 215, 210, 120, 30, 10, 5}
for i = 1, #times do
@ -144,7 +147,7 @@ function Public.generate_overworld_destination(p)
-- scheduled_raft_raids[#scheduled_raft_raids + 1] = {timeinseconds = t, max_bonus_evolution = 0.52}
end
end
elseif macrop.x == 5 then
elseif macrop.x == 4 then
local times
if playercount <= 2 then
times = {1, 5, 10, 15}
@ -333,8 +336,9 @@ function Public.generate_overworld_destination(p)
alignment = 'right',
visible = false,
}
--@TODO add coin cost here as well
dest.dynamic_data.crowsnest_rendering_2 = rendering.draw_sprite{
sprite = 'item/sulfur',
sprite = 'item/coal',
surface = surface,
target = {x = x + 7, y = y - 1.75},
x_scale = 6,

View File

@ -63,7 +63,7 @@ function Public.parrot_80()
end
function Public.parrot_boats_warning()
local memory = Memory.get_crew_memory()
Common.parrot_speak(game.forces[memory.force_name], '200 leagues? I think we\'re being chased...')
Common.parrot_speak(game.forces[memory.force_name], '160 leagues? I think we\'re being chased...')
end
function Public.parrot_kraken_warning()
local memory = Memory.get_crew_memory()

File diff suppressed because one or more lines are too long

View File

@ -265,7 +265,7 @@ function Public.captain_requisition_coins(captain_index)
local crew_members = memory.crewplayerindices
local captain = game.players[captain_index]
if not (captain and crew_members and #crew_members > 2) then return end
if not (captain and crew_members and #crew_members > 1) then return end
local captain_inv = captain.get_inventory(defines.inventory.character_main)

View File

@ -19,6 +19,7 @@ function Public.generate_merchant_trades(market)
if market and market.valid then
market.add_market_item{price={{'pistol', 1}}, offer={type = 'give-item', item = 'coin', count = 500}}
market.add_market_item{price={{'burner-mining-drill', 1}}, offer={type = 'give-item', item = 'iron-plate', count = 9}}
local game_completion_progress = Common.game_completion_progress()
if game_completion_progress <= 1 then

View File

@ -18,17 +18,17 @@ local Public = {}
Public.main_shop_data_1 = {
new_boat_cutter = {
tooltip = 'Purchase a cutter for 3000 stored fuel.',
tooltip = 'Purchase a cutter.',
what_you_get_sprite_buttons = {['utility/spawn_flag'] = false},
base_cost = {fuel = 3000},
},
new_boat_sloop_with_hold = {
tooltip = 'Purchase a sloop (with hold) for 3500 stored fuel.',
tooltip = 'Purchase a sloop (with hold).',
what_you_get_sprite_buttons = {['utility/spawn_flag'] = false},
base_cost = {fuel = 3500},
},
new_boat_cutter_with_hold = {
tooltip = 'Purchase a cutter (with hold) for 5000 stored fuel.',
tooltip = 'Purchase a cutter (with hold).',
what_you_get_sprite_buttons = {['utility/spawn_flag'] = false},
base_cost = {fuel = 5000},
},
@ -52,25 +52,26 @@ Public.main_shop_data_1 = {
-- what_you_get_sprite_buttons = {['item/sulfur'] = 100},
-- base_cost = {copper_plates = 2500},
-- },
-- as as initial pass let's try making the fuel values half of the old gold values...
[Upgrades.enum.MORE_POWER] = {
tooltip = 'Upgrade the ship\'s power for 2000 stored fuel.',
tooltip = 'Upgrade the ship\'s power.',
what_you_get_sprite_buttons = {['utility/status_working'] = false},
base_cost = {fuel = 2000},
base_cost = {coins = 5000, fuel = 1000},
},
[Upgrades.enum.EXTRA_HOLD] = {
tooltip = 'Upgrade the ship\'s hold for 4000 stored fuel.',
tooltip = 'Upgrade the ship\'s hold.',
what_you_get_sprite_buttons = {['item/steel-chest'] = false},
base_cost = {fuel = 4000},
base_cost = {coins = 10000, fuel = 2000},
},
[Upgrades.enum.ROCKETS_FOR_SALE] = {
tooltip = 'Unlock rockets for sale at covered-up markets, for 4000 stored fuel.',
tooltip = 'Unlock rockets for sale at covered-up markets.',
what_you_get_sprite_buttons = {['item/rocket-launcher'] = false},
base_cost = {fuel = 4000},
base_cost = {coins = 10000, fuel = 2000},
},
[Upgrades.enum.UNLOCK_MERCHANTS] = {
tooltip = 'Unlock merchant ships for 5000 stored fuel.',
tooltip = 'Unlock merchant ships.',
what_you_get_sprite_buttons = {['entity/market'] = false},
base_cost = {fuel = 5000},
base_cost = {coins = 10000, fuel = 2500},
},
}
@ -78,7 +79,7 @@ Public.main_shop_data_2 = {
rail_signal = {
tooltip = "100 signals, used to steer the boat once space in the Crow's Nest View.",
what_you_get_sprite_buttons = {['item/rail-signal'] = 100},
base_cost = {coins = 200},
base_cost = {coins = 500},
},
artillery_shell = {
tooltip = '10 cannon shells.',
@ -253,7 +254,7 @@ function Public.main_shop_try_purchase(name)
memory.mainshop_availability_bools[name] = false
elseif name == 'sell_iron' then
gotamount = trade_data.what_you_get_sprite_buttons['item/sulfur']
gotamount = trade_data.what_you_get_sprite_buttons['item/coal']
Common.give(captain, {{name = 'fuel', count = gotamount}})
Common.notify_force_light(force,string.format('%s is selling iron...', captain.name))
@ -273,7 +274,7 @@ function Public.main_shop_try_purchase(name)
-- Common.notify_force_light(force,string.format('%s bought a fast loader...', captain.name))
elseif name == 'sell_copper' then
gotamount = trade_data.what_you_get_sprite_buttons['item/sulfur']
gotamount = trade_data.what_you_get_sprite_buttons['item/coal']
Common.give(captain, {{name = 'fuel', count = gotamount}})
Common.notify_force_light(force,string.format('%s is selling copper...', captain.name))
@ -377,9 +378,9 @@ function Public.event_on_market_item_purchased(event)
if price[2] then
local fish = price[2].name
if fish == 'raw-fish' then fish = 'fish' end
Common.notify_force_light(player.force, player.name .. ' is trading away ' .. price[1].count .. ' ' .. price[1].name .. ' and ' .. fish .. ' to get ' .. this_offer.offer.item .. '...')
Common.notify_force_light(player.force, player.name .. ' is trading away ' .. price[1].amount .. ' ' .. price[1].name .. ' and ' .. fish .. ' to get ' .. this_offer.offer.item .. '...')
else
Common.notify_force_light(player.force, player.name .. ' is trading away ' .. price[1].count .. ' ' .. price[1].name .. ' to get ' .. this_offer.offer.item .. '...')
Common.notify_force_light(player.force, player.name .. ' is trading away ' .. price[1].amount .. ' ' .. price[1].name .. ' to get ' .. this_offer.offer.item .. '...')
end
end
end

View File

@ -24,9 +24,9 @@ function Public.base_ores()
return {
['copper-ore'] = 2.0,
['iron-ore'] = 2.0,
['coal'] = 3.4,
['coal'] = 5.4,
['stone'] = 0.5,
['crude-oil'] = 2.8,
['crude-oil'] = 3.8,
}
end

View File

@ -190,7 +190,7 @@ function Public.destination_on_collide(destination)
-- destination.static_params.scheduled_raft_raids = scheduled_raft_raids
end
if memory.overworldx == 40*5 then Parrot.parrot_boats_warning() end
if memory.overworldx == 40*4 then Parrot.parrot_boats_warning() end
if memory.overworldx == 600 then
Parrot.parrot_radioactive_tip_1()
elseif memory.overworldx == 800 then
@ -267,6 +267,12 @@ function Public.destination_on_arrival(destination)
-- Public.player_exit_crows_nest(player, {x = 5, y = 0})
-- 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'

View File

@ -439,8 +439,9 @@ function Public.place_cached_structures(tickinterval)
covered_data.market.destructible = false
-- @TODO: Add trades here
covered_data.market.add_market_item{price={{'pistol', 1}}, offer={type = 'give-item', item = 'coin', count = 500}}
covered_data.market.add_market_item{price={{'coin', Balance.class_cost()}}, offer={type="nothing"}}
covered_data.market.add_market_item{price={{'pistol', 1}}, offer={type = 'give-item', item = 'coin', count = 500}}
covered_data.market.add_market_item{price={{'burner-mining-drill', 1}}, offer={type = 'give-item', item = 'iron-plate', count = 9}}
local coin_offers = ShopCovered.market_generate_coin_offers(2)
for _, o in pairs(coin_offers) do