hedgewars/uScript.pas
changeset 14484 764ba6182389
parent 14479 4e5280a9e782
child 14522 d0441c7e9000
equal deleted inserted replaced
14483:310b167141cc 14484:764ba6182389
  2288             // Specify color directly
  2288             // Specify color directly
  2289             colorStr:= IntToStr(colorArg)
  2289             colorStr:= IntToStr(colorArg)
  2290         else
  2290         else
  2291             begin
  2291             begin
  2292             OutError('Lua error: AddTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
  2292             OutError('Lua error: AddTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
  2293             lc_addteam:= 0;
  2293             lua_pushnil(L);
       
  2294             lua_pushnil(L);
       
  2295             lc_addteam:= 2;
  2294             exit;
  2296             exit;
  2295             end;
  2297             end;
  2296         ParseCommand('addteam x ' + colorStr + ' ' + lua_tostring(L, 1), true, true);
  2298         ParseCommand('addteam x ' + colorStr + ' ' + lua_tostring(L, 1), true, true);
  2297         ParseCommand('grave ' + lua_tostring(L, 3), true, true);
  2299         ParseCommand('grave ' + lua_tostring(L, 3), true, true);
  2298         ParseCommand('fort ' + lua_tostring(L, 4), true, true);
  2300         ParseCommand('fort ' + lua_tostring(L, 4), true, true);
  2299         ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
  2301         ParseCommand('voicepack ' + lua_tostring(L, 5), true, true);
  2300         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
  2302         if (np = 6) then ParseCommand('flag ' + lua_tostring(L, 6), true, true);
  2301         CurrentTeam^.Binds:= DefaultBinds;
  2303         CurrentTeam^.Binds:= DefaultBinds;
  2302         // push team index
  2304         // push team name and index
       
  2305         lua_pushstring(L, str2pchar(CurrentTeam^.TeamName));
  2303         lua_pushnumber(L, TeamsCount - 1);
  2306         lua_pushnumber(L, TeamsCount - 1);
  2304         end
  2307         end
  2305     else
  2308     else
       
  2309         begin
  2306         lua_pushnil(L);
  2310         lua_pushnil(L);
  2307     lc_addteam:= 1;
  2311         lua_pushnil(L);
       
  2312         end;
       
  2313     lc_addteam:= 2;
  2308 end;
  2314 end;
  2309 
  2315 
  2310 function lc_addmissionteam(L : Plua_State) : LongInt; Cdecl;
  2316 function lc_addmissionteam(L : Plua_State) : LongInt; Cdecl;
  2311 var colorArg: Int64;
  2317 var colorArg: Int64;
  2312     colorStr: shortstring;
  2318     colorStr: shortstring;
  2328             // Specify color directly
  2334             // Specify color directly
  2329             colorStr:= IntToStr(colorArg)
  2335             colorStr:= IntToStr(colorArg)
  2330         else
  2336         else
  2331             begin
  2337             begin
  2332             OutError('Lua error: AddMissionTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
  2338             OutError('Lua error: AddMissionTeam: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true);
  2333             lc_addmissionteam:= 0;
  2339             lua_pushnil(L);
       
  2340             lua_pushnil(L);
       
  2341             lc_addmissionteam:= 2;
  2334             exit;
  2342             exit;
  2335             end;
  2343             end;
  2336 
  2344 
  2337         ParseCommand('addteam x ' + colorStr + ' ' + MissionTeam^.TeamName, true, true);
  2345         ParseCommand('addteam x ' + colorStr + ' ' + MissionTeam^.TeamName, true, true);
  2338         ParseCommand('grave ' + MissionTeam^.GraveName, true, true);
  2346         ParseCommand('grave ' + MissionTeam^.GraveName, true, true);
  2339         ParseCommand('fort ' + MissionTeam^.FortName, true, true);
  2347         ParseCommand('fort ' + MissionTeam^.FortName, true, true);
  2340         ParseCommand('voicepack ' + MissionTeam^.Voicepack^.name, true, true);
  2348         ParseCommand('voicepack ' + MissionTeam^.Voicepack^.name, true, true);
  2341         ParseCommand('flag ' + MissionTeam^.Flag, true, true);
  2349         ParseCommand('flag ' + MissionTeam^.Flag, true, true);
  2342         CurrentTeam^.Binds:= DefaultBinds;
  2350         CurrentTeam^.Binds:= DefaultBinds;
  2343         // push team index
  2351         // push real team name and team index
       
  2352         lua_pushstring(L, str2pchar(CurrentTeam^.TeamName));
  2344         lua_pushnumber(L, TeamsCount - 1);
  2353         lua_pushnumber(L, TeamsCount - 1);
  2345         end
  2354         end
  2346     else
  2355     else
       
  2356         begin
  2347         lua_pushnil(L);
  2357         lua_pushnil(L);
  2348     lc_addmissionteam:= 1;
  2358         lua_pushnil(L);
       
  2359         end;
       
  2360     lc_addmissionteam:= 2;
  2349 end;
  2361 end;
  2350 
  2362 
  2351 function lc_setteamlabel(L : Plua_State) : LongInt; Cdecl;
  2363 function lc_setteamlabel(L : Plua_State) : LongInt; Cdecl;
  2352 var teamValue: ansistring;
  2364 var teamValue: ansistring;
  2353     i, n: LongInt;
  2365     i, n: LongInt;