mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-26 03:52:22 +02:00
Tweaks
Changes: - When players enter the game they are now placed at the lobby. If the player left the game and rejoined within few minutes, they will be auto placed in the crew they were before. - Increased amount of worms you need to kill for a quest in Sandworm Caldera island. - Worm quest now can sometimes appear in Mysterious Caves island. - Fixed an issue where worm quest was sometimes incompletable due to not enough worms on the island. - Slightly reduced the cost of extra hold and new class purchases in captain's cabin. - When player joins protected run with no captain, he will get information in whisper, instead of parrot announcing it.
This commit is contained in:
parent
1223350cca
commit
9aa5511bf9
@ -354,6 +354,9 @@ warn_nearly_afk_captain=Note: If you go idle as captain for too long, the role p
|
||||
|
||||
personal_join_string_1=You have joined the crew '__1__' [Capacity __2__].
|
||||
personal_join_string_2=You have joined the crew '__1__' [Capacity __2__, Difficulty [color=__3__,__4__,__5__] __6__[/color]].
|
||||
player_join_game_info=Welcome! You're currently in a lobby. To hop into action, you can click "Crews" button up top to create a crew or choose an existing crew to join.
|
||||
player_joins_protected_run_with_no_captain=This run has captain protection turned on, so you will have to wait for captain to come back to control the ship.
|
||||
create_new_crew_tip=You can always join/create another run from the lobby by exiting current run by clicking red flag on top then clicking Quit Crew.
|
||||
|
||||
goto_oldest_crew_with_large_capacity=There are multiple crews on this server. You have been placed in the oldest crew with large capacity.
|
||||
goto_oldest_crew=There are multiple crews on this server. You have been placed in the oldest.
|
||||
|
@ -1486,54 +1486,58 @@ local function event_on_player_joined_game(event)
|
||||
Common.ensure_chunks_at(surface, spawnpoint, 5)
|
||||
end
|
||||
|
||||
Common.notify_player_expected(player, {'pirates.player_join_game_info'})
|
||||
|
||||
-- It was suggested to always spawn players in lobby, in hopes that they may want to create their crew increasing the popularity of scenario.
|
||||
|
||||
-- Auto-join the oldest crew:
|
||||
local ages = {}
|
||||
for _, memory in pairs(global_memory.crew_memories) do
|
||||
if Common.is_id_valid(memory.id)
|
||||
and (not memory.run_is_private)
|
||||
and memory.crewstatus == Crew.enum.ADVENTURING
|
||||
and memory.capacity
|
||||
and memory.crewplayerindices
|
||||
and #memory.crewplayerindices < memory.capacity
|
||||
and (not (memory.tempbanned_from_joining_data
|
||||
and memory.tempbanned_from_joining_data[player.index]
|
||||
and game.tick < memory.tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks)) then
|
||||
ages[#ages+1] = {id = memory.id, age = memory.age, large = (memory.capacity >= Common.minimum_run_capacity_to_enforce_space_for)}
|
||||
end
|
||||
end
|
||||
table.sort(
|
||||
ages,
|
||||
function(a, b) --true if a should be to the left of b
|
||||
if a.large and (not b.large) then
|
||||
return true
|
||||
elseif (not a.large) and b.large then
|
||||
return false
|
||||
else
|
||||
return a.age > b.age
|
||||
end
|
||||
end
|
||||
)
|
||||
if ages[1] then
|
||||
Crew.join_crew(player, ages[1].id)
|
||||
-- local ages = {}
|
||||
-- for _, memory in pairs(global_memory.crew_memories) do
|
||||
-- if Common.is_id_valid(memory.id)
|
||||
-- and (not memory.run_is_private)
|
||||
-- and memory.crewstatus == Crew.enum.ADVENTURING
|
||||
-- and memory.capacity
|
||||
-- and memory.crewplayerindices
|
||||
-- and #memory.crewplayerindices < memory.capacity
|
||||
-- and (not (memory.tempbanned_from_joining_data
|
||||
-- and memory.tempbanned_from_joining_data[player.index]
|
||||
-- and game.tick < memory.tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks)) then
|
||||
-- ages[#ages+1] = {id = memory.id, age = memory.age, large = (memory.capacity >= Common.minimum_run_capacity_to_enforce_space_for)}
|
||||
-- end
|
||||
-- end
|
||||
-- table.sort(
|
||||
-- ages,
|
||||
-- function(a, b) --true if a should be to the left of b
|
||||
-- if a.large and (not b.large) then
|
||||
-- return true
|
||||
-- elseif (not a.large) and b.large then
|
||||
-- return false
|
||||
-- else
|
||||
-- return a.age > b.age
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
-- if ages[1] then
|
||||
-- Crew.join_crew(player, ages[1].id)
|
||||
|
||||
local memory = global_memory.crew_memories[ages[1].id]
|
||||
if (not memory.run_is_protected) and #memory.crewplayerindices <= 1 then
|
||||
Roles.make_captain(player)
|
||||
end
|
||||
-- local memory = global_memory.crew_memories[ages[1].id]
|
||||
-- if (not memory.run_is_protected) and #memory.crewplayerindices <= 1 then
|
||||
-- Roles.make_captain(player)
|
||||
-- end
|
||||
|
||||
if ages[2] then
|
||||
if ages[1].large and (not ages[#ages].large) then
|
||||
Common.notify_player_announce(player, {'pirates.goto_oldest_crew_with_large_capacity'})
|
||||
else
|
||||
Common.notify_player_announce(player, {'pirates.goto_oldest_crew'})
|
||||
end
|
||||
end
|
||||
-- if ages[2] then
|
||||
-- if ages[1].large and (not ages[#ages].large) then
|
||||
-- Common.notify_player_announce(player, {'pirates.goto_oldest_crew_with_large_capacity'})
|
||||
-- else
|
||||
-- Common.notify_player_announce(player, {'pirates.goto_oldest_crew'})
|
||||
-- end
|
||||
-- end
|
||||
|
||||
if memory.run_is_protected and (not Roles.captain_exists()) then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_player_joins_protected_run_with_no_captain'})
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_create_new_crew_tip'})
|
||||
end
|
||||
end
|
||||
-- if memory.run_is_protected and (not Roles.captain_exists()) then
|
||||
-- Common.notify_player_expected(player, {'pirates.player_joins_protected_run_with_no_captain'})
|
||||
-- Common.notify_player_expected(player, {'pirates.create_new_crew_tip'})
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
|
||||
if not _DEBUG then
|
||||
|
@ -109,24 +109,25 @@ local function check_captain_or_admin(cmd)
|
||||
end
|
||||
|
||||
|
||||
local function check_trusted(cmd)
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
local player = game.players[cmd.player_index]
|
||||
local trusted = Session.get_trusted_table()
|
||||
local p
|
||||
if player then
|
||||
if player ~= nil then
|
||||
p = player.print
|
||||
if not (trusted[player.name] or player.admin) then
|
||||
p('[ERROR] Only admins and trusted weebs are allowed to run this command!', Color.fail)
|
||||
return false
|
||||
end
|
||||
else
|
||||
p = log
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
-- @UNUSED
|
||||
-- local function check_trusted(cmd)
|
||||
-- local Session = require 'utils.datastore.session_data'
|
||||
-- local player = game.players[cmd.player_index]
|
||||
-- local trusted = Session.get_trusted_table()
|
||||
-- local p
|
||||
-- if player then
|
||||
-- if player ~= nil then
|
||||
-- p = player.print
|
||||
-- if not (trusted[player.name] or player.admin) then
|
||||
-- p('[ERROR] Only admins and trusted weebs are allowed to run this command!', Color.fail)
|
||||
-- return false
|
||||
-- end
|
||||
-- else
|
||||
-- p = log
|
||||
-- end
|
||||
-- end
|
||||
-- return true
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
@ -630,10 +631,12 @@ function(cmd)
|
||||
|
||||
if not Gui.classes then return end
|
||||
|
||||
memory.spare_classes = {}
|
||||
memory.classes_table = {}
|
||||
memory.spare_classes = {}
|
||||
memory.recently_purchased_classes = {}
|
||||
memory.unlocked_classes = {}
|
||||
memory.available_classes_pool = Classes.initial_class_pool()
|
||||
memory.class_entry_count = 0
|
||||
|
||||
local players = Common.crew_get_crew_members_and_spectators()
|
||||
|
||||
@ -878,19 +881,6 @@ if _DEBUG then
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'bld',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
function(cmd)
|
||||
cmd_set_memory(cmd)
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_admin(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
local memory = Memory.get_crew_memory()
|
||||
memory.classes_table = {[1] = 1}
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command(
|
||||
'rad',
|
||||
{'pirates.cmd_explain_dev'},
|
||||
|
@ -515,8 +515,8 @@ function Public.click(event)
|
||||
Crew.join_crew(player, memory.id)
|
||||
|
||||
if memory.run_is_protected and (not Roles.captain_exists()) then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_player_joins_protected_run_with_no_captain'})
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_create_new_crew_tip'})
|
||||
Common.notify_player_expected(player, {'pirates.player_joins_protected_run_with_no_captain'})
|
||||
Common.notify_player_expected(player, {'pirates.create_new_crew_tip'})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -719,8 +719,8 @@ function Public.click(event)
|
||||
flow.ongoing_runs.body.password_namefield.visible = false
|
||||
|
||||
if memory.run_is_protected and (not Roles.captain_exists()) then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_player_joins_protected_run_with_no_captain'})
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_create_new_crew_tip'})
|
||||
Common.notify_player_expected(player, {'pirates.player_joins_protected_run_with_no_captain'})
|
||||
Common.notify_player_expected(player, {'pirates.create_new_crew_tip'})
|
||||
end
|
||||
else
|
||||
Common.notify_player_error(player, {'pirates.gui_join_private_run_error_wrong_password'})
|
||||
@ -729,8 +729,8 @@ function Public.click(event)
|
||||
Crew.join_crew(player, crewid)
|
||||
|
||||
if memory.run_is_protected and (not Roles.captain_exists()) then
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_player_joins_protected_run_with_no_captain'})
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_create_new_crew_tip'})
|
||||
Common.notify_player_expected(player, {'pirates.player_joins_protected_run_with_no_captain'})
|
||||
Common.notify_player_expected(player, {'pirates.create_new_crew_tip'})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,8 +93,10 @@ end
|
||||
|
||||
function Public.initialise_random_cave_island_quest()
|
||||
local rng = Math.random(100)
|
||||
if rng <= 50 then
|
||||
if rng <= 30 then
|
||||
Public.initialise_fish_quest()
|
||||
elseif rng <= 60 then
|
||||
Public.initialise_worms_quest()
|
||||
else
|
||||
Public.initialise_compilatron_quest()
|
||||
end
|
||||
@ -218,17 +220,24 @@ function Public.initialise_worms_quest()
|
||||
1 + 9 * Math.slopefromto(count, 0, 20) + 10 * Math.slopefromto(count, 20, 70)
|
||||
)
|
||||
|
||||
if Common.difficulty_scale() < 1 then needed = Math.max(1, needed - 3) end
|
||||
if Common.difficulty_scale() > 1 then needed = Math.max(1, needed + 2) end
|
||||
|
||||
local difficulty_name = CoreData.get_difficulty_option_informal_name_from_value(Common.difficulty_scale())
|
||||
if difficulty_name == 'easy' then
|
||||
needed = Math.max(1, needed - 3)
|
||||
elseif difficulty_name ~= 'normal' then
|
||||
needed = Math.max(1, needed + 2)
|
||||
if destination.subtype == IslandEnum.enum.RED_DESERT then
|
||||
needed = Math.random(20, 30)
|
||||
elseif destination.subtype == IslandEnum.enum.CAVE then
|
||||
needed = Math.random(15, 25)
|
||||
end
|
||||
|
||||
if needed >= 5 then
|
||||
-- These extra difficulty formulas don't work when there is very little amount of worms
|
||||
-- if Common.difficulty_scale() < 1 then needed = Math.max(1, needed - 3) end
|
||||
-- if Common.difficulty_scale() > 1 then needed = Math.max(1, needed + 2) end
|
||||
|
||||
-- local difficulty_name = CoreData.get_difficulty_option_informal_name_from_value(Common.difficulty_scale())
|
||||
-- if difficulty_name == 'easy' then
|
||||
-- needed = Math.max(1, needed - 3)
|
||||
-- elseif difficulty_name ~= 'normal' then
|
||||
-- needed = Math.max(1, needed + 2)
|
||||
-- end
|
||||
|
||||
if needed >= 10 then
|
||||
destination.dynamic_data.quest_type = enum.WORMS
|
||||
destination.dynamic_data.quest_reward = Public.quest_reward()
|
||||
destination.dynamic_data.quest_progress = 0
|
||||
|
@ -371,13 +371,13 @@ function Public.get_market_random_price(slot)
|
||||
|
||||
if slot == enum.SLOT_EXTRA_HOLD then
|
||||
local tier = memory.hold_surface_count
|
||||
return Common.pick_random_price(tier, Public.market_price_scale, math.min(1, 0.05 + tier * 0.15))
|
||||
return Common.pick_random_price(tier, 0.9*Public.market_price_scale, math.min(1, 0.05 + tier * 0.15))
|
||||
elseif slot == enum.SLOT_MORE_POWER then
|
||||
local tier = memory.boat.EEI_stage
|
||||
return Common.pick_random_price(tier, 0.5*Public.market_price_scale, math.min(1, 0.05 + tier * 0.15))
|
||||
elseif slot == enum.SLOT_RANDOM_CLASS then
|
||||
local tier = memory.boat.random_class_purchase_count + 1
|
||||
return Common.pick_random_price(tier, Public.market_price_scale, math.min(1, 0.05 + tier * 0.15))
|
||||
return Common.pick_random_price(tier, 0.9*Public.market_price_scale, math.min(1, 0.05 + tier * 0.15))
|
||||
end
|
||||
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user