Page 1 of 1

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

Posted: Thu Dec 03, 2020 2:02 pm
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.

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

Posted: Thu Dec 03, 2020 2:10 pm
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.

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

Posted: Fri Dec 04, 2020 3:21 am
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.

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

Posted: Fri Dec 04, 2020 4:46 am
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.

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

Posted: Fri Dec 04, 2020 6:53 am
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.

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

Posted: Fri Dec 04, 2020 9:51 am
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,
      }
    }

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

Posted: Fri Dec 04, 2020 1:19 pm
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?