mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-03 13:12:11 +02:00
spooky_forest update
This commit is contained in:
parent
b4711754fa
commit
dc6b72f0eb
@ -22,7 +22,7 @@ require "score"
|
||||
--require "maps.spiral_troopers"
|
||||
--require "maps.fish_defender"
|
||||
--require "maps.crossing"
|
||||
--require "maps.spooky_forest"
|
||||
require "maps.spooky_forest"
|
||||
--require "maps.atoll"
|
||||
--require "maps.empty_map"
|
||||
-----------------------------
|
||||
|
@ -81,7 +81,7 @@ local function hunger_update(player, food_value)
|
||||
|
||||
if player.character then
|
||||
if player_hunger_stages[global.player_hunger[player.name]] ~= player_hunger_stages[past_hunger] then
|
||||
local print_message = "You feel " .. player_hunger_stages[global.player_hunger[player.name]] .. "."
|
||||
local print_message = "You are " .. player_hunger_stages[global.player_hunger[player.name]] .. "."
|
||||
if player_hunger_stages[global.player_hunger[player.name]] == "Obese" then
|
||||
print_message = "You have become " .. player_hunger_stages[global.player_hunger[player.name]] .. "."
|
||||
end
|
||||
@ -101,7 +101,7 @@ end
|
||||
local function respawn_fishes()
|
||||
local surface = game.players[1].surface
|
||||
for chunk in surface.get_chunks() do
|
||||
if math_random(1, 4) == 1 then
|
||||
if math_random(1, 32) == 1 then
|
||||
local area = {{chunk.x * 32, chunk.y * 32}, {chunk.x * 32 + 32, chunk.y * 32 + 32}}
|
||||
local water_tiles = surface.find_tiles_filtered({name = {"water", "deepwater", "water-green"}, area = area})
|
||||
for _, tile in pairs(water_tiles) do
|
||||
@ -137,10 +137,12 @@ local function on_player_used_capsule(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_tick(event)
|
||||
if game.tick % 3600 == 1800 then
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.afk_time < 18000 then hunger_update(player, -1) end
|
||||
local function on_tick()
|
||||
if game.tick % 360 == 0 then
|
||||
if game.tick % 3600 == 0 then
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.afk_time < 18000 then hunger_update(player, -1) end
|
||||
end
|
||||
end
|
||||
if respawn_fish then
|
||||
respawn_fishes()
|
||||
|
@ -81,9 +81,9 @@ local function secret_shop(pos, surface)
|
||||
{price = {{"raw-fish", math_random(60,120)}}, offer = {type = 'give-item', item = 'exoskeleton-equipment'}},
|
||||
{price = {{"raw-fish", math_random(60,120)}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
|
||||
{price = {{"raw-fish", math_random(10,20)}}, offer = {type = 'give-item', item = 'construction-robot'}},
|
||||
{price = {{"raw-fish", math_random(75,150)}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
|
||||
{price = {{"raw-fish", math_random(150,300)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{"raw-fish", math_random(20,30)}}, offer = {type = 'give-item', item = 'railgun'}},
|
||||
{price = {{"raw-fish", math_random(100,200)}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
|
||||
{price = {{"raw-fish", math_random(200,400)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{"raw-fish", math_random(25,50)}}, offer = {type = 'give-item', item = 'railgun'}},
|
||||
{price = {{"raw-fish", math_random(1,2)}}, offer = {type = 'give-item', item = 'railgun-dart', count = 2}},
|
||||
{price = {{"raw-fish", math_random(30,60)}}, offer = {type = 'give-item', item = 'loader'}},
|
||||
{price = {{"raw-fish", math_random(50,80)}}, offer = {type = 'give-item', item = 'fast-loader'}},
|
||||
@ -91,12 +91,9 @@ local function secret_shop(pos, surface)
|
||||
{price = {{"raw-fish", math_random(30,60)}}, offer = {type = 'give-item', item = 'locomotive'}},
|
||||
{price = {{"raw-fish", math_random(15,35)}}, offer = {type = 'give-item', item = 'cargo-wagon'}},
|
||||
{price = {{"raw-fish", math_random(1,4)}}, offer = {type = 'give-item', item = 'grenade'}},
|
||||
{price = {{"raw-fish", math_random(70,100)}}, offer = {type = 'give-item', item = 'express-loader'}},
|
||||
{price = {{"raw-fish", math_random(70,100)}}, offer = {type = 'give-item', item = 'express-loader'}},
|
||||
{price = {{"raw-fish", math_random(70,100)}}, offer = {type = 'give-item', item = 'express-loader'}},
|
||||
{price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'rail', count = 4}},
|
||||
{price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'rail-signal', count = 2}},
|
||||
{price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'rail-chain-signal', count = 2}},
|
||||
-- {price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'rail-signal', count = 2}},
|
||||
-- {price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'rail-chain-signal', count = 2}},
|
||||
{price = {{"raw-fish", 5}}, offer = {type = 'give-item', item = 'train-stop'}},
|
||||
{price = {{"raw-fish", 1}}, offer = {type = 'give-item', item = 'small-lamp'}},
|
||||
{price = {{"raw-fish", 2}}, offer = {type = 'give-item', item = 'firearm-magazine'}},
|
||||
@ -183,7 +180,7 @@ local function get_entity(position)
|
||||
end
|
||||
end
|
||||
else
|
||||
if math_random(1, 1024) == 1 then
|
||||
if math_random(1, 2048) == 1 then
|
||||
entity_name = "market"
|
||||
end
|
||||
|
||||
@ -534,6 +531,46 @@ local function on_research_finished(event)
|
||||
game.forces.player.recipes["flamethrower-turret"].enabled = false
|
||||
end
|
||||
|
||||
local function break_some_random_trees(surface)
|
||||
local trees = {}
|
||||
local chunks = {}
|
||||
|
||||
for chunk in surface.get_chunks() do
|
||||
table.insert(chunks, {x = chunk.x, y = chunk.y})
|
||||
end
|
||||
chunks = shuffle(chunks)
|
||||
|
||||
for _, chunk in pairs(chunks) do
|
||||
local area = {{chunk.x * 32, chunk.y * 32}, {chunk.x * 32 + 32, chunk.y * 32 + 32}}
|
||||
trees = surface.find_entities_filtered({type = "tree", area = area})
|
||||
if #trees > 1 then break end
|
||||
end
|
||||
if #trees == 0 then return end
|
||||
trees = shuffle(trees)
|
||||
for i = 1, math_random(4, 8), 1 do
|
||||
if not trees[i] then break end
|
||||
trees[i].die("enemy")
|
||||
end
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
if game.tick % 9000 ~= 0 then return end
|
||||
if math_random(1, 2) ~= 1 then return end
|
||||
|
||||
local surface = game.surfaces["spooky_forest"]
|
||||
|
||||
break_some_random_trees(surface)
|
||||
|
||||
local biters = surface.find_entities_filtered({type = "unit", force = "enemy", limit = 24})
|
||||
if biters[1] then
|
||||
biters = shuffle(biters)
|
||||
for _, biter in pairs(biters) do
|
||||
biter.set_command({type = defines.command.attack_area, destination = {x = 0, y = 0}, radius = 64, distraction = defines.distraction.by_anything})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_tick, on_tick)
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
|
@ -1,3 +1,7 @@
|
||||
0.07
|
||||
added randomly breaking trees
|
||||
added randomly attacking biters
|
||||
|
||||
0.06
|
||||
added markets
|
||||
added hunger and respawning fish
|
||||
|
Loading…
x
Reference in New Issue
Block a user