Page 1 of 1

disable the placement of ground tiles

Posted: Sun Mar 10, 2019 7:15 am
by kingarthur
how do i disable all the land tiles from spawning in .17. in 16 i turned off autoplace and it worked but that doesnt seem to do anything anymore with the new mapgen

Code: Select all

local tiles = 
	{
	"grass-1",
	"grass-2",
	"grass-3",
	"grass-4",
	"dry-dirt",
	"dirt-1",
	"dirt-2",
	"dirt-3",
	"dirt-4",
	"dirt-5",
	"dirt-6",
	"dirt-7",
	"sand-1",
	"sand-2",
	"sand-3",
	"red-desert-0",
	"red-desert-1",
	"red-desert-2",
	"red-desert-3",
	}

for t, tile in ipairs(tiles) do

	data.raw.tile[tile].autoplace = nil
	
end

Re: disable the placement of ground tiles

Posted: Sun Mar 10, 2019 11:44 am
by orzelek
Took me a while to figure out after 0.17 update:

Code: Select all

local zeroExpression = {
    expression_id = "literal-number:1",
    literal_value = 0,
    type = "literal-number"
  }

function resetRichness(ent)
	if ent and ent.autoplace then
		ent.autoplace.richness_multiplier = null
		ent.autoplace.richness_expression = zeroExpression
		ent.autoplace.probability_expression = zeroExpression
	end
--	log(serpent.block(ent.autoplace))
end
This works for ores. You might need to check if terrain has different variables by uncommenting the log statement.

Re: disable the placement of ground tiles

Posted: Tue Mar 12, 2019 12:20 am
by kingarthur
well i got it to work. somehow. here is what i did

Code: Select all

local tiles = 
	{
	--"out-of-map",
	"grass-1",
	"grass-2",
	"grass-3",
	"grass-4",
	"dry-dirt",
	"dirt-1",
	"dirt-2",
	"dirt-3",
	"dirt-4",
	"dirt-5",
	"dirt-6",
	"dirt-7",
	"sand-1",
	"sand-2",
	"sand-3",
	"red-desert-0",
	"red-desert-1",
	"red-desert-2",
	"red-desert-3",
	
	}
	--[[
	for a, a in pairs(data.raw.tile) do
	
		log(a.name)
		
	end
]]
	data.raw.tile["landfill"].collision_mask = {}
	data.raw.tile["out-of-map"].collision_mask = {}
	
for t, tile in ipairs(tiles) do

--log(serpent.block(data.raw.tile[tile].autoplace))

	--data.raw.tile[tile].autoplace = nil
	data.raw.tile[tile] = nil
	data.raw["optimized-decorative"]["sand-dune-decal"] = nil
	--data.raw.tile[tile].autoplace = autoplace_settings(tile,"grass",{{0,0},{0,0}})
	
end
i removed the unwanted tiles completly and that replaced all land with out of map tiles. then for reasons i dont understand i removed the collision masks from the out of map tiles and it was replaced with the marsh tile. so it works and im slightly confused. :?:

Re: disable the placement of ground tiles

Posted: Thu Mar 14, 2019 3:28 am
by kingarthur
Doesnt work as intended. Marsh tiles wont let you use landfill due to ground-tile collision mask and removing that makes them get replaced with a different tile. Removing the extra tiles eventually it gives an error stating that needs at least one tile with ground-tile tag and isnt minable