hedgewars/uScript.pas
changeset 13121 de07c8423beb
parent 13088 2b5314cc356c
child 13122 d52d79f35558
equal deleted inserted replaced
13120:be5d9fd2c56a 13121:de07c8423beb
  2057         s:= LuaToSoundOrd(L, 1, call, params);
  2057         s:= LuaToSoundOrd(L, 1, call, params);
  2058         if s >= 0 then
  2058         if s >= 0 then
  2059             begin
  2059             begin
  2060             // no gear specified
  2060             // no gear specified
  2061             if n = 1 then
  2061             if n = 1 then
  2062                 PlaySound(TSound(s))
  2062                 PlaySound(TSound(s), false, true)
  2063             else
  2063             else
  2064                 begin
  2064                 begin
  2065                 gear:= GearByUID(Trunc(lua_tonumber(L, 2)));
  2065                 gear:= GearByUID(Trunc(lua_tonumber(L, 2)));
  2066                 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
  2066                 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
  2067                     AddVoice(TSound(s),gear^.Hedgehog^.Team^.Voicepack)
  2067                     AddVoice(TSound(s), gear^.Hedgehog^.Team^.Voicepack, true)
  2068                 end;
  2068                 end;
  2069             end;
  2069             end;
  2070         end;
  2070         end;
  2071     lc_playsound:= 0;
  2071     lc_playsound:= 0;
       
  2072 end;
       
  2073 
       
  2074 function lc_setsoundmask(L : Plua_State) : LongInt; Cdecl;
       
  2075 var s: LongInt;
       
  2076     soundState: boolean;
       
  2077 const
       
  2078     call = 'SetSoundMasked';
       
  2079     params = 'soundId, isMasked]';
       
  2080 begin
       
  2081     if CheckLuaParamCount(L, 2, call, params) then
       
  2082         begin
       
  2083         s:= LuaToSoundOrd(L, 1, call, params);
       
  2084         if s <> Ord(sndNone) then
       
  2085             begin
       
  2086             soundState:= lua_toboolean(L, 2);
       
  2087             MaskedSounds[TSound(s)]:= soundState;
       
  2088             end;
       
  2089         end;
       
  2090     lc_setsoundmask:= 0;
  2072 end;
  2091 end;
  2073 
  2092 
  2074 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
  2093 function lc_addteam(L : Plua_State) : LongInt; Cdecl;
  2075 var np: LongInt;
  2094 var np: LongInt;
  2076 begin
  2095 begin
  3783 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix);
  3802 lua_register(luaState, _P'SetAmmoDescriptionAppendix', @lc_setammodescriptionappendix);
  3784 lua_register(luaState, _P'AddCaption', @lc_addcaption);
  3803 lua_register(luaState, _P'AddCaption', @lc_addcaption);
  3785 lua_register(luaState, _P'SetAmmo', @lc_setammo);
  3804 lua_register(luaState, _P'SetAmmo', @lc_setammo);
  3786 lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay);
  3805 lua_register(luaState, _P'SetAmmoDelay', @lc_setammodelay);
  3787 lua_register(luaState, _P'PlaySound', @lc_playsound);
  3806 lua_register(luaState, _P'PlaySound', @lc_playsound);
       
  3807 lua_register(luaState, _P'SetSoundMask', @lc_setsoundmask);
  3788 lua_register(luaState, _P'GetTeamName', @lc_getteamname);
  3808 lua_register(luaState, _P'GetTeamName', @lc_getteamname);
  3789 lua_register(luaState, _P'GetTeamIndex', @lc_getteamindex);
  3809 lua_register(luaState, _P'GetTeamIndex', @lc_getteamindex);
  3790 lua_register(luaState, _P'GetTeamClan', @lc_getteamclan);
  3810 lua_register(luaState, _P'GetTeamClan', @lc_getteamclan);
  3791 lua_register(luaState, _P'AddTeam', @lc_addteam);
  3811 lua_register(luaState, _P'AddTeam', @lc_addteam);
  3792 lua_register(luaState, _P'SetTeamLabel', @lc_setteamlabel);
  3812 lua_register(luaState, _P'SetTeamLabel', @lc_setteamlabel);