1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

Journey more to the update, also test to start luachecking journey

This commit is contained in:
hanakocz 2023-07-17 19:34:22 +02:00
parent b0cea418cc
commit 4d8a6fb551
4 changed files with 160 additions and 174 deletions

View File

@ -18,4 +18,5 @@ tooltip_modifier=__1__ - __2__%\n
tooltip_capsule= __1__x [item=__2__]
tooltip_capsule2= __1__x [item=__2__]\n
message_rocket_launched=Launching a rocket with __1__x [item=__2__] at [gps=__3__,__4__,nauvis].
cmd_server_restarting=Server is restarting to apply updates to the scenario...Please reconnect in a minute.

View File

@ -1,8 +1,8 @@
--luacheck: ignore
local Public = {}
Public.mothership_teleporter_position = {x = 0, y = 12}
Public.teleporter_tile = "lab-dark-2"
Public.teleporter_tile = 'lab-dark-2'
Public.mothership_radius = 48
@ -53,172 +53,147 @@ Public.reroll_selector_area = {
Public.mothership_messages = {
waiting = {
"Return to me, so we can continue the journey!",
"Don't leave me waiting for so long. Let's continue our journey.",
"Please return to me.",
"Board me, so we can continue this adventure!",
'Return to me, so we can continue the journey!',
'Don\'t leave me waiting for so long. Let\'s continue our journey.',
'Please return to me.',
'Board me, so we can continue this adventure!',
},
answers = {
"Yes, great idea.",
"Yes, wonderful.",
"Yes, definitely.",
"Yes, i love it!",
"The calculations say yes.",
"I don't know how to feel about this.",
"Ask again later, my processors are very busy.",
"No, this is certainly wrong.",
"No, i don't think so.",
"No, you are wrong.",
"No, that would be weird.",
"The calculations say no.",
'Yes, great idea.',
'Yes, wonderful.',
'Yes, definitely.',
'Yes, i love it!',
'The calculations say yes.',
'I don\'t know how to feel about this.',
'Ask again later, my processors are very busy.',
'No, this is certainly wrong.',
'No, i don\'t think so.',
'No, you are wrong.',
'No, that would be weird.',
'The calculations say no.',
},
}
Public.mothership_gen_settings = {
["water"] = 0,
["starting_area"] = 1,
["cliff_settings"] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
["default_enable_all_autoplace_controls"] = false,
["autoplace_settings"] = {
["entity"] = {treat_missing_as_default = false},
["tile"] = {treat_missing_as_default = false},
["decorative"] = {treat_missing_as_default = false},
['water'] = 0,
['starting_area'] = 1,
['cliff_settings'] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
['default_enable_all_autoplace_controls'] = false,
['autoplace_settings'] = {
['entity'] = {treat_missing_as_default = false},
['tile'] = {treat_missing_as_default = false},
['decorative'] = {treat_missing_as_default = false},
},
autoplace_controls = {
["coal"] = {frequency = 0, size = 0, richness = 0},
["stone"] = {frequency = 0, size = 0, richness = 0},
["copper-ore"] = {frequency = 0, size = 0, richness = 0},
["iron-ore"] = {frequency = 0, size = 0, richness = 0},
["uranium-ore"] = {frequency = 0, size = 0, richness = 0},
["crude-oil"] = {frequency = 0, size = 0, richness = 0},
["trees"] = {frequency = 0, size = 0, richness = 0},
["enemy-base"] = {frequency = 0, size = 0, richness = 0}
['coal'] = {frequency = 0, size = 0, richness = 0},
['stone'] = {frequency = 0, size = 0, richness = 0},
['copper-ore'] = {frequency = 0, size = 0, richness = 0},
['iron-ore'] = {frequency = 0, size = 0, richness = 0},
['uranium-ore'] = {frequency = 0, size = 0, richness = 0},
['crude-oil'] = {frequency = 0, size = 0, richness = 0},
['trees'] = {frequency = 0, size = 0, richness = 0},
['enemy-base'] = {frequency = 0, size = 0, richness = 0}
},
}
Public.modifiers_old = {
["trees"] = {-20, -10, "Trees"},
["tree_durability"] = {-30, -15, "Tree Durability"},
["cliff_settings"] = {20, 40, "Cliffs"},
["water"] = {-20, -10, "Water"},
["coal"] = {-20, -10, "Coal"},
["stone"] = {-20, -10, "Stone"},
["iron-ore"] = {-20, -10, "Iron Ore"},
["copper-ore"] = {-20, -10, "Copper Ore"},
["crude-oil"] = {-20, -10, "Oil"},
["uranium-ore"] = {-20, -10, "Uranium Ore"},
["mixed_ore"] = {-20, -10, "Mixed Ore"},
["enemy-base"] = {10, 20, "Nests"},
["expansion_cooldown"] = {-30, -15, "Nest Expansion Cooldown"},
["enemy_attack_pollution_consumption_modifier"] = {-20, -10, "Nest Pollution Consumption"},
["max_unit_group_size"] = {15, 30, "Biter Group Size Maximum"},
["time_factor"] = {15, 30, "Evolution Time Factor"},
["destroy_factor"] = {15, 30, "Evolution Destroy Factor"},
["pollution_factor"] = {15, 30, "Evolution Pollution Factor"},
["ageing"] = {-20, -10, "Terrain Pollution Consumption"},
["diffusion_ratio"] = {10, 20, "Pollution Diffusion"},
["technology_price_multiplier"] = {10, 20, "Technology Price"},
}
Public.modifiers = {
["trees"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Trees"},
["tree_durability"] = {min = 0.01, max = 10, base = 1, dmin = -30, dmax =-15, name = "Tree Durability"},
["cliff_settings"] = {min = 0.01, max = 10, base = 1, dmin = 20, dmax = 40, name = "Cliffs"},
["water"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Water"},
["coal"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Coal"},
["stone"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Stone"},
["iron-ore"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Iron Ore"},
["copper-ore"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Copper Ore"},
["crude-oil"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Oil"},
["uranium-ore"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Uranium Ore"},
["mixed_ore"] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = "Mixed Ore"},
["enemy-base"] = {min = 0.01, max = 10, base = 1, dmin = 10, dmax = 20, name = "Nests"},
["expansion_cooldown"] = {min = 3600, max = 28800, base = 14400, dmin = -20, dmax = -10, name = "Nest Expansion Cooldown"},
["enemy_attack_pollution_consumption_modifier"] = {min = 0.2, max = 10, base = 1, dmin = -10, dmax = -5, name = "Nest Pollution Consumption"},
["max_unit_group_size"] = {min = 10, max = 500, base = 100, dmin = 10, dmax = 20, name = "Biter Group Size Maximum"},
["time_factor"] = {min = 0.000001, max = 0.0001, base = 0.000004, dmin = 15, dmax = 30, name = "Evolution Time Factor"},
["destroy_factor"] = {min = 0.0002, max = 0.2, base = 0.002, dmin = 15, dmax = 30, name = "Evolution Destroy Factor"},
["pollution_factor"] = {min = 0.00000009, max = 0.00009, base = 0.0000009, dmin = 15, dmax = 30, name = "Evolution Pollution Factor"},
["ageing"] = {min = 0.01, max = 4, base = 1, dmin = -20, dmax = -10, name = "Terrain Pollution Consumption"},
["diffusion_ratio"] = {min = 0.01, max = 0.1, base = 0.02, dmin = 10, dmax = 20, name = "Pollution Diffusion"},
["technology_price_multiplier"] = {min = 0.5, max = 10, base = 1, dmin = 10, dmax = 20, name = "Technology Price"},
['trees'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Trees'},
['tree_durability'] = {min = 0.1, max = 50, base = 10, dmin = -30, dmax =-15, name = 'Tree Durability'},
['cliff_settings'] = {min = 0.01, max = 10, base = 1, dmin = 20, dmax = 40, name = 'Cliffs'},
['water'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Water'},
['coal'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Coal'},
['stone'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Stone'},
['iron-ore'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Iron Ore'},
['copper-ore'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Copper Ore'},
['crude-oil'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Oil'},
['uranium-ore'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Uranium Ore'},
['mixed_ore'] = {min = 0.01, max = 10, base = 1, dmin = -20, dmax = -10, name = 'Mixed Ore'},
['enemy-base'] = {min = 0.01, max = 10, base = 1, dmin = 10, dmax = 20, name = 'Nests'},
['expansion_cooldown'] = {min = 3600, max = 28800, base = 14400, dmin = -20, dmax = -10, name = 'Nest Expansion Cooldown'},
['enemy_attack_pollution_consumption_modifier'] = {min = 0.25, max = 4, base = 1, dmin = -5, dmax = -2.5, name = 'Nest Pollution Consumption'},
['max_unit_group_size'] = {min = 10, max = 500, base = 100, dmin = 10, dmax = 20, name = 'Biter Group Size Maximum'},
['time_factor'] = {min = 0.000001, max = 0.0001, base = 0.000004, dmin = 15, dmax = 30, name = 'Evolution Time Factor'},
['destroy_factor'] = {min = 0.0002, max = 0.2, base = 0.002, dmin = 15, dmax = 30, name = 'Evolution Destroy Factor'},
['pollution_factor'] = {min = 0.00000009, max = 0.00009, base = 0.0000009, dmin = 15, dmax = 30, name = 'Evolution Pollution Factor'},
['ageing'] = {min = 0.01, max = 4, base = 1, dmin = -20, dmax = -10, name = 'Terrain Pollution Consumption'},
['diffusion_ratio'] = {min = 0.005, max = 0.05, base = 0.02, dmin = 10, dmax = 20, name = 'Pollution Diffusion'},
['technology_price_multiplier'] = {min = 0.05, max = 5, base = 0.5, dmin = 10, dmax = 20, name = 'Technology Price'},
}
Public.starter_goods_pool = {
{"accumulator", 8, 16},
{"big-electric-pole", 8, 16},
{"burner-inserter", 64, 128},
{"burner-mining-drill", 8, 16},
{"car", 2, 4},
{"copper-cable", 128, 256},
{"copper-plate", 64, 128},
{"electric-furnace", 4, 8},
{"electric-mining-drill", 4, 8},
{"firearm-magazine", 64, 128},
{"grenade", 8, 16},
{"gun-turret", 4, 8},
{"inserter", 32, 64},
{"iron-gear-wheel", 64, 128},
{"iron-plate", 64, 128},
{"lab", 2, 4},
{"long-handed-inserter", 32, 64},
{"medium-electric-pole", 16, 32},
{"pipe", 128, 256},
{"radar", 4, 8},
{"small-lamp", 64, 128},
{"solar-panel", 8, 16},
{"solid-fuel", 256, 512},
{"stack-inserter", 16, 32},
{"stack-filter-inserter", 16, 32},
{"steam-turbine", 4, 8},
{"steel-chest", 16, 32},
{"steel-furnace", 8, 16},
{"steel-plate", 32, 64},
{"stone-wall", 128, 256},
{"substation", 4, 8},
{"green-wire", 256, 512},
{"red-wire", 256, 512},
{'accumulator', 8, 16},
{'big-electric-pole', 8, 16},
{'burner-inserter', 64, 128},
{'burner-mining-drill', 8, 16},
{'car', 2, 4},
{'copper-cable', 128, 256},
{'copper-plate', 64, 128},
{'electric-furnace', 4, 8},
{'electric-mining-drill', 4, 8},
{'firearm-magazine', 64, 128},
{'grenade', 8, 16},
{'gun-turret', 4, 8},
{'inserter', 32, 64},
{'iron-gear-wheel', 64, 128},
{'iron-plate', 64, 128},
{'lab', 2, 4},
{'long-handed-inserter', 32, 64},
{'medium-electric-pole', 16, 32},
{'pipe', 128, 256},
{'radar', 4, 8},
{'small-lamp', 64, 128},
{'solar-panel', 8, 16},
{'solid-fuel', 256, 512},
{'stack-inserter', 16, 32},
{'stack-filter-inserter', 16, 32},
{'steam-turbine', 4, 8},
{'steel-chest', 16, 32},
{'steel-furnace', 8, 16},
{'steel-plate', 32, 64},
{'stone-wall', 128, 256},
{'substation', 4, 8},
{'green-wire', 256, 512},
{'red-wire', 256, 512},
}
Public.build_type_whitelist = {
["arithmetic-combinator"] = true,
["constant-combinator"] = true,
["decider-combinator"] = true,
["electric-energy-interface"] = true,
["electric-pole"] = true,
["gate"] = true,
["heat-pipe"] = true,
["lamp"] = true,
["pipe"] = true,
["pipe-to-ground"] = true,
["programmable-speaker"] = true,
["transport-belt"] = true,
["wall"] = true,
['arithmetic-combinator'] = true,
['constant-combinator'] = true,
['decider-combinator'] = true,
['electric-energy-interface'] = true,
['electric-pole'] = true,
['gate'] = true,
['heat-pipe'] = true,
['lamp'] = true,
['pipe'] = true,
['pipe-to-ground'] = true,
['programmable-speaker'] = true,
['transport-belt'] = true,
['wall'] = true,
}
Public.unique_world_traits = {
["lush"] = {"Lush", "Pure Vanilla.", 1},
["abandoned_library"] = {"Abandoned Library", "No blueprints to be found.", 3},
["lazy_bastard"] = {"Lazy Bastard", "The machine does the job.", 4},
["oceanic"] = {"Oceanic", "Arrrr, the flame turrets seem to malfunction in this climate.", 2},
["ribbon"] = {"Ribbon", "Go right. (or left)", 4},
["wasteland"] = {"Wasteland", "Rusty treasures.", 2},
["infested"] = {"Infested", "They lurk inside.", 4},
["pitch_black"] = {"Pitch Black", "No light may reach this realm.", 2},
["volcanic"] = {"Volcanic", "The floor is (almost) lava.", 4},
["matter_anomaly"] = {"Matter Anomaly", "Why can't i hold all these ores.\nThe laser turret structures seem to malfunction.", 2},
["mountainous"] = {"Mountainous", "Diggy diggy hole!", 2},
["eternal_night"] = {"Eternal Night", "This world seems to be missing a sun.", 2},
["dense_atmosphere"] = {"Dense Atmosphere", "Your roboport structures seem to malfunction.", 3},
["undead_plague"] = {"Undead Plague", "The dead are restless.", 4},
["swamps"] = {"Swamps", "No deep water to be found in this world.", 3},
["chaotic_resources"] = {"Chaotic Resources", "Something to sort out.", 2},
["low_mass"] = {"Low Mass", "You feel light footed and the robots are buzzing.", 2},
["eternal_day"] = {"Eternal Day", "The sun never moves.", 1},
["quantum_anomaly"] = {"Quantum Anomaly", "Research complete.", 2},
["replicant_fauna"] = {"Replicant Fauna", "The biters feed on your structures.", 4},
["tarball"] = {"Tarball", "Door stuck, Door stuck...", 4},
--[[
]]
['lush'] = {'Lush', 'Pure Vanilla.', 1},
['abandoned_library'] = {'Abandoned Library', 'No blueprints to be found.', 3},
['lazy_bastard'] = {'Lazy Bastard', 'The machine does the job.', 4},
['oceanic'] = {'Oceanic', 'Arrrr, the flame turrets seem to malfunction in this climate.', 2},
['ribbon'] = {'Ribbon', 'Go right. (or left)', 4},
['wasteland'] = {'Wasteland', 'Rusty treasures.', 2},
['infested'] = {'Infested', 'They lurk inside.', 4},
['pitch_black'] = {'Pitch Black', 'No light may reach this realm.', 2},
['volcanic'] = {'Volcanic', 'The floor is (almost) lava.', 4},
['matter_anomaly'] = {'Matter Anomaly', 'Why can\'t I hold all these ores.\nThe laser turret structures seem to malfunction.', 2},
['mountainous'] = {'Mountainous', 'Diggy diggy hole!', 2},
['eternal_night'] = {'Eternal Night', 'This world seems to be missing a sun.', 2},
['dense_atmosphere'] = {'Dense Atmosphere', 'Your roboport structures seem to malfunction.', 3},
['undead_plague'] = {'Undead Plague', 'The dead are restless.', 4},
['swamps'] = {'Swamps', 'No deep water to be found in this world.', 3},
['chaotic_resources'] = {'Chaotic Resources', 'Something to sort out.', 2},
['low_mass'] = {'Low Mass', 'You feel light footed and the robots are buzzing.', 2},
['eternal_day'] = {'Eternal Day', 'The sun never moves.', 1},
['quantum_anomaly'] = {'Quantum Anomaly', 'Research complete.', 2},
['replicant_fauna'] = {'Replicant Fauna', 'The biters feed on your structures.', 4},
['tarball'] = {'Tarball', 'Door stuck, Door stuck...', 4},
}
return Public

View File

@ -450,9 +450,11 @@ function Public.hard_reset(journey)
journey.beacon_objective_health = 10000
journey.beacon_objective_resistance = 0.9
journey.world_number = 0
journey.world_trait = "lush"
journey.world_trait = 'lush'
journey.world_modifiers = {}
journey.game_state = "create_mothership"
journey.emergency_triggered = false
journey.emergency_selected = false
journey.game_state = 'create_mothership'
journey.mothership_messages_last_damage = game.tick
for k, modifier in pairs(Constants.modifiers) do
journey.world_modifiers[k] = modifier.base
@ -907,6 +909,14 @@ function Public.mothership_world_selection(journey)
local reroll_selector_activation_level = get_activation_level(surface, Constants.reroll_selector_area)
journey.reroll_selector.activation_level = reroll_selector_activation_level
if journey.emergency_triggered then
if not journey.emergency_selected then
journey.selected_world = math.random(1, 3)
table.insert(journey.mothership_messages, "Emergency destination selected..")
table.insert(journey.mothership_messages, "Some reactors were damaged due to unplanned circumstances..")
journey.emergency_selected = true
end
else
journey.selected_world = false
for i = 1, 3, 1 do
local activation_level = get_activation_level(surface, Constants.world_selector_areas[i])
@ -915,12 +925,12 @@ function Public.mothership_world_selection(journey)
journey.selected_world = i
end
end
if reroll_selector_activation_level > 1 and journey.mothership_speed == 0.35 and journey.mothership_cargo.satellite > 0 then
journey.game_state = "reroll_worlds"
table.insert(journey.mothership_messages, "Dispatching satellite..")
return
end
end
if journey.selected_world then
if not journey.mothership_advancing_to_world then
@ -978,7 +988,8 @@ function Public.mothership_arrives_at_world(journey)
journey.mothership_speed = 0.15
end
journey.beacon_objective_resistance = 0.90 - (0.03 * journey.world_number)
journey.emergency_triggered = false
journey.emergency_selected = false
draw_background(journey, surface)
Public.update_tooltips(journey)
end
@ -1060,7 +1071,7 @@ function Public.create_the_world(journey)
game.map_settings.pollution.diffusion_ratio = journey.world_modifiers[name]
end
if name == "tree_durability" then
game.map_settings.pollution.min_pollution_to_damage_trees = journey.world_modifiers[name]
game.map_settings.pollution.min_pollution_to_damage_trees = journey.world_modifiers[name] * 6
game.map_settings.pollution.pollution_restored_per_tree_damage = journey.world_modifiers[name]
end
if name == "max_unit_group_size" then
@ -1238,15 +1249,13 @@ function Public.world(journey)
table.remove(journey.rocket_silos, k)
break
end
local inventory = silo.get_inventory(defines.inventory.rocket_silo_rocket)
if inventory then
local fuel_cells_required = journey.mothership_cargo_space['uranium-fuel-cell'] - journey.mothership_cargo['uranium-fuel-cell']
if fuel_cells_required > 50 then fuel_cells_required = 50 end
local reactors_required = journey.mothership_cargo_space['nuclear-reactor'] - journey.mothership_cargo['nuclear-reactor']
if reactors_required > 10 then reactors_required = 10 end
if inventory.get_item_count('satellite') == 1 or inventory.get_item_count('uranium-fuel-cell') >= fuel_cells_required or inventory.get_item_count('nuclear-reactor') >= reactors_required then
local inventory = silo.get_inventory(defines.inventory.rocket_silo_rocket) or {}
local slot = inventory[1]
if slot and slot.valid and slot.valid_for_read then
local needs = (journey.mothership_cargo_space[slot.name] or 0) - (journey.mothership_cargo[slot.name] or 0)
if needs > 0 and slot.count >= math.min(game.item_prototypes[slot.name].stack_size, needs) then
if silo.launch_rocket() then
table.insert(journey.mothership_messages, "Launching rocket [gps=" .. silo.position.x .. "," .. silo.position.y .. ",nauvis]")
table.insert(journey.mothership_messages, {'journey.message_rocket_launched', slot.count, slot.name, silo.position.x, silo.position.y})
end
end
end
@ -1319,6 +1328,7 @@ function Public.deal_damage_to_beacon(journey, incoming_damage)
end
Public.hard_reset(journey)
else
journey.emergency_triggered = true
journey.game_state = "set_world_selectors"
Public.update_tooltips(journey)
Public.draw_gui(journey)

View File

@ -143,8 +143,8 @@ local function on_rocket_launched(event)
if journey.mothership_cargo[slot.name] > journey.mothership_cargo_space[slot.name] then
journey.mothership_cargo[slot.name] = journey.mothership_cargo_space[slot.name]
end
if slot.name == "uranium-fuel-cell" or slot.name == 'nuclear-fuel' then
Server.to_discord_embed("Refueling progress: " .. journey.mothership_cargo[slot.name] .. "/" .. journey.mothership_cargo_space[slot.name])
if slot.name == 'uranium-fuel-cell' or slot.name == 'nuclear-reactor' then
Server.to_discord_embed('Refueling progress: ' .. slot.name .. ': ' .. journey.mothership_cargo[slot.name] .. '/' .. journey.mothership_cargo_space[slot.name])
end
end
end