mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
augments playSoundAsset
adds hooks to the garbage collector exposes an (optional) position. adds a ServerPlaySound + clientCMDPlaySound command pair to trip that for all clients
This commit is contained in:
parent
3c95fa808e
commit
a76613604a
2 changed files with 21 additions and 4 deletions
|
|
@ -38,3 +38,10 @@ function ServerPlay3D(%profile,%transform)
|
||||||
ClientGroup.getObject(%idx).play3D(%profile,%transform);
|
ClientGroup.getObject(%idx).play3D(%profile,%transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ServerPlaySound(%profile,%pos)
|
||||||
|
{
|
||||||
|
// Play the given sound profile at the given position on every client
|
||||||
|
// The sound will be transmitted as an event, not attached to any object.
|
||||||
|
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
|
||||||
|
commandToClient(ClientGroup.getObject(%idx), PlaySound, %pos);
|
||||||
|
}
|
||||||
|
|
@ -645,11 +645,21 @@ function populateAllFonts(%font)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
function playSoundAsset(%soundAssetId)
|
function clientCMDPlaySound(%soundAssetId,%pos)
|
||||||
|
{
|
||||||
|
playSoundAsset(%soundAssetId,%pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
function playSoundAsset(%soundAssetId,%pos)
|
||||||
{
|
{
|
||||||
%assetDef = AssetDatabase.acquireAsset(%soundAssetId);
|
%assetDef = AssetDatabase.acquireAsset(%soundAssetId);
|
||||||
|
%handle = 0;
|
||||||
if(isObject(%assetDef))
|
if(isObject(%assetDef))
|
||||||
%assetDef.playSound();
|
{
|
||||||
|
%handle = %assetDef.playSound(%pos);
|
||||||
AssetDatabase.releaseAsset(%soundAssetId);
|
if( isObject( ClientMissionCleanup ) )
|
||||||
|
ClientMissionCleanup.add(%handle);
|
||||||
|
}
|
||||||
|
AssetDatabase.releaseAsset(%soundAssetId);
|
||||||
|
return %handle;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue