summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/encyclopediae/default_encyclopedia.json4
-rw-r--r--content/maps/town.json2
-rw-r--r--src/savestate.rs5
3 files changed, 7 insertions, 4 deletions
diff --git a/content/encyclopediae/default_encyclopedia.json b/content/encyclopediae/default_encyclopedia.json
index 411f1c1..cfb55df 100644
--- a/content/encyclopediae/default_encyclopedia.json
+++ b/content/encyclopediae/default_encyclopedia.json
@@ -397,6 +397,7 @@
"stone": {"action": ["build", ["builtwall", ["Floor"], ["Blocking"]]]},
"radishseed": {"sprite": "seed", "action": ["build", ["plantedradishseed", ["Floor", "Soil"], ["Occupied", "Blocking"]]]},
"radish": {"sprite": "food", "action": ["eat", 3]},
+ "eldritch_radish": {"sprite": "food", "name": "eldritch_radish", "action": ["eat", 20]},
"carrotseed": {"sprite": "seed", "action": ["build", ["plantedcarrotseed", ["Floor", "Soil"], ["Occupied", "Blocking"]]]},
"carrot": {"sprite": "food", "action": ["eat", 5]},
"sword": {"action": ["equip", {
@@ -415,6 +416,7 @@
"templates":{
"plantedcarrotseed": ["plantedseed", {"delay": 60, "next": "carrotseedling"}],
"carrotseedling": ["seedling", {"delay": 60, "next": "youngcarrotplant"}],
- "youngcarrotplant": ["youngplant", {"crop": "carrot", "delay": 60, "next": "carrotplant"}]
+ "youngcarrotplant": ["youngplant", {"crop": "carrot", "delay": 60, "next": "carrotplant"}],
+ "radishes": ["radish", {}]
}
}
diff --git a/content/maps/town.json b/content/maps/town.json
index dd0b2b5..4a31f17 100644
--- a/content/maps/town.json
+++ b/content/maps/town.json
@@ -95,7 +95,7 @@
"^": ["spiketrap", "ground"],
"%": [{
"type": "portal",
- "kwargs": {"destination": "smallview", "despos": "towneast"}
+ "kwargs": {"destination": "smallview", "destpos": "towneast"}
}, "ground"],
"r": ["grass", "rabbit"],
"/": ["grass", "sword"],
diff --git a/src/savestate.rs b/src/savestate.rs
index c3b79cb..95f8d84 100644
--- a/src/savestate.rs
+++ b/src/savestate.rs
@@ -34,10 +34,11 @@ impl SaveState {
for v in val.get("changes").ok_or(perr!("save does not have changes"))?.as_array().ok_or(perr!("changes not an array"))? {
let pos = Pos::from_json(v.get(0).ok_or(perr!("change does not have index 0"))?).ok_or(perr!("change index 0 is not a pos"))?;
let mut templates = Vec::new();
- for t in v.get(1).ok_or(perr!("change does not have index 1"))?.as_array().ok_or(perr!("change index 1 not an array"))? {
+ let jsontemplates = v.get(1).ok_or(perr!("change does not have index 1"))?;
+ for t in jsontemplates.as_array().clone().unwrap_or(&vec![jsontemplates.clone()]) {
templates.push(Template::from_json(t)?);
}
- changes.insert(pos, templates);
+ changes.entry(pos).or_insert_with(Vec::new).append(&mut templates);
}
Ok(Self {changes})
}