1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-28 23:06:38 +02:00

Post update fixes and changes

Changes:
- Disabled crafting of speed 2 and speed 3 modules.
- Items are saved for 5 minutes when player leaves and automatically given back when player joins instead of being sent to the crew.
- Increased captain /tax from 10% to 25% of good amount.
- Doubled the chance to find smol vein or chest when mining trees.
- Increased amount of fish that can be caught at sea from 30 to 40.
- Decreased amount of coins granted from selling pistols in markets from 500 to 300 coins.
- Fixed protected run timer only decreasing when crew was empty instead of when captain wasn't in the crew.
- Shaman now passively absorbs small amount of energy from the sun.
This commit is contained in:
Piratux 2023-02-12 00:01:53 +02:00
parent 1c97005d27
commit 9d0a920908
9 changed files with 172 additions and 58 deletions

View File

@ -302,7 +302,7 @@ class_medic_explanation_advanced=When eating fish they additionally heal themsel
class_doctor=Doctor
class_doctor_explanation_advanced=When eating fish they additionally heal themselves and nearby players (__1__ tile radius) for __2__% of max hp.
class_shaman=Shaman
class_shaman_explanation_advanced=Shamans energize themselves when standing next to accumulators. They can use this accumulated energy to summon biters when eating fish.\nSummoned biters last for __1__ mins.
class_shaman_explanation_advanced=Shamans energize themselves when standing next to accumulators. They can use this accumulated energy to summon biters when eating fish.\nShamans also passively absorb small amount of energy from the sun.\nSummoned biters last for __1__ mins.
class_explanation=__1__: __2__
class_explanation_upgraded_class=__1__: An upgrade of __2__. __3__

View File

@ -835,12 +835,12 @@ local function player_mined_tree(event)
Common.give(player, give, entity.position)
if destination.subtype ~= IslandEnum.enum.FIRST then
if Math.random(1024) == 1 then
if Math.random(512) == 1 then
local placed = Ores.try_ore_spawn(entity.surface, entity.position, entity.name, 0, true)
if placed then
Common.notify_player_expected(player, {'pirates.ore_discovered'})
end
elseif Math.random(2048) == 1 then
elseif Math.random(1024) == 1 then
local e = entity.surface.create_entity{name = 'wooden-chest', position = entity.position, force = memory.ancient_friendly_force_name}
if e and e.valid then
e.minable = false

View File

@ -264,41 +264,72 @@ function Public.prune_offline_characters_list(tickinterval)
for player_index, tick in pairs(memory.temporarily_logged_off_characters) do
if player_index and game.players[player_index] and game.players[player_index].connected then
--game.print("deleting already online character from list")
memory.temporarily_logged_off_characters[player_index] = nil
if memory.temporarily_logged_off_characters_items[player_index] then
memory.temporarily_logged_off_characters_items[player_index].destroy()
end
memory.temporarily_logged_off_characters_items[player_index] = nil
else
if player_index and tick < game.tick - 60 * 60 * Common.logged_off_items_preserved_minutes then
local player_inv = {}
player_inv[1] = game.players[player_index].get_inventory(defines.inventory.character_main)
player_inv[2] = game.players[player_index].get_inventory(defines.inventory.character_armor)
player_inv[3] = game.players[player_index].get_inventory(defines.inventory.character_ammo)
player_inv[4] = game.players[player_index].get_inventory(defines.inventory.character_guns)
player_inv[5] = game.players[player_index].get_inventory(defines.inventory.character_trash)
local any = false
for ii = 1, 5, 1 do
if player_inv[ii] and player_inv[ii].valid then
for iii = 1, #player_inv[ii], 1 do
if player_inv[ii][iii] and player_inv[ii][iii].valid and player_inv[ii][iii].valid_for_read then
-- items[#items + 1] = player_inv[ii][iii]
Common.give_items_to_crew(player_inv[ii][iii])
any = true
end
local temp_inv = memory.temporarily_logged_off_characters_items[player_index]
if temp_inv then
for i = 1, #temp_inv, 1 do
if temp_inv[i] and temp_inv[i].valid and temp_inv[i].valid_for_read then
Common.give_items_to_crew(temp_inv[i])
any = true
end
end
end
if any then
Common.notify_force_light(memory.force, {'pirates.recover_offline_player_items'})
end
for ii = 1, 5, 1 do
if player_inv[ii].valid then
player_inv[ii].clear()
if any then
Common.notify_force_light(memory.force, {'pirates.recover_offline_player_items'})
end
temp_inv.destroy()
end
memory.temporarily_logged_off_characters[player_index] = nil
memory.temporarily_logged_off_characters_items[player_index] = nil
end
end
end
-- for player_index, tick in pairs(memory.temporarily_logged_off_characters) do
-- if player_index and game.players[player_index] and game.players[player_index].connected then
-- --game.print("deleting already online character from list")
-- memory.temporarily_logged_off_characters[player_index] = nil
-- else
-- if player_index and tick < game.tick - 60 * 60 * Common.logged_off_items_preserved_minutes then
-- local player_inv = {}
-- player_inv[1] = game.players[player_index].get_inventory(defines.inventory.character_main)
-- player_inv[2] = game.players[player_index].get_inventory(defines.inventory.character_armor)
-- player_inv[3] = game.players[player_index].get_inventory(defines.inventory.character_ammo)
-- player_inv[4] = game.players[player_index].get_inventory(defines.inventory.character_guns)
-- player_inv[5] = game.players[player_index].get_inventory(defines.inventory.character_trash)
-- local any = false
-- for ii = 1, 5, 1 do
-- if player_inv[ii] and player_inv[ii].valid then
-- for iii = 1, #player_inv[ii], 1 do
-- if player_inv[ii][iii] and player_inv[ii][iii].valid and player_inv[ii][iii].valid_for_read then
-- -- items[#items + 1] = player_inv[ii][iii]
-- Common.give_items_to_crew(player_inv[ii][iii])
-- any = true
-- end
-- end
-- end
-- end
-- if any then
-- Common.notify_force_light(memory.force, {'pirates.recover_offline_player_items'})
-- end
-- for ii = 1, 5, 1 do
-- if player_inv[ii].valid then
-- player_inv[ii].clear()
-- end
-- end
-- memory.temporarily_logged_off_characters[player_index] = nil
-- end
-- end
-- end
end
@ -1630,7 +1661,7 @@ end
function Public.update_protected_run_lock_timer(tickinterval)
local memory = Memory.get_crew_memory()
if memory.run_is_protected then
if Common.activecrewcount() <= 0 then
if not Roles.captain_exists() then
if memory.protected_run_lock_timer > 0 then
memory.protected_run_lock_timer = memory.protected_run_lock_timer - tickinterval

View File

@ -82,10 +82,11 @@ Public.doctor_heal_percentage_amount = 0.15
Public.shaman_energy_required_per_summon = 1000000
Public.shaman_max_charge = 30000000
Public.shaman_summoned_biter_time_to_live = 60 * 2 -- in seconds
Public.shaman_passive_charge = 200000 -- each second
Public.class_cycle_count = 5 -- How many classes should be purchased to have a chance to buy the same class again
Public.maximum_fish_allowed_to_catch_at_sea = 30
Public.maximum_fish_allowed_to_catch_at_sea = 40
Public.prevent_waves_from_spawning_in_cave_timer_length = 10 -- in seconds
@ -461,7 +462,8 @@ function Public.quest_market_entry_price_scale()
-- return (1 + 0.05 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/3)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.4
return (1 + 0.05 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/4)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.4
local scale = (1 + 0.05 * (Common.overworldx()/40 - 1)) * ((0.6 + Public.crew_scale())^(1/8)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.5
return Math.max(0.1, scale)
end
function Public.quest_furnace_entry_price_scale()
@ -479,7 +481,8 @@ function Public.quest_furnace_entry_price_scale()
-- x = 1000 (25th island): 1.008
-- return (1 + 0.03 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/3)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.4
return (1 + 0.03 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/4)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.4
local scale = (1 + 0.03 * (Common.overworldx()/40 - 1)) * ((0.6 + Public.crew_scale())^(1/8)) * Math.sloped(Common.difficulty_scale(), 1/2) - 0.5
return Math.max(0.1, scale)
end
-- function Public.apply_crew_buffs_per_league(force, leagues_travelled)
@ -498,7 +501,7 @@ end
Public.quest_structures_first_appear_at = 40
Public.coin_sell_amount = 500
Public.coin_sell_amount = 300
Public.starting_fuel = 4000

View File

@ -44,7 +44,7 @@ Public.structure_ensure_chunk_radius = 2
Public.allow_barreling_off_ship = true
Public.coin_tax_percentage = 10
Public.coin_tax_percentage = 25
Public.fraction_of_map_loaded_at_sea = 1
Public.map_loading_ticks_atsea = 68 * 60
@ -1361,7 +1361,8 @@ function Public.send_important_items_from_player_to_crew(player, all_items)
if #to_remove > 0 then
for iii = 1, #to_remove, 1 do
if to_remove[iii].valid_for_read then
Public.give_items_to_crew{{name = to_remove[iii].name, count = to_remove[iii].count}}
-- Public.give_items_to_crew{{name = to_remove[iii].name, count = to_remove[iii].count}}
Public.give_items_to_crew(to_remove[iii])
to_remove[iii].clear()
end
end
@ -1373,6 +1374,49 @@ function Public.send_important_items_from_player_to_crew(player, all_items)
return any
end
function Public.temporarily_store_logged_off_character_items(player)
local memory = Memory.get_crew_memory()
memory.temporarily_logged_off_characters_items[player.index] = game.create_inventory(150)
local temp_inv = memory.temporarily_logged_off_characters_items[player.index]
local player_inv = {}
player_inv[1] = game.players[player.index].get_inventory(defines.inventory.character_main)
player_inv[2] = game.players[player.index].get_inventory(defines.inventory.character_armor)
player_inv[3] = game.players[player.index].get_inventory(defines.inventory.character_guns)
player_inv[4] = game.players[player.index].get_inventory(defines.inventory.character_ammo)
player_inv[5] = game.players[player.index].get_inventory(defines.inventory.character_trash)
for ii = 1, 5, 1 do
if player_inv[ii].valid then
for iii = 1, #player_inv[ii], 1 do
if player_inv[ii] and player_inv[ii][iii].valid and player_inv[ii][iii].valid_for_read then
temp_inv.insert(player_inv[ii][iii])
player_inv[ii][iii].clear()
end
end
end
end
end
function Public.give_back_items_to_temporarily_logged_off_player(player)
local memory = Memory.get_crew_memory()
if not memory.temporarily_logged_off_characters_items[player.index] then
return
end
local temp_inv = memory.temporarily_logged_off_characters_items[player.index]
for i = 1, #temp_inv, 1 do
if temp_inv and temp_inv[i].valid and temp_inv[i].valid_for_read then
player.insert(temp_inv[i])
end
end
temp_inv.destroy()
memory.temporarily_logged_off_characters_items[player.index] = nil
end
function Public.give_items_to_crew(items)
local memory = Memory.get_crew_memory()
@ -1616,6 +1660,9 @@ function Public.get_item_blacklist(tier)
-- blacklist['land-mine'] = true
blacklist['wood'] = true -- too easy to acquire
blacklist['speed-module-2'] = true
blacklist['speed-module-3'] = true
return blacklist
end

View File

@ -353,7 +353,7 @@ function Public.join_crew(player, crewid, rejoin)
-- local adventuring = false
local spectating = false
if memory.crewstatus and memory.crewstatus == enum.ADVENTURING then
if memory.crewstatus == enum.ADVENTURING then
-- for _, playerindex in pairs(memory.crewplayerindices) do
-- if player.index == playerindex then adventuring = true end
-- end
@ -379,9 +379,11 @@ function Public.join_crew(player, crewid, rejoin)
player.force = memory.force
player.teleport(surface.find_non_colliding_position('character', memory.spawnpoint, 32, 0.5) or memory.spawnpoint, surface)
Common.notify_lobby({'pirates.lobby_to_crew_2', player.name, memory.name})
Common.notify_lobby({'pirates.lobby_to_crew_2', player.name, memory.name})
end
Common.give_back_items_to_temporarily_logged_off_player(player)
Common.notify_force(player.force, {'pirates.lobby_to_crew', player.name})
-- Server.to_discord_embed_raw(CoreData.comfy_emojis.yum1 .. '[' .. memory.name .. '] ' .. message)
@ -432,13 +434,34 @@ function Public.leave_crew(player, to_lobby, quiet)
-- -- Server.to_discord_embed_raw(CoreData.comfy_emojis.feel .. '[' .. memory.name .. '] ' .. message)
-- end
-- @TODO: figure out why surface_name can be nil
-- When player remains in island when ship leaves, prevent him from getting items back
local save_items = true
if player.surface and
player.surface.valid and
memory.boat and
memory.boat.surface_name
then
local player_surface_type = SurfacesCommon.decode_surface_name(player.surface.name).type
local boat_surface_type = SurfacesCommon.decode_surface_name(memory.boat.surface_name).type
if player_surface_type == Surfaces.enum.ISLAND and boat_surface_type == Surfaces.enum.SEA then
save_items = false
end
end
if to_lobby then
Common.send_important_items_from_player_to_crew(player, true)
if save_items then
Common.send_important_items_from_player_to_crew(player, true)
end
char.die(memory.force_name)
else
Common.send_important_items_from_player_to_crew(player, true)
if save_items then
Common.temporarily_store_logged_off_character_items(player)
end
memory.temporarily_logged_off_characters[player.index] = game.tick
end
-- else
-- if not quiet then
-- -- local message = player.name .. ' left the crew.'
@ -715,6 +738,7 @@ function Public.initialise_crew(accepted_proposal)
memory.tempbanned_from_joining_data = {}
memory.destinations = {}
memory.temporarily_logged_off_characters = {}
memory.temporarily_logged_off_characters_items = {}
memory.class_renderings = {}
memory.class_auxiliary_data = {}
@ -919,15 +943,15 @@ function Public.reset_crew_and_enemy_force(id)
crew_force.technologies['rail-signals'].enabled = false
-- crew_force.technologies['logistic-system'].enabled = false
crew_force.technologies['logistic-system'].enabled = false
-- crew_force.technologies['rocketry'].enabled = false
crew_force.technologies['rocketry'].enabled = false
crew_force.technologies['artillery'].enabled = false
-- crew_force.technologies['destroyer'].enabled = false
-- crew_force.technologies['spidertron'].enabled = false
crew_force.technologies['spidertron'].enabled = false
crew_force.technologies['atomic-bomb'].enabled = false
-- crew_force.technologies['explosive-rocketry'].enabled = false
crew_force.technologies['explosive-rocketry'].enabled = false
-- crew_force.technologies['research-speed-1'].enabled = false
-- crew_force.technologies['research-speed-2'].enabled = false
@ -996,7 +1020,7 @@ function Public.reset_crew_and_enemy_force(id)
-- crew_force.technologies['effectivity-module'].enabled = true
-- crew_force.technologies['effectivity-module-2'].enabled = false
-- crew_force.technologies['effectivity-module-3'].enabled = false
-- crew_force.technologies['automation-3'].enabled = true
crew_force.technologies['automation-3'].enabled = false
-- crew_force.technologies['rocket-control-unit'].enabled = false
-- crew_force.technologies['rocket-silo'].enabled = false
-- crew_force.technologies['space-scienkce-pack'].enabled = false
@ -1019,21 +1043,21 @@ function Public.reset_crew_and_enemy_force(id)
crew_force.technologies['production-science-pack'].enabled = true
crew_force.technologies['utility-science-pack'].enabled = true
-- crew_force.technologies['modular-armor'].enabled = false
-- crew_force.technologies['power-armor'].enabled = false
-- crew_force.technologies['solar-panel-equipment'].enabled = false
-- crew_force.technologies['personal-roboport-equipment'].enabled = false
-- crew_force.technologies['personal-laser-defense-equipment'].enabled = false
-- crew_force.technologies['night-vision-equipment'].enabled = false
-- crew_force.technologies['energy-shield-equipment'].enabled = false
-- crew_force.technologies['belt-immunity-equipment'].enabled = false
-- crew_force.technologies['exoskeleton-equipment'].enabled = false
-- crew_force.technologies['battery-equipment'].enabled = false
-- crew_force.technologies['fusion-reactor-equipment'].enabled = false
-- crew_force.technologies['power-armor-mk2'].enabled = false
-- crew_force.technologies['energy-shield-mk2-equipment'].enabled = false
-- crew_force.technologies['personal-roboport-mk2-equipment'].enabled = false
-- crew_force.technologies['battery-mk2-equipment'].enabled = false
crew_force.technologies['modular-armor'].enabled = false
crew_force.technologies['power-armor'].enabled = false
crew_force.technologies['solar-panel-equipment'].enabled = false
crew_force.technologies['personal-roboport-equipment'].enabled = false
crew_force.technologies['personal-laser-defense-equipment'].enabled = false
crew_force.technologies['night-vision-equipment'].enabled = false
crew_force.technologies['energy-shield-equipment'].enabled = false
crew_force.technologies['belt-immunity-equipment'].enabled = false
crew_force.technologies['exoskeleton-equipment'].enabled = false
crew_force.technologies['battery-equipment'].enabled = false
crew_force.technologies['fusion-reactor-equipment'].enabled = false
crew_force.technologies['power-armor-mk2'].enabled = false
crew_force.technologies['energy-shield-mk2-equipment'].enabled = false
crew_force.technologies['personal-roboport-mk2-equipment'].enabled = false
crew_force.technologies['battery-mk2-equipment'].enabled = false
crew_force.technologies['discharge-defense-equipment'].enabled = false
-- crew_force.technologies['distractor'].enabled = false
@ -1067,6 +1091,9 @@ function Public.disable_recipes(crew_force)
-- crew_force.recipes['hazard-concrete'].enabled = false
-- crew_force.recipes['refined-concrete'].enabled = false
-- crew_force.recipes['refined-hazard-concrete'].enabled = false
crew_force.recipes['speed-module-2'].enabled = false
crew_force.recipes['speed-module-3'].enabled = false
end
return Public

View File

@ -111,7 +111,7 @@ Public.chest_loot_data_raw = {
{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},
{50, -1, 1, true, 'speed-module', 1, 3},
{25, 0, 1.5, true, 'speed-module-2', 1, 2},
{12, 0, 2, true, 'speed-module-3', 1, 1},
{4, -1, 1, true, 'effectivity-module', 1, 3},

View File

@ -87,6 +87,7 @@ function Public.initialise_crew_memory(id) --mostly serves as a dev reference of
memory.captain_accrued_time_data = nil
memory.max_players_recorded = nil
memory.temporarily_logged_off_characters = nil
memory.temporarily_logged_off_characters_items = nil
memory.speed_boost_characters = nil

View File

@ -83,9 +83,14 @@ function Public.class_update_auxiliary_data(tickinterval)
processed_players[player_index] = true
if data.shaman_charge < Balance.shaman_max_charge then
-- charge from accumulators
local power_need = Balance.shaman_max_charge - data.shaman_charge
local energy = discharge_accumulators(player.surface, player.position, memory.force, power_need)
data.shaman_charge = data.shaman_charge + energy
-- charge from sun pasively
data.shaman_charge = data.shaman_charge + (1 - player.surface.daytime) * Balance.shaman_passive_charge * (tickinterval / 60)
data.shaman_charge = Math.min(data.shaman_charge, Balance.shaman_max_charge)
end
end
end