mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-25 21:29:06 +02:00
Merge pull request #477 from danielmartin0/develop
Final pre-2.0 update
This commit is contained in:
commit
8d0c814496
@ -13,10 +13,13 @@ softmod_info_new_players_1=For New Players
|
||||
softmod_info_new_players_2=Mine coal and other resources and bring them to the ship to keep things going, or try asking the captain for more specific tasks.
|
||||
|
||||
softmod_info_tips_1=Features of the game that are hard to work out alone
|
||||
softmod_info_tips_2=• The captain (or officers) can steer the boat from the crow's nest by placing 50 rail signals in one of the blue boxes.\n• The quantity on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• Items dropped on the deck are transferred to the cabin when the boat moves for performance reasons.\n• When waiting for the captain's order to set sail, the free power supply is disabled.\n• Productivity modules can't be used in machines.\n• Resources granted to the ship appear in the captain's cabin.\n• Useful commands: /classinfo {classname} command, /plank {player}, /officer {player}, /undock, /ccolor, /clear_north_tanks, /clear_south_tanks, /tax
|
||||
softmod_info_tips_2=• The captain (or officers) can steer the boat from the crow's nest by placing 50 rail signals in one of the blue boxes.\n• The quantity on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• Items dropped on the deck are transferred to the cabin when the boat moves for performance reasons.\n• When waiting for the captain's order to set sail, the free power supply is disabled.\n• Resources granted to the ship appear in the captain's cabin.\n• Useful commands: /classinfo {classname} command, /plank {player}, /officer {player}, /undock, /ccolor, /clear_north_tanks, /clear_south_tanks, /tax, /reset_password
|
||||
|
||||
softmod_info_updates_1=v1.6.0
|
||||
softmod_info_updates_2=• 7 simultaneous crews supported. Surface loading is paused if other crews are engaged in a fight at sea, or are loading themselves.\n• New runs begin on the top lane so that beginners are more likely to encounter docks.\n• Disconnecting players once again have their items temporarily saved. Items are returned to the crew if players don't reconnect quickly.\n• Island surfaces are now always deleted after the boat leaves, fixing issues with marooned players.\n• Melee classes can no longer hold weapons. New class added.\n• The pause at sea now occurs after the loading time for the next destination.\n• Spectators can now change surfaces.\n• Crew proposal endorsements system removed.\n• Productivity modules are removed from the game until a later feature is released.\n• Balance tweaks:\n - Most maps now have some unkillable spawners\n - Mining productivity increases naturally with leagues traveled\n - Biter nighttime damage bonus nerfed\n - Tweaks to radioactive islands\n - Kovarex enrichment no longer researched at start of game\n - Land mines only purchasable at docks, and drop your speed when placed\n - Flamers nerf slightly increased\n - 5% weapon and turret damage upgrade available at each island market
|
||||
softmod_info_1_1=v1.6.1–1.6.5 highlights
|
||||
softmod_info_1_2=• Optional setting for new crews to disable blueprints.\n• Each island now has a grace period of 2 minutes before attacks.\n• Machines now deactivate after several minutes spent waiting at sea.\n• Private crews and captain-protected crews no longer revert to public crews when inactive. Runs now autodisband after 96 hours of inactivity.\n• Further slowing of gameplay for small crews.
|
||||
|
||||
softmod_info_2_1=v1.6.0 highlights
|
||||
softmod_info_2_2=• 7 simultaneous crews supported. Surface loading is paused if other crews are engaged in a fight at sea, or are loading themselves.\n• New runs begin on the top lane so that beginners are more likely to encounter docks.\n• Disconnecting players once again have their items temporarily saved. Items are returned to the crew if players don't reconnect quickly.\n• Players now die rather than being temporarily marooned if they miss the boat.\n• Melee classes can no longer hold weapons. New class added.\n• The pause at sea now occurs after the loading time for the next destination.\n• Balance tweaks:\n - Most maps now have some unkillable spawners.\n - Mining productivity increases naturally with leagues traveled.\n - Biter nighttime damage bonus nerfed.\n - Tweaks to radioactive islands.\n - Kovarex enrichment no longer researched at start of game.\n - Land mines only purchasable at docks, and drop your speed when placed.\n - Flamers nerf slightly increased.\n - 5% weapon and turret damage upgrade available at each island market.
|
||||
|
||||
softmod_info_credits_1=Credits
|
||||
softmod_info_credits_2=Designed/developed by thesixthroc. Updates from Piratux. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). 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
|
||||
@ -26,8 +29,6 @@ thesixthroc_support_toast=Support Pirate Ship at ko-fi.com/thesixthroc
|
||||
softmod_info_body_promote=by thesixthroc
|
||||
softmod_info_body_promote_old2=patreon.com/thesixthroc
|
||||
|
||||
softmod_info_body_clicky=Click to dismiss.
|
||||
|
||||
|
||||
|
||||
separator_1=,
|
||||
@ -76,7 +77,7 @@ parrot_cave_tip_1=That island looks suspiciously dark... I'm scared! Squawk!
|
||||
parrot_captain_first_time_in_cabin_hint=Squawk! Captains and officers can buy rail signals to steer the ship!
|
||||
parrot_cliff_explosive_tip=Cliff explosives? These look so powerful, they could blow away those annoying chests in the hold. Squawk!
|
||||
parrot_buried_treasure_tip=Squawk! If X marks the spot - use an item to dig!
|
||||
parrot_captain_left_protected_run=The captain has disconnected. Since this crew is captain-protected, the captain role will not be redistributed for __1__ hours. Squawk!
|
||||
parrot_captain_left_protected_run=The captain has disconnected. Since this crew is captain-protected, the captain role will not be redistributed. Squawk!
|
||||
parrot_player_joins_protected_run_with_no_captain=Hello there! Since this crew is captain-protected, you will have to wait for captain to return in order to control the ship.
|
||||
parrot_create_new_crew_tip=You can always create or join another crew. To do this, press the red flag on top, click 'Quit Crew', then press 'Crews'.
|
||||
parrot_crafters_disabled=Our machines have paused whilst we're waiting at sea.
|
||||
@ -400,9 +401,10 @@ highscore_heading_version=Version
|
||||
highscore_heading_difficulty=Difficulty
|
||||
highscore_heading_peak_players=PeakPlayers
|
||||
|
||||
|
||||
proposal_displayform=__1__ — __2__
|
||||
run_displayform= __2__
|
||||
second_element=__2__
|
||||
run_condition_private=, private
|
||||
run_condition_captain_protected=, cap'n-protected
|
||||
run_condition_blueprints_disabled=, BPs disabled
|
||||
crewmember_displayform=[color=__2__,__3__,__4__]__5__[/color] [color=1,1,1]__6__[/color]
|
||||
capacity_tooltip=Capacity. Sets the maximum number of crewmembers allowed.
|
||||
difficulty_tooltip=Difficulty.\n\nHigher difficulties have higher pollution and evo, higher biter damage, lower gold loot, but higher chest loot, along with small effects on the time per island, quest requirements, and silo position.\n\nDifficulty also determines the material the ship is made out of.
|
||||
@ -527,13 +529,13 @@ gui_runs_proposals_abandon_proposal=Abandon Proposal
|
||||
gui_runs_proposal_maker_run_name=Crew name
|
||||
gui_runs_proposal_maker_run_name_2=Name
|
||||
gui_runs_proposal_maker_capacity=Capacity
|
||||
gui_runs_proposal_maker_capacity_disabled=This capacity setting isn't available at the moment.
|
||||
gui_runs_proposal_maker_propose=Propose
|
||||
gui_runs_proposal_maker_no_limit=No limit
|
||||
gui_runs_proposal_maker_protected=Protected
|
||||
gui_runs_proposal_maker_protected_tooltip=Captain-protected crew. If the captain leaves or becomes afk, and there are no officers, the captain role stays vacant.\nIf the crew is empty or inactive for __1__ hours, it becomes unprotected.
|
||||
gui_runs_proposal_maker_blueprints_disabled=Blueprints disabled
|
||||
gui_runs_proposal_maker_protected=Captain-protected
|
||||
gui_runs_proposal_maker_protected_tooltip=Captain-protected crew. If the captain leaves or becomes afk, and there are no officers, the captain role stays vacant.
|
||||
gui_runs_proposal_maker_private=Private
|
||||
gui_runs_proposal_maker_private_tooltip=Private crew. Once the crew has launched, players must enter the password in order to join.\nIf the crew is empty or inactive for __1__ hours, the password is removed.
|
||||
gui_runs_proposal_maker_private_tooltip=Private crew. Once the crew has launched, players must enter the password in order to join.
|
||||
gui_runs_proposal_maker_password=Password
|
||||
gui_runs_proposal_maker_confirm_password=Confirm Password
|
||||
gui_runs_proposal_maker_error_protected_run_limit=All protected crew slots are occupied. Wait until protected crew slots free up to create your own.
|
||||
@ -543,9 +545,11 @@ gui_runs_proposal_maker_error_two_private_runs=You can't create more than one pr
|
||||
gui_runs_proposal_maker_error_three_runs=You can't create more than two crews.
|
||||
gui_runs_proposal_maker_error_private_run_password_no_match=Passwords do not match.
|
||||
gui_runs_proposal_maker_error_private_run_password_empty=Passwords can't be empty.
|
||||
gui_join_protected_run_info=This crew is protected.\nThis means when captain leaves the game, other members won't get the captain role (unless there are officers).\nCaptain protection expires in __1__:__2__:__3__
|
||||
gui_join_private_run_info=This crew is private.\nPlease enter a password to join the crew.\nThis crew will become public in __1__:__2__:__3__
|
||||
gui_join_protected_run_info=This crew is protected.\nThis means when captain leaves the game, other members won't get the captain role (unless there are officers)
|
||||
gui_join_private_run_info=This crew is private.\nEnter the password to join the crew.
|
||||
gui_join_private_run_error_wrong_password=The password you've entered is incorrect.
|
||||
cmd_notify_set_private_run_password=The password for __1__ has been set to __2__
|
||||
|
||||
|
||||
|
||||
|
||||
@ -613,6 +617,8 @@ cmd_error_not_captain=[ERROR] Only captains can run this command.
|
||||
cmd_error_invalid_player_name=[ERROR] Player __1__ not found.
|
||||
cmd_error_invalid_class_name=[ERROR] Class __1__ not found.
|
||||
cmd_error_color_not_found=[ERROR] Color __1__ not found.
|
||||
cmd_error_not_creator_of_crew=[ERROR] Only the original creator of the crew can run this command.
|
||||
cmd_error_no_existing_password=There is no existing password to overwrite for this crew.
|
||||
|
||||
cmd_explain_set_max_crews=is an admin command to set the maximum number of concurrent crews allowed on the server.
|
||||
cmd_explain_sail=is an admin command to set the ship sailing after an island, in case there's a problem with the captain doing so.
|
||||
|
@ -54,7 +54,7 @@ function Public.Tick_actions(tickinterval)
|
||||
if destination.type ~= Surfaces.enum.ISLAND then return end
|
||||
if memory.boat.state ~= Boats.enum_state.LANDED and memory.boat.state ~= Boats.enum_state.RETREATING then return end
|
||||
|
||||
if (memory.game_lost) or (destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + Common.seconds_after_landing_to_enable_AI) then return end
|
||||
if (memory.game_lost) or (destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + Balance.grace_period_on_arriving_at_island_seconds) then return end
|
||||
|
||||
if game.tick % (tickinterval * 2) == 0 and memory.boat.state == Boats.enum_state.LANDED then
|
||||
local extra_evo = 2 * tickinterval / 60 * Balance.evolution_per_second()
|
||||
@ -66,7 +66,7 @@ function Public.Tick_actions(tickinterval)
|
||||
-- if destination.subtype == IslandEnum.enum.RED_DESERT then return end -- This was a hack to stop biter boats causing attacks, but, it has the even worse effect of stopping all floating_pollution gathering.
|
||||
|
||||
|
||||
local minute_cycle = { -- warning: use even seconds only
|
||||
local ai_cycle_seconds = { -- warning: use even seconds only
|
||||
[2] = Public.tell_biters_near_silo_to_attack_it,
|
||||
[4] = Public.poke_script_groups,
|
||||
[6] = Public.try_main_attack,
|
||||
@ -75,18 +75,18 @@ function Public.Tick_actions(tickinterval)
|
||||
[18] = Public.poke_script_groups,
|
||||
[20] = Public.try_secondary_attack,
|
||||
|
||||
[32] = Public.tell_biters_near_silo_to_attack_it,
|
||||
[34] = Public.poke_script_groups,
|
||||
[36] = Public.try_rogue_attack,
|
||||
[42] = Public.tell_biters_near_silo_to_attack_it,
|
||||
[44] = Public.poke_script_groups,
|
||||
[46] = Public.try_rogue_attack,
|
||||
|
||||
[46] = Public.poke_inactive_scripted_biters,
|
||||
[48] = Public.create_mail_delivery_biters,
|
||||
[56] = Public.poke_inactive_scripted_biters,
|
||||
[58] = Public.create_mail_delivery_biters,
|
||||
|
||||
[54] = Public.try_boat_biters_attack,
|
||||
[74] = Public.try_boat_biters_attack,
|
||||
}
|
||||
|
||||
if minute_cycle[(game.tick / 60) % 60] then
|
||||
minute_cycle[(game.tick / 60) % 60]()
|
||||
if ai_cycle_seconds[(game.tick / 60) % 80] then
|
||||
ai_cycle_seconds[(game.tick / 60) % 80]()
|
||||
end
|
||||
end
|
||||
|
||||
@ -155,7 +155,7 @@ function Public.wave_size_rng() -- random variance in attack sizes
|
||||
wave_size_multiplier = 1.5
|
||||
elseif rng2 >= 15 * rng_scale then
|
||||
wave_size_multiplier = 2
|
||||
elseif rng2 >= 5 * rng_scale then
|
||||
elseif rng2 >= 2 * rng_scale then
|
||||
wave_size_multiplier = 3
|
||||
else
|
||||
wave_size_multiplier = 4
|
||||
@ -239,7 +239,7 @@ function Public.tell_biters_near_silo_to_attack_it()
|
||||
local enemy_force_name = memory.enemy_force_name
|
||||
|
||||
-- don't do this too early
|
||||
if destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + Common.seconds_after_landing_to_enable_AI * 4 then return end
|
||||
if destination.dynamic_data.timeratlandingtime and destination.dynamic_data.timer < destination.dynamic_data.timeratlandingtime + Balance.grace_period_on_arriving_at_island_seconds * 2 then return end
|
||||
if not (destination.dynamic_data.rocketsilos and destination.dynamic_data.rocketsilos[1] and destination.dynamic_data.rocketsilos[1].valid and destination.dynamic_data.rocketsilos[1].destructible) then return end
|
||||
|
||||
local attackcommand = Public.attack_target_entity(destination.dynamic_data.rocketsilos[1])
|
||||
@ -413,19 +413,7 @@ function Public.try_spawner_spend_fraction_of_available_pollution_on_biters(spaw
|
||||
if initial_spawner_count > 0 then
|
||||
local spawnerscount = Common.spawner_count(surface)
|
||||
if spawnerscount > 0 then
|
||||
-- if Common.current_destination().subtype and Common.current_destination().subtype == IslandEnum.enum.RADIOACTIVE then
|
||||
-- -- destroying spawners doesn't do quite as much here:
|
||||
-- base_pollution_cost_multiplier = (initial_spawner_count/spawnerscount)^(1/3)
|
||||
-- else
|
||||
-- base_pollution_cost_multiplier = (initial_spawner_count/spawnerscount)^(1/2)
|
||||
-- end
|
||||
-- base_pollution_cost_multiplier = (initial_spawner_count/spawnerscount)^(1/2)
|
||||
-- Now directly proportional:
|
||||
map_pollution_cost_multiplier = initial_spawner_count / spawnerscount
|
||||
|
||||
if memory.overworldx == 0 then
|
||||
map_pollution_cost_multiplier = Math.max(1, map_pollution_cost_multiplier)
|
||||
end -- The first map not being fully loaded when you get there commonly means it records too few initial spawners, which this helps fix
|
||||
map_pollution_cost_multiplier = Math.max(initial_spawner_count / spawnerscount, 1)
|
||||
else
|
||||
map_pollution_cost_multiplier = 1000000
|
||||
end
|
||||
|
@ -16,7 +16,8 @@ local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
-- local Progression = require 'maps.pirates.progression'
|
||||
local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
local Gui = require 'maps.pirates.gui.gui'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
-- local Gui = require 'maps.pirates.gui.gui'
|
||||
-- local Sea = require 'maps.pirates.surfaces.sea.sea'
|
||||
-- local Hold = require 'maps.pirates.surfaces.hold'
|
||||
-- local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
@ -1455,6 +1456,10 @@ local function event_on_player_joined_game(event)
|
||||
end
|
||||
end
|
||||
|
||||
-- if not _DEBUG then
|
||||
-- Gui.info.toggle_window(player)
|
||||
-- end
|
||||
|
||||
if crew_to_put_back_in then
|
||||
log('INFO: ' .. player.name .. ' (crew ID: ' .. crew_to_put_back_in .. ') joined the game')
|
||||
|
||||
@ -1479,7 +1484,7 @@ local function event_on_player_joined_game(event)
|
||||
local surface = game.surfaces[CoreData.lobby_surface_name]
|
||||
|
||||
player.teleport(surface.find_non_colliding_position('character', spawnpoint, 32, 0.5) or spawnpoint, surface)
|
||||
Roles.update_privileges(player)
|
||||
Permissions.update_privileges(player)
|
||||
|
||||
if not player.name then return end
|
||||
|
||||
@ -1551,10 +1556,6 @@ local function event_on_player_joined_game(event)
|
||||
-- end
|
||||
end
|
||||
|
||||
if not _DEBUG then
|
||||
Gui.info.toggle_window(player)
|
||||
end
|
||||
|
||||
global_memory.last_players_health[event.player_index] = player.character.health
|
||||
|
||||
-- player.teleport(surface.find_non_colliding_position('character', spawnpoint, 32, 0.5), surface)
|
||||
@ -1672,7 +1673,7 @@ local function on_player_changed_surface(event)
|
||||
end
|
||||
end
|
||||
|
||||
Roles.update_privileges(player)
|
||||
Permissions.update_privileges(player)
|
||||
|
||||
GuiWelcome.close_welcome_window(player)
|
||||
end
|
||||
@ -2091,10 +2092,7 @@ local function event_on_console_chat(event)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
local tag = player.tag
|
||||
if not tag then
|
||||
tag = ''
|
||||
end
|
||||
local tag = player.tag or ''
|
||||
local color = player.chat_color
|
||||
|
||||
-- if global.tournament_mode then
|
||||
@ -2115,11 +2113,13 @@ local function event_on_console_chat(event)
|
||||
end
|
||||
else
|
||||
-- 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
|
||||
if memory.name and player.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)
|
||||
elseif player.name then
|
||||
game.forces.player.print(player.name .. tag .. ': ' .. event.message, color)
|
||||
log('Error (non-critical): memory.name is nil')
|
||||
else
|
||||
log('Error (non-critical): player.name is nil')
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -2225,10 +2225,15 @@ local function event_on_gui_opened(event)
|
||||
if not player then return end
|
||||
if not player.valid then return end
|
||||
|
||||
if player.permission_group.name ~= 'restricted_area' then return end
|
||||
|
||||
if entity.name == 'wooden-chest' or entity.name == 'iron-chest' or entity.name == 'steel-chest' or entity.name == 'red-chest' or entity.name == 'blue-chest' then
|
||||
player.opened = nil
|
||||
if player.permission_group.name == 'cabin_privileged' then
|
||||
if entity.name == 'red-chest' then
|
||||
-- Even the captain has to wait for items to be removed from the red chests by loaders:
|
||||
player.opened = nil
|
||||
end
|
||||
elseif player.permission_group.name == 'cabin' then
|
||||
if entity.name == 'wooden-chest' or entity.name == 'iron-chest' or entity.name == 'steel-chest' or entity.name == 'red-chest' or entity.name == 'blue-chest' then
|
||||
player.opened = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ local Crew = require 'maps.pirates.crew'
|
||||
local Math = require 'maps.pirates.math'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local Kraken = require 'maps.pirates.surfaces.sea.kraken'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
|
||||
local Quest = require 'maps.pirates.quest'
|
||||
-- local ShopDock = require 'maps.pirates.shop.dock'
|
||||
@ -80,20 +80,20 @@ function Public.prevent_unbarreling_off_ship(tickinterval)
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_productivity_modules(surface, machines)
|
||||
for _, machine in ipairs(machines) do
|
||||
if machine and machine.valid then
|
||||
local modules = machine.get_module_inventory()
|
||||
if modules and modules.valid then
|
||||
local productivity_modules = modules.get_contents()['productivity-module']
|
||||
if productivity_modules and productivity_modules > 0 then
|
||||
modules.remove { name = 'productivity-module', count = productivity_modules }
|
||||
surface.spill_item_stack(machine.position, { name = 'productivity-module', count = productivity_modules }, true, nil, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- local function remove_productivity_modules(surface, machines)
|
||||
-- for _, machine in ipairs(machines) do
|
||||
-- if machine and machine.valid then
|
||||
-- local modules = machine.get_module_inventory()
|
||||
-- if modules and modules.valid then
|
||||
-- local productivity_modules = modules.get_contents()['productivity-module']
|
||||
-- if productivity_modules and productivity_modules > 0 then
|
||||
-- modules.remove { name = 'productivity-module', count = productivity_modules }
|
||||
-- surface.spill_item_stack(machine.position, { name = 'productivity-module', count = productivity_modules }, true, nil, true)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function Public.apply_restrictions_to_machines(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
@ -165,10 +165,10 @@ function Public.apply_restrictions_to_machines(tickinterval)
|
||||
type = { 'assembling-machine', 'furnace', 'lab' },
|
||||
force = memory.force_name
|
||||
}
|
||||
local drills = surface.find_entities_filtered {
|
||||
type = { 'mining-drill' },
|
||||
force = memory.force_name
|
||||
}
|
||||
-- local drills = surface.find_entities_filtered {
|
||||
-- type = { 'mining-drill' },
|
||||
-- force = memory.force_name
|
||||
-- }
|
||||
local power_machines = surface.find_entities_filtered {
|
||||
type = { 'generator', 'solar-panel', 'boiler', 'reactor' },
|
||||
force = memory.force_name
|
||||
@ -184,9 +184,6 @@ function Public.apply_restrictions_to_machines(tickinterval)
|
||||
machine.active = not memory.crafters_disabled
|
||||
end
|
||||
end
|
||||
|
||||
remove_productivity_modules(surface, crafters)
|
||||
remove_productivity_modules(surface, drills)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1008,7 +1005,9 @@ function Public.loading_update(tickinterval)
|
||||
local crew_fighting_kraken = nil
|
||||
|
||||
for id, crew_memory in pairs(global_memory.crew_memories) do
|
||||
if crew_memory.loadingticks and (crew_memory.loadingticks > memory.loadingticks or (crew_memory.loadingticks == memory.loadingticks and id < memory.id)) then
|
||||
local is_loading = crew_memory.loadingticks ~= nil and crew_memory.boat and crew_memory.boat.state and crew_memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP
|
||||
|
||||
if is_loading and (crew_memory.loadingticks > memory.loadingticks or (crew_memory.loadingticks == memory.loadingticks and crew_memory.age < memory.age)) then
|
||||
other_crew_loading = id
|
||||
end
|
||||
|
||||
@ -1073,8 +1072,6 @@ function Public.loading_update(tickinterval)
|
||||
Overworld.ensure_lane_generated_up_to(24, Crowsnest.Data.visibilitywidth)
|
||||
Overworld.ensure_lane_generated_up_to(-24, Crowsnest.Data.visibilitywidth)
|
||||
|
||||
log(_inspect(memory.destinations))
|
||||
|
||||
for i = 1, #memory.destinations do
|
||||
if memory.destinations[i].overworld_position.x == 0 then
|
||||
memory.mapbeingloadeddestination_index = i
|
||||
@ -1110,6 +1107,8 @@ function Public.loading_update(tickinterval)
|
||||
end
|
||||
|
||||
Progression.go_from_starting_dock_to_first_destination()
|
||||
|
||||
log("starting game for crew " .. memory.name)
|
||||
elseif memory.loadingticks > 1230 then
|
||||
if boat then
|
||||
boat.speed = 0
|
||||
@ -1148,13 +1147,12 @@ function Public.loading_update(tickinterval)
|
||||
local fraction = memory.loadingticks / (total + (memory.extra_time_at_sea or 0))
|
||||
|
||||
if fraction > Common.fraction_of_map_loaded_at_sea then
|
||||
boat.state = Boats.enum_state.ATSEA_WAITING_TO_SAIL
|
||||
memory.at_sea_waiting_game_tick = game.tick
|
||||
|
||||
local force = memory.force
|
||||
if not (force and force.valid) then return end
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
if currentdestination.type == Surfaces.enum.DOCK then
|
||||
Progression.progress_to_destination(destination_index)
|
||||
else
|
||||
boat.state = Boats.enum_state.ATSEA_WAITING_TO_SAIL
|
||||
memory.at_sea_waiting_game_tick = game.tick
|
||||
end
|
||||
else
|
||||
PiratesApiEvents.load_some_map_chunks_random_order(surface, currentdestination, fraction) --random order is good for maze world
|
||||
if currentdestination.subtype == IslandEnum.enum.CAVE then
|
||||
@ -1712,43 +1710,6 @@ function Public.revealed_buried_treasure_distance_check()
|
||||
end
|
||||
end
|
||||
|
||||
function Public.update_protected_run_lock_timer(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
if memory.run_is_protected 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
|
||||
|
||||
if memory.protected_run_lock_timer <= 0 then
|
||||
Common.notify_game({ 'pirates.protected_run_lock_expired', memory.name })
|
||||
memory.run_is_protected = false
|
||||
Roles.assign_captain_based_on_priorities()
|
||||
end
|
||||
end
|
||||
else
|
||||
memory.protected_run_lock_timer = 60 * 60 * 60 * CoreData.protected_run_lock_amount_hr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.update_private_run_lock_timer(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
if memory.run_is_private then
|
||||
if Common.activecrewcount() <= 0 then
|
||||
if memory.private_run_lock_timer > 0 then
|
||||
memory.private_run_lock_timer = memory.private_run_lock_timer - tickinterval
|
||||
|
||||
if memory.private_run_lock_timer <= 0 then
|
||||
Common.notify_game({ 'pirates.private_run_lock_expired', memory.name })
|
||||
memory.run_is_private = false
|
||||
end
|
||||
end
|
||||
else
|
||||
memory.private_run_lock_timer = 60 * 60 * 60 * CoreData.private_run_lock_amount_hr
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.update_pet_biter_lifetime(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
if memory.pet_biters then
|
||||
|
@ -109,7 +109,7 @@ Public.EEI_stages = { --multipliers
|
||||
function Public.scripted_biters_pollution_cost_multiplier()
|
||||
local early_game_factor = 1 + 1.2 / ((1 + (Common.overworldx() / 40)) ^ (1.5 + Common.difficulty_scale())) -- the complicated factor makes the early-game easier; in particular the first island, but on easier difficulties the next few islands as well
|
||||
|
||||
local factor_accounting_for_new_damage_upgrades = 0.98 ^ (Common.overworldx() / 40)
|
||||
local factor_accounting_for_new_damage_upgrades = 0.985 ^ (Common.overworldx() / 40)
|
||||
|
||||
return (1.1 / Math.sloped(Common.difficulty_scale(), 0.7)) * early_game_factor * factor_accounting_for_new_damage_upgrades
|
||||
end
|
||||
@ -171,7 +171,7 @@ function Public.game_slowness_scale()
|
||||
-- return 1 / (Public.crew_scale()^(50/100) / Math.sloped(Common.difficulty_scale(), 1/4)) --changed crew_scale factor significantly to help smaller crews
|
||||
|
||||
-- local scale = 0.3 + Math.sloped(Common.difficulty_scale(), -0.15) / (Public.crew_scale()^(1/8))
|
||||
local scale = 2.6 * Math.sloped(Common.difficulty_scale(), -0.2) - Public.crew_scale() ^ (1 / 4)
|
||||
local scale = 2.6 * Math.sloped(Common.difficulty_scale(), -0.2) - Public.crew_scale() ^ (1 / 2)
|
||||
return Math.max(1, scale)
|
||||
end
|
||||
|
||||
@ -187,7 +187,7 @@ end
|
||||
|
||||
-- Waiting at sea forever isn't generally fun for your teammates, so we encourage keeping the action moving:
|
||||
function Public.seconds_until_machines_shut_down_at_sea()
|
||||
local minimum_mins = 3
|
||||
local minimum_mins = 7
|
||||
return Math.ceil(60 * minimum_mins * Public.game_slowness_scale())
|
||||
end
|
||||
|
||||
@ -214,8 +214,10 @@ end
|
||||
|
||||
Public.expected_time_fraction = 0.7
|
||||
|
||||
Public.grace_period_on_arriving_at_island_seconds = 120
|
||||
|
||||
function Public.expected_time_on_island() --always >0
|
||||
return Public.expected_time_fraction * Public.max_time_on_island_formula_seconds()
|
||||
return Public.expected_time_fraction * Public.max_time_on_island_formula_seconds() + Public.grace_period_on_arriving_at_island_seconds
|
||||
end
|
||||
|
||||
function Public.fuel_depletion_rate_static()
|
||||
@ -255,21 +257,23 @@ function Public.boat_passive_pollution_per_minute(time)
|
||||
|
||||
local boost
|
||||
if time then --sharp rise approaching T, steady increase thereafter
|
||||
if time > T then
|
||||
boost = 20 + 10 * (time - T) / (30 / 100 * T)
|
||||
elseif time >= 90 / 100 * T then
|
||||
local adjusted_time = Math.max(0, time - Public.grace_period_on_arriving_at_island_seconds)
|
||||
|
||||
if adjusted_time > T then
|
||||
boost = 20 + 10 * (adjusted_time - T) / (30 / 100 * T)
|
||||
elseif adjusted_time >= 90 / 100 * T then
|
||||
boost = 16
|
||||
elseif time >= 85 / 100 * T then
|
||||
elseif adjusted_time >= 85 / 100 * T then
|
||||
boost = 12
|
||||
elseif time >= 80 / 100 * T then
|
||||
elseif adjusted_time >= 80 / 100 * T then
|
||||
boost = 8
|
||||
elseif time >= 70 / 100 * T then
|
||||
elseif adjusted_time >= 70 / 100 * T then
|
||||
boost = 5
|
||||
elseif time >= 60 / 100 * T then
|
||||
elseif adjusted_time >= 60 / 100 * T then
|
||||
boost = 3
|
||||
elseif time >= 50 / 100 * T then
|
||||
elseif adjusted_time >= 50 / 100 * T then
|
||||
boost = 2
|
||||
elseif time >= 40 / 100 * T then
|
||||
elseif adjusted_time >= 40 / 100 * T then
|
||||
boost = 1.5
|
||||
else
|
||||
boost = 1
|
||||
@ -346,25 +350,27 @@ function Public.evolution_per_second()
|
||||
end
|
||||
|
||||
function Public.evolution_per_nest_kill() --it's important to have evo go up with biter base kills, to provide resistance if you try to plow through all the bases
|
||||
local destination = Common.current_destination()
|
||||
if Common.overworldx() == 0 then return 0 end
|
||||
-- local destination = Common.current_destination()
|
||||
-- if Common.overworldx() == 0 then return 0 end
|
||||
|
||||
if destination and destination.dynamic_data and destination.dynamic_data.timer and destination.dynamic_data.timer > 0 and destination.dynamic_data.initial_spawner_count and destination.dynamic_data.initial_spawner_count > 0 then
|
||||
local initial_spawner_count = destination.dynamic_data.initial_spawner_count
|
||||
local base_evo_jump = 0.04 * (1 / initial_spawner_count) --extra friction to make them hard to mow through, even at late times
|
||||
-- if destination and destination.dynamic_data and destination.dynamic_data.timer and destination.dynamic_data.timer > 0 and destination.dynamic_data.initial_spawner_count and destination.dynamic_data.initial_spawner_count > 0 then
|
||||
-- local initial_spawner_count = destination.dynamic_data.initial_spawner_count
|
||||
-- local base_evo_jump = 0.04 * (1 / initial_spawner_count) --extra friction to make them hard to mow through, even at late times
|
||||
|
||||
local time = destination.dynamic_data.timer
|
||||
-- local time_to_jump_to = Public.expected_time_on_island() * ((1/Public.expected_time_fraction)^(2/3))
|
||||
local time_to_jump_to = Public.max_time_on_island_formula_seconds()
|
||||
if time > time_to_jump_to then
|
||||
return base_evo_jump
|
||||
else
|
||||
-- evo it 'would have' contributed:
|
||||
return (1 / initial_spawner_count) * Public.expected_time_evo() * (time_to_jump_to - time) / time_to_jump_to + base_evo_jump
|
||||
end
|
||||
else
|
||||
return 0
|
||||
end
|
||||
-- local time = destination.dynamic_data.timer
|
||||
-- -- local time_to_jump_to = Public.expected_time_on_island() * ((1/Public.expected_time_fraction)^(2/3))
|
||||
-- local time_to_jump_to = Public.max_time_on_island_formula_seconds()
|
||||
-- if time > time_to_jump_to then
|
||||
-- return base_evo_jump
|
||||
-- else
|
||||
-- -- evo it 'would have' contributed:
|
||||
-- return (1 / initial_spawner_count) * Public.expected_time_evo() * (time_to_jump_to - time) / time_to_jump_to + base_evo_jump
|
||||
-- end
|
||||
-- else
|
||||
-- return 0
|
||||
-- end
|
||||
|
||||
return 0
|
||||
|
||||
-- return 0.003 * Common.difficulty_scale()
|
||||
end
|
||||
@ -514,7 +520,10 @@ function Public.weapon_damage_upgrade_percentage()
|
||||
end
|
||||
|
||||
function Public.weapon_damage_upgrade_price()
|
||||
return { { name = 'coin', amount = 2000 }, { name = 'steel-plate', amount = 100 } } --NOTE: Should be different to other 'nothing' costs. See the use of this function in shop.lua.
|
||||
-- local steel_plate_cost = 100
|
||||
local steel_plate_cost = 100 * (1 + 0.1 * (Common.overworldx() / 40))
|
||||
|
||||
return { { name = 'coin', amount = 2000 }, { name = 'steel-plate', amount = steel_plate_cost } } --NOTE: Coin cost should be different to other 'nothing' costs. See the use of this function in shop.lua.
|
||||
end
|
||||
|
||||
Public.quest_structures_first_appear_at = 40
|
||||
|
@ -21,7 +21,7 @@ local Islands = require 'maps.pirates.surfaces.islands.islands'
|
||||
local Progression = require 'maps.pirates.progression'
|
||||
local Crowsnest = require 'maps.pirates.surfaces.crowsnest'
|
||||
local PiratesApiEvents = require 'maps.pirates.api_events'
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local Effects = require 'maps.pirates.effects'
|
||||
local Kraken = require 'maps.pirates.surfaces.sea.kraken'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
@ -29,7 +29,7 @@ local simplex_noise = require 'utils.simplex_noise'.d2
|
||||
local Token = require 'utils.token'
|
||||
local Task = require 'utils.task'
|
||||
local Highscore = require 'maps.pirates.highscore'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
local Classes = require 'maps.pirates.roles.classes'
|
||||
local Gui = require 'maps.pirates.gui.gui'
|
||||
-- local Session = require 'utils.datastore.session_data'
|
||||
@ -73,7 +73,7 @@ local function check_captain(cmd)
|
||||
if player ~= nil then
|
||||
p = player.print
|
||||
if not Common.validate_player(player) then return end
|
||||
if not (Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN) then
|
||||
if not (Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN) then
|
||||
p({ 'pirates.cmd_error_not_captain' }, Color.fail)
|
||||
return false
|
||||
end
|
||||
@ -91,7 +91,7 @@ local function check_captain_or_admin(cmd)
|
||||
if player ~= nil then
|
||||
p = player.print
|
||||
if not Common.validate_player(player) then return end
|
||||
if not (player.admin or Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN) then
|
||||
if not (player.admin or Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN) then
|
||||
p({ 'pirates.cmd_error_not_captain' }, Color.fail)
|
||||
return false
|
||||
end
|
||||
@ -102,6 +102,28 @@ local function check_captain_or_admin(cmd)
|
||||
return true
|
||||
end
|
||||
|
||||
local function check_creator_of_crew(cmd)
|
||||
local player = game.players[cmd.player_index]
|
||||
local p
|
||||
if player then
|
||||
if player ~= nil then
|
||||
p = player.print
|
||||
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local creator = memory.original_proposal.created_by_player
|
||||
|
||||
if creator ~= player.index then
|
||||
Common.notify_player_error(player, { 'pirates.cmd_error_not_creator_of_crew' })
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- @UNUSED
|
||||
-- local function check_trusted(cmd)
|
||||
@ -335,6 +357,35 @@ commands.add_command(
|
||||
end
|
||||
end)
|
||||
|
||||
-- *** *** --
|
||||
--*** CREATOR OF CREW COMMANDS ***--
|
||||
-- *** *** --
|
||||
|
||||
commands.add_command(
|
||||
'reset_password',
|
||||
{ 'pirates.cmd_explain_set_private_run_password' },
|
||||
function (cmd)
|
||||
cmd_set_memory(cmd)
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
if not Common.is_id_valid(memory.id) then return end
|
||||
|
||||
local param = tostring(cmd.parameter)
|
||||
if check_creator_of_crew(cmd) then
|
||||
local player = game.players[cmd.player_index]
|
||||
|
||||
if not memory.private_run_password then
|
||||
Common.notify_player_error(player, { 'pirates.cmd_error_no_existing_password' })
|
||||
return false
|
||||
end
|
||||
|
||||
memory.private_run_password = param
|
||||
Common.notify_player_expected(player, { 'pirates.cmd_notify_set_private_run_password', memory.name, param })
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
-- *** *** --
|
||||
--*** ADMIN COMMANDS ***--
|
||||
-- *** *** --
|
||||
@ -565,7 +616,6 @@ if _DEBUG then
|
||||
end
|
||||
|
||||
memory.currentdestination_index = memory.mapbeingloadeddestination_index
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
Surfaces.create_surface(Common.current_destination())
|
||||
Task.set_timeout_in_ticks(60, go_2, { id = data.id })
|
||||
end
|
||||
@ -632,7 +682,7 @@ if _DEBUG then
|
||||
created_by_player = cmd.player_index
|
||||
}
|
||||
|
||||
Crew.initialise_crew(proposal)
|
||||
Crew.initialise_crew(proposal, player.position)
|
||||
Crew.initialise_crowsnest() --contains a Task
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
@ -21,19 +21,16 @@ local Public = {}
|
||||
|
||||
Public.starting_ships_count = 7
|
||||
Public.active_crews_cap = 7
|
||||
Public.private_run_cap = 3
|
||||
Public.protected_but_not_private_run_cap = 3
|
||||
Public.minimumCapacitySliderValue = 1
|
||||
Public.private_run_cap = 4
|
||||
Public.protected_but_not_private_run_cap = 2
|
||||
Public.minimum_run_capacity_to_enforce_space_for = 22
|
||||
|
||||
-- auto-disbanding when there are no players left in the crew:
|
||||
-- Public.autodisband_ticks = nil
|
||||
Public.autodisband_ticks = 60 * 60 * 60 * 24 * 3 -- should not be zero (as this messes with saving and loading a game, which boots the player for a moment.) Also note that the server may run very slowly when no-one is on it.
|
||||
-- Public.autodisband_hours = nil
|
||||
Public.autodisband_hours = 24 * 4 -- should not be zero (as this messes with saving and loading a game, which boots the player for a moment.) Also note that the server may run very slowly when no-one is on it.
|
||||
|
||||
Public.boat_steps_at_a_time = 1
|
||||
|
||||
Public.seconds_after_landing_to_enable_AI = 45
|
||||
|
||||
Public.boat_default_starting_distance_from_shore = 22
|
||||
-- Public.mapedge_distance_from_boat_starting_position = 136
|
||||
Public.mapedge_distance_from_boat_starting_position = 272 -- to accommodate horseshoe
|
||||
@ -1620,7 +1617,7 @@ function Public.init_game_settings(technology_price_multiplier)
|
||||
game.map_settings.path_finder.short_cache_min_algo_steps_to_cache = 100
|
||||
game.map_settings.path_finder.cache_accept_path_start_distance_ratio = 0.1
|
||||
|
||||
game.map_settings.enemy_expansion.enabled = true
|
||||
game.map_settings.enemy_expansion.enabled = false
|
||||
-- faster expansion:
|
||||
-- game.map_settings.enemy_expansion.min_expansion_cooldown = 4 * 3600
|
||||
-- game.map_settings.enemy_expansion.max_expansion_cooldown = 30 * 3600
|
||||
@ -1699,9 +1696,9 @@ function Public.get_item_blacklist(tier)
|
||||
-- blacklist['cannon-shell'] = true
|
||||
-- blacklist['explosive-cannon-shell'] = true
|
||||
-- blacklist['speed-module-3'] = true
|
||||
blacklist['productivity-module'] = true
|
||||
blacklist['productivity-module-2'] = true
|
||||
blacklist['productivity-module-3'] = true
|
||||
-- blacklist['productivity-module'] = true
|
||||
-- blacklist['productivity-module-2'] = true
|
||||
-- blacklist['productivity-module-3'] = true
|
||||
-- blacklist['effectivity-module-3'] = true
|
||||
-- blacklist['space-science-pack'] = true
|
||||
-- blacklist['rocket-control-unit'] = true
|
||||
|
@ -7,10 +7,7 @@ local _inspect = require 'utils.inspect'.inspect
|
||||
local Public = {}
|
||||
|
||||
Public.scenario_id_name = 'pirates'
|
||||
Public.version_string = '1.6.0' --major.minor.patch versioning, to match factorio mod portal
|
||||
|
||||
Public.blueprint_library_allowed = true
|
||||
Public.blueprint_importing_allowed = true
|
||||
Public.version_string = '1.6.5' --major.minor.patch versioning, to match factorio mod portal
|
||||
|
||||
Public.rocket_silo_death_causes_loss = false
|
||||
|
||||
@ -20,9 +17,6 @@ Public.total_max_biters = 2200
|
||||
|
||||
Public.lobby_surface_name = '000-000-Lobby'
|
||||
|
||||
Public.private_run_lock_amount_hr = 24 -- how many hours need to pass, when crew is empty or inactive, until private run becomes public
|
||||
Public.protected_run_lock_amount_hr = 24 -- how many hours need to pass, when crew is empty or inactive, until captain protection expires
|
||||
|
||||
Public.colors = {
|
||||
coal = { r = 0.5, g = 0.5, b = 0.5 },
|
||||
wood = { r = 204, g = 158, b = 67 },
|
||||
@ -109,27 +103,43 @@ Public.comfy_emojis = {
|
||||
}
|
||||
|
||||
Public.capacity_options = {
|
||||
{ value = 2, icon = 'virtual-signal/signal-2', text = '2', text2 = '/2', text3 = '2' },
|
||||
{ value = 4, icon = 'virtual-signal/signal-4', text = '4', text2 = '/4', text3 = '4' },
|
||||
{ value = 8, icon = 'virtual-signal/signal-8', text = '8', text2 = '/8', text3 = '8' },
|
||||
{ value = 24, icon = 'virtual-signal/signal-blue', text = '24', text2 = '/24', text3 = '24' },
|
||||
{ value = 999, icon = 'virtual-signal/signal-white', text = 'Inf.', text2 = '', text3 = 'Inf' },
|
||||
{ value = 2, icon = 'virtual-signal/signal-2', text = '2', text2 = '/2', text3 = '2' },
|
||||
{ value = 4, icon = 'virtual-signal/signal-4', text = '4', text2 = '/4', text3 = '4' },
|
||||
{ value = 8, icon = 'virtual-signal/signal-8', text = '8', text2 = '/8', text3 = '8' },
|
||||
{ value = 24, icon = 'virtual-signal/signal-blue', text = '24', text2 = '/24', text3 = '24' },
|
||||
{ value = 999, icon = 'virtual-signal/signal-white', text = 'Inf.', text2 = '/inf', text3 = 'Inf' },
|
||||
-- {value = 64, icon = 'item/storage-tank', text = '64'},
|
||||
}
|
||||
|
||||
-- Prefer not to change difficulty values if possible, since even tiny value change can have big effect on some formulas that rely on it.
|
||||
Public.difficulty_options = {
|
||||
-- The difficulty values we currently offer
|
||||
|
||||
--For the value of Easy difficulty, we are pulled in two directions: We wish to make the game comfy to play for those who haven't played it, but we also wish to represent the game mechanics faithfully so that Normal is not a crazy distance away.
|
||||
{ value = 0.5, icon = 'item/firearm-magazine', text = { 'pirates.difficulty_easy' }, associated_color = { r = 50, g = 255, b = 50 } },
|
||||
|
||||
{ value = 1.0, icon = 'item/piercing-rounds-magazine', text = { 'pirates.difficulty_normal' }, associated_color = { r = 255, g = 255, b = 50 } },
|
||||
|
||||
{ value = 1.5, icon = 'item/uranium-rounds-magazine', text = { 'pirates.difficutly_hard' }, associated_color = { r = 255, g = 50, b = 50 } },
|
||||
|
||||
{ value = 2, icon = 'item/atomic-bomb', text = { 'pirates.difficulty_nightmare' }, associated_color = { r = 170, g = 60, b = 60 } },
|
||||
{
|
||||
value = 0.5,
|
||||
icon = 'firearm-magazine',
|
||||
text = { 'pirates.difficulty_easy' },
|
||||
associated_color = { r = 50, g = 255, b = 50 }
|
||||
},
|
||||
{
|
||||
value = 1.0,
|
||||
icon = 'piercing-rounds-magazine',
|
||||
text = { 'pirates.difficulty_normal' },
|
||||
associated_color = { r = 255, g = 255, b = 50 }
|
||||
},
|
||||
{
|
||||
value = 1.5,
|
||||
icon = 'uranium-rounds-magazine',
|
||||
text = { 'pirates.difficutly_hard' },
|
||||
associated_color = { r = 255, g = 50, b = 50 }
|
||||
},
|
||||
{
|
||||
value = 2,
|
||||
icon = 'atomic-bomb',
|
||||
text = { 'pirates.difficulty_nightmare' },
|
||||
associated_color = { r = 170, g = 60, b = 60 }
|
||||
},
|
||||
}
|
||||
|
||||
function Public.get_difficulty_option_from_value(difficulty_value)
|
||||
-- given a difficulty value, key in to the closesy entry in the above table. (organising things this way allows us to make changes to the 'value' keys in the above table without disrupting e.g. past highscores data)
|
||||
if difficulty_value <= 0.75 then
|
||||
@ -162,10 +172,10 @@ end
|
||||
-- }
|
||||
|
||||
Public.daynightcycle_types = {
|
||||
{ displayname = { 'pirates.daynightcycle_static' }, 0 },
|
||||
{ displayname = { 'pirates.daynightcycle_slowcyclic' }, ticksperday = 100000 },
|
||||
{ displayname = { 'pirates.daynightcycle_cyclic' }, ticksperday = 80000 },
|
||||
{ displayname = { 'pirates.daynightcycle_fastcyclic' }, ticksperday = 60000 },
|
||||
{ displayname = { 'pirates.daynightcycle_static' }, 0 },
|
||||
{ displayname = { 'pirates.daynightcycle_slowcyclic' }, ticksperday = 100000 },
|
||||
{ displayname = { 'pirates.daynightcycle_cyclic' }, ticksperday = 80000 },
|
||||
{ displayname = { 'pirates.daynightcycle_fastcyclic' }, ticksperday = 60000 },
|
||||
{ displayname = { 'pirates.daynightcycle_rapidcyclic' }, ticksperday = 40000 },
|
||||
}
|
||||
|
||||
|
@ -279,8 +279,10 @@ function Public.join_spectators(player, crewid)
|
||||
end
|
||||
|
||||
if #Common.crew_get_crew_members() == 0 then
|
||||
if Common.autodisband_ticks then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_ticks
|
||||
local exists_disband_tick = memory.crew_disband_tick and memory.crew_disband_tick > game.tick
|
||||
|
||||
if Common.autodisband_hours and not exists_disband_tick and Server.get_current_time() then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_hours * 60 * 60 * 60
|
||||
end
|
||||
end
|
||||
|
||||
@ -312,8 +314,10 @@ function Public.leave_spectators(player, quiet)
|
||||
memory.spectatorplayerindices = Utils.ordered_table_with_values_removed(memory.spectatorplayerindices, player.index)
|
||||
|
||||
if #Common.crew_get_crew_members() == 0 then
|
||||
if Common.autodisband_ticks then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_ticks
|
||||
local exists_disband_tick = memory.crew_disband_tick and memory.crew_disband_tick > game.tick
|
||||
|
||||
if Common.autodisband_hours and not exists_disband_tick and Server.get_current_time() then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_hours * 60 * 60 * 60
|
||||
end
|
||||
end
|
||||
|
||||
@ -492,8 +496,8 @@ function Public.leave_crew(player, to_lobby, quiet)
|
||||
if #Common.crew_get_crew_members() == 0 then
|
||||
local exists_disband_tick = memory.crew_disband_tick and memory.crew_disband_tick > game.tick
|
||||
|
||||
if Common.autodisband_ticks and not exists_disband_tick then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_ticks
|
||||
if Common.autodisband_hours and not exists_disband_tick and Server.get_current_time() then
|
||||
memory.crew_disband_tick = game.tick + Common.autodisband_hours * 60 * 60 * 60
|
||||
end
|
||||
|
||||
-- if _DEBUG then memory.crew_disband_tick = game.tick + 30*60*60 end
|
||||
@ -635,17 +639,24 @@ function Public.disband_crew(donotprint)
|
||||
Lobby.place_starting_dock_showboat(id)
|
||||
end
|
||||
|
||||
function Public.generate_new_crew_id()
|
||||
function Public.generate_new_crew_id(player_position)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
local max_crews = Common.starting_ships_count
|
||||
local closest_id = nil
|
||||
local closest_distance = math.huge
|
||||
|
||||
for id = 1, max_crews do
|
||||
if not global_memory.crew_memories[id] then
|
||||
return id
|
||||
local boat_position = Lobby.StartingBoats[id].position
|
||||
local distance = Math.distance(player_position, boat_position)
|
||||
if distance < closest_distance then
|
||||
closest_distance = distance
|
||||
closest_id = id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
return closest_id
|
||||
end
|
||||
|
||||
function Public.player_abandon_proposal(player)
|
||||
@ -680,10 +691,10 @@ function Public.initialise_crowsnest_2()
|
||||
Crowsnest.crowsnest_surface_delayed_init()
|
||||
end
|
||||
|
||||
function Public.initialise_crew(accepted_proposal)
|
||||
function Public.initialise_crew(accepted_proposal, player_position)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
|
||||
local new_id = Public.generate_new_crew_id()
|
||||
local new_id = Public.generate_new_crew_id(player_position)
|
||||
if not new_id then return end
|
||||
|
||||
game.reset_time_played() -- affects the multiplayer lobby view
|
||||
@ -745,11 +756,10 @@ function Public.initialise_crew(accepted_proposal)
|
||||
memory.difficulty = CoreData.difficulty_options[accepted_proposal.difficulty_option].value
|
||||
memory.capacity = CoreData.capacity_options[accepted_proposal.capacity_option].value
|
||||
-- memory.mode = CoreData.mode_options[accepted_proposal.mode_option].value
|
||||
memory.run_has_blueprints_disabled = accepted_proposal.run_has_blueprints_disabled
|
||||
memory.run_is_protected = accepted_proposal.run_is_protected
|
||||
memory.protected_run_lock_timer = 60 * 60 * 60 * CoreData.protected_run_lock_amount_hr
|
||||
memory.run_is_private = accepted_proposal.run_is_private
|
||||
memory.private_run_password = accepted_proposal.private_run_password
|
||||
memory.private_run_lock_timer = 60 * 60 * 60 * CoreData.private_run_lock_amount_hr
|
||||
|
||||
memory.destinationsvisited_indices = {}
|
||||
memory.stored_fuel = Balance.starting_fuel
|
||||
@ -967,7 +977,7 @@ function Public.reset_crew_and_enemy_force(id)
|
||||
|
||||
|
||||
-- Trying out having this be researched by default, in order to make coal (the resource needed to power the ship) interchangeable with oil, thereby making coal more precious:
|
||||
crew_force.technologies['coal-liquefaction'].researched = true
|
||||
-- crew_force.technologies['coal-liquefaction'].researched = true
|
||||
|
||||
-- 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
|
||||
|
||||
@ -1049,8 +1059,9 @@ function Public.reset_crew_and_enemy_force(id)
|
||||
crew_force.technologies['gate'].enabled = true
|
||||
|
||||
-- crew_force.technologies['productivity-module'].enabled = false
|
||||
crew_force.technologies['productivity-module-2'].enabled = false
|
||||
crew_force.technologies['productivity-module-3'].enabled = false
|
||||
-- crew_force.technologies['productivity-module-2'].enabled = false
|
||||
-- crew_force.technologies['productivity-module-3'].enabled = false
|
||||
|
||||
-- crew_force.technologies['speed-module'].enabled = true
|
||||
-- crew_force.technologies['speed-module-2'].enabled = false
|
||||
-- crew_force.technologies['speed-module-3'].enabled = false
|
||||
|
@ -1,16 +0,0 @@
|
||||
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
|
||||
|
||||
|
||||
local Event = require 'utils.event'
|
||||
|
||||
local Public = {}
|
||||
|
||||
-- just beginning this, gotta finish reformulating the gui updates in terms of events:
|
||||
|
||||
local enum = {
|
||||
update_crew_progress_gui = Event.generate_event_name('update_crew_progress_gui'),
|
||||
update_crew_fuel_gui = Event.generate_event_name('update_crew_fuel_gui'),
|
||||
}
|
||||
Public.enum = enum
|
||||
|
||||
return Public
|
@ -11,7 +11,7 @@ local _inspect = require 'utils.inspect'.inspect
|
||||
local Crew = require 'maps.pirates.crew'
|
||||
-- local Progression = require 'maps.pirates.progression'
|
||||
-- local Structures = require 'maps.pirates.structures.structures'
|
||||
local Shop = require 'maps.pirates.shop.shop'
|
||||
-- local Shop = require 'maps.pirates.shop.shop'
|
||||
local Boats = require 'maps.pirates.structures.boats.boats'
|
||||
local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
|
||||
@ -156,94 +156,6 @@ function Public.flow_add_floating_button(flow1, button_name)
|
||||
return flow3
|
||||
end
|
||||
|
||||
function Public.flow_add_shop_item(flow, name)
|
||||
local flow2, flow3
|
||||
|
||||
local shop_data_1 = Shop.Captains.main_shop_data_1
|
||||
local shop_data_2 = Shop.Captains.main_shop_data_2
|
||||
local trade_data = shop_data_1[name] or shop_data_2[name]
|
||||
if not trade_data then return end
|
||||
|
||||
flow2 = flow.add({
|
||||
name = name,
|
||||
type = 'flow',
|
||||
direction = 'horizontal',
|
||||
})
|
||||
flow2.style.top_margin = 3
|
||||
flow2.style.horizontal_align = 'center'
|
||||
flow2.style.vertical_align = 'center'
|
||||
flow2.tooltip = trade_data.tooltip
|
||||
|
||||
|
||||
for k, v in pairs(trade_data.what_you_get_sprite_buttons) do
|
||||
flow3 = flow2.add({
|
||||
type = 'sprite-button',
|
||||
name = k,
|
||||
sprite = k,
|
||||
enabled = false,
|
||||
})
|
||||
flow3.style.minimal_height = 40
|
||||
flow3.style.maximal_height = 40
|
||||
if v == false then
|
||||
flow3.number = nil
|
||||
else
|
||||
flow3.number = v
|
||||
end
|
||||
flow3.tooltip = trade_data.tooltip
|
||||
end
|
||||
|
||||
flow3 = flow2.add({
|
||||
type = 'label',
|
||||
name = 'for',
|
||||
caption = 'for'
|
||||
})
|
||||
flow3.style.font = 'default-large'
|
||||
flow3.style.font_color = Public.default_font_color
|
||||
flow3.tooltip = trade_data.tooltip
|
||||
|
||||
for k, _ in pairs(trade_data.base_cost) do
|
||||
flow3 = flow2.add({
|
||||
name = 'cost_' .. k,
|
||||
type = 'sprite-button',
|
||||
enabled = false,
|
||||
})
|
||||
flow3.style.minimal_height = 40
|
||||
flow3.style.maximal_height = 40
|
||||
flow3.tooltip = trade_data.tooltip
|
||||
if k == 'fuel' then
|
||||
flow3.sprite = 'item/coal'
|
||||
elseif k == 'coins' then
|
||||
flow3.sprite = 'item/coin'
|
||||
elseif k == 'iron_plates' then
|
||||
flow3.sprite = 'item/iron-plate'
|
||||
elseif k == 'copper_plates' then
|
||||
flow3.sprite = 'item/copper-plate'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'spacing',
|
||||
type = 'flow',
|
||||
direction = 'horizontal',
|
||||
})
|
||||
flow3.style.horizontally_stretchable = true
|
||||
|
||||
flow3 = flow2.add({
|
||||
type = 'sprite-button',
|
||||
name = 'buy_button',
|
||||
caption = 'Buy'
|
||||
})
|
||||
flow3.style.font = 'default-large'
|
||||
flow3.style.font_color = Public.default_font_color
|
||||
flow3.style.height = 32
|
||||
flow3.style.width = 50
|
||||
flow3.style.padding = 0
|
||||
flow3.style.margin = 0
|
||||
|
||||
return flow2
|
||||
end
|
||||
|
||||
function Public.flow_add_section(flow, name, caption)
|
||||
local flow2, flow3
|
||||
|
||||
|
@ -13,6 +13,7 @@ local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
local SurfacesCommon = require 'maps.pirates.surfaces.common'
|
||||
local Hold = require 'maps.pirates.surfaces.hold'
|
||||
-- local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
|
||||
local window_name = 'crew'
|
||||
|
||||
@ -226,7 +227,7 @@ function Public.toggle_window(player)
|
||||
{
|
||||
name = 'difficulty_option_' .. i,
|
||||
type = 'button',
|
||||
caption = o.text
|
||||
caption = { "", "[item=", o.icon, "] ", o.text }
|
||||
}
|
||||
)
|
||||
flow3.style.minimal_width = 95
|
||||
@ -596,7 +597,7 @@ function Public.click(event)
|
||||
|
||||
if eventname == 'capn_summon_crew' then
|
||||
--double check:
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
Crew.summon_crew()
|
||||
end
|
||||
return
|
||||
@ -604,7 +605,7 @@ function Public.click(event)
|
||||
|
||||
if eventname == 'capn_requisition' then
|
||||
--double check:
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
Roles.captain_tax(memory.playerindex_captain)
|
||||
end
|
||||
return
|
||||
@ -622,7 +623,7 @@ function Public.click(event)
|
||||
|
||||
if eventname == 'capn_disband_crew' then
|
||||
--double check:
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
if not memory.disband_are_you_sure_ticks then
|
||||
memory.disband_are_you_sure_ticks = {}
|
||||
end
|
||||
@ -633,7 +634,7 @@ function Public.click(event)
|
||||
|
||||
if eventname == 'capn_disband_are_you_sure' then
|
||||
--double check:
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
local force = memory.force
|
||||
if force and force.valid then
|
||||
local message = { 'pirates.crew_disbanded', player.name, memory.name, Utils.time_longform((memory.real_age or 0) / 60) }
|
||||
|
@ -1,194 +0,0 @@
|
||||
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
|
||||
|
||||
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
-- local Common = require 'maps.pirates.common'
|
||||
-- local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
-- local Math = require 'maps.pirates.math'
|
||||
local Balance = require 'maps.pirates.balance'
|
||||
-- local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
local Crew = require 'maps.pirates.crew'
|
||||
local Shop = require 'maps.pirates.shop.shop'
|
||||
-- local Progression = require 'maps.pirates.progression'
|
||||
-- local Structures = require 'maps.pirates.structures.structures'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
-- local Boats = require 'maps.pirates.structures.boats.boats'
|
||||
local GuiCommon = require 'maps.pirates.gui.common'
|
||||
local Public = {}
|
||||
|
||||
local window_name = 'fuel'
|
||||
|
||||
function Public.toggle_window(player)
|
||||
local flow, flow2, flow3
|
||||
|
||||
local shop_data_1 = Shop.Captains.main_shop_data_1
|
||||
local shop_data_2 = Shop.Captains.main_shop_data_2
|
||||
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then
|
||||
player.gui.screen[window_name .. '_piratewindow'].destroy()
|
||||
return
|
||||
end
|
||||
|
||||
flow = GuiCommon.new_window(player, window_name)
|
||||
flow.caption = 'Captain\'s Store'
|
||||
|
||||
|
||||
flow2 = flow.add({
|
||||
name = 'trades',
|
||||
type = 'flow',
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow2.style.top_margin = 3
|
||||
flow2.style.bottom_margin = 3
|
||||
flow2.style.horizontal_align = 'center'
|
||||
flow2.style.vertical_align = 'center'
|
||||
|
||||
for k, _ in pairs(shop_data_1) do
|
||||
GuiCommon.flow_add_shop_item(flow2, k)
|
||||
end
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'line_1',
|
||||
type = 'line',
|
||||
})
|
||||
flow3.style.width = 100
|
||||
|
||||
for k, _ in pairs(shop_data_2) do
|
||||
GuiCommon.flow_add_shop_item(flow2, k)
|
||||
end
|
||||
|
||||
|
||||
flow2 = GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton')
|
||||
|
||||
flow2.add({
|
||||
name = 'tospend',
|
||||
type = 'sprite-button',
|
||||
sprite = 'item/coin',
|
||||
index = 1,
|
||||
enabled = false,
|
||||
})
|
||||
end
|
||||
|
||||
function Public.regular_update(player)
|
||||
local flow
|
||||
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
|
||||
if not player.gui.screen[window_name .. '_piratewindow'] then return end
|
||||
flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
|
||||
flow.close_button_flow.hflow.tospend.visible = true
|
||||
|
||||
local inv = player.get_inventory(defines.inventory.character_main)
|
||||
if inv and inv.valid then
|
||||
local coin_amount = inv.get_item_count('coin') or 0
|
||||
|
||||
flow.close_button_flow.hflow.tospend.number = coin_amount
|
||||
flow.close_button_flow.hflow.tospend.tooltip = string.format("You're holding " .. Utils.bignumber_abbrevform2(coin_amount) .. " doubloons.")
|
||||
end
|
||||
else
|
||||
flow.close_button_flow.hflow.tospend.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
function Public.full_update(player)
|
||||
if Public.regular_update then Public.regular_update(player) end
|
||||
|
||||
local flow
|
||||
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
local shop_data = Utils.nonrepeating_join_dict(Shop.Captains.main_shop_data_1, Shop.Captains.main_shop_data_2)
|
||||
local shop_data_1 = Shop.Captains.main_shop_data_1
|
||||
local shop_data_2 = Shop.Captains.main_shop_data_2
|
||||
|
||||
local availability_data = memory.mainshop_availability_bools
|
||||
|
||||
if not player.gui.screen[window_name .. '_piratewindow'] then return end
|
||||
flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
|
||||
--*** WHAT TO SHOW ***--
|
||||
|
||||
-- if memory.stored_fuel then
|
||||
-- flow.close_button_flow.hflow.tospend.number = memory.stored_fuel
|
||||
-- flow.close_button_flow.hflow.tospend.tooltip = string.format('The crew has %01d stored coal.', memory.stored_fuel)
|
||||
-- else
|
||||
-- flow.close_button_flow.hflow.tospend.number = 0
|
||||
-- flow.close_button_flow.hflow.tospend.tooltip = string.format('The crew has %01d stored coal.', 0)
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
if memory.crewstatus == Crew.enum.ADVENTURING then
|
||||
flow.trades.visible = true
|
||||
else
|
||||
flow.trades.visible = false
|
||||
end
|
||||
|
||||
local anything_in_shop_1 = false
|
||||
for k, _ in pairs(shop_data_1) do
|
||||
if availability_data and availability_data[k] == true then
|
||||
flow.trades[k].visible = true
|
||||
anything_in_shop_1 = true
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
|
||||
flow.trades[k].buy_button.visible = true
|
||||
else
|
||||
flow.trades[k].buy_button.visible = false
|
||||
end
|
||||
else
|
||||
flow.trades[k].visible = false
|
||||
end
|
||||
end
|
||||
flow.trades.line_1.visible = anything_in_shop_1
|
||||
for k, _ in pairs(shop_data_2) do
|
||||
if availability_data and availability_data[k] == true then
|
||||
flow.trades[k].visible = true
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.OFFICER then
|
||||
flow.trades[k].buy_button.visible = true
|
||||
else
|
||||
flow.trades[k].buy_button.visible = false
|
||||
end
|
||||
else
|
||||
flow.trades[k].visible = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--*** UPDATE CONTENT ***--
|
||||
|
||||
local multiplier = Balance.main_shop_cost_multiplier()
|
||||
|
||||
for k, v in pairs(shop_data) do
|
||||
for k2, v2 in pairs(v.base_cost) do
|
||||
if v2 == false then
|
||||
flow.trades[k]['cost_' .. k2].number = nil
|
||||
else
|
||||
flow.trades[k]['cost_' .. k2].number = multiplier * v2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.click(event)
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
|
||||
local player = game.players[event.element.player_index]
|
||||
|
||||
local eventname = event.element.name
|
||||
|
||||
if not player.gui.screen[window_name .. '_piratewindow'] then return end
|
||||
-- local flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
|
||||
if eventname == 'buy_button' then
|
||||
Shop.Captains.main_shop_try_purchase(player, event.element.parent.name)
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
@ -10,7 +10,6 @@ local GuiProgress = require 'maps.pirates.gui.progress'
|
||||
local GuiRuns = require 'maps.pirates.gui.runs'
|
||||
local GuiCrew = require 'maps.pirates.gui.crew'
|
||||
local GuiClasses = require 'maps.pirates.gui.classes'
|
||||
local GuiFuel = require 'maps.pirates.gui.fuel'
|
||||
local GuiMinimap = require 'maps.pirates.gui.minimap'
|
||||
local GuiInfo = require 'maps.pirates.gui.info'
|
||||
local Quest = require 'maps.pirates.quest'
|
||||
@ -23,62 +22,25 @@ local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
local Crowsnest = require 'maps.pirates.surfaces.crowsnest'
|
||||
local Progression = require 'maps.pirates.progression'
|
||||
local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
local Event = require 'utils.event'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
-- local Roles = require 'maps.pirates.roles.roles'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
|
||||
local Kraken = require 'maps.pirates.surfaces.sea.kraken'
|
||||
local GuiWelcome = require 'maps.pirates.gui.welcome'
|
||||
|
||||
local ComfyGui = require 'utils.gui'
|
||||
ComfyGui.set_disabled_tab('Scoreboard', true)
|
||||
ComfyGui.set_disabled_tab('Groups', true)
|
||||
|
||||
|
||||
local Public = {}
|
||||
-- this seems to be never used
|
||||
local enum = {
|
||||
PROGRESS = 'progress',
|
||||
RUNS = 'runs',
|
||||
CREW = 'crew',
|
||||
CLASSES = 'classes',
|
||||
FUEL = 'fuel',
|
||||
MINIMAP = 'minimap',
|
||||
INFO = 'info',
|
||||
COLOR = 'color',
|
||||
}
|
||||
Public.enum = enum
|
||||
|
||||
Public.progress = require 'maps.pirates.gui.progress'
|
||||
Public.runs = require 'maps.pirates.gui.runs'
|
||||
Public.crew = require 'maps.pirates.gui.crew'
|
||||
Public.classes = require 'maps.pirates.gui.classes'
|
||||
Public.fuel = require 'maps.pirates.gui.fuel'
|
||||
Public.minimap = require 'maps.pirates.gui.minimap'
|
||||
Public.info = require 'maps.pirates.gui.info'
|
||||
Public.color = require 'maps.pirates.gui.color'
|
||||
|
||||
|
||||
function Public.update_crew_gui(which_gui)
|
||||
if not Public[which_gui] then return end
|
||||
|
||||
local players = Common.crew_get_crew_members_and_spectators()
|
||||
|
||||
for _, player in pairs(players) do
|
||||
Public[which_gui].full_update(player)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.update_crew_progress_gui()
|
||||
return Public.update_crew_gui('progress')
|
||||
end
|
||||
Event.add(CustomEvents.enum['update_crew_progress_gui'], Public.update_crew_progress_gui)
|
||||
-- script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
function Public.update_crew_fuel_gui()
|
||||
return Public.update_crew_gui('fuel')
|
||||
end
|
||||
Event.add(CustomEvents.enum['update_crew_fuel_gui'], Public.update_crew_fuel_gui)
|
||||
|
||||
|
||||
local function create_gui(player)
|
||||
local flow1, flow2, flow3, flow4
|
||||
|
||||
@ -87,19 +49,19 @@ local function create_gui(player)
|
||||
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'info_piratebutton')
|
||||
flow2.caption = '?'
|
||||
flow2.style.font = 'debug'
|
||||
flow2.tooltip = {'pirates.gui_info_main_tooltip'}
|
||||
flow2.style.font_color = {r=1, g=1, b=1}
|
||||
flow2.style.hovered_font_color = {r=1, g=1, b=1}
|
||||
flow2.style.clicked_font_color = {r=1, g=1, b=1}
|
||||
flow2.tooltip = { 'pirates.gui_info_main_tooltip' }
|
||||
flow2.style.font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.style.hovered_font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.style.clicked_font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.parent.style.left_padding = -6
|
||||
|
||||
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'runs_piratebutton', 70)
|
||||
flow2.caption = {'pirates.gui_crews'}
|
||||
flow2.tooltip = {'pirates.gui_crews_main_tooltip'}
|
||||
flow2.caption = { 'pirates.gui_crews' }
|
||||
flow2.tooltip = { 'pirates.gui_crews_main_tooltip' }
|
||||
flow2.style.font = 'debug'
|
||||
flow2.style.font_color = {r=1, g=1, b=1}
|
||||
flow2.style.hovered_font_color = {r=1, g=1, b=1}
|
||||
flow2.style.clicked_font_color = {r=1, g=1, b=1}
|
||||
flow2.style.font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.style.hovered_font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.style.clicked_font_color = { r = 1, g = 1, b = 1 }
|
||||
flow2.parent.style.width = 67
|
||||
flow2.parent.style.left_padding = -6
|
||||
|
||||
@ -131,11 +93,11 @@ local function create_gui(player)
|
||||
|
||||
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'evo_piratebutton')
|
||||
flow2.sprite = 'entity/small-biter'
|
||||
flow2.mouse_button_filter = {'middle'} --hack to avoid press visual
|
||||
flow2.mouse_button_filter = { 'middle' } --hack to avoid press visual
|
||||
flow2.show_percent_for_small_numbers = true --as of factorio v1.1.59, there is a bug in which 1.002 displays as like 1e-2% or something. but after 1.01 it's ok
|
||||
|
||||
flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'minimap_piratebutton')
|
||||
flow2.tooltip = {'pirates.gui_minimap_main_tooltip'}
|
||||
flow2.tooltip = { 'pirates.gui_minimap_main_tooltip' }
|
||||
flow2.sprite = 'utility/map'
|
||||
|
||||
-- flow2 = GuiCommon.flow_add_floating_sprite_button(flow1, 'shop_piratebutton')
|
||||
@ -167,7 +129,7 @@ local function create_gui(player)
|
||||
})
|
||||
flow3.style.font = 'default-large-semibold'
|
||||
flow3.style.font_color = GuiCommon.bold_font_color
|
||||
flow3.caption = {'pirates.gui_fuel_1'}
|
||||
flow3.caption = { 'pirates.gui_fuel_1' }
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'fuel_label_1',
|
||||
@ -222,9 +184,9 @@ local function create_gui(player)
|
||||
flow3.style.font = 'default-large-semibold'
|
||||
flow3.style.font_color = GuiCommon.bold_font_color
|
||||
|
||||
flow3 = flow2.add({type = 'table', name = 'cost_table', column_count = #CoreData.cost_items})
|
||||
flow3 = flow2.add({ type = 'table', name = 'cost_table', column_count = #CoreData.cost_items })
|
||||
for i = 1, #CoreData.cost_items do
|
||||
flow4 = flow3.add({type = 'sprite-button', name = 'cost_' .. i, number = 0})
|
||||
flow4 = flow3.add({ type = 'sprite-button', name = 'cost_' .. i, number = 0 })
|
||||
-- flow4.mouse_button_filter = {'middle'}
|
||||
flow4.sprite = CoreData.cost_items[i].sprite_name
|
||||
flow4.enabled = false
|
||||
@ -234,14 +196,14 @@ local function create_gui(player)
|
||||
flow4.visible = false
|
||||
end
|
||||
-- and
|
||||
flow4 = flow3.add({type = 'sprite-button', name = 'cost_launch_rocket'})
|
||||
-- flow4.mouse_button_filter = {'middle'}
|
||||
flow4.sprite = 'item/rocket-silo'
|
||||
flow4.enabled = false
|
||||
flow4.style.top_margin = -6
|
||||
flow4.style.right_margin = -6
|
||||
flow4.style.maximal_height = 38
|
||||
flow4.visible = false
|
||||
flow4 = flow3.add({ type = 'sprite-button', name = 'cost_launch_rocket' })
|
||||
-- flow4.mouse_button_filter = {'middle'}
|
||||
flow4.sprite = 'item/rocket-silo'
|
||||
flow4.enabled = false
|
||||
flow4.style.top_margin = -6
|
||||
flow4.style.right_margin = -6
|
||||
flow4.style.maximal_height = 38
|
||||
flow4.visible = false
|
||||
|
||||
flow3.style.left_margin = -1
|
||||
flow3.style.right_margin = -2 --to get to the end of the button frame
|
||||
@ -485,13 +447,13 @@ local function create_gui(player)
|
||||
|
||||
-- spontaneous inside view of the hold:
|
||||
flow1 =
|
||||
player.gui.screen.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'pirates_spontaneous_camera',
|
||||
position = {x=0,y=0},
|
||||
}
|
||||
)
|
||||
player.gui.screen.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'pirates_spontaneous_camera',
|
||||
position = { x = 0, y = 0 },
|
||||
}
|
||||
)
|
||||
flow1.visible = false
|
||||
flow1.style.margin = 8
|
||||
-- flow2.style.minimal_height = 64
|
||||
@ -546,34 +508,32 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = false
|
||||
|
||||
tooltip = {'pirates.gui_etaframe_board_warning_tooltip'}
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_board_warning'}
|
||||
tooltip = { 'pirates.gui_etaframe_board_warning_tooltip' }
|
||||
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_board_warning' }
|
||||
elseif bools.eta_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = true
|
||||
|
||||
tooltip = {'pirates.auto_undock_tooltip'}
|
||||
tooltip = { 'pirates.auto_undock_tooltip' }
|
||||
|
||||
local passive_eta = dynamic_data.time_remaining
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_autoundock'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_autoundock' }
|
||||
flow2.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(passive_eta)
|
||||
|
||||
elseif bools.atsea_loading_bool then
|
||||
if Kraken.get_active_kraken_count(memory.id) > 0 then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = false
|
||||
|
||||
tooltip = {'pirates.defeat_krakens_tooltip'}
|
||||
tooltip = { 'pirates.defeat_krakens_tooltip' }
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_defeat_krakens'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_defeat_krakens' }
|
||||
else
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = true
|
||||
|
||||
tooltip = {'pirates.atsea_loading_tooltip'}
|
||||
tooltip = { 'pirates.atsea_loading_tooltip' }
|
||||
|
||||
local total = Common.map_loading_ticks_atsea
|
||||
if destination.type == Surfaces.enum.DOCK then
|
||||
@ -584,34 +544,31 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
|
||||
local eta_ticks = total + (memory.extra_time_at_sea or 0) - memory.loadingticks
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_loading_for'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_loading_for' }
|
||||
flow2.etaframe_label_2.caption = Utils.standard_string_form_of_time_in_seconds(eta_ticks / 60)
|
||||
end
|
||||
|
||||
elseif bools.atsea_waiting_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = false
|
||||
|
||||
tooltip = {'pirates.atsea_waiting_tooltip'}
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_atsea_waiting'}
|
||||
tooltip = { 'pirates.atsea_waiting_tooltip' }
|
||||
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_atsea_waiting' }
|
||||
elseif bools.atsea_victorious_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = false
|
||||
|
||||
tooltip = {'pirates.atsea_victorious_tooltip'}
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_atsea_victorious'}
|
||||
tooltip = { 'pirates.atsea_victorious_tooltip' }
|
||||
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_atsea_victorious' }
|
||||
elseif bools.leave_anytime_bool then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_2.visible = true
|
||||
|
||||
tooltip = {'pirates.leave_anytime_tooltip'}
|
||||
tooltip = { 'pirates.leave_anytime_tooltip' }
|
||||
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_undock'}
|
||||
flow2.etaframe_label_2.caption = {'pirates.gui_etaframe_anytime'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_undock' }
|
||||
flow2.etaframe_label_2.caption = { 'pirates.gui_etaframe_anytime' }
|
||||
end
|
||||
|
||||
if bools.cost_bool and Kraken.get_active_kraken_count(memory.id) == 0 then
|
||||
@ -624,65 +581,65 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
cost_table.visible = true
|
||||
|
||||
if flow2.etaframe_label_2.visible then
|
||||
flow2.etaframe_label_2.caption = flow2.etaframe_label_2.caption .. '.'
|
||||
flow2.etaframe_label_2.caption = flow2.etaframe_label_2.caption .. '.'
|
||||
end
|
||||
|
||||
-- local caption
|
||||
if bools.atsea_loading_bool then
|
||||
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_next_escape_cost'}
|
||||
flow2.etaframe_label_3.caption = { 'pirates.gui_etaframe_next_escape_cost' }
|
||||
if Boats.need_resources_to_undock(Common.overworldx(), destination.subtype) then
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_4_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_4_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_4'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_4' }
|
||||
end
|
||||
elseif destination.static_params.undock_cost_decreases == true then
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_1_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_1_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_1'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_1' }
|
||||
end
|
||||
else
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_0a_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_0a_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_0a'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_0a' }
|
||||
end
|
||||
end
|
||||
elseif (not bools.eta_bool) then -- Shown when ship doesn't have auto undock timer
|
||||
flow2.etaframe_label_3.visible = false
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_to_escape_store'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_to_escape_store' }
|
||||
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_3_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_3_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_3'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_3' }
|
||||
end
|
||||
else -- Shown when at island
|
||||
if Boats.need_resources_to_undock(Common.overworldx(), destination.subtype) then
|
||||
flow2.etaframe_label_3.visible = false
|
||||
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_5_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_5_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_5'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_5' }
|
||||
end
|
||||
elseif destination.static_params.undock_cost_decreases == true then
|
||||
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_or_store'}
|
||||
flow2.etaframe_label_3.caption = { 'pirates.gui_etaframe_or_store' }
|
||||
|
||||
local adjusted_costs_resources_strings = Common.time_adjusted_departure_cost_resources_strings(memory)
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_2_rocketvariant', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2]}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_2_rocketvariant', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2] }
|
||||
else
|
||||
--@Future reference: localisation handling
|
||||
tooltip = {'pirates.resources_needed_tooltip_2', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2]}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_2', adjusted_costs_resources_strings[1], adjusted_costs_resources_strings[2] }
|
||||
end
|
||||
else
|
||||
if bools.cost_includes_rocket_launch_bool then
|
||||
tooltip = {'pirates.resources_needed_tooltip_3_rocketvariant'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_3_rocketvariant' }
|
||||
else
|
||||
tooltip = {'pirates.resources_needed_tooltip_3'}
|
||||
tooltip = { 'pirates.resources_needed_tooltip_3' }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -710,7 +667,7 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
else
|
||||
cost_table['cost_launch_rocket'].number = 0
|
||||
end
|
||||
cost_table['cost_launch_rocket'].tooltip = {'pirates.gui_etaframe_rocket_requirement_tooltip'}
|
||||
cost_table['cost_launch_rocket'].tooltip = { 'pirates.gui_etaframe_rocket_requirement_tooltip' }
|
||||
cost_table['cost_launch_rocket'].visible = true
|
||||
else
|
||||
cost_table['cost_launch_rocket'].visible = false
|
||||
@ -721,24 +678,22 @@ function Public.process_etaframe_update(player, flow1, bools)
|
||||
flow2.tooltip = tooltip
|
||||
|
||||
if bools.captain_bool and (not bools.retreating_bool) and (bools.leave_anytime_bool or bools.atsea_waiting_bool or bools.eta_bool or (bools.cost_bool and (not bools.atsea_loading_bool))) then
|
||||
flow1.etaframe_piratebutton.mouse_button_filter = {'left'}
|
||||
flow1.etaframe_piratebutton.mouse_button_filter = { 'left' }
|
||||
if memory.undock_shortcut_are_you_sure_data and memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
|
||||
flow2.etaframe_label_1.visible = true
|
||||
flow2.etaframe_label_1.caption = {'pirates.gui_etaframe_undock_are_you_sure'}
|
||||
flow2.etaframe_label_1.caption = { 'pirates.gui_etaframe_undock_are_you_sure' }
|
||||
flow2.etaframe_label_2.visible = false
|
||||
flow2.etaframe_label_3.visible = false
|
||||
end
|
||||
else
|
||||
flow1.etaframe_piratebutton.mouse_button_filter = {'middle'} --hack to avoid press visual
|
||||
flow1.etaframe_piratebutton.mouse_button_filter = { 'middle' } --hack to avoid press visual
|
||||
end
|
||||
else
|
||||
flow1.visible = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bools)
|
||||
|
||||
local destination = Common.current_destination()
|
||||
local dynamic_data = destination.dynamic_data --assumes this always exists
|
||||
|
||||
@ -747,40 +702,37 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
|
||||
flow1 = flowsilo
|
||||
if flow1 then
|
||||
|
||||
if bools.silo_bool then
|
||||
flow1.visible = true
|
||||
|
||||
if bools.charged_bool then
|
||||
|
||||
if bools.launched_bool then
|
||||
|
||||
flow1.silo_progressbar.visible = false
|
||||
|
||||
flow1.silo_label_2.visible = false
|
||||
flow1.silo_label_3.visible = true
|
||||
|
||||
-- flow1.silo_label_1.caption = string.format('[achievement=there-is-no-spoon]: +%.0f[item=sulfur]', dynamic_data.rocketcoalreward)
|
||||
flow1.silo_label_1.caption = {'pirates.gui_etaframe_launched'}
|
||||
flow1.silo_label_1.caption = { 'pirates.gui_etaframe_launched' }
|
||||
-- flow1.silo_label_1.caption = string.format('Launched for %.0f[item=coal] , ' .. Balance.rocket_launch_coin_reward .. '[item=coin]', dynamic_data.rocketcoalreward)
|
||||
flow1.silo_label_1.style.font_color = GuiCommon.achieved_font_color
|
||||
|
||||
local rocket_launch_coal_reward = Balance.rocket_launch_fuel_reward()
|
||||
local rocket_launch_coin_reward = Balance.rocket_launch_coin_reward()
|
||||
|
||||
flow1.silo_label_3.caption = Math.floor(rocket_launch_coal_reward/100)/10 .. 'k[item=coal], ' .. Math.floor(rocket_launch_coin_reward/100)/10 .. 'k[item=coin]'
|
||||
flow1.silo_label_3.caption = Math.floor(rocket_launch_coal_reward / 100) / 10 .. 'k[item=coal], ' .. Math.floor(rocket_launch_coin_reward / 100) / 10 .. 'k[item=coin]'
|
||||
|
||||
local tooltip = {'pirates.gui_etaframe_launched_tooltip'}
|
||||
local tooltip = { 'pirates.gui_etaframe_launched_tooltip' }
|
||||
flow1.tooltip = tooltip
|
||||
flow1.silo_label_1.tooltip = tooltip
|
||||
flow1.silo_label_3.tooltip = tooltip
|
||||
else
|
||||
local tooltip = {'pirates.gui_etaframe_launching'}
|
||||
local tooltip = { 'pirates.gui_etaframe_launching' }
|
||||
flow1.tooltip = tooltip
|
||||
flow1.silo_label_1.tooltip = tooltip
|
||||
flow1.silo_progressbar.tooltip = tooltip
|
||||
|
||||
flow1.silo_label_1.caption = {'pirates.gui_etaframe_charge'}
|
||||
flow1.silo_label_1.caption = { 'pirates.gui_etaframe_charge' }
|
||||
flow1.silo_label_1.style.font_color = GuiCommon.bold_font_color
|
||||
flow1.silo_label_2.visible = false
|
||||
flow1.silo_label_3.visible = false
|
||||
@ -788,9 +740,8 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
|
||||
flow1.silo_progressbar.value = 1
|
||||
end
|
||||
|
||||
else
|
||||
flow1.silo_label_1.caption = {'pirates.gui_etaframe_charge'}
|
||||
flow1.silo_label_1.caption = { 'pirates.gui_etaframe_charge' }
|
||||
flow1.silo_label_1.style.font_color = GuiCommon.bold_font_color
|
||||
flow1.silo_label_2.visible = true
|
||||
flow1.silo_progressbar.visible = true
|
||||
@ -800,9 +751,9 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
local needed = dynamic_data.rocketsiloenergyneeded
|
||||
local recent = (dynamic_data.rocketsiloenergyconsumedwithinlasthalfsecond * 2)
|
||||
|
||||
flow1.silo_progressbar.value = consumed/needed
|
||||
flow1.silo_progressbar.value = consumed / needed
|
||||
|
||||
local tooltip = {'pirates.gui_etaframe_charge_tooltip', string.format('%.1f', Math.floor(consumed / 100000000)/10), string.format('%.1f', Math.floor(needed / 100000000)/10)}
|
||||
local tooltip = { 'pirates.gui_etaframe_charge_tooltip', string.format('%.1f', Math.floor(consumed / 100000000) / 10), string.format('%.1f', Math.floor(needed / 100000000) / 10) }
|
||||
flow1.tooltip = tooltip
|
||||
flow1.silo_label_1.tooltip = tooltip
|
||||
flow1.silo_label_2.tooltip = tooltip
|
||||
@ -836,16 +787,15 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
local quest_reward = dynamic_data.quest_reward or nil
|
||||
local quest_progress = dynamic_data.quest_progress or 0
|
||||
local quest_progressneeded = dynamic_data.quest_progressneeded or 0
|
||||
local quest_complete = dynamic_data.quest_complete or false
|
||||
local quest_complete = dynamic_data.quest_complete or false
|
||||
|
||||
if quest_type then
|
||||
|
||||
---@type string|table
|
||||
local tooltip = ''
|
||||
|
||||
if quest_complete and quest_reward then
|
||||
tooltip = {'pirates.gui_questframe_complete_tooltip', quest_type}
|
||||
flow1.quest_label_1.caption = {'pirates.gui_questframe'}
|
||||
tooltip = { 'pirates.gui_questframe_complete_tooltip', quest_type }
|
||||
flow1.quest_label_1.caption = { 'pirates.gui_questframe' }
|
||||
flow1.quest_label_1.style.font_color = GuiCommon.achieved_font_color
|
||||
flow1.quest_label_2.visible = true
|
||||
flow1.quest_label_3.visible = false
|
||||
@ -853,7 +803,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 = {'pirates.gui_questframe'}
|
||||
flow1.quest_label_1.caption = { 'pirates.gui_questframe' }
|
||||
flow1.quest_label_1.style.font_color = GuiCommon.bold_font_color
|
||||
flow1.quest_label_2.visible = true
|
||||
flow1.quest_label_3.visible = true
|
||||
@ -867,7 +817,7 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
end
|
||||
|
||||
if quest_type == Quest.enum.TIME then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_time'} end
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_time' } end
|
||||
|
||||
if quest_progress >= 0 then
|
||||
flow1.quest_label_3.caption = string.format('%.0fm%.0fs', Math.floor(quest_progress / 60), quest_progress % 60)
|
||||
@ -885,49 +835,42 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
end
|
||||
end
|
||||
else
|
||||
flow1.quest_label_3.caption = {'pirates.gui_questframe_fail'}
|
||||
flow1.quest_label_3.caption = { 'pirates.gui_questframe_fail' }
|
||||
flow1.quest_label_3.style.font_color = GuiCommon.insufficient_font_color
|
||||
end
|
||||
|
||||
elseif quest_type == Quest.enum.WORMS then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_worms'} end
|
||||
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_worms' } end
|
||||
elseif quest_type == Quest.enum.FIND then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_find'} end
|
||||
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_find' } end
|
||||
elseif quest_type == Quest.enum.RESOURCEFLOW then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_resourceflow'} end
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_resourceflow' } end
|
||||
|
||||
-- out of date:
|
||||
if quest_progressneeded/60 % 1 == 0 then
|
||||
flow1.quest_label_2.caption = string.format('%s %.1f/%.0f /s', '[item=' .. quest_params.item .. ']', quest_progress/60, quest_progressneeded/60)
|
||||
if quest_progressneeded / 60 % 1 == 0 then
|
||||
flow1.quest_label_2.caption = string.format('%s %.1f/%.0f /s', '[item=' .. quest_params.item .. ']', quest_progress / 60, quest_progressneeded / 60)
|
||||
flow1.quest_label_3.caption = string.format(' for %s', quest_reward.display_sprite)
|
||||
else
|
||||
flow1.quest_label_2.caption = string.format('%s %.1f/%.1f /s', '[item=' .. quest_params.item .. ']', quest_progress/60, quest_progressneeded/60)
|
||||
flow1.quest_label_2.caption = string.format('%s %.1f/%.1f /s', '[item=' .. quest_params.item .. ']', quest_progress / 60, quest_progressneeded / 60)
|
||||
flow1.quest_label_3.caption = string.format(' for %s', quest_reward.display_sprite)
|
||||
end
|
||||
|
||||
elseif quest_type == Quest.enum.RESOURCECOUNT then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_resourcecount'} end
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_resourcecount' } end
|
||||
|
||||
flow1.quest_label_2.caption = string.format('%s ', '[item=' .. quest_params.item .. ']')
|
||||
|
||||
elseif quest_type == Quest.enum.NODAMAGE then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_nodamage'} end
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_nodamage' } 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 = {'pirates.gui_questframe_ok'}
|
||||
flow1.quest_label_3.caption = { 'pirates.gui_questframe_ok' }
|
||||
flow1.quest_label_3.style.font_color = GuiCommon.sufficient_font_color
|
||||
else
|
||||
flow1.quest_label_3.caption = {'pirates.gui_questframe_fail'}
|
||||
flow1.quest_label_3.caption = { 'pirates.gui_questframe_fail' }
|
||||
flow1.quest_label_3.style.font_color = GuiCommon.insufficient_font_color
|
||||
end
|
||||
|
||||
elseif quest_type == Quest.enum.FISH then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_fish'} end
|
||||
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_fish' } end
|
||||
elseif quest_type == Quest.enum.COMPILATRON then
|
||||
if tooltip == '' then tooltip = {'pirates.gui_questframe_compilatron'} end
|
||||
if tooltip == '' then tooltip = { 'pirates.gui_questframe_compilatron' } end
|
||||
end
|
||||
end
|
||||
|
||||
@ -943,7 +886,6 @@ function Public.process_siloframe_and_questframe_updates(flowsilo, flowquest, bo
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- local function create_gui_2()
|
||||
|
||||
-- end
|
||||
@ -965,11 +907,11 @@ function Public.update_gui(player)
|
||||
flow1 = pirates_flow.crew_piratebutton_frame.crew_piratebutton
|
||||
|
||||
if Common.is_id_valid(memory.id) then
|
||||
flow1.tooltip = {'pirates.gui_crew_tooltip_1'}
|
||||
flow1.mouse_button_filter = {'left','right'}
|
||||
flow1.tooltip = { 'pirates.gui_crew_tooltip_1' }
|
||||
flow1.mouse_button_filter = { 'left', 'right' }
|
||||
else
|
||||
flow1.tooltip = {'pirates.gui_crew_tooltip_2'}
|
||||
flow1.mouse_button_filter = {'middle'} --hack to avoid press visual
|
||||
flow1.tooltip = { 'pirates.gui_crew_tooltip_2' }
|
||||
flow1.mouse_button_filter = { 'middle' } --hack to avoid press visual
|
||||
if player.gui.screen['crew_piratewindow'] then
|
||||
player.gui.screen['crew_piratewindow'].destroy()
|
||||
end
|
||||
@ -978,11 +920,11 @@ function Public.update_gui(player)
|
||||
flow1 = pirates_flow.classes_piratebutton_frame.classes_piratebutton
|
||||
|
||||
if Common.is_id_valid(memory.id) then
|
||||
flow1.tooltip = {'pirates.gui_classes_tooltip_1'}
|
||||
flow1.mouse_button_filter = {'left','right'}
|
||||
flow1.tooltip = { 'pirates.gui_classes_tooltip_1' }
|
||||
flow1.mouse_button_filter = { 'left', 'right' }
|
||||
else
|
||||
flow1.tooltip = {'pirates.gui_classes_tooltip_2'}
|
||||
flow1.mouse_button_filter = {'middle'} --hack to avoid press visual
|
||||
flow1.tooltip = { 'pirates.gui_classes_tooltip_2' }
|
||||
flow1.mouse_button_filter = { 'middle' } --hack to avoid press visual
|
||||
if player.gui.screen['classes_piratewindow'] then
|
||||
player.gui.screen['classes_piratewindow'].destroy()
|
||||
end
|
||||
@ -993,7 +935,6 @@ function Public.update_gui(player)
|
||||
if GuiRuns.full_update then GuiRuns.full_update(player) end
|
||||
if GuiCrew.full_update then GuiCrew.full_update(player) end
|
||||
if GuiClasses.full_update then GuiClasses.full_update(player) end
|
||||
if GuiFuel.regular_update then GuiFuel.regular_update(player) end --moved to event
|
||||
if GuiMinimap.full_update then GuiMinimap.full_update(player) end
|
||||
if GuiInfo.full_update then GuiInfo.full_update(player) end
|
||||
|
||||
@ -1013,7 +954,7 @@ function Public.update_gui(player)
|
||||
flow1 = pirates_flow.fuel_flow
|
||||
-- flow1 = pirates_flow.fuel_piratebutton_flow_1
|
||||
|
||||
local tooltip = {'pirates.fuel_tooltip', Math.floor(memory.stored_fuel or 0)}
|
||||
local tooltip = { 'pirates.fuel_tooltip', Math.floor(memory.stored_fuel or 0) }
|
||||
flow1.tooltip = tooltip
|
||||
-- flow1.fuel_piratebutton.tooltip = {'pirates.fuel_tooltip', Math.floor(memory.stored_fuel or 0)}
|
||||
|
||||
@ -1023,11 +964,11 @@ function Public.update_gui(player)
|
||||
|
||||
flow2.fuel_label_1.caption = Utils.bignumber_abbrevform(memory.stored_fuel or 0) .. '[item=coal]'
|
||||
flow2.fuel_label_2.caption = Utils.negative_rate_abbrevform(memory.fuel_depletion_rate_memoized or 0)
|
||||
local color_scale = Math.clamp(0, 1, (- (memory.fuel_depletion_rate_memoized or 0))/30)
|
||||
local color_scale = Math.clamp(0, 1, (-(memory.fuel_depletion_rate_memoized or 0)) / 30)
|
||||
flow2.fuel_label_2.style.font_color = {
|
||||
r = GuiCommon.fuel_color_1.r * (1-color_scale) + GuiCommon.fuel_color_2.r * color_scale,
|
||||
g = GuiCommon.fuel_color_1.g * (1-color_scale) + GuiCommon.fuel_color_2.g * color_scale,
|
||||
b = GuiCommon.fuel_color_1.b * (1-color_scale) + GuiCommon.fuel_color_2.b * color_scale,
|
||||
r = GuiCommon.fuel_color_1.r * (1 - color_scale) + GuiCommon.fuel_color_2.r * color_scale,
|
||||
g = GuiCommon.fuel_color_1.g * (1 - color_scale) + GuiCommon.fuel_color_2.g * color_scale,
|
||||
b = GuiCommon.fuel_color_1.b * (1 - color_scale) + GuiCommon.fuel_color_2.b * color_scale,
|
||||
}
|
||||
flow2.fuel_label_0.tooltip = tooltip
|
||||
flow2.fuel_label_1.tooltip = tooltip
|
||||
@ -1037,7 +978,7 @@ function Public.update_gui(player)
|
||||
flow1 = pirates_flow.progress_piratebutton_frame.progress_piratebutton
|
||||
|
||||
flow1.number = (memory.overworldx or 0)
|
||||
flow1.tooltip = {'pirates.gui_progress_tooltip', memory.overworldx or 0, CoreData.victory_x}
|
||||
flow1.tooltip = { 'pirates.gui_progress_tooltip', memory.overworldx or 0, CoreData.victory_x }
|
||||
-- pirates_flow.destination_piratebutton_frame.destination_piratebutton.number = memory.destinationsvisited_indices and #memory.destinationsvisited_indices or 0
|
||||
|
||||
|
||||
@ -1178,41 +1119,41 @@ function Public.update_gui(player)
|
||||
|
||||
if not flow1 then --comfy panel might possibly destroy this, so this puts it back
|
||||
flow1 =
|
||||
player.gui.screen.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'pirates_spontaneous_camera',
|
||||
position = {x=0,y=0},
|
||||
}
|
||||
)
|
||||
player.gui.screen.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'pirates_spontaneous_camera',
|
||||
position = { x = 0, y = 0 },
|
||||
}
|
||||
)
|
||||
flow1.visible = false
|
||||
flow1.style.margin = 8
|
||||
end
|
||||
|
||||
if flow1 then
|
||||
flow1.visible = false
|
||||
flow1.location = {x = 8, y = 48}
|
||||
flow1.location = { x = 8, y = 48 }
|
||||
if bools.on_deck_standing_near_loco_bool then
|
||||
flow1.visible = true
|
||||
flow1.surface_index = Hold.get_hold_surface(1).index
|
||||
flow1.zoom = 0.182
|
||||
flow1.style.minimal_height = 292
|
||||
flow1.style.minimal_width = 540
|
||||
flow1.position = {x=0,y=-2}
|
||||
flow1.position = { x = 0, y = -2 }
|
||||
elseif bools.on_deck_standing_near_cabin_bool then
|
||||
flow1.visible = true
|
||||
flow1.surface_index = Cabin.get_cabin_surface().index
|
||||
flow1.zoom = 0.468
|
||||
flow1.style.minimal_height = 400
|
||||
flow1.style.minimal_width = 280
|
||||
flow1.position = {x=0,y=-1}
|
||||
flow1.position = { x = 0, y = -1 }
|
||||
elseif bools.on_deck_standing_near_crowsnest_bool then
|
||||
flow1.visible = true
|
||||
flow1.surface_index = Crowsnest.get_crowsnest_surface().index
|
||||
flow1.zoom = 0.21
|
||||
flow1.style.minimal_height = 384
|
||||
flow1.style.minimal_width = 384
|
||||
flow1.position = {x=memory.overworldx,y=memory.overworldy}
|
||||
flow1.position = { x = memory.overworldx, y = memory.overworldy }
|
||||
elseif bools.in_crowsnest_bool then
|
||||
flow1.visible = true
|
||||
flow1.surface_index = game.surfaces[memory.boat.surface_name].index
|
||||
@ -1223,15 +1164,13 @@ function Public.update_gui(player)
|
||||
local position = memory.boat.position
|
||||
if (destination and destination.type and destination.type == Surfaces.enum.ISLAND and memory.boat.surface_name and memory.boat.surface_name == destination.surface_name and destination.static_params and destination.static_params.boat_starting_xposition) then
|
||||
-- nicer viewing position:
|
||||
position = {x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0}
|
||||
position = { x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0 }
|
||||
end
|
||||
flow1.position = position
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- ATTENTION: Giving same names to GUI elements can cause issues, because click events are dispatched to all GUI windows!
|
||||
local function on_gui_click(event)
|
||||
if not event then return end
|
||||
@ -1246,7 +1185,7 @@ local function on_gui_click(event)
|
||||
|
||||
if event.element.name and event.element.name == 'etaframe_piratebutton' then
|
||||
if (memory.boat.state == Boats.enum_state.DOCKED or memory.boat.state == Boats.enum_state.LANDED) then
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
if (not memory.undock_shortcut_are_you_sure_data) then memory.undock_shortcut_are_you_sure_data = {} end
|
||||
if memory.undock_shortcut_are_you_sure_data[player.index] and memory.undock_shortcut_are_you_sure_data[player.index] > game.tick - 60 * 4 then
|
||||
if memory.boat.state == Boats.enum_state.DOCKED then
|
||||
@ -1258,34 +1197,30 @@ local function on_gui_click(event)
|
||||
memory.undock_shortcut_are_you_sure_data[player.index] = game.tick
|
||||
end
|
||||
end
|
||||
|
||||
elseif memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL then
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
local destination_index = memory.mapbeingloadeddestination_index
|
||||
|
||||
Progression.progress_to_destination(destination_index)
|
||||
memory.loadingticks = 0
|
||||
end
|
||||
|
||||
elseif memory.boat.state == Boats.enum_state.ATSEA_VICTORIOUS then
|
||||
if Roles.player_privilege_level(player) >= Roles.privilege_levels.CAPTAIN then
|
||||
if Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN then
|
||||
memory.boat.state = Boats.enum_state.ATSEA_SAILING
|
||||
|
||||
local force = memory.force
|
||||
if not (force and force.valid) then return end
|
||||
if memory.victory_continue_message then
|
||||
memory.victory_continue_message = false
|
||||
Common.notify_force(force, {'pirates.crew_continue_on_freeplay'}, CoreData.colors.notify_victory)
|
||||
Common.notify_force(force, { 'pirates.crew_continue_on_freeplay' }, CoreData.colors.notify_victory)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif string.sub(event.element.name, -13, -1) and string.sub(event.element.name, -13, -1) == '_piratebutton' then
|
||||
local name = string.sub(event.element.name, 1, -14)
|
||||
if Public[name] then
|
||||
Public[name].toggle_window(player)
|
||||
Public[name].full_update(player)
|
||||
end
|
||||
local name = string.sub(event.element.name, 1, -14)
|
||||
if Public[name] then
|
||||
Public[name].toggle_window(player)
|
||||
Public[name].full_update(player)
|
||||
end
|
||||
-- elseif event.element.name == 'fuel_label_1' or event.element.name == 'fuel_label_2' then
|
||||
-- Public.fuel.toggle_window(player)
|
||||
-- Public.fuel.full_update(player)
|
||||
@ -1294,10 +1229,9 @@ local function on_gui_click(event)
|
||||
if GuiRuns.click then GuiRuns.click(event) end
|
||||
if GuiCrew.click then GuiCrew.click(event) end
|
||||
if GuiClasses.click then GuiClasses.click(event) end
|
||||
if GuiFuel.click then GuiFuel.click(event) end
|
||||
if GuiMinimap.click then GuiMinimap.click(event) end
|
||||
if GuiInfo.click then GuiInfo.click(event) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_gui_location_changed(event)
|
||||
@ -1312,12 +1246,8 @@ local function on_gui_location_changed(event)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
||||
event.add(defines.events.on_gui_location_changed, on_gui_location_changed)
|
||||
|
||||
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -25,24 +25,27 @@ local width = 400
|
||||
function Public.toggle_window(player)
|
||||
local flow, flow2, flow3, flow4
|
||||
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then player.gui.screen[window_name .. '_piratewindow'].destroy() return end
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then
|
||||
player.gui.screen[window_name .. '_piratewindow'].destroy()
|
||||
return
|
||||
end
|
||||
|
||||
flow = player.gui.screen.add{
|
||||
type = 'tabbed-pane',
|
||||
name = window_name .. '_piratewindow',
|
||||
direction = 'vertical'
|
||||
}
|
||||
flow.location = {x = 90, y = 90}
|
||||
flow = player.gui.screen.add {
|
||||
type = 'tabbed-pane',
|
||||
name = window_name .. '_piratewindow',
|
||||
direction = 'vertical'
|
||||
}
|
||||
flow.location = { x = 90, y = 90 }
|
||||
flow.selected_tab_index = 1
|
||||
|
||||
flow.style = 'frame_tabbed_pane'
|
||||
flow.style.width = width
|
||||
flow.style.height = 420
|
||||
|
||||
flow2 = Public.flow_add_info_tab(flow, {'pirates.gui_info_info'})
|
||||
flow2 = Public.flow_add_info_tab(flow, { 'pirates.gui_info_info' })
|
||||
|
||||
flow3 = flow2.parent.last_info_flow_1.last_info_flow_2
|
||||
flow4 = flow3.add{type = "label", caption = {"pirates.softmod_info_body_1"}}
|
||||
flow4 = flow3.add { type = "label", caption = { "pirates.softmod_info_body_1" } }
|
||||
flow4.style.font_color = GuiCommon.friendly_font_color
|
||||
flow4.style.single_line = false
|
||||
flow4.style.font = 'debug'
|
||||
@ -50,36 +53,35 @@ function Public.toggle_window(player)
|
||||
flow4.style.bottom_margin = 0
|
||||
-- flow4.style.bottom_margin = 16
|
||||
|
||||
Public.flow_add_info_sections(flow2, {'game_description'})
|
||||
Public.flow_add_info_sections(flow2, { 'game_description' })
|
||||
|
||||
flow2 = Public.flow_add_info_tab(flow, {'pirates.gui_info_tips'})
|
||||
flow2 = Public.flow_add_info_tab(flow, { 'pirates.gui_info_tips' })
|
||||
|
||||
Public.flow_add_info_sections(flow2, {'new_players', 'tips'})
|
||||
Public.flow_add_info_sections(flow2, { 'new_players', 'tips' })
|
||||
|
||||
flow2 = Public.flow_add_info_tab(flow, {'pirates.gui_info_updates'})
|
||||
flow2 = Public.flow_add_info_tab(flow, { 'pirates.gui_info_updates' })
|
||||
|
||||
Public.flow_add_info_sections(flow2, {'updates'})
|
||||
Public.flow_add_info_sections(flow2, { '1', '2' })
|
||||
-- Public.flow_add_info_sections(flow2, {'updates', 'bugs'})
|
||||
|
||||
flow2 = Public.flow_add_info_tab(flow, {'pirates.gui_info_credits'})
|
||||
flow2 = Public.flow_add_info_tab(flow, { 'pirates.gui_info_credits' })
|
||||
|
||||
Public.flow_add_info_sections(flow2, {'credits'})
|
||||
Public.flow_add_info_sections(flow2, { 'credits' })
|
||||
end
|
||||
|
||||
|
||||
function Public.flow_add_info_sections(flow, sections_list)
|
||||
local flow2
|
||||
|
||||
for j = 1, #sections_list do
|
||||
local i = sections_list[j]
|
||||
|
||||
flow2 = flow.add{type = "label", caption = {"pirates.softmod_info_" .. i .. "_1"}}
|
||||
flow2 = flow.add { type = "label", caption = { "pirates.softmod_info_" .. i .. "_1" } }
|
||||
flow2.style.font_color = GuiCommon.friendly_font_color
|
||||
flow2.style.single_line = false
|
||||
flow2.style.font = 'heading-3'
|
||||
flow2.style.bottom_margin = -4
|
||||
|
||||
flow2 = flow.add{type = "label", caption = {"pirates.softmod_info_" .. i .. "_2"}}
|
||||
flow2 = flow.add { type = "label", caption = { "pirates.softmod_info_" .. i .. "_2" } }
|
||||
flow2.style.font_color = GuiCommon.friendly_font_color
|
||||
flow2.style.single_line = false
|
||||
flow2.style.font = 'default'
|
||||
@ -88,12 +90,10 @@ function Public.flow_add_info_sections(flow, sections_list)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.flow_add_info_tab(flow, tab_name)
|
||||
|
||||
local tab, contents, ret, flow3, flow4, flow5
|
||||
|
||||
tab = flow.add{type='tab', caption=tab_name}
|
||||
tab = flow.add { type = 'tab', caption = tab_name }
|
||||
tab.style = 'frame_tab'
|
||||
|
||||
contents = flow.add({
|
||||
@ -114,7 +114,7 @@ function Public.flow_add_info_tab(flow, tab_name)
|
||||
direction = 'horizontal',
|
||||
})
|
||||
flow3.style.horizontally_stretchable = true
|
||||
flow3.style.horizontal_align = 'center'
|
||||
flow3.style.horizontal_align = 'center'
|
||||
|
||||
flow4 = flow3.add({
|
||||
type = 'flow',
|
||||
@ -122,14 +122,14 @@ function Public.flow_add_info_tab(flow, tab_name)
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow4.style.horizontally_stretchable = true
|
||||
flow4.style.horizontal_align = 'center'
|
||||
flow4.style.horizontal_align = 'center'
|
||||
|
||||
flow5 = flow4.add{type = "label", caption = {"", {"pirates.softmod_info_header_before_version_number"}, CoreData.version_string, {"pirates.softmod_info_header_after_version_number"}}}
|
||||
flow5 = flow4.add { type = "label", caption = { "", { "pirates.softmod_info_header_before_version_number" }, CoreData.version_string, { "pirates.softmod_info_header_after_version_number" } } }
|
||||
flow5.style.font_color = GuiCommon.friendly_font_color
|
||||
flow5.style.font = 'heading-1'
|
||||
flow5.style.bottom_margin = 2
|
||||
|
||||
flow5 = flow4.add{type = "label", caption = {"pirates.softmod_info_body_promote"}}
|
||||
flow5 = flow4.add { type = "label", caption = { "pirates.softmod_info_body_promote" } }
|
||||
flow5.style.font_color = GuiCommon.friendly_font_color
|
||||
flow5.style.single_line = false
|
||||
flow5.style.font = 'default-small'
|
||||
@ -149,7 +149,7 @@ function Public.flow_add_info_tab(flow, tab_name)
|
||||
direction = 'horizontal',
|
||||
})
|
||||
flow3.style.horizontally_stretchable = true
|
||||
flow3.style.horizontal_align = 'center'
|
||||
flow3.style.horizontal_align = 'center'
|
||||
|
||||
flow4 = flow3.add({
|
||||
type = 'flow',
|
||||
@ -157,7 +157,7 @@ function Public.flow_add_info_tab(flow, tab_name)
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow4.style.horizontally_stretchable = true
|
||||
flow4.style.horizontal_align = 'center'
|
||||
flow4.style.horizontal_align = 'center'
|
||||
|
||||
flow3 = contents.add({
|
||||
type = 'flow',
|
||||
@ -171,21 +171,13 @@ function Public.flow_add_info_tab(flow, tab_name)
|
||||
direction = 'horizontal',
|
||||
})
|
||||
flow3.style.horizontally_stretchable = true
|
||||
flow3.style.horizontal_align = 'center'
|
||||
|
||||
flow4 = flow3.add{type = "label", caption = {"pirates.softmod_info_body_clicky"}}
|
||||
flow4.style.font = 'default-small'
|
||||
flow4.style.font_color = GuiCommon.friendly_font_color
|
||||
flow4.style.single_line = false
|
||||
flow4.style.bottom_margin = 4
|
||||
flow4.style.top_margin = 3
|
||||
flow3.style.horizontal_align = 'center'
|
||||
|
||||
flow.add_tab(tab, contents)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function Public.click(event)
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
@ -201,19 +193,17 @@ function Public.click(event)
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
|
||||
if eventtype ~= 'tab' and (
|
||||
element.name == (window_name .. '_piratewindow') or
|
||||
(element.parent and element.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.parent and element.parent.parent.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.parent and element.parent.parent.parent.parent.parent and element.parent.parent.parent.parent.parent.name == (window_name .. '_piratewindow'))
|
||||
) then
|
||||
element.name == (window_name .. '_piratewindow') or
|
||||
(element.parent and element.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.parent and element.parent.parent.parent.parent.name == (window_name .. '_piratewindow')) or
|
||||
(element.parent and element.parent.parent and element.parent.parent.parent and element.parent.parent.parent.parent and element.parent.parent.parent.parent.parent and element.parent.parent.parent.parent.parent.name == (window_name .. '_piratewindow'))
|
||||
) then
|
||||
Public.toggle_window(player)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- function Public.regular_update(player)
|
||||
|
||||
-- end
|
||||
@ -225,19 +215,16 @@ function Public.full_update(player)
|
||||
local flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
local flow2 = flow
|
||||
-- warning, if you make these too small, it loses 'Click to dismiss.'
|
||||
-- This is really really dumb, to have to change these manually. But sadly we couldn't get the window to look like it does and also be expandable.
|
||||
if flow2.selected_tab_index == 1 then
|
||||
flow2.style.height = 400
|
||||
elseif flow2.selected_tab_index == 2 then
|
||||
flow2.style.height = 550
|
||||
flow2.style.height = 500
|
||||
elseif flow2.selected_tab_index == 3 then
|
||||
flow2.style.height = 680
|
||||
flow2.style.height = 500
|
||||
elseif flow2.selected_tab_index == 4 then
|
||||
flow2.style.height = 340
|
||||
flow2.style.height = 350
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -40,7 +40,7 @@ function Public.toggle_window(player)
|
||||
end -- else:
|
||||
|
||||
flow = GuiCommon.new_window(player, window_name)
|
||||
flow.caption = {'pirates.gui_minimap_outside_view'}
|
||||
flow.caption = { 'pirates.gui_minimap_outside_view' }
|
||||
flow.style.maximal_width = 800
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
@ -60,11 +60,11 @@ function Public.toggle_window(player)
|
||||
|
||||
if not (memory.boat and memory.boat.position and memory.boat.surface_name) then return end
|
||||
|
||||
local position = memory.boat.position
|
||||
local position = memory.boat.position
|
||||
local destination = Common.current_destination()
|
||||
if (destination and destination.type and destination.type == Surfaces.enum.ISLAND and destination.static_params and destination.static_params.boat_starting_xposition) then
|
||||
-- nicer viewing position:
|
||||
position = {x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0}
|
||||
position = { x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0 }
|
||||
end
|
||||
local zoom
|
||||
if gui_memory and gui_memory[window_name] and gui_memory[window_name].zoom then
|
||||
@ -79,25 +79,25 @@ function Public.toggle_window(player)
|
||||
size = default_size
|
||||
end
|
||||
|
||||
local element = flow['camera']
|
||||
if not element then
|
||||
element =
|
||||
flow.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'camera',
|
||||
position = position,
|
||||
surface_index = game.surfaces[memory.boat.surface_name].index,
|
||||
zoom = zoom,
|
||||
tooltip = {'pirates.gui_minimap_tooltip'}
|
||||
}
|
||||
)
|
||||
element.style.margin = 1
|
||||
element.style.minimal_height = size
|
||||
element.style.minimal_width = size
|
||||
element.style.maximal_height = size
|
||||
element.style.maximal_width = size
|
||||
end
|
||||
local element = flow['camera']
|
||||
if not element then
|
||||
element =
|
||||
flow.add(
|
||||
{
|
||||
type = 'camera',
|
||||
name = 'camera',
|
||||
position = position,
|
||||
surface_index = game.surfaces[memory.boat.surface_name].index,
|
||||
zoom = zoom,
|
||||
tooltip = { 'pirates.gui_minimap_tooltip' }
|
||||
}
|
||||
)
|
||||
element.style.margin = 1
|
||||
element.style.minimal_height = size
|
||||
element.style.minimal_width = size
|
||||
element.style.maximal_height = size
|
||||
element.style.maximal_width = size
|
||||
end
|
||||
|
||||
flow2 = GuiCommon.flow_add_close_button(flow, window_name .. '_piratebutton')
|
||||
flow2.add(
|
||||
@ -107,16 +107,12 @@ function Public.toggle_window(player)
|
||||
index = 1,
|
||||
allow_none_state = false,
|
||||
switch_state = switch_state,
|
||||
left_label_caption = {'pirates.gui_minimap_switch_left'},
|
||||
right_label_caption = {'pirates.gui_minimap_switch_right'},
|
||||
left_label_caption = { 'pirates.gui_minimap_switch_left' },
|
||||
right_label_caption = { 'pirates.gui_minimap_switch_right' },
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- function Public.regular_update(player)
|
||||
|
||||
-- end
|
||||
@ -131,13 +127,13 @@ function Public.full_update(player)
|
||||
if not player.gui.screen[window_name .. '_piratewindow'] then return end
|
||||
flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
local element = flow['camera']
|
||||
local element = flow['camera']
|
||||
if element then
|
||||
local position = boat.position
|
||||
local destination = Common.current_destination()
|
||||
if (destination and destination.type and destination.type == Surfaces.enum.ISLAND and boat.surface_name and boat.surface_name == destination.surface_name and destination.static_params and destination.static_params.boat_starting_xposition) then
|
||||
-- nicer viewing position:
|
||||
position = {x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0}
|
||||
position = { x = destination.static_params.boat_starting_xposition + 50, y = destination.static_params.boat_starting_yposition or 0 }
|
||||
end
|
||||
|
||||
if position then
|
||||
@ -149,7 +145,6 @@ function Public.full_update(player)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.click(event)
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
@ -162,13 +157,8 @@ function Public.click(event)
|
||||
-- local flow = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
-- local shop_data = Shop.main_shop_data
|
||||
|
||||
-- if eventname == 'buy_button' then
|
||||
-- Shop.Captains.main_shop_try_purchase(event.element.parent.name)
|
||||
-- end
|
||||
|
||||
if eventname ~= 'camera' then return end
|
||||
if eventname ~= 'camera' then return end
|
||||
|
||||
local zoom = default_zoom
|
||||
local size = default_size
|
||||
@ -181,7 +171,7 @@ function Public.click(event)
|
||||
size = gui_memory[window_name].size or default_size
|
||||
end
|
||||
|
||||
if event.button == defines.mouse_button_type.right then
|
||||
if event.button == defines.mouse_button_type.right then
|
||||
if zoom == 0.15 then
|
||||
zoom = 0.11
|
||||
elseif zoom == 0.11 then
|
||||
@ -189,9 +179,9 @@ function Public.click(event)
|
||||
else
|
||||
zoom = 0.04
|
||||
end
|
||||
event.element.zoom = zoom
|
||||
end
|
||||
if event.button == defines.mouse_button_type.left then
|
||||
event.element.zoom = zoom
|
||||
end
|
||||
if event.button == defines.mouse_button_type.left then
|
||||
if zoom == 0.04 then
|
||||
zoom = 0.07
|
||||
elseif zoom == 0.07 then
|
||||
@ -199,9 +189,9 @@ function Public.click(event)
|
||||
else
|
||||
zoom = 0.15
|
||||
end
|
||||
event.element.zoom = zoom
|
||||
end
|
||||
if event.button == defines.mouse_button_type.middle then
|
||||
event.element.zoom = zoom
|
||||
end
|
||||
if event.button == defines.mouse_button_type.middle then
|
||||
if size == 340 then
|
||||
size = 440
|
||||
elseif size == 440 then
|
||||
@ -213,31 +203,29 @@ function Public.click(event)
|
||||
else
|
||||
size = 340
|
||||
end
|
||||
event.element.style.minimal_height = size
|
||||
event.element.style.minimal_width = size
|
||||
event.element.style.maximal_height = size
|
||||
event.element.style.maximal_width = size
|
||||
end
|
||||
event.element.style.minimal_height = size
|
||||
event.element.style.minimal_width = size
|
||||
event.element.style.maximal_height = size
|
||||
event.element.style.maximal_width = size
|
||||
end
|
||||
|
||||
GuiCommon.update_gui_memory(player, window_name, 'zoom', zoom)
|
||||
GuiCommon.update_gui_memory(player, window_name, 'size', size)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function on_player_changed_surface(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not Common.validate_player_and_character(player) then
|
||||
return
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
if not Common.validate_player_and_character(player) then
|
||||
return
|
||||
end
|
||||
|
||||
local window = player.gui.screen[window_name .. '_piratewindow']
|
||||
|
||||
local from_hold_or_cabin_bool = string.sub(game.surfaces[event.surface_index].name, 9, 12) == 'Hold' or string.sub(game.surfaces[event.surface_index].name, 9, 13) == 'Cabin'
|
||||
local to_hold_or_cabin_bool = string.sub(player.surface.name, 9, 12) == 'Hold' or string.sub(player.surface.name, 9, 13) == 'Cabin'
|
||||
|
||||
if from_hold_or_cabin_bool and (not to_hold_or_cabin_bool) then
|
||||
if window then
|
||||
if from_hold_or_cabin_bool and (not to_hold_or_cabin_bool) then
|
||||
if window then
|
||||
Public.toggle_window(player)
|
||||
end
|
||||
elseif to_hold_or_cabin_bool and (not from_hold_or_cabin_bool) then
|
||||
@ -247,11 +235,10 @@ local function on_player_changed_surface(event)
|
||||
if (gui_memory and gui_memory[window_name] and gui_memory[window_name].auto_map) or (not gui_memory) or (gui_memory and (not gui_memory[window_name])) then --if no gui memory exists for this, default to opening the minimap
|
||||
Public.toggle_window(player)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -17,14 +17,16 @@ local Public = {}
|
||||
local window_name = 'progress'
|
||||
|
||||
function Public.toggle_window(player)
|
||||
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then player.gui.screen[window_name .. '_piratewindow'].destroy() return end
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then
|
||||
player.gui.screen[window_name .. '_piratewindow'].destroy()
|
||||
return
|
||||
end
|
||||
|
||||
local flow, flow2, flow3
|
||||
flow = GuiCommon.new_window(player, window_name)
|
||||
flow.caption = {'pirates.gui_progress'}
|
||||
flow.caption = { 'pirates.gui_progress' }
|
||||
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'distance_travelled', {'pirates.gui_progress_distance_travelled'})
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'distance_travelled', { 'pirates.gui_progress_distance_travelled' })
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'leagues',
|
||||
@ -37,7 +39,7 @@ function Public.toggle_window(player)
|
||||
flow3.style.maximal_width = 160
|
||||
flow3.style.font = 'default-dropdown'
|
||||
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'current_location', {'pirates.gui_progress_current_location', ''})
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'current_location', { 'pirates.gui_progress_current_location', '' })
|
||||
|
||||
-- flow3 = flow2.add({
|
||||
-- name = 'location_name',
|
||||
@ -67,7 +69,7 @@ function Public.toggle_window(player)
|
||||
-- flow3 = flow2.add({type = 'label', name = 'patch_size', caption = ''})
|
||||
-- flow3.style.top_margin = -3
|
||||
|
||||
flow3 = flow2.add({type = 'label', name = 'daynight', caption = ''})
|
||||
flow3 = flow2.add({ type = 'label', name = 'daynight', caption = '' })
|
||||
flow3.style.top_margin = -3
|
||||
|
||||
|
||||
@ -84,7 +86,6 @@ function Public.toggle_window(player)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
-- function Public.regular_update(player)
|
||||
|
||||
-- end
|
||||
@ -109,8 +110,8 @@ function Public.full_update(player)
|
||||
name = Lobby.Data.display_name
|
||||
end
|
||||
|
||||
flow.current_location.header.caption = {'pirates.gui_progress_current_location', name}
|
||||
flow.distance_travelled.body.leagues.caption = {'pirates.gui_progress_leagues', memory.overworldx or 0}
|
||||
flow.current_location.header.caption = { 'pirates.gui_progress_current_location', name }
|
||||
flow.distance_travelled.body.leagues.caption = { 'pirates.gui_progress_leagues', memory.overworldx or 0 }
|
||||
|
||||
-- local daynighttype
|
||||
-- if destination.static_params and destination.static_params.daynightcycletype then
|
||||
@ -145,7 +146,7 @@ function Public.full_update(player)
|
||||
-- flow.current_location.body.daynight.visible = false
|
||||
-- end
|
||||
local daynightcycletype = destination.static_params.daynightcycletype or 1
|
||||
flow.current_location.body.daynight.caption = {'pirates.gui_progress_time_of_day', CoreData.daynightcycle_types[daynightcycletype].displayname}
|
||||
flow.current_location.body.daynight.caption = { 'pirates.gui_progress_time_of_day', CoreData.daynightcycle_types[daynightcycletype].displayname }
|
||||
|
||||
|
||||
-- local ores
|
||||
@ -173,5 +174,4 @@ function Public.full_update(player)
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -3,7 +3,7 @@
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
-- local Utils = require 'maps.pirates.utils_local'
|
||||
local Math = require 'maps.pirates.math'
|
||||
-- local Surfaces = require 'maps.pirates.surfaces.surfaces'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
@ -29,8 +29,8 @@ local function flow_add_proposal_slider(flow, name, displayname, indices_count,
|
||||
type = 'flow',
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow2.style.horizontal_align = 'left'
|
||||
flow2.style.width = 130
|
||||
flow2.style.horizontal_align = 'left'
|
||||
flow2.style.width = 130
|
||||
|
||||
flow3 = flow2.add({
|
||||
type = 'label',
|
||||
@ -38,10 +38,10 @@ local function flow_add_proposal_slider(flow, name, displayname, indices_count,
|
||||
})
|
||||
flow3.style.font = 'heading-3'
|
||||
flow3.style.height = 20
|
||||
flow3.style.margin = 0
|
||||
flow3.style.padding = 0
|
||||
flow3.style.top_padding = -4
|
||||
flow3.style.bottom_margin = 0
|
||||
flow3.style.margin = 0
|
||||
flow3.style.padding = 0
|
||||
flow3.style.top_padding = -4
|
||||
flow3.style.bottom_margin = 0
|
||||
flow3.style.font_color = GuiCommon.subsection_header_font_color
|
||||
flow3.tooltip = tooltip
|
||||
|
||||
@ -50,8 +50,8 @@ local function flow_add_proposal_slider(flow, name, displayname, indices_count,
|
||||
type = 'flow',
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow3.style.horizontal_align = 'center'
|
||||
flow3.style.width = 130
|
||||
flow3.style.horizontal_align = 'center'
|
||||
flow3.style.width = 130
|
||||
|
||||
flow4 = flow3.add({
|
||||
name = 'slider',
|
||||
@ -64,7 +64,7 @@ local function flow_add_proposal_slider(flow, name, displayname, indices_count,
|
||||
discrete_slider = true,
|
||||
})
|
||||
flow4.style.width = 100
|
||||
flow4.style.margin = 0
|
||||
flow4.style.margin = 0
|
||||
flow4.tooltip = tooltip
|
||||
|
||||
flow4 = flow3.add({
|
||||
@ -74,10 +74,10 @@ local function flow_add_proposal_slider(flow, name, displayname, indices_count,
|
||||
})
|
||||
flow4.style.font = 'default-listbox'
|
||||
flow4.style.height = 20
|
||||
flow4.style.margin = 0
|
||||
flow4.style.padding = 0
|
||||
flow4.style.top_padding = 0
|
||||
flow4.style.bottom_margin = 16
|
||||
flow4.style.margin = 0
|
||||
flow4.style.padding = 0
|
||||
flow4.style.top_padding = 0
|
||||
flow4.style.bottom_margin = 16
|
||||
flow4.tooltip = tooltip
|
||||
|
||||
flow2 = flow.add({
|
||||
@ -164,34 +164,37 @@ end
|
||||
|
||||
function Public.toggle_window(player)
|
||||
local window
|
||||
local flow, flow2, flow3, flow4, flow5
|
||||
local flow, flow2, flow3, flow4, flow5, flow6
|
||||
|
||||
--*** OVERALL FLOW ***--
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then player.gui.screen[window_name .. '_piratewindow'].destroy() return end
|
||||
if player.gui.screen[window_name .. '_piratewindow'] then
|
||||
player.gui.screen[window_name .. '_piratewindow'].destroy()
|
||||
return
|
||||
end
|
||||
|
||||
window = GuiCommon.new_window(player, window_name)
|
||||
window.caption = {'pirates.gui_runs_play'}
|
||||
window.caption = { 'pirates.gui_runs_play' }
|
||||
|
||||
flow = window.add {
|
||||
type = 'scroll-pane',
|
||||
name = 'scroll_pane',
|
||||
direction = 'vertical',
|
||||
horizontal_scroll_policy = 'never',
|
||||
type = 'scroll-pane',
|
||||
name = 'scroll_pane',
|
||||
direction = 'vertical',
|
||||
horizontal_scroll_policy = 'never',
|
||||
vertical_scroll_policy = 'auto-and-reserve-space'
|
||||
}
|
||||
flow.style.maximal_height = 500
|
||||
}
|
||||
flow.style.maximal_height = 500
|
||||
flow.style.bottom_margin = 10
|
||||
|
||||
--*** ONGOING RUNS ***--
|
||||
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'ongoing_runs', {'pirates.gui_runs_ongoing_runs'})
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'ongoing_runs', { 'pirates.gui_runs_ongoing_runs' })
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'helpful_tip',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_ongoing_runs_helpful_tip'},
|
||||
caption = { 'pirates.gui_runs_ongoing_runs_helpful_tip' },
|
||||
})
|
||||
flow3.style.font_color = {r=0.90, g=0.90, b=0.90}
|
||||
flow3.style.font_color = { r = 0.90, g = 0.90, b = 0.90 }
|
||||
flow3.style.single_line = false
|
||||
flow3.style.maximal_width = 160
|
||||
|
||||
@ -206,7 +209,7 @@ function Public.toggle_window(player)
|
||||
flow3 = flow2.add({
|
||||
name = 'join_protected_crew_info',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_join_protected_run_info', 0, 0, 0},
|
||||
caption = { 'pirates.gui_join_protected_run_info' },
|
||||
visible = false,
|
||||
})
|
||||
flow3.style.single_line = false
|
||||
@ -214,13 +217,13 @@ function Public.toggle_window(player)
|
||||
flow3 = flow2.add({
|
||||
name = 'join_private_crew_info',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_join_private_run_info', 0, 0, 0},
|
||||
caption = { 'pirates.gui_join_private_run_info' },
|
||||
visible = false,
|
||||
})
|
||||
flow3.style.single_line = false
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'password_namefield',
|
||||
name = 'password',
|
||||
type = 'textfield',
|
||||
text = '',
|
||||
visible = false,
|
||||
@ -239,29 +242,29 @@ function Public.toggle_window(player)
|
||||
flow4 = flow3.add({
|
||||
name = 'join_spectators',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_ongoing_runs_spectate'},
|
||||
caption = { 'pirates.gui_runs_ongoing_runs_spectate' },
|
||||
})
|
||||
flow4.style.minimal_width = 95
|
||||
flow4.style.font = 'default-bold'
|
||||
flow4.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow4.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
|
||||
flow4 = flow3.add({
|
||||
name = 'join_crew',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_ongoing_runs_join_crew'},
|
||||
caption = { 'pirates.gui_runs_ongoing_runs_join_crew' },
|
||||
})
|
||||
flow4.style.minimal_width = 95
|
||||
flow4.style.font = 'default-bold'
|
||||
flow4.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow4.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
|
||||
flow4 = flow3.add({
|
||||
name = 'leave_spectators',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_ongoing_runs_return_to_lobby'},
|
||||
caption = { 'pirates.gui_runs_ongoing_runs_return_to_lobby' },
|
||||
})
|
||||
flow4.style.minimal_width = 95
|
||||
flow4.style.font = 'default-bold'
|
||||
flow4.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow4.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'wait_to_join',
|
||||
@ -272,14 +275,14 @@ function Public.toggle_window(player)
|
||||
flow3 = flow2.add({
|
||||
name = 'leaving_prompt',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_ongoing_runs_hop_on_board'},
|
||||
caption = { 'pirates.gui_runs_ongoing_runs_hop_on_board' },
|
||||
})
|
||||
flow3.style.left_margin = 5
|
||||
|
||||
|
||||
-- PROPOSALS --
|
||||
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'proposals', {'pirates.gui_runs_proposals'})
|
||||
flow2 = GuiCommon.flow_add_section(flow, 'proposals', { 'pirates.gui_runs_proposals' })
|
||||
|
||||
flow3 = flow2.add({
|
||||
name = 'proposals_listbox',
|
||||
@ -298,11 +301,11 @@ function Public.toggle_window(player)
|
||||
flow4 = flow3.add({
|
||||
name = 'abandon_proposal',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_proposals_abandon_proposal'},
|
||||
caption = { 'pirates.gui_runs_proposals_abandon_proposal' },
|
||||
})
|
||||
flow4.style.minimal_width = 150
|
||||
flow4.style.font = 'default-bold'
|
||||
flow4.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow4.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
flow4.style.bottom_margin = 9
|
||||
|
||||
|
||||
@ -315,118 +318,116 @@ function Public.toggle_window(player)
|
||||
type = 'flow',
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow4.style.horizontal_align = 'center'
|
||||
flow4.style.vertical_align = 'center'
|
||||
flow4.style.horizontal_align = 'center'
|
||||
flow4.style.vertical_align = 'center'
|
||||
|
||||
flow5 = flow4.add({
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_proposal_maker_run_name'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_run_name' },
|
||||
})
|
||||
flow5.style.font = 'heading-3'
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'namefield',
|
||||
type = 'textfield',
|
||||
caption = {'pirates.gui_runs_proposal_maker_run_name_2'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_run_name_2' },
|
||||
text = '',
|
||||
})
|
||||
flow5.style.width = 150
|
||||
flow5.style.height = 24
|
||||
flow5.style.top_margin = -3
|
||||
flow5.style.bottom_margin = 3
|
||||
|
||||
-- PROTECTED RUN ELEMENTS --
|
||||
-- CREW SETTINGS --
|
||||
|
||||
flow4.add({
|
||||
flow5 = flow4.add({
|
||||
name = 'settings',
|
||||
type = 'flow',
|
||||
direction = 'vertical',
|
||||
})
|
||||
flow5.style.horizontal_align = 'left'
|
||||
flow5.style.bottom_margin = 5
|
||||
|
||||
flow5.add({
|
||||
name = 'blueprints_disabled_checkbox',
|
||||
type = 'checkbox',
|
||||
caption = { 'pirates.gui_runs_proposal_maker_blueprints_disabled' },
|
||||
state = false,
|
||||
})
|
||||
|
||||
flow5.add({
|
||||
name = 'protected_checkbox',
|
||||
type = 'checkbox',
|
||||
caption = {'pirates.gui_runs_proposal_maker_protected'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_protected' },
|
||||
state = false,
|
||||
tooltip = {'pirates.gui_runs_proposal_maker_protected_tooltip', CoreData.protected_run_lock_amount_hr}
|
||||
tooltip = { 'pirates.gui_runs_proposal_maker_protected_tooltip' }
|
||||
})
|
||||
|
||||
-- PRIVATE RUN ELEMENTS --
|
||||
|
||||
flow4.add({
|
||||
flow5.add({
|
||||
name = 'private_checkbox',
|
||||
type = 'checkbox',
|
||||
caption = {'pirates.gui_runs_proposal_maker_private'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_private' },
|
||||
state = false,
|
||||
tooltip = {'pirates.gui_runs_proposal_maker_private_tooltip', CoreData.private_run_lock_amount_hr}
|
||||
tooltip = { 'pirates.gui_runs_proposal_maker_private_tooltip' }
|
||||
})
|
||||
|
||||
flow5 = flow4.add({
|
||||
flow6 = flow5.add({
|
||||
name = 'password_label',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_proposal_maker_password'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_password' },
|
||||
})
|
||||
flow5.style.font = 'heading-3'
|
||||
flow6.style.font = 'heading-3'
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'password_namefield',
|
||||
flow6 = flow5.add({
|
||||
name = 'password',
|
||||
type = 'textfield',
|
||||
text = '',
|
||||
})
|
||||
flow5.style.width = 150
|
||||
flow5.style.height = 24
|
||||
flow5.style.top_margin = -3
|
||||
flow5.style.bottom_margin = 3
|
||||
flow6.style.width = 150
|
||||
flow6.style.height = 24
|
||||
flow6.style.top_margin = -3
|
||||
flow6.style.bottom_margin = 3
|
||||
|
||||
flow5 = flow4.add({
|
||||
flow6 = flow5.add({
|
||||
name = 'confirm_password_label',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_proposal_maker_confirm_password'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_confirm_password' },
|
||||
})
|
||||
flow5.style.font = 'heading-3'
|
||||
flow6.style.font = 'heading-3'
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'confirm_password_namefield',
|
||||
flow6 = flow5.add({
|
||||
name = 'confirm_password',
|
||||
type = 'textfield',
|
||||
text = '',
|
||||
})
|
||||
flow5.style.width = 150
|
||||
flow5.style.height = 24
|
||||
flow5.style.top_margin = -3
|
||||
flow5.style.bottom_margin = 3
|
||||
flow6.style.width = 150
|
||||
flow6.style.height = 24
|
||||
flow6.style.top_margin = -3
|
||||
flow6.style.bottom_margin = 3
|
||||
|
||||
-- CREW SIZE LIMIT SLIDER --
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'options',
|
||||
name = 'capacity_options',
|
||||
type = 'table',
|
||||
column_count = 2,
|
||||
})
|
||||
flow5.style.width = 200
|
||||
flow5.style.margin = 0
|
||||
|
||||
flow_add_proposal_slider(flow5, 'capacity', {'pirates.gui_runs_proposal_maker_capacity'}, #CoreData.capacity_options, 5, {'pirates.capacity_tooltip'})
|
||||
flow_add_proposal_slider(flow5, 'capacity', { 'pirates.gui_runs_proposal_maker_capacity' }, #CoreData.capacity_options, 5, { 'pirates.capacity_tooltip' })
|
||||
-- flow_add_proposal_slider(flow5, 'difficulty', 'Difficulty', #CoreData.difficulty_options, 2, {'pirates.difficulty_tooltip'})
|
||||
-- flow_add_proposal_switch(flow5, 'mode', 'Mode', 'left', {'pirates.mode_tooltip'})
|
||||
|
||||
-- flow5 = flow4.add({
|
||||
-- name = 'proposal_cant_do_infinity_mode',
|
||||
-- type = 'label',
|
||||
-- caption = 'Infinity mode isn\'t available at the moment.',
|
||||
-- })
|
||||
-- flow5.style.single_line = false
|
||||
-- flow5.style.maximal_width = 200
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'proposal_disabled_low_crew_caps',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_proposal_maker_capacity_disabled'},
|
||||
})
|
||||
flow5.style.single_line = false
|
||||
flow5.style.maximal_width = 200
|
||||
flow5.visible = false --maybe will bring this back for the speedrun ship?
|
||||
|
||||
flow5 = flow4.add({
|
||||
name = 'propose_crew',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_proposal_maker_propose'},
|
||||
caption = { 'pirates.gui_runs_proposal_maker_propose' },
|
||||
})
|
||||
flow5.style.minimal_width = 75
|
||||
flow5.style.font = 'default-bold'
|
||||
flow5.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow5.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
|
||||
|
||||
-- LAUNCH YOUR PROPOSAL --
|
||||
@ -440,33 +441,30 @@ function Public.toggle_window(player)
|
||||
flow4 = flow3.add({
|
||||
name = 'proposal_crew_count_capped',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_launch_error_2'},
|
||||
caption = { 'pirates.gui_runs_launch_error_2' },
|
||||
})
|
||||
flow4.style.single_line = false
|
||||
|
||||
flow4 = flow3.add({
|
||||
name = 'proposal_insufficient_sloops',
|
||||
type = 'label',
|
||||
caption = {'pirates.gui_runs_launch_error_4'},
|
||||
caption = { 'pirates.gui_runs_launch_error_4' },
|
||||
})
|
||||
flow4.style.single_line = false
|
||||
|
||||
flow4 = flow3.add({
|
||||
name = 'launch_crew',
|
||||
type = 'button',
|
||||
caption = {'pirates.gui_runs_launch'},
|
||||
caption = { 'pirates.gui_runs_launch' },
|
||||
})
|
||||
flow4.style.minimal_width = 150
|
||||
flow4.style.font = 'default-bold'
|
||||
flow4.style.font_color = {r=0.10, g=0.10, b=0.10}
|
||||
flow4.style.font_color = { r = 0.10, g = 0.10, b = 0.10 }
|
||||
|
||||
|
||||
GuiCommon.flow_add_close_button(window, window_name .. '_piratebutton')
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- function Public.regular_update(player)
|
||||
|
||||
-- end
|
||||
@ -477,174 +475,110 @@ function Public.full_update(player)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
if not player.gui.screen['runs_piratewindow'] then return end
|
||||
local flow = player.gui.screen['runs_piratewindow'].scroll_pane
|
||||
local window = player.gui.screen['runs_piratewindow']
|
||||
if not window then return end
|
||||
local flow = window.scroll_pane
|
||||
local playercrew_status = GuiCommon.crew_overall_state_bools(player.index)
|
||||
if not playercrew_status then return end
|
||||
|
||||
local ongoing_runs = flow.ongoing_runs
|
||||
ongoing_runs.visible = (#global_memory.crew_active_ids > 0)
|
||||
|
||||
--*** WHAT TO SHOW ***--
|
||||
|
||||
flow.ongoing_runs.visible = (#global_memory.crew_active_ids > 0)
|
||||
if flow.ongoing_runs.visible then
|
||||
local bool1 = (not playercrew_status.leaving) and (not playercrew_status.adventuring) and (not playercrew_status.spectating) and (flow.ongoing_runs.body.ongoing_runs_listbox.selected_index ~= 0)
|
||||
|
||||
local selected_joinable_bool = false
|
||||
local crewid
|
||||
if bool1 then
|
||||
crewid = tonumber((flow.ongoing_runs.body.ongoing_runs_listbox.get_item(flow.ongoing_runs.body.ongoing_runs_listbox.selected_index))[2])
|
||||
selected_joinable_bool = bool1 and crewid ~= nil and global_memory.crew_memories[crewid] ~= nil and (global_memory.crew_memories[crewid].crewstatus == Crew.enum.ADVENTURING)
|
||||
end
|
||||
|
||||
flow.ongoing_runs.body.helpful_tip.visible = not (playercrew_status.leaving or playercrew_status.adventuring or playercrew_status.spectating)
|
||||
|
||||
flow.ongoing_runs.body.flow_buttons.visible = selected_joinable_bool or playercrew_status.spectating
|
||||
flow.ongoing_runs.body.flow_buttons.join_spectators.visible = selected_joinable_bool
|
||||
flow.ongoing_runs.body.flow_buttons.leave_spectators.visible = playercrew_status.spectating
|
||||
flow.ongoing_runs.body.flow_buttons.join_crew.visible = selected_joinable_bool and (not (crewid and global_memory.crew_memories[crewid] and (global_memory.crew_memories[crewid].crewstatus == Crew.enum.LEAVING_INITIAL_DOCK or #global_memory.crew_memories[crewid].crewplayerindices >= global_memory.crew_memories[crewid].capacity or (global_memory.crew_memories[crewid].tempbanned_from_joining_data and global_memory.crew_memories[crewid].tempbanned_from_joining_data[player.index] and game.tick < global_memory.crew_memories[crewid].tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks))))
|
||||
|
||||
flow.ongoing_runs.body.wait_to_join.visible = selected_joinable_bool and crewid and global_memory.crew_memories[crewid] and (global_memory.crew_memories[crewid].tempbanned_from_joining_data and global_memory.crew_memories[crewid].tempbanned_from_joining_data[player.index] and game.tick < global_memory.crew_memories[crewid].tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks) and (not (global_memory.crew_memories[crewid].crewstatus == Crew.enum.LEAVING_INITIAL_DOCK or #global_memory.crew_memories[crewid].crewplayerindices >= global_memory.crew_memories[crewid].capacity))
|
||||
if flow.ongoing_runs.body.wait_to_join.visible then
|
||||
flow.ongoing_runs.body.wait_to_join.caption = {'pirates.gui_runs_wait_to_join', Math.ceil(((global_memory.crew_memories[crewid].tempbanned_from_joining_data[player.index] - (game.tick - Common.ban_from_rejoining_crew_ticks)))/60)}
|
||||
end
|
||||
|
||||
if not selected_joinable_bool then flow.ongoing_runs.body.ongoing_runs_listbox.selected_index = 0 end
|
||||
|
||||
flow.ongoing_runs.body.leaving_prompt.visible = playercrew_status.leaving
|
||||
|
||||
local show_protected_info = crewid and global_memory.crew_memories[crewid].run_is_protected
|
||||
flow.ongoing_runs.body.join_protected_crew_info.visible = show_protected_info
|
||||
|
||||
local show_private_info = crewid and global_memory.crew_memories[crewid].run_is_private
|
||||
flow.ongoing_runs.body.join_private_crew_info.visible = show_private_info
|
||||
flow.ongoing_runs.body.password_namefield.visible = show_private_info
|
||||
end
|
||||
|
||||
flow.proposals.visible = (memory.crewstatus == nil and not playercrew_status.leaving)
|
||||
if flow.proposals.visible then
|
||||
if playercrew_status.proposing then
|
||||
flow.proposals.body.proposals_listbox.selected_index = 0
|
||||
flow.proposals.body.proposals_listbox.selected_index = 0
|
||||
end
|
||||
|
||||
flow.proposals.body.proposals_listbox.visible = (not playercrew_status.leaving) and (#global_memory.crewproposals > 0)
|
||||
|
||||
flow.proposals.body.flow_buttons.abandon_proposal.visible = (not playercrew_status.leaving) and playercrew_status.created_crew and playercrew_status.proposing and (#global_memory.crewproposals > 0)
|
||||
|
||||
flow.proposals.body.proposal_maker.visible = (not playercrew_status.leaving) and (not playercrew_status.created_crew)
|
||||
|
||||
flow.proposals.body.flow_proposal_launch.proposal_insufficient_sloops.visible = playercrew_status.sloops_full
|
||||
|
||||
flow.proposals.body.flow_proposal_launch.proposal_crew_count_capped.visible = playercrew_status.crew_count_capped
|
||||
|
||||
-- flow.proposals.body.proposal_maker.body.proposal_cant_do_infinity_mode.visible = (flow.proposals.body.proposal_maker.body.options.mode.mode.switch.switch_state == 'right')
|
||||
|
||||
-- flow.proposals.body.proposal_maker.body.proposal_disabled_low_crew_caps.visible = false
|
||||
flow.proposals.body.proposal_maker.body.proposal_disabled_low_crew_caps.visible = (flow.proposals.body.proposal_maker.body.options.capacity.capacity.slider.slider_value < global_memory.minimumCapacitySliderValue)
|
||||
|
||||
flow.proposals.body.proposal_maker.body.propose_crew.visible = (flow.proposals.body.proposal_maker.body.proposal_disabled_low_crew_caps.visible == false)
|
||||
-- flow.proposals.body.proposal_maker.body.propose_crew.visible = (flow.proposals.body.proposal_maker.body.proposal_cant_do_infinity_mode.visible == false) and (flow.proposals.body.proposal_maker.body.proposal_disabled_low_crew_caps.visible == false)
|
||||
|
||||
flow.proposals.body.flow_proposal_launch.launch_crew.visible = playercrew_status.proposal_can_launch
|
||||
|
||||
local checkbox_state = flow.proposals.body.proposal_maker.body.private_checkbox.state
|
||||
flow.proposals.body.proposal_maker.body.password_label.visible = checkbox_state
|
||||
flow.proposals.body.proposal_maker.body.password_namefield.visible = checkbox_state
|
||||
flow.proposals.body.proposal_maker.body.confirm_password_label.visible = checkbox_state
|
||||
flow.proposals.body.proposal_maker.body.confirm_password_namefield.visible = checkbox_state
|
||||
end
|
||||
|
||||
|
||||
|
||||
--*** UPDATE CONTENT ***--
|
||||
|
||||
if flow.ongoing_runs.visible then
|
||||
if ongoing_runs.visible then
|
||||
local wrappedmemories = {}
|
||||
for _, mem in pairs(global_memory.crew_memories) do
|
||||
local count = 0
|
||||
if mem.crewstatus and mem.crewstatus == Crew.enum.LEAVING_INITIAL_DOCK then
|
||||
count = Boats.players_on_boat_count(mem.boat)
|
||||
elseif mem.crewplayerindices then
|
||||
count = #mem.crewplayerindices
|
||||
local count = (mem.crewstatus == Crew.enum.LEAVING_INITIAL_DOCK) and Boats.players_on_boat_count(mem.boat) or #mem.crewplayerindices
|
||||
local crew_info = {
|
||||
'pirates.second_element',
|
||||
mem.id,
|
||||
{ '', mem.name .. " (" .. count .. (count == 1 and ' player' or ' players') .. ") — ",
|
||||
'[item=', CoreData.difficulty_options[mem.difficulty_option].icon, '], ',
|
||||
'[item=rail]', mem.overworldx or 0,
|
||||
mem.run_is_private and { 'pirates.run_condition_private' } or '',
|
||||
mem.run_is_protected and { 'pirates.run_condition_captain_protected' } or '',
|
||||
mem.run_has_blueprints_disabled and { 'pirates.run_condition_blueprints_disabled' } or '' }
|
||||
}
|
||||
table.insert(wrappedmemories, crew_info)
|
||||
end
|
||||
GuiCommon.update_listbox(ongoing_runs.body.ongoing_runs_listbox, wrappedmemories)
|
||||
|
||||
local selected_index = ongoing_runs.body.ongoing_runs_listbox.selected_index
|
||||
local selected_crew = selected_index ~= 0 and global_memory.crew_memories[tonumber(ongoing_runs.body.ongoing_runs_listbox.get_item(selected_index)[2])]
|
||||
|
||||
if playercrew_status.leaving or playercrew_status.adventuring or playercrew_status.spectating then
|
||||
selected_crew = false
|
||||
end
|
||||
|
||||
local can_join = selected_crew and selected_crew.crewstatus == Crew.enum.ADVENTURING
|
||||
|
||||
ongoing_runs.body.helpful_tip.visible = not (playercrew_status.leaving or playercrew_status.adventuring or playercrew_status.spectating)
|
||||
ongoing_runs.body.flow_buttons.visible = can_join or playercrew_status.spectating
|
||||
ongoing_runs.body.flow_buttons.join_spectators.visible = can_join
|
||||
ongoing_runs.body.flow_buttons.leave_spectators.visible = playercrew_status.spectating
|
||||
ongoing_runs.body.flow_buttons.join_crew.visible = can_join and selected_crew and not (selected_crew.crewstatus == Crew.enum.LEAVING_INITIAL_DOCK or #selected_crew.crewplayerindices >= selected_crew.capacity or (selected_crew.tempbanned_from_joining_data and selected_crew.tempbanned_from_joining_data[player.index] and game.tick < selected_crew.tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks))
|
||||
|
||||
local show_wait_message = can_join and selected_crew and selected_crew.tempbanned_from_joining_data and selected_crew.tempbanned_from_joining_data[player.index] and game.tick < selected_crew.tempbanned_from_joining_data[player.index] + Common.ban_from_rejoining_crew_ticks
|
||||
ongoing_runs.body.wait_to_join.visible = show_wait_message
|
||||
if show_wait_message then
|
||||
local wait_time = selected_crew and Math.ceil((selected_crew.tempbanned_from_joining_data[player.index] - (game.tick - Common.ban_from_rejoining_crew_ticks)) / 60) or 0
|
||||
ongoing_runs.body.wait_to_join.caption = { 'pirates.gui_runs_wait_to_join', wait_time }
|
||||
end
|
||||
|
||||
ongoing_runs.body.leaving_prompt.visible = playercrew_status.leaving
|
||||
ongoing_runs.body.join_protected_crew_info.visible = selected_crew and selected_crew.run_is_protected
|
||||
ongoing_runs.body.join_private_crew_info.visible = selected_crew and selected_crew.run_is_private
|
||||
ongoing_runs.body.password.visible = selected_crew and selected_crew.run_is_private
|
||||
|
||||
if selected_crew then
|
||||
if ongoing_runs.body.join_protected_crew_info.visible then
|
||||
ongoing_runs.body.join_protected_crew_info.caption = { 'pirates.gui_join_protected_run_info' }
|
||||
end
|
||||
|
||||
local extraCrewText = ''
|
||||
if mem.run_is_protected and mem.run_is_private then
|
||||
extraCrewText = ' (private & protected)'
|
||||
elseif mem.run_is_private then
|
||||
extraCrewText = ' (private)'
|
||||
elseif mem.run_is_protected then
|
||||
extraCrewText = ' (protected)'
|
||||
if ongoing_runs.body.join_private_crew_info.visible then
|
||||
ongoing_runs.body.join_private_crew_info.caption = { 'pirates.gui_join_private_run_info' }
|
||||
end
|
||||
wrappedmemories[#wrappedmemories + 1] = {'pirates.run_displayform', mem.id, {'', mem.name .. extraCrewText .. ', ', CoreData.difficulty_options[mem.difficulty_option].text, ', [item=light-armor]' .. count .. CoreData.capacity_options[mem.capacity_option].text2 .. ', [item=rail] ' .. (mem.overworldx or 0)}}
|
||||
-- wrappedmemories[#wrappedmemories + 1] = {'pirates.run_displayform', mem.id, mem.name, Utils.spritepath_to_richtext(CoreData.difficulty_options[mem.difficulty_option].icon), count, CoreData.capacity_options[mem.capacity_option].text2, ' [item=rail] ', mem.overworldx or 0}
|
||||
end
|
||||
GuiCommon.update_listbox(flow.ongoing_runs.body.ongoing_runs_listbox, wrappedmemories)
|
||||
|
||||
local crewid = nil
|
||||
local bool1 = (not playercrew_status.leaving) and (not playercrew_status.adventuring) and (not playercrew_status.spectating) and (flow.ongoing_runs.body.ongoing_runs_listbox.selected_index ~= 0)
|
||||
if bool1 then
|
||||
crewid = tonumber((flow.ongoing_runs.body.ongoing_runs_listbox.get_item(flow.ongoing_runs.body.ongoing_runs_listbox.selected_index))[2])
|
||||
end
|
||||
|
||||
-- Update timer when captain protection expires
|
||||
if crewid and flow.ongoing_runs.body.join_protected_crew_info.visible then
|
||||
local lock_timer = global_memory.crew_memories[crewid].protected_run_lock_timer
|
||||
local sec = Math.floor((lock_timer / (60)) % 60)
|
||||
local min = Math.floor((lock_timer / (60 * 60)) % 60)
|
||||
local hrs = Math.floor((lock_timer / (60 * 60 * 60)) % 60)
|
||||
flow.ongoing_runs.body.join_protected_crew_info.caption = {'pirates.gui_join_protected_run_info', hrs, min, sec}
|
||||
end
|
||||
|
||||
-- Update timer when run will become public
|
||||
if crewid and flow.ongoing_runs.body.join_private_crew_info.visible then
|
||||
local lock_timer = global_memory.crew_memories[crewid].private_run_lock_timer
|
||||
local sec = Math.floor((lock_timer / (60)) % 60)
|
||||
local min = Math.floor((lock_timer / (60 * 60)) % 60)
|
||||
local hrs = Math.floor((lock_timer / (60 * 60 * 60)) % 60)
|
||||
flow.ongoing_runs.body.join_private_crew_info.caption = {'pirates.gui_join_private_run_info', hrs, min, sec}
|
||||
end
|
||||
end
|
||||
|
||||
if flow.proposals.visible then
|
||||
local proposals = flow.proposals
|
||||
proposals.visible = (memory.crewstatus == nil and not playercrew_status.leaving)
|
||||
|
||||
if proposals.visible then
|
||||
local wrappedproposals = {}
|
||||
for _, proposal in pairs(global_memory.crewproposals) do
|
||||
wrappedproposals[#wrappedproposals + 1] = {'pirates.proposal_displayform', proposal.name, Utils.spritepath_to_richtext(CoreData.capacity_options[proposal.capacity_option].icon)}
|
||||
-- wrappedproposals[#wrappedproposals + 1] = {'pirates.proposal_displayform', proposal.name, Utils.spritepath_to_richtext(CoreData.difficulty_options[proposal.difficulty_option].icon), Utils.spritepath_to_richtext(CoreData.capacity_options[proposal.capacity_option].icon)}
|
||||
local proposal_info = { '',
|
||||
proposal.name .. ' — ',
|
||||
'[item=rail]',
|
||||
0,
|
||||
proposal.run_is_private and { 'pirates.run_condition_private' } or '',
|
||||
proposal.run_is_protected and { 'pirates.run_condition_captain_protected' } or '',
|
||||
proposal.run_has_blueprints_disabled and { 'pirates.run_condition_blueprints_disabled' } or ''
|
||||
}
|
||||
table.insert(wrappedproposals, proposal_info)
|
||||
end
|
||||
GuiCommon.update_listbox(flow.proposals.body.proposals_listbox, wrappedproposals)
|
||||
end
|
||||
GuiCommon.update_listbox(proposals.body.proposals_listbox, wrappedproposals)
|
||||
|
||||
-- update proposal maker
|
||||
if flow.proposals.body.proposal_maker.visible then
|
||||
local capacity_slider_value = flow.proposals.body.proposal_maker.body.options.capacity.capacity.slider.slider_value
|
||||
for i, opt in pairs(CoreData.capacity_options) do
|
||||
if capacity_slider_value == i then
|
||||
flow.proposals.body.proposal_maker.body.options.capacity.capacity.readoff_text.caption = opt.text
|
||||
flow.proposals.body.proposal_maker.body.options.capacity_readoff_icon.sprite = opt.icon
|
||||
end
|
||||
proposals.body.proposals_listbox.visible = not playercrew_status.leaving and #global_memory.crewproposals > 0
|
||||
proposals.body.flow_buttons.abandon_proposal.visible = not playercrew_status.leaving and playercrew_status.created_crew and playercrew_status.proposing and #global_memory.crewproposals > 0
|
||||
proposals.body.proposal_maker.visible = not playercrew_status.leaving and not playercrew_status.created_crew
|
||||
proposals.body.flow_proposal_launch.proposal_insufficient_sloops.visible = playercrew_status.sloops_full
|
||||
proposals.body.flow_proposal_launch.proposal_crew_count_capped.visible = playercrew_status.crew_count_capped
|
||||
proposals.body.flow_proposal_launch.launch_crew.visible = playercrew_status.proposal_can_launch
|
||||
|
||||
if proposals.body.proposal_maker.visible then
|
||||
local capacity_slider = proposals.body.proposal_maker.body.capacity_options.capacity.capacity
|
||||
local capacity_option = CoreData.capacity_options[capacity_slider.slider.slider_value]
|
||||
capacity_slider.readoff_text.caption = capacity_option.text == '∞' and { 'pirates.gui_runs_proposal_maker_no_limit' } or capacity_option.text
|
||||
proposals.body.proposal_maker.body.capacity_options.capacity_readoff_icon.sprite = capacity_option.icon
|
||||
|
||||
local is_private = proposals.body.proposal_maker.body.settings.private_checkbox.state
|
||||
proposals.body.proposal_maker.body.settings.password_label.visible = is_private
|
||||
proposals.body.proposal_maker.body.settings.password.visible = is_private
|
||||
proposals.body.proposal_maker.body.settings.confirm_password_label.visible = is_private
|
||||
proposals.body.proposal_maker.body.settings.confirm_password.visible = is_private
|
||||
end
|
||||
if flow.proposals.body.proposal_maker.body.options.capacity.capacity.readoff_text.caption == '∞' then flow.proposals.body.proposal_maker.body.options.capacity.capacity.readoff_text.caption = {'pirates.gui_runs_proposal_maker_no_limit'} end
|
||||
|
||||
-- local difficulty_slider_value = flow.proposals.body.proposal_maker.body.options.difficulty.difficulty.slider.slider_value
|
||||
-- for i, opt in pairs(CoreData.difficulty_options) do
|
||||
-- if difficulty_slider_value == i then
|
||||
-- flow.proposals.body.proposal_maker.body.options.difficulty.difficulty.readoff_text.caption = opt.text
|
||||
-- flow.proposals.body.proposal_maker.body.options.difficulty_readoff_icon.sprite = opt.icon
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local mode_switch_state = flow.proposals.body.proposal_maker.body.options.mode.mode.switch.switch_state
|
||||
-- for i, opt in pairs(CoreData.mode_options) do
|
||||
-- if mode_switch_state == i then
|
||||
-- flow.proposals.body.proposal_maker.body.options.mode.mode.readoff_text.caption = opt.text
|
||||
-- flow.proposals.body.proposal_maker.body.options.mode_readoff_icon.sprite = opt.icon
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.click(event)
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
@ -689,24 +623,24 @@ function Public.click(event)
|
||||
|
||||
-- If run is private
|
||||
if memory.run_is_private then
|
||||
if memory.private_run_password == flow.ongoing_runs.body.password_namefield.text then
|
||||
if memory.private_run_password == flow.ongoing_runs.body.password.text then
|
||||
Crew.join_crew(player)
|
||||
flow.ongoing_runs.body.join_private_crew_info.visible = false
|
||||
flow.ongoing_runs.body.password_namefield.visible = false
|
||||
flow.ongoing_runs.body.password.visible = false
|
||||
|
||||
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'})
|
||||
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'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_join_private_run_error_wrong_password' })
|
||||
end
|
||||
else
|
||||
Crew.join_crew(player)
|
||||
|
||||
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'})
|
||||
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
|
||||
|
||||
@ -716,7 +650,7 @@ function Public.click(event)
|
||||
|
||||
if eventname == 'propose_crew' then
|
||||
if #global_memory.crew_active_ids >= global_memory.active_crews_cap_in_memory then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_launch_error_5'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_launch_error_5' })
|
||||
return
|
||||
end
|
||||
|
||||
@ -736,45 +670,46 @@ function Public.click(event)
|
||||
end
|
||||
end
|
||||
|
||||
local run_is_protected = flow.proposals.body.proposal_maker.body.protected_checkbox.state
|
||||
local run_is_private = flow.proposals.body.proposal_maker.body.private_checkbox.state
|
||||
local run_has_blueprints_disabled = flow.proposals.body.proposal_maker.body.settings.blueprints_disabled_checkbox.state
|
||||
local run_is_protected = flow.proposals.body.proposal_maker.body.settings.protected_checkbox.state
|
||||
local run_is_private = flow.proposals.body.proposal_maker.body.settings.private_checkbox.state
|
||||
if run_is_private then
|
||||
-- Make sure private run can be created
|
||||
if private_run_count >= global_memory.private_run_cap then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_private_run_limit'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_private_run_limit' })
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the player created any other private runs
|
||||
for _, id in pairs(global_memory.crew_active_ids) do
|
||||
if global_memory.crew_memories[id].run_is_private then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_two_private_runs'})
|
||||
if global_memory.crew_memories[id].run_is_private and global_memory.crew_memories[id].created_by_player == player.index then
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_two_private_runs' })
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if passwords match
|
||||
if flow.proposals.body.proposal_maker.body.password_namefield.text ~= flow.proposals.body.proposal_maker.body.confirm_password_namefield.text then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_private_run_password_no_match'})
|
||||
if flow.proposals.body.proposal_maker.body.settings.password.text ~= flow.proposals.body.proposal_maker.body.settings.confirm_password.text then
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_private_run_password_no_match' })
|
||||
return
|
||||
end
|
||||
|
||||
-- Check if passwords aren't empty
|
||||
if flow.proposals.body.proposal_maker.body.password_namefield.text == '' then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_private_run_password_empty'})
|
||||
if flow.proposals.body.proposal_maker.body.settings.password.text == '' then
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_private_run_password_empty' })
|
||||
return
|
||||
end
|
||||
elseif run_is_protected then
|
||||
-- Make sure protected run can be created
|
||||
if protected_but_not_private_run_count >= global_memory.protected_but_not_private_run_cap then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_protected_run_limit'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_protected_run_limit' })
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the player created any other protected runs
|
||||
for _, id in pairs(global_memory.crew_active_ids) do
|
||||
if global_memory.crew_memories[id].run_is_protected then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_two_protected_runs'})
|
||||
if global_memory.crew_memories[id].run_is_protected and global_memory.crew_memories[id].created_by_player == player.index then
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_two_protected_runs' })
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -788,18 +723,15 @@ function Public.click(event)
|
||||
end
|
||||
end
|
||||
if player_run_count >= 2 then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_three_runs'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_three_runs' })
|
||||
return
|
||||
end
|
||||
|
||||
local private_run_password = flow.proposals.body.proposal_maker.body.password_namefield.text
|
||||
local private_run_password = flow.proposals.body.proposal_maker.body.settings.password.text
|
||||
local proposal_name = flow.proposals.body.proposal_maker.body.namefield.text
|
||||
-- local proposal_name = string.sub(flow.proposals.body.proposal_maker.body.namefield.text, 1, 30)
|
||||
|
||||
local capacity_option = flow.proposals.body.proposal_maker.body.options.capacity.capacity.slider.slider_value
|
||||
local capacity_option = flow.proposals.body.proposal_maker.body.capacity_options.capacity.capacity.slider.slider_value
|
||||
local difficulty_option = 1
|
||||
-- local difficulty_option = flow.proposals.body.proposal_maker.body.options.difficulty.difficulty.slider.slider_value
|
||||
-- local mode_option = flow.proposals.body.proposal_maker.body.options.mode.mode.switch.switch_state
|
||||
|
||||
if (not proposal_name) or (proposal_name == '') then proposal_name = 'NoName' end
|
||||
|
||||
@ -842,15 +774,16 @@ function Public.click(event)
|
||||
created_by_player = player.index,
|
||||
run_is_protected = run_is_protected,
|
||||
run_is_private = run_is_private,
|
||||
run_has_blueprints_disabled = run_has_blueprints_disabled,
|
||||
private_run_password = private_run_password,
|
||||
}
|
||||
|
||||
global_memory.crewproposals[#global_memory.crewproposals + 1] = proposal
|
||||
|
||||
if run_is_private then
|
||||
Common.notify_lobby({'pirates.proposal_propose_private', player.name, proposal_name, CoreData.capacity_options[capacity_option].text3})
|
||||
Common.notify_lobby({ 'pirates.proposal_propose_private', player.name, proposal_name, CoreData.capacity_options[capacity_option].text3 })
|
||||
else
|
||||
Common.notify_lobby({'pirates.proposal_propose', player.name, proposal_name, CoreData.capacity_options[capacity_option].text3})
|
||||
Common.notify_lobby({ 'pirates.proposal_propose', player.name, proposal_name, CoreData.capacity_options[capacity_option].text3 })
|
||||
end
|
||||
|
||||
-- local message = player.name .. ' proposed the run ' .. proposal_name .. ' (difficulty ' .. CoreData.difficulty_options[difficulty_option].text .. ', capacity ' .. CoreData.capacity_options[capacity_option].text3 .. ').'
|
||||
@ -877,7 +810,7 @@ function Public.click(event)
|
||||
end
|
||||
|
||||
if private_run_count >= global_memory.private_run_cap then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_private_run_limit'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_private_run_limit' })
|
||||
return
|
||||
end
|
||||
elseif proposal.run_is_protected then
|
||||
@ -889,12 +822,12 @@ function Public.click(event)
|
||||
end
|
||||
|
||||
if protected_but_not_private_run_count >= global_memory.protected_but_not_private_run_cap then
|
||||
Common.notify_player_error(player, {'pirates.gui_runs_proposal_maker_error_protected_run_limit'})
|
||||
Common.notify_player_error(player, { 'pirates.gui_runs_proposal_maker_error_protected_run_limit' })
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Crew.initialise_crew(proposal)
|
||||
Crew.initialise_crew(proposal, player.position)
|
||||
global_memory.crewproposals[k] = nil
|
||||
Progression.set_off_from_starting_dock()
|
||||
|
||||
@ -905,4 +838,4 @@ function Public.click(event)
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -24,7 +24,6 @@ The scenario is quite complex, but there are ways to get started, even if you do
|
||||
-- require 'modules.biters_yield_coins'
|
||||
require 'modules.biter_noms_you'
|
||||
require 'modules.no_deconstruction_of_neutral_entities'
|
||||
require 'maps.pirates.custom_events' --probably do this before anything else
|
||||
require 'utils.server'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
-- local Modifers = require 'player_modifiers'
|
||||
@ -57,7 +56,7 @@ require 'maps.pirates.ores'
|
||||
require 'maps.pirates.quest'
|
||||
require 'maps.pirates.parrot'
|
||||
require 'maps.pirates.shop.shop'
|
||||
require 'maps.pirates.boat_upgrades'
|
||||
require 'maps.pirates.shop.boat_upgrades'
|
||||
local Token = require 'utils.token'
|
||||
local Task = require 'utils.task'
|
||||
local Server = require 'utils.server'
|
||||
@ -112,8 +111,6 @@ local function on_init()
|
||||
global_memory.protected_but_not_private_run_cap = Common.protected_but_not_private_run_cap
|
||||
global_memory.private_run_cap = Common.private_run_cap
|
||||
|
||||
global_memory.minimumCapacitySliderValue = Common.minimumCapacitySliderValue
|
||||
|
||||
Surfaces.Lobby.create_starting_dock_surface()
|
||||
local lobby = game.surfaces[CoreData.lobby_surface_name]
|
||||
game.forces.player.set_spawn_position(Common.lobby_spawnpoint, lobby)
|
||||
@ -243,8 +240,6 @@ local function crew_tick()
|
||||
|
||||
if tick % 3600 == 0 then
|
||||
PiratesApiOnTick.prune_offline_characters_list(3600)
|
||||
PiratesApiOnTick.update_protected_run_lock_timer(3600)
|
||||
PiratesApiOnTick.update_private_run_lock_timer(3600)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ local _inspect = require 'utils.inspect'.inspect
|
||||
local Common = require 'maps.pirates.common'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
local simplex_noise = require 'utils.simplex_noise'.d2
|
||||
-- local CustomEvents = require 'maps.pirates.custom_events'
|
||||
--
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -151,8 +151,6 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus, from_t
|
||||
end
|
||||
end
|
||||
|
||||
-- script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
@ -25,11 +25,11 @@ local Crew = require 'maps.pirates.crew'
|
||||
-- local Parrot = require 'maps.pirates.parrot'
|
||||
-- local Hold = require 'maps.pirates.surfaces.hold'
|
||||
-- local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
local Shop = require 'maps.pirates.shop.shop'
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
-- local Shop = require 'maps.pirates.shop.shop'
|
||||
local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local Kraken = require 'maps.pirates.surfaces.sea.kraken'
|
||||
local Highscore = require 'maps.pirates.highscore'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ local destinationScheme = {
|
||||
[15] = { DOCK, B, B },
|
||||
[16] = { RADIOACTIVE, RADIOACTIVE, RADIOACTIVE },
|
||||
[17] = { B, B, B },
|
||||
[18] = { C, C, C }, --first showing of robot frame cost
|
||||
[18] = { C, C, C }, --first showing of robot frame cost
|
||||
[19] = { DOCK, B, B },
|
||||
[20] = { WALKWAYS, WALKWAYS, WALKWAYS }, --rocket launch cost begins
|
||||
[21] = { SWAMP, RED_DESERT, STANDARD2 }, -- uniquely, this has a rocket launch cost, but still has an auto-undock timer
|
||||
@ -424,12 +424,13 @@ function Public.generate_overworld_destination(p)
|
||||
}
|
||||
|
||||
local i = 1
|
||||
for price_name, price_count in pairs(Shop.Captains.main_shop_data_1[dest.static_params.upgrade_for_sale].base_cost) do
|
||||
for _, price_data in ipairs(Upgrades.upgrades_data[dest.static_params.upgrade_for_sale].market_item.price) do
|
||||
local price_name, price_count = price_data[1], price_data[2]
|
||||
local sprite
|
||||
if price_name == 'fuel' then
|
||||
if price_name == 'coal' then
|
||||
sprite = 'item/coal'
|
||||
else
|
||||
sprite = 'item/coin'
|
||||
sprite = 'item/' .. price_name
|
||||
end
|
||||
dest.dynamic_data.crowsnest_renderings[price_name] = {
|
||||
text_rendering = rendering.draw_text {
|
||||
@ -516,7 +517,12 @@ function Public.ensure_lane_generated_up_to(lane_yvalue, x)
|
||||
end
|
||||
for rendering_name, r in pairs(dest.dynamic_data.crowsnest_renderings) do
|
||||
if type(r) == 'table' and r.text_rendering and rendering.is_valid(r.text_rendering) then
|
||||
rendering.set_text(r.text_rendering, Utils.bignumber_abbrevform2(Shop.Captains.main_shop_data_1[dest.static_params.upgrade_for_sale].base_cost[rendering_name]))
|
||||
for _, price_data in ipairs(Upgrades.upgrades_data[dest.static_params.upgrade_for_sale].market_item.price) do
|
||||
if price_data[1] == rendering_name then
|
||||
rendering.set_text(r.text_rendering, Utils.bignumber_abbrevform2(price_data[2]))
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -585,8 +591,6 @@ function Public.check_for_destination_collisions()
|
||||
memory.currentdestination_index = index
|
||||
memory.boat.state = Boats.enum_state.ATSEA_LOADING_MAP
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
|
||||
local destination = Common.current_destination()
|
||||
Surfaces.destination_on_collide(destination)
|
||||
|
||||
|
228
maps/pirates/permissions.lua
Normal file
228
maps/pirates/permissions.lua
Normal file
@ -0,0 +1,228 @@
|
||||
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
|
||||
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
local Antigrief = require 'utils.antigrief'
|
||||
-- local Balance = require 'maps.pirates.balance'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
|
||||
local Public = {}
|
||||
|
||||
local privilege_levels = {
|
||||
NORMAL = 1,
|
||||
OFFICER = 2,
|
||||
CAPTAIN = 3
|
||||
}
|
||||
Public.privilege_levels = privilege_levels
|
||||
|
||||
function Public.player_privilege_level(player)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
if Common.is_id_valid(memory.id) and Common.is_captain(player) then
|
||||
return Public.privilege_levels.CAPTAIN
|
||||
elseif Common.is_officer(player.index) then
|
||||
return Public.privilege_levels.OFFICER
|
||||
else
|
||||
return Public.privilege_levels.NORMAL
|
||||
end
|
||||
end
|
||||
|
||||
local function set_normal_permissions(group)
|
||||
if not _DEBUG then
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
end
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
end
|
||||
|
||||
local function set_restricted_permissions(group)
|
||||
set_normal_permissions(group)
|
||||
|
||||
group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
group.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.drop_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.build, false)
|
||||
group.set_allows_action(defines.input_action.build_rail, false)
|
||||
group.set_allows_action(defines.input_action.build_terrain, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining_terrain, false)
|
||||
group.set_allows_action(defines.input_action.activate_copy, false)
|
||||
group.set_allows_action(defines.input_action.activate_cut, false)
|
||||
group.set_allows_action(defines.input_action.activate_paste, false)
|
||||
group.set_allows_action(defines.input_action.upgrade, false)
|
||||
group.set_allows_action(defines.input_action.deconstruct, false)
|
||||
group.set_allows_action(defines.input_action.open_gui, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_transfer, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_split, false)
|
||||
end
|
||||
|
||||
function Public.try_create_permissions_groups()
|
||||
if not game.permissions.get_group('lobby') then
|
||||
local group = game.permissions.create_group('lobby')
|
||||
set_restricted_permissions(group)
|
||||
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('crowsnest') then
|
||||
local group = game.permissions.create_group('crowsnest')
|
||||
set_restricted_permissions(group)
|
||||
group.set_allows_action(defines.input_action.deconstruct, true) --pick up dead players
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('crowsnest_privileged') then
|
||||
local group = game.permissions.create_group('crowsnest_privileged')
|
||||
set_restricted_permissions(group)
|
||||
group.set_allows_action(defines.input_action.deconstruct, true) --pick up dead players
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, true)
|
||||
group.set_allows_action(defines.input_action.fast_entity_transfer, true)
|
||||
group.set_allows_action(defines.input_action.fast_entity_split, true)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('cabin') then
|
||||
local group = game.permissions.create_group('cabin')
|
||||
group.set_allows_action(defines.input_action.deconstruct, true) --pick up dead players
|
||||
set_restricted_permissions(group)
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, true) -- We want you to open the market, but there is other code to prevent you from opening certain chests
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('cabin_privileged') then
|
||||
local group = game.permissions.create_group('cabin_privileged')
|
||||
group.set_allows_action(defines.input_action.deconstruct, true) --pick up dead players
|
||||
set_restricted_permissions(group)
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, true) -- We want you to open the market, but there is other code to prevent you from opening certain chests
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('plebs') then
|
||||
local group = game.permissions.create_group('plebs')
|
||||
set_normal_permissions(group)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('not_trusted') then
|
||||
local group = game.permissions.create_group('not_trusted')
|
||||
set_normal_permissions(group)
|
||||
|
||||
-- not_trusted.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
-- not_trusted.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
group.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
group.set_allows_action(defines.input_action.open_train_gui, false)
|
||||
group.set_allows_action(defines.input_action.open_train_station_gui, false)
|
||||
group.set_allows_action(defines.input_action.open_trains_gui, false)
|
||||
group.set_allows_action(defines.input_action.change_train_stop_station, false)
|
||||
group.set_allows_action(defines.input_action.change_train_wait_condition, false)
|
||||
group.set_allows_action(defines.input_action.change_train_wait_condition_data, false)
|
||||
group.set_allows_action(defines.input_action.drag_train_schedule, false)
|
||||
group.set_allows_action(defines.input_action.drag_train_wait_condition, false)
|
||||
group.set_allows_action(defines.input_action.go_to_train_station, false)
|
||||
group.set_allows_action(defines.input_action.remove_train_station, false)
|
||||
group.set_allows_action(defines.input_action.set_trains_limit, false)
|
||||
group.set_allows_action(defines.input_action.set_train_stopped, false)
|
||||
end
|
||||
|
||||
local blueprint_disabled_groups = {
|
||||
'crowsnest_bps_disabled',
|
||||
'crowsnest_privileged_bps_disabled',
|
||||
'cabin_bps_disabled',
|
||||
'cabin_privileged_bps_disabled',
|
||||
'plebs_bps_disabled',
|
||||
'not_trusted_bps_disabled'
|
||||
}
|
||||
|
||||
for _, group_name in ipairs(blueprint_disabled_groups) do
|
||||
if not game.permissions.get_group(group_name) then
|
||||
local group = game.permissions.create_group(group_name)
|
||||
local base_group_name = group_name:gsub('_bps_disabled', '')
|
||||
local base_group = game.permissions.get_group(base_group_name)
|
||||
|
||||
for _, action in pairs(defines.input_action) do
|
||||
group.set_allows_action(action, base_group.allows_action(action))
|
||||
end
|
||||
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function add_player_to_permission_group(player, group_override)
|
||||
Public.try_create_permissions_groups()
|
||||
|
||||
-- local jailed = Jailed.get_jailed_table()
|
||||
-- local enable_permission_group_disconnect = WPT.get('disconnect_wagon')
|
||||
|
||||
local gulag = game.permissions.get_group('gulag')
|
||||
local tbl = gulag and gulag.players
|
||||
for i = 1, #tbl do
|
||||
if tbl[i].index == player.index then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- if player.admin then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- if jailed[player.name] then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
local group = game.permissions.get_group(group_override)
|
||||
|
||||
group.add_player(player)
|
||||
end
|
||||
|
||||
function Public.update_privileges(player)
|
||||
Public.try_create_permissions_groups()
|
||||
|
||||
if not Common.validate_player_and_character(player) then
|
||||
return
|
||||
end
|
||||
|
||||
local memory = Memory.get_crew_memory()
|
||||
local bps_disabled_suffix = memory.run_has_blueprints_disabled and '_bps_disabled' or ''
|
||||
|
||||
if string.sub(player.surface.name, 9, 17) == 'Crowsnest' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return add_player_to_permission_group(player, 'crowsnest_privileged' .. bps_disabled_suffix)
|
||||
else
|
||||
return add_player_to_permission_group(player, 'crowsnest' .. bps_disabled_suffix)
|
||||
end
|
||||
elseif string.sub(player.surface.name, 9, 13) == 'Cabin' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return add_player_to_permission_group(player, 'cabin_privileged' .. bps_disabled_suffix)
|
||||
else
|
||||
return add_player_to_permission_group(player, 'cabin' .. bps_disabled_suffix)
|
||||
end
|
||||
elseif player.surface.name == CoreData.lobby_surface_name then
|
||||
return add_player_to_permission_group(player, 'lobby')
|
||||
else
|
||||
local session = Session.get_session_table()
|
||||
local AG = Antigrief.get()
|
||||
|
||||
local playtime = player.online_time
|
||||
if session and session[player.name] then
|
||||
playtime = player.online_time + session[player.name]
|
||||
end
|
||||
|
||||
if AG and AG.enabled and not player.admin and playtime < 5184000 then -- 24 hours
|
||||
add_player_to_permission_group(player, 'not_trusted' .. bps_disabled_suffix)
|
||||
else
|
||||
add_player_to_permission_group(player, 'plebs' .. bps_disabled_suffix)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
@ -10,7 +10,7 @@ local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
|
||||
-- local Structures = require 'maps.pirates.structures.structures'
|
||||
local Boats = require 'maps.pirates.structures.boats.boats'
|
||||
@ -25,11 +25,11 @@ local Roles = require 'maps.pirates.roles.roles'
|
||||
-- local Parrot = require 'maps.pirates.parrot'
|
||||
-- local Quest = require 'maps.pirates.quest'
|
||||
|
||||
local Shop = require 'maps.pirates.shop.shop'
|
||||
-- local Shop = require 'maps.pirates.shop.shop'
|
||||
local Overworld = require 'maps.pirates.overworld'
|
||||
local Hold = require 'maps.pirates.surfaces.hold'
|
||||
local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
-- local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local ShopDock = require 'maps.pirates.shop.dock'
|
||||
@ -133,8 +133,6 @@ function Public.go_from_starting_dock_to_first_destination()
|
||||
|
||||
boat.stored_resources = {}
|
||||
|
||||
Shop.Captains.initialise_captains_shop()
|
||||
|
||||
Hold.create_hold_surface(1)
|
||||
boat.EEI_stage = 1
|
||||
boat.random_class_purchase_count = 0
|
||||
@ -233,36 +231,6 @@ function Public.progress_to_destination(destination_index)
|
||||
-- starting_boatposition = {x = -destination_data.static_params.width/2 + BoatData.width + 10, y = Dock.Data.player_boat_top - BoatData.height/2}
|
||||
Common.current_destination().dynamic_data.time_remaining = 180
|
||||
|
||||
-- memory.mainshop_availability_bools.sell_iron = true
|
||||
memory.mainshop_availability_bools.buy_iron = true
|
||||
memory.mainshop_availability_bools.buy_copper = true
|
||||
-- memory.mainshop_availability_bools.buy_fast_loader = true
|
||||
-- memory.mainshop_availability_bools.sell_copper = true
|
||||
|
||||
memory.mainshop_availability_bools.upgrade_cannons = true
|
||||
|
||||
local boat_for_sale_type = Common.current_destination().static_params.boat_for_sale_type
|
||||
if boat_for_sale_type then
|
||||
if boat_for_sale_type == Boats.enum.CUTTER then
|
||||
memory.mainshop_availability_bools.new_boat_cutter = true
|
||||
elseif boat_for_sale_type == Boats.enum.CUTTER_WITH_HOLD then
|
||||
memory.mainshop_availability_bools.new_boat_cutter_with_hold = true
|
||||
elseif boat_for_sale_type == Boats.enum.SLOOP_WITH_HOLD then
|
||||
memory.mainshop_availability_bools.new_boat_sloop_with_hold = true
|
||||
end
|
||||
end
|
||||
|
||||
local upgrade_for_sale = Common.current_destination().static_params.upgrade_for_sale
|
||||
if upgrade_for_sale then
|
||||
for _, u in pairs(Upgrades.List) do
|
||||
if upgrade_for_sale == u then
|
||||
memory.mainshop_availability_bools[u] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
|
||||
-- Delay.add(Delay.enum.PLACE_DOCK_JETTY_AND_BOATS)
|
||||
Task.set_timeout_in_ticks(2, place_dock_jetty_and_boats, { crew_id = memory.id })
|
||||
else
|
||||
@ -309,8 +277,6 @@ function Public.progress_to_destination(destination_index)
|
||||
memory.currentdestination_index = destination_index --already done when we collide with it typically
|
||||
local destination = Common.current_destination()
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
|
||||
destination.dynamic_data.timer = 0
|
||||
destination.dynamic_data.timeratlandingtime = nil
|
||||
destination.dynamic_data.enemyboats = {}
|
||||
@ -398,23 +364,6 @@ function Public.check_for_end_of_boat_movement(boat)
|
||||
Boats.place_boat(boat, CoreData.static_boat_floor, false, false)
|
||||
return true
|
||||
elseif leaving_dock and boat.position.x >= game.surfaces[boat.surface_name].map_gen_settings.width / 2 - 60 then
|
||||
memory.mainshop_availability_bools.new_boat_cutter = false
|
||||
memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
|
||||
memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
|
||||
-- memory.mainshop_availability_bools.sell_iron = false
|
||||
memory.mainshop_availability_bools.buy_iron = false
|
||||
memory.mainshop_availability_bools.buy_copper = false
|
||||
-- memory.mainshop_availability_bools.buy_fast_loader = false
|
||||
-- memory.mainshop_availability_bools.sell_copper = false
|
||||
memory.mainshop_availability_bools.upgrade_cannons = false
|
||||
|
||||
memory.mainshop_availability_bools.extra_hold = false
|
||||
memory.mainshop_availability_bools.upgrade_power = false
|
||||
memory.mainshop_availability_bools.unlock_merchants = false
|
||||
memory.mainshop_availability_bools.rockets_for_sale = false
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
|
||||
Public.go_from_currentdestination_to_sea()
|
||||
|
||||
return true
|
||||
@ -488,12 +437,6 @@ function Public.undock_from_dock(manual)
|
||||
|
||||
Boats.place_boat(boat, CoreData.moving_boat_floor, false, false)
|
||||
|
||||
memory.mainshop_availability_bools.new_boat_cutter = false
|
||||
memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
|
||||
memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
|
||||
Crew.summon_crew()
|
||||
|
||||
local force = memory.force
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
|
||||
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
local Antigrief = require 'utils.antigrief'
|
||||
-- local Session = require 'utils.datastore.session_data'
|
||||
-- local Antigrief = require 'utils.antigrief'
|
||||
-- local Balance = require 'maps.pirates.balance'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
@ -11,14 +11,9 @@ local Utils = require 'maps.pirates.utils_local'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Server = require 'utils.server'
|
||||
local Classes = require 'maps.pirates.roles.classes'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
|
||||
local Public = {}
|
||||
local privilege_levels = {
|
||||
NORMAL = 1,
|
||||
OFFICER = 2,
|
||||
CAPTAIN = 3
|
||||
}
|
||||
Public.privilege_levels = privilege_levels
|
||||
|
||||
|
||||
--== Roles — General ==--
|
||||
@ -38,7 +33,7 @@ function Public.make_officer(captain, player)
|
||||
memory.officers_table[player.index] = true
|
||||
|
||||
Common.notify_force_light(force, { 'pirates.roles_make_officer', captain.name, player.name })
|
||||
Public.update_privileges(player)
|
||||
Permissions.update_privileges(player)
|
||||
else
|
||||
Common.notify_player_error(captain, { 'pirates.roles_make_officer_error_1' })
|
||||
return false
|
||||
@ -62,7 +57,7 @@ function Public.unmake_officer(captain, player)
|
||||
memory.officers_table[player.index] = nil
|
||||
|
||||
Common.notify_force_light(force, { 'pirates.roles_unmake_officer', captain.name, player.name })
|
||||
Public.update_privileges(player)
|
||||
Permissions.update_privileges(player)
|
||||
return true
|
||||
else
|
||||
Common.notify_player_error(captain, { 'pirates.roles_unmake_officer_error_1' })
|
||||
@ -154,18 +149,6 @@ function Public.get_class_print_string(class, add_is_class_obstainable)
|
||||
return nil
|
||||
end
|
||||
|
||||
function Public.player_privilege_level(player)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
if Common.is_id_valid(memory.id) and Common.is_captain(player) then
|
||||
return Public.privilege_levels.CAPTAIN
|
||||
elseif Common.is_officer(player.index) then
|
||||
return Public.privilege_levels.OFFICER
|
||||
else
|
||||
return Public.privilege_levels.NORMAL
|
||||
end
|
||||
end
|
||||
|
||||
function Public.make_captain(player)
|
||||
local global_memory = Memory.get_global_memory()
|
||||
local memory = Memory.get_crew_memory()
|
||||
@ -177,7 +160,7 @@ function Public.make_captain(player)
|
||||
end
|
||||
|
||||
if memory.playerindex_captain then
|
||||
Public.update_privileges(game.players[memory.playerindex_captain])
|
||||
Permissions.update_privileges(game.players[memory.playerindex_captain])
|
||||
end
|
||||
|
||||
memory.playerindex_captain = player.index
|
||||
@ -192,7 +175,7 @@ function Public.make_captain(player)
|
||||
-- don't use "unmake_officer" as it prints additional messages
|
||||
memory.officers_table[player.index] = nil
|
||||
|
||||
Public.update_privileges(player)
|
||||
Permissions.update_privileges(player)
|
||||
|
||||
local force = player.force
|
||||
if force and force.valid then
|
||||
@ -237,7 +220,7 @@ function Public.player_left_so_redestribute_roles(player)
|
||||
local officers = Common.crew_get_non_afk_officers()
|
||||
if memory.run_is_protected and #officers == 0 then
|
||||
if memory.crewplayerindices and #memory.crewplayerindices > 0 then
|
||||
Common.parrot_speak(memory.force, { 'pirates.parrot_captain_left_protected_run', Common.protected_run_lock_amount_hr })
|
||||
Common.parrot_speak(memory.force, { 'pirates.parrot_captain_left_protected_run' })
|
||||
Common.parrot_speak(memory.force, { 'pirates.parrot_create_new_crew_tip' })
|
||||
end
|
||||
elseif memory.run_is_protected then
|
||||
@ -562,200 +545,4 @@ function Public.captain_tax(captain_index)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.try_create_permissions_groups()
|
||||
if not game.permissions.get_group('restricted_area') then
|
||||
local group = game.permissions.create_group('restricted_area')
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
group.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.drop_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.build, false)
|
||||
group.set_allows_action(defines.input_action.build_rail, false)
|
||||
group.set_allows_action(defines.input_action.build_terrain, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining_terrain, false)
|
||||
-- group.set_allows_action(defines.input_action.deconstruct, false) --pick up dead players
|
||||
group.set_allows_action(defines.input_action.activate_copy, false)
|
||||
group.set_allows_action(defines.input_action.activate_cut, false)
|
||||
group.set_allows_action(defines.input_action.activate_paste, false)
|
||||
group.set_allows_action(defines.input_action.upgrade, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
if not CoreData.blueprint_library_allowed then
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
end
|
||||
if not CoreData.blueprint_importing_allowed then
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
|
||||
group.set_allows_action(defines.input_action.fast_entity_transfer, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_split, false)
|
||||
|
||||
-- Note there is other code to prevent these players from opening chests
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('restricted_area_privileged') then
|
||||
local group = game.permissions.create_group('restricted_area_privileged')
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
group.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.drop_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.build, false)
|
||||
group.set_allows_action(defines.input_action.build_rail, false)
|
||||
group.set_allows_action(defines.input_action.build_terrain, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining_terrain, false)
|
||||
-- group.set_allows_action(defines.input_action.deconstruct, false) --pick up dead players
|
||||
group.set_allows_action(defines.input_action.activate_copy, false)
|
||||
group.set_allows_action(defines.input_action.activate_cut, false)
|
||||
group.set_allows_action(defines.input_action.activate_paste, false)
|
||||
group.set_allows_action(defines.input_action.upgrade, false)
|
||||
|
||||
if not CoreData.blueprint_library_allowed then
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
end
|
||||
if not CoreData.blueprint_importing_allowed then
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('plebs') then
|
||||
local group = game.permissions.create_group('plebs')
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
|
||||
if not CoreData.blueprint_library_allowed then
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
end
|
||||
if not CoreData.blueprint_importing_allowed then
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('not_trusted') then
|
||||
local group = game.permissions.create_group('not_trusted')
|
||||
-- not_trusted.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
-- not_trusted.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
group.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
group.set_allows_action(defines.input_action.open_train_gui, false)
|
||||
group.set_allows_action(defines.input_action.open_train_station_gui, false)
|
||||
group.set_allows_action(defines.input_action.open_trains_gui, false)
|
||||
group.set_allows_action(defines.input_action.change_train_stop_station, false)
|
||||
group.set_allows_action(defines.input_action.change_train_wait_condition, false)
|
||||
group.set_allows_action(defines.input_action.change_train_wait_condition_data, false)
|
||||
group.set_allows_action(defines.input_action.drag_train_schedule, false)
|
||||
group.set_allows_action(defines.input_action.drag_train_wait_condition, false)
|
||||
group.set_allows_action(defines.input_action.go_to_train_station, false)
|
||||
group.set_allows_action(defines.input_action.remove_train_station, false)
|
||||
group.set_allows_action(defines.input_action.set_trains_limit, false)
|
||||
group.set_allows_action(defines.input_action.set_train_stopped, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
if not CoreData.blueprint_library_allowed then
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
end
|
||||
if not CoreData.blueprint_importing_allowed then
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.add_player_to_permission_group(player, group_override)
|
||||
-- local jailed = Jailed.get_jailed_table()
|
||||
-- local enable_permission_group_disconnect = WPT.get('disconnect_wagon')
|
||||
local session = Session.get_session_table()
|
||||
local AG = Antigrief.get()
|
||||
|
||||
local gulag = game.permissions.get_group('gulag')
|
||||
local tbl = gulag and gulag.players
|
||||
for i = 1, #tbl do
|
||||
if tbl[i].index == player.index then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- if player.admin then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
local playtime = player.online_time
|
||||
if session and session[player.name] then
|
||||
playtime = player.online_time + session[player.name]
|
||||
end
|
||||
|
||||
-- if jailed[player.name] then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
Public.try_create_permissions_groups()
|
||||
|
||||
local group
|
||||
if group_override then
|
||||
group = game.permissions.get_group(group_override)
|
||||
else
|
||||
if AG.enabled and not player.admin and playtime < 5184000 then -- 24 hours
|
||||
group = game.permissions.get_group('not_trusted')
|
||||
else
|
||||
group = game.permissions.get_group('plebs')
|
||||
end
|
||||
end
|
||||
|
||||
-- if _DEBUG then return end
|
||||
|
||||
group.add_player(player)
|
||||
end
|
||||
|
||||
function Public.update_privileges(player)
|
||||
Public.try_create_permissions_groups()
|
||||
|
||||
if not Common.validate_player_and_character(player) then
|
||||
return
|
||||
end
|
||||
|
||||
if string.sub(player.surface.name, 9, 17) == 'Crowsnest' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area_privileged')
|
||||
else
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area')
|
||||
end
|
||||
elseif string.sub(player.surface.name, 9, 13) == 'Cabin' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area_privileged')
|
||||
else
|
||||
-- return Public.add_player_to_permission_group(player, 'restricted_area')
|
||||
-- Moved to restricted_area to prevent them messing with items in the blue chests.ssd
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area')
|
||||
end
|
||||
elseif player.surface.name == CoreData.lobby_surface_name then
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area')
|
||||
else
|
||||
return Public.add_player_to_permission_group(player)
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -49,13 +49,78 @@ Public.crowsnest_display_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
|
||||
Public.market_offer_form = {
|
||||
[enum.MORE_POWER] = { price = { { 'coin', 7000 }, { 'coal', 500 } }, offer = { type = 'nothing', effect_description = { 'pirates.market_description_upgrade_power' } } },
|
||||
[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_turrets' } } },
|
||||
Public.upgrades_data = {
|
||||
[enum.MORE_POWER] = {
|
||||
market_item = {
|
||||
price = {
|
||||
{ 'coin', 7000 },
|
||||
{ 'coal', 500 }
|
||||
},
|
||||
offer = {
|
||||
type = 'nothing',
|
||||
effect_description = { 'pirates.market_description_upgrade_power' }
|
||||
},
|
||||
},
|
||||
tooltip = { 'pirates.market_description_upgrade_power' },
|
||||
what_you_get_sprite_buttons = { ['utility/status_working'] = false },
|
||||
},
|
||||
[enum.EXTRA_HOLD] = {
|
||||
market_item = {
|
||||
price = {
|
||||
{ 'coin', 7000 },
|
||||
{ 'coal', 500 }
|
||||
},
|
||||
offer = {
|
||||
type = 'nothing',
|
||||
effect_description = { 'pirates.market_description_upgrade_hold' }
|
||||
},
|
||||
},
|
||||
tooltip = { 'pirates.market_description_upgrade_hold' },
|
||||
what_you_get_sprite_buttons = { ['item/steel-chest'] = false },
|
||||
},
|
||||
[enum.UNLOCK_MERCHANTS] = {
|
||||
market_item = {
|
||||
price = {
|
||||
{ 'coin', 14000 },
|
||||
{ 'coal', 1000 }
|
||||
},
|
||||
offer = {
|
||||
type = 'nothing',
|
||||
effect_description = { 'pirates.market_description_upgrade_merchants' }
|
||||
},
|
||||
},
|
||||
tooltip = { 'pirates.market_description_upgrade_merchants' },
|
||||
what_you_get_sprite_buttons = { ['entity/market'] = false },
|
||||
},
|
||||
[enum.ROCKETS_FOR_SALE] = {
|
||||
market_item = {
|
||||
price = {
|
||||
{ 'coin', 21000 },
|
||||
{ 'coal', 1000 }
|
||||
},
|
||||
offer = {
|
||||
type = 'nothing',
|
||||
effect_description = { 'pirates.market_description_upgrade_rockets' }
|
||||
},
|
||||
},
|
||||
tooltip = { 'pirates.market_description_upgrade_rockets' },
|
||||
what_you_get_sprite_buttons = { ['item/rocket-launcher'] = false },
|
||||
},
|
||||
[enum.UPGRADE_CANNONS] = {
|
||||
market_item = {
|
||||
price = {
|
||||
{ 'repair-pack', 20 },
|
||||
{ 'coin', 5000 },
|
||||
{ 'coal', 800 }
|
||||
},
|
||||
offer = {
|
||||
type = 'nothing',
|
||||
effect_description = { 'pirates.market_description_upgrade_turrets' }
|
||||
},
|
||||
},
|
||||
tooltip = { 'pirates.market_description_upgrade_turrets' },
|
||||
what_you_get_sprite_buttons = { ['item/artillery-turret'] = false },
|
||||
},
|
||||
}
|
||||
|
||||
function Public.execute_upgade(upgrade_type, player)
|
@ -1,347 +0,0 @@
|
||||
-- This file is part of thesixthroc's Pirate Ship softmod, licensed under GPLv3 and stored at https://github.com/ComfyFactory/ComfyFactorio and https://github.com/danielmartin0/ComfyFactorio-Pirates.
|
||||
|
||||
|
||||
local Memory = require 'maps.pirates.memory'
|
||||
-- local Roles = require 'maps.pirates.roles.roles'
|
||||
-- local Balance = require 'maps.pirates.balance'
|
||||
-- local Common = require 'maps.pirates.common'
|
||||
-- local Utils = require 'maps.pirates.utils_local'
|
||||
-- local Math = require 'maps.pirates.math'
|
||||
-- local Loot = require 'maps.pirates.loot'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
-- local Hold = require 'maps.pirates.surfaces.hold'
|
||||
-- local Crew = require 'maps.pirates.crew'
|
||||
-- local Boats = require 'maps.pirates.structures.boats.boats'
|
||||
-- local Dock = require 'maps.pirates.surfaces.dock'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
local Public = {}
|
||||
|
||||
|
||||
|
||||
-- Note! This file is deprecated. It is replaced with a dedicated market at the dock and inside the captain's cabin. The exception is main_shop_data_1 as noted below, which is consulted for the Crowsnest caption. (Haven't had time to unify this yet.)
|
||||
|
||||
|
||||
|
||||
--== Warning: If something only costs fuel, then we need to check the player can't buy it whilst they're dead
|
||||
|
||||
-- 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},
|
||||
-- },
|
||||
new_boat_cutter = {
|
||||
tooltip = 'Purchase a cutter.',
|
||||
what_you_get_sprite_buttons = { ['utility/spawn_flag'] = false },
|
||||
base_cost = { fuel = 3000 },
|
||||
},
|
||||
new_boat_sloop_with_hold = {
|
||||
tooltip = 'Purchase a sloop (with hold).',
|
||||
what_you_get_sprite_buttons = { ['utility/spawn_flag'] = false },
|
||||
base_cost = { fuel = 3500 },
|
||||
},
|
||||
new_boat_cutter_with_hold = {
|
||||
tooltip = 'Purchase a cutter (with hold).',
|
||||
what_you_get_sprite_buttons = { ['utility/spawn_flag'] = false },
|
||||
base_cost = { fuel = 5000 },
|
||||
},
|
||||
-- buy_iron = {
|
||||
-- tooltip = 'Purchase 250 iron plates for 300 stored fuel.',
|
||||
-- what_you_get_sprite_buttons = {['item/iron-plate'] = 250},
|
||||
-- base_cost = {fuel = 300},
|
||||
-- },
|
||||
-- buy_copper = {
|
||||
-- tooltip = 'Purchase 250 copper plates for 300 stored fuel.',
|
||||
-- what_you_get_sprite_buttons = {['item/copper-plate'] = 250},
|
||||
-- base_cost = {fuel = 300},
|
||||
-- },
|
||||
-- sell_iron = {
|
||||
-- tooltip = 'Purchase 200 stored fuel for 2000 iron plates.',
|
||||
-- what_you_get_sprite_buttons = {['item/sulfur'] = 200},
|
||||
-- base_cost = {iron_plates = 2000},
|
||||
-- },
|
||||
-- sell_copper = {
|
||||
-- tooltip = 'Purchase 100 stored fuel for 2500 copper plates',
|
||||
-- what_you_get_sprite_buttons = {['item/sulfur'] = 100},
|
||||
-- base_cost = {copper_plates = 2500},
|
||||
-- },
|
||||
-- as as initial pass let's try making the fuel values half of the old gold values...
|
||||
[Upgrades.enum.MORE_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 = { '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 = { '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 = { '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 = {
|
||||
rail_signal = {
|
||||
tooltip = "50 signals, used to steer the boat one space in the Crow's Nest View.",
|
||||
what_you_get_sprite_buttons = { ['item/rail-signal'] = 50 },
|
||||
base_cost = { coins = 500, fuel = 50 },
|
||||
},
|
||||
artillery_shell = {
|
||||
tooltip = '8 cannon shells.',
|
||||
what_you_get_sprite_buttons = { ['item/artillery-shell'] = 8 },
|
||||
base_cost = { coins = 800, fuel = 30 },
|
||||
},
|
||||
-- artillery_remote = {
|
||||
-- tooltip = 'An artillery targeting remote.',
|
||||
-- what_you_get_sprite_buttons = {['item/artillery-targeting-remote'] = 1},
|
||||
-- base_cost = {coins = 12000, fuel = 2500},
|
||||
-- },
|
||||
-- buy_fast_loader = {
|
||||
-- tooltip = 'A fast loader for 500 stored fuel.',
|
||||
-- what_you_get_sprite_buttons = {['item/fast-loader'] = 1},
|
||||
-- base_cost = {fuel = 500},
|
||||
-- },
|
||||
uranium_ore = {
|
||||
tooltip = '10 green rocks of unknown origin.',
|
||||
what_you_get_sprite_buttons = { ['item/uranium-238'] = 10 },
|
||||
base_cost = { coins = 1000, fuel = 100 },
|
||||
},
|
||||
extra_time = {
|
||||
tooltip = 'Relax at sea for an extra minute. (Increases the next destination\'s loading time.)',
|
||||
what_you_get_sprite_buttons = { ['utility/time_editor_icon'] = 60 },
|
||||
base_cost = { coins = 10, fuel = 1 },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Public.initialise_captains_shop()
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
memory.mainshop_availability_bools = {
|
||||
uranium_ore = true,
|
||||
rail_signal = true,
|
||||
artillery_shell = true,
|
||||
artillery_remote = false, --good way to get trolled by crew and remove skill
|
||||
extra_time = false,
|
||||
new_boat_sloop_with_hold = false,
|
||||
new_boat_cutter_with_hold = false,
|
||||
new_boat_cutter = false,
|
||||
buy_iron = false,
|
||||
upgrade_cannons = false,
|
||||
-- sell_iron = false,
|
||||
-- buy_fast_loader = true,
|
||||
-- sell_copper = false,
|
||||
}
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
end
|
||||
|
||||
-- function Public.main_shop_try_purchase(player, purchase_name)
|
||||
-- local memory = Memory.get_crew_memory()
|
||||
-- local destination = Common.current_destination()
|
||||
-- local shop_data_1 = Public.main_shop_data_1
|
||||
-- local shop_data_2 = Public.main_shop_data_2
|
||||
-- local trade_data = shop_data_1[purchase_name] or shop_data_2[purchase_name]
|
||||
-- if not trade_data then return end
|
||||
|
||||
-- local stored_fuel = memory.stored_fuel
|
||||
-- if not stored_fuel then return end
|
||||
-- -- local captain_index = memory.playerindex_captain
|
||||
-- -- if not (stored_fuel and captain_index) then return end
|
||||
-- -- local captain = game.players[captain_index]
|
||||
-- if not Common.validate_player_and_character(player) then return end
|
||||
|
||||
-- local inv = player.get_inventory(defines.inventory.character_main)
|
||||
-- if not (inv and inv.valid) then return end
|
||||
|
||||
-- local multiplier = Balance.main_shop_cost_multiplier()
|
||||
|
||||
-- -- local rate_limit_ok = not (memory.mainshop_rate_limit_ticker and memory.mainshop_rate_limit_ticker > 0)
|
||||
-- local rate_limit_ok = true
|
||||
-- local enough_fuel = true
|
||||
-- local enough_iron_plates = true
|
||||
-- local enough_coins = true
|
||||
-- local enough_copper_plates = true
|
||||
-- local coins_got
|
||||
-- local iron_plates_got
|
||||
-- local copper_plates_got
|
||||
-- -- local able_to_buy_boats = memory.boat.state == Boats.enum_state.DOCKED --disabled for now
|
||||
-- local able_to_buy_boats = false
|
||||
-- -- local able_to_buy_boats = (memory.boat.state == Boats.enum_state.DOCKED or memory.boat.state == Boats.enum_state.APPROACHING) --problem with this if you buy whilst approaching, the original one no longer moves
|
||||
|
||||
-- for k, v in pairs(trade_data.base_cost) do
|
||||
-- if k == 'fuel' then
|
||||
-- enough_fuel = (stored_fuel >= v * multiplier)
|
||||
-- elseif k == 'coins' then
|
||||
-- coins_got = inv.get_item_count('coin')
|
||||
-- enough_coins = coins_got >= v * multiplier
|
||||
-- elseif k == 'iron_plates' then
|
||||
-- iron_plates_got = inv.get_item_count('iron-plate')
|
||||
-- enough_iron_plates = iron_plates_got >= v * multiplier
|
||||
-- elseif k == 'copper_plates' then
|
||||
-- copper_plates_got = inv.get_item_count('copper-plate')
|
||||
-- enough_copper_plates = copper_plates_got >= v * multiplier
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local can_buy = rate_limit_ok and enough_coins and enough_fuel and enough_iron_plates and enough_copper_plates
|
||||
|
||||
-- if purchase_name == 'new_boat_sloop_with_hold' or purchase_name == 'new_boat_cutter_with_hold' or purchase_name == 'new_boat_cutter' then can_buy = can_buy and able_to_buy_boats end
|
||||
|
||||
-- -- @TODO: prevent people from buying things whilst marooned
|
||||
|
||||
-- if can_buy then
|
||||
-- for k, v in pairs(trade_data.base_cost) do
|
||||
-- if k == 'fuel' then
|
||||
-- memory.stored_fuel = memory.stored_fuel - v * multiplier
|
||||
-- elseif k == 'coins' then
|
||||
-- inv.remove{name="coin", count=v * multiplier}
|
||||
-- elseif k == 'iron_plates' then
|
||||
-- inv.remove{name="iron-plate", count=v * multiplier}
|
||||
-- elseif k == 'copper_plates' then
|
||||
-- inv.remove{name="copper-plate", count=v * multiplier}
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local force = memory.force
|
||||
-- if not (force and force.valid) then return end
|
||||
|
||||
-- local gotamount
|
||||
-- if purchase_name == 'uranium_ore' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/uranium-238']
|
||||
-- Common.give(player, {{name = 'uranium-238', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is buying green rocks...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'extra_time' then
|
||||
-- local success = Crew.try_add_extra_time_at_sea(60 * 60)
|
||||
-- if success then
|
||||
-- Common.notify_force_light(force,string.format('%s is buying extra time at sea...', player.name))
|
||||
-- else
|
||||
-- Common.notify_player_error(player, string.format('Purchase error: Can\'t buy more time than this.', player.name))
|
||||
-- -- refund:
|
||||
-- memory.stored_fuel = memory.stored_fuel + trade_data.base_cost.fuel * multiplier
|
||||
-- end
|
||||
|
||||
-- elseif purchase_name == 'rail_signal' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/rail-signal']
|
||||
-- Common.give(player, {{name = 'rail-signal', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is buying signals...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'artillery_shell' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/artillery-shell']
|
||||
-- Common.give(player, {{name = 'artillery-shell', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is buying cannon shells...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'artillery_remote' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/artillery-targeting-remote']
|
||||
-- Common.give(player, {{name = 'artillery-targeting-remote', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is buying an artillery targeting remote...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'new_boat_cutter' or purchase_name == 'new_boat_cutter_with_hold' or purchase_name == 'new_boat_sloop_with_hold' then
|
||||
-- Dock.execute_boat_purchase()
|
||||
-- Common.notify_force(force,string.format('[font=heading-1]%s bought a %s.[/font]', player.name, Boats[Common.current_destination().static_params.boat_for_sale_type].Data.display_name))
|
||||
|
||||
-- elseif purchase_name == 'repair_cannons' then
|
||||
-- -- heal all cannons:
|
||||
-- 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.healthbars[unit_number]
|
||||
-- if _DEBUG then game.print(unit_number) end
|
||||
-- if healthbar then
|
||||
-- healthbar.health = healthbar.max_health
|
||||
-- Public.update_healthbar_rendering(healthbar, healthbar.max_health)
|
||||
-- end
|
||||
-- end
|
||||
-- Common.notify_force(force,string.format('[font=heading-1]%s repaired the cannons.[/font]', player.name))
|
||||
-- memory.mainshop_availability_bools[purchase_name] = false
|
||||
|
||||
-- elseif purchase_name == Upgrades.enum.MORE_POWER then
|
||||
-- Upgrades.execute_upgade(Upgrades.enum.MORE_POWER)
|
||||
-- memory.mainshop_availability_bools[purchase_name] = false
|
||||
|
||||
-- elseif purchase_name == Upgrades.enum.EXTRA_HOLD then
|
||||
-- Upgrades.execute_upgade(Upgrades.enum.EXTRA_HOLD)
|
||||
-- memory.mainshop_availability_bools[purchase_name] = false
|
||||
|
||||
-- elseif purchase_name == Upgrades.enum.UNLOCK_MERCHANTS then
|
||||
-- Upgrades.execute_upgade(Upgrades.enum.UNLOCK_MERCHANTS)
|
||||
-- memory.mainshop_availability_bools[purchase_name] = false
|
||||
|
||||
-- elseif purchase_name == Upgrades.enum.ROCKETS_FOR_SALE then
|
||||
-- Upgrades.execute_upgade(Upgrades.enum.ROCKETS_FOR_SALE)
|
||||
-- memory.mainshop_availability_bools[purchase_name] = false
|
||||
|
||||
-- elseif purchase_name == 'sell_iron' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/coal']
|
||||
-- Common.give(player, {{name = 'fuel', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is selling iron...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'buy_iron' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/iron-plate']
|
||||
-- Common.give_items_to_crew{{name = 'iron-plate', count = gotamount}}
|
||||
-- Common.notify_force_light(force,string.format('%s is buying iron...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'buy_copper' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/copper-plate']
|
||||
-- Common.give_items_to_crew{{name = 'copper-plate', count = gotamount}}
|
||||
-- Common.notify_force_light(force,string.format('%s is buying copper...', player.name))
|
||||
|
||||
-- -- elseif name == 'buy_fast_loader' then
|
||||
-- -- gotamount = trade_data.what_you_get_sprite_buttons['item/fast-loader']
|
||||
-- -- Common.give(player, {{name = 'fast-loader', count = gotamount}})
|
||||
-- -- Common.notify_force_light(force,string.format('%s bought a fast loader...', player.name))
|
||||
|
||||
-- elseif purchase_name == 'sell_copper' then
|
||||
-- gotamount = trade_data.what_you_get_sprite_buttons['item/coal']
|
||||
-- Common.give(player, {{name = 'fuel', count = gotamount}})
|
||||
-- Common.notify_force_light(force,string.format('%s is selling copper...', player.name))
|
||||
|
||||
-- end
|
||||
|
||||
-- script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
|
||||
-- -- memory.mainshop_rate_limit_ticker = Common.mainshop_rate_limit_ticks
|
||||
-- else
|
||||
-- -- play sound?
|
||||
-- if rate_limit_ok == false then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Shop rate limit exceeded.')
|
||||
-- end
|
||||
-- if enough_fuel == false then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Not enough stored fuel.')
|
||||
-- end
|
||||
-- if enough_coins == false then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Not enough doubloons.')
|
||||
-- end
|
||||
-- if enough_iron_plates == false then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Not enough iron plates.')
|
||||
-- end
|
||||
-- if enough_copper_plates == false then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Not enough copper plates.')
|
||||
-- end
|
||||
|
||||
-- if (purchase_name == 'new_boat_cutter' or purchase_name == 'new_boat_sloop_with_hold' or purchase_name == 'new_boat_cutter_with_hold') and (not able_to_buy_boats) then
|
||||
-- Common.notify_player_error(player, 'Purchase error: Not able to purchase ships right now.')
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
return Public
|
@ -13,7 +13,7 @@ local Utils = require 'maps.pirates.utils_local'
|
||||
local Math = require 'maps.pirates.math'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
|
||||
-- local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
-- local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -26,7 +26,7 @@ Public.offers_loaders = {
|
||||
}
|
||||
|
||||
Public.offers_rockets = {
|
||||
{ price = { { 'coin', 250 }, { 'electronic-circuit', 80 } }, offer = { type = 'give-item', item = 'rocket-launcher', count = 1 } },
|
||||
{ price = { { 'coin', 250 }, { 'electronic-circuit', 80 } }, offer = { type = 'give-item', item = 'rocket-launcher', count = 1 } },
|
||||
{ price = { { 'coin', 1200 }, { 'explosives', 20 }, { 'electronic-circuit', 20 } }, offer = { type = 'give-item', item = 'rocket', count = 20 } },
|
||||
}
|
||||
|
||||
@ -34,19 +34,19 @@ Public.offers_default = {
|
||||
{ price = { { 'coin', 1500 } }, offer = { type = 'give-item', item = 'copper-plate', count = 300 } },
|
||||
{ price = { { 'coin', 1500 } }, offer = { type = 'give-item', item = 'iron-plate', count = 300 } },
|
||||
{ price = { { 'coin', 1000 } }, offer = { type = 'give-item', item = 'piercing-rounds-magazine', count = 60 } },
|
||||
{ price = { { 'coin', 900 } }, offer = { type = 'give-item', item = 'heavy-armor', count = 1 } },
|
||||
{ price = { { 'coin', 900 } }, offer = { type = 'give-item', item = 'heavy-armor', count = 1 } },
|
||||
{ price = { { 'coin', 1000 } }, offer = { type = 'give-item', item = 'grenade', count = 30 } },
|
||||
{ price = { { 'coin', 1200 } }, offer = { type = 'give-item', item = 'defender-capsule', count = 15 } },
|
||||
{ price = { { 'coin', 1500 } }, offer = { type = 'give-item', item = 'distractor-capsule', count = 15 } },
|
||||
{ price = { { 'coin', 1000 } }, offer = { type = 'give-item', item = 'slowdown-capsule', count = 25 } },
|
||||
{ price = { { 'coin', 1000 } }, offer = { type = 'give-item', item = 'poison-capsule', count = 15 } },
|
||||
{ price = { { 'coin', 1400 } }, offer = { type = 'give-item', item = 'gate', count = 25 } },
|
||||
{ price = { { 'coin', 800 } }, offer = { type = 'give-item', item = 'storage-tank', count = 20 } },
|
||||
{ price = { { 'coin', 600 } }, offer = { type = 'give-item', item = 'big-electric-pole', count = 15 } },
|
||||
{ price = { { 'coin', 850 } }, offer = { type = 'give-item', item = 'stack-inserter', count = 7 } },
|
||||
{ price = { { 'coin', 900 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 15 } },
|
||||
{ price = { { 'coin', 960 } }, offer = { type = 'give-item', item = 'flamethrower', count = 1 } },
|
||||
{ price = { { 'coin', 980 } }, offer = { type = 'give-item', item = 'flamethrower', count = 1 } },
|
||||
{ price = { { 'coin', 800 } }, offer = { type = 'give-item', item = 'storage-tank', count = 20 } },
|
||||
{ price = { { 'coin', 600 } }, offer = { type = 'give-item', item = 'big-electric-pole', count = 15 } },
|
||||
{ price = { { 'coin', 850 } }, offer = { type = 'give-item', item = 'stack-inserter', count = 7 } },
|
||||
{ price = { { 'coin', 900 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 15 } },
|
||||
{ price = { { 'coin', 960 } }, offer = { type = 'give-item', item = 'flamethrower', count = 1 } },
|
||||
{ price = { { 'coin', 980 } }, offer = { type = 'give-item', item = 'flamethrower', count = 1 } },
|
||||
{ price = { { 'coin', 1700 } }, offer = { type = 'give-item', item = 'flamethrower-ammo', count = 15 } },
|
||||
{ price = { { 'coin', 1800 } }, offer = { type = 'give-item', item = 'flamethrower-ammo', count = 20 } },
|
||||
{ price = { { 'coin', 1800 } }, offer = { type = 'give-item', item = 'flying-robot-frame', count = 5 } },
|
||||
|
@ -12,10 +12,10 @@ local Balance = require 'maps.pirates.balance'
|
||||
local Common = require 'maps.pirates.common'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
local Math = require 'maps.pirates.math'
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
|
||||
-- local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
-- local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@ -23,67 +23,67 @@ local Public = {}
|
||||
|
||||
|
||||
Public.market_barters = {
|
||||
{ price = { { 'iron-plate', 300 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'iron-plate', 300 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'copper-plate', 300 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
--repeating these:
|
||||
{ price = { { 'iron-plate', 300 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'iron-plate', 300 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'copper-plate', 300 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
|
||||
{ price = { { 'steel-plate', 40 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'steel-plate', 40 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'coal', count = 500 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'iron-plate', count = 750 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'copper-plate', count = 750 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'steel-plate', count = 150 } },
|
||||
{ price = { { 'wood', 200 } }, offer = { type = 'give-item', item = 'coin', count = 360 } },
|
||||
{ price = { { 'wood', 150 } }, offer = { type = 'give-item', item = 'coal', count = 150 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'steel-plate', count = 160 } },
|
||||
{ price = { { 'steel-plate', 40 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'steel-plate', 40 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'coal', count = 500 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'iron-plate', count = 750 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'copper-plate', count = 750 } },
|
||||
{ price = { { 'raw-fish', 80 } }, offer = { type = 'give-item', item = 'steel-plate', count = 150 } },
|
||||
{ price = { { 'wood', 200 } }, offer = { type = 'give-item', item = 'coin', count = 360 } },
|
||||
{ price = { { 'wood', 150 } }, offer = { type = 'give-item', item = 'coal', count = 150 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'iron-plate', count = 500 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'copper-plate', count = 500 } },
|
||||
{ price = { { 'stone-brick', 200 } }, offer = { type = 'give-item', item = 'steel-plate', count = 160 } },
|
||||
}
|
||||
|
||||
-- permanent means you can buy more than once (but only some items???)
|
||||
Public.market_permanent_offers = {
|
||||
{ price = { { 'pistol', 1 } }, offer = { type = 'give-item', item = 'coin', count = Balance.coin_sell_amount } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'iron-ore', count = 800 } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'copper-ore', count = 800 } },
|
||||
{ price = { { 'coin', 4200 } }, offer = { type = 'give-item', item = 'crude-oil-barrel', count = 100 } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'fast-loader', count = 1 } },
|
||||
{ price = { { 'coin', 6200 } }, offer = { type = 'give-item', item = 'beacon', count = 2 } },
|
||||
{ price = { { 'coin', 4200 } }, offer = { type = 'give-item', item = 'speed-module-2', count = 2 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'explosives', count = 50 } },
|
||||
{ price = { { 'pistol', 1 } }, offer = { type = 'give-item', item = 'coin', count = Balance.coin_sell_amount } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'iron-ore', count = 800 } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'copper-ore', count = 800 } },
|
||||
{ price = { { 'coin', 4200 } }, offer = { type = 'give-item', item = 'crude-oil-barrel', count = 100 } },
|
||||
{ price = { { 'coin', 3600 } }, offer = { type = 'give-item', item = 'fast-loader', count = 1 } },
|
||||
{ price = { { 'coin', 6200 } }, offer = { type = 'give-item', item = 'beacon', count = 2 } },
|
||||
{ price = { { 'coin', 4200 } }, offer = { type = 'give-item', item = 'speed-module-2', count = 2 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'explosives', count = 50 } },
|
||||
{ price = { { 'coin', 6500 }, { 'steel-plate', 25 }, { 'explosives', 50 } }, offer = { type = 'give-item', item = 'land-mine', count = 100 } },
|
||||
-- {price = {{'coin', 30000}}, offer = {type = 'give-item', item = 'artillery-targeting-remote', count = 1}},
|
||||
}
|
||||
|
||||
-- cheap but one-off
|
||||
Public.market_sales = {
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'coal', count = 900 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'piercing-rounds-magazine', count = 75 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'uranium-rounds-magazine', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 50 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'raw-fish', count = 300 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'laser-turret', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'vehicle-machine-gun', count = 2 } },
|
||||
{ price = { { 'coin', 6000 } }, offer = { type = 'give-item', item = 'modular-armor', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'distractor-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'poison-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'slowdown-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'coin', count = 6000 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'roboport', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'construction-robot', count = 10 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'logistic-chest-passive-provider', count = 2 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'logistic-robot', count = 2 } },
|
||||
{ price = { { 'transport-belt', 100 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-transport-belt', count = 100 } },
|
||||
{ price = { { 'fast-transport-belt', 100 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-transport-belt', count = 100 } },
|
||||
{ price = { { 'underground-belt', 10 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-underground-belt', count = 10 } },
|
||||
{ price = { { 'fast-underground-belt', 10 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-underground-belt', count = 10 } },
|
||||
{ price = { { 'splitter', 10 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-splitter', count = 10 } },
|
||||
{ price = { { 'fast-splitter', 10 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-splitter', count = 10 } },
|
||||
{ price = { { 'pistol', 1 }, { 'coin', 300 } }, offer = { type = 'give-item', item = 'submachine-gun', count = 1 } },
|
||||
{ price = { { 'submachine-gun', 1 }, { 'coin', 1000 } }, offer = { type = 'give-item', item = 'vehicle-machine-gun', count = 1 } },
|
||||
{ price = { { 'shotgun', 1 }, { 'coin', 3500 } }, offer = { type = 'give-item', item = 'combat-shotgun', count = 1 } },
|
||||
{ price = { { 'shotgun-shell', 100 }, { 'coin', 2000 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 100 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'coal', count = 900 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'piercing-rounds-magazine', count = 75 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'uranium-rounds-magazine', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 50 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'raw-fish', count = 300 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'laser-turret', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'vehicle-machine-gun', count = 2 } },
|
||||
{ price = { { 'coin', 6000 } }, offer = { type = 'give-item', item = 'modular-armor', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'distractor-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'poison-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'slowdown-capsule', count = 20 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'coin', count = 6000 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'roboport', count = 1 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'construction-robot', count = 10 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'logistic-chest-passive-provider', count = 2 } },
|
||||
{ price = { { 'coin', 3000 } }, offer = { type = 'give-item', item = 'logistic-robot', count = 2 } },
|
||||
{ price = { { 'transport-belt', 100 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-transport-belt', count = 100 } },
|
||||
{ price = { { 'fast-transport-belt', 100 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-transport-belt', count = 100 } },
|
||||
{ price = { { 'underground-belt', 10 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-underground-belt', count = 10 } },
|
||||
{ price = { { 'fast-underground-belt', 10 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-underground-belt', count = 10 } },
|
||||
{ price = { { 'splitter', 10 }, { 'coin', 800 } }, offer = { type = 'give-item', item = 'fast-splitter', count = 10 } },
|
||||
{ price = { { 'fast-splitter', 10 }, { 'coin', 2500 } }, offer = { type = 'give-item', item = 'express-splitter', count = 10 } },
|
||||
{ price = { { 'pistol', 1 }, { 'coin', 300 } }, offer = { type = 'give-item', item = 'submachine-gun', count = 1 } },
|
||||
{ price = { { 'submachine-gun', 1 }, { 'coin', 1000 } }, offer = { type = 'give-item', item = 'vehicle-machine-gun', count = 1 } },
|
||||
{ price = { { 'shotgun', 1 }, { 'coin', 3500 } }, offer = { type = 'give-item', item = 'combat-shotgun', count = 1 } },
|
||||
{ price = { { 'shotgun-shell', 100 }, { 'coin', 2000 } }, offer = { type = 'give-item', item = 'piercing-shotgun-shell', count = 100 } },
|
||||
{ price = { { 'piercing-rounds-magazine', 100 }, { 'coin', 3500 } }, offer = { type = 'give-item', item = 'uranium-rounds-magazine', count = 100 } },
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ function Public.create_dock_markets(surface, p)
|
||||
|
||||
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])
|
||||
e.add_market_item(Upgrades.upgrades_data[upgrade_for_sale].market_item)
|
||||
end
|
||||
|
||||
destination.dynamic_data.dock_captains_market = e
|
||||
|
@ -10,16 +10,15 @@ local Crew = require 'maps.pirates.crew'
|
||||
local Balance = require 'maps.pirates.balance'
|
||||
local Common = require 'maps.pirates.common'
|
||||
-- local Utils = require 'maps.pirates.utils_local'
|
||||
local Roles = require 'maps.pirates.roles.roles'
|
||||
-- local Roles = require 'maps.pirates.roles.roles'
|
||||
local Math = require 'maps.pirates.math'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local SurfacesCommon = require 'maps.pirates.surfaces.common'
|
||||
local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
-- local Upgrades = require 'maps.pirates.boat_upgrades'
|
||||
|
||||
-- local Upgrades = require 'maps.pirates.shop.boat_upgrades'
|
||||
local Permissions = require 'maps.pirates.permissions'
|
||||
local Public = {}
|
||||
Public.Captains = require 'maps.pirates.shop.captains'
|
||||
Public.Covered = require 'maps.pirates.shop.covered'
|
||||
Public.Merchants = require 'maps.pirates.shop.merchants'
|
||||
Public.Minimarket = require 'maps.pirates.shop.dock'
|
||||
@ -92,7 +91,7 @@ local function purchaseData(market, player, offer_index)
|
||||
local in_captains_cabin = type and type == SurfacesCommon.enum.CABIN
|
||||
local dock_upgrades_market = destination.dynamic_data.dock_captains_market and (destination.dynamic_data.dock_captains_market == market)
|
||||
|
||||
local permission_level_fail = (in_captains_cabin and Roles.player_privilege_level(player) < Roles.privilege_levels.OFFICER) or (dock_upgrades_market and Roles.player_privilege_level(player) < Roles.privilege_levels.OFFICER)
|
||||
local permission_level_fail = (in_captains_cabin and Permissions.player_privilege_level(player) < Permissions.privilege_levels.OFFICER) or (dock_upgrades_market and Permissions.player_privilege_level(player) < Permissions.privilege_levels.OFFICER)
|
||||
|
||||
if in_captains_cabin then
|
||||
decay_type = 'static'
|
||||
@ -216,7 +215,7 @@ function Public.event_on_market_item_purchased(event)
|
||||
end
|
||||
else
|
||||
if thisPurchaseData.offer_type == 'nothing' then
|
||||
local isDamageUpgrade = thisPurchaseData.price[1].amount == Balance.weapon_damage_upgrade_price()[1].amount and thisPurchaseData.price[1].name == Balance.weapon_damage_upgrade_price()[1].name and thisPurchaseData.price[2] and thisPurchaseData.price[2].amount == Balance.weapon_damage_upgrade_price()[2].amount and thisPurchaseData.price[2].name == Balance.weapon_damage_upgrade_price()[2].name
|
||||
local isDamageUpgrade = thisPurchaseData.price[1].amount == Balance.weapon_damage_upgrade_price()[1].amount and thisPurchaseData.price[1].name == Balance.weapon_damage_upgrade_price()[1].name
|
||||
|
||||
if isDamageUpgrade then
|
||||
Common.notify_force_light(player.force, { 'pirates.market_event_attack_upgrade_purchased', player.name, Balance.weapon_damage_upgrade_percentage() })
|
||||
|
@ -8,7 +8,7 @@ local Common = require 'maps.pirates.common'
|
||||
-- local CoreData = require 'maps.pirates.coredata'
|
||||
-- local Utils = require 'maps.pirates.utils_local'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
-- local CustomEvents = require 'maps.pirates.custom_events'
|
||||
--
|
||||
-- local SurfacesCommon = require 'maps.pirates.surfaces.common'
|
||||
local Raffle = require 'maps.pirates.raffle'
|
||||
local ShopCovered = require 'maps.pirates.shop.covered'
|
||||
|
@ -8,7 +8,7 @@ local Common = require 'maps.pirates.common'
|
||||
-- local CoreData = require 'maps.pirates.coredata'
|
||||
-- local Utils = require 'maps.pirates.utils_local'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
-- local CustomEvents = require 'maps.pirates.custom_events'
|
||||
--
|
||||
-- local SurfacesCommon = require 'maps.pirates.surfaces.common'
|
||||
local Raffle = require 'maps.pirates.raffle'
|
||||
local ShopCovered = require 'maps.pirates.shop.covered'
|
||||
|
@ -8,7 +8,7 @@ local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
-- local CustomEvents = require 'maps.pirates.custom_events'
|
||||
--
|
||||
local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
|
||||
-- local Raffle = require 'maps.pirates.raffle'
|
||||
-- local ShopCovered = require 'maps.pirates.shop.covered'
|
||||
|
@ -7,7 +7,7 @@ local Common = require 'maps.pirates.common'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
-- local Math = require 'maps.pirates.math'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local Token = require 'utils.token'
|
||||
@ -119,8 +119,6 @@ function Public.move_crowsnest(vectorx, vectory)
|
||||
-- crew_force.clear_chart(surface)
|
||||
crew_force.chart(surface, area)
|
||||
end
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
|
||||
end
|
||||
|
||||
function Public.update_destination_renderings()
|
||||
|
@ -12,7 +12,7 @@ local Cabin = require 'maps.pirates.surfaces.cabin'
|
||||
local CoreData = require 'maps.pirates.coredata'
|
||||
local Utils = require 'maps.pirates.utils_local'
|
||||
local _inspect = require 'utils.inspect'.inspect
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
|
||||
|
||||
local Public = {}
|
||||
@ -71,12 +71,6 @@ function Public.execute_boat_purchase()
|
||||
|
||||
Hold.connect_up_linked_belts_to_deck()
|
||||
Cabin.connect_up_linked_belts_to_deck()
|
||||
|
||||
-- memory.mainshop_availability_bools.new_boat_cutter_with_hold = false
|
||||
-- memory.mainshop_availability_bools.new_boat_sloop_with_hold = false
|
||||
-- memory.mainshop_availability_bools.new_boat_cutter = false
|
||||
|
||||
script.raise_event(CustomEvents.enum['update_crew_fuel_gui'], {})
|
||||
end
|
||||
|
||||
function Public.place_dock_jetty_and_boats()
|
||||
|
@ -128,7 +128,7 @@ function Public.create_hold_surface(nth)
|
||||
|
||||
local surface = game.create_surface(holdname, map_gen_settings)
|
||||
surface.freeze_daytime = true
|
||||
surface.daytime = 0.3
|
||||
surface.daytime = 0.25
|
||||
surface.show_clouds = false
|
||||
surface.solar_power_multiplier = 0
|
||||
|
||||
|
@ -28,13 +28,17 @@ local function spawn_market(args, is_main)
|
||||
if is_main then
|
||||
offers = ShopCovered.market_generate_coin_offers(6)
|
||||
|
||||
offers[#offers + 1] = {
|
||||
price = Balance.weapon_damage_upgrade_price(),
|
||||
offer = {
|
||||
type = "nothing",
|
||||
effect_description = { 'pirates.market_description_purchase_attack_upgrade', Balance.weapon_damage_upgrade_percentage() }
|
||||
if not destination_data.dynamic_data.offered_weapon_damage_upgrade then
|
||||
offers[#offers + 1] = {
|
||||
price = Balance.weapon_damage_upgrade_price(),
|
||||
offer = {
|
||||
type = "nothing",
|
||||
effect_description = { 'pirates.market_description_purchase_attack_upgrade', Balance.weapon_damage_upgrade_percentage() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destination_data.dynamic_data.offered_weapon_damage_upgrade = true
|
||||
end
|
||||
|
||||
if destination_data.static_params.class_for_sale then
|
||||
offers[#offers + 1] = { price = { { 'coin', Balance.class_cost(true) } }, offer = { type = "nothing", effect_description = { 'pirates.market_description_purchase_class', Classes.display_form(destination_data.static_params.class_for_sale) } } }
|
||||
|
@ -9,8 +9,8 @@ local Public = {}
|
||||
|
||||
Public.display_names = { { 'pirates.location_displayname_horseshoe_1' }, { 'pirates.location_displayname_horseshoe_2' }, { 'pirates.location_displayname_horseshoe_3' } }
|
||||
|
||||
Public.terraingen_frame_width = 992
|
||||
Public.terraingen_frame_height = 992
|
||||
Public.terraingen_frame_width = 896
|
||||
Public.terraingen_frame_height = 896
|
||||
Public.static_params_default = {
|
||||
starting_time_of_day = 0,
|
||||
daynightcycletype = 1,
|
||||
@ -30,8 +30,8 @@ function Public.base_ores()
|
||||
}
|
||||
end
|
||||
|
||||
local rscale1 = 264
|
||||
local rscale2 = 230
|
||||
local rscale1 = 240
|
||||
local rscale2 = 210
|
||||
local hscale = 0.1
|
||||
Public.noiseparams = {
|
||||
radius1 = {
|
||||
|
@ -114,7 +114,7 @@ function Public.chunk_structures(args)
|
||||
return {
|
||||
placeable = noises.farness(p) > 0.36,
|
||||
-- spawners_indestructible = false,
|
||||
spawners_indestructible = noises.farness(p) > 0.82,
|
||||
spawners_indestructible = noises.farness(p) > 0.8,
|
||||
density_perchunk = 9 * Math.slopefromto(noises.mood(p), 0.12, -0.18) * Math.slopefromto(noises.farness(p), 0.36, 1) * args.biter_base_density_scale,
|
||||
}
|
||||
end
|
||||
|
@ -101,7 +101,7 @@ function Public.mid_farness_position_1(args, points_to_avoid)
|
||||
if (not Utils.contains(CoreData.tiles_that_conflict_with_resource_layer, tile.name)) and (not Utils.contains(CoreData.edgemost_tile_names, tile.name)) then
|
||||
local p3 = { x = p2.x + args.static_params.terraingen_coordinates_offset.x, y = p2.y + args.static_params.terraingen_coordinates_offset.y }
|
||||
|
||||
if IslandsCommon.island_farness_1(args)(p3) > 0.1 and IslandsCommon.island_farness_1(args)(p3) < 0.7 then
|
||||
if IslandsCommon.island_farness_1(args)(p3) > 0.1 and IslandsCommon.island_farness_1(args)(p3) < 0.75 then
|
||||
local allowed = true
|
||||
for _, pa in pairs(points_to_avoid) do
|
||||
if Math.distance({ x = pa.x, y = pa.y }, p2) < pa.r then
|
||||
|
@ -9,8 +9,8 @@ local Public = {}
|
||||
|
||||
Public.display_names = { { 'pirates.location_displayname_standard_1' } }
|
||||
|
||||
Public.terraingen_frame_width = 1024
|
||||
Public.terraingen_frame_height = 1024
|
||||
Public.terraingen_frame_width = 896
|
||||
Public.terraingen_frame_height = 896
|
||||
Public.static_params_default = {
|
||||
default_decoratives = true,
|
||||
base_starting_treasure = 1000,
|
||||
@ -32,7 +32,7 @@ function Public.base_ores()
|
||||
}
|
||||
end
|
||||
|
||||
local rscale = 280
|
||||
local rscale = 250
|
||||
local hscale = 0.1
|
||||
Public.noiseparams = {
|
||||
radius = {
|
||||
|
@ -30,7 +30,6 @@ function Public.noises(args)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function Public.terrain(args)
|
||||
local noises = Public.noises(args)
|
||||
local p = args.p
|
||||
@ -39,63 +38,62 @@ function Public.terrain(args)
|
||||
if IslandsCommon.place_water_tile(args) then return end
|
||||
|
||||
if noises.height(p) < 0 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'water', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'water', position = args.p }
|
||||
return
|
||||
end
|
||||
|
||||
if noises.height(p) < 0.05 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'sand-1', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'sand-1', position = args.p }
|
||||
if (not args.iconized_generation) and noises.farness(p) > 0.02 and noises.farness(p) < 0.6 and Math.random(500) == 1 then
|
||||
args.specials[#args.specials + 1] = {name = 'buried-treasure', position = args.p}
|
||||
args.specials[#args.specials + 1] = { name = 'buried-treasure', position = args.p }
|
||||
end
|
||||
elseif noises.height(p) < 0.12 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'sand-2', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'sand-2', position = args.p }
|
||||
else
|
||||
if noises.forest_abs_suppressed(p) > 0.3 and noises.rock(p) < 0.3 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'dry-dirt', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'dry-dirt', position = args.p }
|
||||
elseif noises.forest_abs_suppressed(p) > 0.15 and noises.rock(p) < 0.3 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'dirt-3', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'dirt-3', position = args.p }
|
||||
else
|
||||
args.tiles[#args.tiles + 1] = {name = 'dirt-2', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'dirt-2', position = args.p }
|
||||
end
|
||||
end
|
||||
|
||||
if noises.height(p) > 0.06 then
|
||||
if noises.forest_abs_suppressed(p) > 0.5 then
|
||||
if (not args.iconized_generation) and noises.forest_abs_suppressed(p) < 0.75 and Math.random(1300) == 1 then
|
||||
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
|
||||
if (not args.iconized_generation) and noises.forest_abs_suppressed(p) < 0.75 and Math.random(1300) == 1 then
|
||||
args.specials[#args.specials + 1] = { name = 'chest', position = args.p }
|
||||
else
|
||||
local forest_noise = noises.forest(p)
|
||||
local treedensity = 0.7 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.5, 0.7)
|
||||
if forest_noise > 0 then
|
||||
if noises.rock(p) > 0 then
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-06', position = args.p, visible_on_overworld = true} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-06', position = args.p, visible_on_overworld = true } end
|
||||
else
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-06-brown', position = args.p} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-06-brown', position = args.p } end
|
||||
end
|
||||
elseif forest_noise < -1 then
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-03', position = args.p, visible_on_overworld = true} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-03', position = args.p, visible_on_overworld = true } end
|
||||
else
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-07', position = args.p} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-07', position = args.p } end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if noises.forest_abs_suppressed(p) < 0.45 then
|
||||
|
||||
if noises.height(p) > 0.12 then
|
||||
if noises.rock_abs(p) > 0.22 then
|
||||
local rockdensity = 1/600 * Math.slopefromto(noises.rock_abs(p), 0.22, 0.6) + 1/5 * Math.slopefromto(noises.rock_abs(p), 2.4, 2.6)
|
||||
local rockdensity = 1 / 600 * Math.slopefromto(noises.rock_abs(p), 0.22, 0.6) + 1 / 5 * Math.slopefromto(noises.rock_abs(p), 2.4, 2.6)
|
||||
local rockrng = Math.random()
|
||||
if rockrng < rockdensity then
|
||||
args.entities[#args.entities + 1] = IslandsCommon.random_rock_1(args.p)
|
||||
elseif rockrng < rockdensity * 1.5 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-medium', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-medium', position = args.p }
|
||||
elseif rockrng < rockdensity * 2 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-small', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-small', position = args.p }
|
||||
elseif rockrng < rockdensity * 2.5 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-tiny', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-tiny', position = args.p }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -103,29 +101,27 @@ function Public.terrain(args)
|
||||
|
||||
if noises.height(p) > 0.18 and noises.mood(p) > 0.6 then
|
||||
if noises.forest_abs(p) < 0.2 and noises.rock_abs(p) > 1.5 then
|
||||
args.entities[#args.entities + 1] = {name = 'coal', position = args.p, amount = 7}
|
||||
args.entities[#args.entities + 1] = { name = 'coal', position = args.p, amount = 7 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.chunk_structures(args)
|
||||
|
||||
local spec = function(p)
|
||||
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
|
||||
local spec = function (p)
|
||||
local noises = Public.noises { p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed }
|
||||
|
||||
return {
|
||||
placeable = noises.farness(p) > 0.3,
|
||||
spawners_indestructible = noises.farness(p) > 0.7,
|
||||
-- spawners_indestructible = false,
|
||||
density_perchunk = 30 * Math.slopefromto(noises.mood(p), 0.14, -0.1) * Math.slopefromto(noises.farness(p), 0.3, 1)^(1.5) * args.biter_base_density_scale,
|
||||
density_perchunk = 30 * Math.slopefromto(noises.mood(p), 0.14, -0.1) * Math.slopefromto(noises.farness(p), 0.3, 1) ^ 1.5 * args.biter_base_density_scale,
|
||||
}
|
||||
end
|
||||
|
||||
IslandsCommon.enemies_1(args, spec)
|
||||
|
||||
local spec2 = function(p)
|
||||
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
|
||||
local spec2 = function (p)
|
||||
local noises = Public.noises { p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed }
|
||||
|
||||
return {
|
||||
-- placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
|
||||
@ -137,7 +133,6 @@ function Public.chunk_structures(args)
|
||||
IslandsCommon.assorted_structures_1(args, spec2)
|
||||
end
|
||||
|
||||
|
||||
-- function Public.break_rock(surface, p, entity_name)
|
||||
-- -- return Ores.try_ore_spawn(surface, p, entity_name)
|
||||
-- end
|
||||
@ -147,5 +142,4 @@ function Public.generate_silo_setup_position(points_to_avoid)
|
||||
return Hunt.silo_setup_position(points_to_avoid)
|
||||
end
|
||||
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -30,7 +30,6 @@ function Public.noises(args)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function Public.terrain(args)
|
||||
local noises = Public.noises(args)
|
||||
local p = args.p
|
||||
@ -39,67 +38,66 @@ function Public.terrain(args)
|
||||
if IslandsCommon.place_water_tile(args) then return end
|
||||
|
||||
if noises.height(p) < 0 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'water', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'water', position = args.p }
|
||||
return
|
||||
end
|
||||
|
||||
if noises.height(p) < 0.04 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'sand-1', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'sand-1', position = args.p }
|
||||
if (not args.iconized_generation) and noises.farness(p) > 0.02 and noises.farness(p) < 0.6 and Math.random(500) == 1 then
|
||||
args.specials[#args.specials + 1] = {name = 'buried-treasure', position = args.p}
|
||||
args.specials[#args.specials + 1] = { name = 'buried-treasure', position = args.p }
|
||||
end
|
||||
elseif noises.height(p) < 0.05 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'sand-2', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'sand-2', position = args.p }
|
||||
elseif noises.height(p) < 0.11 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'dry-dirt', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'dry-dirt', position = args.p }
|
||||
elseif noises.height(p) < 0.12 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'grass-4', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'grass-4', position = args.p }
|
||||
else
|
||||
if noises.forest_abs_suppressed(p) > 0.3 and noises.rock(p) < 0.3 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'dirt-7', position = args.p }
|
||||
elseif noises.forest_abs_suppressed(p) > 0.15 and noises.rock(p) < 0.3 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'grass-4', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'grass-4', position = args.p }
|
||||
else
|
||||
args.tiles[#args.tiles + 1] = {name = 'grass-3', position = args.p}
|
||||
args.tiles[#args.tiles + 1] = { name = 'grass-3', position = args.p }
|
||||
end
|
||||
end
|
||||
|
||||
if noises.height(p) > 0.11 then
|
||||
if noises.forest_abs_suppressed(p) > 0.7 then
|
||||
if (not args.iconized_generation) and noises.forest_abs_suppressed(p) < 1 and Math.random(700) == 1 then -- high amounts of this
|
||||
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
|
||||
if (not args.iconized_generation) and noises.forest_abs_suppressed(p) < 1 and Math.random(700) == 1 then -- high amounts of this
|
||||
args.specials[#args.specials + 1] = { name = 'chest', position = args.p }
|
||||
else
|
||||
local forest_noise = noises.forest(p)
|
||||
local treedensity = 0.7 * Math.slopefromto(noises.forest_abs_suppressed(p), 0.61, 0.76)
|
||||
if forest_noise > 0 then
|
||||
if noises.rock(p) > 0.05 then
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-08-red', position = args.p, visible_on_overworld = true} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-08-red', position = args.p, visible_on_overworld = true } end
|
||||
elseif noises.rock(p) < -0.05 then
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-09-brown', position = args.p} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-09-brown', position = args.p } end
|
||||
end
|
||||
elseif forest_noise < -1.2 then
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-09', position = args.p, visible_on_overworld = true} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-09', position = args.p, visible_on_overworld = true } end
|
||||
else
|
||||
if Math.random(1,100) < treedensity*100 then args.entities[#args.entities + 1] = {name = 'tree-02-red', position = args.p} end
|
||||
if Math.random(1, 100) < treedensity * 100 then args.entities[#args.entities + 1] = { name = 'tree-02-red', position = args.p } end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if noises.forest_abs_suppressed(p) < 0.45 then
|
||||
|
||||
if noises.height(p) > 0.12 then
|
||||
if noises.rock_abs(p) > 0.25 then
|
||||
local rockdensity = 1/600 * Math.slopefromto(noises.rock_abs(p), 0.25, 0.6) + 1/5 * Math.slopefromto(noises.rock_abs(p), 2.4, 2.6)
|
||||
local rockdensity = 1 / 600 * Math.slopefromto(noises.rock_abs(p), 0.25, 0.6) + 1 / 5 * Math.slopefromto(noises.rock_abs(p), 2.4, 2.6)
|
||||
local rockrng = Math.random()
|
||||
if rockrng < rockdensity then
|
||||
args.entities[#args.entities + 1] = IslandsCommon.random_rock_1(args.p)
|
||||
elseif rockrng < rockdensity * 1.5 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-medium', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-medium', position = args.p }
|
||||
elseif rockrng < rockdensity * 2 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-small', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-small', position = args.p }
|
||||
elseif rockrng < rockdensity * 2.5 then
|
||||
args.decoratives[#args.decoratives + 1] = {name = 'rock-tiny', position = args.p}
|
||||
args.decoratives[#args.decoratives + 1] = { name = 'rock-tiny', position = args.p }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -107,29 +105,27 @@ function Public.terrain(args)
|
||||
|
||||
if noises.height(p) > 0.18 and noises.mood(p) > 0.3 then
|
||||
if noises.forest_abs(p) < 0.2 and noises.rock_abs(p) > 1.5 then
|
||||
args.entities[#args.entities + 1] = {name = 'coal', position = args.p, amount = 7}
|
||||
args.entities[#args.entities + 1] = { name = 'coal', position = args.p, amount = 7 }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Public.chunk_structures(args)
|
||||
|
||||
local spec = function(p)
|
||||
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
|
||||
local spec = function (p)
|
||||
local noises = Public.noises { p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed }
|
||||
|
||||
return {
|
||||
placeable = noises.farness(p) > 0.3,
|
||||
-- spawners_indestructible = false,
|
||||
spawners_indestructible = noises.farness(p) > 0.7,
|
||||
density_perchunk = 25 * Math.slopefromto(noises.mood(p), 0.16, -0.1) * Math.slopefromto(noises.farness(p), 0.3, 1)^2 * args.biter_base_density_scale,
|
||||
density_perchunk = 25 * Math.slopefromto(noises.mood(p), 0.16, -0.1) * Math.slopefromto(noises.farness(p), 0.3, 1) ^ 2 * args.biter_base_density_scale,
|
||||
}
|
||||
end
|
||||
|
||||
IslandsCommon.enemies_1(args, spec)
|
||||
|
||||
local spec2 = function(p)
|
||||
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
|
||||
local spec2 = function (p)
|
||||
local noises = Public.noises { p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed }
|
||||
|
||||
return {
|
||||
-- placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
|
||||
@ -141,7 +137,6 @@ function Public.chunk_structures(args)
|
||||
IslandsCommon.assorted_structures_1(args, spec2)
|
||||
end
|
||||
|
||||
|
||||
-- function Public.break_rock(surface, p, entity_name)
|
||||
-- -- return Ores.try_ore_spawn(surface, p, entity_name)
|
||||
-- end
|
||||
@ -151,5 +146,4 @@ function Public.generate_silo_setup_position(points_to_avoid)
|
||||
return Hunt.silo_setup_position(points_to_avoid)
|
||||
end
|
||||
|
||||
|
||||
return Public
|
||||
return Public
|
||||
|
@ -9,8 +9,8 @@ local Public = {}
|
||||
|
||||
Public.display_names = { { 'pirates.location_displayname_swamp_1' } }
|
||||
|
||||
Public.terraingen_frame_width = 480
|
||||
Public.terraingen_frame_height = 480
|
||||
Public.terraingen_frame_width = 400
|
||||
Public.terraingen_frame_height = 400
|
||||
Public.static_params_default = {
|
||||
starting_time_of_day = 0.26,
|
||||
daynightcycletype = 1,
|
||||
@ -32,7 +32,7 @@ function Public.base_ores()
|
||||
}
|
||||
end
|
||||
|
||||
local rscale = 185
|
||||
local rscale = 170
|
||||
Public.noiseparams = {
|
||||
radius = {
|
||||
type = 'simplex_2d',
|
||||
|
Loading…
x
Reference in New Issue
Block a user