1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
This commit is contained in:
danielmartin0 2022-05-29 12:43:31 +01:00
parent fa1a5ff5a6
commit f73765515b
16 changed files with 44 additions and 53 deletions

View File

@ -1,10 +1,10 @@
local Public = {}
local Math = require 'maps.pirates.math'
local Raffle = require 'maps.pirates.raffle'
-- local Raffle = require 'maps.pirates.raffle'
-- local Memory = require 'maps.pirates.memory'
local Common = require 'maps.pirates.common'
local Utils = require 'maps.pirates.utils_local'
-- local Utils = require 'maps.pirates.utils_local'
local _inspect = require 'utils.inspect'.inspect
-- this file is an API to all the balance tuning knobs

View File

@ -167,7 +167,6 @@ end
function Public.parrot_speak(force, message)
force.print({"", {'pirates.notify_parrot'}, ' ', message}, CoreData.colors.parrot)
local memory = Memory.get_crew_memory()
Server.to_discord_embed_raw({"", {'pirates.notify_parrot'}, ' ', message}, true)
end

View File

@ -405,7 +405,6 @@ function Public.leave_crew(player, to_lobby, quiet)
if char and char.valid then
-- local p = char.position
-- local surface_name = char.surface.name
local message
if not quiet then
Common.notify_force(player.force, {'pirates.crew_leave', player.name})
-- else
@ -868,7 +867,7 @@ function Public.reset_crew_and_enemy_force(id)
crew_force.recipes['cannon-shell'].enabled = false
crew_force.recipes['explosive-cannon-shell'].enabled = false
--@TRYING this out:
crew_force.technologies['coal-liquefaction'].enabled = true

View File

@ -145,7 +145,7 @@ function Public.toggle_window(player)
flow3.tooltip = {'pirates.gui_crew_window_crewmembers_resign_as_officer_tooltip'}
flow2 = GuiCommon.flow_add_section(flow, 'spectators', {'pirates.gui_crew_window_spectators'})
flow3 = flow2.add({
name = 'spectators_listbox',

View File

@ -238,7 +238,7 @@ function Public.covered_wooden_chest_loot()
end
function Public.covered_wooden_chest_loot_1()
return {
{name = 'iron-plate', count = 180},
{name = 'copper-plate', count = 180}
@ -246,7 +246,7 @@ function Public.covered_wooden_chest_loot_1()
end
function Public.covered_wooden_chest_loot_2()
return Common.raffle_from_processed_loot_data(Common.processed_loot_data(Public.chest_loot_data_raw), 2,
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * (12/100 + Common.game_completion_progress()))))
end

View File

@ -1,12 +1,12 @@
-- local Math = require 'maps.pirates.math'
local Memory = require 'maps.pirates.memory'
-- local Memory = require 'maps.pirates.memory'
local _inspect = require 'utils.inspect'.inspect
-- local Token = require 'utils.token'
-- local CoreData = require 'maps.pirates.coredata'
-- local Task = require 'utils.task'
-- local Balance = require 'maps.pirates.balance'
local Common = require 'maps.pirates.common'
-- local Common = require 'maps.pirates.common'
-- local Utils = require 'maps.pirates.utils_local'
local Public = {}

View File

@ -134,7 +134,6 @@ function Public.assign_class(player_index, class, self_assigned)
local force = memory.force
if force and force.valid then
local message
if self_assigned then
Common.notify_force_light(force,{'pirates.class_take_spare', player.name, Public.display_form(memory.classes_table[player_index]), Public.explanation(memory.classes_table[player_index])})
else

View File

@ -284,7 +284,7 @@ function Public.pass_captainhood(player, player_to_pass_to)
if not (force and force.valid) then return end
local message = {'pirates.roles_pass_captainhood', player.name, player_to_pass_to.name}
Common.notify_force(force, message)
@ -379,7 +379,7 @@ function Public.assign_captain_based_on_priorities(excluded_player_index)
else
message = {'pirates.roles_ask_player_about_captainhood_variant_3', captain_name}
end
Common.notify_force_light(force, message)
-- Server.to_discord_embed_raw('[' .. memory.name .. ']' .. CoreData.comfy_emojis.spurdo .. ' ' .. message)
memory.captain_acceptance_timer = 72 --tuned

View File

@ -973,7 +973,7 @@ local function process_entity_on_boat(memory, boat, newsurface, newposition, vec
e.player.teleport(newsurface.find_non_colliding_position('character', p, 1.2, 0.2) or p, newsurface)
end
end
elseif Utils.contains(CoreData.unteleportable_names, name) or (name == 'entity-ghost' and Utils.contains(CoreData.unteleportable_names, e.ghost_name)) then
process_entity_on_boat_unteleportable(memory, boat, newsurface, vector, players_just_offside, oldsurface_name, newsurface_name, e, name)
else

View File

@ -3,11 +3,11 @@ local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Balance = require 'maps.pirates.balance'
local Common = require 'maps.pirates.common'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
-- 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 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'
local Classes = require 'maps.pirates.roles.classes'
@ -20,7 +20,6 @@ Public.Data = require 'maps.pirates.structures.quest_structures.furnace1.data'
function Public.create_step1_entities()
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
local surface = game.surfaces[destination.surface_name]

View File

@ -3,11 +3,11 @@ local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Balance = require 'maps.pirates.balance'
local Common = require 'maps.pirates.common'
local CoreData = require 'maps.pirates.coredata'
local Utils = require 'maps.pirates.utils_local'
-- 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 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'
local Classes = require 'maps.pirates.roles.classes'
@ -18,7 +18,6 @@ Public.Data = require 'maps.pirates.structures.quest_structures.market1.data'
function Public.create_step1_entities()
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
local surface = game.surfaces[destination.surface_name]

View File

@ -1,17 +1,17 @@
local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Balance = require 'maps.pirates.balance'
-- local Balance = require 'maps.pirates.balance'
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 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'
local Classes = require 'maps.pirates.roles.classes'
local Loot = require 'maps.pirates.loot'
-- local Raffle = require 'maps.pirates.raffle'
-- local ShopCovered = require 'maps.pirates.shop.covered'
-- local Classes = require 'maps.pirates.roles.classes'
-- local Loot = require 'maps.pirates.loot'
local Public = {}
@ -45,8 +45,6 @@ function Public.initialise_cached_quest_structure(position, quest_structure_type
local destination = Common.current_destination()
local surface = game.surfaces[destination.surface_name]
local special_to_return
if quest_structure_type == enum.MARKET1 then
local structurePath = Public[enum.MARKET1]
@ -190,8 +188,6 @@ function Public.initialise_cached_quest_structure(position, quest_structure_type
end
log('quest structure position: ' .. position.x .. ', ' .. position.y)
return special_to_return
end
@ -239,11 +235,11 @@ function Public.tick_quest_structure_entry_price_check()
if not (blue_chest and blue_chest.valid and red_chest and red_chest.valid) then return end
local blue_inv = quest_structure_data.blue_chest.get_inventory(defines.inventory.chest)
local red_inv = quest_structure_data.red_chest.get_inventory(defines.inventory.chest)
local blue_contents = blue_inv.get_contents()
local entry_price = quest_structure_data.entry_price
local got = 0
for k, v in pairs(blue_contents) do
if quest_structure_data.state == 'covered' and k == entry_price.name then
@ -254,7 +250,7 @@ function Public.tick_quest_structure_entry_price_check()
blue_inv.remove({name = k, count = v});
end
end
if quest_structure_data.state == 'covered' then
if got >= entry_price.count then
blue_inv.remove({name = entry_price.name, count = entry_price.count});
@ -263,7 +259,7 @@ function Public.tick_quest_structure_entry_price_check()
rendering.destroy(quest_structure_data.rendering2)
rendering.destroy(quest_structure_data.rendering3)
rendering.destroy(quest_structure_data.rendering4)
local special = Utils.deepcopy(Public[enum.MARKET1].Data.step2)
special.position = quest_structure_data.position
@ -290,12 +286,12 @@ function Public.tick_quest_structure_entry_price_check()
red_invs[1] = quest_structure_data.red_chests[1].get_inventory(defines.inventory.chest)
red_invs[2] = quest_structure_data.red_chests[2].get_inventory(defines.inventory.chest)
red_invs[3] = quest_structure_data.red_chests[3].get_inventory(defines.inventory.chest)
local blue_contents = {}
blue_contents[1] = blue_invs[1].get_contents()
blue_contents[2] = blue_invs[2].get_contents()
blue_contents[3] = blue_invs[3].get_contents()
local entry_price = quest_structure_data.entry_price --fields {name, count, batchSize, batchRawMaterials}
if quest_structure_data.state == 'covered' then
@ -358,10 +354,10 @@ function Public.tick_quest_structure_entry_price_check()
rendering.destroy(quest_structure_data.rendering3)
rendering.destroy(quest_structure_data.rendering4)
rendering.destroy(quest_structure_data.rendering5)
local special = Utils.deepcopy(Public[enum.FURNACE1].Data.step2)
special.position = quest_structure_data.position
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
else
if quest_structure_data.rendering1 then

View File

@ -394,7 +394,7 @@ function Public.nth_hold_connect_linked_belts(nth) --assumes both are in standar
rendering.set_text(boat.hold_helper_renderings[nth-1][1], 'to -' .. nth)
rendering.set_text(boat.hold_helper_renderings[nth][2], 'from -' .. nth-1)
rendering.set_text(boat.hold_helper_renderings[nth-1][2], 'to -' .. nth)
connections = {
{5,9},
{6,10},

View File

@ -2,7 +2,7 @@
local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Balance = require 'maps.pirates.balance'
local Structures = require 'maps.pirates.structures.structures'
-- local Structures = require 'maps.pirates.structures.structures'
local Boats = require 'maps.pirates.structures.boats.boats'
local Common = require 'maps.pirates.common'
local CoreData = require 'maps.pirates.coredata'
@ -178,10 +178,10 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid)
points_to_avoid[#points_to_avoid + 1] = {x=p.x, y=p.y, r=11}
if ore == 'crude-oil' then
local count = Math.max(1, Math.ceil((destination.static_params.abstract_ore_amounts[ore]/3)^(1/2)))
local amount = Common.oil_abstract_to_real(destination.static_params.abstract_ore_amounts[ore]) / count
for i = 1, count do
local p2 = {p.x + Math.random(-7, 7), p.y + Math.random(-7, 7)}
local whilesafety = 0
@ -189,16 +189,16 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid)
p2 = {p.x + Math.random(-7, 7), p.y + Math.random(-7, 7)}
whilesafety = whilesafety + 1
end
surface.create_entity{name = 'crude-oil', position = p2, amount = amount}
end
destination.dynamic_data.ore_types_spawned[ore] = true
else
local amount = Common.ore_abstract_to_real(destination.static_params.abstract_ore_amounts[ore])
local placed = Ores.draw_noisy_ore_patch(surface, p, ore, amount, 10000, 30, true, true)
if placed > 0 then
destination.dynamic_data.ore_types_spawned[ore] = true
end

View File

@ -123,7 +123,7 @@ function Public.generate_silo_setup_position()
end
Common.ensure_chunks_at(surface, p_silo, 1)
surface.set_tiles(tiles, true)
return p_silo
end
end

View File

@ -15,7 +15,7 @@ local Cabin = require 'maps.pirates.surfaces.cabin'
local Islands = require 'maps.pirates.surfaces.islands.islands'
local Crowsnest = require 'maps.pirates.surfaces.crowsnest'
local Quest = require 'maps.pirates.quest'
local Parrot = require 'maps.pirates.parrot'
-- local Parrot = require 'maps.pirates.parrot'
local ShopMerchants = require 'maps.pirates.shop.merchants'
local SurfacesCommon = require 'maps.pirates.surfaces.common'
-- local Roles = require 'maps.pirates.roles.roles'