summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-09-27 15:33:09 +0200
committertroido <troido@protonmail.com>2020-09-27 15:33:09 +0200
commita20bcfed7d3b6aacc3211514d9804651a458e725 (patch)
treed4d4aaab553a3a9065e9dba8ef4fdec9ccf45778 /content
parentc3a282d04f1fd5c7cc4cf5ebb478129c2b1c42fa (diff)
better serialisation structure for encyclopediae
["list", [1, 2, 3]] is now just [1, 2, 3] and {"type": builtwall", "kwargs": {"health": 50}} is now {":template": "builtwall", "health": 50}
Diffstat (limited to 'content')
-rw-r--r--content/encyclopediae/base.json14
-rw-r--r--content/encyclopediae/crops.json76
-rw-r--r--content/encyclopediae/default_encyclopedia.json70
-rw-r--r--content/encyclopediae/npcs.json64
4 files changed, 101 insertions, 123 deletions
diff --git a/content/encyclopediae/base.json b/content/encyclopediae/base.json
index e6806b5..1964579 100644
--- a/content/encyclopediae/base.json
+++ b/content/encyclopediae/base.json
@@ -23,7 +23,7 @@
"grass": {
"components": [
["Visible", {
- "sprite": ["random", [
+ "sprite": {"$random": [
"grass1",
"grass2",
"grass3",
@@ -31,7 +31,7 @@
"grass2",
"grass3",
"ground"
- ]],
+ ]},
"height": 0.1,
"name": "grass"
}]
@@ -41,11 +41,11 @@
"greengrass": {
"components": [
["Visible", {
- "sprite": ["random", [
+ "sprite": {"$random": [
"grass1",
"grass2",
"grass3"
- ]],
+ ]},
"height": 0.1,
"name": "grass"
}]
@@ -76,14 +76,14 @@
"img": {
"arguments": [["sprite", "string", ""], ["height", "float", 1.0]],
"components": [
- ["Visible", {"name": ["arg", "sprite"], "sprite": ["arg", "sprite"], "height": ["arg", "height"]}]
+ ["Visible", {"name": {"$arg": "sprite"}, "sprite": {"$arg": "sprite"}, "height": {"$arg": "height"}}]
]
},
"letter": {
"arguments": [["char", "string"]],
"components": [["Visible", {
- "name": ["concat", ["letter_", ["arg", "char"]]],
- "sprite": ["concat", ["emptyletter-", ["arg", "char"]]],
+ "name": {"$concat": ["letter_", {"$arg": "char"}]},
+ "sprite": {"$concat": ["emptyletter-", {"$arg": "char"}]},
"height": 1.0
}]]
}
diff --git a/content/encyclopediae/crops.json b/content/encyclopediae/crops.json
index a8c9047..0c16073 100644
--- a/content/encyclopediae/crops.json
+++ b/content/encyclopediae/crops.json
@@ -6,12 +6,12 @@
"height": 0.5,
"components": [
["Interactable", {"typ": "trigger", "arg": "die"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "radishseed"}, 0.92]],
- ["list", [{"type": "radishseed"}, 0.20]],
- ["list", [{"type": "radish"}, 0.8]],
- ["list", [{"type": "radish"}, 0.4]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "radishseed"}, 0.92],
+ [{"$template": "radishseed"}, 0.20],
+ [{"$template": "radish"}, 0.8],
+ [{"$template": "radish"}, 0.4]
+ ]}]
],
"flags": ["Occupied"]
},
@@ -24,10 +24,10 @@
["Timer", {
"delay": 600,
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["template", "radishseedling"]}]
+ ["Build", {"obj": {"$template": "radishseedling"}}]
],
"extract": {
"target_time": ["Timer", "target_time"]
@@ -43,10 +43,10 @@
["Timer", {
"delay": 600,
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["template", "youngradishplant"]}]
+ ["Build", {"obj": {"$template": "youngradishplant"}}]
],
"extract": {
"target_time": ["Timer", "target_time"]
@@ -62,10 +62,10 @@
["Timer", {
"delay": 600,
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["template", "radishplant"]}]
+ ["Build", {"obj": {"$template": "radishplant"}}]
],
"extract": {
"target_time": ["Timer", "target_time"]
@@ -79,12 +79,12 @@
"name": "plantedseed",
"components": [
["Timer", {
- "delay": ["arg", "delay"],
+ "delay": {"$arg": "delay"},
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["arg", "next"]}]
+ ["Build", {"obj": {"$arg": "next"}}]
],
"extract": {
"target_time": ["Timer", "target_time"]
@@ -98,12 +98,12 @@
"name": "seedling",
"components": [
["Timer", {
- "delay": ["arg", "delay"],
+ "delay": {"$arg": "delay"},
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["arg", "next"]}]
+ ["Build", {"obj": {"$arg": "next"}}]
],
"extract": {
"target_time": ["Timer", "target_time"]
@@ -114,14 +114,14 @@
"arguments": [["target_time", "int", -1], ["next", "template"], ["crop", "string"], ["delay", "int"]],
"components": [
["Timer", {
- "delay": ["arg", "delay"],
+ "delay": {"$arg": "delay"},
"spread": 0.5,
- "target_time": ["arg", "target_time"],
+ "target_time": {"$arg": "target_time"},
"trigger": "change"
}],
- ["Build", {"obj": ["arg", "next"]}],
+ ["Build", {"obj": {"$arg": "next"}}],
["Visible", {
- "name": ["concat", [["string", "young"], ["arg", "crop"], ["string", "plant"]]],
+ "name": {"$concat": ["young", {"$arg": "crop"}, "plant"]},
"sprite": "youngplant",
"height": 0.8
}]
@@ -137,10 +137,10 @@
"height": 1.0,
"components": [
["Interactable", {"typ": "trigger", "arg": "die"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "carrotseed"}, 1.0]],
- ["list", [{"type": "carrot"}, 1.0]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "carrotseed"}, 1.0],
+ [{"$template": "carrot"}, 1.0]
+ ]}]
],
"flags": ["Occupied"]
},
@@ -150,12 +150,12 @@
"height": 1.0,
"components": [
["Interactable", {"typ": "trigger", "arg": "die"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "cottonseed"}, 0.92]],
- ["list", [{"type": "cottonseed"}, 0.20]],
- ["list", [{"type": "cotton"}, 0.8]],
- ["list", [{"type": "cotton"}, 0.4]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "cottonseed"}, 0.92],
+ [{"$template": "cottonseed"}, 0.20],
+ [{"$template": "cotton"}, 0.8],
+ [{"$template": "cotton"}, 0.4]
+ ]}]
],
"flags": ["Occupied"]
},
@@ -176,11 +176,11 @@
"cottoncloth": {"sprite": "cottoncloth"}
},
"templates":{
- "plantedcarrotseed": ["plantedseed", {"delay": 1800, "next": {"type": "carrotseedling"}}],
- "carrotseedling": ["seedling", {"delay": 3000, "next": {"type": "youngcarrotplant"}}],
- "youngcarrotplant": ["youngplant", {"crop": "carrot", "delay": 6000, "next": {"type": "carrotplant"}}],
- "plantedcottonseed": ["plantedseed", {"delay": 6000, "next": {"type": "cottonseedling"}}],
- "cottonseedling": ["seedling", {"delay": 18000, "next": {"type": "youngcottonplant"}}],
- "youngcottonplant": ["youngplant", {"crop": "cotton", "delay": 36000, "next": {"type": "cottonplant"}}]
+ "plantedcarrotseed": ["plantedseed", {"delay": 1800, "next": {":template": "carrotseedling"}}],
+ "carrotseedling": ["seedling", {"delay": 3000, "next": {":template": "youngcarrotplant"}}],
+ "youngcarrotplant": ["youngplant", {"crop": "carrot", "delay": 6000, "next": {":template": "carrotplant"}}],
+ "plantedcottonseed": ["plantedseed", {"delay": 6000, "next": {":template": "cottonseedling"}}],
+ "cottonseedling": ["seedling", {"delay": 18000, "next": {":template": "youngcottonplant"}}],
+ "youngcottonplant": ["youngplant", {"crop": "cotton", "delay": 36000, "next": {":template": "cottonplant"}}]
}
}
diff --git a/content/encyclopediae/default_encyclopedia.json b/content/encyclopediae/default_encyclopedia.json
index 25e3d32..cf58771 100644
--- a/content/encyclopediae/default_encyclopedia.json
+++ b/content/encyclopediae/default_encyclopedia.json
@@ -3,25 +3,25 @@
"portal": {
"arguments": [["destination", "string"], ["destpos", "string", ""]],
"components": [
- ["RoomExit", {"destination": ["arg", "destination"], "dest_pos": ["arg", "destpos"]}]
+ ["RoomExit", {"destination": {"$arg": "destination"}, "dest_pos": {"$arg": "destpos"}}]
],
"flags": ["Floor"]
},
"_homeportal": {
- "arguments": [["allowed", "list", ["list", []]]],
+ "arguments": [["allowed", "list", []]],
"extract": {"allowed": ["Whitelist", "allowed"]},
"components": [
["RoomExit", {"destination": "_home+{player}", "dest_pos": ""}],
["Interactable", {"typ": "visit", "arg": "_home+{player}"}],
- ["Whitelist", {"allowed": ["arg", "allowed"]}]
+ ["Whitelist", {"allowed": {"$arg": "allowed"}}]
],
"flags": ["Floor"]
},
"builtwall": {
"arguments": [["health", "int", 100]],
"components": [
- ["Health", {"health": ["arg", "health"], "maxhealth": 100}],
- ["Loot", {"loot": ["list", [["list", [{"type": "stone"}, 1.0]]]]}]
+ ["Health", {"health": {"$arg": "health"}, "maxhealth": 100}],
+ ["Loot", {"loot": [[{"$template": "stone"}, 1.0]]}]
],
"sprite": "builtwall",
"height": 2,
@@ -38,7 +38,7 @@
"sprite": "dummy",
"height": 1,
"components": [
- ["Health", {"health": ["arg", "health"], "maxhealth": 20}]
+ ["Health", {"health": {"$arg": "health"}, "maxhealth": 20}]
]
},
"wound": {
@@ -51,16 +51,16 @@
"arguments": [["template", "template"], ["amount", "int", 1], ["delay", "int", 0], ["clan", "string", ""], ["initial_spawn", "bool", true], ["radius", "int", 0]],
"components": [
["Timer", {
- "delay": ["arg", "delay"],
+ "delay": {"$arg": "delay"},
"spread": 0.1,
"trigger": "spawn",
- "target_time": ["if", [["arg", "initial_spawn"], 0, -1]]
+ "target_time": {"$if": [{"$arg": "initial_spawn"}, 0, -1]}
}],
["Spawner", {
- "template": ["arg", "template"],
- "amount": ["arg", "amount"],
- "clan": ["arg", "clan"],
- "radius": ["arg", "radius"]
+ "template": {"$arg": "template"},
+ "amount": {"$arg": "amount"},
+ "clan": {"$arg": "clan"},
+ "radius": {"$arg": "radius"}
}]
]
},
@@ -68,9 +68,9 @@
"arguments": [["ent", "template"], ["clan", "string", ""]],
"components": [
["Spawner", {
- "template": ["arg", "ent"],
+ "template": {"$arg": "ent"},
"amount": 1,
- "clan": ["arg", "clan"],
+ "clan": {"$arg": "clan"},
"radius": 0
}],
["Timer", {
@@ -87,7 +87,7 @@
"flags": ["Blocking"],
"components": [
["Interactable", {"typ": "trigger", "arg": "change"}],
- ["Build", {"obj": {"type": "opendoor", "save": false}}]
+ ["Build", {"obj": {"$template": "opendoor", "__save__": false}}]
]
},
"opendoor": {
@@ -96,7 +96,7 @@
"flags": ["Occupied"],
"components": [
["Interactable", {"typ": "trigger", "arg": "change"}],
- ["Build", {"obj": {"type": "closeddoor", "save": false}}]
+ ["Build", {"obj": {"$template": "closeddoor", "__save__": false}}]
]
},
"sign": {
@@ -113,20 +113,15 @@
"components": [
["Interactable", {"typ": "mine", "arg": "mining"}],
["Minable", {"total": 20, "trigger": "loot"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "stone"}, 1.0]]
- ]]}]
+ ["Loot", {"loot": [[{"$template": "stone"}, 1.0]]}]
]
},
"spinningwheel": {
"sprite": "spinningwheel",
"height": 1.0,
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "spin ",
- ["list", [
- ["list", ["cotton yarn", ["list", ["cotton", "cotton"]], ["list", ["cottonyarn"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["spin ", [
+ ["cotton yarn", ["cotton", "cotton"], ["cottonyarn"]]
]]}]
]
},
@@ -134,11 +129,8 @@
"sprite": "loom",
"height": 1.0,
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "weave ",
- ["list", [
- ["list", ["cotton cloth", ["list", ["cottonyarn", "cottonyarn", "cottonyarn", "cottonyarn", "cottonyarn"]], ["list", ["cottoncloth"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["weave ", [
+ ["cotton cloth", ["cottonyarn", "cottonyarn", "cottonyarn", "cottonyarn", "cottonyarn"], ["cottoncloth"]]
]]}]
]
},
@@ -146,11 +138,8 @@
"sprite": "sewingtable",
"height": 1.0,
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "sew ",
- ["list", [
- ["list", ["cape", ["list", ["cottoncloth", "cottoncloth", "cottoncloth", "cottonyarn", "cottonyarn"]], ["list", ["cape"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["sew ", [
+ ["cape", ["cottoncloth", "cottoncloth", "cottoncloth", "cottonyarn", "cottonyarn"], ["cape"]]
]]}]
]
},
@@ -158,13 +147,10 @@
"sprite": "tub",
"height": 1.0,
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "dye ",
- ["list", [
- ["list", ["red cape", ["list", ["cape", "reddye"]], ["list", ["redcape"]]]],
- ["list", ["green cape", ["list", ["cape", "greendye"]], ["list", ["greencape"]]]],
- ["list", ["blue cape", ["list", ["cape", "bluedye"]], ["list", ["bluecape"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["dye ", [
+ ["red cape", ["cape", "reddye"], ["redcape"]],
+ ["green cape", ["cape", "greendye"], ["greencape"]],
+ ["blue cape", ["cape", "bluedye"], ["bluecape"]]
]]}]
]
}
@@ -239,6 +225,6 @@
}
},
"templates": {
- "homeportal": ["singleton", {"ent": {"type": "_homeportal"}}]
+ "homeportal": ["singleton", {"ent": {":template": "_homeportal"}}]
}
}
diff --git a/content/encyclopediae/npcs.json b/content/encyclopediae/npcs.json
index 592417c..5cb7a60 100644
--- a/content/encyclopediae/npcs.json
+++ b/content/encyclopediae/npcs.json
@@ -13,9 +13,9 @@
["Fighter", {"damage": 2, "cooldown": 6}],
["Movable", {"cooldown": 3}],
["Faction", {"faction": "evil"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "radishseed"}, 1.0]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "radishseed"}, 1.0]
+ ]}]
]
},
"goblin": {
@@ -31,11 +31,11 @@
["Fighter", {"damage": 5, "cooldown": 8}],
["Movable", {"cooldown": 4}],
["Faction", {"faction": "evil"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "sword"}, 0.05]],
- ["list", [{"type": "club"}, 0.1]],
- ["list", [{"type": "radish"}, 0.25]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "sword"}, 0.05],
+ [{"$template": "club"}, 0.1],
+ [{"$template": "radish"}, 0.25]
+ ]}]
]
},
"troll": {
@@ -51,13 +51,13 @@
["Fighter", {"damage": 15, "cooldown": 10}],
["Movable", {"cooldown": 5}],
["Faction", {"faction": "evil"}],
- ["Loot", {"loot": ["list", [
- ["list", [{"type": "stone"}, 1.0]],
- ["list", [{"type": "stone"}, 0.3]],
- ["list", [{"type": "pebble"}, 0.5]],
- ["list", [{"type": "pebble"}, 0.5]],
- ["list", [{"type": "pebble"}, 0.5]]
- ]]}]
+ ["Loot", {"loot": [
+ [{"$template": "stone"}, 1.0],
+ [{"$template": "stone"}, 0.3],
+ [{"$template": "pebble"}, 0.5],
+ [{"$template": "pebble"}, 0.5],
+ [{"$template": "pebble"}, 0.5]
+ ]}]
]
},
@@ -87,14 +87,11 @@
"height": 1.5,
"name": "crop trader",
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "buy ",
- ["list", [
- ["list", ["pebble", ["list", ["radish", "radish"]], ["list", ["pebble"]]]],
- ["list", ["radishseed", ["list", ["radish"]], ["list", ["radishseed", "radishseed"]]]],
- ["list", ["carrotseed", ["list", ["radish"]], ["list", ["carrotseed"]]]],
- ["list", ["cottonseed", ["list", ["stone"]], ["list", ["cottonseed"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["buy ", [
+ ["pebble", ["radish", "radish"], ["pebble"]],
+ ["radishseed", ["radish"], ["radishseed", "radishseed"]],
+ ["carrotseed", ["radish"], ["carrotseed"]],
+ ["cottonseed", ["stone"], ["cottonseed"]]
]]}],
["MonsterAI", {
"view_distance": 1,
@@ -109,13 +106,10 @@
"height": 1.5,
"name": "dye trader",
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "buy ",
- ["list", [
- ["list", ["red dye", ["list", ["club", "club"]], ["list", ["reddye"]]]],
- ["list", ["green dye", ["list", ["stone", "stone", "stone", "stone", "stone"]], ["list", ["greendye"]]]],
- ["list", ["blue dye", ["list", ["sword"]], ["list", ["bluedye"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["buy ", [
+ ["red dye", ["club", "club"], ["reddye"]],
+ ["green dye", ["stone", "stone", "stone", "stone", "stone"], ["greendye"]],
+ ["blue dye", ["sword"], ["bluedye"]]
]]}],
["MonsterAI", {
"view_distance": 1,
@@ -130,11 +124,8 @@
"height": 1.5,
"name": "toolsmith",
"components": [
- ["Interactable", {"typ": "exchange", "arg": ["list", [
- "buy ",
- ["list", [
- ["list", ["pickaxe", ["list", ["carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot"]], ["list", ["pickaxe"]]]]
- ]]
+ ["Interactable", {"typ": "exchange", "arg": ["buy ", [
+ ["pickaxe", ["carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot", "carrot"], ["pickaxe"]]
]]}],
["MonsterAI", {
"view_distance": 1,
@@ -154,7 +145,8 @@
"move_chance": 0.01,
"homesickness": 0.3
}],
- ["Movable", {"cooldown": 3}]
+ ["Movable", {"cooldown": 3}],
+ ["Interactable", {"typ": "say", "arg": "Hello"}]
]
}
}