loadGameMode method
Implementation
Future<SetonixPlugin?> loadGameMode(
AssetManager assetManager,
ItemLocation? location,
) async {
if (location == null) return null;
final gameMode = assetManager
.getPack(location.namespace)
?.getMode(location.id);
if (gameMode == null) return null;
final script = gameMode.script;
if (script == null || script.isEmpty) return null;
final scriptLocation = ItemLocation.fromString(script, location.namespace);
try {
return await loadLuaPluginFromLocation(assetManager, scriptLocation);
} catch (error, stackTrace) {
Error.throwWithStackTrace(
Exception(
'Error loading game mode "$location" from script "$scriptLocation": $error',
),
stackTrace,
);
}
}