[Done] Removing Decal

Place to get help with not working mods / modding interface.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

[Done] Removing Decal

Post by TheSAguy »

Hi,

I'm trying to remove decal when I change the terrain.
I'm running the below, but not getting any count. Can anyone see what I'm doing wrong.

Code: Select all


---------------------------------------------				 
local function Remove_Decal(surface, pos)

		game.print("Decal Script running")
		local radius = 2.5
		local area = {{pos.x - radius, pos.y - radius}, {pos.x + radius, pos.y + radius}}			
		local decals = surface.find_entities_filtered({area = area, type = "optimized-decorative"})
		game.print(#decals) -- Always 0
		if (#decals > 0) then 
				game.print("Decal Found")
			for i,decal in pairs(decals) do
				if decal and decal.valid then
					decal.destroy()
				end
			end
			
		end
			
end

Thanks,
Last edited by TheSAguy on Mon Jul 01, 2019 10:33 pm, edited 1 time in total.

Bilka
Factorio Staff
Factorio Staff
Posts: 3128
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Removing Decal

Post by Bilka »

I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Removing Decal

Post by TheSAguy »

Got it,
Thanks.

Post Reply

Return to “Modding help”