From 2df421ebb2d129330aaec12f5a29408f2c20d5a4 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 22 Dec 2018 17:46:01 -0500 Subject: [PATCH] More work on the new character screen --- features.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ game.js | 28 ++++++++++++++++++++++++ stroll.html | 2 +- 3 files changed, 92 insertions(+), 1 deletion(-) diff --git a/features.js b/features.js index ed3e39e..bd46826 100644 --- a/features.js +++ b/features.js @@ -80,5 +80,68 @@ options = [ ] } ] + }, + { + "name": "Brutality", + "id": "brutality", + "optional": false, + "entries": + [ + { + "type": "radio", + "id": "brutality", + "default": "1", + "choices": + [ + { + "name": "Non-fatal", + "value": "0" + }, + { + "name": "Fatal", + "value": "1" + }, + { + "name": "Gory", + "value": "2" + }, + { + "name": "Sadistic", + "value": "3" + }, + ] + } + ] + }, + { + "name": "Victims", + "id": "victims", + "optional": false, + "entries": + [ + { + "type": "checkbox", + "id": "victims", + "choices": + [ + { + "name": "Human prey", + "value": "Human" + }, + { + "name": "Military", + "value": "Military" + }, + { + "name": "Other macros", + "value": "Macros" + }, + { + "name": "Micros", + "value": "Micros" + }, + ] + } + ] } ]; diff --git a/game.js b/game.js index 56acc9f..2f93442 100644 --- a/game.js +++ b/game.js @@ -4883,6 +4883,34 @@ function construct_options() { return; } + if (option.type == "checkbox") { + option.choices.forEach(function(choice) { + let li = document.createElement("li"); + + let input = document.createElement("input"); + input.setAttribute("autocomplete", "off"); + input.setAttribute("id", option.id + choice.value); + input.setAttribute("name", option.id + choice.value); + input.setAttribute("type", "checkbox"); + + if (choice.default) { + input.setAttribute("checked", true); + } + + let label = document.createElement("label"); + label.setAttribute("for", option.id + choice.value); + label.innerText = choice.name; + + li.appendChild(input); + li.appendChild(label); + options_div.appendChild(li); + + }); + + // we added n li elements; we need to skip the default one + return; + } + if (option.type == "select") { let label = document.createElement("label"); label.setAttribute("for", option.id); diff --git a/stroll.html b/stroll.html index b2e6301..d0bfdb3 100644 --- a/stroll.html +++ b/stroll.html @@ -446,7 +446,6 @@ - -->
Brutality
@@ -491,6 +490,7 @@
+ -->
Misc