1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

Merge pull request #269 from danielmartin0/develop

Fixing some critical bugs
This commit is contained in:
Gerkiz 2022-05-24 18:03:07 +02:00 committed by GitHub
commit 69c205616d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 47 additions and 38 deletions

View File

@ -45,7 +45,9 @@ Public.rocket_launch_coin_reward = 6000
function Public.crew_scale()
local ret = Common.activecrewcount()/10
if ret == 0 then ret = 1/10 end --if all players are afk
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 capacity setting
if ret > 2.1 then ret = 2.1 end --An upper cap on this is important, for two reasons:
-- large crews become disorganised
-- Higher values of this scale lower the amount of time you get on each island. But the amount of time certain island tasks take is fixed; e.g. the amount of ore is mostly invariant, and you need time to mine it.
return ret
end
@ -105,7 +107,7 @@ function Public.max_time_on_island()
return -1
else
if x == 40 then
return 1.1 * Math.ceil(Public.max_time_on_island_formula()) --it's important for this island to be chill, so that it's not such a shock to go here from the first chill island
return 1.1 * Math.ceil(Public.max_time_on_island_formula()) --it's important for this island to be somewhat chill, so that it's not such a shock to go here from the first lobby chill island
else
return Math.ceil(Public.max_time_on_island_formula())
end
@ -191,7 +193,7 @@ function Public.base_evolution_leagues(leagues)
if overworldx > 600 and overworldx < 1000 then
evo = evo + (0.0025 * (overworldx - 600)/40)
elseif overworldx > 1000 then
elseif overworldx >= 1000 then
evo = evo + 0.0025 * 10
end --extra slope from 600 to 1000 adds 2.5% evo
end
@ -268,7 +270,7 @@ end
-- end
function Public.biter_timeofday_bonus_damage(darkness) -- a surface having min_brightness of 0.2 will cap this at 0.8
function Public.biter_timeofday_bonus_damage(darkness) -- a surface having min_brightness of 0.2 will cap darkness at 0.8
return 0.1 * darkness
end
@ -368,7 +370,7 @@ function Public.kraken_kill_reward_items()
return {{name = 'sulfuric-acid-barrel', count = 5}, {name = 'coin', count = 1000}}
end
function Public.kraken_kill_reward_fuel()
return 150
return 200
end
function Public.kraken_health()
@ -524,13 +526,12 @@ end
function Public.covered_entry_price_scale()
return 0.85 * (1 + 0.033 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/3)) * Math.sloped(Common.difficulty_scale(), 1/2) --whilst resource scales tend to be held fixed with crew size, we account slightly for the fact that more players tend to handcraft more
return 0.85 * (1 + 0.033 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/3)) * Math.sloped(Common.difficulty_scale(), 1/2) --whilst the scenario philosophy says that resource scales tend to be independent of crew size, we account slightly for the fact that more players tend to handcraft more
end
-- if the prices are too high, players will accidentally throw too much in when they can't do it
Public.covered1_entry_price_data_raw = { --watch out that the raw_materials chest can only hold e.g. 4.8 iron-plates
-- choose things that are easy to make at outposts
-- if the prices are too high, players will accidentally throw too much in when they can't do it
{1, 0, 1, false, {
price = {name = 'iron-stick', count = 1500},
raw_materials = {{name = 'iron-plate', count = 750}}}, {}},

View File

@ -9,6 +9,9 @@ local _inspect = require 'utils.inspect'.inspect
-- local perlin_noise = require 'utils.perlin_noise'
-- local Force_health_booster = require 'modules.force_health_booster'
-- == Common variables and functions used throughout pirate ship files
local Public = {}
-- Public.active_crews_cap = 1
@ -735,6 +738,7 @@ end
function Public.entity_damage_healthbar(entity, damage, location_override)
location_override = location_override or Memory.get_crew_memory()
local unit_number = entity.unit_number
if not (location_override.healthbars) then return end
local healthbar = location_override.healthbars[unit_number]
if not healthbar then return 0 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.2.2.2'
Public.version_float = 1.1222
Public.version_string = '1.2.2' --will now try to stick to major.minor.patch versioning, to match factorio mod portal
Public.version_float = 1.22
Public.blueprint_library_allowed = true
Public.blueprint_importing_allowed = true

View File

@ -664,7 +664,7 @@ function Public.initialise_crew(accepted_proposal)
global_memory.crew_active_ids[#global_memory.crew_active_ids + 1] = new_id
Memory.reset_crew_memory(new_id)
Memory.initialise_crew_memory(new_id)
Memory.set_working_id(new_id)
game.reset_time_played() -- affects the multiplayer lobby view

View File

@ -779,7 +779,7 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
if quest_complete and quest_reward then
tooltip = 'This island\'s quest is complete, and this is the reward.'
flow1.quest_label_1.caption = 'Quest:'
flow1.quest_label_1.caption = 'Island Quest:'
flow1.quest_label_1.style.font_color = GuiCommon.achieved_font_color
flow1.quest_label_2.visible = true
flow1.quest_label_3.visible = false
@ -787,7 +787,7 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
flow1.quest_label_2.caption = quest_reward.display_amount .. ' ' .. quest_reward.display_sprite
elseif quest_reward then
if quest_progress < quest_progressneeded then
flow1.quest_label_1.caption = 'Quest:'
flow1.quest_label_1.caption = 'Island Quest:'
flow1.quest_label_1.style.font_color = GuiCommon.bold_font_color
flow1.quest_label_2.visible = true
flow1.quest_label_3.visible = true
@ -801,7 +801,7 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
end
if quest_type == Quest.enum.TIME then
if tooltip == '' then tooltip = 'Quest: Time\n\nLaunch a rocket before the countdown completes for a bonus.' end
if tooltip == '' then tooltip = 'Island Quest: Time\n\nLaunch a rocket before the countdown completes for a bonus.' end
if quest_progress >= 0 then
flow1.quest_label_3.caption = string.format('%.0fm%.0fs', Math.floor(quest_progress / 60), quest_progress % 60)
@ -824,13 +824,13 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
end
elseif quest_type == Quest.enum.WORMS then
if tooltip == '' then tooltip = 'Quest: Worms\n\nKill enough worms for a bonus.' end
if tooltip == '' then tooltip = 'Island Quest: Worms\n\nKill enough worms for a bonus.' end
elseif quest_type == Quest.enum.FIND then
if tooltip == '' then tooltip = 'Quest: Ghosts\n\nFind the ghosts for a bonus.' end
if tooltip == '' then tooltip = 'Island Quest: Ghosts\n\nFind the ghosts for a bonus.' end
elseif quest_type == Quest.enum.RESOURCEFLOW then
if tooltip == '' then tooltip = 'Quest: Resource Flow\n\nAchieve a production rate of a particular item for a bonus.' end
if tooltip == '' then tooltip = 'Island Quest: Resource Flow\n\nAchieve a production rate of a particular item for a bonus.' end
-- out of date:
if quest_progressneeded/60 % 1 == 0 then
@ -842,12 +842,12 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
end
elseif quest_type == Quest.enum.RESOURCECOUNT then
if tooltip == '' then tooltip = 'Quest: Item Production\n\nSimply produce a particular number of items for a bonus, anywhere on the map.' end
if tooltip == '' then tooltip = 'Island Quest: Item Production\n\nSimply complete production of these items for a bonus, anywhere on the map.' end
flow1.quest_label_2.caption = string.format('%s ', '[item=' .. quest_params.item .. ']')
elseif quest_type == Quest.enum.NODAMAGE then
if tooltip == '' then tooltip = 'Quest: No Damage\n\nLaunch a rocket without the silo taking damage.' end
if tooltip == '' then tooltip = 'Island Quest: No Damage\n\nLaunch a rocket without the silo taking damage.' end
if bools.approaching_bool or (dynamic_data.rocketsilos and dynamic_data.rocketsilos[1] and dynamic_data.rocketsilos[1].valid and dynamic_data.rocketsilohp == dynamic_data.rocketsilomaxhp) then
flow1.quest_label_3.caption = string.format('OK')

View File

@ -21,6 +21,9 @@ local score_key_debug = 'pirate_ship_scores_debug'
local score_key_modded = 'pirate_ship_scores_modded'
-- == This code is mostly a fork of the file from Mountain Fortress
local Public = {}
local insert = table.insert
local this = {

View File

@ -42,7 +42,7 @@ Public.buried_treasure_loot_data_raw = {
Public.chest_loot_data_raw = {
{80, 0, 1, false, 'coin', 400, 700},
{30, 0, 1, false, 'rail-signal', 25, 110},
{30, 0, 1, false, 'rail-signal', 50, 50},
{1, 0.2, 1, false, 'electric-engine-unit', 1, 2},
{3, 0, 1, false, 'small-lamp', 4, 16},
{10, 0, 1, false, 'coal', 60, 100},
@ -336,7 +336,7 @@ Public.maze_treasure_data_raw = {
{2, 0, 1, false, 'uranium-rounds-magazine', 15, 25},
{2, 0, 1, false, 'artillery-shell', 5, 7},
{2, 0, 1, false, 'rail-signal', 400, 500},
{2, 0, 1, false, 'rail-signal', 400, 400},
{2, 0, 1, false, 'electric-engine-unit', 3, 4},
{2, 0, 1, false, 'cluster-grenade', 8, 12},

View File

@ -40,7 +40,7 @@ end
function Public.reset_crew_memory(id) --mostly serves as a dev reference of memory entries
function Public.initialise_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] = {}

View File

@ -246,7 +246,7 @@ function Public.generate_overworld_destination(p)
local base_cost_4 = {
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100),
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18),
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*15),
['launch_rocket'] = true,
}
local base_cost_5 = {

View File

@ -41,7 +41,7 @@ function Public.fuel_depletion_rate()
if state == Boats.enum_state.ATSEA_SAILING or state == Boats.enum_state.APPROACHING then
return Balance.fuel_depletion_rate_sailing()
elseif state == Boats.enum_state.LEAVING_DOCK then
return Balance.fuel_depletion_rate_sailing() * 2
return Balance.fuel_depletion_rate_sailing() * 1.25
elseif state == Boats.enum_state.RETREATING then
return Balance.fuel_depletion_rate_sailing() / 4
elseif state == Boats.enum_state.LANDED then

View File

@ -39,7 +39,7 @@ function Public.generate_merchant_trades(market)
market.add_market_item{price = {{'coin', 5000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'energy-shield-mk2-equipment', count = 1}}
market.add_market_item{price = {{'coin', 4000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-roboport-mk2-equipment', count = 1}}
market.add_market_item{price = {{'coin', 8000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'exoskeleton-equipment', count = 1}}
market.add_market_item{price = {{'coin', 10000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-laser-defense', count = 1}}
market.add_market_item{price = {{'coin', 10000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment', count = 1}}
-- else
-- market.add_market_item{price = {{'coin', 18000}, {'raw-fish', 100}}, offer = {type = 'give-item', item = 'power-armor', count = 1}}
-- market.add_market_item{price = {{'coin', 24000}, {'raw-fish', 100}}, offer = {type = 'give-item', item = 'power-armor-mk2', count = 1}}
@ -50,7 +50,7 @@ function Public.generate_merchant_trades(market)
-- market.add_market_item{price = {{'coin', 5000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'energy-shield-mk2-equipment', count = 1}}
-- market.add_market_item{price = {{'coin', 4000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-roboport-mk2-equipment', count = 1}}
-- market.add_market_item{price = {{'coin', 8000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'exoskeleton-equipment', count = 1}}
-- market.add_market_item{price = {{'coin', 10000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-laser-defense', count = 1}}
-- market.add_market_item{price = {{'coin', 10000}, {'raw-fish', 10}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment', count = 1}}
end
end

View File

@ -23,11 +23,11 @@ Public.Minimarket = require 'maps.pirates.shop.dock'
function Public.print_transaction(player, offer, price)
function Public.print_transaction(player, offer_itemname, offer_itemcount, price)
local s1 = ' traded away '
local s2 = ''
local s3 = offer.count .. ' ' .. offer.item
if offer.item == 'coin' then s1 = ' sold ' end
local s3 = offer_itemcount .. ' ' .. offer_itemname
if offer_itemname == 'coin' then s1 = ' sold ' end
for i, p in pairs(price) do
local p2 = {name = p.name, amount = p.amount}
if p2.name == 'raw-fish' then p2.name = 'fish' end
@ -104,6 +104,7 @@ local function purchaseData(market, player, offer_index)
end
return {
alloffers = alloffers,
decay_type = decay_type,
price = price,
offer_type = offer_type,
@ -253,7 +254,7 @@ function Public.event_on_market_item_purchased(event)
refunds = refunds + 1
end
else
Common.notify_force_light(player.force, player.name .. ' bought ' .. thisPurchaseData.this_offer.offer.count .. ' ' .. thisPurchaseData.this_offer.offer.item .. ' for ' .. thisPurchaseData.price[1].amount .. ' ' .. thisPurchaseData.price[1].name .. '.')
Common.notify_force_light(player.force, player.name .. ' bought ' .. thisPurchaseData.offer_giveitem_count .. ' ' .. thisPurchaseData.offer_giveitem_name .. ' for ' .. thisPurchaseData.price[1].amount .. ' ' .. thisPurchaseData.price[1].name .. '.')
market.remove_market_item(offer_index)
end
@ -280,7 +281,7 @@ function Public.event_on_market_item_purchased(event)
local price_name = thisPurchaseData.price[1].name
Common.notify_force_light(player.force, player.name .. ' bought extra time at sea for ' .. thisPurchaseData.price[1].amount .. ' ' .. price_name .. '.')
else
Public.print_transaction(player, thisPurchaseData.this_offer.offer, thisPurchaseData.price)
Public.print_transaction(player, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count, thisPurchaseData.price)
end
end
end
@ -302,8 +303,8 @@ function Public.event_on_market_item_purchased(event)
if thisPurchaseData.decay_type == 'static' then
if not inv then return end
local flying_text_color = {r = 255, g = 255, b = 255}
local text1 = '[color=1,1,1]+' .. thisPurchaseData.this_offer.offer.count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.alloffers[offer_index].offer.item) .. ')[/color]'
local text1 = '[color=1,1,1]+' .. thisPurchaseData.offer_giveitem_count .. '[/color] [item=' .. thisPurchaseData.offer_giveitem_name .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.offer_giveitem_name) .. ')[/color]'
Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]')
else
@ -312,8 +313,8 @@ function Public.event_on_market_item_purchased(event)
if not inv then return end
local flying_text_color = {r = 255, g = 255, b = 255}
local text1 = '[color=1,1,1]+' .. thisPurchaseData.this_offer.offer.count .. '[/color] [item=' .. thisPurchaseData.alloffers[offer_index].offer.item .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.this_offer.offer.item) .. ')[/color]'
local text1 = '[color=1,1,1]+' .. thisPurchaseData.offer_giveitem_count .. '[/color] [item=' .. thisPurchaseData.offer_giveitem_name .. ']'
local text2 = '[color=' .. flying_text_color.r .. ',' .. flying_text_color.g .. ',' .. flying_text_color.b .. '](' .. inv.get_item_count(thisPurchaseData.offer_giveitem_name) .. ')[/color]'
Common.flying_text(player.surface, player.position, text1 .. ' [font=count-font]' .. text2 .. '[/font]')
@ -329,8 +330,8 @@ function Public.event_on_market_item_purchased(event)
end
end
if thisPurchaseData.this_offer.offer.item == 'coin' and refunds < trade_count then
memory.playtesting_stats.coins_gained_by_markets = memory.playtesting_stats.coins_gained_by_markets + thisPurchaseData.this_offer.offer.count
if thisPurchaseData.offer_giveitem_name and thisPurchaseData.offer_giveitem_name == 'coin' and refunds < trade_count then
memory.playtesting_stats.coins_gained_by_markets = memory.playtesting_stats.coins_gained_by_markets + thisPurchaseData.offer_giveitem_count
end
end

View File

@ -101,7 +101,7 @@ Public.cabin_shop_data = {
offer = {type='give-item', item = 'artillery-shell', count = 5},
},
{
price = {{'coin', 1000}, {'electronic-circuit', 30}},
price = {{'coin', 1000}, {'electronic-circuit', 25}},
offer = {type='give-item', item = 'rail-signal', count = 100},
},
{