diff options
| author | troido <troido@protonmail.com> | 2020-09-27 17:42:44 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-09-27 17:42:44 +0200 |
| commit | 09cc0f0e81a339faec191b773b5eca985d15799c (patch) | |
| tree | 26321aadc3981a0836170c14262ca40bd9a43486 | |
| parent | 3b483c793f0f2c8e76f599f74285f237d5dde00e (diff) | |
templates are not used as {"type": something} anymore
| -rw-r--r-- | content/maps/_home.json | 155 | ||||
| -rw-r--r-- | content/maps/basement.json | 20 | ||||
| -rw-r--r-- | content/maps/begin.json | 29 | ||||
| -rw-r--r-- | content/maps/broom.json | 2 | ||||
| -rw-r--r-- | content/maps/cave.json | 28 | ||||
| -rw-r--r-- | content/maps/room.json | 12 | ||||
| -rw-r--r-- | content/maps/smallview.json | 19 | ||||
| -rw-r--r-- | content/maps/town.json | 5 | ||||
| -rw-r--r-- | content/maps/tutorial.json | 72 | ||||
| -rw-r--r-- | src/template.rs | 15 |
10 files changed, 150 insertions, 207 deletions
diff --git a/content/maps/_home.json b/content/maps/_home.json index 7d67c85..e5f97a0 100644 --- a/content/maps/_home.json +++ b/content/maps/_home.json @@ -1,80 +1,81 @@ { - "width": 64, - "height": 64, - "spawn": [0,0], + "width": 64, + "height": 64, + "spawn": [0,0], "flags": ["Build"], - "places": {}, - "field":[ - "%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", - ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," - ], - "mapping": { - ",": ["grass"], - "%": [{ - "type": "portal", - "kwargs": {"destination": "smallview", "destpos": "home"} - }, "ground"] - } + "places": {}, + "field":[ + "%,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", + ",,,,,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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", + ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," + ], + "mapping": { + ",": ["grass"], + "%": [ + {":template": "portal", "destination": "smallview", "destpos": "home"}, + "ground", + {":template": "img", "sprite": "portal"} + ] + } } diff --git a/content/maps/basement.json b/content/maps/basement.json index d5f941b..99a75de 100644 --- a/content/maps/basement.json +++ b/content/maps/basement.json @@ -29,18 +29,18 @@ "^": ["spiketrap"], "D": ["ground", "closeddoor"], "<": [ - {"type": "portal", "kwargs": {"destination": "begin", "destpos": "stairdown"}}, - {"type": "img", "kwargs": {"sprite": "stairup"}}, + {":template": "portal", "destination": "begin", "destpos": "stairdown"}, + {":template": "img", "sprite": "stairup"}, "floor" ], - "a": ["floor", { - "type": "spawner", - "kwargs": {"template": {"type": "rat"}, "delay": 300, "initial_spawn": true} - }], - ":": ["floor", { - "type": "spawner", - "kwargs": {"template": {"type": "carrotseed"}, "delay": 1200, "initial_spawn": false} - }], + "a": [ + "floor", + {":template": "spawner","template": {":template": "rat"}, "delay": 300, "initial_spawn": true} + ], + ":": [ + "floor", + {":template": "spawner","template": {":template": "carrotseed"}, "delay": 1200, "initial_spawn": false} + ], " ": [] } } diff --git a/content/maps/begin.json b/content/maps/begin.json index d8f8efe..63d4368 100644 --- a/content/maps/begin.json +++ b/content/maps/begin.json @@ -89,42 +89,33 @@ "~": "water", "=": ["water", "bridge"], "*": ["ground", { - "type": "spawner", - "kwargs": {"template": {"type": "pebble"}, "delay": 600, "initial_spawn": false} + ":template": "spawner", "template": {":template": "pebble"}, "delay": 600, "initial_spawn": false }], "d": ["ground", { - "type": "spawner", - "kwargs": {"template": {"type": "dummy"}, "delay": 600, "initial_spawn": true} + ":template": "spawner", "template": {":template": "dummy"}, "delay": 600, "initial_spawn": true }], "D": ["ground", "opendoor"], "#": "wall", ":": ["ground", { - "type": "spawner", - "kwargs": {"template": {"type": "radishseed"}, "delay": 600, "initial_spawn": false} + ":template": "spawner", "template": {":template": "radishseed"}, "delay": 600, "initial_spawn": false }], ".": "ground", "+": "floor", "X": "rock", "^": ["spiketrap", "ground"], ">": [ - {"type": "portal", "kwargs": {"destination": "basement", "destpos": "stairup"}}, - {"type": "img", "kwargs": {"sprite": "stairdown"}}, + {":template": "portal", "destination": "basement", "destpos": "stairup"}, + {":template": "img", "sprite": "stairdown"}, "floor" ], "C": [ - {"type": "portal", "kwargs": {"destination": "cave", "destpos": "stairup"}}, - {"type": "img", "kwargs": {"sprite": "stairdown"}}, + {":template": "portal", "destination": "cave", "destpos": "stairup"}, + {":template": "img", "sprite": "stairdown"}, "floor" ], - "r": ["grass", {"type": "singleton", "kwargs": {"ent": {"type": "rabbit"}}}], - "3": [{ - "type": "portal", - "kwargs": {"destination": "smallview", "destpos": "begin"} - },"bridge", "water"], - "2": [{ - "type": "portal", - "kwargs": {"destination": "tutorial", "destpos": "tunnelout"} - }, "floor"], + "r": ["grass", {":template": "singleton", "ent": {":template": "rabbit"}}], + "3": [{":template": "portal", "destination": "smallview", "destpos": "begin"}, "bridge", "water"], + "2": [{":template": "portal", "destination": "tutorial", "destpos": "tunnelout"}, "floor"], "E": ["grass", "trader"], " ": [] } diff --git a/content/maps/broom.json b/content/maps/broom.json index 6effa07..f775327 100644 --- a/content/maps/broom.json +++ b/content/maps/broom.json @@ -42,7 +42,7 @@ "T": ["grass", "tree"], "f": ["grass", "fence"], "X": "rock", - "%": {"type": "portal", "kwargs": {"destination": "room"}}, + "%": {":template": "portal", "destination": "room"}, " ": [] } } diff --git a/content/maps/cave.json b/content/maps/cave.json index 084aeca..bc67b8d 100644 --- a/content/maps/cave.json +++ b/content/maps/cave.json @@ -59,35 +59,19 @@ ".": "ground", "+": "floor", "<": [ - {"type": "portal", "kwargs": {"destination": "begin", "destpos": "caveentrance"}}, - {"type": "img", "kwargs": {"sprite": "stairup"}}, + {":template": "portal", "destination": "begin", "destpos": "caveentrance"}, + {":template": "img", "sprite": "stairup"}, "floor" ], "g": [ "ground", - { - "type": "spawner", - "kwargs": { - "template": {"type": "goblin"}, - "amount": 2, - "delay": 50, - "initial_spawn": true - } - }, - {"type": "img", "kwargs": {"sprite": "spawner"}} + {":template": "spawner", "template": {":template": "goblin"}, "amount": 2, "delay": 50, "initial_spawn": true}, + {":template": "img", "sprite": "spawner"} ], "T": [ "ground", - { - "type": "spawner", - "kwargs": { - "template": {"type": "troll"}, - "amount": 1, - "delay": 200, - "initial_spawn": true - } - }, - {"type": "img", "kwargs": {"sprite": "spawner"}} + {":template": "spawner", "template": {":template": "troll"}, "amount": 1, "delay": 200, "initial_spawn": true}, + {":template": "img", "sprite": "spawner"} ], " ": [] } diff --git a/content/maps/room.json b/content/maps/room.json index b13a951..470b200 100644 --- a/content/maps/room.json +++ b/content/maps/room.json @@ -38,13 +38,13 @@ "T": ["grass", "tree"], "f": ["grass", "fence"], "X": "rock", - "*": ["grass", {"type": "spawner", "kwargs": {"template": {"type": "pebble"}, "delay": 1200, "initial_spawn": false}}], - "o": ["grass", {"type": "spawner", "kwargs": {"template": {"type": "stone"}, "delay": 1200, "initial_spawn": false}}], - "%": {"type": "portal", "kwargs": {"destination": "broom", "destpos": "northentry"}}, - "1": {"type": "portal", "kwargs": {"destination": "smallview"}}, + "*": ["grass", {":template": "spawner", "template": {":template": "pebble"}, "delay": 1200, "initial_spawn": false}], + "o": ["grass", {":template": "spawner", "template": {":template": "stone"}, "delay": 1200, "initial_spawn": false}], + "%": {":template": "portal", "destination": "broom", "destpos": "northentry"}, + "1": {":template": "portal", "destination": "smallview"}, "^": ["grass", "spiketrap"], - "d": ["grass", {"type": "spawner", "kwargs": {"template": {"type": "dummy"}, "delay": 100, "initial_spawn": true}}], - "r": ["grass", {"type": "spawner", "kwargs": {"template": {"type": "rat"}, "amount": 3, "clan": "rats", "delay": 200, "initial_spawn": true}}], + "d": ["grass", {":template": "spawner", "template": {":template": "dummy"}, "delay": 100, "initial_spawn": true}], + "r": ["grass", {":template": "spawner", "template": {":template": "rat"}, "amount": 3, "clan": "rats", "delay": 200, "initial_spawn": true}], "D": ["ground", "closeddoor"], "s": ["ground", "sign"], "u": ["ground", "dude"], diff --git a/content/maps/smallview.json b/content/maps/smallview.json index 3ddd9ac..cabf10f 100644 --- a/content/maps/smallview.json +++ b/content/maps/smallview.json @@ -47,25 +47,16 @@ "Y": ["grass", "plant"], "T": ["grass", "tree"], "~": "water", - "=": ["water", {"type": "bridge", "kwargs": {"small": true}}], + "=": ["water", {":template": "bridge", "small": true}], "#": "fence", ".": "ground", "+": "floor", "X": "rock", "^": "house", - "1": [{ - "type": "portal", - "kwargs": {"destination": "begin", "destpos": "bridge"} - }, "floor"], - "2": [{ - "type": "portal", - "kwargs": {"destination": "town", "destpos": "gate"} - }, "floor"], - "3": ["homeportal", "floor", {"type": "img", "kwargs": {"sprite": "portal", "height": 1.0}}], - "4": [{ - "type": "portal", - "kwargs": {"destination": "room"} - }, "floor"], + "1": [{":template": "portal", "destination": "begin", "destpos": "bridge"}, "floor"], + "2": [{":template": "portal", "destination": "town", "destpos": "gate"}, "floor"], + "3": ["homeportal", "floor", {":template": "img", "sprite": "portal", "height": 1.0}], + "4": [{":template": "portal", "destination": "room"}, "floor"], "r": ["grass", "rabbit"], " ": [] } diff --git a/content/maps/town.json b/content/maps/town.json index c2b0624..f9b0f1d 100644 --- a/content/maps/town.json +++ b/content/maps/town.json @@ -85,10 +85,7 @@ "X": "rock", "^": ["spiketrap", "ground"], "D": ["floor", "opendoor"], - "%": [{ - "type": "portal", - "kwargs": {"destination": "smallview", "destpos": "towneast"} - }, "ground"], + "%": [{":template": "portal", "destination": "smallview", "destpos": "towneast"}, "ground"], "r": ["grass", "rabbit"], "S": ["floor", "toolsmith"], "t": ["floor", "trader"], diff --git a/content/maps/tutorial.json b/content/maps/tutorial.json index 5f75725..f84cf73 100644 --- a/content/maps/tutorial.json +++ b/content/maps/tutorial.json @@ -80,48 +80,38 @@ "~": ["water"], "=": ["water", "bridge"], "m": ["rock"], - "^": [{"type": "spiketrap", "kwargs": {"damage": 3}} - , "floor"], + "^": [{":template": "spiketrap", "damage": 3}, "floor"], "%": ["floor", "closeddoor"], - "&": [{ - "type": "spawner", - "kwargs": {"template": {"type": "dummy"}, "delay": 300, "initial_spawn": true} - }, "floor"], - "1": [{ - "type": "portal", - "kwargs": {"destination": "begin", "destpos": "cavebridge"} - }, "floor"], - ";": ["floor", { - "type": "spawner", - "kwargs": {"template": {"type": "radishseed"}, "delay": 600, "initial_spawn": true} - }], - "A": [{"type": "letter", "kwargs": {"char": "A"}}], - "B": [{"type": "letter", "kwargs": {"char": "B"}}], - "C": [{"type": "letter", "kwargs": {"char": "C"}}], - "D": [{"type": "letter", "kwargs": {"char": "D"}}], - "E": [{"type": "letter", "kwargs": {"char": "E"}}], - "F": [{"type": "letter", "kwargs": {"char": "F"}}], - "G": [{"type": "letter", "kwargs": {"char": "G"}}], - "H": [{"type": "letter", "kwargs": {"char": "H"}}], - "I": [{"type": "letter", "kwargs": {"char": "I"}}], - "J": [{"type": "letter", "kwargs": {"char": "J"}}], - "K": [{"type": "letter", "kwargs": {"char": "K"}}], - "L": [{"type": "letter", "kwargs": {"char": "L"}}], - "M": [{"type": "letter", "kwargs": {"char": "M"}}], - "N": [{"type": "letter", "kwargs": {"char": "N"}}], - "O": [{"type": "letter", "kwargs": {"char": "O"}}], - "P": [{"type": "letter", "kwargs": {"char": "P"}}], - "Q": [{"type": "letter", "kwargs": {"char": "Q"}}], - "R": [{"type": "letter", "kwargs": {"char": "R"}}], - "S": [{"type": "letter", "kwargs": {"char": "S"}}], - "T": [{"type": "letter", "kwargs": {"char": "T"}}], - "U": [{"type": "letter", "kwargs": {"char": "U"}}], - "V": [{"type": "letter", "kwargs": {"char": "V"}}], - "W": [{"type": "letter", "kwargs": {"char": "W"}}], - "X": [{"type": "letter", "kwargs": {"char": "X"}}], - "Y": [{"type": "letter", "kwargs": {"char": "Y"}}], - "Z": [{"type": "letter", "kwargs": {"char": "Z"}}], - "_": [{"type": "letter", "kwargs": {"char": " "}}], + "&": [{":template": "spawner", "template": {":template": "dummy"}, "delay": 300, "initial_spawn": true}, "floor"], + "1": [{":template": "portal", "destination": "begin", "destpos": "cavebridge"}, "floor"], + ";": ["floor", {":template": "spawner", "template": {":template": "radishseed"}, "delay": 600, "initial_spawn": true}], + "A": [{":template": "letter", "char": "A"}], + "B": [{":template": "letter", "char": "B"}], + "C": [{":template": "letter", "char": "C"}], + "D": [{":template": "letter", "char": "D"}], + "E": [{":template": "letter", "char": "E"}], + "F": [{":template": "letter", "char": "F"}], + "G": [{":template": "letter", "char": "G"}], + "H": [{":template": "letter", "char": "H"}], + "I": [{":template": "letter", "char": "I"}], + "J": [{":template": "letter", "char": "J"}], + "K": [{":template": "letter", "char": "K"}], + "L": [{":template": "letter", "char": "L"}], + "M": [{":template": "letter", "char": "M"}], + "N": [{":template": "letter", "char": "N"}], + "O": [{":template": "letter", "char": "O"}], + "P": [{":template": "letter", "char": "P"}], + "Q": [{":template": "letter", "char": "Q"}], + "R": [{":template": "letter", "char": "R"}], + "S": [{":template": "letter", "char": "S"}], + "T": [{":template": "letter", "char": "T"}], + "U": [{":template": "letter", "char": "U"}], + "V": [{":template": "letter", "char": "V"}], + "W": [{":template": "letter", "char": "W"}], + "X": [{":template": "letter", "char": "X"}], + "Y": [{":template": "letter", "char": "Y"}], + "Z": [{":template": "letter", "char": "Z"}], + "_": [{":template": "letter", "char": " "}], " ": [] } } diff --git a/src/template.rs b/src/template.rs index 6eb27e1..530fbc9 100644 --- a/src/template.rs +++ b/src/template.rs @@ -15,16 +15,6 @@ pub struct EntityType(pub String); enum TemplateSave { Name(EntityType), Full{ - #[serde(rename = "type")] - name: EntityType, - #[serde(default, skip_serializing_if = "HashMap::is_empty")] - kwargs: HashMap<String, Parameter>, - #[serde(default, skip_serializing_if = "Option::is_none")] - save: Option<bool>, - #[serde(default, skip_serializing_if = "Option::is_none")] - clan: Option<String> - }, - New{ #[serde(rename = ":template")] name: EntityType, #[serde(rename="__save__", default, skip_serializing_if = "Option::is_none")] @@ -50,8 +40,7 @@ impl From<TemplateSave> for Template { fn from(ts: TemplateSave) -> Self { match ts { TemplateSave::Name(name) => Self{name, kwargs: HashMap::new(), save: None, clan: None}, - TemplateSave::Full{name, kwargs, save, clan} => Self{name, kwargs, save, clan}, - TemplateSave::New{name, kwargs, save, clan} => Self{name, kwargs, save, clan} + TemplateSave::Full{name, kwargs, save, clan} => Self{name, kwargs, save, clan} } } } @@ -60,7 +49,7 @@ impl Into<TemplateSave> for Template { if self.kwargs.is_empty() && self.save == None && self.clan == None { return TemplateSave::Name(self.name); } - TemplateSave::New { + TemplateSave::Full { name: self.name, kwargs: self.kwargs, save: self.save, |
