1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-24 03:47:58 +02:00

Merge branch 'v1.3' into develop

This commit is contained in:
danielmartin0 2022-05-26 12:48:02 +01:00
commit 243a9d53c1
19 changed files with 842 additions and 129 deletions

View File

@ -5,6 +5,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 Raffle = require 'maps.pirates.raffle'
local _inspect = require 'utils.inspect'.inspect
-- local Structures = require 'maps.pirates.structures.structures'
@ -532,7 +533,7 @@ function Public.generate_side_attack_target(surface, position)
for index, _ in pairs(entities) do
weights[#weights + 1] = 1 + Math.floor((#entities - index) / 2)
end
return Math.raffle(entities, weights)
return Raffle.raffle(entities, weights)
end
function Public.nearest_target(surface, position)

View File

@ -1,6 +1,7 @@
local Public = {}
local Math = require 'maps.pirates.math'
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'
@ -626,15 +627,160 @@ function Public.covered1_entry_price()
end
end
local res = Utils.deepcopy(Math.raffle(types, weights))
local res = Utils.deepcopy(Raffle.raffle(types, weights))
res.price.count = Math.ceil(res.price.count * Public.covered_entry_price_scale())
res.price.count = Math.ceil(res.price.count * Public.covered1_entry_price_scale())
for i, _ in pairs(res.raw_materials) do
res.raw_materials[i].count = Math.ceil(res.raw_materials[i].count * Public.covered_entry_price_scale() * (0.9 + 0.2 * Math.random()))
res.raw_materials[i].count = Math.ceil(res.raw_materials[i].count * Public.covered1_entry_price_scale() * (0.9 + 0.2 * Math.random()))
end
return res
end
function Public.covered2_entry_price_scale()
return 0.85 * (1 + 0.033 * (Common.overworldx()/40 - 1)) * ((1 + Public.crew_scale())^(1/3)) * Math.sloped(Common.difficulty_scale(), 1/2) --whilst resource scales tend to be held fixed with crew size, we account slightly for the fact that more players tend to handcraft more
end
Public.covered2EntryPriceData = {-- choose things which make interesting minifactories
['electric-mining-drill'] = {
overallWeight = 1,
minLambda = -0.75,
maxLambda = 0.75,
shape = 'bump',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 46, ['copper-plate'] = 9},
},
['fast-splitter'] = {
overallWeight = 1,
minLambda = -1,
maxLambda = 1,
shape = 'bump',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 92, ['copper-plate'] = 45},
},
['assembling-machine-1'] = {
overallWeight = 1,
minLambda = -1,
maxLambda = 1,
shape = 'bump',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 44, ['copper-plate'] = 9},
},
['filter-inserter'] = {
overallWeight = 1,
minLambda = 0,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 32, ['copper-plate'] = 24},
},
['programmable-speaker'] = {
overallWeight = 1,
minLambda = 0,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 18, ['copper-plate'] = 17},
},
['pump'] = {
overallWeight = 1,
minLambda = 0.05,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 1,
batchRawMaterials = {['iron-plate'] = 15},
},
['grenade'] = {
overallWeight = 1,
minLambda = 0.05,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 1,
batchRawMaterials = {['iron-plate'] = 5, ['coal'] = 10},
},
['assembling-machine-2'] = {
overallWeight = 1,
minLambda = 0.2,
maxLambda = 1.2,
shape = 'bump',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 160, ['copper-plate'] = 18},
},
['pumpjack'] = {
overallWeight = 1,
minLambda = 0.35,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 120, ['copper-plate'] = 15},
},
['oil-refinery'] = {
overallWeight = 1,
minLambda = 0.35,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 1,
batchRawMaterials = {['iron-plate'] = 115, ['copper-plate'] = 15, ['stone-brick'] = 10},
},
['chemical-plant'] = {
overallWeight = 1,
minLambda = 0.35,
maxLambda = 1,
shape = 'density',
enabled = true,
baseAmount = 500,
itemBatchSize = 2,
batchRawMaterials = {['iron-plate'] = 90, ['copper-plate'] = 15},
},
}
function Public.generateCovered2EntryPrice()
local lambda = Math.max(Math.min(Math.sloped(Common.difficulty_scale(),1/2) * Common.game_completion_progress(), 1), 0)
local item = Raffle.LambdaRaffle(Public.covered2EntryPriceData, lambda)
local batchSize = Public.covered2EntryPriceData[item].itemBatchSize
return {
name = item,
count = Math.ceil(
(0.9 + 0.2 * Math.random()) * Public.covered2EntryPriceData[item].baseAmount * Public.covered2_entry_price_scale() / batchSize
) * batchSize,
batchSize = batchSize,
batchRawMaterials = Public.covered2EntryPriceData[item].batchRawMaterials,
}
end
return Public

View File

@ -1,5 +1,6 @@
local Math = require 'maps.pirates.math'
local Raffle = require 'maps.pirates.raffle'
local Server = require 'utils.server'
local Utils = require 'maps.pirates.utils_local'
local CoreData = require 'maps.pirates.coredata'
@ -14,9 +15,10 @@ local _inspect = require 'utils.inspect'.inspect
local Public = {}
--@TODO: decide on snakecase vs camelcase
-- Public.active_crews_cap = 1
Public.active_crews_cap = 2
Public.minimum_capacity_slider_value = 1
Public.activeCrewsCap = 2
Public.minimumCapacitySliderValue = 1
Public.minimum_run_capacity_to_enforce_space_for = 32
-- auto-disbanding when there are no players left in the crew:
Public.autodisband_ticks = nil
@ -33,10 +35,10 @@ Public.mapedge_distance_from_boat_starting_position = 272 -- to accommodate hors
Public.deepwater_distance_from_leftmost_shore = 32
Public.lobby_spawnpoint = {x = -72, y = -8}
Public.quartermaster_range = 17
Public.quartermaster_range = 19
Public.allow_barreling_off_ship = true
Public.fraction_of_map_loaded_atsea = 1
Public.fraction_of_map_loaded_at_sea = 1
Public.map_loading_ticks_atsea = 68 * 60
Public.map_loading_ticks_atsea_maze = 80 * 60
Public.map_loading_ticks_atsea_dock = 20 * 60
@ -242,7 +244,7 @@ function Public.raffle_from_processed_loot_data(processed_loot_data, how_many, g
end
for _ = 1, how_many do
local loot = Math.raffle(loot_types, loot_weights)
local loot = Raffle.raffle(loot_types, loot_weights)
if loot then
local low = Math.max(1, Math.ceil(loot.min_count))
local high = Math.max(1, Math.ceil(loot.max_count))

View File

@ -114,13 +114,13 @@ Public.difficulty_options = {
{value = 0.6, icon = 'item/firearm-magazine', text = 'Easy', associated_color = {r = 50, g = 255, b = 50}},
{value = 1.0, icon = 'item/piercing-rounds-magazine', text = 'Normal', associated_color = {r = 255, g = 255, b = 50}},
{value = 1.4, icon = 'item/uranium-rounds-magazine', text = 'Hard', associated_color = {r = 255, g = 50, b = 50}},
{value = 2.4, icon = 'item/atomic-bomb', text = 'Nightmare', associated_color = {r = 120, g = 35, b = 35}},
{value = 2.1, icon = 'item/atomic-bomb', text = 'Nightmare', associated_color = {r = 120, g = 35, b = 35}},
}
function Public.get_difficulty_name_from_value(difficulty_value)
-- Functions will reference this when given a difficulty value and want to present a difficulty name to the player; just make it consistent with the above
if difficulty_value <= 0.7 then
return 'Easy'
elseif difficulty_value < 1.3 then
elseif difficulty_value < 1.2 then
return 'Normal'
elseif difficulty_value <= 2 then
return 'Hard'

View File

@ -443,11 +443,11 @@ function Public.player_and_crew_state_bools(player)
if character_on_deck_bool then
local BoatData = Boats.get_scope(memory.boat).Data
on_deck_standing_near_loco_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.loco_pos)) < 3
on_deck_standing_near_loco_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.loco_pos)) < 2.5
on_deck_standing_near_cabin_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.cabin_car)) < 2.5
on_deck_standing_near_cabin_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.cabin_car)) < 2.0
on_deck_standing_near_crowsnest_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.crowsnest_center)) < 2.7
on_deck_standing_near_crowsnest_bool = Math.distance(player.character.position, Math.vector_sum(memory.boat.position, BoatData.crowsnest_center)) < 2.5
end
approaching_dock_bool = destination.type == Surfaces.enum.DOCK and memory.boat.state == Boats.enum_state.APPROACHING

View File

@ -477,7 +477,7 @@ function Public.full_update(player)
-- 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.minimum_capacity_slider_value)
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)

View File

@ -212,16 +212,16 @@ function Public.wooden_chest_loot()
local num = 1
return Public.chest_loot(num,
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * Common.game_completion_progress())) --enforce 0 to 1
)
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * Common.game_completion_progress())) --enforce 0 to 1
)
end
function Public.iron_chest_loot()
local num = 2
local loot = Public.chest_loot(num,
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * (5/100 + Common.game_completion_progress()))) --enforce 0 to 1
) --reward higher difficulties with better loot
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * (5/100 + Common.game_completion_progress())) ) --enforce 0 to 1
) --reward higher difficulties with better loot
loot[#loot + 1] = {name = 'coin', count = Math.random(500,1500)}
return loot
@ -231,12 +231,26 @@ function Public.covered_wooden_chest_loot()
local num = 2
local loot = Public.chest_loot(num,
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * (10/100 + Common.game_completion_progress()))) --enforce 0 to 1
) --reward higher difficulties with better loot
Math.max(0,Math.min(1, Math.sloped(Common.difficulty_scale(),1/2) * (15/100 + Common.game_completion_progress()) )) --enforce 0 to 1
) --reward higher difficulties with better loot
return loot
end
function Public.covered_wooden_chest_loot_1()
return {
{name = 'iron-plate', count = 180},
{name = 'copper-plate', count = 180}
}
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
function Public.stone_furnace_loot()
return {
{name = 'coal', count = 50},

View File

@ -97,8 +97,8 @@ local function on_init()
Common.init_game_settings(Balance.technology_price_multiplier)
global_memory.active_crews_cap = Common.active_crews_cap
global_memory.minimum_capacity_slider_value = Common.minimum_capacity_slider_value
global_memory.active_crews_cap = Common.activeCrewsCap
global_memory.minimumCapacitySliderValue = Common.minimumCapacitySliderValue
Surfaces.Lobby.create_starting_dock_surface()
local lobby = game.surfaces[CoreData.lobby_surface_name]

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@
-- local Balance = require 'maps.pirates.balance'
-- local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Raffle = require 'maps.pirates.raffle'
local CoreData = require 'maps.pirates.coredata'
local _inspect = require 'utils.inspect'.inspect
local Common = require 'maps.pirates.common'
@ -38,7 +39,7 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus)
if Utils.length(choices_to_prioitise) > 0 then
choice = choices_to_prioitise[Math.random(Utils.length(choices_to_prioitise))]
else
choice = Math.raffle2(choices_possible)
choice = Raffle.raffle2(choices_possible)
end
local placed

View File

@ -196,6 +196,31 @@ local place_dock_jetty_and_boats = Token.register(
function Public.choose_quest_structures(destination_data)
local subtype = destination_data.subtype
--@TODO: Finish writing this function
--@Package 'quest structures' into their own folder
local rng = Math.random(2)
if rng == 1 or subtype == Surfaces.Island.enum.WALKWAYS then
--Avoid furnace type on movement-restricted islands (like walkways)
local covered2_requirement = Balance.generateCovered2EntryPrice()
-- market
destination_data.dynamic_data.quest_structure_requirements = {}
destination_data.dynamic_data.quest_structure_requirements[] = covered2_requirement
else
-- furnace
local covered2_requirement = Balance.generateCovered2EntryPrice()
destination_data.dynamic_data.covered2_requirement[] = covered2_requirement
end
end
function Public.progress_to_destination(destination_index)
local memory = Memory.get_crew_memory()
if memory.game_lost then return end
@ -215,8 +240,7 @@ function Public.progress_to_destination(destination_index)
local initial_boatspeed, starting_boatposition
if type == Surfaces.enum.ISLAND then --moved from overworld generation, so that it updates properly
local covered1_requirement = Balance.covered1_entry_price()
destination_data.dynamic_data.covered1_requirement = covered1_requirement
Public.choose_quest_structures(destination_data)
end
if type == Surfaces.enum.DOCK then

View File

@ -5,6 +5,7 @@ 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 Raffle = require 'maps.pirates.raffle'
-- local Loot = require 'maps.pirates.loot'
local CoreData = require 'maps.pirates.coredata'
local _inspect = require 'utils.inspect'.inspect
@ -331,7 +332,7 @@ function Public.generate_flow_quest()
end
end
return Math.raffle(v, w)
return Raffle.raffle(v, w)
end
@ -398,7 +399,7 @@ function Public.generate_resourcecount_quest()
end
end
return Math.raffle(v, w)
return Raffle.raffle(v, w)
end

98
maps/pirates/raffle.lua Normal file
View File

@ -0,0 +1,98 @@
local Math = require 'maps.pirates.math'
local Public = {}
function Public.raffle(values, weights) --arguments of the form {[a] = A, [b] = B, ...} and {[a] = a_weight, [b] = b_weight, ...} or just {a,b,c,...} and {1,2,3...}
local total_weight = 0
for k,w in pairs(weights) do
assert(values[k])
if w > 0 then
total_weight = total_weight + w
end
-- negative weights treated as zero
end
if (not (total_weight > 0)) then return nil end
local cumulative_probability = 0
local rng = Math.random()
for k,v in pairs(values) do
assert(weights[k])
cumulative_probability = cumulative_probability + (weights[k] / total_weight)
if rng <= cumulative_probability then
return v
end
end
end
function Public.raffle2(table) --arguments of the form {v1 = w1, v2 = w2, ...}
local total_weight = 0
for k,w in pairs(table) do
if w > 0 then
total_weight = total_weight + w
end
-- negative weights treated as zero
end
if (not (total_weight > 0)) then return nil end
local cumulative_probability = 0
local rng = Math.random()
for k,v in pairs(table) do
cumulative_probability = cumulative_probability + v/total_weight
if rng <= cumulative_probability then
return k
end
end
end
function Public.LambdaRaffle(data, lambda, extraConditionParameter)
-- example_argument = {
-- ['iron-stick'] = {
-- overallWeight = 1,
-- minLambda = 0,
-- maxLambda = 1,
-- shape = 'uniform',
-- condition = function(x) return x == 'ironIsland' end,
-- },
-- }
local raffle = {}
for k, v in pairs(data) do
if (not v.shape) or (v.shape == 'uniform' or v.shape == 'flat') then
if (not v.minLambda) or (lambda >= v.minLambda) then
if (not v.maxLambda) or (lambda <= v.maxLambda) then
if (not v.condition) or (extraConditionParameter and v.condition(extraConditionParameter)) then
raffle[k] = v.overallWeight
end
end
end
elseif (v.shape == 'density') then
if v.minLambda and v.maxLambda and v.maxLambda ~= v.minLambda and lambda >= v.minLambda and lambda <= v.maxLambda then
if (not v.condition) or (extraConditionParameter and v.condition(extraConditionParameter)) then
raffle[k] = v.overallWeight / (v.maxLambda - v.minLambda)
end
end
elseif (v.shape == 'bump') then
if v.minLambda and v.maxLambda and lambda >= v.minLambda and lambda <= v.maxLambda then
if (not v.condition) or (extraConditionParameter and v.condition(extraConditionParameter)) then
if v.minLambda == v.maxLambda and lambda == v.minLambda then
raffle[k] = v.overallWeight
else
local midpoint = (v.minLambda + v.maxLambda) / 2
local peak = 2 * v.overallWeight
local slope = peak / ((v.maxLambda - v.minLambda) / 2)
local difference = Math.abs(lambda - midpoint)
raffle[k] = peak * (1 - difference * slope)
end
end
end
end
end
return Public.raffle2(raffle)
end
return Public

View File

@ -48,7 +48,6 @@ Public.shelter2 = {
},
}
Public.lonely_storage_tank = {
name = 'lonely_storage_tank',
width = 4,
@ -150,6 +149,241 @@ Public.covered1b.wooden_chests = {
}
Public.covered2 = {
name = 'covered2',
width = 17,
height = 15,
components = {
--for some reason tile blueprints need to be offset...
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -9, y = -8},
bp_string = [[0eNqVmMGKwjAURf8l6wreJG2S/srgwtEgAW1L7Qwj0n8fqy5m4YBnJcKxHrxc7sOr+Tx+5WEs3WTaqzl322E19avDWPbL+x/TKlXmcnsJc2XKru/Opv24geXQbY8LMl2GbFpTpnwylem2p+XdjduNecpm+VC3z8tz5k1lpnLMjwcM/blMpe+e37K+f8l6fvWEf2AR2BLYEdgTuCZwQ+BA4EjghEJhEaIMhUIUSlEoRqEc9WaQIh0Q6YBIB0Q6INIBkQ6IdECkAyIdEOmAUAeEOiDUAaEOCHVAqANCHbCkA5Z0wCJri6wdsXbE2iFrh6w9sfbE2iNrj6xrYl0T6xpZ18i6IdYNsW6QdYOsA7EOxDog64CsI7GOxDoi64isE7FOxDoh68RuFnS4C13uYseW4LXFzi12b8GJZBspNJJCKyk2k2I7KTSUQkspNpViWyk0lkJrKTaXYnspNJhCiyk2mWKbKTSaQqspNptiuyk0nELL+aQtoh2iPaJrRLNfMCA6IjqxdGCYLE2xOMXyFAtULNG3S4HuMqHD7ElbRDtEe0TXiGa/YEB0RHRi6cAwWZpicYrlKRaoWKKvS7GpHv+Tt3/+da/Mdx7P9wfYKB+SDd41Ptk4z7+pVIVy]],
},
{
type = 'tiles',
tile_name = 'green-refined-concrete',
offset = {x = -4, y = 2},
bp_string = [[0eNqV1NEKgjAUxvF3OdcLnO6k7lWiC9MhA52iKxLZuzeti6CCvsvBb+fwv9hWunRXM07WedIrza4aD344tJNttvOddCloIc1BkK0HN5M+RWZbV3Ub8MtoSJP1pidBruq3U3T1ZLyh7ZJrTJwiw1mQt515DhiH2Xo7uNeOZN+hwrcJH1giOEVwtuMEwRLBKYIzBP8ZqJBAhQQqJFAhgQoJZCSQkUBGAhkJZCTwiOAcwcVvHJ/u/sD122ch6Gameb+eFlLlZZqzkhknHMIDrYdkGw==]],
},
{
type = 'tiles',
tile_name = 'out-of-map',
offset = {x = -7, y = -6},
bp_string = [[0eNqd2c1qwkAYheF7mXUKnpn55ie3UrqwGiSgUTQtLZJ7r9EWurDg21URvqZw8mz6enav27fucOyH0bVndxqWh6dx/7Q59uv584drZY37vPwIU+P61X44ufb5cthvhuV2Phk/D51rXT92O9e4YbmbP13uVsdu7Nz8S8O6m58zvTRu7Lfd7QGH/akf+/3w/VcW1z+ymO494Y9jkWNPjgM5juTYyHEix5kcF3Jc0UthrxC9Qz34EkUsiVgSsSRiScSSiCURSyKWRCyJWBKyJGRJyJInljyx5IklTyx5YskTS55Y8sSSJ5Y8seSRJY8seWQpEEuBWArEUiCWArEUiKVALAViKRBLgVgKyFJAlgKyFImlSCxFYikSS5FYisRSJJYisRSJpUgsRWQpIktGdBjRYUSHER1GdBjRYUSHER1GdBjRYUiHIR2J6EhERyI6EtGRiI5EdCSiIxEdmeycyc6Z7JzJzpnsnMnOmeycyc6F7FzIzoXsXMjOhexcyM6F7FzIzpXsXMnOlexcyc6V7FzJzpXsXPnOhRxX9FLYK3z0/2qU8IQanlDEE6p4QhlPqOMJhTyhkieU8oRanljME6t5YoGOFTqW6FijY5GOVTqW6VinY6GOlTqY6vQfKQ+HX1TrhHKdUK8TCnZCxU4o2Qk1O6FoJ1TthLKdWLcTC3di5U4o3Qm1O6F4J1TvhPKdUL8TCnhCBU8o4Qk1PLGIJ1bxxDKeUMcTCnlCJU8o5Qm1PKGYJ1TzhHKeUM8TCnpiRU8s6f2c332dL83t+/f217f5jXvvjqfrA3xRzNVniwq2sGn6ArBHNd4=]],
},
--this needs to appear last, so that the walls connect properly
{
type = 'static',
force = 'environment',
offset = {x = 0, y = 0},
bp_string = [[0eNqlmNFuqzAMht8l1zBhQkjCq0zVEV2jCokGBGFbNfXdD7TaTnVWE5teVajw5Xfi38Z8iX07uX5ofBDVlxh93aehS49Dc1iuP0UFOhHn+UddEtG8dX4U1et8Y3P0dbvcEs69E5VogjuJRPj6tFyNofMu/ajbViyP+YNbSJck+qD77Ac3jmnb1Qc33D2cX3aJcD40oXE3CdeL8x8/nfbznRU8WjwRfTfOj3T+O5oXdQ0ne1GXRc5/kJwEydYhkgSR65CCBMnXIYoEUeuQkgQp1iH61wlP87kOx6Gbf9O9a8NvpL5DJt/p0k2hn4J4sIQh6SzXddoNOg1PJ2Qb1rDMNYhuiGQy0PwAEVcBzREQsQTQPAERUwDNFRCxBdB8ARFjgKZhInkLhlW5coRiWRRAimjGCwkRkwMPg6nh1XSDUCSLohFKwQsJE6N4GExNyTttrGdqFsYiFIO9A6B9AYBSCnP7ROux9+W28cgSMiNrNyztEshgywPnT/Qg4qbIJ1opcQmmnbAMlkw/ISksmX5C6p7k+QmQuicNc3MwOZbJQfQUGesFfembDzHA2x0Ms8UAP1B5Tc9DM7i32995PFkL3liACucNBihGbYhfEeLHa05RsqYRVLlmzSMohtFvnjh0mnl0RKzKWLMNiqG3k2VIeRh0GQ9a0d64bEwtzTAmhik2ZPrPRLO2AXiqK8Wbm1DtJW+MQzmaN4ChHMObwFCO5Y1gGKfMeDMYyuGOGhhnS1f5R42bbZfcvpdVd5/tEvHuhvFWkQwU2uZaFSBVNkv8C+RQcGE=]],
},
},
}
Public.covered2.red_chests = {
{x = -1, y = 5},
{x = 0, y = 5},
{x = 1, y = 5},
}
Public.covered2.blue_chest = {x = 0, y = 6}
Public.covered2.walls = {
{x = -8, y = -4},
{x = -8, y = -3},
{x = -8, y = -2},
{x = -8, y = -1},
{x = 8, y = -4},
{x = 8, y = -3},
{x = 8, y = -2},
{x = 8, y = -1},
}
Public.covered2b = {
name = 'covered2b',
width = 17,
height = 15,
doNotDestroyExistingEntities = true,
components = {
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -7, y = -6},
bp_string = [[0eNqV2M1qg0AYheF7+dYGcubHUW+ldJEmQxhIVIwtDcF7b0y76KItfZfCcYRn9To3ezm95nEq/WzdzS79btzMw+Y4lcP6/G6dYmVX6+qlsrIf+ot1T/ddOfa707qYr2O2zsqcz1ZZvzuvT/fdfspztvWl/pDXY5bnyuZyyp8HjMOlzGXovz6yfXxju/x0wi9jkbEjY0/GgYzj/8YiGiIaIhoiGiIaIhqOaDii4YiGIxqOaDii4YmGJxqeaHii4YmGJxqBaASiEYhGIBqBaASiEYlGJBqRaESiEYlGJBo10aiJRk00aqJRE42aaCSikYhGIhqJaCSikYhGQzQaotEQjYZoNESjIRot0WiJRks0WqLREo0W1ReKUaEaFcpRoR4VClKxImVJypqURSmrUpalqEuFwlSoTIXSVKhNheJUqE6F8lSoT4UCVahQhRJVqFGFIlWoUoUyVahThUJVf5Tq/c//cT/QfbtsqOwtT5fH+65RSK1LMcjHbVyWD41XTnY=]],
},
{
type = 'static',
force = 'ancient-friendly',
offset = {x = 0, y = -6},
bp_string = [[0eNqN01GLgzAMAOD/kuc6rNqp/SvHOPQWRkFTsd3tZPjf1+o9DO6oeQqB5CO0yRP64Y7TbMiDfoKjbsq8zW6zucb8B7RUApYQVgHmy5ID/RHqzI26IVb4ZULQYDyOIIC6MWbOW8Ls0Q0DxDa6YoTWiwAkb7zBXdmS5ZPuY49zKPivX8BkXWix9DtPftoHCnFdxR+kYCEyjZQs5JxGKhai0ohiIU0aObOQOo3UvIc9+J6GpbRppOWNUqQVmfOYg12RvLWV5QHDXNzqnQkHtR2efrtiAd84u62jaGRVt0WtKlmqPNS/ABFaQ/0=]],
},
},
}
Public.covered2b.market = {x = -4, y = -5}
Public.covered2b.wooden_chests = {
{x = -7, y = -5},
{x = -6, y = -5},
{x = 6, y = -5},
{x = 7, y = -5},
}
Public.v2_covered_market = {
name = 'v2_covered_market',
width = 15,
height = 18,
components = {
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -8, y = -9},
bp_string = [[0eNqVmc1Kw0AYRd9l1hHmfvOfVxEX1QYJ1LS0URTJu9u0Llyo9KxK4DaBe3oDZ/rpHnevw+E4TrPrP91p2hzu5v3d83Hcrtfvrlfq3Mf5oy6dG5/208n19+fg+Dxtdmtk/jgMrnfjPLy4zk2bl/XqnHs6DvPg1i9N22G9z/LQuXncDdcbHPancR730/dT/OUhtvx2hz/CSreldUl7EhYJGwkHEo4kjNrIJFxIuJJwQ1AYQsRQCKIQRSGM7FctBFI3kjSyGCOLMbIYI4sxshgjizGyGCOLMbIYI4sxtBhDizG0GEOLMbQYQ4sxtBhDiwlkMYEsJpDFBLKYgMgERCYgMgGRCYhMJGQiIRMJmUjIRNReRO1F1F4i7SXSXiLtJdJeQu0l1F5C7WXSXibtZdJeJu1l1F5G7WXUXiHtFdJeIe0V0l5B79SC3qkFkSmITEFkKiFTCZlKyFRCpiIyFZGpiExFZCoi0wiZRsg01F9D/TXUX0P9NdSfPDos8Oi0wDN59Mwe4aGIZ/7oWY3szIUdukAHhxIOLRxqOPNwIREXMnEhFRdycSEZF7JxIR0X8nEhIRcycjElF3NyMSkXs3IxLRfzcjExFzNzITUXcnMhORey8+90ROmE0hmlWd8VpRujA2EymmI4xXiKARUjKob05g39dyDx0F3/++l//JPUubfheLrcwKpiaVZSVEg+LcsXIxltDQ==]],
},
{
type = 'tiles',
tile_name = 'out-of-map',
offset = {x = -6, y = -7},
bp_string = [[0eNqd2D1uwkAQQOG7TG0kZn+Yta8SURBYoZXAtmwnCkK+ezCkSJFEvJQrvZkpvm6v8np6y/1Q2kmaq4ztrl9N3eo4lMPy/pCmruQijfq5krLv2lGal1tXju3utBTTpc/SSJnyWSppd+fldev2Q56yLEPtId/W6LytZCqn/FjQd2OZStd+HVnfj7j5pw2/xJ7EgcSRxBsSG4kTiWsS6/q5WomKEhUlKkpUlKgoUVGiokRF/6GiiuonER0Rd0TcEXFHxB0Rd0TcEXFHxB0Sd0jcIXFPxD0R90TcE3FPxD0R90TcE3GPxD0S90g8EPFAxAMRD0Q8EPFAxAMRD0Q8IPFIVCJRiUQlEpVIVCJRiUQlEpWIVDb3GsVKYkdiT+JA4kjiDYmNxInENUJ5ktCItxFvI95GvI14G/E24m3E24i3EW9D3ol4J+KdiHci3ol4J+KdiHci3ol4J+Kd/vDeVo9/iebbJ0cl73kY7/MuabDaWQzq4zrO8yeeGHe9]],
},
{
type = 'static',
force = 'environment',
offset = {x = 0, y = 0},
bp_string = [[0eNqlmN2OmzAQhd/F16TCfxjyKtWqIhsrQiIGgdNutMq7F5JW3So5xIdcIRTzzbEzczz2p9i1J98PTYhi+ynGUPeb2G0OQ7Of3z/EVspMnKdHcclE896FUWy/TwObQ6jbeUg8915sRRP9UWQi1Mf5bYxd8JtfdduK+bOw9zPp8pYJH2ITG3+jXF/OP8LpuPPDNODR95nou3H6pAt/BOXf7FXR9LxcsjuISoLIZYhOgqhliEmC6GWITYKYZUiRBLHLEJcEKZYhZRLELUOqJEi5DJF5EqV6QknLWfkkaaWiUl8BiqZyH1EMRZGA8i9x/Uc/+HHcnCYbGA5DNz03O99GPL+ZmYl9M/j326/T8vz1mdCfongUsKBqFk3eUUWLKOWKyavnk+9OEc2+uovYdvUU8oFXPI5SJERROWUkYHWUpDwNURTlRyBNlaYoSIvhXABhLIdBcyooM9GA4jgxCFNSYkpAqSiKA7t6zk0JiNGk5yM1nOdL1KpoClMBCpnBUA2ZwkgOl8ISFJR2HAYUlC65HRGpuffoONRh7Lshgj3BfkX+vyk8ajhzOoDjAkg6QMEFUHSA8smqG031eRDDFgjisB4PctIUXE4agHGvtGlmRZ9myGIC+4rhdgSEsfkrnZpZ06pZybZqa5bZqvVmg9ZKJwt3QHiRINys+EfKVzLSWs4hQCnZgsOgVV5TkTJ/LSVL0pSQ9oqrbQuuK3KuthFGUmc5iFHUwRJiNHV2ghhDHZ4gxlIXMRBTcIcwhHHUjQ7ElFwFIkxFVsOV85bd7kC3X25UM/HTD+OtDEtpXKWcNVLbfBr/G8eu84M=]],
},
},
}
Public.v2_covered_market.red_chest = {x = 0, y = -6}
Public.v2_covered_market.blue_chest = {x = 0, y = 6}
Public.v2_covered_market.walls = {
{x = -8, y = -5},
{x = -8, y = -4},
{x = -8, y = -3},
{x = 8, y = -5},
{x = 8, y = -4},
{x = 8, y = -3},
}
Public.v2_covered_market_b = {
name = 'v2_covered_market_b',
width = 17,
height = 15,
components = {
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -7, y = -6},
bp_string = [[0eNqd2D1uwkAQQOG7TG0kZn+Yta8SURBYoZXAtmwnCkK+ezCkSJFEvJQrvZkpvm6v8np6y/1Q2kmaq4ztrl9N3eo4lMPy/pCmruQijfq5krLv2lGal1tXju3utBTTpc/SSJnyWSppd+fldev2Q56yLEPtId/W6LytZCqn/FjQd2OZStd+HVnfj7j5pw2/xJ7EgcSRxBsSG4kTiWsS6/q5WomKEhUlKkpUlKgoUVGiokRF/6GiiuonER0Rd0TcEXFHxB0Rd0TcEXFHxB0Sd0jcIXFPxD0R90TcE3FPxD0R90TcE3GPxD0S90g8EPFAxAMRD0Q8EPFAxAMRD0Q8IPFIVCJRiUQlEpVIVCJRiUQlEpWIVDb3GsVKYkdiT+JA4kjiDYmNxInENUJ5ktCItxFvI95GvI14G/E24m3E24i3EW9D3ol4J+KdiHci3ol4J+KdiHci3ol4J+Kd/vDeVo9/iebbJ0cl73kY7/MuabDaWQzq4zrO8yeeGHe9]],
},
{
type = 'static',
force = 'ancient-friendly',
offset = {x = 0, y = 0},
bp_string = [[0eNqdkd0KgzAMhd8l11X8xa2vMsbwJ0hB09LGoYjvvlZ3MdjYhVfhkJMvh2SFZpjQWEUMcgVHtYlYR71VXdAzyFTAAjLfBKhWkwN58zbVUz0EAy8GQYJiHEEA1WNQOBuLzkVsa3JGW44aHBgCgjoMzO0uAIkVKzyIu1geNI0N2n3pf5YAo50f1/SOmcTlHjSNy20TX8DsNNBXH7xTFtujm/3A56fxWcjrr7FfUH58Q8ATrTs2XtKiumZVWaR5mXj/CzxjkfE=]],
},
},
}
Public.v2_covered_market_b.market = {x = 3, y = -5}
Public.v2_covered_market_b.steel_chest = {x = 4, y = 2}
Public.v2_covered_market_b.wooden_chests = {
{x = 0, y = -3},
{x = -4, y = 3},
{x = -4, y = 4},
}
Public.v2_covered_furnace = {
name = 'v2_covered_furnace',
width = 14,
height = 15,
components = {
--for some reason tile blueprints need to be offset...
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -7, y = -8},
bp_string = [[0eNqVmM1qwkAYRd9l1ink+5n8vUpxYXWQAU1CTEtF8u412kUXbfGsQuB4E7gH7phreDu+p3HK/Ry6azj32/FlHl4OU96v95+hEy/C5XaJSxHybujPoXu9gfnQb48rMl/GFLqQ53QKRei3p/Xuxu2mNKew/qjfpzVn2RRhzsf0CBiHc57z0H8/pXw8ZPkt4Q9YCWwEdgJHAlcErgncELglsJSIRh0KKlGebFHudElgIbASGL2zEzgSuCJwTeCGwC0qhVWIOhRUIjNPnqxRiadKPFXiqRJPlXiqxFMlnirxVImnSjxV5KkiTxV5qshTRZ4a8dSIp0Y8NeKpEU+NeGrEUyOeGvHUiKeGPDXkqSFPDXlqyFMn6jlRz4l6TtRzop6Tzh117qhzR5076jySFiOKrkh0haJrEl2j6IZENyi6JdEtOwqhv3QCT/js1A4PceioJWx5Be2joIEUtJCCJlLQRgoaSUErKWgmBe2ksKEUtpTCplL+28pN8fjk0v34gFOEjzSd7wHaiNet1tHFYhmX5QubhLg2]],
},
{
type = 'tiles',
tile_name = 'out-of-map',
offset = {x = -5, y = -6},
bp_string = [[0eNqV2EFuwjAQQNG7zDpIxJ6xTa5SsaBgIUuQREmoilDuXgJddNFW/KWl77Hkt5ubvJ8uuR9KO0lzk7Hd9aupWx2HcljOn9JsKrlKU9dzJWXftaM0b/euHNvdaSmma5+lkTLls1TS7s7L6d7thzxlWS61h3wfU8/bSqZyys8BfTeWqXTt9yPrxyM6/zbhj9hIHF6L60e8JnFNYkdiT2IlsZEYfV0kcSLxBqG8SOiItyPejng74u2ItyPejng74u2ItyPeDnl74u2Jtyfennh74u2Jtyfennh74u2Jt0feSryVeCvxVuKtxFuJtxJvJd5KvJV4K/I24m3E24i3EW8j3ka8jXgb8TbibcTbkHcg3oF4B+IdiHcg3oF4B+IdiHcg3oF4B+QdiXck3pF4R+IdiXck3pF4R+IdiXck3hF5J+KdiHci3ol4J+KdiHci3ol4J+KdiHf6x3tbPdcGzY8dRCUfeRgf912qNW5cNK29rW2evwC3J1mB]],
},
--this needs to appear last, so that the walls connect properly
{
type = 'static',
force = 'environment',
offset = {x = 0, y = 0},
bp_string = [[0eNqlmNtuozAURf/Fz1DhG7dfGVUjkngiJGoQmJlGVf59oOlDNJMdvMsTQsLrXNjn2Mcf4tDNbhhbH0T9ISbfDGno0/PYntb3d1FLk4jL8rDXRLTH3k+i/rF82J59062fhMvgRC3a4N5EInzztr5Nofcu/dN0nViX+ZNbSddkc6F7H0Y3TWnXNyc33i1W19dEOB/a0LqbC58vl59+fjssX9bykfFEDP20LOn9VzTZi72F82Kvqzv/QFQURD6H6P+imZcYxvPYL8/04LqAkYt/S8xfqennMMxBPDBhovxUz/20URD9HJJ/I1jNBVt8w4TiTJRRqTDPU1FFQexziMyiKPkGJa4aig1KXDmUGxQdV1QbapVxmpcbepUW9RpYkyZGQTKn+o8G3hU7eoe613rrkaMl5agCjlbRadRMGlUWzVUUV+7oU3GJVWpHn4o0oak+BUSmDEUBClCWq0eEyTkMiqmgVG0AhasNCygVlV9A0RlFARFpyaUXYRSHQTHdHY06dwxje0x/zaNvjg6XRgFYhvpXOaBYioJ8IUWMnCk4DPKGU3EJKBVFqR5TDKdiRCFVDEIypIqRN5o+QkgZ0d0Np2iZAfc4SUtwUDI5vcPHRVnQO3wclzzDo7C55o1+gs3I0yrikMpHYVnFiQLs1nbPbCtV3DBmyToARwJruWEeYfZMuNEh75lxo42U3K0BSkjF3RsATM7tDBAjuakbYRTnDaiPXHPTO/LGcOM7wlhufkeYnBzgEYc83kBOSXLQz6r2NDMTNbEV2Z7uEWlD7mkej2y8Jrdr2frudjgRv904fQJUKU1RqcIaqW225PYv7EY6nw==]],
},
},
}
Public.v2_covered_furnace.red_chests = {
{x = -4, y = 2},
{x = -3, y = 2},
{x = -2, y = 2},
}
Public.v2_covered_furnace.blue_chests = {
{x = -4, y = -2},
{x = -3, y = -2},
{x = -2, y = -2},
}
Public.v2_covered_furnace.walls = {
{x = 3, y = -6},
{x = 4, y = -6},
{x = 5, y = -6},
{x = 3, y = 6},
{x = 4, y = 6},
{x = 5, y = 6},
}
Public.v2_covered_furnace_b = {
name = 'v2_covered_furnace_b',
width = 17,
height = 15,
doNotDestroyExistingEntities = true,
components = {
{
type = 'tiles',
tile_name = 'orange-refined-concrete',
offset = {x = -7, y = -6},
bp_string = [[0eNqV2M1qg0AYheF7+dYGcubHUW+ldJEmQxhIVIwtDcF7b0y76KItfZfCcYRn9To3ezm95nEq/WzdzS79btzMw+Y4lcP6/G6dYmVX6+qlsrIf+ot1T/ddOfa707qYr2O2zsqcz1ZZvzuvT/fdfspztvWl/pDXY5bnyuZyyp8HjMOlzGXovz6yfXxju/x0wi9jkbEjY0/GgYzj/8YiGiIaIhoiGiIaIhqOaDii4YiGIxqOaDii4YmGJxqeaHii4YmGJxqBaASiEYhGIBqBaASiEYlGJBqRaESiEYlGJBo10aiJRk00aqJRE42aaCSikYhGIhqJaCSikYhGQzQaotEQjYZoNESjIRot0WiJRks0WqLREo0W1ReKUaEaFcpRoR4VClKxImVJypqURSmrUpalqEuFwlSoTIXSVKhNheJUqE6F8lSoT4UCVahQhRJVqFGFIlWoUoUyVahThUJVf5Tq/c//cT/QfbtsqOwtT5fH+65RSK1LMcjHbVyWD41XTnY=]],
},
{
type = 'static',
force = 'ancient-friendly',
offset = {x = 0, y = 0},
bp_string = [[0eNqV01FvgyAQAOD/cs+4COpU/krTLNZeOxI9DGAz0/jfh2wPTYZdeSKX3H054O4Op2HGyShyIO9gqZsyp7OrUect/gJZMFhAcr4yUL0mC/Lg89SVumHLcMuEIEE5HIEBdeMWWYc4ZP0nWgdbHZ3RS3w9MkByyin8YUKwfNA8ntD4hCjAYNLW12j67Sh/q0JP/lxX9kcRaQqPK8VrCn+ulGnKzo2qB0UTZpfZUNdjxAlKETPe016ljndSpylNXGnSlDautGlvu6PwPHFcdv6Ivzi84j9HJA5ecPxihQ2UD+vM4IbGhgrR8LJuRV2VvKhyn/8NRt5ISg==]],
},
},
}
Public.v2_covered_furnace_b.market = {x = 4, y = 0}
Public.v2_covered_furnace_b.wooden_chests = {
{x = 5, y = -5},
{x = 5, y = -4},
{x = 5, y = 4},
{x = 5, y = 5},
}
Public.maze_defended_camp = {
name = 'maze_defended_camp',
width = 20,

View File

@ -6,10 +6,24 @@ Public.shelter1 = {}
Public.shelter1.Data = Data.shelter1
Public.shelter2 = {}
Public.shelter2.Data = Data.shelter2
Public.covered1 = {}
Public.covered1.Data = Data.covered1
Public.covered1b = {}
Public.covered1b.Data = Data.covered1b
Public.covered2 = {}
Public.covered2.Data = Data.covered2
Public.covered2b = {}
Public.covered2b.Data = Data.covered2b
Public.v2_covered_market = {}
Public.v2_covered_market.Data = Data.v2_covered_market
Public.v2_covered_market_b = {}
Public.v2_covered_market_b.Data = Data.v2_covered_market_b
Public.v2_covered_furnace = {}
Public.v2_covered_furnace.Data = Data.v2_covered_furnace
Public.v2_covered_furnace_b = {}
Public.v2_covered_furnace_b.Data = Data.v2_covered_furnace_b
Public.lonely_storage_tank = {}
Public.lonely_storage_tank.Data = Data.lonely_storage_tank
Public.swamp_lonely_storage_tank = {}

View File

@ -142,18 +142,22 @@ function Public.spawn_covered(destination, points_to_avoid)
for i = 1, 1 do
p = Hunt.mid_farness_position_1(args, points_to_avoid)
local structureData = Structures.IslandStructures.ROC.covered1.Data
local special = {
position = p,
components = structureData.components,
width = structureData.width,
height = structureData.height,
name = structureData.name,
}
if not destination.dynamic_data.structures_waiting_to_be_placed then
destination.dynamic_data.structures_waiting_to_be_placed = {}
end
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
--@TODO: Figure out what to do about these two kinds of structure
local which = 'covered2'
if which == 'covered1' then
local structureData = Structures.IslandStructures.ROC.covered1.Data
local special = {
position = p,
components = structureData.components,
width = structureData.width,
height = structureData.height,
name = structureData.name,
}
if not destination.dynamic_data.structures_waiting_to_be_placed then
destination.dynamic_data.structures_waiting_to_be_placed = {}
end
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
local requirement = destination.dynamic_data.covered1_requirement.price
@ -174,6 +178,7 @@ function Public.spawn_covered(destination, points_to_avoid)
}
destination.dynamic_data.covered_data = {
structure_type = structureData.name,
position = p,
state = 'covered',
requirement = requirement,
@ -181,6 +186,50 @@ function Public.spawn_covered(destination, points_to_avoid)
rendering2 = rendering2,
}
elseif which == 'covered2' then
local structureData = Structures.IslandStructures.ROC.covered2.Data
local special = {
position = p,
components = structureData.components,
width = structureData.width,
height = structureData.height,
name = structureData.name,
}
if not destination.dynamic_data.structures_waiting_to_be_placed then
destination.dynamic_data.structures_waiting_to_be_placed = {}
end
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
local requirement = destination.dynamic_data.covered2_requirement
local rendering1 = rendering.draw_text{
surface = surface,
target = {x = p.x + 2, y = p.y + 6.85},
color = CoreData.colors.renderingtext_green,
scale = 1.5,
font = 'default-game',
alignment = 'right',
}
local rendering2 = rendering.draw_sprite{
sprite = 'item/' .. requirement.name,
surface = surface,
target = {x = p.x + 2.85, y = p.y + 7.5},
x_scale = 1.5,
y_scale = 1.5
}
destination.dynamic_data.covered_data = {
structure_type = structureData.name,
position = p,
state = 'covered',
rendering1 = rendering1,
rendering2 = rendering2,
requirement = requirement,
completion_counter = 0,
}
end
log('covered market position: ' .. p.x .. ', ' .. p.y)
end

View File

@ -1,6 +1,7 @@
-- local Memory = require 'maps.pirates.memory'
local Math = require 'maps.pirates.math'
local Raffle = require 'maps.pirates.raffle'
-- local Balance = require 'maps.pirates.balance'
local Structures = require 'maps.pirates.structures.structures'
-- local Common = require 'maps.pirates.common'
@ -161,7 +162,7 @@ local function free_labyrinth_cell_type(args)
end
if not type then
type = Math.raffle2(free_labyrinth_cell_raffle)
type = Raffle.raffle2(free_labyrinth_cell_raffle)
cell_types[tostring(reduced_p.x) .. '_' .. tostring(reduced_p.y)] = type
end

View File

@ -340,7 +340,7 @@ function Public.destination_on_arrival(destination)
Islands.spawn_ores_on_arrival(destination, points_to_avoid)
if memory.overworldx >= Balance.covered_first_appears_at and destination.subtype ~= Islands.enum.RADIOACTIVE then
if (memory.overworldx >= Balance.covered_first_appears_at and destination.subtype ~= Islands.enum.RADIOACTIVE) or _DEBUG then
local class_for_sale = Classes.generate_class_for_sale()
destination.static_params.class_for_sale = class_for_sale

View File

@ -691,6 +691,114 @@ function Public.place_cached_structures(tickinterval)
end
covered_data.wooden_chests[#covered_data.wooden_chests + 1] = e
end
elseif special.name == 'covered2' then
local covered_data = destination.dynamic_data.covered_data
if not covered_data then return end
local hardcoded_data = Structures.IslandStructures.ROC.covered2.Data
covered_data.blue_chest = surface.create_entity{name = 'blue-chest', position = Math.vector_sum(special.position, hardcoded_data.blue_chest), force = 'environment'}
if covered_data.blue_chest and covered_data.blue_chest.valid then
covered_data.blue_chest.minable = false
covered_data.blue_chest.rotatable = false
covered_data.blue_chest.operable = false
covered_data.blue_chest.destructible = false
end
covered_data.red_chests = {}
for _, chest_position in pairs(hardcoded_data.red_chests) do
local e = surface.create_entity{name = 'red-chest', position = Math.vector_sum(special.position, chest_position), force = 'environment'}
if e and e.valid then
e.minable = false
e.rotatable = false
e.operable = false
e.destructible = false
covered_data.red_chests[#covered_data.red_chests+1] = e
end
end
covered_data.door_walls = {}
for _, p in pairs(hardcoded_data.walls) do
local e = surface.create_entity{name = 'stone-wall', position = Math.vector_sum(special.position, p), force = 'environment'}
if e and e.valid then
e.minable = false
e.rotatable = false
e.operable = false
e.destructible = false
end
covered_data.door_walls[#covered_data.door_walls + 1] = e
end
elseif special.name == 'covered2b' then
local covered_data = destination.dynamic_data.covered_data
if not covered_data then return end
local hardcoded_data = Structures.IslandStructures.ROC.covered2b.Data
covered_data.market = surface.create_entity{name = 'market', position = Math.vector_sum(special.position, hardcoded_data.market), force = string.format('ancient-friendly-%03d', memory.id)}
if covered_data.market and covered_data.market.valid then
covered_data.market.minable = false
covered_data.market.rotatable = false
covered_data.market.destructible = false
covered_data.market.add_market_item{price={{'pistol', 1}}, offer={type = 'give-item', item = 'coin', count = Balance.coin_sell_amount}}
covered_data.market.add_market_item{price={{'burner-mining-drill', 1}}, offer={type = 'give-item', item = 'iron-plate', count = 9}}
local how_many_coin_offers = 4
if Balance.crew_scale() >= 1.2 then how_many_coin_offers = 5 end
local coin_offers = ShopCovered.market_generate_coin_offers(how_many_coin_offers)
for _, o in pairs(coin_offers) do
covered_data.market.add_market_item(o)
end
if destination.static_params.class_for_sale then
covered_data.market.add_market_item{price={{'coin', Balance.class_cost()}}, offer={type="nothing", effect_description = 'Purchase the class ' .. Classes.display_form[destination.static_params.class_for_sale] .. '.'}}
-- destination.dynamic_data.market_class_offer_rendering = rendering.draw_text{
-- text = 'Class available: ' .. Classes.display_form[destination.static_params.class_for_sale],
-- surface = surface,
-- target = Utils.psum{special.position, hardcoded_data.market, {x = 1, y = -3.9}},
-- color = CoreData.colors.renderingtext_green,
-- scale = 2.5,
-- font = 'default-game',
-- alignment = 'center'
-- }
end
end
for _, w in pairs(covered_data.door_walls) do
if w and w.valid then
w.destructible = true
w.destroy()
end
end
covered_data.wooden_chests = {}
for k, p in ipairs(hardcoded_data.wooden_chests) do
local e = surface.create_entity{name = 'wooden-chest', position = Math.vector_sum(special.position, p), force = string.format('ancient-friendly-%03d', memory.id)}
if e and e.valid then
e.minable = false
e.rotatable = false
e.destructible = false
local inv = e.get_inventory(defines.inventory.chest)
if k==1 then
inv.insert({name = 'coin', count = 2000})
elseif k==4 then
local loot = Loot.covered_wooden_chest_loot_1()
for j = 1, #loot do
local l = loot[j]
inv.insert(l)
end
else
local loot = Loot.covered_wooden_chest_loot_2()
for j = 1, #loot do
local l = loot[j]
inv.insert(l)
end
end
end
covered_data.wooden_chests[#covered_data.wooden_chests + 1] = e
end
end
@ -711,49 +819,113 @@ function Public.covered_requirement_check(tickinterval)
local covered_data = destination.dynamic_data.covered_data
if not covered_data then return end
local blue_chest = covered_data.blue_chest
local red_chest = covered_data.red_chest
if not (blue_chest and blue_chest.valid and red_chest and red_chest.valid) then return end
local blue_inv = covered_data.blue_chest.get_inventory(defines.inventory.chest)
local red_inv = covered_data.red_chest.get_inventory(defines.inventory.chest)
if covered_data.structure_type == 'covered1' then
local blue_contents = blue_inv.get_contents()
local requirement = covered_data.requirement
local got = 0
for k, v in pairs(blue_contents) do
if covered_data.state == 'covered' and k == requirement.name then
got = v
else
-- @FIX: power armor loses components, items lose health!
red_inv.insert({name = k, count = v});
blue_inv.remove({name = k, count = v});
end
end
if covered_data.state == 'covered' then
if got >= requirement.count then
blue_inv.remove({name = requirement.name, count = requirement.count});
covered_data.state = 'uncovered'
rendering.destroy(covered_data.rendering1)
rendering.destroy(covered_data.rendering2)
local structureData = Structures.IslandStructures.ROC.covered1b.Data
local special = {
position = covered_data.position,
components = structureData.components,
width = structureData.width,
height = structureData.height,
name = structureData.name,
}
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
else
if covered_data.rendering1 then
rendering.set_text(covered_data.rendering1, 'Needs ' .. requirement.count - got .. ' x')
local blue_chest = covered_data.blue_chest
local red_chest = covered_data.red_chest
if not (blue_chest and blue_chest.valid and red_chest and red_chest.valid) then return end
local blue_inv = covered_data.blue_chest.get_inventory(defines.inventory.chest)
local red_inv = covered_data.red_chest.get_inventory(defines.inventory.chest)
local blue_contents = blue_inv.get_contents()
local requirement = covered_data.requirement
local got = 0
for k, v in pairs(blue_contents) do
if covered_data.state == 'covered' and k == requirement.name then
got = v
else
-- @FIX: power armor loses components, items lose health!
red_inv.insert({name = k, count = v});
blue_inv.remove({name = k, count = v});
end
end
if covered_data.state == 'covered' then
if got >= requirement.count then
blue_inv.remove({name = requirement.name, count = requirement.count});
covered_data.state = 'uncovered'
rendering.destroy(covered_data.rendering1)
rendering.destroy(covered_data.rendering2)
local structureData = Structures.IslandStructures.ROC.covered1b.Data
local special = {
position = covered_data.position,
components = structureData.components,
width = structureData.width,
height = structureData.height,
name = structureData.name,
}
destination.dynamic_data.structures_waiting_to_be_placed[#destination.dynamic_data.structures_waiting_to_be_placed + 1] = {data = special, tick = game.tick}
else
if covered_data.rendering1 then
rendering.set_text(covered_data.rendering1, 'Needs ' .. requirement.count - got .. ' x')
end
end
end
elseif covered_data.structure_type == 'covered2' then
local blue_chest = covered_data.blue_chest
local red_chests = covered_data.red_chests
if not (blue_chest and blue_chest.valid and red_chests and red_chests[1] and red_chests[1].valid and red_chests[2] and red_chests[2].valid and red_chests[3] and red_chests[3].valid) then return end
local blue_inv = covered_data.blue_chest.get_inventory(defines.inventory.chest)
local red_inv_main = {}
red_inv_main[1] = covered_data.red_chests[1].get_inventory(defines.inventory.chest)
red_inv_main[2] = covered_data.red_chests[3].get_inventory(defines.inventory.chest)
local red_inv_other = covered_data.red_chests[2].get_inventory(defines.inventory.chest)
local blue_contents = blue_inv.get_contents()
local requirement = covered_data.requirement --fields {name, count, batchSize, batchRawMaterials}
for k, v in pairs(blue_contents) do
if covered_data.state == 'covered' and k == requirement.name and v >= requirement.batchSize then
local toRemove = v - (v % requirement.batchSize)
local batches = toRemove / requirement.batchSize
covered_data.completion_counter = covered_data.completion_counter + toRemove
blue_inv.remove({name = k, count = toRemove});
local i = 1
for k2, v2 in pairs(requirement.batchRawMaterials) do
red_inv_main[i].insert({name = k2, count = v2 * batches})
if red_inv_main[i+1] then i = i + 1 end
end
elseif not (covered_data.state == 'covered' and k == requirement.name and v < requirement.batchSize) then
-- @FIX: power armor loses components, items lose health data!
red_inv_other.insert({name = k, count = v});
blue_inv.remove({name = k, count = v});
end
end
if covered_data.state == 'covered' then
if covered_data.completion_counter >= requirement.count then
covered_data.state = 'uncovered'
rendering.destroy(covered_data.rendering1)
rendering.destroy(covered_data.rendering2)
-- local structureData = Structures.IslandStructures.ROC.covered1b.Data
-- local structureData = Structures.IslandStructures.ROC.covered2b.Data
-- local special = {
-- position = covered_data.position,
-- components = structureData.components,
-- width = structureData.width,
-- height = structureData.height,
-- name = structureData.name,
-- }
local special = Utils.deepcopy(Structures.IslandStructures.ROC.covered2b.Data)
special.position = covered_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 covered_data.rendering1 then
rendering.set_text(covered_data.rendering1, 'Needs ' .. requirement.count - covered_data.completion_counter .. ' x')
end
end
end
else
end
end
@ -1083,7 +1255,7 @@ function Public.loading_update(tickinterval)
else
local fraction = memory.loadingticks / (total + (memory.extra_time_at_sea or 0))
if fraction > Common.fraction_of_map_loaded_atsea then
if fraction > Common.fraction_of_map_loaded_at_sea then
Progression.progress_to_destination(destination_index)
memory.loadingticks = 0
else
@ -1092,7 +1264,7 @@ function Public.loading_update(tickinterval)
end
elseif memory.boat.state == Boats.enum_state.LANDED then
local fraction = Common.fraction_of_map_loaded_atsea + (1 - Common.fraction_of_map_loaded_atsea) * memory.loadingticks / Common.map_loading_ticks_onisland
local fraction = Common.fraction_of_map_loaded_at_sea + (1 - Common.fraction_of_map_loaded_at_sea) * memory.loadingticks / Common.map_loading_ticks_onisland
if fraction > 1 then
memory.loadingticks = nil