diff --git a/control.lua b/control.lua index 0f52d0ba..4eb90ef6 100644 --- a/control.lua +++ b/control.lua @@ -3,6 +3,7 @@ _LIFECYCLE = _STAGE.control -- Control stage _DEBUG = false _DUMP_ENV = false + require 'utils.server' require 'utils.server_commands' require 'utils.utils' @@ -29,12 +30,12 @@ require 'utils.debug.command' require 'comfy_panel.main' require 'comfy_panel.player_list' require 'comfy_panel.admin' -require 'comfy_panel.group' -require 'comfy_panel.poll' -require 'comfy_panel.score' +-- require 'comfy_panel.group' +-- require 'comfy_panel.poll' +-- require 'comfy_panel.score' require 'comfy_panel.config' -require 'modules.autostash' +-- require 'modules.autostash' ---------------- !ENABLE MODULES HERE ---------------- --require 'modules.admins_operate_biters' @@ -107,6 +108,10 @@ require 'modules.autostash' --![[Comfylatron has seized the Fish Train and turned it into a time machine]]-- --require 'maps.chronosphere.main' +--![[Adventure as a crew of pirates!]]-- +require 'maps.pirates.main' +-- Note: should disable comfy_panel.group, comfy_panel.poll, comfy_panel.score + --![[Launch rockets in increasingly harder getting worlds.]]-- --require 'maps.journey.main' diff --git a/locale/en/pirates.cfg b/locale/en/pirates.cfg index 3d6db9a8..0f117995 100644 --- a/locale/en/pirates.cfg +++ b/locale/en/pirates.cfg @@ -13,7 +13,7 @@ softmod_info_new_players_1=For New Players softmod_info_new_players_2=Try asking the captain what you can help with, or just mine resources and bring them to the ship. softmod_info_tips_1=Features of the game that are hard to work out alone -softmod_info_tips_2=• Resources granted to the ship appear in the captain's cabin.\n• After the first island, the ship makes ore over time.\n• Charging a silo launches a rocket. This makes gold and coin, but also pollution and evo.\n• Charging a silo drains power from everything else on its network.\n• Once a silo has launched a rocket, biters will ignore it.\n• If X marks the spot, use inserters to dig.\n• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Labs producitivity increases with each league.\n• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.\n• Time increase in evolution, and passive pollution, are both proportional to the number of remaining nests. However, destroying a nest will immediately jump evolution by roughly the amount it 'would have' made had it survived. \n• At Abandoned Labs, biters don't care if you emit pollution. They only care how long you stay. +softmod_info_tips_2=• Resources granted to the ship appear in the captain's cabin.\n• After the first island, the ship makes ore over time.\n• Charging a silo launches a rocket. This makes gold and coin, but also pollution and evo.\n• Charging a silo drains power from everything else on its network.\n• Once a silo has launched a rocket, biters will ignore it.\n• If X marks the spot, use inserters to dig.\n• You can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Labs producitivity increases with each league.\n• To launch a second parallel run, you need a fifth of the server's pirates to endorse it.\n• Time increase in evolution, and the strength of attacks, are both proportional to the number of remaining nests. However, destroying a nest will immediately jump evolution by roughly the amount it 'would have' made had it survived. \n• At Abandoned Labs, biters don't care if you emit pollution. They only care how long you stay. softmod_info_updates_1=Development softmod_info_updates_2=After more than a year on and off development, Pirate Ship is released. Not everything made it into 1.0. We don't have a 'city' in the lobby with a practice boat, nor 'biter forts' on the top lane, 'maze wurld', localisation to other languages, nor pvp. But for now, it is time to enjoy and tweak 1.0. diff --git a/maps/pirates/commands.lua b/maps/pirates/commands.lua index 584c3732..e06fef11 100644 --- a/maps/pirates/commands.lua +++ b/maps/pirates/commands.lua @@ -57,6 +57,7 @@ function(cmd) if player and player.valid then if PlayerColors[param] then player.color = PlayerColors[param] + player.chat_color = PlayerColors[param] game.print(player.name .. '\'s color is now ' .. param .. ' (via /ccolor).', PlayerColors[param]) else player.print('Color not found.') diff --git a/maps/pirates/coredata.lua b/maps/pirates/coredata.lua index 450e0805..cca1f10f 100644 --- a/maps/pirates/coredata.lua +++ b/maps/pirates/coredata.lua @@ -5,8 +5,8 @@ local inspect = require 'utils.inspect'.inspect local Public = {} Public.scenario_id_name = 'pirates' -Public.version_string = '1.0.1.5' -Public.version_float = 1.015 +Public.version_string = '1.0.1.6' +Public.version_float = 1.016 Public.victory_x = 1000 diff --git a/maps/pirates/crew.lua b/maps/pirates/crew.lua index 315a9034..3c00e373 100644 --- a/maps/pirates/crew.lua +++ b/maps/pirates/crew.lua @@ -704,6 +704,7 @@ function Public.reset_crew_and_enemy_force(id) crew_force.recipes['centrifuge'].enabled = false crew_force.recipes['flamethrower-turret'].enabled = true crew_force.recipes['locomotive'].enabled = false + crew_force.technologies['automobilism'].enabled = false crew_force.recipes['car'].enabled = false crew_force.recipes['cargo-wagon'].enabled = false diff --git a/maps/pirates/gui/minimap.lua b/maps/pirates/gui/minimap.lua index a58fc078..ac681272 100644 --- a/maps/pirates/gui/minimap.lua +++ b/maps/pirates/gui/minimap.lua @@ -191,14 +191,16 @@ function Public.click(event) event.element.zoom = zoom end if event.button == defines.mouse_button_type.middle then - if size == 320 then - size = 420 - elseif size == 420 then - size = 520 - elseif size == 520 then - size = 250 + if size == 340 then + size = 440 + elseif size == 440 then + size = 560 + elseif size == 560 then + size = 700 + elseif size == 700 then + size = 280 else - size = 320 + size = 340 end event.element.style.minimal_height = size event.element.style.minimal_width = size diff --git a/maps/pirates/highscore.lua b/maps/pirates/highscore.lua index 3b94ba79..a62a59c9 100644 --- a/maps/pirates/highscore.lua +++ b/maps/pirates/highscore.lua @@ -126,16 +126,16 @@ local function saved_scores_trim(scores) table.sort(leagues_travelled_latestv) local completion_times_cutoff = #completion_times > 8 and completion_times[8] or 9999999 - local completion_times_mediump_latestv_cutoff = #completion_times_mediump_latestv > 5 and completion_times_mediump_latestv[5] or 9999999 - local completion_times_hard_cutoff = #completion_times_hard > 5 and completion_times_hard[5] or 9999999 - local completion_times_nightmare_cutoff = #completion_times_hard > 3 and completion_times_hard[3] or 9999999 + local completion_times_mediump_latestv_cutoff = #completion_times_mediump_latestv > 4 and completion_times_mediump_latestv[4] or 9999999 + local completion_times_hard_cutoff = #completion_times_hard > 4 and completion_times_hard[4] or 9999999 + local completion_times_nightmare_cutoff = #completion_times_hard > 2 and completion_times_hard[2] or 9999999 local completion_times_latestv_cutoff = #completion_times_latestv > 8 and completion_times_latestv[8] or 9999999 local leagues_travelled_cutoff = #leagues_travelled > 8 and leagues_travelled[-8] or 0 - local leagues_travelled_mediump_latestv_cutoff = #leagues_travelled_mediump_latestv > 5 and leagues_travelled_mediump_latestv[-5] or 0 - local leagues_travelled_hard_cutoff = #leagues_travelled_hard > 5 and leagues_travelled_hard[-5] or 0 - local leagues_travelled_nightmare_cutoff = #leagues_travelled_hard > 3 and leagues_travelled_hard[-3] or 0 - local leagues_travelled_latestv_cutoff = #leagues_travelled_latestv > 8 and leagues_travelled_latestv[-8] or 0 + local leagues_travelled_mediump_latestv_cutoff = #leagues_travelled_mediump_latestv > 4 and leagues_travelled_mediump_latestv[-4] or 0 + local leagues_travelled_hard_cutoff = #leagues_travelled_hard > 4 and leagues_travelled_hard[-4] or 0 + local leagues_travelled_nightmare_cutoff = #leagues_travelled_hard > 2 and leagues_travelled_hard[-2] or 0 + local leagues_travelled_latestv_cutoff = #leagues_travelled_latestv > 86 and leagues_travelled_latestv[-8] or 0 -- log(inspect{completion_times_cutoff,completion_times_mediump_latestv_cutoff,completion_times_hard_cutoff,completion_times_latestv_cutoff,leagues_travelled_cutoff,leagues_travelled_mediump_latestv_cutoff,leagues_travelled_hard_cutoff,leagues_travelled_latestv_cutoff}) @@ -350,7 +350,7 @@ local function score_gui(data) for _, header in ipairs(headers) do local cap = header.caption - log(header.caption) + -- log(header.caption) -- Add sorting symbol if any if header.column and sorting_pref[1] and sorting_pref[1].column == header.column then @@ -483,30 +483,30 @@ local function on_gui_click(event) ['_difficulty'] = 'difficulty', ['_capacity'] = 'capacity', } - local column = element_to_column[name] - if column then + if element_to_column[name] then --@TODO: Extend local sorting_pref = this.sort_by[player.index] - local found = false + local found_index = nil local new_method = 'descending' + for i, sort in ipairs(sorting_pref) do - if sort.column == column.column then - found = true - if sort.method == 'descending' then new_method = 'ascending' end + if sort.column == element_to_column[name] then + found_index = i + if sort.method == 'descending' and i==1 then new_method = 'ascending' end end end - if found then + if found_index then --remove this and shuffle everything before it up by 1: - for j = i, 2, -1 do + for j = found_index, 2, -1 do sorting_pref[j] = Utils.deepcopy(sorting_pref[j-1]) --deepcopy just as I'm slightly unsure about refernces here end else --prepend: for j = #sorting_pref + 1, 2, -1 do - sorting_pref[j] = Utils.deepcopy(sorting_pref[j-1]) --deepcopy just as I'm slightly unsure about refernces here + sorting_pref[j] = Utils.deepcopy(sorting_pref[j-1]) --deepcopy just as I'm slightly unsure about references here end end - sorting_pref[1] = {column = column, method = new_method} + sorting_pref[1] = {column = element_to_column[name], method = new_method} score_gui({player = player, frame = frame}) return diff --git a/maps/pirates/interface.lua b/maps/pirates/interface.lua index af48b239..b234618b 100644 --- a/maps/pirates/interface.lua +++ b/maps/pirates/interface.lua @@ -1272,15 +1272,17 @@ local function event_on_built_entity(event) entity.time_to_live = entity.force.ghost_time_to_live end - if memory.boat and memory.boat.surface_name and player.surface == game.surfaces[memory.boat.surface_name] then + if memory.boat and memory.boat.surface_name and player.surface == game.surfaces[memory.boat.surface_name] and entity.position then if (entity.type and (entity.type == 'underground-belt')) or (entity.name == 'entity-ghost' and entity.ghost_type and (entity.ghost_type == 'underground-belt')) then - -- if (entity.type and (entity.type == 'underground-belt' or entity.type == 'pipe-to-ground')) or (entity.name == 'entity-ghost' and entity.ghost_type and (entity.ghost_type == 'underground-belt' or entity.ghost_type == 'pipe-to-ground')) then - if not (entity.name and entity.name == 'entity-ghost') then - player.insert{name = entity.name, count = 1} + if Boats.on_boat(memory.boat, entity.position) then + -- if (entity.type and (entity.type == 'underground-belt' or entity.type == 'pipe-to-ground')) or (entity.name == 'entity-ghost' and entity.ghost_type and (entity.ghost_type == 'underground-belt' or entity.ghost_type == 'pipe-to-ground')) then + if not (entity.name and entity.name == 'entity-ghost') then + player.insert{name = entity.name, count = 1} + end + entity.destroy() + Common.notify_player(player, 'Undergrounds can\'t be built on the boat, due to conflicts with the boat movement code.') + return end - entity.destroy() - Common.notify_player(player, 'Undergrounds can\'t be built on the overworld, due to conflicts with the boat movement code.') - return end end diff --git a/maps/pirates/loot.lua b/maps/pirates/loot.lua index 2c747d26..eef9c5c4 100644 --- a/maps/pirates/loot.lua +++ b/maps/pirates/loot.lua @@ -13,8 +13,10 @@ function Public.buried_treasure_loot() local ret local rng = Math.random(1000) - if rng <= 150 then + if rng <= 100 then ret = {name = 'steel-plate', count = 150} + elseif rng <= 150 then + ret = {name = 'flying-robot-frame', count = 30} elseif rng <= 200 then ret = {name = 'construction-robot', count = 15} elseif rng <= 330 then diff --git a/maps/pirates/main.lua b/maps/pirates/main.lua index 7fc374a2..c01c4371 100644 --- a/maps/pirates/main.lua +++ b/maps/pirates/main.lua @@ -60,7 +60,7 @@ local function on_init() Autostash.bottom_button(true) BottomFrame.reset() BottomFrame.activate_custom_buttons(true) - BottomFrame.bottom_right(true) + -- BottomFrame.bottom_right(true) local mgs = game.surfaces['nauvis'].map_gen_settings mgs.width = 16 @@ -208,8 +208,11 @@ local function crew_tick() end if memory.captain_accrued_time_data and memory.playerindex_captain then - if (not memory.captain_accrued_time_data[memory.playerindex_captain]) then memory.captain_accrued_time_data[memory.playerindex_captain] = 0 end - memory.captain_accrued_time_data[memory.playerindex_captain] = memory.captain_accrued_time_data[memory.playerindex_captain] + 1 + local player = game.players[memory.playerindex_captain] + if player and player.name then + if (not memory.captain_accrued_time_data[player.name]) then memory.captain_accrued_time_data[player.name] = 0 end + memory.captain_accrued_time_data[player.name] = memory.captain_accrued_time_data[player.name] + 1 + end end if destination.dynamic_data.time_remaining and destination.dynamic_data.time_remaining > 0 then diff --git a/maps/pirates/ores.lua b/maps/pirates/ores.lua index 28bd08d5..9fa58ed3 100644 --- a/maps/pirates/ores.lua +++ b/maps/pirates/ores.lua @@ -164,6 +164,7 @@ function Public.draw_noisy_ore_patch(surface, position, name, budget, radius_squ end end + --@FIXME: Hardcode positions instead, ordered by distance from origin local spiral_layer = 0 local outwards_spiral_x = 0 local outwards_spiral_y = 0 diff --git a/maps/pirates/overworld.lua b/maps/pirates/overworld.lua index fb0e0179..ce727e13 100644 --- a/maps/pirates/overworld.lua +++ b/maps/pirates/overworld.lua @@ -125,6 +125,7 @@ function Public.generate_overworld_destination(p) if type == Surfaces.enum.ISLAND then local scope = Surfaces[Surfaces.enum.ISLAND][subtype] + --@FIXME: Common.activecrewcount() shouldn't be used here, it should be sensitive to the playercount when you arrive on the island local playercount = Common.activecrewcount() local static_params = Utils.deepcopy(scope.Data.static_params_default) @@ -562,10 +563,10 @@ function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves if memory.overworldx % 40 == 0 then local modal_captain = nil local modal_captain_time = 0 - for player, time in pairs(memory.captain_accrued_time_data) do + for name, time in pairs(memory.captain_accrued_time_data) do if time > modal_captain_time then modal_captain_time = time - modal_captain = player + modal_captain = name end end Highscore.write_score(memory.secs_id, memory.name, modal_captain, memory.completion_time or 0, memory.overworldx, CoreData.version_float, memory.difficulty, memory.capacity) diff --git a/maps/pirates/structures/boats/raft/data.lua b/maps/pirates/structures/boats/raft/data.lua index 5e9f27dd..f48f254e 100644 --- a/maps/pirates/structures/boats/raft/data.lua +++ b/maps/pirates/structures/boats/raft/data.lua @@ -32,13 +32,13 @@ Public.areas_offleft = { } Public.entities = { inaccessible = { - pos = { x = -9, y = 0}, + pos = { x = -7.5, y = 0}, bp_str = [[0eNqV08sOwiAQBdB/mTU1ltIXv2KMqXZSSdqhKfhoDP9uQRcmsmF5k7mHWQwvOI83nBdFFuQLDHVzZnU2LKr3+QkyZ7CCbB0DddFkQB62MTVQN/oBu84IEpTFCRhQN/n00LpHyi5XNBZ8kXr0kjsyQLLKKvw4Iawnuk1nXMJTMYHBrM1W0vRdab8rw1L5rnSO/TE8kdnHmSKRKeKMSGR4nCkTmTLOVImMiDN1IlPHmSaRqeJMm8g0ntluMVyt/PkBDO64mFDgTS7qlteiqETLG+fekGkHZg==]], }, } Public.landingtrack = { - offset = {x = 4, y = -7}, + offset = {x = 4.5, y = -7}, bp = [[0eNqV2M1qwkAYheF7mXWE+eZ/civFhdVBBjQJSSwVyb3XVBddtMV3JYHjBJ85m+NNvZ8uZRhrN6v2pqZuN2zmfnMc62F9/lStmEZd7x9+aVTd992k2rd7sB673WmNzNehqFbVuZxVo7rdeX265/ZjmYtav9QdynrOsm3UXE/lccDQT3Wuffd8y+b5Gr38dsafcWFxA0+neQvz7tW8MBxhOMJwBOIIxBGIoxmOZjia4WiIoyGOZjgZ2WREk5FMZjCZuWTGkhBLQiwJsSTGkhhLYiwRsUTEEhFLZCyRsUTGEhBLQCwBsQTGEhhLYCwesXjE4hGLZyyesXjG4hCLQywOsTjG4hiLYywWsVjEYhHLI21Rmv1Kj9IBpSNKJ5TO7HbgZbLbFHadwu7z5dqyWcJWCRslBtXWoNoaVFuDamtQbQ2qrUG1Nay2htUWbkY4GeliZJuITSK2iFBtBdVWUG0F1VZQbQXVVlBthdVWWG3pmod79Z/abpvHv0btj/+gGvVRxun7AJPExWyiDc5pa5blC6gg570=]], } diff --git a/maps/pirates/structures/boats/sloop/data.lua b/maps/pirates/structures/boats/sloop/data.lua index 92aea114..303179b1 100644 --- a/maps/pirates/structures/boats/sloop/data.lua +++ b/maps/pirates/structures/boats/sloop/data.lua @@ -157,9 +157,9 @@ Public.deck_whitebelts_lrtp_order = { {x = -52.5, y = 11.5, direction = defines.direction.south, type = 'output'}, {x = -51.5, y = 11.5, direction = defines.direction.south, type = 'output'}, {x = -50.5, y = 11.5, direction = defines.direction.south, type = 'output'}, - {x = -17.5, y = 11.5, direction = defines.direction.north, type = 'input'}, - {x = -16.5, y = 11.5, direction = defines.direction.north, type = 'input'}, - {x = -15.5, y = 11.5, direction = defines.direction.north, type = 'input'}, + {x = -17.5, y = 11.5, direction = defines.direction.north, type = 'output'}, + {x = -16.5, y = 11.5, direction = defines.direction.north, type = 'output'}, + {x = -15.5, y = 11.5, direction = defines.direction.north, type = 'output'}, } Public.crewname_rendering_position = {x = -67, y = -18.5} diff --git a/maps/pirates/surfaces/hold.lua b/maps/pirates/surfaces/hold.lua index c1ea3232..7d4ffbbf 100644 --- a/maps/pirates/surfaces/hold.lua +++ b/maps/pirates/surfaces/hold.lua @@ -52,9 +52,9 @@ Public[enum.INITIAL].Data.hold_whitebelts_lrtp_order = { {x = -18.5, y = 21.5, direction = defines.direction.south, type = 'input'}, {x = -17.5, y = 21.5, direction = defines.direction.south, type = 'input'}, - {x = 17.5, y = 21.5, direction = defines.direction.south, type = 'output'}, - {x = 18.5, y = 21.5, direction = defines.direction.south, type = 'output'}, - {x = 19.5, y = 21.5, direction = defines.direction.south, type = 'output'}, + {x = 17.5, y = 21.5, direction = defines.direction.south, type = 'input'}, + {x = 18.5, y = 21.5, direction = defines.direction.south, type = 'input'}, + {x = 19.5, y = 21.5, direction = defines.direction.south, type = 'input'}, } Public[enum.SECONDARY] = {} diff --git a/maps/pirates/tick_functions.lua b/maps/pirates/tick_functions.lua index aa699557..440d3710 100644 --- a/maps/pirates/tick_functions.lua +++ b/maps/pirates/tick_functions.lua @@ -46,7 +46,7 @@ function Public.prevent_unbarreling_off_ship(tickinterval) local r = a.get_recipe() if r and r.subgroup and r.subgroup.name and r.subgroup.name == 'fill-barrel' and (not (r.name and r.name == 'fill-water-barrel')) then if not Boats.on_boat(boat, a.position) then - Common.notify_force(game.forces[memory.force_name], 'Nope: Can\'t barrel fluids offboard.') + Common.notify_force(game.forces[memory.force_name], 'Barrelling recipe removed; barrels are too heavy to carry back to the ship.') a.set_recipe('fill-water-barrel') end end