MCPcopy
hub / github.com/4ian/GDevelop / validateVolumeParameter

Function validateVolumeParameter

GDevelop.js/__tests__/Core.js:2623–2643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2621 });
2622
2623 const validateVolumeParameter = value => {
2624 // `PlaySoundOnChannel` has an optional "expression" parameter (Volume,
2625 // PARAM4) defaulting to "100".
2626 const action = new gd.Instruction();
2627 action.setType('PlaySoundOnChannel');
2628 action.setParametersCount(6);
2629 action.setParameter(4, value);
2630 const result = gd.InstructionValidator.validateParameter(
2631 gd.JsPlatform.get(),
2632 projectScopedContainers,
2633 action,
2634 gd.MetadataProvider.getActionMetadata(
2635 gd.JsPlatform.get(),
2636 'PlaySoundOnChannel'
2637 ),
2638 4
2639 );
2640 const isValid = result.isValid();
2641 action.delete();
2642 return isValid;
2643 };
2644
2645 it('considers an optional parameter left empty as valid', function () {
2646 // The default value is used when generating the code, so it must not be

Callers 1

Core.jsFile · 0.85

Calls 3

setTypeMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected