0ad/binaries/data/mods/public/simulation/components/Sound.js
Ykkrosh 40688ec5df # Initial support for automatic validation of entity template XML.
Add RelaxNG schemas for all current components.
Add -dumpSchema command-line option to dump the combined entity schema.
Add a Perl script to validate entity templates against the schema.
See #413.

This was SVN commit r7452.
2010-04-09 19:02:39 +00:00

33 lines
686 B
JavaScript

function Sound() {}
Sound.prototype.Schema =
"<element name='SoundGroups'>" +
"<zeroOrMore>" +
"<element>" +
"<anyName/>" +
"<text/>" +
"</element>" +
"</zeroOrMore>" +
"</element>";
Sound.prototype.Init = function()
{
};
Sound.prototype.GetSoundGroup = function(name)
{
return this.template.SoundGroups[name] || "";
};
Sound.prototype.PlaySoundGroup = function(name)
{
if (name in this.template.SoundGroups)
{
var cmpSoundManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_SoundManager);
if (cmpSoundManager)
cmpSoundManager.PlaySoundGroup(this.template.SoundGroups[name], this.entity);
}
};
Engine.RegisterComponentType(IID_Sound, "Sound", Sound);