]> git.cworth.org Git - empires-server/blobdiff - empathy.js
empathy: Don't allow a prompt with 0 items
[empires-server] / empathy.js
index 7b1e9a1a7e79815a4d6c581f22562056bbb27f04..c1d150f354d9bb4207f985b7da65540d4caa8ccd 100644 (file)
@@ -19,7 +19,7 @@ const PHASE_MINIMUM_TIME = 30;
  *
  * Specified in seconds
  */
-const PHASE_IDLE_TIMEOUT = 30;
+const PHASE_IDLE_TIMEOUT = 15;
 
 class Empathy extends Game {
   constructor(id) {
@@ -115,11 +115,19 @@ class Empathy extends Game {
   }
 
   add_prompt(items, prompt_string) {
-    if (items > MAX_PROMPT_ITEMS)
+    if (items > MAX_PROMPT_ITEMS) {
       return {
         valid: false,
         message: `Maximum number of items is ${MAX_PROMPT_ITEMS}`
       };
+    }
+
+    if (items < 1) {
+      return {
+        valid: false,
+        message: "Category must require at least one item"
+      };
+    }
 
     const prompt = new Prompt(this.next_prompt_id, items, prompt_string);
     this.next_prompt_id++;