razorgrass autoplace settings

This commit is contained in:
Brevven 2025-01-04 04:30:16 -08:00
parent 1f3258abd1
commit 51767552e5
3 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,23 @@
local util = require("control-util")
util.add_regenerate_command_handler()
script.on_configuration_changed(plant_fix)
function plant_fix()
if not script.active_mods["space-age"] then return end
local surface_name = "gleba"
for _, resource in pairs(me.resources) do
local map_gen_settings = game.surfaces[surface_name].map_gen_settings
if map_gen_settings.autoplace_controls[resource] == nil then
map_gen_settings.autoplace_controls[resource] = {}
end
if map_gen_settings.autoplace_settings.entity.settings[resource] == nil then
map_gen_settings.autoplace_settings.entity.settings[resource] = {}
end
game.surfaces[surface_name].map_gen_settings = map_gen_settings
end
end
script.on_event( defines.events.on_console_chat, function(event)
-- refresh recipes, in case of settings change
if event.message and event.message == "SiliconRecipes" and (not event.player_index or not game.players[event.player_index] or game.players[event.player_index].admin) then

3
me.lua
View file

@ -1,6 +1,7 @@
local me = {}
me.name = "bzsilicon"
me.silicon_processing = mods["Krastorio2"] and "kr-silicon-processing" or "silicon-processing"
me.resources = {"razorgrass"}
me.silicon_processing = (mods and mods["Krastorio2"] and "kr-silicon-processing") or "silicon-processing"
me.recipes = {"silica", "silicon", "optical-fiber", "silicon-wafer", "solar-cell", "gyro", "silicon-smelting-vulcanite"}
function me.use_gyros()

View file

@ -3,6 +3,7 @@ local util = require("data-util")
if mods["space-age"] then
data.raw.planet.gleba.map_gen_settings.autoplace_settings.entity.settings["razorgrass"] = {}
local space_age_item_sounds = require("__space-age__.prototypes.item_sounds")
local function razorgrass_variations()
local variation_count = 8 --variation_count or 5