Page 1 of 1

[Done] Removing Decal

Posted: Mon Jul 01, 2019 9:46 pm
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,

Re: Removing Decal

Posted: Mon Jul 01, 2019 10:06 pm
by Bilka

Re: Removing Decal

Posted: Mon Jul 01, 2019 10:33 pm
by TheSAguy
Got it,
Thanks.