trying to spawn custom tile on new surface

Place to get help with not working mods / modding interface.
Post Reply
kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

trying to spawn custom tile on new surface

Post by kingarthur »

i made a new tile by copying grass-4 from the base mod and changing name and image to be different. also created a autoplace control for the tile. im attempting to spawn a new surface that has only my custom tile on it but when i teleport to that surface its covered by water with no land at all.

surface creation code in control.lua

Code: Select all

script.on_event(defines.events.on_built_entity, function(event)

local entity = event.created_entity
local surface = game.surfaces

if entity.name == "rocket-silo" then
	if game.surfaces["Space"] == nil then
		surface = game.create_surface("Space", 
		{
		terrain_segmentation = "normal",
		water = "none",
		starting_area = "normal",
		default_enable_all_autoplace_controls = false,
		autoplace_controls =
		{
			["moon-grass-4"] = 
				{
				frequency = "very-high",
				size = "very-high",
				richness = "very-high"
				}
		},
		seed = null
		})
		surface.daytime = 0
	end
end
end)
code from tile.lua that i belive should be a new tile

Code: Select all

data:extend(
{
	{
	name = "moon-grass-4",
	type = "tile",
    collision_mask = {"ground-tile"},
    --autoplace = autoplace_settings("grass-4", "grass", {{0, 0.55}, {0.55, 0.8}}),
    layer = 29,
    variants = tile_variations_template(
      "__SpaceFinalFrontier__/graphics/tiles/moon-grass-4.png", "__base__/graphics/terrain/masks/transition-3.png",
      "__SpaceFinalFrontier__/graphics/tiles/hr-moon-grass-4.png", "__base__/graphics/terrain/masks/hr-transition-3.png",
      {
        max_size = 4,
        [1] = { weights = {0.085, 0.085, 0.085, 0.085, 0.087, 0.085, 0.065, 0.085, 0.045, 0.045, 0.045, 0.045, 0.005, 0.025, 0.045, 0.045 } },
        [2] = { probability = 1, weights = {0.018, 0.020, 0.015, 0.025, 0.015, 0.020, 0.025, 0.015, 0.025, 0.025, 0.010, 0.025, 0.020, 0.025, 0.025, 0.010 }, },
        [4] = { probability = 0.5, weights = {0.018, 0.020, 0.015, 0.025, 0.015, 0.020, 0.025, 0.015, 0.025, 0.025, 0.010, 0.025, 0.020, 0.025, 0.025, 0.010 }, },
        --[8] = { probability = 1.00, weights = {0.090, 0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.025, 0.125, 0.005, 0.010, 0.100, 0.100, 0.010, 0.020, 0.020} },
      }
    ),

    transitions = grass_transitions,
    transitions_between_transitions = grass_transitions_between_transitions,

    walking_sound =
    {
      {
        filename = "__base__/sound/walking/grass-01.ogg",
        volume = 0.8
      },
      {
        filename = "__base__/sound/walking/grass-02.ogg",
        volume = 0.8
      },
      {
        filename = "__base__/sound/walking/grass-03.ogg",
        volume = 0.8
      },
      {
        filename = "__base__/sound/walking/grass-04.ogg",
        volume = 0.8
      }
    },
    map_color={r=54, g=47, b=35},
    ageing=0.0004,
    vehicle_friction_modifier = grass_vehicle_speed_modifier
  },
  
  {
    type = "autoplace-control",
    name = "moon-grass-4",
    order = "c-a",
    category = "terrain",
  },
  
}
)

Post Reply

Return to “Modding help”