1
2
3
4
5
6
addhook("objectupgrade","stopupgrade")
function stopupgrade(oid)
if object(oid,"type") == 1 then
return 1
end
end
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
37
38
39
barricades = {}
addhook("startround","initbars")
function initbars()
barricades = {}
for _, o in pairs(object(0,"table")) do
if object(o,"type") == 1 then
table.insert(barricades,o)
end
end
end
addhook("build","addtobars")
function addtobars(pid,btype,x,y,mode,oid)
if btype == 1 then
table.insert(barricades,oid)
end
end
addhook("objectkill","removefrombars")
function removefrombars(oid)
for a, b in ipairs(barricades) do
if b == oid then
table.remove(barricades,a)
break
end
end
end
addhook("objectupgrade","stopupgrade")
function stopupgrade(oid)
for _, o in ipairs(barricades) do
if o == oid then
return 1
end
end
end
Could argue this is more of a performance hit due to the 3 iterations being done especially during the upgrade attempt.