1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00
Print more messages to discord.
Resource modifiers only apply to richness.
Generate a tiny amount of power from solar in the eternal night and pitch black.
Always reward 1000 white science flasks.
Disabled the auto-launch via permissions.
Capsule drop radius further reduced.
Terrain segmentation a bit more random.
Fuel progress bar, +25 to +50 fuel requirement per world.
Add mixed ore to all worlds.
Add mixed ore modifier.
Satellites as a reroll token, mothership dispatches the satellite and rerolls the selectors.
Reroll is triggered at the top part of ship.
This commit is contained in:
MewMew 2021-05-25 22:12:08 +02:00
parent 7de1d62372
commit 1076fbf66e
4 changed files with 318 additions and 72 deletions

View File

@ -44,6 +44,12 @@ Public.world_selector_colors = {
[3] = {r = 200, g = 100, b = 100, a = 255}, [3] = {r = 200, g = 100, b = 100, a = 255},
} }
Public.reroll_selector_area_color = {r = 220, g = 220, b = 220, a = 255}
Public.reroll_selector_area = {
left_top = {x = -4, y = math.floor(Public.mothership_radius - 6) * -1},
right_bottom = {x = 4, y = math.floor(Public.mothership_radius - 6) * -1 + 5},
}
Public.mothership_messages = { Public.mothership_messages = {
waiting = { waiting = {
"Return to me, so we can continue the journey!", "Return to me, so we can continue the journey!",
@ -76,25 +82,26 @@ Public.mothership_gen_settings = {
} }
Public.modifiers = { Public.modifiers = {
["trees"] = {-30, -15, "Trees"}, ["trees"] = {-20, -10, "Trees"},
["tree_durability"] = {-30, -15, "Tree Durability"}, ["tree_durability"] = {-30, -15, "Tree Durability"},
["cliff_settings"] = {20, 40, "Cliffs"}, ["cliff_settings"] = {20, 40, "Cliffs"},
["water"] = {-30, -15, "Water"}, ["water"] = {-20, -10, "Water"},
["coal"] = {-20, -10, "Coal"}, ["coal"] = {-20, -10, "Coal"},
["stone"] = {-20, -10, "Stone"}, ["stone"] = {-20, -10, "Stone"},
["iron-ore"] = {-20, -10, "Iron Ore"}, ["iron-ore"] = {-20, -10, "Iron Ore"},
["copper-ore"] = {-20, -10, "Copper Ore"}, ["copper-ore"] = {-20, -10, "Copper Ore"},
["crude-oil"] = {-20, -10, "Oil"}, ["crude-oil"] = {-20, -10, "Oil"},
["uranium-ore"] = {-20, -10, "Uranium Ore"}, ["uranium-ore"] = {-20, -10, "Uranium Ore"},
["enemy-base"] = {20, 40, "Nests"}, ["mixed_ore"] = {-20, -10, "Mixed Ore"},
["expansion_cooldown"] = {-40, -20, "Nest Expansion Cooldown"}, ["enemy-base"] = {10, 20, "Nests"},
["enemy_attack_pollution_consumption_modifier"] = {-30, -15, "Nest Pollution Consumption"}, ["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"}, ["max_unit_group_size"] = {15, 30, "Biter Group Size Maximum"},
["time_factor"] = {20, 40, "Evolution Time Factor"}, ["time_factor"] = {15, 30, "Evolution Time Factor"},
["destroy_factor"] = {20, 40, "Evolution Destroy Factor"}, ["destroy_factor"] = {15, 30, "Evolution Destroy Factor"},
["pollution_factor"] = {20, 40, "Evolution Pollution Factor"}, ["pollution_factor"] = {15, 30, "Evolution Pollution Factor"},
["ageing"] = {-30, -15, "Terrain Pollution Consumption"}, ["ageing"] = {-20, -10, "Terrain Pollution Consumption"},
["diffusion_ratio"] = {15, 30, "Pollution Diffusion"}, ["diffusion_ratio"] = {10, 20, "Pollution Diffusion"},
["technology_price_multiplier"] = {10, 20, "Technology Price"}, ["technology_price_multiplier"] = {10, 20, "Technology Price"},
} }
@ -152,26 +159,26 @@ Public.build_type_whitelist = {
Public.unique_world_traits = { Public.unique_world_traits = {
["lush"] = {"Lush", "Pure Vanilla."}, ["lush"] = {"Lush", "Pure Vanilla."},
["eternal_night"] = {"Eternal Night", "This world seems to be missing a sun."},
["dense_atmosphere"] = {"Dense Atmosphere", "Your roboport structures seem to malfunction."},
["pitch_black"] = {"Pitch Black", "No light may reach this realm."},
["volcanic"] = {"Volcanic", "The floor is (almost) lava."},
["matter_anomaly"] = {"Matter Anomaly", "Why can't i hold all these ores."}, ["matter_anomaly"] = {"Matter Anomaly", "Why can't i hold all these ores."},
["mountainous"] = {"Mountainous", "Diggy diggy hole!"}, ["mountainous"] = {"Mountainous", "Diggy diggy hole!"},
["quantum_anomaly"] = {"Quantum Anomaly", "Research complete."}, ["quantum_anomaly"] = {"Quantum Anomaly", "Research complete."},
["pitch_black"] = {"Pitch Black", "No light may reach this realm."},
["replicant_fauna"] = {"Replicant Fauna", "The biters feed on your structures."}, ["replicant_fauna"] = {"Replicant Fauna", "The biters feed on your structures."},
["tarball"] = {"Tarball", "Door stuck, Door stuck..."}, ["tarball"] = {"Tarball", "Door stuck, Door stuck..."},
["swamps"] = {"Swamps", "No deep water to be found in this world."}, ["swamps"] = {"Swamps", "No deep water to be found in this world."},
["volcanic"] = {"Volcanic", "The floor is (almost) lava."},
["chaotic_resources"] = {"Chaotic Resources", "Something to sort out."}, ["chaotic_resources"] = {"Chaotic Resources", "Something to sort out."},
["infested"] = {"Infested", "They lurk inside."}, ["infested"] = {"Infested", "They lurk inside."},
["low_mass"] = {"Low Mass", "You feel light footed and the robots are buzzing."}, ["low_mass"] = {"Low Mass", "You feel light footed and the robots are buzzing."},
["eternal_night"] = {"Eternal Night", "This world seems to be missing a sun."},
["eternal_day"] = {"Eternal Day", "The sun never moves."}, ["eternal_day"] = {"Eternal Day", "The sun never moves."},
["dense_atmosphere"] = {"Dense Atmosphere", "The roboports seem to malfunction."},
["undead_plague"] = {"Undead Plague", "The dead are restless."}, ["undead_plague"] = {"Undead Plague", "The dead are restless."},
--[[
]]
--["snowpiercer"] = {"Snowpiercer", "It's cold outside, so very cold."},
--["wasteland"] = {"Wasteland", "Smells like sulfur."}, --["wasteland"] = {"Wasteland", "Smells like sulfur."},
--["wetlands"] = {"Wetlands", "Many rivers and many fish."}, --["wetlands"] = {"Wetlands", "Many rivers and many fish."},
--["high_mass"] = {"High Mass", "Your feet will need some proper ground to walk well."},
} }
return Public return Public

View File

@ -1,10 +1,18 @@
--luacheck: ignore --luacheck: ignore
local Public = {} local Map_functions = require 'tools.map_functions'
local Server = require 'utils.server' local Server = require 'utils.server'
local Get_noise = require 'utils.get_noise'
local Constants = require 'maps.journey.constants' local Constants = require 'maps.journey.constants'
local Unique_modifiers = require 'maps.journey.unique_modifiers' local Unique_modifiers = require 'maps.journey.unique_modifiers'
local math_sqrt = math.sqrt
local math_random = math.random
local math_floor = math.floor
local math_abs = math.abs
local function clear_world_selectors(journey) local Public = {}
local mixed_ores = {'copper-ore', 'iron-ore', 'stone', 'coal'}
local function clear_selectors(journey)
for k, world_selector in pairs(journey.world_selectors) do for k, world_selector in pairs(journey.world_selectors) do
for _, ID in pairs(world_selector.texts) do for _, ID in pairs(world_selector.texts) do
rendering.destroy(ID) rendering.destroy(ID)
@ -12,6 +20,21 @@ local function clear_world_selectors(journey)
journey.world_selectors[k].texts = {} journey.world_selectors[k].texts = {}
journey.world_selectors[k].activation_level = 0 journey.world_selectors[k].activation_level = 0
end end
for _, ID in pairs(journey.reroll_selector.texts) do
rendering.destroy(ID)
end
journey.reroll_selector.texts = {}
journey.reroll_selector.activation_level = 0
end
function Public.place_mixed_ore(event, journey)
if math_random(1, 192) ~= 1 then return end
local surface = event.surface
local x = event.area.left_top.x + math_random(0, 31)
local y = event.area.left_top.y + math_random(0, 31)
local base_amount = 1000 + math_sqrt(x ^ 2 + y ^ 2) * 5
local richness = journey.mixed_ore_richness
Map_functions.draw_rainbow_patch({x = x, y = y}, surface, math_random(17, 23), base_amount * richness + 100)
end end
local function place_teleporter(journey, surface, position) local function place_teleporter(journey, surface, position)
@ -100,10 +123,10 @@ local function remove_offline_players(maximum_age_in_hours)
game.remove_offline_players(players_to_remove) game.remove_offline_players(players_to_remove)
end end
local function get_current_modifier_percentage(name) local function get_current_modifier_percentage(name, journey)
local mgs = game.surfaces.nauvis.map_gen_settings local mgs = game.surfaces.nauvis.map_gen_settings
for _, autoplace in pairs({"iron-ore", "copper-ore", "uranium-ore", "coal", "stone", "crude-oil", "stone", "trees", "enemy-base"}) do for _, autoplace in pairs({"iron-ore", "copper-ore", "uranium-ore", "coal", "stone", "crude-oil", "stone", "trees", "enemy-base"}) do
if name == autoplace then return mgs.autoplace_controls[name].frequency end if name == autoplace then return mgs.autoplace_controls[name].richness end
end end
if name == "cliff_settings" then return 40 / mgs.cliff_settings.cliff_elevation_interval end if name == "cliff_settings" then return 40 / mgs.cliff_settings.cliff_elevation_interval end
if name == "water" then return mgs.water end if name == "water" then return mgs.water end
@ -117,6 +140,7 @@ local function get_current_modifier_percentage(name)
if name == "diffusion_ratio" then return game.map_settings.pollution.diffusion_ratio * 50 end if name == "diffusion_ratio" then return game.map_settings.pollution.diffusion_ratio * 50 end
if name == "tree_durability" then return game.map_settings.pollution.pollution_restored_per_tree_damage * 0.1 end if name == "tree_durability" then return game.map_settings.pollution.pollution_restored_per_tree_damage * 0.1 end
if name == "max_unit_group_size" then return game.map_settings.unit_group.max_unit_group_size * 0.005 end if name == "max_unit_group_size" then return game.map_settings.unit_group.max_unit_group_size * 0.005 end
if name == "mixed_ore" then return journey.mixed_ore_richness end
end end
local function delete_nauvis_chunks(journey) local function delete_nauvis_chunks(journey)
@ -184,7 +208,7 @@ function Public.draw_gui(journey)
local tooltip = Constants.unique_world_traits[journey.world_trait][2] .. "\n\n" local tooltip = Constants.unique_world_traits[journey.world_trait][2] .. "\n\n"
for k, v in pairs(Constants.modifiers) do for k, v in pairs(Constants.modifiers) do
tooltip = tooltip .. v[3] .. " - " .. math.round(get_current_modifier_percentage(k) * 100, 1) .. "%\n" tooltip = tooltip .. v[3] .. " - " .. math.round(get_current_modifier_percentage(k, journey) * 100, 1) .. "%\n"
end end
tooltip = tooltip .. "\nCapsules:\n" tooltip = tooltip .. "\nCapsules:\n"
@ -197,17 +221,83 @@ function Public.draw_gui(journey)
for _, player in pairs(game.connected_players) do for _, player in pairs(game.connected_players) do
if not player.gui.top.journey_button then if not player.gui.top.journey_button then
local button = player.gui.top.add({type = "sprite-button", name = "journey_button", caption = ""}) local element = player.gui.top.add({type = "sprite-button", name = "journey_button", caption = ""})
button.style.font = "heading-1" element.style.font = "heading-1"
button.style.font_color = {222, 222, 222} element.style.font_color = {222, 222, 222}
button.style.minimal_height = 38 element.style.minimal_height = 38
button.style.minimal_width = 250 element.style.minimal_width = 250
button.style.padding = -2 element.style.padding = -2
end end
local gui = player.gui.top.journey_button local gui = player.gui.top.journey_button
gui.caption = caption gui.caption = caption
gui.tooltip = tooltip gui.tooltip = tooltip
end end
local fuel_requirement = journey.mothership_cargo_space["uranium-fuel-cell"]
local value
if fuel_requirement == 0 then
value = 1
else
value = journey.mothership_cargo["uranium-fuel-cell"] / fuel_requirement
end
local tooltip = "Fuel requirement to advance to next world:\n" .. fuel_requirement .. "\n\nNuclear Fuel Cells in Mothership Cargo:\n" .. journey.mothership_cargo["uranium-fuel-cell"]
for _, player in pairs(game.connected_players) do
if not player.gui.top.journey_fuel then
local frame = player.gui.top.add({type = 'frame', name = 'journey_fuel'})
frame.style.padding = 0
local element = frame.add({type = 'sprite', sprite = 'item/uranium-fuel-cell', name = "journey_fuel_sprite"})
element.style.minimal_width = 32
element.style.minimal_height = 32
element.style.maximal_width = 32
element.style.maximal_height = 32
element.style.margin = 0
element.style.padding = 0
local element = frame.add({type = 'progressbar', name = 'journey_fuel_progressbar', value = 0})
element.style.minimal_width = 100
element.style.maximal_width = 100
element.style.top_margin = 12
element.style.right_margin = 12
end
local gui = player.gui.top.journey_fuel
gui.tooltip = tooltip
local gui = player.gui.top.journey_fuel.journey_fuel_sprite
gui.tooltip = tooltip
local gui = player.gui.top.journey_fuel.journey_fuel_progressbar
gui.value = value
gui.tooltip = tooltip
end
local max_sattelites = journey.mothership_cargo_space["satellite"]
local value = journey.mothership_cargo["satellite"] / max_sattelites
local tooltip = "Room for satellites in Mothership cargo:\n" .. max_sattelites .. "\n\nSatellites stored:\n" .. journey.mothership_cargo["satellite"]
for _, player in pairs(game.connected_players) do
if not player.gui.top.journey_satellites then
local frame = player.gui.top.add({type = 'frame', name = 'journey_satellites'})
frame.style.left_margin = 4
frame.style.padding = 0
local element = frame.add({type = 'sprite', sprite = 'item/satellite', name = "journey_satellites_sprite"})
element.style.minimal_width = 32
element.style.minimal_height = 32
element.style.maximal_width = 32
element.style.maximal_height = 32
element.style.margin = 0
element.style.padding = 0
local element = frame.add({type = 'progressbar', name = 'journey_satellites_progressbar', value = 0})
element.style.minimal_width = 100
element.style.maximal_width = 100
element.style.top_margin = 12
element.style.right_margin = 12
end
local gui = player.gui.top.journey_satellites
gui.tooltip = tooltip
local gui = player.gui.top.journey_satellites.journey_satellites_sprite
gui.tooltip = tooltip
local gui = player.gui.top.journey_satellites.journey_satellites_progressbar
gui.value = value
gui.tooltip = tooltip
end
end end
local function is_mothership(position) local function is_mothership(position)
@ -298,12 +388,20 @@ function Public.hard_reset(journey)
end end
journey.world_selectors = {} journey.world_selectors = {}
journey.reroll_selector = {activation_level = 0}
for i = 1, 3, 1 do journey.world_selectors[i] = {activation_level = 0, texts = {}} end for i = 1, 3, 1 do journey.world_selectors[i] = {activation_level = 0, texts = {}} end
journey.mothership_speed = 0.5 journey.mothership_speed = 0.5
journey.characters_in_mothership = 0 journey.characters_in_mothership = 0
journey.world_color_filters = {} journey.world_color_filters = {}
journey.mixed_ore_richness = 1
journey.mothership_messages = {} journey.mothership_messages = {}
journey.mothership_cargo = {} journey.mothership_cargo = {}
journey.mothership_cargo["uranium-fuel-cell"] = 10
journey.mothership_cargo["satellite"] = 1
journey.mothership_cargo_space = {
["satellite"] = 1,
["uranium-fuel-cell"] = 0,
}
journey.bonus_goods = {} journey.bonus_goods = {}
journey.nauvis_chunk_positions = nil journey.nauvis_chunk_positions = nil
journey.world_number = 0 journey.world_number = 0
@ -349,9 +447,6 @@ function Public.draw_mothership(journey)
for k, area in pairs(Constants.world_selector_areas) do for k, area in pairs(Constants.world_selector_areas) do
journey.world_selectors[k].rectangles = {} journey.world_selectors[k].rectangles = {}
local center = {x = area.left_top.x + Constants.world_selector_width * 0.5, y = area.left_top.y + Constants.world_selector_height * 0.5}
local position = area.left_top local position = area.left_top
local rectangle = rendering.draw_rectangle { local rectangle = rendering.draw_rectangle {
width = 1, width = 1,
@ -364,7 +459,6 @@ function Public.draw_mothership(journey)
only_in_alt_mode = false only_in_alt_mode = false
} }
table.insert(journey.world_selectors[k].rectangles, rectangle) table.insert(journey.world_selectors[k].rectangles, rectangle)
journey.world_selectors[k].border = rendering.draw_rectangle { journey.world_selectors[k].border = rendering.draw_rectangle {
width = 8, width = 8,
filled=false, filled=false,
@ -377,6 +471,27 @@ function Public.draw_mothership(journey)
} }
end end
journey.reroll_selector.rectangle = rendering.draw_rectangle {
width = 8,
filled=true,
surface = surface,
left_top = Constants.reroll_selector_area.left_top,
right_bottom = Constants.reroll_selector_area.right_bottom,
color = Constants.reroll_selector_area_color,
draw_on_ground = true,
only_in_alt_mode = false
}
journey.reroll_selector.border = rendering.draw_rectangle {
width = 8,
filled=false,
surface = surface,
left_top = Constants.reroll_selector_area.left_top,
right_bottom = Constants.reroll_selector_area.right_bottom,
color = {r = 100, g = 100, b = 100, a = 255},
draw_on_ground = true,
only_in_alt_mode = false
}
for k, item_name in pairs({"arithmetic-combinator", "constant-combinator", "decider-combinator", "programmable-speaker", "red-wire", "green-wire", "small-lamp", "substation", "pipe", "gate", "stone-wall", "transport-belt"}) do for k, item_name in pairs({"arithmetic-combinator", "constant-combinator", "decider-combinator", "programmable-speaker", "red-wire", "green-wire", "small-lamp", "substation", "pipe", "gate", "stone-wall", "transport-belt"}) do
local e = surface.create_entity({name = 'infinity-chest', position = {-7 + k, Constants.mothership_radius - 3}, force = 'player'}) local e = surface.create_entity({name = 'infinity-chest', position = {-7 + k, Constants.mothership_radius - 3}, force = 'player'})
e.set_infinity_container_filter(1, {name = item_name, count = game.item_prototypes[item_name].stack_size}) e.set_infinity_container_filter(1, {name = item_name, count = game.item_prototypes[item_name].stack_size})
@ -409,6 +524,7 @@ function Public.draw_mothership(journey)
e.operable = false e.operable = false
local e = surface.create_entity({name = "burner-inserter", position = {(x - 1) * m, y}, force = "player"}) local e = surface.create_entity({name = "burner-inserter", position = {(x - 1) * m, y}, force = "player"})
e.direction = 4 + m * 2 e.direction = 4 + m * 2
e.rotatable = false
e.minable = false e.minable = false
e.destructible = false e.destructible = false
e.operable = false e.operable = false
@ -462,6 +578,11 @@ local function animate_selectors(journey)
rendering.set_color(rectangle, {r = color.r * activation_level, g = color.g * activation_level, b = color.b * activation_level, a = 255}) rendering.set_color(rectangle, {r = color.r * activation_level, g = color.g * activation_level, b = color.b * activation_level, a = 255})
end end
end end
local activation_level = journey.reroll_selector.activation_level
if activation_level < 0.2 then activation_level = 0.2 end
if activation_level > 1 then activation_level = 1 end
local color = Constants.reroll_selector_area_color
rendering.set_color(journey.reroll_selector.rectangle, {r = color.r * activation_level, g = color.g * activation_level, b = color.b * activation_level, a = 255})
end end
local function draw_background(journey, surface) local function draw_background(journey, surface)
@ -498,6 +619,28 @@ end
function Public.set_world_selectors(journey) function Public.set_world_selectors(journey)
local surface = game.surfaces.mothership local surface = game.surfaces.mothership
local x = Constants.reroll_selector_area.left_top.x + 3.2
journey.reroll_selector.texts = {
rendering.draw_text{
text = journey.mothership_cargo.satellite .. " x ",
surface = surface,
target = {x, Constants.reroll_selector_area.left_top.y - 1.5},
color = {255, 255, 255, 255},
scale = 1.5,
font = "default-large-bold",
alignment = "center",
scale_with_zoom = false,
},
rendering.draw_sprite{
sprite = "item/satellite",
surface = surface,
y_scale = 1.5,
x_scale = 1.5,
target = {x + 1.6, Constants.reroll_selector_area.left_top.y - 1},
},
}
local modifier_names = {} local modifier_names = {}
for k, _ in pairs(Constants.modifiers) do for k, _ in pairs(Constants.modifiers) do
table.insert(modifier_names, k) table.insert(modifier_names, k)
@ -520,11 +663,12 @@ function Public.set_world_selectors(journey)
world_selector.modifiers = {} world_selector.modifiers = {}
world_selector.bonus_goods = {} world_selector.bonus_goods = {}
world_selector.world_trait = unique_world_traits[k] world_selector.world_trait = unique_world_traits[k]
world_selector.fuel_requirement = math.random(25, 50)
local position = Constants.world_selector_areas[k].left_top local position = Constants.world_selector_areas[k].left_top
local texts = world_selector.texts local texts = world_selector.texts
local modifiers = world_selector.modifiers local modifiers = world_selector.modifiers
local bonus_goods = world_selector.bonus_goods local bonus_goods = world_selector.bonus_goods
local y_modifier = - 8.5 local y_modifier = -9.7
for i = 1, 8, 1 do for i = 1, 8, 1 do
local modifier = modifier_names[i] local modifier = modifier_names[i]
@ -571,13 +715,30 @@ function Public.set_world_selectors(journey)
}) })
end end
y_modifier = y_modifier + 0.85
table.insert(texts, rendering.draw_text{
text = "Fuel requirement +" .. world_selector.fuel_requirement,
surface = surface,
target = {position.x + Constants.world_selector_width * 0.5, position.y + y_modifier},
color = {155, 155, 0, 255},
scale = 1.25,
font = "default-large",
alignment = "center",
scale_with_zoom = false
})
table.insert(texts, rendering.draw_sprite{
sprite = "item/uranium-fuel-cell",
surface = surface,
target = {position.x + Constants.world_selector_width * 0.5 + 3.7, position.y + y_modifier + 0.5},
})
for i = 1, 3, 1 do for i = 1, 3, 1 do
local key = bonus_goods_keys[i] local key = bonus_goods_keys[i]
local bonus_good = Constants.starter_goods_pool[key] local bonus_good = Constants.starter_goods_pool[key]
bonus_goods[i] = {bonus_good[1], math.random(bonus_good[2], bonus_good[3])} bonus_goods[i] = {bonus_good[1], math.random(bonus_good[2], bonus_good[3])}
end end
y_modifier = y_modifier + 1 y_modifier = y_modifier + 1.1
local x_modifier = -0.5 local x_modifier = -0.5
for k2, good in pairs(world_selector.bonus_goods) do for k2, good in pairs(world_selector.bonus_goods) do
@ -611,7 +772,7 @@ function Public.set_world_selectors(journey)
destroy_teleporter(journey, game.surfaces.nauvis, Constants.mothership_teleporter_position) destroy_teleporter(journey, game.surfaces.nauvis, Constants.mothership_teleporter_position)
destroy_teleporter(journey, surface, Constants.mothership_teleporter_position) destroy_teleporter(journey, surface, Constants.mothership_teleporter_position)
Server.to_discord_embed("World " .. journey.world_number .. "selection has started!") Server.to_discord_embed("World " .. journey.world_number .. " selection has started!")
journey.game_state = "delete_nauvis_chunks" journey.game_state = "delete_nauvis_chunks"
end end
@ -628,6 +789,37 @@ function Public.delete_nauvis_chunks(journey)
journey.game_state = "mothership_world_selection" journey.game_state = "mothership_world_selection"
end end
function Public.reroll_worlds(journey)
local surface = game.surfaces.mothership
Public.teleport_players_to_mothership(journey)
draw_background(journey, surface)
animate_selectors(journey)
local reroll_selector_activation_level = get_activation_level(surface, Constants.reroll_selector_area)
journey.reroll_selector.activation_level = reroll_selector_activation_level
for i = 1, 3, 1 do
local activation_level = get_activation_level(surface, Constants.world_selector_areas[i])
journey.world_selectors[i].activation_level = activation_level
end
if reroll_selector_activation_level > 1 then
journey.mothership_speed = journey.mothership_speed + 0.025
if journey.mothership_speed > 4 then
journey.mothership_speed = 4
clear_selectors(journey)
journey.mothership_cargo.satellite = journey.mothership_cargo.satellite - 1
Public.draw_gui(journey)
table.insert(journey.mothership_messages, "New lands have been discovered!")
journey.game_state = "set_world_selectors"
end
else
journey.mothership_speed = journey.mothership_speed - 0.25
if journey.mothership_speed < 0.35 then
table.insert(journey.mothership_messages, "Aborting..")
journey.game_state = "mothership_world_selection"
journey.mothership_speed = 0.35
end
end
end
function Public.mothership_world_selection(journey) function Public.mothership_world_selection(journey)
Public.teleport_players_to_mothership(journey) Public.teleport_players_to_mothership(journey)
@ -637,6 +829,9 @@ function Public.mothership_world_selection(journey)
if daytime < 0 then daytime = 0 end if daytime < 0 then daytime = 0 end
surface.daytime = daytime surface.daytime = daytime
local reroll_selector_activation_level = get_activation_level(surface, Constants.reroll_selector_area)
journey.reroll_selector.activation_level = reroll_selector_activation_level
journey.selected_world = false journey.selected_world = false
for i = 1, 3, 1 do for i = 1, 3, 1 do
local activation_level = get_activation_level(surface, Constants.world_selector_areas[i]) local activation_level = get_activation_level(surface, Constants.world_selector_areas[i])
@ -646,6 +841,12 @@ function Public.mothership_world_selection(journey)
end end
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
if journey.selected_world then if journey.selected_world then
if not journey.mothership_advancing_to_world then if not journey.mothership_advancing_to_world then
table.insert(journey.mothership_messages, "Advancing to selected world.") table.insert(journey.mothership_messages, "Advancing to selected world.")
@ -707,6 +908,7 @@ end
function Public.clear_unique_modifiers(journey) function Public.clear_unique_modifiers(journey)
local surface = game.surfaces.nauvis local surface = game.surfaces.nauvis
surface.freeze_daytime = false surface.freeze_daytime = false
surface.solar_power_multiplier = 1
surface.min_brightness = 0.15 surface.min_brightness = 0.15
surface.brightness_visual_weights = {0, 0, 0, 1} surface.brightness_visual_weights = {0, 0, 0, 1}
@ -724,13 +926,23 @@ function Public.create_the_world(journey)
local surface = game.surfaces.nauvis local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings local mgs = surface.map_gen_settings
mgs.seed = math.random(1, 4294967295) mgs.seed = math.random(1, 4294967295)
mgs.terrain_segmentation = math.random(10, 20) * 0.1
mgs.peaceful_mode = false mgs.peaceful_mode = false
local modifiers = journey.world_selectors[journey.selected_world].modifiers local modifiers = journey.world_selectors[journey.selected_world].modifiers
for _, modifier in pairs(modifiers) do for _, modifier in pairs(modifiers) do
local m = (100 + modifier[2]) * 0.01 local m = (100 + modifier[2]) * 0.01
local name = modifier[1] local name = modifier[1]
for _, autoplace in pairs({"iron-ore", "copper-ore", "uranium-ore", "coal", "stone", "crude-oil", "stone", "trees", "enemy-base"}) do for _, autoplace in pairs({"iron-ore", "copper-ore", "uranium-ore", "coal", "stone", "crude-oil"}) do
if name == autoplace then
mgs.autoplace_controls[name].richness = mgs.autoplace_controls[name].richness * m
break
end
end
if name == "mixed_ore" then
journey.mixed_ore_richness = journey.mixed_ore_richness * m
end
for _, autoplace in pairs({"trees", "enemy-base"}) do
if name == autoplace then if name == autoplace then
for k, v in pairs(mgs.autoplace_controls[name]) do for k, v in pairs(mgs.autoplace_controls[name]) do
mgs.autoplace_controls[name][k] = mgs.autoplace_controls[name][k] * m mgs.autoplace_controls[name][k] = mgs.autoplace_controls[name][k] * m
@ -783,7 +995,10 @@ function Public.create_the_world(journey)
journey.world_trait = journey.world_selectors[journey.selected_world].world_trait journey.world_trait = journey.world_selectors[journey.selected_world].world_trait
journey.nauvis_chunk_positions = nil journey.nauvis_chunk_positions = nil
journey.mothership_cargo["uranium-fuel-cell"] = 0
journey.world_number = journey.world_number + 1 journey.world_number = journey.world_number + 1
journey.mothership_cargo_space["satellite"] = journey.world_number
journey.mothership_cargo_space["uranium-fuel-cell"] = journey.mothership_cargo_space["uranium-fuel-cell"] + journey.world_selectors[journey.selected_world].fuel_requirement
game.forces.enemy.reset_evolution() game.forces.enemy.reset_evolution()
@ -803,7 +1018,7 @@ function Public.create_the_world(journey)
end end
function Public.wipe_offline_players(journey) function Public.wipe_offline_players(journey)
remove_offline_players(24) remove_offline_players(48)
for _, player in pairs(game.players) do for _, player in pairs(game.players) do
if not player.connected then if not player.connected then
player.force = game.forces.enemy player.force = game.forces.enemy
@ -834,14 +1049,10 @@ function Public.make_it_night(journey)
daytime = daytime + 0.02 daytime = daytime + 0.02
surface.daytime = daytime surface.daytime = daytime
if daytime > 0.5 then if daytime > 0.5 then
clear_world_selectors(journey) clear_selectors(journey)
game.reset_time_played() game.reset_time_played()
journey.mothership_cargo["uranium-fuel-cell"] = nil
place_teleporter(journey, surface, Constants.mothership_teleporter_position) place_teleporter(journey, surface, Constants.mothership_teleporter_position)
table.insert(journey.mothership_messages, "Teleporter deployed. [gps=" .. Constants.mothership_teleporter_position.x .. "," .. Constants.mothership_teleporter_position.y .. ",mothership]") table.insert(journey.mothership_messages, "Teleporter deployed. [gps=" .. Constants.mothership_teleporter_position.x .. "," .. Constants.mothership_teleporter_position.y .. ",mothership]")
journey.game_state = "dispatch_goods" journey.game_state = "dispatch_goods"
end end
end end
@ -876,10 +1087,10 @@ function Public.dispatch_goods(journey)
return return
end end
if math.random(1, 12) ~= 1 then return end if math.random(1, 2) ~= 1 then return end
local chunk = surface.get_random_chunk() local chunk = surface.get_random_chunk()
if math.abs(chunk.x) > 6 or math.abs(chunk.y) > 6 then return end if math.abs(chunk.x) > 4 or math.abs(chunk.y) > 4 then return end
local position = {x = chunk.x * 32 + math.random(0, 31), y = chunk.y * 32 + math.random(0, 31)} local position = {x = chunk.x * 32 + math.random(0, 31), y = chunk.y * 32 + math.random(0, 31)}
position = surface.find_non_colliding_position("rocket-silo", position, 32, 1) position = surface.find_non_colliding_position("rocket-silo", position, 32, 1)
@ -898,8 +1109,9 @@ end
function Public.world(journey) function Public.world(journey)
if journey.mothership_cargo["uranium-fuel-cell"] then if journey.mothership_cargo["uranium-fuel-cell"] then
if journey.mothership_cargo["uranium-fuel-cell"] >= 50 then if journey.mothership_cargo["uranium-fuel-cell"] >= journey.mothership_cargo_space["uranium-fuel-cell"] then
table.insert(journey.mothership_messages, "[img=item/uranium-fuel-cell] Refuel operation successful!! =^.^=") table.insert(journey.mothership_messages, "[img=item/uranium-fuel-cell] Refuel operation successful!! =^.^=")
Server.to_discord_embed("Refuel operation complete!")
journey.game_state = "mothership_waiting_for_players" journey.game_state = "mothership_waiting_for_players"
end end
end end

View File

@ -3,6 +3,9 @@
Journey, launch a rocket in increasingly harder getting worlds. - MewMew Journey, launch a rocket in increasingly harder getting worlds. - MewMew
]]-- ]]--
require 'modules.rocket_launch_always_yields_science'
local Server = require 'utils.server'
local Constants = require 'maps.journey.constants' local Constants = require 'maps.journey.constants'
local Functions = require 'maps.journey.functions' local Functions = require 'maps.journey.functions'
local Unique_modifiers = require 'maps.journey.unique_modifiers' local Unique_modifiers = require 'maps.journey.unique_modifiers'
@ -21,6 +24,7 @@ local function on_chunk_generated(event)
local surface = event.surface local surface = event.surface
if surface.index == 1 then if surface.index == 1 then
Functions.place_mixed_ore(event, journey)
local unique_modifier = Unique_modifiers[journey.world_trait] local unique_modifier = Unique_modifiers[journey.world_trait]
if unique_modifier.on_chunk_generated then unique_modifier.on_chunk_generated(event, journey) end if unique_modifier.on_chunk_generated then unique_modifier.on_chunk_generated(event, journey) end
return return
@ -102,7 +106,16 @@ local function on_rocket_launched(event)
else else
journey.mothership_cargo[slot.name] = slot.count journey.mothership_cargo[slot.name] = slot.count
end end
if journey.mothership_cargo_space[slot.name] then
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" then
Server.to_discord_embed("Refueling progress: " .. journey.mothership_cargo[slot.name] .. "/" .. journey.mothership_cargo_space[slot.name])
end
end
end end
Functions.draw_gui(journey)
end end
local function on_nth_tick() local function on_nth_tick()
@ -113,7 +126,7 @@ end
local function on_init() local function on_init()
local T = Map.Pop_info() local T = Map.Pop_info()
T.main_caption = 'The Journey' T.main_caption = 'The Journey'
T.sub_caption = 'v 1.6' T.sub_caption = 'v 1.7'
T.text = T.text =
table.concat( table.concat(
{ {
@ -123,15 +136,19 @@ local function on_init()
'It is however, only capable of transfering the subjects body, anything besides will be left on the ground.\n\n', 'It is however, only capable of transfering the subjects body, anything besides will be left on the ground.\n\n',
'Worlds will get more difficult with each jump, adding the chosen modifiers.\n', 'Worlds will get more difficult with each jump, adding the chosen modifiers.\n',
'Launch a stack of uranium fuel cells via rocket cargo, to advance to the next world.\n', 'Worlds can be rerolled by spending a satellite.\n',
'The tooltip on the top button has information about the current world.\n', 'Launch uranium fuel cells via rocket cargo, to advance to the next world.\n',
'The tooltips on the top buttons yield informations about the current world.\n',
'If the journey ends, an admin can fully reset the map via command "/reset-journey".\n\n', 'If the journey ends, an admin can fully reset the map via command "/reset-journey".\n\n',
'How far will this journey lead?\n\n', 'How far will the journey lead?\n\n',
} }
) )
T.main_caption_color = {r = 100, g = 20, b = 255} T.main_caption_color = {r = 100, g = 20, b = 255}
T.sub_caption_color = {r = 100, g = 100, b = 100} T.sub_caption_color = {r = 100, g = 100, b = 100}
game.permissions.get_group('Default').set_allows_action(defines.input_action.set_auto_launch_rocket, false)
Functions.hard_reset(journey) Functions.hard_reset(journey)
end end

View File

@ -41,8 +41,10 @@ Public.lush = {}
Public.eternal_night = { Public.eternal_night = {
on_world_start = function(journey) on_world_start = function(journey)
game.surfaces.nauvis.daytime = 0.5 local surface = game.surfaces.nauvis
game.surfaces.nauvis.freeze_daytime = true surface.daytime = 0.44
surface.freeze_daytime = true
surface.solar_power_multiplier = 5
end, end,
} }
@ -76,7 +78,7 @@ Public.mountainous = {
local surface = entity.surface local surface = entity.surface
event.buffer.clear() event.buffer.clear()
local ore = ore_raffle[math_random(1, size_of_ore_raffle)] local ore = ore_raffle[math_random(1, size_of_ore_raffle)]
local count = math_floor(math_sqrt(entity.position.x ^ 2 + entity.position.y ^ 2) * 0.02) + math_random(25, 75) local count = math_floor(math_sqrt(entity.position.x ^ 2 + entity.position.y ^ 2) * 0.05) + math_random(25, 75)
local ore_amount = math_floor(count * 0.85) local ore_amount = math_floor(count * 0.85)
local stone_amount = math_floor(count * 0.15) local stone_amount = math_floor(count * 0.15)
surface.spill_item_stack(entity.position, {name = ore, count = ore_amount}, true) surface.spill_item_stack(entity.position, {name = ore, count = ore_amount}, true)
@ -120,10 +122,11 @@ Public.replicant_fauna = {
Public.pitch_black = { Public.pitch_black = {
on_world_start = function(journey) on_world_start = function(journey)
local surface = game.surfaces.nauvis local surface = game.surfaces.nauvis
surface.daytime = 0.5 surface.daytime = 0.44
surface.freeze_daytime = true surface.freeze_daytime = true
surface.solar_power_multiplier = 3
surface.min_brightness = 0 surface.min_brightness = 0
surface.brightness_visual_weights = {1, 1, 1, 1} surface.brightness_visual_weights = {0.8, 0.8, 0.8, 1}
end, end,
} }
@ -194,7 +197,7 @@ Public.volcanic = {
y_scale = 32, y_scale = 32,
target = event.area.left_top, target = event.area.left_top,
surface = event.surface, surface = event.surface,
tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.5}, tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.25},
render_layer = 'ground' render_layer = 'ground'
})) }))
end, end,
@ -211,6 +214,13 @@ Public.volcanic = {
surface.request_to_generate_chunks({x = 0, y = 0}, 3) surface.request_to_generate_chunks({x = 0, y = 0}, 3)
surface.force_generate_chunk_requests() surface.force_generate_chunk_requests()
surface.spill_item_stack({0, 0}, {name = "stone-brick", count = 4096}, true) surface.spill_item_stack({0, 0}, {name = "stone-brick", count = 4096}, true)
for x = -24, 24, 1 do
for y = -24, 24, 1 do
if math.sqrt(x ^ 2 + y ^ 2) < 24 then
surface.set_tiles({{name = "stone-path", position = {x, y}}}, true)
end
end
end
end, end,
} }
@ -268,13 +278,13 @@ Public.dense_atmosphere = {
local entity = event.created_entity local entity = event.created_entity
if not entity.valid then return end if not entity.valid then return end
if entity.surface.index ~= 1 then return end if entity.surface.index ~= 1 then return end
if entity.name == "roboport" then entity.die() end if entity.type == "roboport" then entity.die() end
end, end,
on_built_entity = function(event) on_built_entity = function(event)
local entity = event.created_entity local entity = event.created_entity
if not entity.valid then return end if not entity.valid then return end
if entity.surface.index ~= 1 then return end if entity.surface.index ~= 1 then return end
if entity.name == "roboport" then entity.die() end if entity.type == "roboport" then entity.die() end
end, end,
} }