mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-03 13:12:11 +02:00
update
better tier for pet rolls terrain stuffs
This commit is contained in:
parent
d746d760ae
commit
bc9517b8d8
@ -117,7 +117,7 @@ function Public.update_top_gui(cave_miner)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
local element = player.gui.top.cave_miner
|
||||
if element and element.valid then
|
||||
element.children[1].caption = "Tier " .. cave_miner.pickaxe_tier .. " - " .. pickaxe_tiers[cave_miner.pickaxe_tier] .. " | "
|
||||
element.children[1].caption = pickaxe_tiers[cave_miner.pickaxe_tier] .. " Pickaxe | "
|
||||
element.children[1].tooltip = "Mining speed " .. (1 + game.forces.player.manual_mining_speed_modifier) * 100 .. "%"
|
||||
|
||||
element.children[2].caption = "Rocks broken: " .. cave_miner.rocks_broken
|
||||
|
@ -83,7 +83,7 @@ local function on_player_mined_entity(event)
|
||||
return
|
||||
end
|
||||
if math.random(1, 1024) == 1 then
|
||||
local unit = Functions.spawn_random_biter(surface, position, 1)
|
||||
local unit = Functions.spawn_random_biter(surface, position, 2)
|
||||
Pets.biter_pets_tame_unit(game.players[event.player_index], unit, true)
|
||||
return
|
||||
end
|
||||
|
@ -85,6 +85,7 @@ function Public.offer_bought(event, cave_miner)
|
||||
local bought_offer = offers[offer_index].offer
|
||||
if bought_offer.type ~= "nothing" then return end
|
||||
if offer_index == 1 then
|
||||
market.force.play_sound({path = 'utility/new_objective', volume_modifier = 0.75})
|
||||
cave_miner.pickaxe_tier = cave_miner.pickaxe_tier + 1
|
||||
local speed = Functions.set_mining_speed(cave_miner, player.force)
|
||||
game.print("Pickaxe has been upgraded to: " .. Constants.pickaxe_tiers[cave_miner.pickaxe_tier] .. "!")
|
||||
@ -95,6 +96,7 @@ function Public.offer_bought(event, cave_miner)
|
||||
end
|
||||
if offer_index == 2 then
|
||||
market.force.character_inventory_slots_bonus = market.force.character_inventory_slots_bonus + 2
|
||||
market.force.play_sound({path = 'utility/new_objective', volume_modifier = 0.75})
|
||||
game.print("Backpack has been upgraded to tier " .. (market.force.character_inventory_slots_bonus + 2) * 0.5 .. "!")
|
||||
Public.refresh_offer(market, cave_miner, 2)
|
||||
Public.refresh_offer(market, cave_miner, 3)
|
||||
|
@ -36,7 +36,7 @@ function Public.roll_source_surface()
|
||||
},
|
||||
}
|
||||
local surface = game.create_surface("cave_miner_source", map_gen_settings)
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 1)
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 2)
|
||||
surface.force_generate_chunk_requests()
|
||||
end
|
||||
|
||||
@ -113,13 +113,38 @@ function biomes.spawn(surface, seed, position, square_distance)
|
||||
if square_distance < 32 then return end
|
||||
local noise = GetNoise("decoratives", position, seed)
|
||||
|
||||
if math_abs(noise) > 0.5 then
|
||||
if math_abs(noise) > 0.60 and square_distance > 1250 then
|
||||
surface.set_tiles({{name = "water", position = position}}, true, false, false, false)
|
||||
if math_random(1, 16) == 1 then surface.create_entity({name = "fish", position = position}) end
|
||||
return
|
||||
end
|
||||
|
||||
if math_abs(noise) > 0.15 and math_random(1, 2) > 1 then
|
||||
if math_abs(noise) > 0.25 and math_random(1, 2) > 1 then
|
||||
local a = (-49 + math_random(0, 98)) * 0.01
|
||||
local b = (-49 + math_random(0, 98)) * 0.01
|
||||
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = {position.x + a, position.y + b}})
|
||||
return
|
||||
end
|
||||
|
||||
if square_distance > 1750 then
|
||||
local a = (-49 + math_random(0, 98)) * 0.01
|
||||
local b = (-49 + math_random(0, 98)) * 0.01
|
||||
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = {position.x + a, position.y + b}})
|
||||
end
|
||||
end
|
||||
|
||||
function biomes.ocean(surface, seed, position, square_distance, noise)
|
||||
if noise > 0.68 then
|
||||
surface.set_tiles({{name = "deepwater", position = position}}, true, false, false, false)
|
||||
if math_random(1, 32) == 1 then surface.create_entity({name = "fish", position = position}) end
|
||||
return
|
||||
end
|
||||
if noise > 0.63 then
|
||||
surface.set_tiles({{name = "water", position = position}}, true, false, false, false)
|
||||
if math_random(1, 32) == 1 then surface.create_entity({name = "fish", position = position}) end
|
||||
return
|
||||
end
|
||||
if math_random(1, 3) > 1 then
|
||||
local a = (-49 + math_random(0, 98)) * 0.01
|
||||
local b = (-49 + math_random(0, 98)) * 0.01
|
||||
surface.create_entity({name = rock_raffle[math_random(1, size_of_rock_raffle)], position = {position.x + a, position.y + b}})
|
||||
@ -128,17 +153,20 @@ end
|
||||
|
||||
function biomes.cave(surface, seed, position, square_distance, noise)
|
||||
local noise_cave_rivers1 = GetNoise("cave_rivers_2", position, seed + 100000)
|
||||
if math_abs(noise_cave_rivers1) < 0.025 then
|
||||
local noise_cave_rivers2 = GetNoise("cave_rivers_3", position, seed + 200000)
|
||||
|
||||
if math_abs(noise_cave_rivers1) < 0.025 and noise_cave_rivers2 > -0.35 then
|
||||
surface.set_tiles({{name = "water", position = position}}, true)
|
||||
if noise_cave_rivers2 > 0 then
|
||||
surface.set_tiles({{name = "water", position = position}}, true, false, false, false)
|
||||
if math_random(1, 16) == 1 then surface.create_entity({name = "fish", position = position}) end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if GetNoise("no_rocks_2", position, seed) > 0.7 then return end
|
||||
|
||||
local noise_rock = GetNoise("small_caves", position, seed)
|
||||
|
||||
if noise_rock < 0.4 then
|
||||
if noise_rock < 0.5 then
|
||||
if math_random(1, 3) > 1 then
|
||||
local a = (-49 + math_random(0, 98)) * 0.01
|
||||
local b = (-49 + math_random(0, 98)) * 0.01
|
||||
@ -147,30 +175,34 @@ function biomes.cave(surface, seed, position, square_distance, noise)
|
||||
if math_random(1, 512) == 1 then Functions.loot_crate(surface, position, 1, 8, "wooden-chest") return end
|
||||
if math_random(1, 2048) == 2 then Functions.loot_crate(surface, position, 2, 8, "iron-chest") return end
|
||||
if math_random(1, 4096) == 4 then Functions.loot_crate(surface, position, 3, 8, "steel-chest") return end
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if square_distance < 4096 then return end
|
||||
if math_random(1, 48) == 1 then surface.create_entity({name = "biter-spawner", position = position, force = "enemy"}) end
|
||||
if math_random(1, 48) == 1 then Functions.place_worm(surface, position, 1) end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_biome(surface, seed, position)
|
||||
local d = position.x ^ 2 + position.y ^ 2
|
||||
if d < 1024 then return "spawn", d end
|
||||
if d < 2048 then return biomes.spawn, d end
|
||||
|
||||
local noise = GetNoise("cave_miner_01", position, seed)
|
||||
local abs_noise = math_abs(noise)
|
||||
if abs_noise < 0.09 then return biomes.cave, d, noise end
|
||||
|
||||
if abs_noise > 0.25 then
|
||||
local noise = GetNoise("cave_rivers", position, seed)
|
||||
if noise > 0.72 then return "oasis", d, noise end
|
||||
if noise > 0.72 then return biomes.oasis, d, noise end
|
||||
end
|
||||
|
||||
local noise = GetNoise("big_cave", position, seed)
|
||||
if math_abs(noise) < 0.125 then return "cave", d, noise end
|
||||
local noise = GetNoise("cm_ocean", position, seed + 100000)
|
||||
if noise > 0.6 then return biomes.ocean, d, noise end
|
||||
|
||||
local noise = GetNoise("small_caves", position, seed)
|
||||
if math_abs(noise) < 0.1 then return "cave", d, noise end
|
||||
local noise = GetNoise("cave_miner_02", position, seed)
|
||||
if math_abs(noise) < 0.1 then return biomes.cave, d, noise end
|
||||
|
||||
local noise = GetNoise("small_caves_2", position, seed)
|
||||
if math_abs(noise) < 0.1 then return "cave", d, noise end
|
||||
|
||||
return "void"
|
||||
return biomes.void
|
||||
end
|
||||
|
||||
function Public.generate_cave(event)
|
||||
@ -193,7 +225,7 @@ function Public.generate_cave(event)
|
||||
for y = 0.5, 31.5, 1 do
|
||||
local position = {x = left_top_x + x, y = left_top_y + y}
|
||||
local biome, square_distance, noise = get_biome(surface, seed, position)
|
||||
biomes[biome](surface, seed, position, square_distance, noise)
|
||||
biome(surface, seed, position, square_distance, noise)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user