-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.lua
64 lines (49 loc) · 1.33 KB
/
utils.lua
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
AllPlayers = {};
level:onnotify("connected", function (player)
table.insert(AllPlayers, player);
player:onnotifyonce("disconnect", function ()
for i, p in ipairs(AllPlayers) do
if p == player then
table.remove(AllPlayers, i);
break;
end
end
end)
end);
local curObjectID = 32;
function CreateWaypoint(origin, icon, team)
curObjectID = curObjectID - 1;
game:objectivestate(curObjectID, "active");
game:objectiveposition(curObjectID, origin)
game:objectiveicon(curObjectID, icon)
if team ~= nil then
game:objectiveteam(curObjectID, team);
end
local hud = nil;
if team ~= nil then
hud = game:newteamhudelem(team);
else
hud = game:newhudelem();
end
hud.x = origin.x;
hud.y = origin.y;
hud.z = origin.z;
hud.alpha = 0.85;
hud.archived = 1;
hud:setmaterial(icon, 15, 15);
hud:setwaypoint(true);
return { curObjectID, hud };
end
function CreateTrigger(origin, radius, height)
local trigger = game:spawn("trigger_radius", origin, 0, radius, height);
return trigger;
end
function ParseVector(obj)
return vector:new(obj.x, obj.y, obj.z);
end
function GetOtherTeam(team)
if team == "allies" then
return "axis";
end
return "allies";
end