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
addhook("usebutton","barbiredwire")
function barbiredwire(id,x,y)
if entity(x,y,"name")=="barb" then
		for _,p in ipairs(object(0,"table")) do
			if object(p,"tilex") == x and object(p,"tiley") == y then
				parse("killobject "..p)
			end
		end
		parse("spawnobject 2 "..x.." "..y)
	end
end
addhook("movetile","Barbed_knockBack")
function Barbed_knockBack(id,x,y)
	local state = true
	for _,p in ipairs(object(0,"table")) do
		if object(p,"tilex") == x and object(p,"tiley") == y and object(p,"typename") == "Barbed Wire" then
			parse("setpos "..id.." "..((KnockBackPos[id][1]*32)+16).." "..((KnockBackPos[id][2]*32)+16))
			state = false
		end
	end	
	if state then
		KnockBackPos[id] = {x,y}
	end
end