mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-22 03:38:48 +02:00
formatting, some more changes
This commit is contained in:
parent
ed5736a24b
commit
741f3c64cf
@ -6,6 +6,7 @@ map_info_text=The selectors in the mothership, allow you to choose a destination
|
||||
tooltip_satellite=Satellites stored: __1__ / __2__\nSatellites are used by Mothership to scout for alternative destinations.
|
||||
tooltip_nuclear_fuel=Emergency Reactors working: __1__ / __2__\n30 Emergency Reactors are usually damaged by Mothership if the current colony is determined to be lost and Mothership has to leave in a hurry.\nIf teleporter is lost and there is no emergency power, the game is over and run resets.
|
||||
tooltip_fuel=Fuel requirement to advance to next world:\n__1__\n\nNuclear Fuel Cells in Mothership Cargo:\n__2__
|
||||
tooltip_delivery=Orbital Station Delivery: __1__ / __2__\nStation pays with one random starting item roll per time threshold.\nTimes: 120min, 240min, 480min, 960min, 1920min, 3840min\nCurrent time: __3__ minutes.
|
||||
|
||||
beacon_hp=HP: __1__/10000
|
||||
teleporter=Personal Teleporter
|
||||
@ -20,4 +21,6 @@ tooltip_capsule2= __1__x [item=__2__]\n
|
||||
|
||||
message_rocket_launched=Launching a rocket with __1__x [item=__2__] at [gps=__3__,__4__,nauvis].
|
||||
message_min_players=The minimal amount of players to vote for new world is set to __1__.
|
||||
message_delivery_done=[img=item/__1__] Orbital Station delivery completed in __2__ minutes, granting __3__ loot rolls!
|
||||
message_delivered=Delivered from Orbital Station: __2__x [img=item/__1__] added to capsule storage.
|
||||
cmd_server_restarting=Server is restarting to apply updates to the scenario...Please reconnect in a minute.
|
||||
|
@ -121,40 +121,77 @@ Public.modifiers = {
|
||||
}
|
||||
|
||||
Public.starter_goods_pool = {
|
||||
{'accumulator', 8, 16},
|
||||
{'big-electric-pole', 8, 16},
|
||||
{'burner-inserter', 64, 128},
|
||||
{'burner-mining-drill', 8, 16},
|
||||
{'car', 2, 4},
|
||||
{'cliff-explosives', 10, 20},
|
||||
{'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},
|
||||
['basic'] = {
|
||||
{'copper-cable', 128, 256},
|
||||
{'copper-plate', 64, 128},
|
||||
{'iron-gear-wheel', 64, 128},
|
||||
{'iron-plate', 64, 128},
|
||||
{'petroleum-gas-barrel', 20, 40},
|
||||
{'solid-fuel', 256, 512},
|
||||
{'steel-plate', 32, 64},
|
||||
{'electronic-circuit', 32, 64},
|
||||
},
|
||||
['low'] = {
|
||||
{'burner-inserter', 64, 128},
|
||||
{'burner-mining-drill', 8, 16},
|
||||
{'lab', 2, 4},
|
||||
{'steel-furnace', 8, 16},
|
||||
{'boiler', 2, 4},
|
||||
{'steam-engine', 4, 8},
|
||||
},
|
||||
['mil'] = {
|
||||
{'cliff-explosives', 10, 20},
|
||||
{'firearm-magazine', 64, 128},
|
||||
{'grenade', 8, 16},
|
||||
{'gun-turret', 4, 8},
|
||||
{'radar', 4, 8},
|
||||
{'stone-wall', 128, 256},
|
||||
{'gate', 32, 64},
|
||||
{'heavy-armor', 1, 1},
|
||||
{'modular-armor', 1, 1},
|
||||
{'shotgun-shell', 64, 128},
|
||||
{'defender-capsule', 12, 24},
|
||||
{'flamethrower-ammo', 20, 40},
|
||||
{'slowdown-capsule', 10, 20},
|
||||
},
|
||||
['inter'] = {
|
||||
{'big-electric-pole', 8, 16},
|
||||
{'car', 2, 4},
|
||||
{'electric-mining-drill', 4, 8},
|
||||
{'inserter', 32, 64},
|
||||
{'lab', 2, 4},
|
||||
{'long-handed-inserter', 32, 64},
|
||||
{'medium-electric-pole', 16, 32},
|
||||
{'pipe', 128, 256},
|
||||
{'small-lamp', 64, 128},
|
||||
{'steel-chest', 16, 32},
|
||||
{'transport-belt', 32, 64},
|
||||
{'pumpjack', 2, 4},
|
||||
},
|
||||
['adv'] = {
|
||||
{'accumulator', 8, 16},
|
||||
{'electric-furnace', 4, 8},
|
||||
{'solar-panel', 8, 16},
|
||||
{'stack-inserter', 16, 32},
|
||||
{'stack-filter-inserter', 16, 32},
|
||||
{'steam-turbine', 4, 8},
|
||||
{'substation', 4, 8},
|
||||
{'chemical-plant', 3, 6},
|
||||
{'oil-refinery', 1, 2},
|
||||
},
|
||||
['rare'] = {
|
||||
{'green-wire', 256, 512},
|
||||
{'red-wire', 256, 512},
|
||||
{'heat-exchanger', 1, 2},
|
||||
{'heat-pipe', 10, 20},
|
||||
{'nuclear-fuel', 4, 8},
|
||||
{'nuclear-reactor', 1, 1},
|
||||
{'advanced-circuit', 16, 32},
|
||||
{'construction-robot', 16, 32},
|
||||
{'personal-roboport-equipment', 1, 1},
|
||||
{'solar-panel-equipment', 2, 4},
|
||||
{'effectivity-module', 5, 10},
|
||||
},
|
||||
}
|
||||
|
||||
Public.build_type_whitelist = {
|
||||
@ -174,27 +211,144 @@ Public.build_type_whitelist = {
|
||||
}
|
||||
|
||||
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'] = {
|
||||
name = 'Lush',
|
||||
desc = 'Pure Vanilla.',
|
||||
mods = 1,
|
||||
loot = {basic = {1, 1}, low = {1, 1}, mil = {0, 1}, inter = {0, 1}, adv = {0, 0}, rare = {0, 0}}
|
||||
},
|
||||
['abandoned_library'] = {
|
||||
name = 'Abandoned Library',
|
||||
desc = 'No blueprints to be found.',
|
||||
mods = 3,
|
||||
loot = {basic = {0, 1}, low = {0, 1}, mil = {0, 1}, inter = {0, 1}, adv = {1, 1}, rare = {1, 1}}
|
||||
},
|
||||
['lazy_bastard'] = {
|
||||
name = 'Lazy Bastard',
|
||||
desc = 'The machine does the job.',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {0, 1}, inter = {0, 2}, adv = {0, 1}, rare = {1, 1}}
|
||||
},
|
||||
['oceanic'] = {
|
||||
name = 'Oceanic',
|
||||
desc = 'Arrrr, the flame turrets seem to malfunction in this climate.',
|
||||
mods = 2,
|
||||
loot = {basic = {1, 1}, low = {0, 0}, mil = {0, 2}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['ribbon'] = {
|
||||
name = 'Ribbon',
|
||||
desc = 'Go right. (or left)',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {0, 1}, inter = {0, 2}, adv = {0, 1}, rare = {1, 1}}
|
||||
},
|
||||
['wasteland'] = {
|
||||
name = 'Wasteland',
|
||||
desc = 'Rusty treasures.',
|
||||
mods = 2,
|
||||
loot = {basic = {0, 1}, low = {0, 1}, mil = {1, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['infested'] = {
|
||||
name = 'Infested',
|
||||
desc = 'They lurk inside.',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 1}, low = {0, 0}, mil = {1, 1}, inter = {0, 2}, adv = {0, 2}, rare = {1, 1}}
|
||||
},
|
||||
['pitch_black'] = {
|
||||
name = 'Pitch Black',
|
||||
desc = 'No light may reach this realm.',
|
||||
mods = 2,
|
||||
loot = {basic = {1, 1}, low = {0, 1}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['volcanic'] = {
|
||||
name = 'Volcanic',
|
||||
desc = 'The floor is (almost) lava.',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {1, 1}, inter = {0, 2}, adv = {0, 2}, rare = {1, 1}}
|
||||
},
|
||||
['matter_anomaly'] = {
|
||||
name = 'Matter Anomaly',
|
||||
desc = 'Why can\'t I hold all these ores.\nThe laser turret structures seem to malfunction.',
|
||||
mods = 2,
|
||||
loot = {basic = {1, 1}, low = {0, 1}, mil = {1, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['mountainous'] = {
|
||||
name = 'Mountainous',
|
||||
desc = 'Diggy diggy hole!',
|
||||
mods = 2,
|
||||
loot = {basic = {1, 1}, low = {0, 1}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['eternal_night'] = {
|
||||
name = 'Eternal Night',
|
||||
desc = 'This world seems to be missing a sun.',
|
||||
mods = 2,
|
||||
loot = {basic = {1, 1}, low = {0, 1}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['dense_atmosphere'] = {
|
||||
name = 'Dense Atmosphere',
|
||||
desc = 'Your roboport structures seem to malfunction.',
|
||||
mods = 3,
|
||||
loot = {basic = {0, 1}, low = {0, 0}, mil = {0, 1}, inter = {1, 1}, adv = {0, 1}, rare = {1, 1}}
|
||||
},
|
||||
['undead_plague'] = {
|
||||
name = 'Undead Plague',
|
||||
desc = 'The dead are restless.',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {1, 1}, inter = {0, 2}, adv = {0, 2}, rare = {1, 1}}
|
||||
},
|
||||
['swamps'] = {
|
||||
name = 'Swamps',
|
||||
desc = 'No deep water to be found in this world.',
|
||||
mods = 3,
|
||||
loot = {basic = {0, 1}, low = {0, 0}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['chaotic_resources'] = {
|
||||
name = 'Chaotic Resources',
|
||||
desc = 'Something to sort out.',
|
||||
mods = 2,
|
||||
loot = {basic = {0, 1}, low = {0, 1}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['low_mass'] = {
|
||||
name = 'Low Mass',
|
||||
desc = 'You feel light footed and the robots are buzzing.',
|
||||
mods = 2,
|
||||
loot = {basic = {0, 1}, low = {0, 1}, mil = {0, 0}, inter = {0, 2}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['eternal_day'] = {
|
||||
name = 'Eternal Day',
|
||||
desc = 'The sun never moves.',
|
||||
mods = 1,
|
||||
loot = {basic = {1, 1}, low = {0, 1}, mil = {0, 0}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['quantum_anomaly'] = {
|
||||
name = 'Quantum Anomaly',
|
||||
desc = 'Research complete.',
|
||||
mods = 2,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {0, 1}, inter = {1, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['replicant_fauna'] = {
|
||||
name = 'Replicant Fauna',
|
||||
desc = 'The biters feed on your structures.',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {1, 1}, inter = {0, 1}, adv = {0, 1}, rare = {1, 1}}
|
||||
},
|
||||
['tarball'] = {
|
||||
name = 'Tarball',
|
||||
desc = 'Door stuck, Door stuck...',
|
||||
mods = 4,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {0, 1}, inter = {0, 2}, adv = {0, 2}, rare = {1, 1}}
|
||||
},
|
||||
['railworld'] = {
|
||||
name = 'Railworld',
|
||||
desc = 'Long distances better travelled by train...',
|
||||
mods = 3,
|
||||
loot = {basic = {0, 1}, low = {0, 0}, mil = {0, 1}, inter = {0, 1}, adv = {0, 1}, rare = {0, 1}}
|
||||
},
|
||||
['resupply_station'] = {
|
||||
name = 'Resupply Station',
|
||||
desc = 'Local Orbital Station requires immediate resupply.\n Faster the delivery, more they pay.',
|
||||
mods = 2,
|
||||
loot = {basic = {0, 0}, low = {0, 0}, mil = {0, 1}, inter = {0, 2}, adv = {0, 2}, rare = {1, 1}}
|
||||
},
|
||||
}
|
||||
|
||||
return Public
|
||||
|
@ -4,6 +4,7 @@ local Server = require 'utils.server'
|
||||
local Get_noise = require 'utils.get_noise'
|
||||
local Constants = require 'maps.journey.constants'
|
||||
local Unique_modifiers = require 'maps.journey.unique_modifiers'
|
||||
local Vacants = require 'modules.clear_vacant_players'
|
||||
local math_sqrt = math.sqrt
|
||||
local math_random = math.random
|
||||
local math_floor = math.floor
|
||||
@ -161,22 +162,22 @@ end
|
||||
|
||||
local function get_current_modifier_percentage(name, journey)
|
||||
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].richness end
|
||||
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 == "time_factor" then return game.map_settings.enemy_evolution.time_factor * 250000 end
|
||||
if name == "destroy_factor" then return game.map_settings.enemy_evolution.destroy_factor * 500 end
|
||||
if name == "pollution_factor" then return game.map_settings.enemy_evolution.pollution_factor * 1111000 end
|
||||
if name == "expansion_cooldown" then return (game.map_settings.enemy_expansion.min_expansion_cooldown / 144) * 0.01 end
|
||||
if name == "technology_price_multiplier" then return game.difficulty_settings.technology_price_multiplier * 2 end
|
||||
if name == "enemy_attack_pollution_consumption_modifier" then return game.map_settings.pollution.enemy_attack_pollution_consumption_modifier end
|
||||
if name == "ageing" then return game.map_settings.pollution.ageing 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 == "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
|
||||
if name == 'cliff_settings' then return 40 / mgs.cliff_settings.cliff_elevation_interval end
|
||||
if name == 'water' then return mgs.water end
|
||||
if name == 'time_factor' then return game.map_settings.enemy_evolution.time_factor * 250000 end
|
||||
if name == 'destroy_factor' then return game.map_settings.enemy_evolution.destroy_factor * 500 end
|
||||
if name == 'pollution_factor' then return game.map_settings.enemy_evolution.pollution_factor * 1111000 end
|
||||
if name == 'expansion_cooldown' then return (game.map_settings.enemy_expansion.min_expansion_cooldown / 144) * 0.01 end
|
||||
if name == 'technology_price_multiplier' then return game.difficulty_settings.technology_price_multiplier * 2 end
|
||||
if name == 'enemy_attack_pollution_consumption_modifier' then return game.map_settings.pollution.enemy_attack_pollution_consumption_modifier end
|
||||
if name == 'ageing' then return game.map_settings.pollution.ageing 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 == '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
|
||||
|
||||
local function delete_nauvis_chunks(journey)
|
||||
@ -245,13 +246,13 @@ function Public.register_built_silo(event, journey)
|
||||
table.insert(journey.rocket_silos, entity)
|
||||
end
|
||||
|
||||
local function cargo_gui(name, itemname, tooltip, value)
|
||||
local function cargo_gui(name, itemname, tooltip, value, hidden)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not player.gui.top[name] then
|
||||
local frame = player.gui.top.add({type = 'frame', name = name})
|
||||
frame.style.left_margin = 0
|
||||
frame.style.padding = 0
|
||||
local sprite = frame.add({type = 'sprite', sprite = 'item/' .. itemname, name = name .. "_sprite", resize_to_sprite = false})
|
||||
local sprite = frame.add({type = 'sprite', sprite = 'item/' .. itemname, name = name .. '_sprite', resize_to_sprite = false})
|
||||
sprite.style.minimal_width = 28
|
||||
sprite.style.minimal_height = 28
|
||||
sprite.style.maximal_width = 28
|
||||
@ -268,10 +269,16 @@ local function cargo_gui(name, itemname, tooltip, value)
|
||||
local frame = player.gui.top[name]
|
||||
frame.tooltip = tooltip
|
||||
local sprite = player.gui.top[name][name .. '_sprite']
|
||||
sprite.sprite = 'item/' .. itemname
|
||||
sprite.tooltip = tooltip
|
||||
local progressbar = player.gui.top[name][name .. '_progressbar']
|
||||
progressbar.value = value
|
||||
progressbar.tooltip = tooltip
|
||||
if hidden then
|
||||
frame.visible = false
|
||||
else
|
||||
frame.visible = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -298,8 +305,8 @@ end
|
||||
function Public.draw_gui(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
local caption = {'journey.world', journey.world_number, Constants.unique_world_traits[journey.world_trait][1]}
|
||||
local tooltip = {'journey.world_tooltip', Constants.unique_world_traits[journey.world_trait][2], journey.tooltip_modifiers, journey.tooltip_capsules}
|
||||
local caption = {'journey.world', journey.world_number, Constants.unique_world_traits[journey.world_trait].name}
|
||||
local tooltip = {'journey.world_tooltip', Constants.unique_world_traits[journey.world_trait].desc, journey.tooltip_modifiers, journey.tooltip_capsules}
|
||||
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not player.gui.top.journey_button then
|
||||
@ -316,22 +323,32 @@ function Public.draw_gui(journey)
|
||||
gui.tooltip = tooltip
|
||||
end
|
||||
|
||||
local fuel_requirement = journey.mothership_cargo_space["uranium-fuel-cell"]
|
||||
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
|
||||
value = journey.mothership_cargo['uranium-fuel-cell'] / fuel_requirement
|
||||
end
|
||||
cargo_gui('journey_fuel', 'uranium-fuel-cell', {'journey.tooltip_fuel', fuel_requirement, journey.mothership_cargo["uranium-fuel-cell"]}, value)
|
||||
cargo_gui('journey_fuel', 'uranium-fuel-cell', {'journey.tooltip_fuel', fuel_requirement, journey.mothership_cargo['uranium-fuel-cell']}, value)
|
||||
|
||||
local max_satellites = journey.mothership_cargo_space["satellite"]
|
||||
local value = journey.mothership_cargo["satellite"] / max_satellites
|
||||
cargo_gui('journey_satellites', 'satellite', {'journey.tooltip_satellite', journey.mothership_cargo["satellite"], max_satellites}, value)
|
||||
local max_satellites = journey.mothership_cargo_space['satellite']
|
||||
local value2 = journey.mothership_cargo['satellite'] / max_satellites
|
||||
cargo_gui('journey_satellites', 'satellite', {'journey.tooltip_satellite', journey.mothership_cargo['satellite'], max_satellites}, value2)
|
||||
|
||||
local max_emergency_fuel = journey.mothership_cargo_space['nuclear-reactor']
|
||||
local value = journey.mothership_cargo['nuclear-reactor'] / max_emergency_fuel
|
||||
cargo_gui('journey_emergency', 'nuclear-reactor', {'journey.tooltip_nuclear_fuel', journey.mothership_cargo['nuclear-reactor'], max_emergency_fuel}, value)
|
||||
local value3 = journey.mothership_cargo['nuclear-reactor'] / max_emergency_fuel
|
||||
cargo_gui('journey_emergency', 'nuclear-reactor', {'journey.tooltip_nuclear_fuel', journey.mothership_cargo['nuclear-reactor'], max_emergency_fuel}, value3)
|
||||
|
||||
local item = journey.speedrun.item
|
||||
local time = math.round(journey.speedrun.time / 6) / 10
|
||||
local speedgoal = journey.mothership_cargo_space[item] or 1
|
||||
local value4 = (journey.mothership_cargo[item] or 0) / speedgoal
|
||||
if journey.speedrun.enabled then
|
||||
cargo_gui('journey_delivery', item, {'journey.tooltip_delivery', journey.mothership_cargo[item] or 0, speedgoal, time}, value4)
|
||||
else
|
||||
cargo_gui('journey_delivery', item, {'journey.tooltip_delivery', journey.mothership_cargo[item] or 0, speedgoal, time}, value4, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function is_mothership(position)
|
||||
@ -355,9 +372,9 @@ function Public.on_mothership_chunk_generated(event)
|
||||
for y = 0, 31, 1 do
|
||||
local position = {x = left_top.x + x, y = left_top.y + y}
|
||||
if is_mothership(position) then
|
||||
table.insert(tiles, {name = "black-refined-concrete", position = position})
|
||||
table.insert(tiles, {name = 'black-refined-concrete', position = position})
|
||||
else
|
||||
table.insert(tiles, {name = "out-of-map", position = position})
|
||||
table.insert(tiles, {name = 'out-of-map', position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -385,7 +402,7 @@ end
|
||||
|
||||
function Public.import_journey(journey)
|
||||
local state = journey.game_state
|
||||
if state == 'world' or state == 'dispatch_goods' or state = 'mothership_waiting_for_players' then
|
||||
if state == 'world' or state == 'dispatch_goods' or state == 'mothership_waiting_for_players' then
|
||||
log('Can run import command only during world selection stages')
|
||||
return
|
||||
end
|
||||
@ -404,6 +421,7 @@ function Public.hard_reset(journey)
|
||||
Server.start_scenario('Journey')
|
||||
return
|
||||
end
|
||||
Vacants.reset()
|
||||
if game.surfaces.mothership and game.surfaces.mothership.valid then
|
||||
game.delete_surface(game.surfaces.mothership)
|
||||
end
|
||||
@ -447,14 +465,14 @@ function Public.hard_reset(journey)
|
||||
mgs.starting_area = 1
|
||||
mgs.cliff_settings = {cliff_elevation_interval = 40, cliff_elevation_0 = 10, richness = 1}
|
||||
mgs.autoplace_controls = {
|
||||
["coal"] = {frequency = 1, size = 1, richness = 1},
|
||||
["stone"] = {frequency = 1, size = 1, richness = 1},
|
||||
["copper-ore"] = {frequency = 1, size = 1, richness = 1},
|
||||
["iron-ore"] = {frequency = 1, size = 1, richness = 1},
|
||||
["uranium-ore"] = {frequency = 1, size = 1, richness = 1},
|
||||
["crude-oil"] = {frequency = 1, size = 1, richness = 1},
|
||||
["trees"] = {frequency = 1, size = 1, richness = 1},
|
||||
["enemy-base"] = {frequency = 1, size = 1, richness = 1},
|
||||
['coal'] = {frequency = 1, size = 1, richness = 1},
|
||||
['stone'] = {frequency = 1, size = 1, richness = 1},
|
||||
['copper-ore'] = {frequency = 1, size = 1, richness = 1},
|
||||
['iron-ore'] = {frequency = 1, size = 1, richness = 1},
|
||||
['uranium-ore'] = {frequency = 1, size = 1, richness = 1},
|
||||
['crude-oil'] = {frequency = 1, size = 1, richness = 1},
|
||||
['trees'] = {frequency = 1, size = 1, richness = 1},
|
||||
['enemy-base'] = {frequency = 1, size = 1, richness = 1},
|
||||
}
|
||||
surface.map_gen_settings = mgs
|
||||
surface.clear(true)
|
||||
@ -478,13 +496,13 @@ function Public.hard_reset(journey)
|
||||
journey.mixed_ore_richness = 1
|
||||
journey.mothership_messages = {}
|
||||
journey.mothership_cargo = {}
|
||||
journey.mothership_cargo["uranium-fuel-cell"] = 10
|
||||
journey.mothership_cargo["satellite"] = 1
|
||||
journey.mothership_cargo["nuclear-reactor"] = 60
|
||||
journey.mothership_cargo['uranium-fuel-cell'] = 10
|
||||
journey.mothership_cargo['satellite'] = 1
|
||||
journey.mothership_cargo['nuclear-reactor'] = 60
|
||||
journey.mothership_cargo_space = {
|
||||
["satellite"] = 1,
|
||||
["uranium-fuel-cell"] = 0,
|
||||
["nuclear-reactor"] = 60
|
||||
['satellite'] = 1,
|
||||
['uranium-fuel-cell'] = 0,
|
||||
['nuclear-reactor'] = 60
|
||||
}
|
||||
journey.bonus_goods = {}
|
||||
journey.tooltip_capsules = ''
|
||||
@ -498,6 +516,7 @@ function Public.hard_reset(journey)
|
||||
journey.emergency_triggered = false
|
||||
journey.emergency_selected = false
|
||||
journey.game_state = 'create_mothership'
|
||||
journey.speedrun = {enabled = false, time = 0, item = 'iron-stick'}
|
||||
journey.vote_minimum = 1
|
||||
journey.mothership_messages_last_damage = game.tick
|
||||
for k, modifier in pairs(Constants.modifiers) do
|
||||
@ -588,11 +607,11 @@ function Public.draw_mothership(journey)
|
||||
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 chest = surface.create_entity({name = 'infinity-chest', position = {-7 + k, Constants.mothership_radius - 3}, force = 'player'})
|
||||
chest.set_infinity_container_filter(1, {name = item_name, count = game.item_prototypes[item_name].stack_size})
|
||||
protect(chest, false)
|
||||
local loader = surface.create_entity({name = "express-loader", position = {-7 + k, Constants.mothership_radius - 4}, force = 'player'})
|
||||
local loader = surface.create_entity({name = 'express-loader', position = {-7 + k, Constants.mothership_radius - 4}, force = 'player'})
|
||||
protect(loader, true)
|
||||
loader.direction = 4
|
||||
end
|
||||
@ -611,18 +630,18 @@ function Public.draw_mothership(journey)
|
||||
local turret = surface.create_entity({name = 'artillery-turret', position = {x * m, y}, force = 'player'})
|
||||
turret.direction = 4
|
||||
protect(turret, false)
|
||||
local ins = surface.create_entity({name = "burner-inserter", position = {(x - 1) * m, y}, force = "player"})
|
||||
local ins = surface.create_entity({name = 'burner-inserter', position = {(x - 1) * m, y}, force = 'player'})
|
||||
ins.direction = 4 + m * 2
|
||||
ins.rotatable = false
|
||||
protect(ins, false)
|
||||
local chest = surface.create_entity({name = 'infinity-chest', position = {(x - 2) * m, y}, force = 'player'})
|
||||
chest.set_infinity_container_filter(1, {name = "solid-fuel", count = 50})
|
||||
chest.set_infinity_container_filter(2, {name = "artillery-shell", count = 1})
|
||||
chest.set_infinity_container_filter(1, {name = 'solid-fuel', count = 50})
|
||||
chest.set_infinity_container_filter(2, {name = 'artillery-shell', count = 1})
|
||||
protect(chest, false)
|
||||
end
|
||||
|
||||
for _ = 1, 3, 1 do
|
||||
local comp = surface.create_entity({name = "compilatron", position = Constants.mothership_teleporter_position, force = "player"})
|
||||
local comp = surface.create_entity({name = 'compilatron', position = Constants.mothership_teleporter_position, force = 'player'})
|
||||
comp.destructible = false
|
||||
end
|
||||
Public.draw_gui(journey)
|
||||
@ -634,11 +653,11 @@ end
|
||||
function Public.teleport_players_to_mothership(journey)
|
||||
local surface = game.surfaces.mothership
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.surface.name ~= "mothership" then
|
||||
if player.surface.name ~= 'mothership' then
|
||||
Public.clear_player(player)
|
||||
player.teleport(surface.find_non_colliding_position('character', {0,0}, 32, 0.5), surface)
|
||||
journey.characters_in_mothership = journey.characters_in_mothership + 1
|
||||
table.insert(journey.mothership_messages, "Welcome home " .. player.name .. "!")
|
||||
table.insert(journey.mothership_messages, 'Welcome home ' .. player.name .. '!')
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -665,7 +684,7 @@ function Public.set_minimum_to_vote(journey)
|
||||
end
|
||||
|
||||
local function get_activation_level(journey, surface, area)
|
||||
local player_count_in_area = surface.count_entities_filtered({area = area, name = "character"})
|
||||
local player_count_in_area = surface.count_entities_filtered({area = area, name = 'character'})
|
||||
local player_count_for_max_activation = math.max(#game.connected_players, journey.vote_minimum) * 0.66
|
||||
local level = player_count_in_area / player_count_for_max_activation
|
||||
level = math.round(level, 2)
|
||||
@ -694,50 +713,66 @@ local function draw_background(journey, surface)
|
||||
local speed = journey.mothership_speed
|
||||
for c = 1, 16 * speed, 1 do
|
||||
local position = Constants.particle_spawn_vectors[math.random(1, Constants.size_of_particle_spawn_vectors)]
|
||||
surface.create_entity({name = "shotgun-pellet", position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
surface.create_entity({name = 'shotgun-pellet', position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
end
|
||||
for c = 1, 16 * speed, 1 do
|
||||
local position = Constants.particle_spawn_vectors[math.random(1, Constants.size_of_particle_spawn_vectors)]
|
||||
surface.create_entity({name = "piercing-shotgun-pellet", position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
surface.create_entity({name = 'piercing-shotgun-pellet', position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
end
|
||||
for c = 1, 2 * speed, 1 do
|
||||
local position = Constants.particle_spawn_vectors[math.random(1, Constants.size_of_particle_spawn_vectors)]
|
||||
surface.create_entity({name = "cannon-projectile", position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
surface.create_entity({name = 'cannon-projectile', position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
end
|
||||
for c = 1, 1 * speed, 1 do
|
||||
local position = Constants.particle_spawn_vectors[math.random(1, Constants.size_of_particle_spawn_vectors)]
|
||||
surface.create_entity({name = "uranium-cannon-projectile", position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
surface.create_entity({name = 'uranium-cannon-projectile', position = position, target = {position[1], position[2] + Constants.mothership_radius * 2}, speed = speed})
|
||||
end
|
||||
if math.random(1, 32) == 1 then
|
||||
local position = Constants.particle_spawn_vectors[math.random(1, Constants.size_of_particle_spawn_vectors)]
|
||||
surface.create_entity({name = "explosive-uranium-cannon-projectile", position = position, target = {position[1], position[2] + Constants.mothership_radius * 3}, speed = speed})
|
||||
surface.create_entity({name = 'explosive-uranium-cannon-projectile', position = position, target = {position[1], position[2] + Constants.mothership_radius * 3}, speed = speed})
|
||||
end
|
||||
if math.random(1, 90) == 1 then
|
||||
local position_x = math.random(64, 160)
|
||||
local position_y = math.random(64, 160)
|
||||
if math.random(1, 2) == 1 then position_x = position_x * -1 end
|
||||
if math.random(1, 2) == 1 then position_y = position_y * -1 end
|
||||
surface.create_entity({name = "big-worm-turret", position = {position_x, position_y}, force = "enemy"})
|
||||
surface.create_entity({name = 'big-worm-turret', position = {position_x, position_y}, force = 'enemy'})
|
||||
end
|
||||
end
|
||||
|
||||
local function roll_bonus_goods(journey, trait, amount)
|
||||
local loot = Constants.unique_world_traits[trait].loot
|
||||
local bonus_goods = {}
|
||||
while #bonus_goods < (amount or 3) do
|
||||
for key, numbers in pairs(loot) do
|
||||
local loot_table = Constants.starter_goods_pool[key]
|
||||
if #bonus_goods < (amount or 3) and math.random(numbers[1], numbers[2]) >= 1 then
|
||||
|
||||
local item = loot_table[math.random(1, #loot_table)]
|
||||
bonus_goods[#bonus_goods + 1] = {item[1], math.random(item[2], item[3])}
|
||||
end
|
||||
end
|
||||
end
|
||||
return bonus_goods
|
||||
end
|
||||
|
||||
function Public.set_world_selectors(journey)
|
||||
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 ",
|
||||
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",
|
||||
font = 'default-large-bold',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false,
|
||||
},
|
||||
rendering.draw_sprite{
|
||||
sprite = "item/satellite",
|
||||
sprite = 'item/satellite',
|
||||
surface = surface,
|
||||
y_scale = 1.5,
|
||||
x_scale = 1.5,
|
||||
@ -750,11 +785,6 @@ function Public.set_world_selectors(journey)
|
||||
table.insert(modifier_names, k)
|
||||
end
|
||||
|
||||
local bonus_goods_keys = {}
|
||||
for i = 1, #Constants.starter_goods_pool, 1 do
|
||||
table.insert(bonus_goods_keys, i)
|
||||
end
|
||||
|
||||
local unique_world_traits = {}
|
||||
for k, _ in pairs(Constants.unique_world_traits) do
|
||||
table.insert(unique_world_traits, k)
|
||||
@ -763,7 +793,6 @@ function Public.set_world_selectors(journey)
|
||||
|
||||
for k, world_selector in pairs(journey.world_selectors) do
|
||||
if not journey.importing then
|
||||
table.shuffle_table(bonus_goods_keys)
|
||||
table.shuffle_table(modifier_names)
|
||||
world_selector.modifiers = {}
|
||||
world_selector.bonus_goods = {}
|
||||
@ -773,9 +802,8 @@ function Public.set_world_selectors(journey)
|
||||
local position = Constants.world_selector_areas[k].left_top
|
||||
local texts = world_selector.texts
|
||||
local modifiers = world_selector.modifiers
|
||||
local bonus_goods = world_selector.bonus_goods
|
||||
local y_modifier = -11.3
|
||||
local limits = {6, Constants.unique_world_traits[world_selector.world_trait][3]}
|
||||
local limits = {6, Constants.unique_world_traits[world_selector.world_trait].mods}
|
||||
local counts = {0, 0}
|
||||
local i = 1
|
||||
if journey.importing then goto skip_reroll end
|
||||
@ -821,25 +849,25 @@ function Public.set_world_selectors(journey)
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
world_selector.bonus_goods = roll_bonus_goods(journey, world_selector.world_trait)
|
||||
::skip_reroll::
|
||||
|
||||
table.insert(texts, rendering.draw_text{
|
||||
text = Constants.unique_world_traits[world_selector.world_trait][1],
|
||||
text = Constants.unique_world_traits[world_selector.world_trait].name,
|
||||
surface = surface,
|
||||
target = {position.x + Constants.world_selector_width * 0.5, position.y + y_modifier},
|
||||
color = {100, 0, 255, 255},
|
||||
scale = 1.25,
|
||||
font = "default-large-bold",
|
||||
alignment = "center",
|
||||
font = 'default-large-bold',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
})
|
||||
|
||||
for k2, modifier in pairs(modifiers) do
|
||||
y_modifier = y_modifier + 0.8
|
||||
local text = ""
|
||||
if modifier[2] > 0 then text = text .. "+" end
|
||||
text = text .. modifier[2] .. "% "
|
||||
local text = ''
|
||||
if modifier[2] > 0 then text = text .. '+' end
|
||||
text = text .. modifier[2] .. '% '
|
||||
text = text .. Constants.modifiers[modifier[1]].name
|
||||
|
||||
local color
|
||||
@ -855,47 +883,41 @@ function Public.set_world_selectors(journey)
|
||||
target = {position.x + Constants.world_selector_width * 0.5, position.y + y_modifier},
|
||||
color = color,
|
||||
scale = 1.25,
|
||||
font = "default-large",
|
||||
alignment = "center",
|
||||
font = 'default-large',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
})
|
||||
end
|
||||
|
||||
y_modifier = y_modifier + 0.85
|
||||
table.insert(texts, rendering.draw_text{
|
||||
text = "Fuel requirement +" .. world_selector.fuel_requirement,
|
||||
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",
|
||||
font = 'default-large',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
})
|
||||
table.insert(texts, rendering.draw_sprite{
|
||||
sprite = "item/uranium-fuel-cell",
|
||||
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
|
||||
local key = bonus_goods_keys[i]
|
||||
local bonus_good = Constants.starter_goods_pool[key]
|
||||
bonus_goods[i] = {bonus_good[1], math.random(bonus_good[2], bonus_good[3])}
|
||||
end
|
||||
|
||||
y_modifier = y_modifier + 1.1
|
||||
local x_modifier = -0.5
|
||||
|
||||
for k2, good in pairs(world_selector.bonus_goods) do
|
||||
local render_id = rendering.draw_text{
|
||||
text = "+" .. good[2],
|
||||
text = '+' .. good[2],
|
||||
surface = surface,
|
||||
target = {position.x + x_modifier, position.y + y_modifier},
|
||||
color = {200, 200, 0, 255},
|
||||
scale = 1.25,
|
||||
font = "default-large",
|
||||
alignment = "center",
|
||||
font = 'default-large',
|
||||
alignment = 'center',
|
||||
scale_with_zoom = false
|
||||
}
|
||||
table.insert(texts, render_id)
|
||||
@ -905,7 +927,7 @@ function Public.set_world_selectors(journey)
|
||||
if good[2] >= 100 then x_modifier = x_modifier + 0.18 end
|
||||
|
||||
local render_id = rendering.draw_sprite{
|
||||
sprite = "item/" .. good[1],
|
||||
sprite = 'item/' .. good[1],
|
||||
surface = surface,
|
||||
target = {position.x + x_modifier, position.y + 0.5 + y_modifier},
|
||||
}
|
||||
@ -918,11 +940,11 @@ function Public.set_world_selectors(journey)
|
||||
destroy_teleporter(journey, game.surfaces.nauvis, Constants.mothership_teleporter_position)
|
||||
destroy_teleporter(journey, surface, Constants.mothership_teleporter_position)
|
||||
|
||||
Server.to_discord_embed("World " .. journey.world_number + 1 .. " selection has started!")
|
||||
Server.to_discord_embed('World ' .. journey.world_number + 1 .. ' selection has started!')
|
||||
Public.set_minimum_to_vote(journey)
|
||||
journey.importing = false
|
||||
|
||||
journey.game_state = "delete_nauvis_chunks"
|
||||
journey.game_state = 'delete_nauvis_chunks'
|
||||
end
|
||||
|
||||
function Public.delete_nauvis_chunks(journey)
|
||||
@ -934,7 +956,7 @@ function Public.delete_nauvis_chunks(journey)
|
||||
if player.gui.top.chunk_progress then player.gui.top.chunk_progress.destroy() end
|
||||
end
|
||||
|
||||
journey.game_state = "mothership_world_selection"
|
||||
journey.game_state = 'mothership_world_selection'
|
||||
end
|
||||
|
||||
function Public.reroll_worlds(journey)
|
||||
@ -955,14 +977,14 @@ function Public.reroll_worlds(journey)
|
||||
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"
|
||||
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"
|
||||
table.insert(journey.mothership_messages, 'Aborting..')
|
||||
journey.game_state = 'mothership_world_selection'
|
||||
journey.mothership_speed = 0.35
|
||||
end
|
||||
end
|
||||
@ -976,8 +998,8 @@ function Public.importing_world(journey)
|
||||
clear_selectors(journey)
|
||||
Public.update_tooltips(journey)
|
||||
Public.draw_gui(journey)
|
||||
table.insert(journey.mothership_messages, "Restoring the last saved position...")
|
||||
journey.game_state = "set_world_selectors"
|
||||
table.insert(journey.mothership_messages, 'Restoring the last saved position...')
|
||||
journey.game_state = 'set_world_selectors'
|
||||
end
|
||||
|
||||
function Public.mothership_world_selection(journey)
|
||||
@ -995,7 +1017,7 @@ function Public.mothership_world_selection(journey)
|
||||
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, 'Emergency destination selected..')
|
||||
journey.emergency_selected = true
|
||||
end
|
||||
else
|
||||
@ -1008,32 +1030,32 @@ function Public.mothership_world_selection(journey)
|
||||
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..")
|
||||
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
|
||||
table.insert(journey.mothership_messages, "Advancing to selected world.")
|
||||
table.insert(journey.mothership_messages, 'Advancing to selected world.')
|
||||
journey.mothership_advancing_to_world = game.tick + math.random(60 * 45, 60 * 75)
|
||||
else
|
||||
local seconds_left = math.floor((journey.mothership_advancing_to_world - game.tick) / 60)
|
||||
if seconds_left <= 0 then
|
||||
journey.mothership_advancing_to_world = false
|
||||
table.insert(journey.mothership_messages, "Arriving at targeted destination!")
|
||||
journey.game_state = "mothership_arrives_at_world"
|
||||
table.insert(journey.mothership_messages, 'Arriving at targeted destination!')
|
||||
journey.game_state = 'mothership_arrives_at_world'
|
||||
return
|
||||
end
|
||||
if seconds_left % 15 == 0 then table.insert(journey.mothership_messages, "Estimated arrival in " .. seconds_left .. " seconds.") end
|
||||
if seconds_left % 15 == 0 then table.insert(journey.mothership_messages, 'Estimated arrival in ' .. seconds_left .. ' seconds.') end
|
||||
end
|
||||
|
||||
journey.mothership_speed = journey.mothership_speed + 0.1
|
||||
if journey.mothership_speed > 4 then journey.mothership_speed = 4 end
|
||||
else
|
||||
if journey.mothership_advancing_to_world then
|
||||
table.insert(journey.mothership_messages, "Aborting travelling sequence.")
|
||||
table.insert(journey.mothership_messages, 'Aborting travelling sequence.')
|
||||
journey.mothership_advancing_to_world = false
|
||||
end
|
||||
journey.mothership_speed = journey.mothership_speed - 0.25
|
||||
@ -1051,17 +1073,17 @@ function Public.mothership_arrives_at_world(journey)
|
||||
Public.teleport_players_to_mothership(journey)
|
||||
|
||||
if journey.mothership_speed == 0.15 then
|
||||
for _ = 1, 16, 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, "[img=item/uranium-fuel-cell] Fuel cells depleted ;_;")
|
||||
for _ = 1, 16, 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, "Refuel via supply rocket required!")
|
||||
for _ = 1, 16, 1 do table.insert(journey.mothership_messages, '') end
|
||||
table.insert(journey.mothership_messages, '[img=item/uranium-fuel-cell] Fuel cells depleted ;_;')
|
||||
for _ = 1, 16, 1 do table.insert(journey.mothership_messages, '') end
|
||||
table.insert(journey.mothership_messages, 'Refuel via supply rocket required!')
|
||||
|
||||
for i = 1, 3, 1 do
|
||||
journey.world_selectors[i].activation_level = 0
|
||||
end
|
||||
animate_selectors(journey)
|
||||
|
||||
journey.game_state = "clear_modifiers"
|
||||
journey.game_state = 'clear_modifiers'
|
||||
else
|
||||
journey.mothership_speed = journey.mothership_speed - 0.15
|
||||
end
|
||||
@ -1086,7 +1108,7 @@ function Public.clear_modifiers(journey)
|
||||
force.reset_technologies()
|
||||
force.reset_technology_effects()
|
||||
for a = 1, 7, 1 do force.technologies['refined-flammables-' .. a].enabled = false end
|
||||
journey.game_state = "create_the_world"
|
||||
journey.game_state = 'create_the_world'
|
||||
Public.update_tooltips(journey)
|
||||
end
|
||||
|
||||
@ -1103,16 +1125,16 @@ function Public.create_the_world(journey)
|
||||
local name = modifier[1]
|
||||
local extremes = {Constants.modifiers[modifier[1]].min, Constants.modifiers[modifier[1]].max}
|
||||
journey.world_modifiers[name] = math.min(extremes[2], math.max(extremes[1], journey.world_modifiers[name] * m))
|
||||
for _, autoplace in pairs({"iron-ore", "copper-ore", "uranium-ore", "coal", "stone", "crude-oil"}) 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 = journey.world_modifiers[name]
|
||||
break
|
||||
end
|
||||
end
|
||||
if name == "mixed_ore" then
|
||||
if name == 'mixed_ore' then
|
||||
journey.mixed_ore_richness = journey.world_modifiers[name]
|
||||
end
|
||||
for _, autoplace in pairs({"trees", "enemy-base"}) do
|
||||
for _, autoplace in pairs({'trees', 'enemy-base'}) do
|
||||
if name == autoplace then
|
||||
for k, v in pairs(mgs.autoplace_controls[name]) do
|
||||
mgs.autoplace_controls[name][k] = journey.world_modifiers[name]
|
||||
@ -1120,43 +1142,43 @@ function Public.create_the_world(journey)
|
||||
break
|
||||
end
|
||||
end
|
||||
if name == "cliff_settings" then
|
||||
if name == 'cliff_settings' then
|
||||
--smaller value = more cliffs
|
||||
local m2 = (100 - modifier[2]) * 0.01
|
||||
mgs.cliff_settings.cliff_elevation_interval = mgs.cliff_settings.cliff_elevation_interval * m2
|
||||
mgs.cliff_settings.cliff_elevation_0 = mgs.cliff_settings.cliff_elevation_0 * m2
|
||||
end
|
||||
if name == "water" then
|
||||
if name == 'water' then
|
||||
mgs.water = journey.world_modifiers[name]
|
||||
end
|
||||
for _, evo in pairs({"time_factor", "destroy_factor", "pollution_factor"}) do
|
||||
for _, evo in pairs({'time_factor', 'destroy_factor', 'pollution_factor'}) do
|
||||
if name == evo then
|
||||
game.map_settings.enemy_evolution[name] = journey.world_modifiers[name]
|
||||
break
|
||||
end
|
||||
end
|
||||
if name == "expansion_cooldown" then
|
||||
if name == 'expansion_cooldown' then
|
||||
game.map_settings.enemy_expansion.min_expansion_cooldown = journey.world_modifiers[name]
|
||||
game.map_settings.enemy_expansion.max_expansion_cooldown = journey.world_modifiers[name]
|
||||
end
|
||||
if name == "technology_price_multiplier" then
|
||||
if name == 'technology_price_multiplier' then
|
||||
game.difficulty_settings.technology_price_multiplier = journey.world_modifiers[name]
|
||||
end
|
||||
if name == "enemy_attack_pollution_consumption_modifier" then
|
||||
if name == 'enemy_attack_pollution_consumption_modifier' then
|
||||
game.map_settings.pollution.enemy_attack_pollution_consumption_modifier = journey.world_modifiers[name]
|
||||
end
|
||||
if name == "ageing" then
|
||||
if name == 'ageing' then
|
||||
game.map_settings.pollution.ageing = journey.world_modifiers[name]
|
||||
end
|
||||
if name == "diffusion_ratio" then
|
||||
if name == 'diffusion_ratio' then
|
||||
--recommended to keep the diffusion at 0 to 50%. Going over 100% eventually gives corrupted map due to pollution value overflows so needs to be capped
|
||||
game.map_settings.pollution.diffusion_ratio = journey.world_modifiers[name]
|
||||
end
|
||||
if name == "tree_durability" then
|
||||
if name == 'tree_durability' then
|
||||
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
|
||||
if name == 'max_unit_group_size' then
|
||||
game.map_settings.unit_group.max_unit_group_size = journey.world_modifiers[name]
|
||||
end
|
||||
end
|
||||
@ -1167,14 +1189,14 @@ 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.mothership_cargo['uranium-fuel-cell'] = 0
|
||||
journey.world_number = journey.world_number + 1
|
||||
local max_satellites = math_floor(journey.world_number * 0.334) + 1
|
||||
if max_satellites > Constants.max_satellites then
|
||||
max_satellites = Constants.max_satellites
|
||||
end
|
||||
journey.mothership_cargo_space["satellite"] = max_satellites
|
||||
journey.mothership_cargo_space["uranium-fuel-cell"] = journey.mothership_cargo_space["uranium-fuel-cell"] + journey.world_selectors[journey.selected_world].fuel_requirement
|
||||
journey.mothership_cargo_space['satellite'] = max_satellites
|
||||
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()
|
||||
|
||||
@ -1189,24 +1211,24 @@ function Public.create_the_world(journey)
|
||||
for k, v in pairs(journey.bonus_goods) do table.insert(journey.goods_to_dispatch, {k, v}) end
|
||||
table.shuffle_table(journey.goods_to_dispatch)
|
||||
Public.update_tooltips(journey)
|
||||
journey.game_state = "wipe_offline_players"
|
||||
journey.game_state = 'wipe_offline_players'
|
||||
end
|
||||
|
||||
function Public.wipe_offline_players(journey)
|
||||
remove_offline_players(168)
|
||||
remove_offline_players(96)
|
||||
for _, player in pairs(game.players) do
|
||||
if not player.connected then
|
||||
player.force = game.forces.enemy
|
||||
end
|
||||
end
|
||||
journey.game_state = "set_unique_modifiers"
|
||||
journey.game_state = 'set_unique_modifiers'
|
||||
end
|
||||
|
||||
function Public.notify_discord(journey)
|
||||
if journey.disable_discord_notifications then
|
||||
return
|
||||
end
|
||||
local caption = 'World ' .. journey.world_number .. ' | ' .. Constants.unique_world_traits[journey.world_trait][1]
|
||||
local caption = 'World ' .. journey.world_number .. ' | ' .. Constants.unique_world_traits[journey.world_trait].name
|
||||
local message = {
|
||||
title = 'World advanced',
|
||||
description = 'Arriving at target destination!',
|
||||
@ -1218,7 +1240,7 @@ function Public.notify_discord(journey)
|
||||
},
|
||||
field2 = {
|
||||
text1 = 'World description:',
|
||||
text2 = Constants.unique_world_traits[journey.world_trait][2],
|
||||
text2 = Constants.unique_world_traits[journey.world_trait].desc,
|
||||
inline = 'true'
|
||||
},
|
||||
field3 = {
|
||||
@ -1238,7 +1260,7 @@ function Public.set_unique_modifiers(journey)
|
||||
Public.update_tooltips(journey)
|
||||
Public.draw_gui(journey)
|
||||
Public.notify_discord(journey)
|
||||
journey.game_state = "place_teleporter_into_world"
|
||||
journey.game_state = 'place_teleporter_into_world'
|
||||
end
|
||||
|
||||
function Public.place_teleporter_into_world(journey)
|
||||
@ -1246,7 +1268,7 @@ function Public.place_teleporter_into_world(journey)
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 3)
|
||||
surface.force_generate_chunk_requests()
|
||||
place_teleporter(journey, surface, Constants.mothership_teleporter_position, true)
|
||||
journey.game_state = "make_it_night"
|
||||
journey.game_state = 'make_it_night'
|
||||
end
|
||||
|
||||
function Public.make_it_night(journey)
|
||||
@ -1259,8 +1281,8 @@ function Public.make_it_night(journey)
|
||||
clear_selectors(journey)
|
||||
game.reset_time_played()
|
||||
place_teleporter(journey, surface, Constants.mothership_teleporter_position, false)
|
||||
table.insert(journey.mothership_messages, "Teleporter deployed. [gps=" .. Constants.mothership_teleporter_position.x .. "," .. Constants.mothership_teleporter_position.y .. ",mothership]")
|
||||
journey.game_state = "dispatch_goods"
|
||||
table.insert(journey.mothership_messages, 'Teleporter deployed. [gps=' .. Constants.mothership_teleporter_position.x .. ',' .. Constants.mothership_teleporter_position.y .. ',mothership]')
|
||||
journey.game_state = 'dispatch_goods'
|
||||
end
|
||||
end
|
||||
|
||||
@ -1272,11 +1294,11 @@ function Public.dispatch_goods(journey)
|
||||
local goods_to_dispatch = journey.goods_to_dispatch
|
||||
local size_of_goods_to_dispatch = #goods_to_dispatch
|
||||
if size_of_goods_to_dispatch == 0 then
|
||||
for _ = 1, 30, 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, "Capsule storage depleted.")
|
||||
for _ = 1, 30, 1 do table.insert(journey.mothership_messages, "") end
|
||||
table.insert(journey.mothership_messages, "Good luck on your adventure! ^.^")
|
||||
journey.game_state = "world"
|
||||
for _ = 1, 30, 1 do table.insert(journey.mothership_messages, '') end
|
||||
table.insert(journey.mothership_messages, 'Capsule storage depleted.')
|
||||
for _ = 1, 30, 1 do table.insert(journey.mothership_messages, '') end
|
||||
table.insert(journey.mothership_messages, 'Good luck on your adventure! ^.^')
|
||||
journey.game_state = 'world'
|
||||
return
|
||||
end
|
||||
|
||||
@ -1298,32 +1320,69 @@ function Public.dispatch_goods(journey)
|
||||
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)}
|
||||
position = surface.find_non_colliding_position("rocket-silo", position, 32, 1)
|
||||
position = surface.find_non_colliding_position('rocket-silo', position, 32, 1)
|
||||
if not position then return end
|
||||
|
||||
journey.dispatch_beacon = surface.create_entity({name = "stone-wall", position = position, force = "neutral"})
|
||||
journey.dispatch_beacon = surface.create_entity({name = 'stone-wall', position = position, force = 'neutral'})
|
||||
journey.dispatch_beacon.minable = false
|
||||
journey.dispatch_beacon_position = {x = position.x, y = position.y}
|
||||
journey.dispatch_key = math.random(1, size_of_goods_to_dispatch)
|
||||
|
||||
local good = goods_to_dispatch[journey.dispatch_key]
|
||||
table.insert(journey.mothership_messages, "Capsule containing " .. good[2] .. "x [img=item/" .. good[1] .. "] dispatched. [gps=" .. position.x .. "," .. position.y .. ",nauvis]")
|
||||
table.insert(journey.mothership_messages, 'Capsule containing ' .. good[2] .. 'x [img=item/' .. good[1] .. '] dispatched. [gps=' .. position.x .. ',' .. position.y .. ',nauvis]')
|
||||
if journey.announce_capsules then
|
||||
Server.to_discord_embed("A capsule containing " .. good[2] .. "x " .. good[1] .. " was spotted at: x=" .. position.x .. ", y=" .. position.y .. "!")
|
||||
Server.to_discord_embed('A capsule containing ' .. good[2] .. 'x ' .. good[1] .. ' was spotted at: x=' .. position.x .. ', y=' .. position.y .. '!')
|
||||
end
|
||||
|
||||
surface.create_entity({name = "artillery-projectile", position = {x = position.x - 256 + math.random(0, 512), y = position.y - 256}, target = position, speed = 0.2})
|
||||
surface.create_entity({name = 'artillery-projectile', position = {x = position.x - 256 + math.random(0, 512), y = position.y - 256}, target = position, speed = 0.2})
|
||||
end
|
||||
|
||||
function Public.world(journey)
|
||||
if journey.mothership_cargo["uranium-fuel-cell"] 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!! =^.^=")
|
||||
Server.to_discord_embed("Refuel operation complete!")
|
||||
journey.game_state = "mothership_waiting_for_players"
|
||||
if journey.mothership_cargo['uranium-fuel-cell'] 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!! =^.^=')
|
||||
Server.to_discord_embed('Refuel operation complete!')
|
||||
journey.game_state = 'mothership_waiting_for_players'
|
||||
end
|
||||
end
|
||||
draw_background(journey, game.surfaces.mothership)
|
||||
if journey.speedrun.enabled then
|
||||
local item = journey.speedrun.item
|
||||
local time = math.round(journey.speedrun.time / 6) / 10
|
||||
if journey.mothership_cargo[item] and journey.mothership_cargo[item] >= journey.mothership_cargo_space[item] then
|
||||
local amount = 6
|
||||
local brackets = {120, 120, 240, 480, 960, 1920}
|
||||
local timer = time
|
||||
for i = 1, 6, 1 do
|
||||
if timer >= brackets[i] then
|
||||
timer = timer - brackets[i]
|
||||
amount = amount - 1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
table.insert(journey.mothership_messages, {'journey.message_delivery_done', item, time, amount})
|
||||
Server.to_discord_embed({'journey.message_delivery_done', item, time, amount}, true)
|
||||
local bonus_goods = roll_bonus_goods(journey, 'resupply_station', amount)
|
||||
for _, good in pairs(bonus_goods) do
|
||||
if journey.bonus_goods[good[1]] then
|
||||
journey.bonus_goods[good[1]] = journey.bonus_goods[good[1]] + good[2]
|
||||
else
|
||||
journey.bonus_goods[good[1]] = good[2]
|
||||
end
|
||||
table.insert(journey.mothership_messages, {'journey.message_delivered', good[1], good[2]})
|
||||
end
|
||||
Public.update_tooltips(journey)
|
||||
journey.speedrun.enabled = false
|
||||
end
|
||||
if game.tick % 60 == 0 then
|
||||
journey.speedrun.time = journey.speedrun.time + 1
|
||||
time = math.round(journey.speedrun.time / 6) / 10
|
||||
local speedgoal = journey.mothership_cargo_space[item] or 1
|
||||
local value = (journey.mothership_cargo[item] or 0) / speedgoal
|
||||
cargo_gui('journey_delivery', item, {'journey.tooltip_delivery', journey.mothership_cargo[item] or 0, speedgoal, time}, value)
|
||||
end
|
||||
end
|
||||
|
||||
if game.tick % 1800 ~= 0 then return end
|
||||
for k, silo in pairs(journey.rocket_silos) do
|
||||
@ -1346,7 +1405,8 @@ end
|
||||
|
||||
function Public.mothership_waiting_for_players(journey)
|
||||
if journey.characters_in_mothership > #game.connected_players * 0.5 then
|
||||
journey.game_state = "set_world_selectors"
|
||||
journey.game_state = 'set_world_selectors'
|
||||
Vacants.reset()
|
||||
return
|
||||
end
|
||||
|
||||
@ -1367,7 +1427,7 @@ function Public.teleporters(journey, player)
|
||||
local base_position = {0,0}
|
||||
if surface.index == 1 then
|
||||
drop_player_items(journey, player)
|
||||
local position = game.surfaces.mothership.find_non_colliding_position("character", base_position, 32, 0.5)
|
||||
local position = game.surfaces.mothership.find_non_colliding_position('character', base_position, 32, 0.5)
|
||||
if position then
|
||||
player.teleport(position, game.surfaces.mothership)
|
||||
else
|
||||
@ -1376,9 +1436,9 @@ function Public.teleporters(journey, player)
|
||||
journey.characters_in_mothership = journey.characters_in_mothership + 1
|
||||
return
|
||||
end
|
||||
if surface.name == "mothership" then
|
||||
if surface.name == 'mothership' then
|
||||
Public.clear_player(player)
|
||||
local position = game.surfaces.nauvis.find_non_colliding_position("character", base_position, 32, 0.5)
|
||||
local position = game.surfaces.nauvis.find_non_colliding_position('character', base_position, 32, 0.5)
|
||||
if position then
|
||||
player.teleport(position, game.surfaces.nauvis)
|
||||
else
|
||||
@ -1391,27 +1451,27 @@ function Public.teleporters(journey, player)
|
||||
end
|
||||
|
||||
function Public.deal_damage_to_beacon(journey, incoming_damage)
|
||||
if journey.game_state ~= "world" then return end
|
||||
if journey.game_state ~= 'world' then return end
|
||||
local resistance = journey.beacon_objective_resistance
|
||||
journey.beacon_objective_health = math.floor(journey.beacon_objective_health - (incoming_damage * (1 - resistance)))
|
||||
rendering.set_text(journey.beacon_objective_hp_label, {'journey.beacon_hp', journey.beacon_objective_health})
|
||||
if journey.beacon_objective_health < 5000 and game.tick > journey.mothership_messages_last_damage + 900 then --under 50%, once every 15 seconds max
|
||||
table.insert(journey.mothership_messages, "The personal teleporter is being damaged, preparing for emergency departure.")
|
||||
table.insert(journey.mothership_messages, 'The personal teleporter is being damaged, preparing for emergency departure.')
|
||||
journey.mothership_messages_last_damage = game.tick
|
||||
end
|
||||
if journey.beacon_objective_health <= 0 then
|
||||
table.insert(journey.mothership_messages, "Beaming everyone up, triggerring emergency departure.")
|
||||
table.insert(journey.mothership_messages, "[img=item/nuclear-reactor] Emergency power plant burned down ;_;")
|
||||
table.insert(journey.mothership_messages, 'Beaming everyone up, triggerring emergency departure.')
|
||||
table.insert(journey.mothership_messages, '[img=item/nuclear-reactor] Emergency power plant burned down ;_;')
|
||||
journey.mothership_cargo['nuclear-reactor'] = journey.mothership_cargo['nuclear-reactor'] - 30
|
||||
if journey.mothership_cargo['nuclear-reactor'] < 0 then
|
||||
table.insert(journey.mothership_messages, "Aborting, there is not enough emergency fuel. Shutting systems off...")
|
||||
table.insert(journey.mothership_messages, 'Aborting, there is not enough emergency fuel. Shutting systems off...')
|
||||
for _ = 1, #journey.mothership_messages, 1 do
|
||||
Public.mothership_message_queue(journey)
|
||||
end
|
||||
Public.hard_reset(journey)
|
||||
else
|
||||
journey.emergency_triggered = true
|
||||
journey.game_state = "set_world_selectors"
|
||||
journey.game_state = 'set_world_selectors'
|
||||
Public.update_tooltips(journey)
|
||||
Public.draw_gui(journey)
|
||||
end
|
||||
@ -1419,7 +1479,7 @@ function Public.deal_damage_to_beacon(journey, incoming_damage)
|
||||
end
|
||||
|
||||
function Public.lure_biters(journey)
|
||||
if journey.game_state ~= "world" or not journey.beacon_objective.valid then return end
|
||||
if journey.game_state ~= 'world' or not journey.beacon_objective.valid then return end
|
||||
local beacon = journey.beacon_objective
|
||||
local surface = beacon.surface
|
||||
local biters = surface.find_entities_filtered{position = beacon.position, radius = 40, force = 'enemy', type = 'unit'}
|
||||
|
@ -12,6 +12,7 @@ local Map = require 'modules.map_info'
|
||||
local Global = require 'utils.global'
|
||||
local Token = require 'utils.token'
|
||||
local Event = require 'utils.event'
|
||||
local Vacants = require 'modules.clear_vacant_players'
|
||||
|
||||
local journey = {
|
||||
announce_capsules = true
|
||||
@ -47,25 +48,24 @@ local function on_chunk_generated(event)
|
||||
return
|
||||
end
|
||||
|
||||
if surface.name ~= "mothership" then return end
|
||||
if surface.name ~= 'mothership' then return end
|
||||
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)
|
||||
local a = string.find(message, '?', 1, true)
|
||||
if not a then return end
|
||||
local b = string.find(message, 'mother', 1, true)
|
||||
if not b 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, "...")
|
||||
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
|
||||
for _ = 1, math.random(15, 30), 1 do table.insert(journey.mothership_messages, '') end
|
||||
table.insert(journey.mothership_messages, answer)
|
||||
end
|
||||
|
||||
@ -74,14 +74,14 @@ local function on_player_joined_game(event)
|
||||
Functions.draw_gui(journey)
|
||||
Functions.set_minimum_to_vote(journey)
|
||||
|
||||
if player.surface.name == "mothership" then
|
||||
if player.surface.name == 'mothership' then
|
||||
journey.characters_in_mothership = journey.characters_in_mothership + 1
|
||||
end
|
||||
|
||||
if player.force.name == "enemy" then
|
||||
if player.force.name == 'enemy' then
|
||||
Functions.clear_player(player)
|
||||
player.force = game.forces.player
|
||||
local position = game.surfaces.nauvis.find_non_colliding_position("character", {0,0}, 32, 0.5)
|
||||
local position = game.surfaces.nauvis.find_non_colliding_position('character', {0,0}, 32, 0.5)
|
||||
if position then
|
||||
player.teleport(position, game.surfaces.nauvis)
|
||||
else
|
||||
@ -94,8 +94,9 @@ local function on_player_left_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
Functions.draw_gui(journey)
|
||||
|
||||
if player.surface.name == "mothership" then
|
||||
if player.surface.name == 'mothership' then
|
||||
journey.characters_in_mothership = journey.characters_in_mothership - 1
|
||||
player.clear_items_inside()
|
||||
end
|
||||
end
|
||||
|
||||
@ -160,7 +161,9 @@ local function on_rocket_launched(event)
|
||||
end
|
||||
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
|
||||
elseif journey.speedrun.enabled and slot.name == journey.speedrun.item then
|
||||
Server.to_discord_embed('Orbital Station delivery: ' .. slot.name .. ': ' .. journey.mothership_cargo[slot.name] .. '/' .. journey.mothership_cargo_space[slot.name])
|
||||
end
|
||||
end
|
||||
end
|
||||
Functions.draw_gui(journey)
|
||||
@ -201,7 +204,7 @@ local function on_init()
|
||||
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)
|
||||
|
||||
Vacants.init(1, true)
|
||||
Functions.hard_reset(journey)
|
||||
end
|
||||
|
||||
@ -214,7 +217,7 @@ local function cmd_handler()
|
||||
p = player.print
|
||||
end
|
||||
if player and not player.admin then
|
||||
p("You are not an admin!")
|
||||
p('You are not an admin!')
|
||||
return false
|
||||
end
|
||||
return true, player or {name = 'Server'}, p
|
||||
@ -227,7 +230,7 @@ commands.add_command(
|
||||
local s, player = cmd_handler()
|
||||
if s then
|
||||
Functions.hard_reset(journey)
|
||||
game.print(player.name .. " has reset the map.")
|
||||
game.print(player.name .. ' has reset the map.')
|
||||
end
|
||||
end
|
||||
)
|
||||
@ -238,8 +241,8 @@ commands.add_command(
|
||||
function()
|
||||
local s, _, p = cmd_handler()
|
||||
if s then
|
||||
if journey.game_state ~= "dispatch_goods" and journey.game_state ~= "world" then return end
|
||||
journey.game_state = "set_world_selectors"
|
||||
if journey.game_state ~= 'dispatch_goods' and journey.game_state ~= 'world' then return end
|
||||
journey.game_state = 'set_world_selectors'
|
||||
p('The current world was skipped...')
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,3 @@
|
||||
--luacheck: ignore
|
||||
local Get_noise = require 'utils.get_noise'
|
||||
local BiterRaffle = require 'functions.biter_raffle'
|
||||
local LootRaffle = require 'functions.loot_raffle'
|
||||
@ -32,8 +31,8 @@ local solid_tiles = {
|
||||
['refined-hazard-concrete-left'] = true,
|
||||
['refined-hazard-concrete-right'] = true,
|
||||
['stone-path'] = true,
|
||||
["lab-dark-1"] = true,
|
||||
["lab-dark-2"] = true,
|
||||
['lab-dark-1'] = true,
|
||||
['lab-dark-2'] = true,
|
||||
}
|
||||
local wrecks = {
|
||||
'crash-site-spaceship-wreck-big-1',
|
||||
@ -49,455 +48,564 @@ 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,
|
||||
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
|
||||
surface.daytime = 0.44
|
||||
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,
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.daytime = 0.44
|
||||
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.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}
|
||||
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,
|
||||
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}
|
||||
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,
|
||||
}
|
||||
|
||||
Public.matter_anomaly = {
|
||||
on_world_start = function(journey)
|
||||
local force = game.forces.player
|
||||
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,
|
||||
on_world_start = function(journey)
|
||||
local force = game.forces.player
|
||||
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,
|
||||
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,
|
||||
}
|
||||
|
||||
Public.mountainous = {
|
||||
on_player_mined_entity = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if not rock_yield[entity.name] then return end
|
||||
local surface = entity.surface
|
||||
event.buffer.clear()
|
||||
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.05) + math_random(25, 75)
|
||||
local ore_amount = math_floor(count * 0.85)
|
||||
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 = 'stone', count = stone_amount}, true)
|
||||
end,
|
||||
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 get_tile = surface.get_tile
|
||||
local position
|
||||
local noise
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
if math_random(1, 3) ~= 1 then
|
||||
position = {x = left_top_x + x, y = left_top_y + y}
|
||||
if surface.can_place_entity({name = "coal", position = position}) then
|
||||
noise = math_abs(Get_noise('scrapyard', position, seed))
|
||||
if noise < 0.025 or noise > 0.50 then
|
||||
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_player_mined_entity = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
if not rock_yield[entity.name] then return end
|
||||
local surface = entity.surface
|
||||
event.buffer.clear()
|
||||
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.05) + math_random(25, 75)
|
||||
local ore_amount = math_floor(count * 0.85)
|
||||
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 = 'stone', count = stone_amount}, true)
|
||||
end,
|
||||
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 get_tile = surface.get_tile
|
||||
local position
|
||||
local noise
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
if math_random(1, 3) ~= 1 then
|
||||
position = {x = left_top_x + x, y = left_top_y + y}
|
||||
if surface.can_place_entity({name = 'coal', position = position}) then
|
||||
noise = math_abs(Get_noise('scrapyard', position, seed))
|
||||
if noise < 0.025 or noise > 0.50 then
|
||||
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.replicant_fauna = {
|
||||
on_entity_died = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
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 = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = "enemy"}) end
|
||||
end,
|
||||
on_entity_died = function(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
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 = BiterRaffle.roll('mixed', game.forces.enemy.evolution_factor), position = entity.position, force = 'enemy'}) end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.tarball = {
|
||||
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 == "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)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite(
|
||||
{
|
||||
sprite = 'tile/lab-dark-1',
|
||||
x_scale = 32,
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
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,
|
||||
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 == '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)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite(
|
||||
{
|
||||
sprite = 'tile/lab-dark-1',
|
||||
x_scale = 32,
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
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 = {
|
||||
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
|
||||
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", "deepwater"}, area = event.area})) do
|
||||
table.insert(tiles, {name = "water-shallow", position = tile.position})
|
||||
end
|
||||
surface.set_tiles(tiles, true, false, false, false)
|
||||
local tiles = {}
|
||||
for _, tile in pairs(surface.find_tiles_filtered({name = {'water', 'deepwater'}, area = event.area})) do
|
||||
table.insert(tiles, {name = 'water-shallow', position = tile.position})
|
||||
end
|
||||
surface.set_tiles(tiles, true, false, false, false)
|
||||
|
||||
local tiles = {}
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local position = {x = left_top_x + x, y = left_top_y + y}
|
||||
local noise = Get_noise('journey_swamps', position, seed)
|
||||
if noise > 0.45 or noise < -0.65 then table.insert(tiles, {name = "water-shallow", position = {x = position.x, y = position.y}}) end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles, true, false, false, false)
|
||||
local tiles = {}
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local position = {x = left_top_x + x, y = left_top_y + y}
|
||||
local noise = Get_noise('journey_swamps', position, seed)
|
||||
if noise > 0.45 or noise < -0.65 then table.insert(tiles, {name = 'water-shallow', position = {x = position.x, y = position.y}}) end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles, true, false, false, false)
|
||||
|
||||
for _, tile in pairs(tiles) do
|
||||
if math_random(1, 32) == 1 then
|
||||
surface.create_entity({name = "fish", position = tile.position})
|
||||
end
|
||||
end
|
||||
end,
|
||||
for _, tile in pairs(tiles) do
|
||||
if math_random(1, 32) == 1 then
|
||||
surface.create_entity({name = 'fish', position = tile.position})
|
||||
end
|
||||
end
|
||||
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,
|
||||
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,
|
||||
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 + 6
|
||||
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 - 6
|
||||
surface.map_gen_settings = mgs
|
||||
end,
|
||||
}
|
||||
|
||||
Public.volcanic = {
|
||||
on_chunk_generated = function(event, journey)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite({
|
||||
sprite = 'tile/lab-dark-2',
|
||||
x_scale = 32,
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.25},
|
||||
render_layer = 'ground'
|
||||
}))
|
||||
end,
|
||||
on_player_changed_position = function(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.driving then return end
|
||||
local surface = player.surface
|
||||
if surface.index ~= 1 then return end
|
||||
if solid_tiles[surface.get_tile(player.position).name] then return end
|
||||
surface.create_entity({name = "fire-flame", position = player.position})
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 3)
|
||||
surface.force_generate_chunk_requests()
|
||||
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,
|
||||
clear = function(journey)
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
journey.world_color_filters = {}
|
||||
end,
|
||||
on_chunk_generated = function(event, journey)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite({
|
||||
sprite = 'tile/lab-dark-2',
|
||||
x_scale = 32,
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
tint = {r = 0.55, g = 0.0, b = 0.0, a = 0.25},
|
||||
render_layer = 'ground'
|
||||
}))
|
||||
end,
|
||||
on_player_changed_position = function(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.driving then return end
|
||||
local surface = player.surface
|
||||
if surface.index ~= 1 then return end
|
||||
if solid_tiles[surface.get_tile(player.position).name] then return end
|
||||
surface.create_entity({name = 'fire-flame', position = player.position})
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 3)
|
||||
surface.force_generate_chunk_requests()
|
||||
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,
|
||||
clear = function(journey)
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
journey.world_color_filters = {}
|
||||
end,
|
||||
}
|
||||
|
||||
Public.chaotic_resources = {
|
||||
on_chunk_generated = function(event, journey)
|
||||
local surface = event.surface
|
||||
for _, ore in pairs(surface.find_entities_filtered({area = event.area, name = {'iron-ore', 'copper-ore', 'coal', 'stone'}})) do
|
||||
surface.create_entity({name = ore_raffle_2[math_random(1, size_of_ore_raffle_2)], position = ore.position, amount = ore.amount})
|
||||
ore.destroy()
|
||||
end
|
||||
end,
|
||||
on_chunk_generated = function(event, journey)
|
||||
local surface = event.surface
|
||||
for _, ore in pairs(surface.find_entities_filtered({area = event.area, name = {'iron-ore', 'copper-ore', 'coal', 'stone'}})) do
|
||||
surface.create_entity({name = ore_raffle_2[math_random(1, size_of_ore_raffle_2)], position = ore.position, amount = ore.amount})
|
||||
ore.destroy()
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.infested = {
|
||||
on_entity_died = 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_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,
|
||||
on_chunk_generated = function(event, journey)
|
||||
table.insert(journey.world_color_filters, rendering.draw_sprite({
|
||||
sprite = 'tile/lab-dark-2',
|
||||
x_scale = 32,
|
||||
y_scale = 32,
|
||||
target = event.area.left_top,
|
||||
surface = event.surface,
|
||||
tint = {r = 0.8, g = 0.0, b = 0.8, a = 0.25},
|
||||
render_layer = 'ground'
|
||||
}))
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
local apc = mgs.autoplace_controls
|
||||
mgs.autoplace_controls['trees'] = {apc['trees'].frequency * 2, size = apc['trees'].size * 2, richness = apc['trees'].richness * 4}
|
||||
surface.map_gen_settings = mgs
|
||||
surface.clear(true)
|
||||
end,
|
||||
clear = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
local apc = mgs.autoplace_controls
|
||||
mgs.autoplace_controls['trees'] = {apc['trees'].frequency / 2, size = apc['trees'].size / 2, richness = apc['trees'].richness / 4}
|
||||
surface.map_gen_settings = mgs
|
||||
|
||||
for _, id in pairs(journey.world_color_filters) do rendering.destroy(id) end
|
||||
journey.world_color_filters = {}
|
||||
end,
|
||||
on_entity_died = 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_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,
|
||||
}
|
||||
|
||||
Public.undead_plague = {
|
||||
on_entity_died = function(event)
|
||||
local entity = event.entity
|
||||
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,
|
||||
on_entity_died = function(event)
|
||||
local entity = event.entity
|
||||
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,
|
||||
}
|
||||
|
||||
Public.low_mass = {
|
||||
on_world_start = function(journey)
|
||||
local force = game.forces.player
|
||||
force.character_running_speed_modifier = 0.5
|
||||
for i = 1, 6, 1 do force.technologies['worker-robots-speed-' .. i].researched = true end
|
||||
end,
|
||||
on_world_start = function(journey)
|
||||
local force = game.forces.player
|
||||
force.character_running_speed_modifier = 0.5
|
||||
for i = 1, 6, 1 do force.technologies['worker-robots-speed-' .. i].researched = true end
|
||||
end,
|
||||
}
|
||||
|
||||
Public.dense_atmosphere = {
|
||||
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 == "roboport" 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 == "roboport" then entity.die() 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 == 'roboport' 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 == 'roboport' then entity.die() end
|
||||
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
|
||||
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,
|
||||
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,
|
||||
on_chunk_generated = function(event, journey)
|
||||
local surface = event.surface
|
||||
local left_top_x = event.area.left_top.x
|
||||
local left_top_y = event.area.left_top.y
|
||||
if (left_top_x + left_top_y)^2 <= 256 then
|
||||
local oils = surface.count_entities_filtered{name = 'crude-oil', position = {x = 0,y =0}, radius = 256}
|
||||
if math.random(1, 10 + oils * 10) == 1 then
|
||||
local pos = surface.find_non_colliding_position_in_box('oil-refinery', event.area, 0.1, true)
|
||||
if pos then
|
||||
surface.create_entity({name = 'crude-oil', position = pos, amount = 60000})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
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,
|
||||
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,
|
||||
}
|
||||
|
||||
Public.railworld = {
|
||||
on_world_start = function(journey)
|
||||
local surface = game.surfaces.nauvis
|
||||
local mgs = surface.map_gen_settings
|
||||
mgs.starting_area = 3
|
||||
local apc = mgs.autoplace_controls
|
||||
mgs.autoplace_controls = {
|
||||
['coal'] = {frequency = apc['coal'].frequency / 4, size = apc['coal'].size * 4, richness = apc['coal'].richness * 4},
|
||||
['stone'] = {frequency = apc['stone'].frequency / 4, size = apc['stone'].size * 4, richness = apc['stone'].richness * 4},
|
||||
['copper-ore'] = {frequency = apc['copper-ore'].frequency / 4, size = apc['copper-ore'].size * 4, richness = apc['copper-ore'].richness * 4},
|
||||
['iron-ore'] = {frequency = apc['iron-ore'].frequency / 4, size = apc['iron-ore'].size * 4, richness = apc['iron-ore'].richness * 4},
|
||||
['uranium-ore'] = {frequency = apc['uranium-ore'].frequency / 4, size = apc['uranium-ore'].size * 4, richness = apc['uranium-ore'].richness * 4},
|
||||
['crude-oil'] = {frequency = apc['crude-oil'].frequency / 4, size = apc['crude-oil'].size * 4, richness = apc['crude-oil'].richness * 4},
|
||||
['trees'] = apc['trees'],
|
||||
['enemy-base'] = {frequency = apc['enemy-base'].frequency / 4, size = apc['enemy-base'].size * 2, richness = apc['enemy-base'].richness * 2},
|
||||
}
|
||||
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.starting_area = 3
|
||||
local apc = mgs.autoplace_controls
|
||||
mgs.autoplace_controls = {
|
||||
['coal'] = {frequency = apc['coal'].frequency * 4, size = apc['coal'].size / 4, richness = apc['coal'].richness / 4},
|
||||
['stone'] = {frequency = apc['stone'].frequency * 4, size = apc['stone'].size / 4, richness = apc['stone'].richness / 4},
|
||||
['copper-ore'] = {frequency = apc['copper-ore'].frequency * 4, size = apc['copper-ore'].size / 4, richness = apc['copper-ore'].richness / 4},
|
||||
['iron-ore'] = {frequency = apc['iron-ore'].frequency * 4, size = apc['iron-ore'].size / 4, richness = apc['iron-ore'].richness / 4},
|
||||
['uranium-ore'] = {frequency = apc['uranium-ore'].frequency * 4, size = apc['uranium-ore'].size / 4, richness = apc['uranium-ore'].richness / 4},
|
||||
['crude-oil'] = {frequency = apc['crude-oil'].frequency * 4, size = apc['crude-oil'].size / 4, richness = apc['crude-oil'].richness / 4},
|
||||
['trees'] = apc['trees'],
|
||||
['enemy-base'] = {frequency = apc['enemy-base'].frequency * 4, size = apc['enemy-base'].size / 2, richness = apc['enemy-base'].richness / 2},
|
||||
}
|
||||
mgs.water = mgs.water - 1
|
||||
surface.map_gen_settings = mgs
|
||||
end,
|
||||
|
||||
}
|
||||
|
||||
local delivery_options = {
|
||||
'solar-panel',
|
||||
'rocket-part',
|
||||
'beacon',
|
||||
'assembling-machine-3',
|
||||
'low-density-structure',
|
||||
'heat-pipe',
|
||||
'express-transport-belt',
|
||||
'logistic-robot',
|
||||
'power-armor'
|
||||
}
|
||||
|
||||
Public.resupply_station = {
|
||||
on_world_start = function(journey)
|
||||
local pick = delivery_options[math.random(1, #delivery_options)]
|
||||
journey.speedrun = {enabled = true, time = 0, item = pick}
|
||||
journey.mothership_cargo_space[pick] = game.item_prototypes[pick].stack_size
|
||||
end,
|
||||
clear = function(journey)
|
||||
journey.mothership_cargo_space[journey.speedrun.item] = nil
|
||||
journey.mothership_cargo[journey.speedrun.item] = 0
|
||||
journey.speedrun.enabled = false
|
||||
end,
|
||||
}
|
||||
|
||||
return Public
|
||||
|
Loading…
x
Reference in New Issue
Block a user