hedgewars/uScript.pas
changeset 4516 ecf012a762d8
parent 4502 759c1a3bb156
child 4517 0618b31023dc
equal deleted inserted replaced
4515:9b30be246742 4516:ecf012a762d8
   490         end;
   490         end;
   491     lc_gethogclan:= 1
   491     lc_gethogclan:= 1
   492 end;
   492 end;
   493 
   493 
   494 function lc_getclancolor(L : Plua_State) : LongInt; Cdecl;
   494 function lc_getclancolor(L : Plua_State) : LongInt; Cdecl;
   495 var gear : PGear;
       
   496 begin
   495 begin
   497     if lua_gettop(L) <> 1 then
   496     if lua_gettop(L) <> 1 then
   498         begin
   497         begin
   499         LuaError('Lua: Wrong number of parameters passed to GetClanColor!');
   498         LuaError('Lua: Wrong number of parameters passed to GetClanColor!');
   500         lua_pushnil(L); // return value on stack (nil)
   499         lua_pushnil(L); // return value on stack (nil)
   848         end;
   847         end;
   849     lc_findplace:= 0
   848     lc_findplace:= 0
   850 end;
   849 end;
   851 
   850 
   852 function lc_playsound(L : Plua_State) : LongInt; Cdecl;
   851 function lc_playsound(L : Plua_State) : LongInt; Cdecl;
   853 begin
   852 var gear: PGear;
   854     if lua_gettop(L) <> 1 then
   853 begin
   855         LuaError('Lua: Wrong number of parameters passed to PlaySound!')
   854     if lua_gettop(L) = 1 then
   856     else
   855         PlaySound(TSound(lua_tointeger(L, 1)))
   857         PlaySound(TSound(lua_tointeger(L, 1)));
   856     else if lua_gettop(L) = 2 then
       
   857         begin
       
   858         gear:= GearByUID(lua_tointeger(L, 2));
       
   859         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
       
   860             PlaySound(TSound(lua_tointeger(L, 1)),gear^.Hedgehog^.Team^.Voicepack)
       
   861         end
       
   862     else LuaError('Lua: Wrong number of parameters passed to PlaySound!');
   858     lc_playsound:= 0;
   863     lc_playsound:= 0;
   859 end;
   864 end;
   860 
   865 
   861 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
   866 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
   862 begin
   867 begin