mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-13 13:49:33 +02:00
commit
6d03a7dcd8
@ -57,6 +57,20 @@ Public.mothership_messages = {
|
||||
"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.",
|
||||
},
|
||||
}
|
||||
|
||||
Public.mothership_gen_settings = {
|
||||
@ -159,26 +173,28 @@ Public.build_type_whitelist = {
|
||||
|
||||
Public.unique_world_traits = {
|
||||
["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."},
|
||||
["abandoned_library"] = {"Abandoned Library", "No blueprints to be found."},
|
||||
["lazy_bastard"] = {"Lazy Bastard", "The machine does the job."},
|
||||
["oceanic"] = {"Oceanic", "Arrrr, the flame turrets seem to malfunction in this climate."},
|
||||
["ribbon"] = {"Ribbon", "Go right. (or left)"},
|
||||
["wasteland"] = {"Wasteland", "Rusty treasures."},
|
||||
["infested"] = {"Infested", "They lurk inside."},
|
||||
["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.\nThe laser turret structures seem to malfunction."},
|
||||
["mountainous"] = {"Mountainous", "Diggy diggy hole!"},
|
||||
["quantum_anomaly"] = {"Quantum Anomaly", "Research complete."},
|
||||
["replicant_fauna"] = {"Replicant Fauna", "The biters feed on your structures."},
|
||||
["tarball"] = {"Tarball", "Door stuck, Door stuck..."},
|
||||
["eternal_night"] = {"Eternal Night", "This world seems to be missing a sun."},
|
||||
["dense_atmosphere"] = {"Dense Atmosphere", "Your roboport structures seem to malfunction."},
|
||||
["undead_plague"] = {"Undead Plague", "The dead are restless."},
|
||||
["swamps"] = {"Swamps", "No deep water to be found in this world."},
|
||||
["chaotic_resources"] = {"Chaotic Resources", "Something to sort out."},
|
||||
["infested"] = {"Infested", "They lurk inside."},
|
||||
["chaotic_resources"] = {"Chaotic Resources", "Something to sort out."},
|
||||
["low_mass"] = {"Low Mass", "You feel light footed and the robots are buzzing."},
|
||||
["eternal_day"] = {"Eternal Day", "The sun never moves."},
|
||||
["undead_plague"] = {"Undead Plague", "The dead are restless."},
|
||||
["quantum_anomaly"] = {"Quantum Anomaly", "Research complete."},
|
||||
["replicant_fauna"] = {"Replicant Fauna", "The biters feed on your structures."},
|
||||
["tarball"] = {"Tarball", "Door stuck, Door stuck..."},
|
||||
--[[
|
||||
]]
|
||||
|
||||
--["wasteland"] = {"Wasteland", "Smells like sulfur."},
|
||||
--["wetlands"] = {"Wetlands", "Many rivers and many fish."},
|
||||
}
|
||||
|
||||
return Public
|
@ -34,7 +34,7 @@ function Public.place_mixed_ore(event, journey)
|
||||
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)
|
||||
Map_functions.draw_rainbow_patch({x = x, y = y}, surface, math_random(17, 22), base_amount * richness + 100)
|
||||
end
|
||||
|
||||
local function place_teleporter(journey, surface, position)
|
||||
@ -116,7 +116,6 @@ local function remove_offline_players(maximum_age_in_hours)
|
||||
local players_to_remove = {}
|
||||
for _, player in pairs(game.players) do
|
||||
if player.last_online < t then
|
||||
Session.clear_player(player)
|
||||
table.insert(players_to_remove, player)
|
||||
end
|
||||
end
|
||||
@ -162,7 +161,7 @@ local function delete_nauvis_chunks(journey)
|
||||
|
||||
if journey.size_of_nauvis_chunk_positions == 0 then return end
|
||||
|
||||
for c = 1, 16, 1 do
|
||||
for c = 1, 12, 1 do
|
||||
local chunk_position = journey.nauvis_chunk_positions[journey.size_of_nauvis_chunk_positions]
|
||||
if chunk_position then
|
||||
surface.delete_chunk(chunk_position)
|
||||
@ -201,6 +200,15 @@ function Public.deny_building(event)
|
||||
entity.die()
|
||||
end
|
||||
|
||||
function Public.register_built_silo(event, journey)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type ~= "rocket-silo" then return end
|
||||
entity.auto_launch = false
|
||||
table.insert(journey.rocket_silos, entity)
|
||||
end
|
||||
|
||||
function Public.draw_gui(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
@ -893,7 +901,7 @@ function Public.mothership_arrives_at_world(journey)
|
||||
end
|
||||
animate_selectors(journey)
|
||||
|
||||
journey.game_state = "clear_unique_modifiers"
|
||||
journey.game_state = "clear_modifiers"
|
||||
else
|
||||
journey.mothership_speed = journey.mothership_speed - 0.15
|
||||
end
|
||||
@ -905,14 +913,10 @@ function Public.mothership_arrives_at_world(journey)
|
||||
draw_background(journey, surface)
|
||||
end
|
||||
|
||||
function Public.clear_unique_modifiers(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.freeze_daytime = false
|
||||
surface.solar_power_multiplier = 1
|
||||
surface.min_brightness = 0.15
|
||||
surface.brightness_visual_weights = {0, 0, 0, 1}
|
||||
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
function Public.clear_modifiers(journey)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
local clear = unique_modifier.clear
|
||||
if clear then clear(journey) end
|
||||
|
||||
local force = game.forces.player
|
||||
force.reset()
|
||||
@ -995,9 +999,10 @@ function Public.create_the_world(journey)
|
||||
|
||||
journey.world_trait = journey.world_selectors[journey.selected_world].world_trait
|
||||
journey.nauvis_chunk_positions = nil
|
||||
journey.rocket_silos = {}
|
||||
journey.mothership_cargo["uranium-fuel-cell"] = 0
|
||||
journey.world_number = journey.world_number + 1
|
||||
journey.mothership_cargo_space["satellite"] = journey.world_number
|
||||
journey.mothership_cargo_space["satellite"] = math_floor(journey.world_number * 0.334) + 1
|
||||
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()
|
||||
@ -1011,14 +1016,13 @@ function Public.create_the_world(journey)
|
||||
end
|
||||
journey.goods_to_dispatch = {}
|
||||
for k, v in pairs(journey.bonus_goods) do table.insert(journey.goods_to_dispatch, {k, v}) end
|
||||
|
||||
Public.draw_gui(journey)
|
||||
|
||||
table.shuffle_table(journey.goods_to_dispatch)
|
||||
|
||||
journey.game_state = "wipe_offline_players"
|
||||
end
|
||||
|
||||
function Public.wipe_offline_players(journey)
|
||||
remove_offline_players(48)
|
||||
remove_offline_players(168)
|
||||
for _, player in pairs(game.players) do
|
||||
if not player.connected then
|
||||
player.force = game.forces.enemy
|
||||
@ -1031,6 +1035,7 @@ function Public.set_unique_modifiers(journey)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
local on_world_start = unique_modifier.on_world_start
|
||||
if on_world_start then on_world_start(journey) end
|
||||
Public.draw_gui(journey)
|
||||
journey.game_state = "place_teleporter_into_world"
|
||||
end
|
||||
|
||||
@ -1087,8 +1092,6 @@ function Public.dispatch_goods(journey)
|
||||
return
|
||||
end
|
||||
|
||||
if math.random(1, 2) ~= 1 then return end
|
||||
|
||||
local chunk = surface.get_random_chunk()
|
||||
if math.abs(chunk.x) > 4 or math.abs(chunk.y) > 4 then return end
|
||||
|
||||
@ -1116,6 +1119,24 @@ function Public.world(journey)
|
||||
end
|
||||
end
|
||||
draw_background(journey, game.surfaces.mothership)
|
||||
|
||||
if game.tick % 1800 ~= 0 then return end
|
||||
for k, silo in pairs(journey.rocket_silos) do
|
||||
if not silo or not silo.valid then
|
||||
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
|
||||
if inventory.get_item_count('satellite') == 1 or inventory.get_item_count('uranium-fuel-cell') >= fuel_cells_required then
|
||||
if silo.launch_rocket() then
|
||||
table.insert(journey.mothership_messages, "Launching rocket [gps=" .. silo.position.x .. "," .. silo.position.y .. ",nauvis]")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.mothership_waiting_for_players(journey)
|
||||
@ -1137,7 +1158,7 @@ function Public.teleporters(journey, player)
|
||||
if not player.character.valid then return end
|
||||
local surface = player.surface
|
||||
if surface.get_tile(player.position).name ~= Constants.teleporter_tile then return end
|
||||
local base_position = {Constants.mothership_teleporter_position.x , Constants.mothership_teleporter_position.y - 5}
|
||||
local base_position = {0,0}
|
||||
if surface.index == 1 then
|
||||
drop_player_items(player)
|
||||
local position = game.surfaces.mothership.find_non_colliding_position("character", base_position, 32, 0.5)
|
||||
|
@ -34,6 +34,24 @@ local function on_chunk_generated(event)
|
||||
Functions.on_mothership_chunk_generated(event)
|
||||
end
|
||||
|
||||
local function on_console_chat(event)
|
||||
if not event.player_index then return end
|
||||
local player = game.players[event.player_index]
|
||||
local message = event.message
|
||||
message = string.lower(message)
|
||||
local a, b = string.find(message, "?", 1, true)
|
||||
if not a then return end
|
||||
local a, b = string.find(message, "mother", 1, true)
|
||||
if not a then return end
|
||||
local answer = Constants.mothership_messages.answers[math.random(1, #Constants.mothership_messages.answers)]
|
||||
if math.random(1, 4) == 1 then
|
||||
for _ = 1, math.random(2, 5), 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, "...")
|
||||
end
|
||||
for _ = 1, math.random(15, 30), 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, answer)
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
Functions.draw_gui(journey)
|
||||
@ -72,29 +90,31 @@ end
|
||||
|
||||
local function on_built_entity(event)
|
||||
Functions.deny_building(event)
|
||||
Functions.register_built_silo(event, journey)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
if unique_modifier.on_built_entity then unique_modifier.on_built_entity(event) end
|
||||
if unique_modifier.on_built_entity then unique_modifier.on_built_entity(event, journey) end
|
||||
end
|
||||
|
||||
local function on_robot_built_entity(event)
|
||||
Functions.deny_building(event)
|
||||
Functions.register_built_silo(event, journey)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
if unique_modifier.on_robot_built_entity then unique_modifier.on_robot_built_entity(event) end
|
||||
if unique_modifier.on_robot_built_entity then unique_modifier.on_robot_built_entity(event, journey) end
|
||||
end
|
||||
|
||||
local function on_player_mined_entity(event)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
if unique_modifier.on_player_mined_entity then unique_modifier.on_player_mined_entity(event) end
|
||||
if unique_modifier.on_player_mined_entity then unique_modifier.on_player_mined_entity(event, journey) end
|
||||
end
|
||||
|
||||
local function on_robot_mined_entity(event)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
if unique_modifier.on_robot_mined_entity then unique_modifier.on_robot_mined_entity(event) end
|
||||
if unique_modifier.on_robot_mined_entity then unique_modifier.on_robot_mined_entity(event, journey) end
|
||||
end
|
||||
|
||||
local function on_entity_died(event)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
if unique_modifier.on_entity_died then unique_modifier.on_entity_died(event) end
|
||||
if unique_modifier.on_entity_died then unique_modifier.on_entity_died(event, journey) end
|
||||
end
|
||||
|
||||
local function on_rocket_launched(event)
|
||||
@ -126,17 +146,18 @@ end
|
||||
local function on_init()
|
||||
local T = Map.Pop_info()
|
||||
T.main_caption = 'The Journey'
|
||||
T.sub_caption = 'v 1.7'
|
||||
T.sub_caption = 'v 1.8'
|
||||
T.text =
|
||||
table.concat(
|
||||
{
|
||||
'The selectors in the mothership, allow you to select a destination.\n',
|
||||
'Once enough players are on a selector, mothership will start traveling.\n',
|
||||
'A teleporter will be deployed, after reaching the target.\n',
|
||||
'It is however, only capable of transfering the subjects body, anything besides will be left on the ground.\n\n',
|
||||
'The selectors in the mothership, allow you to choose a destination.\n',
|
||||
'Worlds can be rerolled by spending a satellite at the top selector.\n',
|
||||
'Once enough players are on a selector, mothership will start traveling.\n\n',
|
||||
|
||||
'Worlds will get more difficult with each jump, adding the chosen modifiers.\n',
|
||||
'Worlds can be rerolled by spending a satellite.\n',
|
||||
'A teleporter will be deployed, after reaching the target.\n',
|
||||
'It is however, only capable of transfering the subjects body.\n\n',
|
||||
|
||||
'Worlds will get more difficult with each jump, stacking the chosen modifiers.\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',
|
||||
@ -199,3 +220,4 @@ Event.add(defines.events.on_built_entity, on_built_entity)
|
||||
Event.add(defines.events.on_robot_mined_entity, on_robot_mined_entity)
|
||||
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
Event.add(defines.events.on_entity_died, on_entity_died)
|
||||
Event.add(defines.events.on_console_chat, on_console_chat)
|
||||
|
@ -1,6 +1,7 @@
|
||||
--luacheck: ignore
|
||||
local Get_noise = require 'utils.get_noise'
|
||||
local BiterRaffle = require 'functions.biter_raffle'
|
||||
local LootRaffle = require 'functions.loot_raffle'
|
||||
local math_random = math.random
|
||||
local math_abs = math.abs
|
||||
local math_floor = math.floor
|
||||
@ -34,11 +35,30 @@ local solid_tiles = {
|
||||
["lab-dark-1"] = true,
|
||||
["lab-dark-2"] = true,
|
||||
}
|
||||
local wrecks = {
|
||||
'crash-site-spaceship-wreck-big-1',
|
||||
'crash-site-spaceship-wreck-big-2',
|
||||
'crash-site-spaceship-wreck-medium-1',
|
||||
'crash-site-spaceship-wreck-medium-2',
|
||||
'crash-site-spaceship-wreck-medium-3',
|
||||
}
|
||||
local size_of_wrecks = #wrecks
|
||||
|
||||
local Public = {}
|
||||
|
||||
Public.lush = {}
|
||||
|
||||
Public.eternal_day = {
|
||||
on_world_start = function(journey)
|
||||
game.surfaces.nauvis.daytime = 0
|
||||
game.surfaces.nauvis.freeze_daytime = true
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.freeze_daytime = false
|
||||
end,
|
||||
}
|
||||
|
||||
Public.eternal_night = {
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
@ -46,12 +66,28 @@ Public.eternal_night = {
|
||||
surface.freeze_daytime = true
|
||||
surface.solar_power_multiplier = 5
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.freeze_daytime = false
|
||||
surface.solar_power_multiplier = 1
|
||||
end,
|
||||
}
|
||||
|
||||
Public.eternal_day = {
|
||||
Public.pitch_black = {
|
||||
on_world_start = function(journey)
|
||||
game.surfaces.nauvis.daytime = 0
|
||||
game.surfaces.nauvis.freeze_daytime = true
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.daytime = 0.44
|
||||
surface.freeze_daytime = true
|
||||
surface.solar_power_multiplier = 3
|
||||
surface.min_brightness = 0
|
||||
surface.brightness_visual_weights = {0.8, 0.8, 0.8, 1}
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.freeze_daytime = false
|
||||
surface.solar_power_multiplier = 1
|
||||
surface.min_brightness = 0.15
|
||||
surface.brightness_visual_weights = {0, 0, 0, 1}
|
||||
end,
|
||||
}
|
||||
|
||||
@ -61,12 +97,28 @@ Public.matter_anomaly = {
|
||||
for i = 1, 4, 1 do force.technologies['mining-productivity-' .. i].researched = true end
|
||||
for i = 1, 6, 1 do force.technologies['mining-productivity-4'].researched = true end
|
||||
end,
|
||||
on_robot_built_entity = function(event)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "electric-turret" then entity.die() end
|
||||
end,
|
||||
on_built_entity = function(event)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "electric-turret" then entity.die() end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.quantum_anomaly = {
|
||||
on_world_start = function(journey)
|
||||
local force = game.forces.player
|
||||
for i = 1, 6, 1 do force.technologies['research-speed-' .. i].researched = true end
|
||||
game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 0.5
|
||||
end,
|
||||
clear = function(journey)
|
||||
game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 2
|
||||
end,
|
||||
}
|
||||
|
||||
@ -115,18 +167,7 @@ Public.replicant_fauna = {
|
||||
local cause = event.cause
|
||||
if not cause then return end
|
||||
if not cause.valid then return end
|
||||
if cause.force.index == 2 then cause.surface.create_entity({name = cause.name, position = entity.position, force = "enemy"}) end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.pitch_black = {
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.daytime = 0.44
|
||||
surface.freeze_daytime = true
|
||||
surface.solar_power_multiplier = 3
|
||||
surface.min_brightness = 0
|
||||
surface.brightness_visual_weights = {0.8, 0.8, 0.8, 1}
|
||||
if cause.force.index == 2 then cause.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = "enemy"}) end
|
||||
end,
|
||||
}
|
||||
|
||||
@ -135,12 +176,14 @@ Public.tarball = {
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "entity-ghost" or entity.type == "tile-ghost" or entity.type == "container" or entity.type == "wall" or entity.type == "pipe" then return end
|
||||
entity.minable = false
|
||||
end,
|
||||
on_built_entity = function(event)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "entity-ghost" or entity.type == "tile-ghost" or entity.type == "container" or entity.type == "wall" or entity.type == "pipe" then return end
|
||||
entity.minable = false
|
||||
end,
|
||||
on_chunk_generated = function(event, journey)
|
||||
@ -151,11 +194,15 @@ Public.tarball = {
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
tint = {r = 0.0, g = 0.0, b = 0.0, a = 0.5},
|
||||
tint = {r = 0.0, g = 0.0, b = 0.0, a = 0.45},
|
||||
render_layer = 'ground'
|
||||
}
|
||||
))
|
||||
end,
|
||||
clear = function(journey)
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
journey.world_color_filters = {}
|
||||
end,
|
||||
}
|
||||
|
||||
Public.swamps = {
|
||||
@ -189,6 +236,80 @@ Public.swamps = {
|
||||
end,
|
||||
}
|
||||
|
||||
Public.wasteland = {
|
||||
on_chunk_generated = function(event, journey)
|
||||
local surface = event.surface
|
||||
local seed = surface.map_gen_settings.seed
|
||||
local left_top_x = event.area.left_top.x
|
||||
local left_top_y = event.area.left_top.y
|
||||
local tiles = {}
|
||||
for _, tile in pairs(surface.find_tiles_filtered({name = {"water"}, area = event.area})) do
|
||||
table.insert(tiles, {name = "water-green", position = tile.position})
|
||||
end
|
||||
for _, tile in pairs(surface.find_tiles_filtered({name = {"deepwater"}, area = event.area})) do
|
||||
table.insert(tiles, {name = "deepwater-green", position = tile.position})
|
||||
end
|
||||
surface.set_tiles(tiles, true, false, false, false)
|
||||
if math_random(1, 3) ~= 1 then return end
|
||||
for _ = 1, math_random(0, 5), 1 do
|
||||
local name = wrecks[math_random(1, size_of_wrecks)]
|
||||
position = surface.find_non_colliding_position(name, {left_top_x + math_random(0, 31), left_top_y + math_random(0, 31)}, 16, 1)
|
||||
if position then
|
||||
local e = surface.create_entity({name = name, position = position, force = 'neutral'})
|
||||
if math_random(1, 4) == 1 then
|
||||
local slots = game.entity_prototypes[e.name].get_inventory_size(defines.inventory.chest)
|
||||
local blacklist = LootRaffle.get_tech_blacklist(0.2)
|
||||
local item_stacks = LootRaffle.roll(math_random(16, 64), slots, blacklist)
|
||||
for _, item_stack in pairs(item_stacks) do e.insert(item_stack) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.terrain_segmentation = 2.7
|
||||
mgs.water = mgs.water + 1
|
||||
surface.map_gen_settings = mgs
|
||||
surface.clear(true)
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.water = mgs.water - 1
|
||||
surface.map_gen_settings = mgs
|
||||
end,
|
||||
}
|
||||
|
||||
Public.oceanic = {
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.terrain_segmentation = 0.5
|
||||
mgs.water = mgs.water + 4
|
||||
surface.map_gen_settings = mgs
|
||||
surface.clear(true)
|
||||
end,
|
||||
on_robot_built_entity = function(event)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "fluid-turret" then entity.die() end
|
||||
end,
|
||||
on_built_entity = function(event)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "fluid-turret" then entity.die() end
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.water = mgs.water - 4
|
||||
surface.map_gen_settings = mgs
|
||||
end,
|
||||
}
|
||||
|
||||
Public.volcanic = {
|
||||
on_chunk_generated = function(event, journey)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite({
|
||||
@ -222,6 +343,10 @@ Public.volcanic = {
|
||||
end
|
||||
end
|
||||
end,
|
||||
clear = function(journey)
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
journey.world_color_filters = {}
|
||||
end,
|
||||
}
|
||||
|
||||
Public.chaotic_resources = {
|
||||
@ -239,18 +364,21 @@ Public.infested = {
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.force.index ~= 3 then return end
|
||||
if entity.type ~= "simple-entity" and entity.type ~= "tree" then return end
|
||||
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
|
||||
end,
|
||||
on_player_mined_entity = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.force.index ~= 3 then return end
|
||||
if entity.type ~= "simple-entity" and entity.type ~= "tree" then return end
|
||||
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
|
||||
end,
|
||||
on_robot_mined_entity = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.force.index ~= 3 then return end
|
||||
if entity.type ~= "simple-entity" and entity.type ~= "tree" then return end
|
||||
entity.surface.create_entity({name = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor + 0.1), position = entity.position, force = 'enemy'})
|
||||
end,
|
||||
}
|
||||
@ -261,6 +389,7 @@ Public.undead_plague = {
|
||||
if not entity.valid then return end
|
||||
if entity.force.index ~= 2 then return end
|
||||
if math_random(1,2) == 1 then return end
|
||||
if entity.type ~= "unit" then return end
|
||||
entity.surface.create_entity({name = entity.name, position = entity.position, force = 'enemy'})
|
||||
end,
|
||||
}
|
||||
@ -288,4 +417,87 @@ Public.dense_atmosphere = {
|
||||
end,
|
||||
}
|
||||
|
||||
local function update_lazy_bastard(journey, count)
|
||||
journey.lazy_bastard_machines = journey.lazy_bastard_machines + count
|
||||
local speed = journey.lazy_bastard_machines * -0.1
|
||||
if speed < -1 then speed = -1 end
|
||||
game.forces.player.manual_crafting_speed_modifier = speed
|
||||
end
|
||||
|
||||
Public.lazy_bastard = {
|
||||
on_robot_built_entity = function(event, journey)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "assembling-machine" then
|
||||
update_lazy_bastard(journey, 1)
|
||||
end
|
||||
end,
|
||||
on_built_entity = function(event, journey)
|
||||
local entity = event.created_entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "assembling-machine" then
|
||||
update_lazy_bastard(journey, 1)
|
||||
end
|
||||
end,
|
||||
on_entity_died = function(event, journey)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "assembling-machine" then
|
||||
update_lazy_bastard(journey, -1)
|
||||
end
|
||||
end,
|
||||
on_player_mined_entity = function(event, journey)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "assembling-machine" then
|
||||
update_lazy_bastard(journey, -1)
|
||||
end
|
||||
end,
|
||||
on_robot_mined_entity = function(event, journey)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if entity.surface.index ~= 1 then return end
|
||||
if entity.type == "assembling-machine" then
|
||||
update_lazy_bastard(journey, -1)
|
||||
end
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
journey.lazy_bastard_machines = 0
|
||||
end,
|
||||
clear = function(journey)
|
||||
game.forces.player.manual_crafting_speed_modifier = 0
|
||||
end,
|
||||
}
|
||||
|
||||
Public.ribbon = {
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.height = 256
|
||||
surface.map_gen_settings = mgs
|
||||
surface.clear(true)
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.height = nil
|
||||
surface.map_gen_settings = mgs
|
||||
end,
|
||||
}
|
||||
|
||||
Public.abandoned_library = {
|
||||
on_world_start = function(journey)
|
||||
game.permissions.get_group('Default').set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
game.permissions.get_group('Default').set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
end,
|
||||
clear = function(journey)
|
||||
game.permissions.get_group('Default').set_allows_action(defines.input_action.open_blueprint_library_gui, true)
|
||||
game.permissions.get_group('Default').set_allows_action(defines.input_action.import_blueprint_string, true)
|
||||
end,
|
||||
}
|
||||
|
||||
return Public
|
Loading…
x
Reference in New Issue
Block a user