terrain is acting weard

Place to get help with not working mods / modding interface.
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

terrain is acting weard

Post by mophydeen »

might be a bug.

Placing 2 square blocks of water next to each other is impossible. The terrain reforms in a strange way.
Screenshot from 2017-04-09 18-24-10.png
Screenshot from 2017-04-09 18-24-10.png (1.01 MiB) Viewed 1266 times
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: terrain is acting weard

Post by mophydeen »

Code: Select all



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

	-- only when square size is 1x1
	if #event.positions == 1 then
		
		local x = event.positions[1].x
		local y = event.positions[1].y


		local dig_positions2 = {}
		table.insert(dig_positions2, {name = "water", position = {x+1.5, y+1.5}})
		table.insert(dig_positions2, {name = "water", position = {x+1.5, y-1.5}})
		table.insert(dig_positions2, {name = "water", position = {x-1.5, y+1.5}})
		table.insert(dig_positions2, {name = "water", position = {x-1.5, y-1.5}})
		table.insert(dig_positions2, {name = "water", position = {x+1.5, y+0.5}})
		table.insert(dig_positions2, {name = "water", position = {x+1.5, y-0.5}})
		table.insert(dig_positions2, {name = "water", position = {x+0.5, y+1.5}})
		table.insert(dig_positions2, {name = "water", position = {x+0.5, y-1.5}})
		table.insert(dig_positions2, {name = "water", position = {x-0.5, y+1.5}})
		table.insert(dig_positions2, {name = "water", position = {x-0.5, y-1.5}})
		table.insert(dig_positions2, {name = "water", position = {x-1.5, y+0.5}})
		table.insert(dig_positions2, {name = "water", position = {x-1.5, y-0.5}})
		table.insert(dig_positions2, {name = "water", position = {x+1.5, y  }})
		table.insert(dig_positions2, {name = "water", position = {x-1.5, y  }})
		table.insert(dig_positions2, {name = "water", position = {x  , y+1.5}})
		table.insert(dig_positions2, {name = "water", position = {x  , y-1.5}})
		table.insert(dig_positions2, {name = "water", position = {x+0.5, y+0.5}})
		table.insert(dig_positions2, {name = "water", position = {x+0.5, y-0.5}})
		table.insert(dig_positions2, {name = "water", position = {x-0.5, y+0.5}})
		table.insert(dig_positions2, {name = "water", position = {x-0.5, y-0.5}})
		table.insert(dig_positions2, {name = "water", position = {x  , y+0.5}})
		table.insert(dig_positions2, {name = "water", position = {x+0.5, y  }})
		table.insert(dig_positions2, {name = "water", position = {x  , y-0.5}})
		table.insert(dig_positions2, {name = "water", position = {x-0.5, y  }})
		table.insert(dig_positions2, {name = "water", position = {x  , y  }})

		-- increase the size to a 5x5
		local dig_positions = {}
		table.insert(dig_positions, {name = "water", position = {x+2, y+2}})
		table.insert(dig_positions, {name = "water", position = {x+2, y-2}})
		table.insert(dig_positions, {name = "water", position = {x-2, y+2}})
		table.insert(dig_positions, {name = "water", position = {x-2, y-2}})
		table.insert(dig_positions, {name = "water", position = {x+2, y+1}})
		table.insert(dig_positions, {name = "water", position = {x+2, y-1}})
		table.insert(dig_positions, {name = "water", position = {x+1, y+2}})
		table.insert(dig_positions, {name = "water", position = {x+1, y-2}})
		table.insert(dig_positions, {name = "water", position = {x-1, y+2}})
		table.insert(dig_positions, {name = "water", position = {x-1, y-2}})
		table.insert(dig_positions, {name = "water", position = {x-2, y+1}})
		table.insert(dig_positions, {name = "water", position = {x-2, y-1}})
		table.insert(dig_positions, {name = "water", position = {x+2, y  }})
		table.insert(dig_positions, {name = "water", position = {x-2, y  }})
		table.insert(dig_positions, {name = "water", position = {x  , y+2}})
		table.insert(dig_positions, {name = "water", position = {x  , y-2}})
		table.insert(dig_positions, {name = "water", position = {x+1, y+1}})
		table.insert(dig_positions, {name = "water", position = {x+1, y-1}})
		table.insert(dig_positions, {name = "water", position = {x-1, y+1}})
		table.insert(dig_positions, {name = "water", position = {x-1, y-1}})
		table.insert(dig_positions, {name = "water", position = {x  , y+1}})
		table.insert(dig_positions, {name = "water", position = {x+1, y  }})
		table.insert(dig_positions, {name = "water", position = {x  , y-1}})
		table.insert(dig_positions, {name = "water", position = {x-1, y  }})
		table.insert(dig_positions, {name = "water", position = {x  , y  }})




		for index, record in pairs(dig_positions) do
		   	if not game.surfaces[1].can_place_entity({name="steel-chest", position=record.position}) then
				return nil
			end
		end
		for index, record in pairs(dig_positions2) do
		   	if not game.surfaces[1].can_place_entity({name="steel-chest", position=record.position}) then
				return nil
			end
		end
		
		game.surfaces[1].set_tiles(dig_positions2)
		game.surfaces[1].set_tiles(dig_positions)
		game.surfaces[1].set_tiles(dig_positions2)

	   -- slSaysAll("I dug a hole @ " .. x .. " x " .. y)

	end
end)

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5432
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: terrain is acting weard

Post by Klonan »

Thats just the tile correction, set the second parameter of 'set_tiles' to false if you don't want them to correct
Post Reply

Return to “Modding help”