summaryrefslogtreecommitdiff
path: root/src/defaultencyclopedia.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-14 15:17:36 +0100
committertroido <troido@protonmail.com>2020-02-14 15:17:36 +0100
commit10bf24f99efb87b586590b8785ac8fe337db96e5 (patch)
treee4e04af8a3f7a37e6966a9ffd7bead917d9886c7 /src/defaultencyclopedia.rs
parent49f813ae9b45dde9aa18f3ca379ea551fe5cc9cf (diff)
moved default encyclopedia to its own file
Diffstat (limited to 'src/defaultencyclopedia.rs')
-rw-r--r--src/defaultencyclopedia.rs101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/defaultencyclopedia.rs b/src/defaultencyclopedia.rs
new file mode 100644
index 0000000..bbc9d21
--- /dev/null
+++ b/src/defaultencyclopedia.rs
@@ -0,0 +1,101 @@
+
+use crate::encyclopedia::Encyclopedia;
+use serde_json::json;
+
+pub fn default_encyclopedia() -> Encyclopedia {
+ Encyclopedia::from_json(json!({
+ "wall": {
+ "components": ["Blocking"],
+ "sprite": "wall",
+ "height": 2
+ },
+ "rock": {
+ "components": ["Blocking"],
+ "sprite": "rock",
+ "height": 10
+ },
+ "tree": {
+ "components": ["Blocking"],
+ "sprite": "tree",
+ "height": 3
+ },
+ "fence": {
+ "components": ["Blocking"],
+ "sprite": "fence",
+ "height": 1
+ },
+ "grass": {
+ "components": [
+ ["Visible", {
+ "sprite": ["random", [
+ ["string", "grass1"],
+ ["string", "grass2"],
+ ["string", "grass3"],
+ ["string", "grass1"],
+ ["string", "grass2"],
+ ["string", "grass3"],
+ ["string", "ground"]
+ ]],
+ "height": ["float", 0.1]
+ }],
+ "Floor"
+ ]
+ },
+ "greengrass": {
+ "components": [
+ ["Visible", {
+ "sprite": ["random", [
+ ["string", "grass1"],
+ ["string", "grass2"],
+ ["string", "grass3"]
+ ]],
+ "height": ["float", 0.1]
+ }],
+ "Floor"
+ ]
+ },
+ "ground": {
+ "components": ["Floor"],
+ "sprite": "ground",
+ "height": 0.1
+ },
+ "floor": {
+ "components": ["Floor"],
+ "sprite": "floor",
+ "height": 0.1
+ },
+ "bridge": {
+ "components": [
+ "Floor"
+ ],
+ "sprite": "bridge",
+ "height": 0.1
+ },
+ "water": {
+ "components": [],
+ "sprite": "water",
+ "height": 0.1
+ },
+ "pebble": {
+ "components": [
+ ["Item", {"ent": ["template", "pebble"], "name": ["string", "pebble"]}]
+ ],
+ "sprite": "pebble",
+ "height": 0.4
+ },
+ "player": {
+ "arguments": [["name", "string", null]],
+ "components": [
+ ["Visible", {
+ "sprite": ["string", "player"],
+ "height": ["float", 1.0]
+ }],
+ ["Player", {
+ "name": ["arg", "name"]
+ }],
+ ["Inventory", {"capacity": ["int", 3]}],
+ ["Health", {"health": ["int", 9], "maxhealth": ["int", 10]}]
+ ]
+ }
+ })).unwrap()
+}