mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
Add files via upload
This commit is contained in:
parent
87e7edcb5a
commit
5ee0dbb598
@ -1,14 +1,111 @@
|
||||
local Public_chrono = {}
|
||||
|
||||
local Server = require 'utils.server'
|
||||
local math_random = math.random
|
||||
|
||||
function Public_chrono.get_map_gen_settings()
|
||||
local seed = math_random(1, 1000000)
|
||||
local map_gen_settings = {
|
||||
["seed"] = seed,
|
||||
["width"] = 960,
|
||||
["height"] = 960,
|
||||
["water"] = 0.1,
|
||||
["starting_area"] = 1,
|
||||
["cliff_settings"] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
|
||||
["default_enable_all_autoplace_controls"] = true,
|
||||
["autoplace_settings"] = {
|
||||
["entity"] = {treat_missing_as_default = false},
|
||||
["tile"] = {treat_missing_as_default = true},
|
||||
["decorative"] = {treat_missing_as_default = true},
|
||||
},
|
||||
}
|
||||
return map_gen_settings
|
||||
end
|
||||
|
||||
function Public_chrono.restart_settings()
|
||||
local objective = global.objective
|
||||
objective.max_health = 10000
|
||||
objective.health = 10000
|
||||
objective.hpupgradetier = 0
|
||||
objective.acuupgradetier = 0
|
||||
objective.filterupgradetier = 0
|
||||
objective.pickupupgradetier = 0
|
||||
objective.invupgradetier = 0
|
||||
objective.toolsupgradetier = 0
|
||||
objective.waterupgradetier = 0
|
||||
objective.outupgradetier = 0
|
||||
objective.boxupgradetier = 0
|
||||
objective.poisondefense = 2
|
||||
objective.poisontimeout = 0
|
||||
objective.chronotimer = 0
|
||||
objective.passivetimer = 0
|
||||
objective.passivejumps = 0
|
||||
objective.chrononeeds = 2000
|
||||
objective.mainscore = 0
|
||||
objective.active_biters = {}
|
||||
objective.unit_groups = {}
|
||||
objective.biter_raffle = {}
|
||||
objective.dangertimer = 1200
|
||||
objective.dangers = {}
|
||||
objective.looted_nukes = 0
|
||||
objective.offline_players = {}
|
||||
objective.nextsurface = nil
|
||||
global.outchests = {}
|
||||
global.upgradechest = {}
|
||||
global.fishchest = {}
|
||||
global.acumulators = {}
|
||||
global.comfychests = {}
|
||||
global.comfychests2 = {}
|
||||
global.locomotive_cargo = {}
|
||||
for _, player in pairs(game.connected_players) do
|
||||
global.flame_boots[player.index] = {fuel = 1, steps = {}}
|
||||
end
|
||||
global.friendly_fire_history = {}
|
||||
global.landfill_history = {}
|
||||
global.mining_history = {}
|
||||
global.score = {}
|
||||
global.difficulty_poll_closing_timeout = game.tick + 90000
|
||||
global.difficulty_player_votes = {}
|
||||
|
||||
game.difficulty_settings.technology_price_multiplier = 0.6
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0.005
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0
|
||||
game.map_settings.enemy_evolution.time_factor = 7e-05
|
||||
game.map_settings.enemy_expansion.enabled = true
|
||||
game.map_settings.enemy_expansion.max_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.min_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.settler_group_max_size = 8
|
||||
game.map_settings.enemy_expansion.settler_group_min_size = 16
|
||||
game.map_settings.pollution.enabled = true
|
||||
game.map_settings.pollution.pollution_restored_per_tree_damage = 0.02
|
||||
game.map_settings.pollution.min_pollution_to_damage_trees = 1
|
||||
game.map_settings.pollution.max_pollution_to_restore_trees = 0
|
||||
game.map_settings.pollution.pollution_with_max_forest_damage = 10
|
||||
game.map_settings.pollution.pollution_per_tree_damage = 0.1
|
||||
game.map_settings.pollution.ageing = 0.1
|
||||
game.map_settings.pollution.diffusion_ratio = 0.1
|
||||
game.map_settings.pollution.enemy_attack_pollution_consumption_modifier = 5
|
||||
game.forces.neutral.character_inventory_slots_bonus = 500
|
||||
game.forces.enemy.evolution_factor = 0.0001
|
||||
game.forces.scrapyard.set_friend('enemy', true)
|
||||
game.forces.enemy.set_friend('scrapyard', true)
|
||||
|
||||
game.forces.player.technologies["land-mine"].enabled = false
|
||||
game.forces.player.technologies["landfill"].enabled = false
|
||||
game.forces.player.technologies["fusion-reactor-equipment"].enabled = false
|
||||
game.forces.player.technologies["power-armor-mk2"].enabled = false
|
||||
game.forces.player.technologies["railway"].researched = true
|
||||
game.forces.player.recipes["pistol"].enabled = false
|
||||
end
|
||||
|
||||
|
||||
function Public_chrono.objective_died()
|
||||
local objective = global.objective
|
||||
if objective.game_lost == true then return end
|
||||
objective.health = 0
|
||||
local surface = objective.surface
|
||||
game.print("The chronotrain was destroyed!")
|
||||
game.print("Comfylatron is going to kill you for that...he has time machine after all!")
|
||||
game.print({"chronosphere.message_game_lost1"})
|
||||
game.print({"chronosphere.message_game_lost2"})
|
||||
for i = 1, 3, 1 do
|
||||
surface.create_entity({name = "big-artillery-explosion", position = global.locomotive_cargo[i].position})
|
||||
global.locomotive_cargo[i].destroy()
|
||||
@ -56,24 +153,25 @@ function Public_chrono.process_jump(choice)
|
||||
objective.chrononeeds = 2000 + 400 * objective.chronojumps
|
||||
objective.passivetimer = 0
|
||||
objective.chronotimer = 0
|
||||
objective.danegrtimer = 1200
|
||||
local message = "Comfylatron: Wheeee! Time Jump Active! This is Jump number " .. global.objective.chronojumps
|
||||
game.print(message, {r=0.98, g=0.66, b=0.22})
|
||||
Server.to_discord_embed(message)
|
||||
|
||||
if objective.chronojumps == 6 then
|
||||
game.print("Comfylatron: Biters start to evolve faster! We need to charge forward or they will be stronger! (hover over timer to see evolve timer)", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_evolve"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.chronojumps >= 15 and objective.computermessage == 0 then
|
||||
game.print("Comfylatron: You know...I have big quest. Deliver fish to fish market. But this train is broken. Please help me fix the train computer!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest1"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.computermessage = 1
|
||||
elseif objective.chronojumps >= 20 and objective.computermessage == 2 then
|
||||
game.print("Comfylatron: Ah, we need to give this machine more power and better navigation chipset. Please bring me some additional things.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest3"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.computermessage = 3
|
||||
elseif objective.chronojumps >= 25 and objective.computermessage == 4 then
|
||||
game.print("Comfylatron: Finally found the main issue. We will need to rebuild whole processor. Exactly what I feared of. Just a few more things...", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest5"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.computermessage = 5
|
||||
end
|
||||
if overstayed then
|
||||
game.print("Comfylatron: Looks like you stayed on previous planet for so long that enemies on other planets had additional time to evolve!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_overstay"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
if objective.planet[1].name.id == 19 then
|
||||
check_nuke_silos()
|
||||
@ -87,7 +185,7 @@ function Public_chrono.get_wagons()
|
||||
three = global.locomotive_cargo[3].get_inventory(defines.inventory.cargo_wagon)
|
||||
}
|
||||
inventories.one.sort_and_merge()
|
||||
inventories.two.sort_and_merge()
|
||||
--inventories.two.sort_and_merge()
|
||||
local wagons = {}
|
||||
wagons[1] = {inventory = inventories.one.get_contents(), bar = inventories.one.get_bar(), filters = {}}
|
||||
wagons[2] = {inventory = inventories.two.get_contents(), bar = inventories.two.get_bar(), filters = {}}
|
||||
@ -112,16 +210,16 @@ function Public_chrono.post_jump()
|
||||
global.comfychests[1].insert({name = "space-science-pack", count = 1000})
|
||||
if objective.looted_nukes > 0 then
|
||||
global.comfychests[1].insert({name = "atomic-bomb", count = objective.looted_nukes})
|
||||
game.print("Comfylatron: Luckily we looted some nukes before, take them.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_fishmarket3"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
objective.chrononeeds = 200000000
|
||||
elseif objective.planet[1].name.id == 19 then
|
||||
objective.chronotimer = objective.chrononeeds - 1500
|
||||
objective.chronotimer = objective.chrononeeds - 1800
|
||||
end
|
||||
for _, player in pairs(game.connected_players) do
|
||||
global.flame_boots[player.index] = {fuel = 1, steps = {}}
|
||||
end
|
||||
objective.danegrtimer = 1200
|
||||
|
||||
game.map_settings.enemy_evolution.time_factor = 7e-05 + 3e-06 * (objective.chronojumps + objective.passivejumps)
|
||||
game.forces.scrapyard.set_ammo_damage_modifier("bullet", 0.01 * objective.chronojumps)
|
||||
game.forces.scrapyard.set_turret_attack_modifier("gun-turret", 0.01 * objective.chronojumps)
|
||||
|
@ -99,7 +99,7 @@ function Public.determine_planet(choice)
|
||||
name = planet_choice,
|
||||
day_speed = dayspeed,
|
||||
time = daytime,
|
||||
ore_richness = richness[ores],
|
||||
ore_richness = richness[ores]
|
||||
}
|
||||
}
|
||||
objective.planet = planet
|
||||
|
@ -211,18 +211,18 @@ end
|
||||
|
||||
local function desync(event)
|
||||
if global.comfybubble then global.comfybubble.destroy() end
|
||||
--local m = 12
|
||||
--local m2 = m * 0.005
|
||||
-- for i = 1, 32, 1 do
|
||||
-- global.comfylatron.surface.create_entity({
|
||||
-- name = "iron-ore-particle",
|
||||
-- position = global.comfylatron.position,
|
||||
-- frame_speed = 0.1,
|
||||
-- vertical_speed = 0.1,
|
||||
-- height = 0.1,
|
||||
-- movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
-- })
|
||||
-- end
|
||||
local m = 12
|
||||
local m2 = m * 0.005
|
||||
for i = 1, 32, 1 do
|
||||
global.comfylatron.surface.create_particle({
|
||||
name = "iron-ore-particle",
|
||||
position = global.comfylatron.position,
|
||||
frame_speed = 0.1,
|
||||
vertical_speed = 0.1,
|
||||
height = 0.1,
|
||||
movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
})
|
||||
end
|
||||
if not event or math_random(1,4) == 1 then
|
||||
global.comfylatron.surface.create_entity({name = "medium-explosion", position = global.comfylatron.position})
|
||||
global.comfylatron.surface.create_entity({name = "flying-text", position = global.comfylatron.position, text = "desync", color = {r = 150, g = 0, b = 0}})
|
||||
|
@ -23,8 +23,8 @@ local function get_ore_amount()
|
||||
end
|
||||
|
||||
local function reward_ores(amount, mined_loot, surface, player)
|
||||
local i = player.insert {name = mined_loot, count = amount}
|
||||
amount = amount - i
|
||||
local a = player.insert {name = mined_loot, count = amount}
|
||||
amount = amount - a
|
||||
if amount > 0 then
|
||||
if amount >= 50 then
|
||||
for i = 1, math_floor(amount / 50), 1 do
|
||||
@ -180,9 +180,9 @@ local ore_yield = {
|
||||
|
||||
function Public_event.swamp_loot(event)
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
local amount = get_ore_amount() / 10
|
||||
local amount = get_ore_amount() / 12
|
||||
if ore_yield[event.entity.name] then
|
||||
amount = get_ore_amount() / 10 * ore_yield[event.entity.name]
|
||||
amount = get_ore_amount() / 12 * ore_yield[event.entity.name]
|
||||
end
|
||||
local rock_mining = {"iron-ore", "iron-ore", "coal", "coal", "coal"}
|
||||
local mined_loot = rock_mining[math_random(1,#rock_mining)]
|
||||
@ -195,7 +195,7 @@ function Public_event.danger_silo(entity)
|
||||
if objective.dangers and #objective.dangers > 1 then
|
||||
for i = 1, #objective.dangers, 1 do
|
||||
if entity == objective.dangers[i].silo then
|
||||
game.print("Nuclear silo destroyed. You managed to loot 5 atomic bombs. Comfylatron seized them for your own safety.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_silo"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.dangers[i].destroyed = true
|
||||
objective.dangers[i].silo = nil
|
||||
objective.dangers[i].speaker.destroy()
|
||||
@ -263,5 +263,27 @@ function Public_event.flamer_nerfs()
|
||||
game.forces.player.set_turret_attack_modifier("flamethrower-turret", flamer_power - 0.02 * difficulty * objective.chronojumps)
|
||||
end
|
||||
|
||||
function Public_event.mining_buffs()
|
||||
local mining_power = 0
|
||||
local mining_researches = {
|
||||
[1] = {name = "mining-productivity-1", bonus = 0.2},
|
||||
[2] = {name = "mining-productivity-2", bonus = 0.2},
|
||||
[3] = {name = "mining-productivity-3", bonus = 0.2},
|
||||
[4] = {name = "mining-productivity-4", bonus = 0.2}
|
||||
}
|
||||
for i = 1, 3, 1 do
|
||||
if game.forces.player.technologies[mining_researches[i].name].researched then
|
||||
mining_power = mining_power + mining_researches[i].bonus
|
||||
end
|
||||
end
|
||||
mining_power = mining_power + (game.forces.player.technologies[mining_researches[4].name].level - 4) * 0.2
|
||||
game.forces.player.mining_drill_productivity_bonus = 1 + mining_power
|
||||
local bonusinv = 0
|
||||
if game.forces.player.technologies["toolbelt"].researched then bonusinv = 10 end
|
||||
game.forces.player.character_inventory_slots_bonus = mining_power * 50 + global.objective.invupgradetier * 10 + bonusinv
|
||||
if game.forces.player.technologies["steel-axe"].researched then
|
||||
game.forces.player.manual_mining_speed_modifier = 1 + mining_power * 2
|
||||
end
|
||||
end
|
||||
|
||||
return Public_event
|
||||
|
@ -154,7 +154,7 @@ local function update_gui(player)
|
||||
[2] = {t = "[2]: Pollution Filter. Actual value of pollution made: " .. math_floor(300/(objective.filterupgradetier/3+1)) .. "%\n Buyable once per 3 jumps.\n Cost: 5000 coins + 2000 green circuits + Jump number " .. (objective.filterupgradetier + 1) * 3 .. "\n"},
|
||||
[3] = {t = "[3]: Add additional row of Acumulators.\n Cost : " .. math_floor(2000 * (1 + objective.acuupgradetier /4)) .. " coins + 200 batteries\n"},
|
||||
[4] = {t = "[4]: Add item pickup distance to players.Current: +" .. objective.pickupupgradetier .. ",\n Cost: " .. 1000 * (1 + objective.pickupupgradetier) .. " coins + 400 red inserters\n"},
|
||||
[5] = {t = "[5]: Add +5 inventory slots. Buyable once per 5 jumps.\n Cost: " .. 2000 * (1 + objective.invupgradetier) .." coins + " .. chests[objective.invupgradetier + 1].c},
|
||||
[5] = {t = "[5]: Add +10 inventory slots. Buyable once per 5 jumps.\n Cost: " .. 2000 * (1 + objective.invupgradetier) .." coins + " .. chests[objective.invupgradetier + 1].c},
|
||||
[6] = {t = "[6]: Use up more repair tools on train at once. Current: +" .. objective.toolsupgradetier .. "\n Cost: " .. 1000 * (1 + objective.toolsupgradetier) .. " coins + " .. 200 * (1 + objective.toolsupgradetier) .. " repair tools\n"},
|
||||
[7] = {t = "[7]: Add piping through wagon sides to create water sources for each wagon.\n Cost: 2000 coins + 500 pipes\n"},
|
||||
[8] = {t = "[8]: Add comfylatron chests that output outside (into cargo wagon 2 and 3)\n Cost: 2000 coins + 100 fast inserters\n"},
|
||||
|
@ -32,8 +32,8 @@ function Public.locomotive_spawn(surface, position, wagons)
|
||||
global.locomotive.color = {0, 255, 0}
|
||||
global.locomotive.minable = false
|
||||
|
||||
-- if not global.comfychests then global.comfychests = {} end
|
||||
-- if not global.acumulators then global.acumulators = {} end
|
||||
--if not global.comfychests then global.comfychests = {} end
|
||||
--if not global.acumulators then global.acumulators = {} end
|
||||
for i = 1, 24, 1 do
|
||||
local yi = 0
|
||||
local xi = 5
|
||||
@ -122,8 +122,8 @@ local market_offers = {
|
||||
function Public.create_wagon_room()
|
||||
local width = 64
|
||||
local height = 384
|
||||
--global.comfychests2 = {}
|
||||
if not global.acumulators then global.acumulators = {} end
|
||||
global.comfychests2 = {}
|
||||
global.acumulators = {}
|
||||
local map_gen_settings = {
|
||||
["width"] = width,
|
||||
["height"] = height + 128,
|
||||
|
@ -47,11 +47,12 @@ local function generate_overworld(surface, optplanet)
|
||||
game.print(message, {r=0.98, g=0.66, b=0.22})
|
||||
Server.to_discord_embed(message)
|
||||
if planet[1].name.id == 12 then
|
||||
game.print("Comfylatron: OwO what are those strange trees?!? They have ore fruits! WTF!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_choppy"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif planet[1].name.id == 14 then
|
||||
game.print("Comfylatron: OOF this one is a bit hot. And have seen those biters? They BATHE in fire! Maybe try some bricks to protect from lava?", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_lava"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif planet[1].name.id == 17 then
|
||||
game.print("Comfylatron: So here we are. Fish Market. When they ordered the fish, they said this location is perfectly safe. Looks like we will have to do it for them. I hope you have enough nukes. Also, that satellite gave us some space knowledge.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_fishmarket1"}, {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_fishmarket2"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
surface.min_brightness = 0
|
||||
surface.brightness_visual_weights = {1, 1, 1}
|
||||
@ -100,25 +101,6 @@ local function generate_overworld(surface, optplanet)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_map_gen_settings()
|
||||
local seed = math_random(1, 1000000)
|
||||
local map_gen_settings = {
|
||||
["seed"] = seed,
|
||||
["width"] = 960,
|
||||
["height"] = 960,
|
||||
["water"] = 0.1,
|
||||
["starting_area"] = 1,
|
||||
["cliff_settings"] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
|
||||
["default_enable_all_autoplace_controls"] = true,
|
||||
["autoplace_settings"] = {
|
||||
["entity"] = {treat_missing_as_default = false},
|
||||
["tile"] = {treat_missing_as_default = true},
|
||||
["decorative"] = {treat_missing_as_default = true},
|
||||
},
|
||||
}
|
||||
return map_gen_settings
|
||||
end
|
||||
|
||||
local function render_train_hp()
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
local objective = global.objective
|
||||
@ -159,11 +141,11 @@ local function reset_map()
|
||||
objective.computerupgrade = 0
|
||||
objective.computerparts = 0
|
||||
objective.computermessage = 0
|
||||
local map_gen_settings = get_map_gen_settings()
|
||||
objective.chronojumps = 0
|
||||
Planets.determine_planet(nil)
|
||||
local planet = global.objective.planet
|
||||
if not global.active_surface_index then
|
||||
global.active_surface_index = game.create_surface("chronosphere", map_gen_settings).index
|
||||
global.active_surface_index = game.create_surface("chronosphere", Chrono.get_map_gen_settings()).index
|
||||
else
|
||||
game.forces.player.set_spawn_position({12, 10}, game.surfaces[global.active_surface_index])
|
||||
global.active_surface_index = Reset.soft_reset_map(game.surfaces[global.active_surface_index], map_gen_settings, starting_items).index
|
||||
@ -171,79 +153,7 @@ local function reset_map()
|
||||
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
generate_overworld(surface, planet)
|
||||
|
||||
|
||||
objective.max_health = 10000
|
||||
objective.health = 10000
|
||||
objective.hpupgradetier = 0
|
||||
objective.acuupgradetier = 0
|
||||
objective.filterupgradetier = 0
|
||||
objective.pickupupgradetier = 0
|
||||
objective.invupgradetier = 0
|
||||
objective.toolsupgradetier = 0
|
||||
objective.waterupgradetier = 0
|
||||
objective.outupgradetier = 0
|
||||
objective.boxupgradetier = 0
|
||||
objective.poisondefense = 2
|
||||
objective.poisontimeout = 0
|
||||
objective.chronojumps = 0
|
||||
objective.chronotimer = 0
|
||||
objective.passivetimer = 0
|
||||
objective.passivejumps = 0
|
||||
objective.chrononeeds = 2000
|
||||
objective.mainscore = 0
|
||||
objective.active_biters = {}
|
||||
objective.unit_groups = {}
|
||||
objective.biter_raffle = {}
|
||||
objective.dangertimer = 1200
|
||||
objective.dangers = {}
|
||||
objective.looted_nukes = 0
|
||||
global.outchests = {}
|
||||
global.upgradechest = {}
|
||||
global.fishchest = {}
|
||||
global.acumulators = {}
|
||||
global.comfychests = {}
|
||||
global.comfychests2 = {}
|
||||
global.locomotive_cargo = {}
|
||||
for _, player in pairs(game.connected_players) do
|
||||
global.flame_boots[player.index] = {fuel = 1, steps = {}}
|
||||
end
|
||||
global.friendly_fire_history = {}
|
||||
global.landfill_history = {}
|
||||
global.mining_history = {}
|
||||
global.score = {}
|
||||
|
||||
|
||||
|
||||
|
||||
game.difficulty_settings.technology_price_multiplier = 0.6
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0.005
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0
|
||||
game.map_settings.enemy_evolution.time_factor = 7e-05
|
||||
game.map_settings.enemy_expansion.enabled = true
|
||||
game.map_settings.enemy_expansion.max_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.min_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.settler_group_max_size = 8
|
||||
game.map_settings.enemy_expansion.settler_group_min_size = 16
|
||||
game.map_settings.pollution.enabled = true
|
||||
game.map_settings.pollution.pollution_restored_per_tree_damage = 0.02
|
||||
game.map_settings.pollution.min_pollution_to_damage_trees = 1
|
||||
game.map_settings.pollution.max_pollution_to_restore_trees = 0
|
||||
game.map_settings.pollution.pollution_with_max_forest_damage = 10
|
||||
game.map_settings.pollution.pollution_per_tree_damage = 0.1
|
||||
game.map_settings.pollution.ageing = 0.1
|
||||
game.map_settings.pollution.diffusion_ratio = 0.1
|
||||
game.map_settings.pollution.enemy_attack_pollution_consumption_modifier = 5
|
||||
game.forces.enemy.evolution_factor = 0.0001
|
||||
game.forces.scrapyard.set_friend('enemy', true)
|
||||
game.forces.enemy.set_friend('scrapyard', true)
|
||||
|
||||
game.forces.player.technologies["land-mine"].enabled = false
|
||||
game.forces.player.technologies["landfill"].enabled = false
|
||||
game.forces.player.technologies["fusion-reactor-equipment"].enabled = false
|
||||
game.forces.player.technologies["power-armor-mk2"].enabled = false
|
||||
game.forces.player.technologies["railway"].researched = true
|
||||
game.forces.player.recipes["pistol"].enabled = false
|
||||
Chrono.restart_settings()
|
||||
|
||||
game.forces.player.set_spawn_position({12, 10}, surface)
|
||||
local wagons = {}
|
||||
@ -258,10 +168,9 @@ local function reset_map()
|
||||
render_train_hp()
|
||||
game.reset_time_played()
|
||||
Locomotive.create_wagon_room()
|
||||
global.difficulty_poll_closing_timeout = game.tick + 54000
|
||||
global.difficulty_player_votes = {}
|
||||
Event_functions.mining_buffs()
|
||||
if objective.game_won then
|
||||
game.print("Comfylatron: WAIT whaat? Looks like we did not fixed the train properly and it teleported us back in time...sigh...so let's do this again, and now properly.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_game_won_restart"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
objective.game_lost = false
|
||||
objective.game_won = false
|
||||
@ -301,11 +210,6 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_player_left_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
end
|
||||
|
||||
local function on_pre_player_left_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.controller_type == defines.controllers.editor then player.toggle_map_editor() end
|
||||
@ -344,13 +248,12 @@ local function chronojump(choice)
|
||||
Locomotive.enter_cargo_wagon(player, wagons[math_random(1,3)])
|
||||
end
|
||||
end
|
||||
local map_gen_settings = get_map_gen_settings()
|
||||
global.lab_cells = {}
|
||||
global.active_surface_index = game.create_surface("chronosphere" .. objective.chronojumps, map_gen_settings).index
|
||||
global.active_surface_index = game.create_surface("chronosphere" .. objective.chronojumps, Chrono.get_map_gen_settings()).index
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
local planet = nil
|
||||
if choice then
|
||||
Planets.determine_planet(choice)
|
||||
Planets.determine_planet(choice, 1)
|
||||
planet = global.objective.planet
|
||||
end
|
||||
generate_overworld(surface, planet)
|
||||
@ -570,15 +473,9 @@ local function on_entity_died(event)
|
||||
end
|
||||
end
|
||||
|
||||
--on_player_mined_entity(event)
|
||||
--if not event.entity.valid then return end
|
||||
--end
|
||||
|
||||
local function on_research_finished(event)
|
||||
event.research.force.character_inventory_slots_bonus = game.forces.player.mining_drill_productivity_bonus * 100 + global.objective.invupgradetier * 5
|
||||
Event_functions.flamer_nerfs()
|
||||
if not event.research.force.technologies["steel-axe"].researched then return end
|
||||
event.research.force.manual_mining_speed_modifier = 1 + game.forces.player.mining_drill_productivity_bonus * 4
|
||||
Event_functions.mining_buffs()
|
||||
end
|
||||
|
||||
local function on_player_driving_changed_state(event)
|
||||
@ -642,7 +539,6 @@ event.add(defines.events.on_pre_player_left_game, on_pre_player_left_game)
|
||||
event.add(defines.events.on_pre_player_mined_item, pre_player_mined_item)
|
||||
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
||||
--event.add(defines.events.on_market_item_purchased, on_market_item_purchased)
|
||||
event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)
|
||||
event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
||||
|
@ -103,7 +103,7 @@ local function spawn_ore_vein(surface, pos, planet)
|
||||
if choice == "crude-oil" then
|
||||
surface.create_entity({name = "crude-oil", position = pos, amount = get_oil_amount(pos, oil.w, planet[1].ore_richness.factor) })
|
||||
else
|
||||
draw_noise_ore_patch(pos, choice, surface, get_size_of_ore(choice, planet), richness, mixed)
|
||||
draw_noise_ore_patch(pos, choice, surface, get_size_of_ore(choice, planet), richness / 2, mixed)
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
@ -364,7 +364,7 @@ end
|
||||
|
||||
local function process_river_position(p, seed, tiles, entities, treasure, planet)
|
||||
local biters = planet[1].name.biters
|
||||
local richness = math_random(50 + 20 * global.objective.chronojumps, 100 + 20 * global.objective.chronojumps) * planet[1].ore_richness.factor
|
||||
local richness = math_random(50 + 20 * global.objective.chronojumps, 100 + 20 * global.objective.chronojumps) * planet[1].ore_richness.factor * 0.5
|
||||
local iron_size = get_size_of_ore("iron-ore", planet) * 3
|
||||
local copper_size = get_size_of_ore("copper-ore", planet) * 3
|
||||
local stone_size = get_size_of_ore("stone", planet) * 3
|
||||
@ -988,6 +988,7 @@ end
|
||||
|
||||
local function on_chunk_generated(event)
|
||||
if string.sub(event.surface.name, 0, 12) ~= "chronosphere" then return end
|
||||
if event.surface.index == global.objective.nextsurface then return end
|
||||
process_chunk(event.surface, event.area.left_top)
|
||||
--global.chunk_queue[#global.chunk_queue + 1] = {left_top = {x = event.area.left_top.x, y = event.area.left_top.y}, surface_index = event.surface.index}
|
||||
end
|
||||
|
@ -5,23 +5,24 @@ local math_floor = math.floor
|
||||
|
||||
function Public_tick.check_chronoprogress()
|
||||
local objective = global.objective
|
||||
local map_gen_settings = Public_tick.get_map_gen_settings()
|
||||
--game.print(objective.chronotimer)
|
||||
if objective.planet[1].name.id == 19 then
|
||||
if objective.passivetimer == 10 then
|
||||
game.print("Comfylatron: We have a problem! We got disrupted in mid-jump, only part of energy got used, and here we landed. It might have been a trap!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print("Comfylatron: My analysis says that charging needs full energy reset to work again, so we are stuck there until next full jump.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_danger1"}, {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_danger2"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.passivetimer == 25 then
|
||||
game.print("Robot voice: INTRUDER ALERT! Lifeforms detected! Must eliminate!", {r=0.98, g=0, b=0})
|
||||
game.print({"chronosphere.message_danger3"}, {r=0.98, g=0, b=0})
|
||||
elseif objective.passivetimer == 30 then
|
||||
game.print("Robot voice: Nuclear missiles armed, launch countdown enabled.", {r=0.98, g=0, b=0})
|
||||
game.print({"chronosphere.message_danger4"}, {r=0.98, g=0, b=0})
|
||||
end
|
||||
end
|
||||
if objective.chronotimer == objective.chrononeeds - 180 then
|
||||
game.print("Comfylatron: Acumulator charging disabled, 180 seconds countdown to jump!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_jump180"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.chronotimer == objective.chrononeeds - 60 then
|
||||
game.print("Comfylatron: ChronoTrain nearly charged! Grab what you can, we leaving in 60 seconds!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_jump60"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.chronotimer == objective.chrononeeds - 30 then
|
||||
game.print("Comfylatron: You better hurry up! 30 seconds remaining!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_jump30"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.chronotimer >= objective.chrononeeds - 10 and objective.chrononeeds - objective.chronotimer > 0 then
|
||||
game.print("Comfylatron: Jump in " .. objective.chrononeeds - objective.chronotimer .. " seconds!", {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
@ -85,11 +86,19 @@ function Public_tick.move_items()
|
||||
local items = input_inventory.get_contents()
|
||||
|
||||
for item, count in pairs(items) do
|
||||
local inserted = output_inventory.insert({name = item, count = count})
|
||||
if inserted > 0 then
|
||||
local removed = input_inventory.remove({name = item, count = inserted})
|
||||
end
|
||||
if item == "modular-armor" or item == "power-armor" or item == "power-armor-mk2" then
|
||||
--log("can't move armors")
|
||||
else
|
||||
local inserted = output_inventory.insert({name = item, count = count})
|
||||
if inserted > 0 then
|
||||
local removed = input_inventory.remove({name = item, count = inserted})
|
||||
end
|
||||
end
|
||||
end
|
||||
-- local items = {}
|
||||
-- for ii = 1, #input_inventory, 1 do
|
||||
-- items[#items + 1] = input_inventory[ii]
|
||||
-- end
|
||||
end
|
||||
end
|
||||
|
||||
@ -105,15 +114,19 @@ function Public_tick.output_items()
|
||||
inv.sort_and_merge()
|
||||
local items = inv.get_contents()
|
||||
for item, count in pairs(items) do
|
||||
local inserted = nil
|
||||
if i <= 2 then
|
||||
inserted = global.locomotive_cargo[2].get_inventory(defines.inventory.cargo_wagon).insert({name = item, count = count})
|
||||
else
|
||||
inserted = global.locomotive_cargo[3].get_inventory(defines.inventory.cargo_wagon).insert({name = item, count = count})
|
||||
end
|
||||
if inserted > 0 then
|
||||
local removed = inv.remove({name = item, count = inserted})
|
||||
end
|
||||
if item == "modular-armor" or item == "power-armor" or item == "power-armor-mk2" then
|
||||
--log("can't move armors")
|
||||
else
|
||||
local inserted = nil
|
||||
if i <= 2 then
|
||||
inserted = global.locomotive_cargo[2].get_inventory(defines.inventory.cargo_wagon).insert({name = item, count = count, grid = item.grid})
|
||||
else
|
||||
inserted = global.locomotive_cargo[3].get_inventory(defines.inventory.cargo_wagon).insert({name = item, count = count, grid = item.grid})
|
||||
end
|
||||
if inserted > 0 then
|
||||
local removed = inv.remove({name = item, count = inserted})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -168,7 +181,7 @@ local function launch_nukes()
|
||||
if objective.dangers[i].destroyed == false then
|
||||
local fake_shooter = surface.create_entity({name = "character", position = objective.dangers[i].silo.position, force = "enemy"})
|
||||
surface.create_entity({name = "atomic-rocket", position = objective.dangers[i].silo.position, force = "enemy", speed = 1, max_range = 800, target = global.locomotive, source = fake_shooter})
|
||||
game.print("Warning: Nuclear missile launched.", {r=0.98, g=0, b=0})
|
||||
game.print({"chronosphere.message_nuke"}, {r=0.98, g=0, b=0})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -205,7 +218,7 @@ end
|
||||
|
||||
function Public_tick.offline_players()
|
||||
local objective = global.objective
|
||||
if objective.chronotimer > objective.chrononeeds - 182 then return end
|
||||
if objective.chronotimer > objective.chrononeeds - 182 or objective.passivetimer < 30 then return end
|
||||
local current_tick = game.tick
|
||||
local players = objective.offline_players
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
@ -217,30 +230,40 @@ function Public_tick.offline_players()
|
||||
--game.print("deleting already online character from list")
|
||||
players[i] = nil
|
||||
else
|
||||
if players[i] and players[i].tick < game.tick - 54000 then
|
||||
if players[i] and players[i].tick < game.tick - 540 then
|
||||
--log("spawning corpse")
|
||||
local player_inv = {}
|
||||
local items = {}
|
||||
player_inv[1] = game.players[players[i].index].get_inventory(defines.inventory.character_main)
|
||||
player_inv[2] = game.players[players[i].index].get_inventory(defines.inventory.character_armor)
|
||||
player_inv[3] = game.players[players[i].index].get_inventory(defines.inventory.character_guns)
|
||||
player_inv[4] = game.players[players[i].index].get_inventory(defines.inventory.character_ammo)
|
||||
player_inv[5] = game.players[players[i].index].get_inventory(defines.inventory.character_trash)
|
||||
game.print("Comfylatron: Offline player had an accident, and dropped his items on ground around locomotive.")
|
||||
local e = surface.create_entity({name = "character", position = game.forces.player.get_spawn_position(surface), force = "player"})
|
||||
game.print({"chronosphere.message_accident"}, {r=0.98, g=0.66, b=0.22})
|
||||
local e = surface.create_entity({name = "character", position = game.forces.player.get_spawn_position(surface), force = "neutral"})
|
||||
local inv = e.get_inventory(defines.inventory.character_main)
|
||||
for i = 1, 5, 1 do
|
||||
if player_inv[i].valid then
|
||||
local items = player_inv[i].get_contents()
|
||||
for item, count in pairs(items) do
|
||||
inv.insert({name = item, count = count})
|
||||
player_inv[i].remove({name = item, count = count})
|
||||
for ii = 1, 5, 1 do
|
||||
if player_inv[ii].valid then
|
||||
for iii = 1, #player_inv[ii], 1 do
|
||||
if player_inv[ii][iii].valid then
|
||||
items[#items + 1] = player_inv[ii][iii]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if #items > 0 then
|
||||
for item = 1, #items, 1 do
|
||||
if items[item].valid then
|
||||
inv.insert(items[item])
|
||||
end
|
||||
else
|
||||
--log("invalid")
|
||||
--game.print("invalid")
|
||||
end
|
||||
end
|
||||
e.die("neutral")
|
||||
for ii = 1, 5, 1 do
|
||||
if player_inv[ii].valid then
|
||||
player_inv[ii].clear()
|
||||
end
|
||||
end
|
||||
players[i] = nil
|
||||
else
|
||||
--game.print("keeping player in list")
|
||||
|
@ -30,8 +30,8 @@ local function check_upgrade_hp()
|
||||
local coincost = math_floor(500 * (1 + objective.hpupgradetier /2))
|
||||
if countcoins >= coincost and count2 >= 1500 and objective.hpupgradetier < 36 then
|
||||
inv.remove({name = "coin", count = coincost})
|
||||
inv.remove({name = "copper-plate", count = 3000})
|
||||
game.print("Comfylatron: Train's max HP was upgraded.", {r=0.98, g=0.66, b=0.22})
|
||||
inv.remove({name = "copper-plate", count = 1500})
|
||||
game.print({"chronosphere.message_upgrade_hp"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.hpupgradetier = objective.hpupgradetier + 1
|
||||
objective.max_health = 10000 + 2500 * objective.hpupgradetier
|
||||
rendering.set_text(global.objective.health_text, "HP: " .. global.objective.health .. " / " .. global.objective.max_health)
|
||||
@ -48,7 +48,7 @@ local function check_upgrade_filter()
|
||||
if countcoins >= 5000 and count2 >= 2000 and objective.filterupgradetier < 9 and objective.chronojumps >= (objective.filterupgradetier + 1) * 3 then
|
||||
inv.remove({name = "coin", count = 5000})
|
||||
inv.remove({name = "electronic-circuit", count = 2000})
|
||||
game.print("Comfylatron: Train's pollution filter was upgraded.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_filter"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.filterupgradetier = objective.filterupgradetier + 1
|
||||
end
|
||||
end
|
||||
@ -64,7 +64,7 @@ local function check_upgrade_acu()
|
||||
if countcoins >= coincost and count2 >= 200 and objective.acuupgradetier < 24 then
|
||||
inv.remove({name = "coin", count = coincost})
|
||||
inv.remove({name = "battery", count = 200})
|
||||
game.print("Comfylatron: Train's acumulator capacity was upgraded.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_acu"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.acuupgradetier = objective.acuupgradetier + 1
|
||||
spawn_acumulators()
|
||||
end
|
||||
@ -81,7 +81,7 @@ local function check_upgrade_pickup()
|
||||
if countcoins >= coincost and count2 >= 400 and objective.pickupupgradetier < 4 then
|
||||
inv.remove({name = "coin", count = coincost})
|
||||
inv.remove({name = "long-handed-inserter", count = 400})
|
||||
game.print("Comfylatron: Players now have additional red inserter installed on shoulders, increasing their item pickup range.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_pickup"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.pickupupgradetier = objective.pickupupgradetier + 1
|
||||
game.forces.player.character_loot_pickup_distance_bonus = game.forces.player.character_loot_pickup_distance_bonus + 1
|
||||
end
|
||||
@ -108,7 +108,7 @@ local function check_upgrade_inv()
|
||||
if countcoins >= coincost and count2 >= 250 and objective.invupgradetier < 4 and objective.chronojumps >= (objective.invupgradetier + 1) * 5 then
|
||||
inv.remove({name = "coin", count = coincost})
|
||||
inv.remove({name = item, count = 250})
|
||||
game.print("Comfylatron: Players now can carry more trash in their unsorted inventories.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_inventory"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.invupgradetier = objective.invupgradetier + 1
|
||||
game.forces.player.character_inventory_slots_bonus = game.forces.player.character_inventory_slots_bonus + 10
|
||||
end
|
||||
@ -126,7 +126,7 @@ local function check_upgrade_tools()
|
||||
if countcoins >= coincost and count2 >= toolscost and objective.toolsupgradetier < 4 then
|
||||
inv.remove({name = "coin", count = coincost})
|
||||
inv.remove({name = "repair-pack", count = toolscost})
|
||||
game.print("Comfylatron: Train now gets repaired with additional repair kit at once.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_repair"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.toolsupgradetier = objective.toolsupgradetier + 1
|
||||
end
|
||||
end
|
||||
@ -141,7 +141,7 @@ local function check_upgrade_water()
|
||||
if countcoins >= 2000 and count2 >= 500 and objective.waterupgradetier < 1 then
|
||||
inv.remove({name = "coin", count = 2000})
|
||||
inv.remove({name = "pipe", count = 500})
|
||||
game.print("Comfylatron: Train now has piping system for additional water sources.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_water"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.waterupgradetier = objective.waterupgradetier + 1
|
||||
local positions = {{28,66},{28,-62},{-29,66},{-29,-62}}
|
||||
for i = 1, 4, 1 do
|
||||
@ -162,7 +162,7 @@ local function check_upgrade_out()
|
||||
if countcoins >= 2000 and count2 >= 100 and objective.outupgradetier < 1 then
|
||||
inv.remove({name = "coin", count = 2000})
|
||||
inv.remove({name = "fast-inserter", count = 100})
|
||||
game.print("Comfylatron: Train now has output chests.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_out"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.outupgradetier = objective.outupgradetier + 1
|
||||
local positions = {{-16,-62},{15,-62},{-16,66},{15,66}}
|
||||
local out = {}
|
||||
@ -206,47 +206,43 @@ local function check_upgrade_box()
|
||||
if countcoins >= 5000 and count2 >= 250 and objective.boxupgradetier < 4 and objective.chronojumps >= (objective.boxupgradetier + 1) * 5 then
|
||||
inv.remove({name = "coin", count = 5000})
|
||||
inv.remove({name = item, count = 250})
|
||||
game.print("Comfylatron: Cargo wagons now have enlargened storage.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_storage"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.boxupgradetier = objective.boxupgradetier + 1
|
||||
local chests = {}
|
||||
local positions = {
|
||||
[1] = {x = {-33, 32}, y = {-189, -127, -61, 1, 67, 129}}
|
||||
}
|
||||
local positions = {x = {-33, 32}, y = {-189, -127, -61, 1, 67, 129}}
|
||||
for i = 1, 58, 1 do
|
||||
for ii = 1, 6, 1 do
|
||||
if objective.boxupgradetier == 1 then
|
||||
chests[#chests + 1] = {name = "wooden-chest", position = {x = positions[1].x[1] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {name = "wooden-chest", position = {x = positions[1].x[2] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {entity = {name = "wooden-chest", position = {x = positions.x[1] ,y = positions.y[ii] + i}, force = "player"}, old = "none"}
|
||||
chests[#chests + 1] = {entity = {name = "wooden-chest", position = {x = positions.x[2] ,y = positions.y[ii] + i}, force = "player"}, old = "none"}
|
||||
elseif objective.boxupgradetier == 2 then
|
||||
chests[#chests + 1] = {name = "iron-chest", position = {x = positions[1].x[1] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {name = "iron-chest", position = {x = positions[1].x[2] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {entity = {name = "iron-chest", position = {x = positions.x[1] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "wood"}
|
||||
chests[#chests + 1] = {entity = {name = "iron-chest", position = {x = positions.x[2] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "wood"}
|
||||
elseif objective.boxupgradetier == 3 then
|
||||
chests[#chests + 1] = {name = "steel-chest", position = {x = positions[1].x[1] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {name = "steel-chest", position = {x = positions[1].x[2] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {entity = {name = "steel-chest", position = {x = positions.x[1] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "iron"}
|
||||
chests[#chests + 1] = {entity = {name = "steel-chest", position = {x = positions.x[2] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "iron"}
|
||||
elseif objective.boxupgradetier == 4 then
|
||||
chests[#chests + 1] = {name = "logistic-chest-storage", position = {x = positions[1].x[1] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {name = "logistic-chest-storage", position = {x = positions[1].x[2] ,y = positions[1].y[ii] + i}, force = "player"}
|
||||
chests[#chests + 1] = {entity = {name = "logistic-chest-storage", position = {x = positions.x[1] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "steel"}
|
||||
chests[#chests + 1] = {entity = {name = "logistic-chest-storage", position = {x = positions.x[2] ,y = positions.y[ii] + i}, force = "player", fast_replace = true, spill = false}, old = "steel"}
|
||||
end
|
||||
end
|
||||
end
|
||||
local surface = game.surfaces["cargo_wagon"]
|
||||
for i = 1, #chests, 1 do
|
||||
if objective.boxupgradetier == 1 then
|
||||
surface.set_tiles({{name = "tutorial-grid", position = chests[i].position}})
|
||||
surface.set_tiles({{name = "tutorial-grid", position = chests[i].entity.position}})
|
||||
end
|
||||
local e = surface.create_entity(chests[i])
|
||||
local old = nil
|
||||
if e.name == "iron-chest" then old = surface.find_entity("wooden-chest", e.position)
|
||||
elseif e.name == "steel-chest" then old = surface.find_entity("iron-chest", e.position)
|
||||
elseif e.name == "logistic-chest-storage" then old = surface.find_entity("steel-chest", e.position)
|
||||
local oldpos = {x = chests[i].entity.position.x + 0.5, y = chests[i].entity.position.y + 0.5}
|
||||
if chests[i].old == "wood" then old = surface.find_entity("wooden-chest", oldpos)
|
||||
elseif chests[i].old == "iron" then old = surface.find_entity("iron-chest", oldpos)
|
||||
elseif chests[i].old == "steel" then old = surface.find_entity("steel-chest", oldpos)
|
||||
end
|
||||
if old then
|
||||
local items = old.get_inventory(defines.inventory.chest).get_contents()
|
||||
for item, count in pairs(items) do
|
||||
e.insert({name = item, count = count})
|
||||
end
|
||||
old.destroy()
|
||||
old.minable = true
|
||||
old.destructible = true
|
||||
end
|
||||
local e = surface.create_entity(chests[i].entity)
|
||||
e.destructible = false
|
||||
e.minable = false
|
||||
end
|
||||
@ -263,7 +259,7 @@ local function check_poisondefense()
|
||||
if countcoins >= 1000 and count2 >= 50 and objective.poisondefense < 4 then
|
||||
inv.remove({name = "coin", count = 1000})
|
||||
inv.remove({name = "poison-capsule", count = 50})
|
||||
game.print("Comfylatron: I don't believe in your defense skills. I equipped train with poison defense.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_poison"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.poisondefense = objective.poisondefense + 1
|
||||
end
|
||||
end
|
||||
@ -288,7 +284,7 @@ local function check_upgrade_computer()
|
||||
inv.remove({name = "coin", count = 5000})
|
||||
inv.remove({name = "advanced-circuit", count = 1000})
|
||||
inv.remove({name = "copper-plate", count = 2000})
|
||||
game.print("Comfylatron: Thanks for fixing train navigation. I can now get us rid of very poor worlds. It will still need more work though.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest2"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.computermessage = 2
|
||||
objective.computerupgrade = objective.computerupgrade + 1
|
||||
elseif countcoins >= 10000 and count3 >= 1000 and count7 >= 1 and objective.computerupgrade == 1 and objective.chronojumps >= 20 and objective.computermessage == 3 then
|
||||
@ -297,7 +293,7 @@ local function check_upgrade_computer()
|
||||
inv.remove({name = "nuclear-reactor", count = 1})
|
||||
objective.computermessage = 4
|
||||
objective.computerupgrade = objective.computerupgrade + 1
|
||||
game.print("Comfylatron: Perfect! Now we have train reactor and even better destination precision. I will get to you later what still needs to be done.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest4"}, {r=0.98, g=0.66, b=0.22})
|
||||
elseif objective.computerupgrade == 2 and objective.chronojumps >= 25 and objective.computermessage == 5 then
|
||||
if countcoins >= 2000 and count4 >= 100 and count5 >= 100 and count6 >= 50 and objective.computerparts < 10 then
|
||||
inv.remove({name = "coin", count = 2000})
|
||||
@ -308,12 +304,12 @@ local function check_upgrade_computer()
|
||||
if objective.computerparts < 10 then
|
||||
game.print("Comfylatron: That's another processor part done! I still need " .. 10 - objective.computerparts .. " more of those parts.", {r=0.98, g=0.66, b=0.22})
|
||||
else
|
||||
game.print("Comfylatron: And this was last part of cpu brain done. Now we just need to synchronize our time correctly and we are done! Bring me satellite and rocket silo.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest6"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
elseif objective.computerparts == 10 and count9 >= 1 and count10 >= 1 then
|
||||
inv.remove({name = "satellite", count = 1 })
|
||||
inv.remove({name = "rocket-silo", count = 1 })
|
||||
game.print("Comfylatron: Time synchronized. Calculating time and space destination. Success. Jump once more and let me deliver the fish finally. This trip is getting long.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_quest7"}, {r=0.98, g=0.66, b=0.22})
|
||||
objective.computermessage = 6
|
||||
objective.computerupgrade = objective.computerupgrade + 1
|
||||
end
|
||||
@ -342,7 +338,7 @@ local function check_win()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound{path="utility/game_won", volume_modifier=0.85}
|
||||
end
|
||||
local message = "Comfylatron: Thank you with helping me on this delivery. It was tough one. I hope, that now, when all biters are dead, fish will be safe here forever...after all, we delivered " .. objective.mainscore .. " of them fishies."
|
||||
local message = {"chronosphere.message_game_won1"} .. "after all, we delivered " .. objective.mainscore .. " of them fishies."
|
||||
game.print(message, {r=0.98, g=0.66, b=0.22})
|
||||
Server.to_discord_embed(message)
|
||||
end
|
||||
@ -364,7 +360,7 @@ local function check_mk2_buy()
|
||||
inv.remove({name = "railgun-dart", count = 300})
|
||||
inv.remove({name = "power-armor", count = 1})
|
||||
inv.insert({name = "power-armor-mk2", count = 1})
|
||||
game.print("Comfylatron: I upgraded one armor to mk2.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_mk2"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -381,7 +377,7 @@ local function check_fusion_buy()
|
||||
inv.remove({name = "railgun-dart", count = 200})
|
||||
inv.remove({name = "solar-panel-equipment", count = 16})
|
||||
inv.insert({name = "fusion-reactor-equipment", count = 1})
|
||||
game.print("Comfylatron: One personal fusion reactor ready.", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_upgrade_fusion"}, {r=0.98, g=0.66, b=0.22})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -442,7 +438,7 @@ function Public.trigger_poison()
|
||||
objective.poisontimeout = 120
|
||||
local objs = {global.locomotive, global.locomotive_cargo[1], global.locomotive_cargo[2], global.locomotive_cargo[3]}
|
||||
local surface = objective.surface
|
||||
game.print("Comfylatron: Triggering poison defense. Let's kill everything!", {r=0.98, g=0.66, b=0.22})
|
||||
game.print({"chronosphere.message_poison_defense"}, {r=0.98, g=0.66, b=0.22})
|
||||
for i = 1, 4, 1 do
|
||||
surface.create_entity({name = "poison-capsule", position = objs[i].position, force = "player", target = objs[i], speed = 1 })
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user