mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-01 13:08:05 +02:00
Warning fixes
This commit is contained in:
parent
595f6d2cf3
commit
9dc0a145ed
@ -819,7 +819,7 @@ local function event_on_player_mined_entity(event)
|
||||
elseif entity.type == 'fish' then
|
||||
if not event.buffer then return end
|
||||
|
||||
local fish_amount = 0
|
||||
local fish_amount
|
||||
local to_give = {}
|
||||
|
||||
if class == Classes.enum.MASTER_ANGLER then
|
||||
@ -1694,17 +1694,19 @@ function Public.event_on_chunk_generated(event)
|
||||
end
|
||||
end
|
||||
|
||||
chunk_structures_fn{
|
||||
true_left_top = chunk_left_top,
|
||||
left_top = Utils.psum{chunk_left_top, {1, terraingen_coordinates_offset}},
|
||||
noise_generator = noise_generator,
|
||||
static_params = static_params,
|
||||
specials = specials,
|
||||
entities = entities,
|
||||
seed = seed,
|
||||
other_map_generation_data = other_map_generation_data,
|
||||
biter_base_density_scale = Balance.biter_base_density_scale()
|
||||
}
|
||||
if chunk_structures_fn then
|
||||
chunk_structures_fn{
|
||||
true_left_top = chunk_left_top,
|
||||
left_top = Utils.psum{chunk_left_top, {1, terraingen_coordinates_offset}},
|
||||
noise_generator = noise_generator,
|
||||
static_params = static_params,
|
||||
specials = specials,
|
||||
entities = entities,
|
||||
seed = seed,
|
||||
other_map_generation_data = other_map_generation_data,
|
||||
biter_base_density_scale = Balance.biter_base_density_scale()
|
||||
}
|
||||
end
|
||||
|
||||
local tiles_corrected = {}
|
||||
for i = 1, #tiles do
|
||||
|
@ -1589,4 +1589,20 @@ function Public.pick_random_price(tier, scale, tech_tier)
|
||||
return price
|
||||
end
|
||||
|
||||
-- This method should exist in table but it doesn't for some reason on comfy repo so I copied it to here
|
||||
function Public.get_random_dictionary_entry(t, key)
|
||||
local target_index = Math.random(1, table_size(t))
|
||||
local count = 1
|
||||
for k, v in pairs(t) do
|
||||
if target_index == count then
|
||||
if key then
|
||||
return k
|
||||
else
|
||||
return v
|
||||
end
|
||||
end
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
@ -346,7 +346,7 @@ function Public.toggle_window(player)
|
||||
|
||||
-- PRIVATE RUN ELEMENTS --
|
||||
|
||||
flow5 = flow4.add({
|
||||
flow4.add({
|
||||
name = 'private_checkbox',
|
||||
type = 'checkbox',
|
||||
caption = {'pirates.gui_runs_proposal_maker_private'},
|
||||
|
@ -111,7 +111,7 @@ local function on_init()
|
||||
|
||||
global_memory.active_crews_cap = Common.activeCrewsCap
|
||||
global_memory.private_run_cap = Common.private_run_cap
|
||||
|
||||
|
||||
global_memory.minimumCapacitySliderValue = Common.minimumCapacitySliderValue
|
||||
|
||||
Surfaces.Lobby.create_starting_dock_surface()
|
||||
|
@ -1043,7 +1043,7 @@ local function teleport_handle_wake_tiles(boat, dummyboat, newsurface_name, olds
|
||||
for _, area in pairs(wakeareas) do
|
||||
for _, p in pairs(Common.central_positions_within_area(area, adjustednewposition)) do
|
||||
local t = old_water_tile
|
||||
if static_params and static_params.deepwater_xposition and (p.x <= static_params.deepwater_xposition - 0.5) then
|
||||
if static_params and static_params.deepwater_xposition and (p.x <= static_params.deepwater_xposition - 0.5) then
|
||||
if t == 'water' then
|
||||
t = 'deepwater'
|
||||
else
|
||||
|
@ -278,7 +278,7 @@ function Public.entry_price()
|
||||
local item = Raffle.LambdaRaffle(Public.entry_price_data_raw, lambda)
|
||||
|
||||
if not item then
|
||||
item = table.get_random_dictionary_entry(Public.entry_price_data_raw, true)
|
||||
item = Common.get_random_dictionary_entry(Public.entry_price_data_raw, true)
|
||||
end
|
||||
|
||||
local batchSize = Public.entry_price_data_raw[item].itemBatchSize
|
||||
|
@ -277,7 +277,7 @@ function Public.entry_price()
|
||||
local item = Raffle.LambdaRaffle(Public.entry_price_data_raw, lambda)
|
||||
|
||||
if not item then
|
||||
item = table.get_random_dictionary_entry(Public.entry_price_data_raw, true)
|
||||
item = Common.get_random_dictionary_entry(Public.entry_price_data_raw, true)
|
||||
end
|
||||
|
||||
local raw_materials = Public.entry_price_data_raw[item].raw_materials
|
||||
|
@ -19,11 +19,10 @@ Public.Data = require 'maps.pirates.surfaces.islands.cave.data'
|
||||
--lab-dark-1 > position has been copied
|
||||
--lab-dark-2 > position has been visited
|
||||
function Public.reveal(cave_miner, surface, source_surface, position, brushsize)
|
||||
local tile = source_surface.get_tile(position)
|
||||
if not tile.valid then return end
|
||||
if tile.name == 'lab-dark-2' then
|
||||
return
|
||||
end
|
||||
local source_tile = source_surface.get_tile(position)
|
||||
if not source_tile.valid then return end
|
||||
if source_tile.name == 'lab-dark-2' then return end
|
||||
|
||||
local tiles = {}
|
||||
local copied_tiles = {}
|
||||
local i = 0
|
||||
@ -51,7 +50,7 @@ function Public.reveal(cave_miner, surface, source_surface, position, brushsize)
|
||||
|
||||
local boat_height = Math.max(BoatData.height, 15) -- even if boat height is smaller, we need to be at least 10+ just so formulas below play out nicely
|
||||
local spawn_radius = boat_height + 15
|
||||
local entrance_radius = boat_height + 45
|
||||
-- local entrance_radius = boat_height + 45
|
||||
local river_width = boat_height + 40
|
||||
|
||||
-- Don't copy river upon which ship arrives + ship entrance
|
||||
@ -187,14 +186,14 @@ function Public.terrain(args)
|
||||
end
|
||||
|
||||
|
||||
function Public.chunk_structures(args)
|
||||
-- function Public.chunk_structures(args)
|
||||
|
||||
end
|
||||
-- end
|
||||
|
||||
-- Launching rocket in caves sounds silly
|
||||
function Public.generate_silo_setup_position(points_to_avoid)
|
||||
-- function Public.generate_silo_setup_position(points_to_avoid)
|
||||
|
||||
end
|
||||
-- end
|
||||
|
||||
local function on_player_changed_position(event)
|
||||
if not event.player_index then return end
|
||||
|
@ -23,7 +23,7 @@ local function spawn_market(args, is_main)
|
||||
--if not (destination_data and destination_data.dynamic_data and destination_data.dynamic_data.cave_miner) then return end
|
||||
if not (destination_data and destination_data.dynamic_data) then return end
|
||||
|
||||
local offers = {}
|
||||
local offers
|
||||
if is_main then
|
||||
offers = ShopCovered.market_generate_coin_offers(6)
|
||||
if destination_data.static_params.class_for_sale then
|
||||
@ -53,7 +53,7 @@ end
|
||||
|
||||
local biomes = {}
|
||||
|
||||
function biomes.oasis(args, square_distance, noise)
|
||||
function biomes.oasis(args, noise)
|
||||
local seed = args.seed
|
||||
local position = args.p
|
||||
if noise > 0.83 then
|
||||
@ -81,7 +81,7 @@ function biomes.void(args)
|
||||
args.tiles[#args.tiles + 1] = {name = 'out-of-map', position = args.p}
|
||||
end
|
||||
|
||||
function biomes.pond_cave(args, square_distance, noise)
|
||||
function biomes.pond_cave(args, noise)
|
||||
local seed = args.seed
|
||||
local position = args.p
|
||||
local noise_2 = GetNoise('cm_ponds', position, seed)
|
||||
@ -128,7 +128,7 @@ function biomes.spawn(args, square_distance)
|
||||
end
|
||||
end
|
||||
|
||||
function biomes.ocean(args, square_distance, noise)
|
||||
function biomes.ocean(args, noise)
|
||||
if noise > 0.66 then
|
||||
args.tiles[#args.tiles + 1] = {name = 'deepwater', position = args.p}
|
||||
Public.Data.spawn_fish(args);
|
||||
@ -143,7 +143,7 @@ function biomes.ocean(args, square_distance, noise)
|
||||
place_rock(args)
|
||||
end
|
||||
|
||||
function biomes.worm_desert(args, square_distance, noise)
|
||||
function biomes.worm_desert(args, noise)
|
||||
local seed = args.seed
|
||||
local position = args.p
|
||||
|
||||
@ -178,7 +178,7 @@ function biomes.worm_desert(args, square_distance, noise)
|
||||
end
|
||||
end
|
||||
|
||||
function biomes.cave(args, square_distance, noise)
|
||||
function biomes.cave(args, square_distance)
|
||||
local seed = args.seed
|
||||
local position = args.p
|
||||
|
||||
@ -278,31 +278,31 @@ local function get_biome(args)
|
||||
-- Actual cave generation below
|
||||
local cm_ocean = GetNoise('cm_ocean', position, args.seed + 100000)
|
||||
if cm_ocean > 0.6 then
|
||||
return biomes.ocean, d, cm_ocean
|
||||
return biomes.ocean, cm_ocean
|
||||
end
|
||||
|
||||
local noise = GetNoise('cave_miner_01', position, args.seed)
|
||||
local abs_noise = Math.abs(noise)
|
||||
if abs_noise < 0.075 then
|
||||
return biomes.cave, d, noise
|
||||
return biomes.cave, d
|
||||
end
|
||||
|
||||
if abs_noise > 0.25 then
|
||||
noise = GetNoise('cave_rivers', position, args.seed)
|
||||
if noise > 0.72 then
|
||||
return biomes.oasis, d, noise
|
||||
return biomes.oasis, noise
|
||||
end
|
||||
if cm_ocean < -0.6 then
|
||||
return biomes.worm_desert, d, cm_ocean
|
||||
return biomes.worm_desert, cm_ocean
|
||||
end
|
||||
if noise < -0.5 then
|
||||
return biomes.pond_cave, d, noise
|
||||
return biomes.pond_cave, noise
|
||||
end
|
||||
end
|
||||
|
||||
noise = GetNoise('cave_miner_02', position, args.seed)
|
||||
if Math.abs(noise) < 0.085 then
|
||||
return biomes.cave, d, noise
|
||||
return biomes.cave, d
|
||||
end
|
||||
|
||||
return biomes.void
|
||||
@ -321,14 +321,14 @@ end
|
||||
|
||||
|
||||
-- Finding a spot for structures is very hard (it might cause structures to spawn in weird locations, like ship)
|
||||
function Public.chunk_structures(args)
|
||||
-- function Public.chunk_structures(args)
|
||||
|
||||
end
|
||||
-- end
|
||||
|
||||
-- Launching rocket in caves sounds silly (as well as hard to pick position for rocket)
|
||||
function Public.generate_silo_setup_position(points_to_avoid)
|
||||
-- function Public.generate_silo_setup_position(points_to_avoid)
|
||||
|
||||
end
|
||||
-- end
|
||||
|
||||
|
||||
return Public
|
@ -275,6 +275,8 @@ function Public.spawn_silo_setup(points_to_avoid)
|
||||
local subtype = destination.subtype
|
||||
local force = memory.force
|
||||
|
||||
if not Public[subtype].generate_silo_setup_position then return end
|
||||
|
||||
local p_silo = Public[subtype].generate_silo_setup_position(points_to_avoid)
|
||||
if not p_silo then return end
|
||||
-- log(string.format("placing silo at x=%f, y = %f", p_silo.x, p_silo.y))
|
||||
|
Loading…
x
Reference in New Issue
Block a user