Plz add a way to stop map gen algo from generating stones.

Things that already exist in the current mod API
Post Reply
yagaodirac
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Jun 16, 2019 4:04 pm
Contact:

Plz add a way to stop map gen algo from generating stones.

Post by yagaodirac »

stone = {
frequency = 1,
richness = 1,
size = 0}
I still see stones around.
Could you plz add fields to stop the auto map gen from generating water and stones. It helps when making way different game mode. For now, I have to gen a new surface as empty, and remove stones and water. Or I have to copy tile information from a source while ignore all the others.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by eradicator »

The code looks like it's for stone-ore, but what you're saying sounds like you're talking about those decorative stone-rock entities.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

yagaodirac
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Jun 16, 2019 4:04 pm
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by yagaodirac »

eradicator wrote:
Thu Dec 03, 2020 2:10 pm
The code looks like it's for stone-ore, but what you're saying sounds like you're talking about those decorative stone-rock entities.
My code for now is something like

--Removing water
if event.x>-5 and event.x<5 and (-5<y<)
then surface.get_tile(...).name == "water" or "deepwater"
surface.set_tiles(set to grass-2 or something)
end
--Removing rocks.
local results = surface.find_entities_filtered{area = event.area, type = "simple-entity"}
for k,v in pairs(results)
if v.name == "rock" or big rock or any rock.
v.destroy()
end
end

I saw another way to stop rocks from being generated is in Singistics Mod. The method is inside data.lua. But water is still generated. And it affect the prototypes, so it's not very flexible. If people prefer to mix my mod with others, they would probably encounter some issue.

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by PFQNiet »

Code: Select all

for _,rock in pairs(data.raw['simple-entity']) do
  rock.autoplace = nil
end
Should remove all rocks, including those added by other mods, but when other mods are involved just be careful they don't actually use simple-entity with autoplace for stuff other than rocks.

yagaodirac
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Jun 16, 2019 4:04 pm
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by yagaodirac »

PFQNiet wrote:
Fri Dec 04, 2020 4:46 am

Code: Select all

for _,rock in pairs(data.raw['simple-entity']) do
  rock.autoplace = nil
end
Should remove all rocks, including those added by other mods, but when other mods are involved just be careful they don't actually use simple-entity with autoplace for stuff other than rocks.
Yeah, this is the reason I prefer a per-surface method. People are always inspired by tons of wired ideas and try combining different things from all corners of this planet. Any way, thank you for this idea. I'll look into it later.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by eradicator »

You need to look into MapGenSettings.

Here's some old code (not tested in 1.1) i once used to create a completely empty map preset. But if you don't need it selectable in the NewGame menu you should be able to just apply it in i.e. on_init.

Code: Select all

  local autoplace_controls = {}
  for _,control in pairs(data.raw['autoplace-control']) do
    autoplace_controls[control.name] = {
      frequency=0.01,
      richness=50,
      size=0
      }
    end
    
  local autoplace_settings = {
    ['decorative'] = {
      treat_missing_as_default = false,
      },
    ['entity'] = {
      treat_missing_as_default = false,
      },
    ['tile'] = {
      treat_missing_as_default = true,
      },
    }
    
  data.raw['map-gen-presets'].default['er:empty-map'] = {
    order = 'zzz',
    basic_settings = {
      autoplace_controls = autoplace_controls,
      -- default_enable_all_autoplace_controls = false, --prevents desert
      autoplace_settings = autoplace_settings,
      cliff_settings={
        -- cliff_elevation_0=10,
        -- cliff_elevation_interval=40,
        -- name="cliff",
        richness=0
        },
      property_expression_names={ --red desert
        ["control-setting:aux:bias"]="0.500000",
        ["control-setting:aux:frequency:multiplier"]="0.166667",
        ["control-setting:moisture:bias"]="-0.500000",
        ["control-setting:moisture:frequency:multiplier"]="0.166667"
        },
      terrain_segmentation=1,
      water=0,
      starting_area = 0,
      seed=553780354,
      }
    }
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

yagaodirac
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Jun 16, 2019 4:04 pm
Contact:

Re: Plz add a way to stop map gen algo from generating stones.

Post by yagaodirac »

eradicator wrote:
Fri Dec 04, 2020 9:51 am
Thank you. I'll look into it tomorrow.
By the way, I planned to write a Factorio tool kit. Something like get_random_point("nauvis"). And already a branch of simple prototypes like projectile prototype without graphics. Or assemblers which don't consume power.
Any idea?

Post Reply

Return to “Already exists”