1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
addhook("hit","_hit")
function _hit(id,source)
	if id~=0 and source~=0 then
		local walls={}
		for x=-1,1 do
			for y=-1,1 do
				local x2=player(id,"tilex")+x
				local y2=player(id,"tiley")+y
				if tile(x2,y2,"walkable") and entity(x2,y2,"exists")==false then
					table.insert(walls,{x2,y2})
					parse("spawnobject 5 "..x2.." "..y2.." 0 0 0 0")
				end
			end
		end
		for _,wall in pairs(walls) do
			local wall=objectpos(wall[1],wall[2],"id")
			if wall~=false then
				timer(0,"parse","killobject "..wall)
			end
		end
	end
end
function objectpos(x,y,value)
	for _,obj in pairs(object(0,"table")) do
		if object(obj,"tilex")==x and object(obj,"tiley")==y then
			if string.lower(value)=="id" then
				return obj
			else
				return object(obj,value)
			end
		end
	end
	return false
end