summaryrefslogtreecommitdiff
path: root/src/defaultencyclopedia.rs
blob: a9bf5b9ba1d9fd83a6a5245b30daa26e16a9c3e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

use serde_json::json;
use crate::Encyclopedia;

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],
					"name": ["string", "grass"]
				}],
				"Floor"
			]
		},
		"greengrass": {
			"components": [
				["Visible", {
					"sprite": ["random", [
						["string", "grass1"],
						["string", "grass2"],
						["string", "grass3"]
					]],
					"height": ["float", 0.1],
					"name": ["string", "grass"]
				}],
				"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"],
					"action": ["action", ["eat", 1]]
				}]
			],
			"sprite": "pebble",
			"height": 0.3
		},
		"stone": {
			"components": [
				["Item", {"ent": ["template", "stone"], "name": ["string", "stone"], "action": ["action", ["build", "builtwall"]]}]
			],
			"sprite": "stone",
			"height": 0.4
		},
		"player": {
			"arguments": [["name", "string", null]],
			"components": [
				["Visible", {
					"sprite": ["string", "player"],
					"height": ["float", 1.0],
					"name": ["arg", "name"]
				}],
				["Player", {
					"name": ["arg", "name"]
				}],
				["Inventory", {"capacity": ["int", 3]}],
				["Health", {"health": ["int", 9], "maxhealth": ["int", 10]}]
			]
		},
		"portal": {
			"arguments": [["destination", "string", null], ["dest_pos", "string", ""]],
			"components": [
				["RoomExit", {"destination": ["arg", "destination"], "dest_pos": ["arg", "dest_pos"]}],
				"Floor"
			]
		},
		"builtwall": {
			"arguments": [["health", "int", 100]],
			"components": [
				"Blocking",
				["Health", {"health": ["arg", "health"], "maxhealth": ["int", 100]}]
			],
			"sprite": "wall",
			"height": 2
		},
		"spiketrap": {
			"components": [["Trap", {"damage": ["int", 8]}]],
			"sprite": "spikes",
			"height": 0.8
		},
		"dummy": {
			"arguments": [["health", "int", 20]],
			"sprite": "dummy",
			"height": 1,
			"components": [["Health", {"health": ["arg", "health"], "maxhealth": ["int", 20]}]]
		}
	})).unwrap()
}