1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-07 13:31:40 +02:00

Merge pull request #365 from Piratux/develop

v1.4.2 update
This commit is contained in:
Gerkiz 2022-11-21 19:42:54 +01:00 committed by GitHub
commit 1a229e6d4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 336 additions and 122 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.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_updates_2=v1.4.2\n• Disabled 'disband crew' button.\n• Increased amount of fish caught by all fishing classes.\n• Enabled concrete tech.\n• Fixed Mysterious caves island always having the same layout.\n• Fixed issue where power could get disconnected between deck and hold.\n• Added /clear_north_tanks and /clear_south_tanks commands to clear fluid from ship's storage tanks.\n\nv1.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.
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
@ -229,10 +229,10 @@ class_definition_for=Class definition for
class_deckhand=Deckhand
# class_deckhand_explanation=They move faster and generate ore for the cabin whilst onboard above deck.
class_deckhand_explanation_advanced=They move __1__% times faster and generate ore (+__2__ every __3__ seconds) for the cabin whilst onboard above deck.
class_deckhand_explanation_advanced=They move __1__% times faster and generate ore (+__2__ every __3__ seconds) for the cabin whilst onboard above deck. No ore is generated while at sea.
class_fisherman=Fisherman
# class_fisherman_explanation=They fish at greater distance.
class_fisherman_explanation_advanced=They fish (as well as reach objects as side effect) at greater distance (__1__ extra tile range).
class_fisherman_explanation_advanced=They fish (as well as reach objects as side effect) at greater distance (__1__ extra tile range), and catch more (+__2__ fish).
class_scout=Scout
# class_scout_explanation=They are faster, but frail and deal less damage.
class_scout_explanation_advanced=They move __1__% times faster, but receive __2__% more damage and deal __3__% less damage.
@ -247,7 +247,7 @@ class_shoresman=Shoresman
class_shoresman_explanation_advanced=They move __1__% times faster and generate ore (+__2__ every __3__ seconds) for the cabin whilst offboard.
class_boatswain=Boatswain
# class_boatswain_explanation=They move faster and generate ore for the cabin whilst below deck.
class_boatswain_explanation_advanced=They move __1__% times faster and generate ore (+__2__ every __3__ seconds) for the cabin whilst below deck.
class_boatswain_explanation_advanced=They move __1__% times faster and generate ore (+__2__ every __3__ seconds) for the cabin whilst below deck. No ore is generated while at sea.
class_prospector=Prospector
# class_prospector_explanation=They find more resources when handmining.
class_prospector_explanation_advanced=They find more resources when handmining.
@ -605,4 +605,6 @@ cmd_explain_plank={player} is a captain command to remove a player by making the
cmd_explain_officer={player} is a captain command to make a player into an officer, or remove them as one.
cmd_explain_undock=is a captain command to undock the ship.
cmd_explain_tax=is a captain command to take a quarter of all coins, plus other game-critical items from the crew, into your inventory.
cmd_explain_clear_north_tanks=Clear ship's north fluid storage tanks on deck and all holds.
cmd_explain_clear_south_tanks=Clear ship's south fluid storage tanks on deck and all holds.
cmd_explain_dev=is a dev command.

View File

@ -819,21 +819,24 @@ local function event_on_player_mined_entity(event)
elseif entity.type == 'fish' then
if not event.buffer then return end
local fish_amount
local fish_amount = Balance.base_caught_fish_amount
local to_give = {}
if class == Classes.enum.MASTER_ANGLER then
fish_amount = Balance.base_caught_fish_amount + Balance.master_angler_fish_bonus
if class == Classes.enum.FISHERMAN then
fish_amount = fish_amount + Balance.fisherman_fish_bonus
to_give[#to_give + 1] = {name = 'raw-fish', count = fish_amount}
elseif class == Classes.enum.MASTER_ANGLER then
fish_amount = fish_amount + Balance.master_angler_fish_bonus
to_give[#to_give + 1] = {name = 'raw-fish', count = fish_amount}
to_give[#to_give + 1] = {name = 'coin', count = Balance.master_angler_coin_bonus}
elseif class == Classes.enum.DREDGER then
fish_amount = Balance.base_caught_fish_amount + Balance.dredger_fish_bonus
fish_amount = fish_amount + Balance.dredger_fish_bonus
to_give[#to_give + 1] = {name = 'raw-fish', count = fish_amount}
to_give[#to_give + 1] = Loot.dredger_loot()[1]
else
fish_amount = Balance.base_caught_fish_amount
to_give[#to_give + 1] = {name = 'raw-fish', count = fish_amount}
end
@ -1783,12 +1786,7 @@ function Public.event_on_chunk_generated(event)
local inv = e.get_inventory(defines.inventory.chest)
local loot
if Math.random(3) == 1 then
loot = Loot.iron_chest_loot()
else
loot = Loot.wooden_chest_loot()
end
local loot = Loot.iron_chest_loot()
for i = 1, #loot do
local l = loot[i]
@ -1939,6 +1937,7 @@ local function event_on_console_chat(event)
Memory.set_working_id(crew_id)
local memory = Memory.get_crew_memory()
-- NOTE: This check to see if player is in a crew is not reliable and can sometimes cause errors!
if player.force.name == 'player' then
local other_force_indices = global_memory.crew_active_ids
@ -1947,7 +1946,13 @@ local function event_on_console_chat(event)
game.forces[recipient_force_name].print(player.name .. tag .. ' [LOBBY]: ' .. event.message, color)
end
else
game.forces.player.print(player.name .. tag .. ' [' .. memory.name .. ']: ' .. event.message, color)
-- NOTE: For some reason memory.name(or player.name?) can be nil so need this check. It was observed it happened after crew died and resetted, then I said something in lobby before launching new run. That's the only recorded occurence so far.
if memory.name then
game.forces.player.print(player.name .. tag .. ' [' .. memory.name .. ']: ' .. event.message, color)
else
game.forces.player.print(player.name .. tag .. event.message, color)
log('Error (non-critical): memory.name is nil')
end
end
end
@ -1995,7 +2000,7 @@ local boost_movement_speed_on_respawn =
if memory.game_lost then return end
memory.speed_boost_characters[player.index] = true
Task.set_timeout_in_ticks(1050, remove_boost_movement_speed_on_respawn, {player = player, crew_id = crew_id})
Task.set_timeout_in_ticks(1200, remove_boost_movement_speed_on_respawn, {player = player, crew_id = crew_id})
Common.notify_player_expected(player, {'pirates.respawn_speed_bonus_applied'})
end
)

View File

@ -59,14 +59,15 @@ Public.quartermaster_ore_scaling_enabled = false
Public.scout_extra_speed = 1.3
Public.scout_damage_taken_multiplier = 1.25
Public.scout_damage_dealt_multiplier = 0.6
Public.fisherman_fish_bonus = 2
Public.fisherman_reach_bonus = 10
Public.lumberjack_coins_from_tree = 12
Public.lumberjack_ore_base_amount = 4
Public.master_angler_reach_bonus = 16
Public.master_angler_fish_bonus = 2
Public.master_angler_fish_bonus = 4
Public.master_angler_coin_bonus = 20
Public.dredger_reach_bonus = 16
Public.dredger_fish_bonus = 2
Public.dredger_fish_bonus = 6
Public.gourmet_ore_scaling_enabled = false
Public.chef_fish_received_for_biter_kill = 1
Public.chef_fish_received_for_worm_kill = 3

View File

@ -55,7 +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'}}},
[enum.UPGRADE_CANNONS] = {price = {{'repair-pack', 20}, {'coin', 5000}, {'coal', 800}}, offer = {type='nothing', effect_description={'pirates.market_description_upgrade_turrets'}}},
}
function Public.execute_upgade(upgrade_type, player)

View File

@ -158,7 +158,6 @@ function(cmd)
--local param = tostring(cmd.parameter)
if check_admin(cmd) then
--local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Crew.summon_crew()
if memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL then
Progression.at_sea_begin_to_set_sail()
@ -417,7 +416,6 @@ function(cmd)
--local param = tostring(cmd.parameter)
if check_captain_or_admin(cmd) then
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
if memory.boat.state == Boats.enum_state.DOCKED then
Progression.undock_from_dock(true)
elseif memory.boat.state == Boats.enum_state.LANDED then
@ -438,11 +436,38 @@ function(cmd)
--local param = tostring(cmd.parameter)
if check_captain(cmd) then
--local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Roles.captain_tax(memory.playerindex_captain)
end --@TODO: else
end)
commands.add_command(
'clear_north_tanks',
{'pirates.cmd_explain_clear_north_tanks'},
function(cmd)
cmd_set_memory(cmd)
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
if check_captain(cmd) then
Boats.clear_fluid_from_ship_tanks(1)
end --@TODO: else
end)
commands.add_command(
'clear_south_tanks',
{'pirates.cmd_explain_clear_south_tanks'},
function(cmd)
cmd_set_memory(cmd)
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
if check_captain(cmd) then
Boats.clear_fluid_from_ship_tanks(2)
end --@TODO: else
end)
commands.add_command(
'dump_highscores',
{'pirates.cmd_explain_dev'},

View File

@ -1605,4 +1605,69 @@ function Public.get_random_dictionary_entry(t, key)
end
end
-- mainly used to connect multi-surface poles
function Public.force_connect_poles(pole1, pole2)
if not pole1 then return end
if not pole1.valid then return end
if not pole2 then return end
if not pole2.valid then return end
-- force connections for testing (by placing many poles around the substations)
-- for _, e in pairs(pole1.surface.find_entities_filtered{type="electric-pole", position = pole1.position, radius = 10}) do
-- pole1.connect_neighbour(e)
-- end
-- for _, e in pairs(pole2.surface.find_entities_filtered{type="electric-pole", position = pole2.position, radius = 10}) do
-- pole2.connect_neighbour(e)
-- end
local success = pole1.connect_neighbour(pole2)
if success then return end
local pole1_neighbours = pole1.neighbours['copper']
local pole2_neighbours = pole2.neighbours['copper']
-- try avoiding disconnecting more poles than needed
local disconnect_from_pole1 = false
local disconnect_from_pole2 = false
if #pole1_neighbours >= #pole2_neighbours then
disconnect_from_pole1 = true
end
if #pole2_neighbours >= #pole1_neighbours then
disconnect_from_pole2 = true
end
if disconnect_from_pole1 then
-- Prioritise disconnecting last connections as those are most likely redundant (at least for holds, although even then it's not always the case)
for i = #pole1_neighbours, 1, -1 do
local e = pole1_neighbours[i]
-- only disconnect poles from same surface
if e and e.valid and e.surface.name == pole1.surface.name then
pole1.disconnect_neighbour(e)
break
end
end
end
if disconnect_from_pole2 then
-- Prioritise disconnecting last connections as those are most likely redundant (at least for holds, although even then it's not always the case)
for i = #pole2_neighbours, 1, -1 do
local e = pole2_neighbours[i]
-- only disconnect poles from same surface
if e and e.valid and e.surface.name == pole2.surface.name then
pole2.disconnect_neighbour(e)
break
end
end
end
local success2 = pole1.connect_neighbour(pole2)
if not success2 then
-- This can happen if in future pole reach connection limit(5) with poles from other surfaces
log("Error: power fix didn't work")
end
end
return Public

View File

@ -7,7 +7,7 @@ local _inspect = require 'utils.inspect'.inspect
local Public = {}
Public.scenario_id_name = 'pirates'
Public.version_string = '1.4.1' --major.minor.patch versioning, to match factorio mod portal
Public.version_string = '1.4.2' --major.minor.patch versioning, to match factorio mod portal
Public.blueprint_library_allowed = true
Public.blueprint_importing_allowed = true

View File

@ -87,7 +87,9 @@ function Public.update_difficulty()
Common.notify_force(memory.force, message1)
-- local message2 = 'Difficulty changed to ' .. CoreData.difficulty_options[modal_id].text .. '.'
Server.to_discord_embed_raw({'', CoreData.comfy_emojis.kewl .. '[' .. memory.name .. '] ', message1}, true)
-- why print this? if enabling it again, print message to discord without [color] tags (they don't work there)
-- Server.to_discord_embed_raw({'', CoreData.comfy_emojis.kewl .. '[' .. memory.name .. '] ', message1}, true)
memory.difficulty_option = modal_id
memory.difficulty = CoreData.difficulty_options[modal_id].value
@ -749,6 +751,7 @@ function Public.initialise_crew(accepted_proposal)
memory.officers_table = {}
memory.spare_classes = {}
memory.unlocked_classes = {}
memory.class_entry_count = 0 -- used to track whether new class entries should be added during "full_update"
memory.healthbars = {}
memory.overworld_krakens = {}
@ -887,12 +890,12 @@ function Public.reset_crew_and_enemy_force(id)
--as prerequisites for uranium ammo and automation 3:
crew_force.technologies['speed-module'].researched = true
crew_force.technologies['tank'].researched = true
crew_force.technologies['concrete'].researched = true
crew_force.technologies['concrete'].researched = false
--@TRYING this out:
crew_force.technologies['coal-liquefaction'].enabled = true
crew_force.technologies['coal-liquefaction'].researched = true
-- crew_force.technologies['coal-liquefaction'].researched = true -- don't see why this should be researched by default
crew_force.technologies['toolbelt'].enabled = false --trying this. we don't actually want players to carry too many things manually, and in fact in a resource-tight scenario that's problematic
@ -1048,10 +1051,11 @@ function Public.disable_recipes(crew_force)
crew_force.recipes['uranium-cannon-shell'].enabled = false
crew_force.recipes['explosive-uranium-cannon-shell'].enabled = false
crew_force.recipes['concrete'].enabled = false
crew_force.recipes['hazard-concrete'].enabled = false
crew_force.recipes['refined-concrete'].enabled = false
crew_force.recipes['refined-hazard-concrete'].enabled = false
-- need these for nuclear related buildings
-- crew_force.recipes['concrete'].enabled = false
-- crew_force.recipes['hazard-concrete'].enabled = false
-- crew_force.recipes['refined-concrete'].enabled = false
-- crew_force.recipes['refined-hazard-concrete'].enabled = false
end
return Public

View File

@ -15,9 +15,6 @@ widths['available_classes'] = 150
widths['taken_by'] = 150
widths['action_buttons'] = 100
-- used to track whether new class entries should be added during "full_update"
local entry_count = 0
local function add_class_entry(player, class, taken_by_player_index, index)
if not player.gui.screen[window_name .. '_piratewindow'] then return end
local flow
@ -161,7 +158,7 @@ function Public.toggle_window(player)
add_class_entry(player, class_entry.class, class_entry.taken_by, i)
end
entry_count = #memory.unlocked_classes
memory.class_entry_count = #memory.unlocked_classes
GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton')
end
@ -188,7 +185,7 @@ function Public.full_update(player, force_refresh)
-- Currently assuming class list size never decreases
-- Update current content table
for i = 1, entry_count do
for i = 1, memory.class_entry_count do
local label = class_list_panel_table['player_label' .. i]
local class_entry = memory.unlocked_classes[i]
label.caption = class_entry.taken_by and game.players[class_entry.taken_by].name or ''
@ -223,13 +220,13 @@ function Public.full_update(player, force_refresh)
-- If new entries were added since last update, add them to GUI
if entry_count ~= #memory.unlocked_classes then
for i = entry_count + 1, #memory.unlocked_classes do
if memory.class_entry_count ~= #memory.unlocked_classes then
for i = memory.class_entry_count + 1, #memory.unlocked_classes do
local class_entry = memory.unlocked_classes[i]
add_class_entry(player, class_entry.class, class_entry.taken_by, i)
end
entry_count = #memory.unlocked_classes
memory.class_entry_count = #memory.unlocked_classes
end
end

View File

@ -32,7 +32,7 @@ Public.buried_treasure_loot_data_raw = {
{10, 0, 1, false, 'production-science-pack', 12, 24},
{10, 0, 1, false, 'utility-science-pack', 4, 4},
{5, 0, 1, false, 'modular-armor', 1, 1},
{5, 0, 1, false, 'laser-turret', 1, 1},
{5, 0, 1, false, 'laser-turret', 2, 3},
{5, 0, 1, false, 'cannon-shell', 5, 10},
{50, 0, 1, false, 'artillery-shell', 4, 8},
{50, 0, 1, false, 'express-transport-belt', 8, 20},
@ -40,6 +40,7 @@ Public.buried_treasure_loot_data_raw = {
{35, 0, 1, false, 'express-splitter', 4, 11},
{50, 0, 1, false, 'stack-inserter', 4, 12},
{0.1, 0, 1, false, 'atomic-bomb', 1, 1},
{1, 0, 1, false, 'nuclear-reactor', 1, 1},
}
Public.chest_loot_data_raw = {
@ -106,6 +107,9 @@ Public.chest_loot_data_raw = {
{5, 0, 1, true, 'steel-furnace', 4, 8},
{4, 0, 2, true, 'electric-furnace', 1, 3},
{3, 0.2, 1, true, 'chemical-plant', 1, 3},
{0.2, 0.3, 1, false, 'heat-exchanger', 1, 3},
{0.1, 0.3, 1, false, 'nuclear-reactor', 1, 1},
{0.2, 0.2, 2, true, 'concrete', 10, 40},
{50, -1, 0.5, true, 'speed-module', 1, 3},
{25, 0, 1.5, true, 'speed-module-2', 1, 2},
@ -115,6 +119,8 @@ Public.chest_loot_data_raw = {
{4, 0, 2, true, 'effectivity-module-3', 1, 1},
{3, 0, 1, false, 'productivity-module', 1, 1}, --not many of these, merely to make them availabile for future features
{0.2, 0.2, 2, true, 'car', 1, 1},
{0.01, 0.2, 2, true, 'tank', 1, 1},
{4, 0, 0.1, false, 'light-armor', 1, 1},
{2, 0, 0.5, true, 'heavy-armor', 1, 1},
{2, 0, 0.1, false, 'submachine-gun', 1, 1},

View File

@ -19,7 +19,7 @@ function Public.global_reset_memory()
end
pirates_global_memory.config = {}
pirates_global_memory.disband_crews = true
pirates_global_memory.disband_crews = false -- false = disband crew button hidden by default
pirates_global_memory.afk_player_indices = {}
pirates_global_memory.playerindex_to_time_played_continuously = {}
pirates_global_memory.playerindex_to_captainhood_priority = {}

View File

@ -13,7 +13,7 @@ local simplex_noise = require 'utils.simplex_noise'.d2
local Public = {}
-- Gives less and less ore with every call, until given amount slowly converges to 1
-- Gives less and less ore with every call, until given amount slowly converges to 2
-- For now used just for Cave island to give players ore when mining rocks
-- NOTE: Also gives some coins
function Public.try_give_ore(player, realp, source_name)
@ -46,21 +46,24 @@ function Public.try_give_ore(player, realp, source_name)
if not choice then return end
local coin_amount = 4 + Math.random(4)
local real_amount = Math.max(Common.minimum_ore_placed_per_tile, Common.ore_abstract_to_real(total_ore_left))
local real_amount = Common.ore_abstract_to_real(choices[choice])
local given_amount = Math.ceil(real_amount * Math.random_float_in_range(0.004, 0.006))
if source_name == 'rock-huge' then
given_amount = given_amount * 1.5
given_amount = given_amount * 2
coin_amount = coin_amount * 2
end
given_amount = Math.max(2, given_amount)
local to_give = {}
to_give[#to_give+1] = {name = choice, count = Math.ceil(given_amount)}
to_give[#to_give+1] = {name = 'coin', count = Math.ceil(coin_amount)}
Common.give(player, to_give, realp)
choices[choice] = Math.max(0, choices[choice] - Common.ore_real_to_abstract(given_amount))
-- 1 here indicates that ore type should still be given
choices[choice] = Math.max(1, choices[choice] - Common.ore_real_to_abstract(given_amount))
end
end
end

View File

@ -126,6 +126,7 @@ function Public.generate_destination_type_and_subtype(overworld_position)
end
return {type = type2, subtype = subtype}
-- return {type = Surfaces.enum.ISLAND, subtype = IslandEnum.enum.CAVE}
end
@ -368,9 +369,9 @@ function Public.generate_overworld_destination(p)
-- 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
if macro_p.x % 16 == 15 and (not memory.rockets_for_sale) then
upgrade_for_sale = Upgrades.enum.ROCKETS_FOR_SALE
elseif macro_p.x == 19 then
elseif macro_p.x % 16 == 3 and macro_p.x > 16 and (not memory.merchant_ships_unlocked) then
upgrade_for_sale = Upgrades.enum.UNLOCK_MERCHANTS
elseif (macro_p.x % 8) == 3 then
upgrade_for_sale = Upgrades.enum.UPGRADE_CANNONS

View File

@ -103,7 +103,8 @@ function Public.explanation(class, add_is_class_obtainable)
full_explanation = {'', {explanation, range, extra_physical}}
elseif class == enum.FISHERMAN then
local extra_range = Balance.fisherman_reach_bonus
full_explanation = {'', {explanation, extra_range}}
local extra_fish = Balance.fisherman_fish_bonus
full_explanation = {'', {explanation, extra_range, extra_fish}}
elseif class == enum.MASTER_ANGLER then
local extra_range = Balance.master_angler_reach_bonus
local extra_fish = Balance.master_angler_fish_bonus

View File

@ -330,7 +330,9 @@ function Public.place_boat(boat, floor_tile, place_entities_bool, correct_tiles,
e.rotatable = false
if i == 1 then
boat.upstairs_pole = e
Public.try_connect_upstairs_and_downstairs_poles(boat)
if boat.downstairs_poles and boat.downstairs_poles[1] then
Common.force_connect_poles(boat.upstairs_pole, boat.downstairs_poles[1][1])
end
end
end
end
@ -729,17 +731,6 @@ end
-- end
-- end
function Public.try_connect_upstairs_and_downstairs_poles(boat)
-- local memory = Memory.get_crew_memory()
if not (boat and boat.upstairs_pole and boat.upstairs_pole.valid and boat.downstairs_poles and boat.downstairs_poles[1] and boat.downstairs_poles[1][1] and boat.downstairs_poles[1][1].valid) then return end
boat.upstairs_pole.connect_neighbour(boat.downstairs_poles[1][1])
end
local function process_entity_on_boat_unteleportable(memory, boat, newsurface, vector, players_just_offside, oldsurface_name, newsurface_name, e, name)
local un = e.unit_number
@ -913,9 +904,11 @@ local function process_entity_on_boat_teleportable(memory, boat, newsurface, new
ee = e.clone{position = p2, surface = newsurface, create_build_effect_smoke = false}
end
if boat.upstairs_pole and e == boat.upstairs_pole then
if e == boat.upstairs_pole then
boat.upstairs_pole = ee
Public.try_connect_upstairs_and_downstairs_poles(boat)
if boat.downstairs_poles and boat.downstairs_poles[1] then
Common.force_connect_poles(boat.upstairs_pole, boat.downstairs_poles[1][1])
end
end
if not (e.name == 'car' or e.name == 'tank' or e.name == 'spidertron') then
@ -1441,4 +1434,21 @@ function Public.is_boat_at_sea()
end
end
function Public.clear_fluid_from_ship_tanks(idx)
local memory = Memory.get_crew_memory()
local boat = memory.boat
if boat.upstairs_fluid_storages and boat.upstairs_fluid_storages[idx] and boat.upstairs_fluid_storages[idx].valid then
boat.upstairs_fluid_storages[idx].clear_fluid_inside()
end
if boat.downstairs_fluid_storages then
for j = 1, memory.hold_surface_count do
if boat.downstairs_fluid_storages[j] and boat.downstairs_fluid_storages[j][idx] and boat.downstairs_fluid_storages[j][idx].valid then
boat.downstairs_fluid_storages[j][idx].clear_fluid_inside()
end
end
end
end
return Public

View File

@ -172,7 +172,7 @@ Public.entry_price_data_raw = {-- choose things which make interesting minifacto
},
['fast-splitter'] = {
overallWeight = 1,
minLambda = -1,
minLambda = -0.6,
maxLambda = 1,
shape = 'bump',
enabled = true,
@ -212,7 +212,7 @@ Public.entry_price_data_raw = {-- choose things which make interesting minifacto
},
['pump'] = {
overallWeight = 1,
minLambda = 0.05,
minLambda = 0.1,
maxLambda = 1,
shape = 'density',
enabled = true,

View File

@ -61,7 +61,7 @@ function Public.configure_structure_entities(special_name, components)
for _, e in pairs(c.built_entities) do
if e and e.valid then
e.minable = false
e.rotatable = false
-- e.rotatable = false -- don't see why it shouldn't be rotatable
e.destructible = false
end
end

View File

@ -210,9 +210,7 @@ function Public.create_hold_surface(nth)
end
end
if nth >= 2 then
if boat.downstairs_poles[nth][1] and boat.downstairs_poles[nth][1].valid and boat.downstairs_poles[nth-1][2] and boat.downstairs_poles[nth-1][2].valid then
boat.downstairs_poles[nth][1].connect_neighbour(boat.downstairs_poles[nth-1][2])
end
Common.force_connect_poles(boat.downstairs_poles[nth][1], boat.downstairs_poles[nth-1][2])
end
if not boat.downstairs_fluid_storages then boat.downstairs_fluid_storages = {} end

View File

@ -100,6 +100,7 @@ end
function Public.roll_source_surface(destination_data)
local map_gen_settings = {
['water'] = 0,
['seed'] = Math.random(1, 1000000),
['starting_area'] = 1,
['cliff_settings'] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
['default_enable_all_autoplace_controls'] = false,

View File

@ -32,7 +32,22 @@ local function spawn_market(args, is_main)
offers[#offers+1] = {price = {{'coin', 200}}, offer = {type = 'give-item', item = 'small-lamp', count = 100}}
else
-- This doesn't really prevent markets spawning near each other, since markets aren't spawned immediately for a given chunk, but it helps a bit
local surface = destination_data.dynamic_data.cave_miner.cave_surface
local cave_miner = destination_data.dynamic_data.cave_miner
if not cave_miner then
-- this can be null if cave island is first and run is launched using proposal
-- should probably investigate this some time
local message = 'ERROR: cave_miner is nil'
if _DEBUG then
game.print(message)
else
log(message)
end
return
end
local surface = cave_miner.cave_surface
if not surface then return end
local r = 64
if surface.count_entities_filtered({name = 'market', area = {{args.p.x - r, args.p.y - r}, {args.p.x + r, args.p.y + r}}}) > 0 then
return
@ -51,6 +66,25 @@ local function place_rock(args)
args.entities[#args.entities + 1] = IslandsCommon.random_rock_1({x = args.p.x + a, y = args.p.y + b})
end
local function place_spawner(args)
local memory = Memory.get_crew_memory()
local name
if Math.random(1, 2) == 1 then
name = 'biter-spawner'
else
name = 'spitter-spawner'
end
args.entities[#args.entities + 1] = {name = name, position = args.p, force = memory.enemy_force_name}
end
local function place_worm(args)
local memory = Memory.get_crew_memory()
local name = Common.get_random_worm_type(memory.evolution_factor)
local force = memory.enemy_force_name
args.entities[#args.entities + 1] = {name = name, position = args.p, force = force}
end
local biomes = {}
function biomes.oasis(args, noise)
@ -68,8 +102,8 @@ function biomes.oasis(args, noise)
args.entities[#args.entities + 1] = {name = 'tree-04', position = args.p}
end
if Math.random(1, 50) == 1 then
args.entities[#args.entities + 1] = {name = 'crude-oil', position = args.p, amount = Balance.pick_default_oil_amount() * 2}
if Math.random(1, 100) == 1 then
args.entities[#args.entities + 1] = {name = 'crude-oil', position = args.p, amount = Balance.pick_default_oil_amount() * 4}
end
if noise < 0.73 then
@ -92,16 +126,35 @@ function biomes.pond_cave(args, noise)
return
end
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
if Math.random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
if Math.abs(noise_2) > 0.25 then
place_rock(args)
if Math.random(1, 64) == 1 then
place_spawner(args)
else
place_rock(args)
end
return
end
if Math.random(1, 32) == 1 then
place_spawner(args)
return
end
if noise > -0.53 then
place_rock(args)
return
else
if Math.random(1, 512) == 1 then
if Math.random(1, 1024) == 1 then
spawn_market(args)
return
end
end
end
@ -113,7 +166,9 @@ function biomes.spawn(args, square_distance)
-- If coordinate iteration ever changes to xn instead of 0.5 + xn this will need to change
if Math.abs(position.x - 0.5) < 0.1 and Math.abs(position.y - 0.5) < 0.1 then
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
spawn_market(args, true)
return
end
local noise = GetNoise('decoratives', position, seed)
@ -123,6 +178,8 @@ function biomes.spawn(args, square_distance)
return
end
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
if square_distance > 100 then
place_rock(args)
end
@ -140,6 +197,8 @@ function biomes.ocean(args, noise)
return
end
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
place_rock(args)
end
@ -147,20 +206,16 @@ function biomes.worm_desert(args, noise)
local seed = args.seed
local position = args.p
local memory = Memory.get_crew_memory()
local i = Math.floor((GetNoise('decoratives', position, seed) * 8) % 3) + 1
args.tiles[#args.tiles + 1] = {name = 'sand-' .. i, position = args.p}
if noise > -0.65 then
place_rock(args)
return
end
local i = Math.floor((GetNoise('decoratives', position, seed) * 8) % 3) + 1
args.tiles[#args.tiles + 1] = {name = 'sand-' .. i, position = args.p}
if Math.random(1, 64) == 1 then
local name = Common.get_random_worm_type(memory.evolution_factor)
local force = memory.enemy_force_name
args.entities[#args.entities + 1] = {name = name, position = args.p, force = force}
place_worm(args)
return
end
@ -173,7 +228,7 @@ function biomes.worm_desert(args, noise)
end
end
if Math.random(1, 256) == 1 then
if Math.random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
end
end
@ -182,8 +237,6 @@ function biomes.cave(args, square_distance)
local seed = args.seed
local position = args.p
local memory = Memory.get_crew_memory()
local noise_cave_rivers1 = GetNoise('cave_rivers_2', position, seed + 100000)
if Math.abs(noise_cave_rivers1) < 0.025 then
local noise_cave_rivers2 = GetNoise('cave_rivers_3', position, seed + 200000)
@ -205,6 +258,8 @@ function biomes.cave(args, square_distance)
return
end
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
if Math.abs(no_rocks_2) < 0.05 then
return
end
@ -212,11 +267,45 @@ function biomes.cave(args, square_distance)
local noise_rock = GetNoise('small_caves', position, seed)
if noise_rock < 0.6 then
place_rock(args)
local ring1_range = 10
local ring2_range = 20
local ring1_radius = 150
local ring2_radius = 300
if Math.random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
local ring1_start = (ring1_radius - ring1_range) * (ring1_radius - ring1_range)
local ring1_end = (ring1_radius + ring1_range) * (ring1_radius + ring1_range)
local ring2_start = (ring2_radius - ring2_range) * (ring2_radius - ring2_range)
local ring2_end = (ring2_radius + ring2_range) * (ring2_radius + ring2_range)
-- add nest obstacles in these rings on "main" wide cave roads
if (square_distance > ring1_start and square_distance < ring1_end) or
(square_distance > ring2_start and square_distance < ring2_end) then
if Math.random(1, 32) == 1 then
if Math.random(1, 3) == 1 then
place_worm(args)
else
place_spawner(args)
end
return
end
if Math.random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
if Math.random(1, 16) == 1 then
place_rock(args)
return
end
end
if Math.random(1, 1024) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
place_rock(args)
return
end
@ -224,31 +313,23 @@ function biomes.cave(args, square_distance)
return
end
if Math.random(1, 4096) == 1 then
if Math.random(1, 8192) == 1 then
spawn_market(args)
return
end
if Math.random(1, 64) == 1 then
local name
if Math.random(1, 2) == 1 then
name = 'biter-spawner'
if Math.random(1, 16) == 1 then
if Math.random(1, 3) == 1 then
place_worm(args)
return
else
name = 'spitter-spawner'
place_spawner(args)
return
end
args.entities[#args.entities + 1] = {name = name, position = args.p, force = memory.enemy_force_name}
return
end
if Math.random(1, 64) == 1 then
local name = Common.get_random_worm_type(memory.evolution_factor)
local force = memory.enemy_force_name
args.entities[#args.entities + 1] = {name = name, position = args.p, force = force}
return
end
end
local function get_biome(args)
local function pick_biome(args)
local position = args.p
local d = position.x ^ 2 + position.y ^ 2
@ -260,62 +341,74 @@ local function get_biome(args)
-- Spawn location for market
if d < spawn_radius ^ 2 then
return biomes.spawn, d
biomes.spawn(args, d)
return
end
-- River upon which ship arrives + ship entrance
if position.x < 0 and 2 * Math.abs(position.y) < river_width then
return biomes.void
biomes.void(args)
return
end
-- Prevent cave expansion in west direction
-- NOTE: although "river_width ^ 2 - entrance_radius ^ 2" should never be "< 0", it's a small safe check
-- NOTE: the complex calculation here calculates wanted intersection of river and spawn area (or in other words line and circle intersection)
if position.x < 0 and -position.x + (river_width - Math.sqrt(Math.max(0, river_width ^ 2 - entrance_radius ^ 2))) > Math.abs(2 * position.y) then
return biomes.void
biomes.void(args)
return
end
-- Actual cave generation below
local cm_ocean = GetNoise('cm_ocean', position, args.seed + 100000)
if cm_ocean > 0.6 then
return biomes.ocean, cm_ocean
biomes.ocean(args, cm_ocean)
return
end
local noise = GetNoise('cave_miner_01', position, args.seed)
local abs_noise = Math.abs(noise)
if abs_noise < 0.075 then
return biomes.cave, d
biomes.cave(args, d)
return
end
if abs_noise > 0.25 then
noise = GetNoise('cave_rivers', position, args.seed)
if noise > 0.72 then
return biomes.oasis, noise
biomes.oasis(args, noise)
return
end
if cm_ocean < -0.6 then
return biomes.worm_desert, cm_ocean
biomes.worm_desert(args, cm_ocean)
return
end
if noise < -0.5 then
return biomes.pond_cave, noise
biomes.pond_cave(args, noise)
return
end
end
noise = GetNoise('cave_miner_02', position, args.seed)
if Math.abs(noise) < 0.085 then
return biomes.cave, d
-- make 4 times as much narrow caves
local position2 = {x = position.x*2, y = position.y*2}
noise = GetNoise('cave_miner_02', position2, args.seed)
if Math.abs(noise) < 0.1 then
biomes.cave(args, d)
return
end
return biomes.void
biomes.void(args)
end
function Public.terrain(args)
local tiles_placed = #args.tiles
local biome, square_distance, noise = get_biome(args)
biome(args, square_distance, noise)
pick_biome(args)
-- fallback case when tile wasn't placed
if tiles_placed == #args.tiles then
-- fallback case that should never happen
if #args.tiles == tiles_placed then
-- game.print('no tile was placed!')
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
return
end
end

View File

@ -18,12 +18,14 @@ Public.static_params_default = {
min_brightness = 0.08,
}
-- Here we set values somewhat higher, because getting all resources requires work and bit of luck (island needs enough rock)
function Public.base_ores()
return {
['copper-ore'] = 0.7,
['iron-ore'] = 5.9,
['coal'] = 4.4,
['stone'] = 1.0,
['copper-ore'] = 1.5,
['iron-ore'] = 7,
['coal'] = 6,
['stone'] = 3,
['uranium-ore'] = 0.5,
}
end