# HG changeset patch # User nemo # Date 1292215973 18000 # Node ID ecf012a762d8e73b4993ae1b0c4116db237c1b23 # Parent 9b30be24674222c0cf2dc38604ac0546d8357deb add PlaySound(soundType, hogGearUID) -- this roundabout way to reference a team seems to be how things are done in lua right now. might need changing in future diff -r 9b30be246742 -r ecf012a762d8 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Mon Dec 13 04:53:48 2010 +0100 +++ b/hedgewars/uScript.pas Sun Dec 12 23:52:53 2010 -0500 @@ -492,7 +492,6 @@ end; function lc_getclancolor(L : Plua_State) : LongInt; Cdecl; -var gear : PGear; begin if lua_gettop(L) <> 1 then begin @@ -850,11 +849,17 @@ end; function lc_playsound(L : Plua_State) : LongInt; Cdecl; +var gear: PGear; begin - if lua_gettop(L) <> 1 then - LuaError('Lua: Wrong number of parameters passed to PlaySound!') - else - PlaySound(TSound(lua_tointeger(L, 1))); + if lua_gettop(L) = 1 then + PlaySound(TSound(lua_tointeger(L, 1))) + else if lua_gettop(L) = 2 then + begin + gear:= GearByUID(lua_tointeger(L, 2)); + if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then + PlaySound(TSound(lua_tointeger(L, 1)),gear^.Hedgehog^.Team^.Voicepack) + end + else LuaError('Lua: Wrong number of parameters passed to PlaySound!'); lc_playsound:= 0; end;