m!m's team:getColor() function for scripting.

This commit is contained in:
The_E committed 2010-10-15 19:45:02 +00:00
1 parent 85c4032ef7
commit b352e39494
1 file changed
+18
+18
View File
@@ -2832,6 +2832,24 @@ ADE_VIRTVAR(Name, l_Team, "string", "Team name", "string", "Team name, or empty
return ade_set_args(L, "s", Iff_info[tdx].iff_name);
}
ADE_FUNC(getColor, l_Team, NULL, "Gets the IFF color of the specified Team", "number, number, number", "rgb color for the specified team or nil if invalid") {
int idx;
int r,g,b;
if(!ade_get_args(L, "o", l_Team.Get(&idx)))
return ADE_RETURN_NIL;
if(idx < 0 || idx >= Num_iffs)
return ADE_RETURN_NIL;
color* col = iff_get_color_by_team(idx, 0, 0);
r = col->red;
g = col->green;
b = col->blue;
return ade_set_args(L, "iii", r, g, b);
}
ADE_FUNC(isValid, l_Team, NULL, "Detects whether handle is valid", "boolean", "true if valid, false if handle is invalid, nil if a syntax/type error occurs")
{
int idx;