1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00

Merge pull request #350 from Piratux/develop

Bug fixes and dock market offer tweaks
This commit is contained in:
Gerkiz 2022-10-31 12:18:27 +01:00 committed by GitHub
commit bbddb0328f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 101 additions and 70 deletions

View File

@ -16,7 +16,7 @@ softmod_info_tips_1=Features of the game that are hard to work out alone
softmod_info_tips_2=• The captain can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo drains power from everything else on its network.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by most of the amount it 'would have' made had it survived.)\n• Lab productivity increases with each league.\n• item-on-ground entities on the deck are moved to the cabin when the boat moves, for performance reasons.\n• Commands: /ccolor gives you a fun color. /classinfo {classname} gives the description of the named class. To manage your class, use /take {classname} or /giveup.
softmod_info_updates_1=Significant recent changes
softmod_info_updates_2=v1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes.\n\nv1.3.1-v1.3.5\n• Bugfixes.\n• Rebalancings, including: iron ore amounts buffed; kraken reward improved; final resource requirement increased; overall difficulty reduced.\n• Minor reordering of islands.\n• An officer will now be prioritised for the captain role if the captain disconnects.
softmod_info_updates_2=v1.4.1\n• Cannon upgrade is now more expensive and appears less often.\n• Bugfixes.\n\nv1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes.\n\nv1.3.1-v1.3.5\n• Bugfixes.\n• Rebalancings, including: iron ore amounts buffed; kraken reward improved; final resource requirement increased; overall difficulty reduced.\n• Minor reordering of islands.\n• An officer will now be prioritised for the captain role if the captain disconnects.
softmod_info_credits_1=Credits
softmod_info_credits_2=Pirate Ship designed and coded by thesixthroc. Updates from Piratux. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Some island structure blueprints contributed by Mattisso.\n\nCome chat with us: https://getcomfy.eu/discord\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John
@ -202,6 +202,7 @@ upgrade_hold_crowsnest_form=Extra Hold
upgrade_power_crowsnest_form=Power
upgrade_merchants_crowsnest_form=Unlock Merchants
upgrade_rockets_crowsnest_form=Unlock Rockets
upgrade_cannons_crowsnest_form=Upgrade Cannons

View File

@ -1100,7 +1100,8 @@ local function base_kill_rewards(event)
local short_form = (not iron_amount) and true or false
if revenge_target then
-- revenge_target.player can be nil if player kills itself
if revenge_target and revenge_target.player then
Common.give(revenge_target.player, stack, revenge_target.player.position, short_form, entity.surface, entity.position)
else
if event.cause and event.cause.valid and event.cause.position then

View File

@ -30,6 +30,7 @@ local enum = {
MORE_POWER = 'upgrade_power',
UNLOCK_MERCHANTS = 'unlock_merchants',
ROCKETS_FOR_SALE = 'rockets_for_sale',
UPGRADE_CANNONS = 'upgrade_cannons', -- heal and upgrade all ship's artilerry turrets max health
}
Public.enum = enum
Public.List = {
@ -37,6 +38,7 @@ Public.List = {
enum.MORE_POWER,
enum.UNLOCK_MERCHANTS,
enum.ROCKETS_FOR_SALE,
enum.UPGRADE_CANNONS,
}
Public.crowsnest_display_form = {
@ -44,6 +46,7 @@ Public.crowsnest_display_form = {
[enum.MORE_POWER] = {'pirates.upgrade_power_crowsnest_form'},
[enum.UNLOCK_MERCHANTS] = {'pirates.upgrade_merchants_crowsnest_form'},
[enum.ROCKETS_FOR_SALE] = {'pirates.upgrade_rockets_crowsnest_form'},
[enum.UPGRADE_CANNONS] = {'pirates.upgrade_cannons_crowsnest_form'},
}
-- WARNING: The dock market pulls from these values, but the Crowsnest caption pulls data from main_shop_data_1. So don't change one without the other
@ -52,6 +55,7 @@ Public.market_offer_form = {
[enum.EXTRA_HOLD] = {price = {{'coin', 7000}, {'coal', 500}}, offer = {type='nothing', effect_description={'pirates.market_description_upgrade_hold'}}},
[enum.UNLOCK_MERCHANTS] = {price = {{'coin', 14000}, {'coal', 1000}}, offer = {type='nothing', effect_description={'pirates.market_description_upgrade_merchants'}}},
[enum.ROCKETS_FOR_SALE] = {price = {{'coin', 21000}, {'coal', 1000}}, offer = {type='nothing', effect_description={'pirates.market_description_upgrade_rockets'}}},
[enum.UPGRADE_CANNONS] = {price = {{'repair-pack', 20}, {'coin', 5000}, {'coal', 800}}, offer = {type='nothing', effect_description={'pirates.market_description_upgrade_rockets'}}},
}
function Public.execute_upgade(upgrade_type, player)
@ -61,25 +65,34 @@ function Public.execute_upgade(upgrade_type, player)
if upgrade_type == enum.EXTRA_HOLD then
if player then
Common.notify_force(player.force,{'pirates.upgrade_hold',player.name})
Common.notify_force(player.force, {'pirates.upgrade_hold', player.name})
end
Hold.add_another_hold_surface()
elseif upgrade_type == enum.MORE_POWER then
if player then
Common.notify_force(player.force, {'pirates.upgrade_power',player.name})
Common.notify_force(player.force, {'pirates.upgrade_power', player.name})
end
boat.EEI_stage = boat.EEI_stage + 1
Boats.update_EEIs(boat)
elseif upgrade_type == enum.UNLOCK_MERCHANTS then
if player then
Common.notify_force(player.force,{'pirates.upgrade_merchants',player.name})
Common.notify_force(player.force, {'pirates.upgrade_merchants', player.name})
end
memory.merchant_ships_unlocked = true
elseif upgrade_type == enum.ROCKETS_FOR_SALE then
if player then
Common.notify_force(player.force,{'pirates.upgrade_rockets',player.name})
Common.notify_force(player.force, {'pirates.upgrade_rockets', player.name})
end
memory.rockets_for_sale = true
elseif upgrade_type == enum.UPGRADE_CANNONS then
if player then
Common.notify_force(player.force, {'pirates.upgraded_cannons', player.name})
end
Boats.upgrade_cannons()
end
end

View File

@ -7,7 +7,7 @@ local _inspect = require 'utils.inspect'.inspect
local Public = {}
Public.scenario_id_name = 'pirates'
Public.version_string = '1.4.0' --major.minor.patch versioning, to match factorio mod portal
Public.version_string = '1.4.1' --major.minor.patch versioning, to match factorio mod portal
Public.blueprint_library_allowed = true
Public.blueprint_importing_allowed = true
@ -98,7 +98,7 @@ Public.comfy_emojis = {
spurdo = '<:spurdo:669546779360100382>',
loops = '<:loops:783508194755346462>',
ree1 = '<:ree1:555118905090244618>',
derp = '<:derp:527570293850505266>',
derp = '<:derp:1024006042360742028>',
-- doge = '<:doge:491152224681066496>', -- deprecated
yum1 = '<:yum1:740341272451219517>',
feel = '<:feel:491147760553164800>',

View File

@ -362,9 +362,20 @@ function Public.generate_overworld_destination(p)
-- upgrade_for_sale = Upgrades.enum.MORE_POWER
-- else
-- upgrade_for_sale = Upgrades.enum.EXTRA_HOLD
-- end --upgrades like UNLOCK_MERCHANTS will slot themselves in when necessary, due to .overwrite_a_dock_upgrade()
-- end --upgrades like UNLOCK_MERCHANTS will slot themselves in when necessary, due to .overwrite_a_dock_upgrade() (not anymore)
-- one day it's worth making this system more readable
-- NOTE: When DOCK frequency changes, this needs to change too (kinda bad design, but w/e)
-- NOTE: I couldn't manage to make upgrade overwriting to work so I made it fixed here (although I prefer having fixed for less rng)
-- TODO: Perhaps always have something special to sell (or remove the upgrade market if it has no offers?)
if macro_p.x == 15 then
upgrade_for_sale = Upgrades.enum.ROCKETS_FOR_SALE
elseif macro_p.x == 19 then
upgrade_for_sale = Upgrades.enum.UNLOCK_MERCHANTS
elseif (macro_p.x % 8) == 3 then
upgrade_for_sale = Upgrades.enum.UPGRADE_CANNONS
end
local static_params = Utils.deepcopy(Dock.Data.static_params_default)
static_params.upgrade_for_sale = upgrade_for_sale
static_params.boat_for_sale_type = boat_for_sale_type
@ -626,7 +637,7 @@ function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves
Public.ensure_lane_generated_up_to(0, memory.overworldx + Crowsnest.Data.visibilitywidth)
Public.ensure_lane_generated_up_to(24, memory.overworldx + Crowsnest.Data.visibilitywidth)
Public.ensure_lane_generated_up_to(-24, memory.overworldx + Crowsnest.Data.visibilitywidth)
Public.overwrite_a_dock_upgrade()
-- Public.overwrite_a_dock_upgrade()
end
if not Public.is_position_free_to_move_to{x = memory.overworldx + vector.x, y = memory.overworldy+ vector.y} then
@ -684,20 +695,21 @@ function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves
end
-- UNUSED
function Public.overwrite_a_dock_upgrade()
local memory = Memory.get_crew_memory()
if (memory.overworldx % (40*8)) == (40*4-1) then -- pick a point that _must_ be visited, i.e. right before a destination
if (memory.overworldx) == (40*4-1) then -- LEAVE A GAP at x=40*11, because we haven't developed an upgrade to put there yet
for _, dest in pairs(memory.destinations) do
if dest.type == Surfaces.enum.DOCK then
if dest.overworld_position.x == memory.overworldx + 1 + (40*7) then
dest.static_params.upgrade_for_sale = Upgrades.enum.MORE_POWER
end
end
end
else
-- POWER upgrade is disabled at docks
-- if (memory.overworldx) == (40*4-1) then -- LEAVE A GAP at x=40*11, because we haven't developed an upgrade to put there yet
-- for _, dest in pairs(memory.destinations) do
-- if dest.type == Surfaces.enum.DOCK then
-- if dest.overworld_position.x == memory.overworldx + 1 + (40*7) then
-- dest.static_params.upgrade_for_sale = Upgrades.enum.MORE_POWER
-- end
-- end
-- end
-- else
local upgrade_to_overwrite_with
if not memory.dock_overwrite_variable then memory.dock_overwrite_variable = 1 end
@ -730,7 +742,7 @@ function Public.overwrite_a_dock_upgrade()
end
end
end
end
-- end
end
end

View File

@ -166,6 +166,13 @@ function Public.update_character_properties(tickinterval)
local player_index = player.index
local character = player.character
local class = Classes.get_class(player_index)
local speed_boost = Balance.base_extra_character_speed
if memory.speed_boost_characters and memory.speed_boost_characters[player_index] then
speed_boost = speed_boost * Balance.respawn_speed_boost
end
if class then
--local max_reach_bonus = 0
-- if memory.classes_table[player_index] == Classes.enum.DECKHAND then
@ -185,12 +192,7 @@ function Public.update_character_properties(tickinterval)
character.character_reach_distance_bonus = 0
end
local speed_boost = Balance.base_extra_character_speed
if memory.speed_boost_characters and memory.speed_boost_characters[player_index] then
speed_boost = speed_boost * Balance.respawn_speed_boost
elseif class == Classes.enum.SCOUT then
if class == Classes.enum.SCOUT then
speed_boost = speed_boost * Balance.scout_extra_speed
elseif (class == Classes.enum.DECKHAND) or (class == Classes.enum.BOATSWAIN) or (class == Classes.enum.SHORESMAN) then
local surfacedata = Surfaces.SurfacesCommon.decode_surface_name(player.surface.name)
@ -212,12 +214,13 @@ function Public.update_character_properties(tickinterval)
end
end
end
character.character_running_speed_modifier = speed_boost - 1
--character.character_reach_distance_bonus = max_reach_bonus
end
character.character_running_speed_modifier = speed_boost - 1
local health_boost = 0 -- base health is 250
character.character_health_bonus = health_boost
-- moved to damage resistance:
-- if memory.classes_table and memory.classes_table[player_index] then
@ -233,7 +236,6 @@ function Public.update_character_properties(tickinterval)
-- if Common.is_captain(player) then
-- health_boost = health_boost + 50
-- end
character.character_health_bonus = health_boost
-- == DO NOT DO THIS!: Removing inventory slots is evil. The player can spill inventory
-- if Common.is_captain(player) then

View File

@ -28,11 +28,11 @@ local Public = {}
-- WARNING: The Crowsnest caption pulls data from this data. But the actual dock market pulls from boat_upgrades.lua.
Public.main_shop_data_1 = {
upgrade_cannons = {
tooltip = 'Increase cannons max health. This will also repair them.',
what_you_get_sprite_buttons = {['item/artillery-turret'] = false},
base_cost = {coins = 1000},
},
-- upgrade_cannons = {
-- tooltip = 'Increase cannons max health. This will also repair them.',
-- what_you_get_sprite_buttons = {['item/artillery-turret'] = false},
-- base_cost = {coins = 1000},
-- },
new_boat_cutter = {
tooltip = 'Purchase a cutter.',
what_you_get_sprite_buttons = {['utility/spawn_flag'] = false},
@ -70,25 +70,30 @@ Public.main_shop_data_1 = {
-- },
-- 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.',
tooltip = {'pirates.market_description_upgrade_power'},
what_you_get_sprite_buttons = {['utility/status_working'] = false},
base_cost = {coins = 7000, fuel = 500},
},
[Upgrades.enum.EXTRA_HOLD] = {
tooltip = 'Upgrade the ship\'s hold.',
tooltip = {'pirates.market_description_upgrade_hold'},
what_you_get_sprite_buttons = {['item/steel-chest'] = false},
base_cost = {coins = 7000, fuel = 500},
},
[Upgrades.enum.UNLOCK_MERCHANTS] = {
tooltip = 'Unlock merchant ships.',
tooltip = {'pirates.market_description_upgrade_merchants'},
what_you_get_sprite_buttons = {['entity/market'] = false},
base_cost = {coins = 14000, fuel = 1000},
},
[Upgrades.enum.ROCKETS_FOR_SALE] = {
tooltip = 'Unlock rockets for sale at covered-up markets.',
tooltip = {'pirates.market_description_upgrade_rockets'},
what_you_get_sprite_buttons = {['item/rocket-launcher'] = false},
base_cost = {coins = 21000, fuel = 1000},
},
[Upgrades.enum.UPGRADE_CANNONS] = {
tooltip = {'pirates.market_description_upgrade_turrets'},
what_you_get_sprite_buttons = {['item/artillery-turret'] = false},
base_cost = {coins = 5000, fuel = 800},
},
}
Public.main_shop_data_2 = {

View File

@ -158,11 +158,6 @@ function Public.create_dock_markets(surface, p)
-- e.add_market_item{price = {{'repair-pack', 20}, {'coin', 1000}}, offer = {type = 'give-item', item = 'artillery-turret', count = 1}}
-- end
e.add_market_item({
price = {{'repair-pack', 20}, {'coin', 1000}},
offer = {type='nothing', effect_description={'pirates.market_description_upgrade_turrets'}}
})
local upgrade_for_sale = Common.current_destination().static_params.upgrade_for_sale
if upgrade_for_sale then
e.add_market_item(Upgrades.market_offer_form[upgrade_for_sale])

View File

@ -205,32 +205,13 @@ function Public.event_on_market_item_purchased(event)
Public.refund_items(player, thisPurchaseData.price, 1)
refunds = refunds + 1
else
if thisPurchaseData.offer_type == 'nothing' then
-- heal and upgrade all ship's artilerry turrets:
local cannons = game.surfaces[destination.surface_name].find_entities_filtered({type = 'artillery-turret'})
for _, c in pairs(cannons) do
local unit_number = c.unit_number
local healthbar = memory.boat.healthbars[unit_number]
if healthbar then
healthbar.max_health = healthbar.max_health + Balance.cannon_extra_hp_for_upgrade
healthbar.health = healthbar.max_health
Common.update_healthbar_rendering(healthbar, healthbar.max_health)
else
log('error: healthbar ' .. unit_number .. ' not found')
end
end
Common.notify_force(force,{'pirates.upgraded_cannons', player.name})
market.remove_market_item(offer_index)
-- else
-- extra hold and power upgrade is disabled at dock
-- local upgrade_type = Common.current_destination().static_params.upgrade_for_sale
-- if upgrade_type then
-- Upgrades.execute_upgade(upgrade_type, player)
-- end
-- market.remove_market_item(offer_index)
local upgrade_type = Common.current_destination().static_params.upgrade_for_sale
if upgrade_type then
Upgrades.execute_upgade(upgrade_type, player)
else
log('Error purchasing upgrade at dock')
end
market.remove_market_item(offer_index)
end
else

View File

@ -191,6 +191,27 @@ function Public.update_EEIs(boat)
end
function Public.upgrade_cannons()
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
local cannons = game.surfaces[destination.surface_name].find_entities_filtered({type = 'artillery-turret'})
for _, c in pairs(cannons) do
local unit_number = c.unit_number
local healthbar = memory.boat.healthbars[unit_number]
if healthbar then
healthbar.max_health = healthbar.max_health + Balance.cannon_extra_hp_for_upgrade
healthbar.health = healthbar.max_health
Common.update_healthbar_rendering(healthbar, healthbar.max_health)
else
-- TODO: Upgrade works fine, just seems that redundant artilleries are added to healthbar list which get invalid after surface teleportation (?). Not critical, but would be cool if this was fixed some time.
log('Error (non-critical): artillery\'s healthbar ' .. unit_number .. ' not found')
end
end
end
function Public.upgrade_chests(boat, new_chest)
local scope = Public.get_scope(boat)
local surface = game.surfaces[boat.surface_name]