@luminocity/lemonate-engine 26.5.1 → 26.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11406,7 +11406,7 @@
11406
11406
  }
11407
11407
  }
11408
11408
 
11409
- var engine$1 = "26.5.1";
11409
+ var engine$1 = "26.5.2";
11410
11410
  var bullet = "3.26";
11411
11411
  var lua = "5.4.3";
11412
11412
  var packageVersionInfo = {
@@ -99719,10 +99719,19 @@
99719
99719
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
99720
99720
  }
99721
99721
  function isValidEnum(value, options) {
99722
- return typeof (value) === 'string' && options.includes(value);
99722
+ return typeof (value) === 'string' && options.find((option) => {
99723
+ if (typeof (option) === 'object')
99724
+ return option.value === value;
99725
+ return option === value;
99726
+ });
99723
99727
  }
99724
99728
  function isValidMultiEnum(value, options) {
99725
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
99729
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
99730
+ }
99731
+ function getEnumOptionsString(options) {
99732
+ return options.reduce((previousValue, currentValue, currentIndex) => {
99733
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
99734
+ });
99726
99735
  }
99727
99736
  if (!field) {
99728
99737
  console.error(`Field ${name} not found!`);
@@ -99784,7 +99793,7 @@
99784
99793
  }
99785
99794
  case "Enum": {
99786
99795
  if (!isValidEnum(value, field.options)) {
99787
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
99796
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
99788
99797
  return;
99789
99798
  }
99790
99799
  field.value = value;
@@ -99792,7 +99801,7 @@
99792
99801
  }
99793
99802
  case "MultiEnum": {
99794
99803
  if (!isValidMultiEnum(value, field.options)) {
99795
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
99804
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
99796
99805
  return;
99797
99806
  }
99798
99807
  field.value = value;
@@ -100638,10 +100647,19 @@
100638
100647
  return typeof (value) === 'object' && typeof (value.r) === 'number' && typeof (value.g) === 'number' && typeof (value.b) === 'number' && typeof (value.a) === 'number';
100639
100648
  }
100640
100649
  function isValidEnum(value, options) {
100641
- return typeof (value) === 'string' && options.includes(value);
100650
+ return typeof (value) === 'string' && options.find((option) => {
100651
+ if (typeof (option) === 'object')
100652
+ return option.value === value;
100653
+ return option === value;
100654
+ });
100642
100655
  }
100643
100656
  function isValidMultiEnum(value, options) {
100644
- return Array.isArray(value) && value.filter((x) => options.includes(x)).length === value.length;
100657
+ return Array.isArray(value) && value.filter((x) => isValidEnum(x, options)).length === value.length;
100658
+ }
100659
+ function getEnumOptionsString(options) {
100660
+ return options.reduce((previousValue, currentValue, currentIndex) => {
100661
+ return previousValue + (currentIndex === 0 ? '' : ', ') + (typeof (currentValue) === 'object' ? currentValue.value : currentValue);
100662
+ });
100645
100663
  }
100646
100664
  if (!field) {
100647
100665
  console.error(`Field ${name} not found!`);
@@ -100702,7 +100720,7 @@
100702
100720
  }
100703
100721
  case "Enum": {
100704
100722
  if (!isValidEnum(value, field.options)) {
100705
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
100723
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
100706
100724
  return;
100707
100725
  }
100708
100726
  field.value = value;
@@ -100710,7 +100728,7 @@
100710
100728
  }
100711
100729
  case "MultiEnum": {
100712
100730
  if (!isValidMultiEnum(value, field.options)) {
100713
- console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value is invalid.`);
100731
+ console.error(`The field '${name}' has type 'Enum' which needs a valid entry of the enum options. Your submitted value '${value}' is invalid. Possible values: ${getEnumOptionsString(field.options)}`);
100714
100732
  return;
100715
100733
  }
100716
100734
  field.value = value;
package/dist/player.zip CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminocity/lemonate-engine",
3
- "version": "26.5.1",
3
+ "version": "26.5.2",
4
4
  "productName": "Lemonate Engine",
5
5
  "repository": "https://codeberg.org/Luminocity/lemonate-engine",
6
6
  "homepage": "https://lemonate.io",