create-vimp-game 0.1.13 → 0.1.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vimp-game",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Scaffolder for VIMP game plugins",
5
5
  "keywords": [
6
6
  "vimp",
@@ -1,4 +1,4 @@
1
1
  {
2
- "engine": "0.14.4",
2
+ "engine": "0.15.0",
3
3
  "core": "0.8.3"
4
4
  }
@@ -106,10 +106,14 @@ const roomValues = {
106
106
  map: gameConfig.currentMap,
107
107
  };
108
108
 
109
- // bounds of the numeric fields (v3 text controls know no min/max): the same
110
- // numbers the host clamps by, not an independent copy
109
+ // bounds of the numeric fields: the same numbers the host clamps by, not an
110
+ // independent copy. regExp remains the actual (native-shaped) constraint;
111
+ // min/max additionally travel to the client for the field-label hint and
112
+ // the custom range error (formBuilder.js collectFormErrors) — v3 text
113
+ // controls have no native min/max of their own
111
114
  const { roomTimeMin, roomTimeMax } = hostDefaults.timers;
112
115
  const roomTimeRegExp = rangeToPattern(roomTimeMin / 1000, roomTimeMax / 1000);
116
+ const roomTimeBounds = { min: roomTimeMin / 1000, max: roomTimeMax / 1000 };
113
117
 
114
118
  const fieldRegExp = {
115
119
  maxPlayers: rangeToPattern(1, gameConfig.roomDefaults.maxPlayers),
@@ -117,9 +121,15 @@ const fieldRegExp = {
117
121
  mapTime: roomTimeRegExp,
118
122
  };
119
123
 
124
+ const fieldBounds = {
125
+ maxPlayers: { min: 1, max: gameConfig.roomDefaults.maxPlayers },
126
+ roundTime: roomTimeBounds,
127
+ mapTime: roomTimeBounds,
128
+ };
129
+
120
130
  const roomForm = gameConfig.roomForm.map(field =>
121
131
  field.name in fieldRegExp
122
- ? { ...field, regExp: fieldRegExp[field.name] }
132
+ ? { ...field, regExp: fieldRegExp[field.name], ...fieldBounds[field.name] }
123
133
  : field,
124
134
  );
125
135