Skip to content

Commit

Permalink
Push custom scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Nov 14, 2024
1 parent 7e92382 commit 25cd919
Show file tree
Hide file tree
Showing 3 changed files with 547 additions and 3 deletions.
14 changes: 12 additions & 2 deletions modules/ores_are_mixed.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local Event = require 'utils.event'
local simplex_noise = require 'utils.math.simplex_noise'.d2
local Public = {}
local ore_raffle = {
'iron-ore',
'iron-ore',
Expand All @@ -10,9 +11,16 @@ local ore_raffle = {
'stone'
}

Public.settings = {
mixed_ores_on_nauvis_only = false
}

local function on_chunk_generated(event)
local surface = event.surface
local ores = surface.find_entities_filtered({area = event.area, name = {'iron-ore', 'copper-ore', 'coal', 'stone'}})
if Public.settings.mixed_ores_on_nauvis_only and surface.name ~= 'nauvis' then
return
end
local ores = surface.find_entities_filtered({ area = event.area, name = { 'iron-ore', 'copper-ore', 'coal', 'stone' } })
if #ores == 0 then
return
end
Expand All @@ -24,9 +32,11 @@ local function on_chunk_generated(event)
simplex_noise(pos.x * 0.005, pos.y * 0.005, seed) + simplex_noise(pos.x * 0.01, pos.y * 0.01, seed) * 0.3 + simplex_noise(pos.x * 0.05, pos.y * 0.05, seed) * 0.2

local i = (math.floor(noise * 100) % 7) + 1
surface.create_entity({name = ore_raffle[i], position = ore.position, amount = ore.amount})
surface.create_entity({ name = ore_raffle[i], position = ore.position, amount = ore.amount })
ore.destroy()
end
end

Event.add(defines.events.on_chunk_generated, on_chunk_generated)

return Public
2 changes: 1 addition & 1 deletion utils/start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local bp =
'0eNqlm91O20AUhN9lrx2UM7b3J69SocrAUiwlTuQYKEV59yYEF1RXqWe4QiE7Xud82fXq08mru1k/5l3fdoNbvbr2dtvt3erbq9u3P7pmffrf8LLLbuXaIW9c4bpmc3q1bze7dV7kbmiHl8VzOzwsts9d7t2hcG13l3+6lR2uC/c2oM3na55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3viOtyT1uKetB73OWrpujj/gmX16QcvhXvK/f7tQohWhYQQfVqWy+pw+A3SPoD5'

function Public.blueprint(surface)
local position = { x = 0, y = 0 }
local position = { x = 0, y = 5 }
if not surface or not surface.valid then
return
end
Expand Down
Loading

0 comments on commit 25cd919

Please sign in to comment.