Merge pull request #705 from Azaezel/alpha40/playSoundAugs

augments playSoundAsset
This commit is contained in:
Brian Roberts 2021-12-16 01:46:51 -06:00 committed by GitHub
commit f88e82c099
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View file

@ -38,3 +38,10 @@ function ServerPlay3D(%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);
}

View file

@ -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);
%handle = 0;
if(isObject(%assetDef))
%assetDef.playSound();
AssetDatabase.releaseAsset(%soundAssetId);
{
%handle = %assetDef.playSound(%pos);
if( isObject( ClientMissionCleanup ) )
ClientMissionCleanup.add(%handle);
}
AssetDatabase.releaseAsset(%soundAssetId);
return %handle;
}