aboutsummaryrefslogtreecommitdiff
path: root/build/content/autolevel.py
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-25 12:46:55 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-25 12:46:55 +0100
commit23550f8120ebb41b1732d63d6d09c21bdb314c1a (patch)
tree671fc42497488769a7d747b25bed37aa5aaeed88 /build/content/autolevel.py
parentdad432566a5c74f86dc4ba874e631115e0f469d1 (diff)
component representation revolution! Vive la révolution
Diffstat (limited to 'build/content/autolevel.py')
-rw-r--r--build/content/autolevel.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/build/content/autolevel.py b/build/content/autolevel.py
deleted file mode 100644
index 51d30f3..0000000
--- a/build/content/autolevel.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import json
-
-def vectorize (obj, forbidlist, _):
- for c in obj:
- for key in c:
- if not(key in forbidlist):
- val = c[key]
- try: val = int(val);
- except: pass
- try: val = float(val);
- except: pass
- c[key] = [val for i in range(3)]
-
-def query (obj, allowlist, op):
- for c in obj:
- for key in c:
- if key in allowlist:
- c[key] = op(c[key])
-
-
-def comp(filename, l, fun, op=None):
- with open(filename+".txt", "r") as f: obj = json.loads(f.read())
- fun(obj, l, op)
- with open(filename+"-new"+".txt", "w") as f:
- f.write(json.dumps(obj, indent=4))
-
-if __name__ == "__main__":
- #comp("weapons", ["name", "damage_type"])
- #comp("augments", ["name"])
- #comp("batteries", ["name"])
- #comp("armor", ["name"])
- #comp("chassis", ["name"])
- #comp("brains", ["name"])
- #comp("brains", ["name"])
-
- amt = .5
- perc_inc = lambda x: [x[i]*(1.0+(i/2.0)*amt) for i in range(3)]
- comp("weapons", ["damage"], query, perc_inc)