mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-07 13:31:40 +02:00
Add files via upload
This commit is contained in:
parent
99dc57582d
commit
4fb93c7695
@ -19,7 +19,8 @@ local variants = {
|
||||
[14] = {id = 14, name = "lava planet", iron = 2, copper = 2, coal = 2, stone = 2, uranium = 0, oil = 0, biters = 6, moisture = -0.5, chance = 1, cumul_chance = 24},
|
||||
[15] = {id = 15, name = "start planet", iron = 4, copper = 3, coal = 4, stone = 3, uranium = 0, oil = 0, biters = 1, moisture = -0.3, chance = 0, cumul_chance = 24},
|
||||
[16] = {id = 16, name = "hedge maze", iron = 3, copper = 3, coal = 3, stone = 3, uranium = 1, oil = 2, biters = 16, moisture = -0.1, chance = 2, cumul_chance = 26},
|
||||
[17] = {id = 17, name = "fish market", iron = 0, copper = 0, coal = 0, stone = 0, uranium = 0, oil = 0, biters = 100, moisture = 0, chance = 0, cumul_chance = 26}
|
||||
[17] = {id = 17, name = "fish market", iron = 0, copper = 0, coal = 0, stone = 0, uranium = 0, oil = 0, biters = 100, moisture = 0, chance = 0, cumul_chance = 26},
|
||||
[18] = {id = 18, name = "swamp planet", iron = 1, copper = 0, coal = 4, stone = 0, uranium = 0, oil = 2, biters = 16, moisture = 0.5, chance = 2, cumul_chance = 28}
|
||||
}
|
||||
|
||||
local time_speed_variants = {
|
||||
|
@ -1,6 +1,9 @@
|
||||
local Public = {}
|
||||
|
||||
local tick_tack_trap = require "functions.tick_tack_trap"
|
||||
local unearthing_worm = require "functions.unearthing_worm"
|
||||
local unearthing_biters = require "functions.unearthing_biters"
|
||||
|
||||
local math_random = math.random
|
||||
local math_floor = math.floor
|
||||
|
||||
@ -19,6 +22,22 @@ local function get_ore_amount()
|
||||
return amount
|
||||
end
|
||||
|
||||
local function reward_ores(amount, mined_loot, surface, player)
|
||||
local i = player.insert {name = mined_loot, count = amount}
|
||||
amount = amount - i
|
||||
if amount > 0 then
|
||||
if amount >= 50 then
|
||||
for i = 1, math_floor(amount / 50), 1 do
|
||||
surface.create_entity{name = "item-on-ground", position = player.position, stack = {name = mined_loot, count = 50}}
|
||||
amount = amount - 50
|
||||
end
|
||||
end
|
||||
if amount > 0 then
|
||||
surface.spill_item_stack(player.position, {name = mined_loot, count = amount},true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.biters_chew_rocks_faster(event)
|
||||
if event.entity.force.index ~= 3 then return end --Neutral Force
|
||||
if not event.cause then return end
|
||||
@ -109,12 +128,7 @@ function Public.choppy_loot(event)
|
||||
})
|
||||
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
local inserted_count = player.insert({name = main_item, count = amount})
|
||||
amount = amount - inserted_count
|
||||
if amount > 0 then
|
||||
entity.surface.spill_item_stack(player.position,{name = main_item, count = amount}, true)
|
||||
end
|
||||
reward_ores(amount, main_item, entity.surface, player)
|
||||
|
||||
local inserted_count = player.insert({name = second_item, count = second_item_amount})
|
||||
second_item_amount = second_item_amount - inserted_count
|
||||
@ -137,17 +151,36 @@ function Public.rocky_loot(event)
|
||||
text = "+" .. amount .. " [img=item/" .. mined_loot .. "]",
|
||||
color = {r=0.98, g=0.66, b=0.22}
|
||||
})
|
||||
local i = player.insert {name = mined_loot, count = amount}
|
||||
amount = amount - i
|
||||
if amount > 0 then
|
||||
if amount >= 50 then
|
||||
for i = 1, math_floor(amount / 50), 1 do
|
||||
surface.create_entity{name = "item-on-ground", position = player.position, stack = {name = mined_loot, count = 50}}
|
||||
amount = amount - 50
|
||||
end
|
||||
end
|
||||
surface.spill_item_stack(player.position, {name = mined_loot, count = amount},true)
|
||||
reward_ores(amount, mined_loot, surface, player)
|
||||
end
|
||||
|
||||
local ore_yield = {
|
||||
["behemoth-biter"] = 5,
|
||||
["behemoth-spitter"] = 5,
|
||||
["behemoth-worm-turret"] = 9,
|
||||
["big-biter"] = 3,
|
||||
["big-spitter"] = 3,
|
||||
["big-worm-turret"] = 7,
|
||||
["biter-spawner"] = 16,
|
||||
["medium-biter"] = 2,
|
||||
["medium-spitter"] = 2,
|
||||
["medium-worm-turret"] = 5,
|
||||
["small-biter"] = 1,
|
||||
["small-spitter"] = 1,
|
||||
["small-worm-turret"] = 3,
|
||||
["spitter-spawner"] = 16,
|
||||
}
|
||||
|
||||
function Public.swamp_loot(event)
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
local amount = get_ore_amount() / 10
|
||||
if ore_yield[event.entity.name] then
|
||||
amount = get_ore_amount() / 10 * ore_yield[event.entity.name]
|
||||
end
|
||||
game.print(amount)
|
||||
local rock_mining = {"iron-ore", "coal", "coal", "coal", "coal"}
|
||||
local mined_loot = rock_mining[math_random(1,#rock_mining)]
|
||||
surface.spill_item_stack(event.entity.position,{name = mined_loot, count = amount}, true)
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -15,9 +15,6 @@ require "on_tick_schedule"
|
||||
require "modules.biter_noms_you"
|
||||
local Server = require 'utils.server'
|
||||
local Ai = require "maps.chronosphere.ai"
|
||||
local unearthing_worm = require "functions.unearthing_worm"
|
||||
local unearthing_biters = require "functions.unearthing_biters"
|
||||
|
||||
local Planets = require "maps.chronosphere.chronobubles"
|
||||
local Ores =require "maps.chronosphere.ores"
|
||||
local Reset = require "functions.soft_reset"
|
||||
@ -292,7 +289,7 @@ local function set_objective_health(final_damage_amount)
|
||||
if objective.health > objective.max_health then objective.health = objective.max_health end
|
||||
|
||||
if objective.health <= 0 then
|
||||
Objective.objective_died()
|
||||
Chrono.objective_died()
|
||||
end
|
||||
if objective.health < objective.max_health / 2 and final_damage_amount > 0 then
|
||||
Upgrades.trigger_poison()
|
||||
@ -360,6 +357,12 @@ local function tick()
|
||||
--surface.force_generate_chunk_requests()
|
||||
|
||||
end
|
||||
if tick % 10 == 0 and global.objective.planet[1].name.id == 18 then
|
||||
Tick_functions.spawn_poison()
|
||||
Tick_functions.spawn_poison()
|
||||
Tick_functions.spawn_poison()
|
||||
Tick_functions.spawn_poison()
|
||||
end
|
||||
if tick % 30 == 0 then
|
||||
if tick % 600 == 0 then
|
||||
Tick_functions.charge_chronosphere()
|
||||
@ -446,6 +449,11 @@ local function on_entity_damaged(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
if global.objective.planet[1].name.id == 18 and event.entity.force.name == "enemy" then --swamp planet
|
||||
if event.damage_type.name == "poison" then
|
||||
event.entity.health = event.entity.health + event.final_damage_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pre_player_mined_item(event)
|
||||
@ -498,6 +506,10 @@ local function on_entity_died(event)
|
||||
if entity.force.name == "scrapyard" and entity.name == "gun-turret" and global.objective.planet[1].name.id == 16 then
|
||||
Event_functions.trap(entity, true)
|
||||
end
|
||||
if entity.force.name == "enemy" and entity.type == "unit-spawner" and global.objective.planet[1].name.id == 18 then
|
||||
Ores.prospect_ores(event.entity, event.entity.surface, event.entity.position)
|
||||
--Event_functions.swamp_loot(event)
|
||||
end
|
||||
if entity.force.index == 3 then
|
||||
if event.cause then
|
||||
if event.cause.valid then
|
||||
|
@ -113,6 +113,7 @@ function Public_ores.prospect_ores(entity, surface, pos)
|
||||
local chance = 10
|
||||
if entity then
|
||||
if entity.name == "rock-huge" then chance = 40 end
|
||||
if entity.type == "unit-spawner" then chance = 40 end
|
||||
if math_random(chance + math_floor(10 * planet[1].ore_richness.factor) ,100 + chance) >= 100 then
|
||||
spawn_ore_vein(surface, pos, planet)
|
||||
end
|
||||
|
@ -505,6 +505,49 @@ local function process_scrapyard_position(p, seed, tiles, entities, treasure, pl
|
||||
tiles[#tiles + 1] = {name = "stone-path", position = p}
|
||||
end
|
||||
|
||||
local function process_swamp_position(p, seed, tiles, entities, treasure, planet)
|
||||
local scrapyard = get_noise("scrapyard", p, seed)
|
||||
local biters = planet[1].name.biters
|
||||
|
||||
if scrapyard < -0.70 or scrapyard > 0.70 then
|
||||
tiles[#tiles + 1] = {name = "grass-3", position = p}
|
||||
if math_random(1,50) == 1 then treasure[#treasure + 1] = p end
|
||||
return
|
||||
end
|
||||
|
||||
if scrapyard < -0.60 or scrapyard > 0.60 then
|
||||
tiles[#tiles + 1] = {name = "water-green", position = p}
|
||||
return
|
||||
end
|
||||
if math_abs(scrapyard) > 0.40 and math_abs(scrapyard) < 0.60 then
|
||||
if math_random(1,40) == 1 and math_sqrt(p.x * p.x + p.y * p.y) > 120 then entities[#entities + 1] = {name = worm_raffle[math_random(1 + math_floor(game.forces["enemy"].evolution_factor * 8), math_floor(1 + game.forces["enemy"].evolution_factor * 16))], position = p}end
|
||||
tiles[#tiles + 1] = {name = "water-mud", position = p}
|
||||
return
|
||||
end
|
||||
if math_abs(scrapyard) > 0.25 and math_abs(scrapyard) < 0.40 then
|
||||
if math_random(1,80) == 1 and math_sqrt(p.x * p.x + p.y * p.y) > 120 then entities[#entities + 1] = {name = worm_raffle[math_random(1 + math_floor(game.forces["enemy"].evolution_factor * 8), math_floor(1 + game.forces["enemy"].evolution_factor * 16))], position = p}end
|
||||
tiles[#tiles + 1] = {name = "water-shallow", position = p}
|
||||
return
|
||||
end
|
||||
if scrapyard > -0.02 and scrapyard < 0.02 then
|
||||
tiles[#tiles + 1] = {name = "water-green", position = p}
|
||||
return
|
||||
end
|
||||
if scrapyard > -0.05 and scrapyard < 0.05 then
|
||||
if math_random(1,100) > 42 then
|
||||
entities[#entities + 1] = {name = tree_raffle[math_random(1, s_tree_raffle)], position = p}
|
||||
else
|
||||
if math_random(1,20) == 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, size_of_rock_raffle)], position = p} end
|
||||
end
|
||||
tiles[#tiles + 1] = {name = "grass-1", position = p}
|
||||
return
|
||||
end
|
||||
if math_random(1, 120) == 1 and math_sqrt(p.x * p.x + p.y * p.y) > 150 then
|
||||
entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p}
|
||||
end
|
||||
tiles[#tiles + 1] = {name = "grass-2", position = p}
|
||||
end
|
||||
|
||||
local function process_fish_position(p, seed, tiles, entities, treasure, planet)
|
||||
local body_radius = 1984 --3072
|
||||
local body_square_radius = body_radius ^ 2
|
||||
@ -593,7 +636,7 @@ local levels = {
|
||||
process_river_position,
|
||||
process_biter_position,
|
||||
process_scrapyard_position,
|
||||
process_level_9_position,
|
||||
process_swamp_position,
|
||||
process_fish_position,
|
||||
}
|
||||
|
||||
@ -948,6 +991,9 @@ local function process_chunk(surface, left_top)
|
||||
--if math_abs(left_top.y) > 31 or math_abs(left_top.x) > 31 then normal_chunk(surface, left_top, 3, planet) return end
|
||||
if math_abs(left_top.y) <= 31 and math_abs(left_top.x - 864) <= 31 then fish_market(surface, left_top, 10, planet) return end
|
||||
fish_chunk(surface, left_top, 10, planet)
|
||||
elseif id == 18 then --swamp planet
|
||||
if math_abs(left_top.y) <= 31 and math_abs(left_top.x) <= 31 then empty_chunk(surface, left_top, 9, planet) return end
|
||||
if math_abs(left_top.y) > 31 or math_abs(left_top.x) > 31 then normal_chunk(surface, left_top, 9, planet) return end
|
||||
else
|
||||
if math_abs(left_top.y) <= 31 and math_abs(left_top.x) <= 31 then empty_chunk(surface, left_top, 7, planet) return end
|
||||
if math_abs(left_top.y) > 31 or math_abs(left_top.x) > 31 then biter_chunk(surface, left_top, 7, planet) return end
|
||||
|
@ -1,5 +1,7 @@
|
||||
local Public = {}
|
||||
|
||||
local math_random = math.random
|
||||
|
||||
function Public.check_chronoprogress()
|
||||
local objective = global.objective
|
||||
--game.print(objective.chronotimer)
|
||||
@ -132,4 +134,19 @@ function Public.repair_train()
|
||||
return 0
|
||||
end
|
||||
|
||||
function Public.spawn_poison()
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
local random_x = math_random(-460,460)
|
||||
local random_y = math_random(-460,460)
|
||||
local tile = surface.get_tile(random_x, random_y)
|
||||
if not tile.valid then return end
|
||||
if tile.name == "water-shallow" or tile.name == "water-mud" then
|
||||
surface.create_entity({name = "poison-cloud", position = {x = random_x, y = random_y}})
|
||||
surface.create_entity({name = "poison-cloud", position = {x = random_x + 2, y = random_y + 2}})
|
||||
surface.create_entity({name = "poison-cloud", position = {x = random_x - 2, y = random_y - 2}})
|
||||
surface.create_entity({name = "poison-cloud", position = {x = random_x + 2, y = random_y - 2}})
|
||||
surface.create_entity({name = "poison-cloud", position = {x = random_x - 2, y = random_y + 2}})
|
||||
end
|
||||
end
|
||||
|
||||
return Public
|
||||
|
Loading…
x
Reference in New Issue
Block a user