equal
deleted
inserted
replaced
2046 end; |
2046 end; |
2047 |
2047 |
2048 function lc_playsound(L : Plua_State) : LongInt; Cdecl; |
2048 function lc_playsound(L : Plua_State) : LongInt; Cdecl; |
2049 var gear: PGear; |
2049 var gear: PGear; |
2050 n, s: LongInt; |
2050 n, s: LongInt; |
|
2051 instaVoice: boolean; |
2051 const |
2052 const |
2052 call = 'PlaySound'; |
2053 call = 'PlaySound'; |
2053 params = 'soundId [, hhGearUid]'; |
2054 params = 'soundId [, hhGearUid [, instaVoice]]'; |
2054 begin |
2055 begin |
2055 if CheckAndFetchParamCount(L, 1, 2, call, params, n) then |
2056 if CheckAndFetchParamCountRange(L, 1, 3, call, params, n) then |
2056 begin |
2057 begin |
2057 s:= LuaToSoundOrd(L, 1, call, params); |
2058 s:= LuaToSoundOrd(L, 1, call, params); |
2058 if s >= 0 then |
2059 if s >= 0 then |
2059 begin |
2060 begin |
2060 // no gear specified |
2061 // no gear specified |
2062 PlaySound(TSound(s), false, true) |
2063 PlaySound(TSound(s), false, true) |
2063 else |
2064 else |
2064 begin |
2065 begin |
2065 gear:= GearByUID(Trunc(lua_tonumber(L, 2))); |
2066 gear:= GearByUID(Trunc(lua_tonumber(L, 2))); |
2066 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
2067 if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then |
2067 AddVoice(TSound(s), gear^.Hedgehog^.Team^.Voicepack, true) |
2068 begin |
|
2069 instaVoice:= false; |
|
2070 if n = 3 then |
|
2071 instaVoice:= lua_toboolean(L, 3); |
|
2072 if instaVoice then |
|
2073 PlaySoundV(TSound(s), gear^.Hedgehog^.Team^.Voicepack, false, true) |
|
2074 else |
|
2075 AddVoice(TSound(s), gear^.Hedgehog^.Team^.Voicepack, true); |
|
2076 end; |
2068 end; |
2077 end; |
2069 end; |
2078 end; |
2070 end; |
2079 end; |
2071 lc_playsound:= 0; |
2080 lc_playsound:= 0; |
2072 end; |
2081 end; |