diff --git a/extensions/reviewed/PanelSpriteButton.json b/extensions/reviewed/PanelSpriteButton.json index d74aa8444..1788c2dca 100644 --- a/extensions/reviewed/PanelSpriteButton.json +++ b/extensions/reviewed/PanelSpriteButton.json @@ -8,7 +8,7 @@ "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "1.4.3", + "version": "1.4.4", "description": [ "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", @@ -60,8 +60,7 @@ "textG": 0, "textR": 0 }, - "comment": "The \"Validated\" state only last one frame.", - "comment2": "" + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", @@ -111,8 +110,7 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame.", - "comment2": "" + "comment": "Make sure the cursor position is only checked once per frame." }, { "type": "BuiltinCommonInstructions::Standard", @@ -176,8 +174,7 @@ "textG": 0, "textR": 0 }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter.", - "comment2": "" + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." }, { "type": "BuiltinCommonInstructions::Standard", @@ -1231,8 +1228,7 @@ "textG": 0, "textR": 0 }, - "comment": "Create one background instance for of each state.\nOnly the instance for the current state is shown.", - "comment2": "" + "comment": "Create one background instance for of each state.\nOnly the instance for the current state is shown." }, { "type": "BuiltinCommonInstructions::Standard", @@ -1312,8 +1308,7 @@ "textG": 0, "textR": 0 }, - "comment": "Place the label over the backgrounds.", - "comment2": "" + "comment": "Place the label over the backgrounds." }, { "type": "BuiltinCommonInstructions::Standard", @@ -1444,8 +1439,7 @@ "textG": 0, "textR": 0 }, - "comment": "Show the right background accordingly to the new state.", - "comment2": "" + "comment": "Show the right background accordingly to the new state." }, { "type": "BuiltinCommonInstructions::Standard", @@ -1810,8 +1804,7 @@ "textG": 0, "textR": 0 }, - "comment": "Children instances must be resized when the button size change:\n- backgrounds for each state are resized to take the full dimensions of the button\n- the label is put back at the center of the button\n\nThe scale is set back to 1 because it means that the parent instance has the same dimensions as the union of its children instances.", - "comment2": "" + "comment": "Children instances must be resized when the button size change:\n- backgrounds for each state are resized to take the full dimensions of the button\n- the label is put back at the center of the button\n\nThe scale is set back to 1 because it means that the parent instance has the same dimensions as the union of its children instances." }, { "type": "BuiltinCommonInstructions::Standard", @@ -2194,7 +2187,7 @@ "type": "object" }, { - "description": "", + "description": "Text", "name": "LabelText", "type": "string" } diff --git a/scripts/lib/ExtensionValidator.js b/scripts/lib/ExtensionValidator.js index 5109524f5..b209ac118 100644 --- a/scripts/lib/ExtensionValidator.js +++ b/scripts/lib/ExtensionValidator.js @@ -28,16 +28,23 @@ const loadRules = (async function loadRules() { async function validateExtension(extensionWithFileInfo) { /** @type {Error[]} */ const errors = []; - const { eventsBasedBehaviors, eventsFunctions } = + const { eventsBasedBehaviors, eventsBasedObjects, eventsFunctions } = extensionWithFileInfo.extension; + const behaviorFunctions = eventsBasedBehaviors.flatMap( + ({ eventsFunctions }) => eventsFunctions + ); + const objectFunctions = eventsBasedObjects + ? eventsBasedObjects.flatMap(({ eventsFunctions }) => eventsFunctions) + : []; /** * A list of all events functions of the extension. * @type {EventsFunction[]} */ - const allEventsFunctions = eventsFunctions.concat( - eventsBasedBehaviors.flatMap(({ eventsFunctions }) => eventsFunctions) - ); + const allEventsFunctions = []; + Array.prototype.push.apply(allEventsFunctions, eventsFunctions); + Array.prototype.push.apply(allEventsFunctions, behaviorFunctions); + Array.prototype.push.apply(allEventsFunctions, objectFunctions); /** * A list of all events functions that will be used by extension users (non-lifecycle and non-private functions). diff --git a/scripts/lib/ExtensionsValidatorExceptions.js b/scripts/lib/ExtensionsValidatorExceptions.js index 17ce5f07d..3d41b9100 100644 --- a/scripts/lib/ExtensionsValidatorExceptions.js +++ b/scripts/lib/ExtensionsValidatorExceptions.js @@ -43,6 +43,7 @@ const lifecycleFunctions = new Set([ 'onSceneResumed', 'onScenePostEvents', 'onScenePreEvents', + 'onHotReloading', ]); /** diff --git a/scripts/lib/rules/FilledOutDescriptions.js b/scripts/lib/rules/FilledOutDescriptions.js index 4ce4b2258..3419d768f 100644 --- a/scripts/lib/rules/FilledOutDescriptions.js +++ b/scripts/lib/rules/FilledOutDescriptions.js @@ -1,6 +1,7 @@ /** @typedef {import("../../types").Extension} Extension */ /** @typedef {import("../../types").EventsFunction} EventsFunction */ /** @typedef {import("../../types").EventsBasedBehaviors} EventsBasedBehaviors */ +/** @typedef {import("../../types").EventsBasedObjects} EventsBasedObjects */ /** @typedef {import("../../types").Parameter} Parameter */ /** @@ -17,6 +18,8 @@ const NECESSARY_FIELDS = { ACTION_WITH_OPERATOR: ['name', 'getterName'], /** @type {Partial[]} */ BEHAVIOR: ['name', 'fullName', 'description'], + /** @type {Partial[]} */ + OBJECT: ['name', 'fullName', 'description'], /** @type {Partial[]} */ PARAMETER: ['description', 'name', 'type'], }; @@ -88,6 +91,16 @@ async function validate({ extension, publicEventsFunctions, onError }) { `the behavior '${behavior.name}'`, onError ); + if (extension.eventsBasedObjects) { + for (const object of extension.eventsBasedObjects) { + checkForFilledOutString( + object, + NECESSARY_FIELDS.OBJECT, + `the object '${object.name}'`, + onError + ); + } + } } /** @type {import("./rule").RuleModule} */ diff --git a/scripts/types.d.ts b/scripts/types.d.ts index f943cb2c2..5889700e0 100644 --- a/scripts/types.d.ts +++ b/scripts/types.d.ts @@ -98,12 +98,21 @@ export interface EventsBasedBehaviors { eventsFunctions: EventsFunction[]; } +export interface EventsBasedObjects { + description: string; + fullName: string; + name: string; + defaultName: string; + eventsFunctions: EventsFunction[]; +} + export interface Extension extends ExtensionAndShortHeaderFields, ExtensionAndHeaderFields { tags: string | string[]; eventsFunctions: EventsFunction[]; eventsBasedBehaviors: EventsBasedBehaviors[]; + eventsBasedObjects?: EventsBasedObjects[]; } export interface ExtensionWithProperFileInfo {