exopython 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- exopy/__init__.py +270 -0
- exopy/__main__.py +20 -0
- exopy/_state.py +7 -0
- exopy/binary.py +48 -0
- exopy/constants.py +121 -0
- exopy/decompile.py +528 -0
- exopy/scripts.py +257 -0
- exopy/stdlib.py +65 -0
- exopy/variables.py +318 -0
- exopython-1.0.0.dist-info/METADATA +39 -0
- exopython-1.0.0.dist-info/RECORD +14 -0
- exopython-1.0.0.dist-info/WHEEL +5 -0
- exopython-1.0.0.dist-info/licenses/LICENSE +21 -0
- exopython-1.0.0.dist-info/top_level.txt +1 -0
exopy/__init__.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import gzip, hashlib, os, secrets, struct, uuid
|
|
2
|
+
from . import _state, scripts, variables, stdlib
|
|
3
|
+
from .decompile import decompile
|
|
4
|
+
from .binary import BinaryWriter, parse_color
|
|
5
|
+
from .constants import THEMES, DEFAULT_SETTINGS, TILE_IDS, OBJECT_PROPERTIES
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
KEYS_FILE = os.path.expanduser("~/.exopy_keys.txt")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_or_create_key(level_uuid: str) -> str:
|
|
12
|
+
keys = {}
|
|
13
|
+
if os.path.exists(KEYS_FILE):
|
|
14
|
+
with open(KEYS_FILE, "r", encoding="utf-8") as f:
|
|
15
|
+
for line in f:
|
|
16
|
+
if "=" in line:
|
|
17
|
+
k, v = line.strip().split("=", 1)
|
|
18
|
+
keys[k.strip()] = v.strip()
|
|
19
|
+
if level_uuid in keys:
|
|
20
|
+
return keys[level_uuid]
|
|
21
|
+
new_key = secrets.token_hex(16)
|
|
22
|
+
with open(KEYS_FILE, "a", encoding="utf-8") as f:
|
|
23
|
+
f.write(f"{level_uuid}={new_key}\n")
|
|
24
|
+
return new_key
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _build_exopy_footer(obfuscated=False, watermark="made with exopy", decompiled=False, key_hash: bytes = b"") -> bytes:
|
|
28
|
+
flags = 0x01 # compiled by exopy
|
|
29
|
+
if decompiled:
|
|
30
|
+
flags |= 0x02
|
|
31
|
+
if obfuscated:
|
|
32
|
+
flags |= 0x04
|
|
33
|
+
if key_hash:
|
|
34
|
+
flags |= 0x08
|
|
35
|
+
wm_bytes = str(watermark or "")[:200].encode("utf-8")
|
|
36
|
+
body = b"EXPY" + bytes([flags, len(wm_bytes)]) + wm_bytes + key_hash
|
|
37
|
+
return body + struct.pack("<H", len(body)) + b"YPXE"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Layer:
|
|
41
|
+
def __init__(self, layer_id: int, name: str, foreground_type: int = 0, parallax=(0.0, 0.0)):
|
|
42
|
+
self.layer_id, self.layer_name = int(layer_id), str(name)
|
|
43
|
+
self.selected = self.invisible = self.locked = self.fixed_size = False
|
|
44
|
+
self.foreground_type = int(foreground_type)
|
|
45
|
+
self.parallax = (float(parallax[0]), float(parallax[1]))
|
|
46
|
+
self.children = []
|
|
47
|
+
|
|
48
|
+
def _write_to(self, w: BinaryWriter):
|
|
49
|
+
w.write_i32(self.layer_id); w.write_str(self.layer_name)
|
|
50
|
+
w.write_bool(self.selected); w.write_bool(self.invisible); w.write_bool(self.locked)
|
|
51
|
+
w.write_i32(self.foreground_type); w.write_vec2(self.parallax); w.write_bool(self.fixed_size)
|
|
52
|
+
w.write_vec(self.children, w.write_i32)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class GameObject:
|
|
56
|
+
def __init__(self, obj_type, pos: tuple, level):
|
|
57
|
+
if isinstance(obj_type, int):
|
|
58
|
+
self.tile_id = obj_type
|
|
59
|
+
elif isinstance(obj_type, str) and obj_type.lower() in TILE_IDS:
|
|
60
|
+
self.tile_id = TILE_IDS[obj_type.lower()]
|
|
61
|
+
else:
|
|
62
|
+
raise ValueError(f"Unknown object '{obj_type}'. Valid: {list(TILE_IDS.keys())} or int tile_id")
|
|
63
|
+
self.entity_id = level._next_entity_id()
|
|
64
|
+
self.pos = (float(pos[0]), float(pos[1]))
|
|
65
|
+
self.scale = (1.0, 1.0)
|
|
66
|
+
self.rotation = 0.0
|
|
67
|
+
self.tag = ""
|
|
68
|
+
self.layer = level.layers[0].layer_id
|
|
69
|
+
self.properties = {}
|
|
70
|
+
self._level = level
|
|
71
|
+
|
|
72
|
+
def settings(self, cfg: dict):
|
|
73
|
+
for k, v in cfg.items():
|
|
74
|
+
if k == "Rotation": self.rotation = float(v)
|
|
75
|
+
elif k == "Scale": self.scale = (float(v[0]), float(v[1]))
|
|
76
|
+
elif k == "Tag": self.tag = str(v)
|
|
77
|
+
elif k == "Layer": self.layer = v.layer_id if isinstance(v, Layer) else int(v)
|
|
78
|
+
elif k == "Box":
|
|
79
|
+
hw, hh = float(v[0]) / 2.0, float(v[1]) / 2.0
|
|
80
|
+
self.properties["TerrainCorners"] = [[(-hw, -hh), (hw, -hh), (hw, hh), (-hw, hh)]]
|
|
81
|
+
elif k in OBJECT_PROPERTIES:
|
|
82
|
+
self.properties[k] = v
|
|
83
|
+
else:
|
|
84
|
+
raise ValueError(f"Unknown object property: '{k}'")
|
|
85
|
+
return self
|
|
86
|
+
|
|
87
|
+
def pack(self):
|
|
88
|
+
if self.tile_id == TILE_IDS["terrain"] and "TerrainCorners" not in self.properties:
|
|
89
|
+
self.properties["TerrainCorners"] = [[(-3.0, -1.0), (3.0, -1.0), (3.0, 1.0), (-3.0, 1.0)]]
|
|
90
|
+
self._level.objects.append(self)
|
|
91
|
+
layer = self._level._get_layer(self.layer)
|
|
92
|
+
if layer and self.entity_id not in layer.children:
|
|
93
|
+
layer.children.append(self.entity_id)
|
|
94
|
+
return self
|
|
95
|
+
|
|
96
|
+
def _write_to(self, w: BinaryWriter):
|
|
97
|
+
w.write_i32(self.entity_id); w.write_i32(self.tile_id)
|
|
98
|
+
w.write_i32(0); w.write_i32(0)
|
|
99
|
+
w.write_vec2(self.pos); w.write_vec2(self.scale); w.write_f32(self.rotation); w.write_str(self.tag)
|
|
100
|
+
w.write_i32(len(self.properties))
|
|
101
|
+
for name, val in self.properties.items():
|
|
102
|
+
pid, pt = OBJECT_PROPERTIES[name]
|
|
103
|
+
w.write_i32(pid)
|
|
104
|
+
if pt == "color": w.write_color(val)
|
|
105
|
+
elif pt == "i32": w.write_i32(val)
|
|
106
|
+
elif pt == "f32": w.write_f32(val)
|
|
107
|
+
elif pt == "bool": w.write_bool(val)
|
|
108
|
+
elif pt == "vec2": w.write_vec2(val)
|
|
109
|
+
elif pt == "str": w.write_str(val)
|
|
110
|
+
elif pt == "vi32": w.write_vec(val, w.write_i32)
|
|
111
|
+
elif pt == "tcorners": w.write_vec(val, lambda poly: w.write_vec(poly, w.write_vec2))
|
|
112
|
+
w.write_i32(self.layer); w.write_i32(0); w.write_vec([], w.write_i32)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class ExoLevel:
|
|
116
|
+
def __init__(self, name, bg_type="Mountains", laps=1, gravity=(0.0, -75.0), settings=None):
|
|
117
|
+
tk = str(bg_type).strip().lower()
|
|
118
|
+
if tk not in THEMES:
|
|
119
|
+
raise ValueError("bg_type must be Mountains, Halloween, Christmas, or Custom")
|
|
120
|
+
if not (1 <= int(laps) <= 10):
|
|
121
|
+
raise ValueError("laps must be 1..10")
|
|
122
|
+
|
|
123
|
+
self.settings = DEFAULT_SETTINGS.copy()
|
|
124
|
+
if settings:
|
|
125
|
+
self.settings.update(settings)
|
|
126
|
+
|
|
127
|
+
custom_uid = self.settings.get("uuid") or self.settings.get("UUID")
|
|
128
|
+
self.uuid = str(custom_uid) if custom_uid else str(uuid.uuid4())
|
|
129
|
+
self.name, self.theme, self.laps = str(name), THEMES[tk], int(laps)
|
|
130
|
+
self.gravity = (float(gravity[0]), float(gravity[1]))
|
|
131
|
+
self.custom_bg_color = parse_color(self.settings.get("CustomBackgroundColor", (0.0, 0.0, 0.0, 1.0)))
|
|
132
|
+
|
|
133
|
+
self.objects, self.layers, self.nova_scripts, self.global_variables = [], [Layer(1, "Layer 1")], [], []
|
|
134
|
+
self._eid = self._vid = self._sid = self._pid = 1
|
|
135
|
+
self._lid = 2
|
|
136
|
+
self._return_regs = {}
|
|
137
|
+
self._stdlib_cache = {}
|
|
138
|
+
|
|
139
|
+
def _next_entity_id(self): v = self._eid; self._eid += 1; return v
|
|
140
|
+
def _next_layer_id(self): v = self._lid; self._lid += 1; return v
|
|
141
|
+
def _next_var_id(self): v = self._vid; self._vid += 1; return v
|
|
142
|
+
def _next_script_id(self): v = self._sid; self._sid += 1; return v
|
|
143
|
+
def _next_param_id(self): v = self._pid; self._pid += 1; return v
|
|
144
|
+
def _get_layer(self, lid): return next((l for l in self.layers if l.layer_id == lid), None)
|
|
145
|
+
|
|
146
|
+
def _obfuscate_names(self):
|
|
147
|
+
def _mangle(seed):
|
|
148
|
+
return "_0x" + hashlib.md5(f"{self.uuid}:{seed}".encode()).hexdigest()[:6]
|
|
149
|
+
for idx, v in enumerate(self.global_variables):
|
|
150
|
+
v.name = _mangle(f"gv_{idx}_{v.variable_id}")
|
|
151
|
+
for idx, s in enumerate(self.nova_scripts):
|
|
152
|
+
s.script_name = _mangle(f"sc_{idx}_{s.script_id}")
|
|
153
|
+
for pi, p in enumerate(s.parameters):
|
|
154
|
+
p.name = _mangle(f"p_{idx}_{pi}_{p.parameter_id}")
|
|
155
|
+
for vi, lv in enumerate(s.variables):
|
|
156
|
+
lv.name = _mangle(f"lv_{idx}_{vi}_{lv.variable_id}")
|
|
157
|
+
|
|
158
|
+
def to_bytes(self) -> bytes:
|
|
159
|
+
w = BinaryWriter()
|
|
160
|
+
w.write_raw(b"NYA^")
|
|
161
|
+
w.write_i32(18); w.write_str(self.uuid); w.write_i32(1); w.write_str(self.name); w.write_str("")
|
|
162
|
+
w.write_datetime_now(); w.write_datetime_now()
|
|
163
|
+
w.write_i64(int(round(float(self.settings.get("AuthorTime", 0.0)) * 1000))); w.write_vec([], w.write_i64); w.write_i64(int(round(float(self.settings.get("Silver", 0.0)) * 1000))); w.write_i64(int(round(float(self.settings.get("Gold", 0.0)) * 1000)))
|
|
164
|
+
w.write_i32(self.laps); w.write_bool(self.settings["Private"]); w.write_bool(True)
|
|
165
|
+
w.write_str(self.uuid); w.write_i32(1); w.write_bool(True)
|
|
166
|
+
for _ in range(6): w.write_vec([], w.write_i32)
|
|
167
|
+
w.write_vec(self.objects, lambda o: o._write_to(w))
|
|
168
|
+
w.write_vec(self.layers, lambda l: l._write_to(w))
|
|
169
|
+
for _ in range(4): w.write_i32(0)
|
|
170
|
+
w.write_i64(int(round(float(self.settings.get("AuthorTime", 0.0)) * 1000))); w.write_vec([], w.write_i64); w.write_i64(int(round(float(self.settings.get("Silver", 0.0)) * 1000))); w.write_i64(int(round(float(self.settings.get("Gold", 0.0)) * 1000)))
|
|
171
|
+
w.write_i32(self.laps); w.write_bool(self.settings["CenterCamera"])
|
|
172
|
+
w.write_vec([], w.write_i32)
|
|
173
|
+
w.write_vec(self.nova_scripts, lambda s: s._write_to(w))
|
|
174
|
+
w.write_vec(self.global_variables, lambda v: v._write_to(w))
|
|
175
|
+
w.write_str(self.theme); w.write_color(self.custom_bg_color); w.write_raw(b"\x00\x00\x00\x00")
|
|
176
|
+
w.write_i32(0); w.write_vec2((0.0, 0.0)); w.write_vec2((0.0, 0.0))
|
|
177
|
+
w.write_color((0.0, 0.0, 0.0, 0.0)); w.write_color((0.0, 0.0, 0.0, 0.0)); w.write_i32(0)
|
|
178
|
+
w.write_color((0.0, 0.0, 0.0, 0.0)); w.write_f32(0.0); w.write_f32(0.0)
|
|
179
|
+
w.write_bool(False); w.write_bool(False); w.write_f32(0.0)
|
|
180
|
+
music = self.settings["music"]
|
|
181
|
+
if not music:
|
|
182
|
+
w.write_bool(True); w.write_vec([], w.write_str)
|
|
183
|
+
else:
|
|
184
|
+
w.write_bool(False); w.write_vec([music] if isinstance(music, str) else list(music), w.write_str)
|
|
185
|
+
w.write_bool(self.settings["AllowDirectionChange"])
|
|
186
|
+
w.write_bool(self.settings["DisableReplays"])
|
|
187
|
+
w.write_bool(self.settings["DisableRevivePads"])
|
|
188
|
+
w.write_bool(self.settings["DisableStartAnim"])
|
|
189
|
+
w.write_vec2(self.gravity)
|
|
190
|
+
w.write_i32(0)
|
|
191
|
+
return w.to_bytes()
|
|
192
|
+
|
|
193
|
+
def export(
|
|
194
|
+
self,
|
|
195
|
+
filepath: str,
|
|
196
|
+
compress: bool = True,
|
|
197
|
+
generator_mode: bool = None,
|
|
198
|
+
obfuscate: bool = None,
|
|
199
|
+
metadata_mode: str = "footer",
|
|
200
|
+
include_meta: bool = False,
|
|
201
|
+
):
|
|
202
|
+
obf = bool(self.settings.get("Obfuscate", False)) if obfuscate is None else bool(obfuscate)
|
|
203
|
+
from_dec = bool(self.settings.get("_ExopyDecompiled", False))
|
|
204
|
+
wm = "recompiled with exopy" if from_dec else "made with exopy"
|
|
205
|
+
|
|
206
|
+
key_hash = b""
|
|
207
|
+
if obf:
|
|
208
|
+
self._obfuscate_names()
|
|
209
|
+
secret_key = _get_or_create_key(self.uuid)
|
|
210
|
+
key_hash = hashlib.sha256(secret_key.encode("utf-8")).digest()[:8]
|
|
211
|
+
|
|
212
|
+
meta_obj = None
|
|
213
|
+
if metadata_mode == "object":
|
|
214
|
+
kh_part = f"|kh={key_hash.hex()}" if key_hash else ""
|
|
215
|
+
tag_val = f"EXOPY|obf={int(obf)}|dec={int(from_dec)}|wm={wm}{kh_part}"
|
|
216
|
+
meta_obj = GameObject("text", (90000019828.0, 90000019828.0), self).settings({
|
|
217
|
+
"Text": tag_val, "FontSize": 0.1, "Tag": "__EXOPY_META__",
|
|
218
|
+
}).pack()
|
|
219
|
+
|
|
220
|
+
raw_bytes = self.to_bytes()
|
|
221
|
+
if metadata_mode == "footer":
|
|
222
|
+
raw_bytes += _build_exopy_footer(obfuscated=obf, watermark=wm, decompiled=from_dec, key_hash=key_hash)
|
|
223
|
+
|
|
224
|
+
data = gzip.compress(raw_bytes) if compress else raw_bytes
|
|
225
|
+
with open(filepath, "wb") as f:
|
|
226
|
+
f.write(data)
|
|
227
|
+
|
|
228
|
+
if meta_obj is not None:
|
|
229
|
+
self.objects.remove(meta_obj)
|
|
230
|
+
|
|
231
|
+
fns = sum(1 for s in self.nova_scripts if s.is_function)
|
|
232
|
+
gen = _state.generator_mode if generator_mode is None else bool(generator_mode)
|
|
233
|
+
fname = os.path.basename(filepath)
|
|
234
|
+
result = {
|
|
235
|
+
"ok": True,
|
|
236
|
+
"path": filepath,
|
|
237
|
+
"uuid": self.uuid,
|
|
238
|
+
"counts": {
|
|
239
|
+
"objects": len(self.objects),
|
|
240
|
+
"scripts": len(self.nova_scripts),
|
|
241
|
+
"variables": len(self.global_variables),
|
|
242
|
+
},
|
|
243
|
+
}
|
|
244
|
+
if include_meta:
|
|
245
|
+
result["obfuscated"] = obf
|
|
246
|
+
result["watermark"] = wm
|
|
247
|
+
if gen:
|
|
248
|
+
return result
|
|
249
|
+
pass
|
|
250
|
+
return filepath
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def init(name, bg_type="Mountains", laps=1, gravity=(0.0, -75.0), settings=None):
|
|
254
|
+
_state.active_level = ExoLevel(name, bg_type, laps, gravity, settings)
|
|
255
|
+
return _state.active_level
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def CreateObj(name, pos: tuple):
|
|
259
|
+
return GameObject(name, pos, _state.get_level())
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def CreateLayer(name: str, foreground_type: int = 0, parallax=(0.0, 0.0)):
|
|
263
|
+
lvl = _state.get_level()
|
|
264
|
+
layer = Layer(lvl._next_layer_id(), name, foreground_type, parallax)
|
|
265
|
+
lvl.layers.append(layer)
|
|
266
|
+
return layer
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def set_generator_mode(enabled: bool = True):
|
|
270
|
+
_state.generator_mode = bool(enabled)
|
exopy/__main__.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import json, sys
|
|
2
|
+
from .decompile import decompile
|
|
3
|
+
|
|
4
|
+
flags = {a for a in sys.argv[1:] if a.startswith("--")}
|
|
5
|
+
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
|
6
|
+
as_json = "--json" in flags
|
|
7
|
+
show_meta = "--meta" in flags
|
|
8
|
+
|
|
9
|
+
if not args:
|
|
10
|
+
print("Usage: python -m exopy <file.exolvl> [output.py] [--json] [--meta]")
|
|
11
|
+
sys.exit(1)
|
|
12
|
+
|
|
13
|
+
res = decompile(
|
|
14
|
+
args[0],
|
|
15
|
+
args[1] if len(args) > 1 else None,
|
|
16
|
+
generator_mode=as_json,
|
|
17
|
+
include_meta=show_meta,
|
|
18
|
+
)
|
|
19
|
+
if as_json:
|
|
20
|
+
print(json.dumps({k: v for k, v in res.items() if k != "code"}, indent=2))
|
exopy/_state.py
ADDED
exopy/binary.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import struct, time
|
|
2
|
+
|
|
3
|
+
_CS_EPOCH_TICKS = 621355968000000000
|
|
4
|
+
_CS_KIND_UTC = 1 << 62
|
|
5
|
+
|
|
6
|
+
def parse_color(rgba):
|
|
7
|
+
if isinstance(rgba, str):
|
|
8
|
+
h = rgba.lstrip("#")
|
|
9
|
+
if len(h) == 6:
|
|
10
|
+
return (int(h[0:2],16)/255.0, int(h[2:4],16)/255.0, int(h[4:6],16)/255.0, 1.0)
|
|
11
|
+
if len(h) == 8:
|
|
12
|
+
return (int(h[0:2],16)/255.0, int(h[2:4],16)/255.0, int(h[4:6],16)/255.0, int(h[6:8],16)/255.0)
|
|
13
|
+
raise ValueError(f"Invalid hex color: {rgba}")
|
|
14
|
+
if len(rgba) == 3:
|
|
15
|
+
return (float(rgba[0]), float(rgba[1]), float(rgba[2]), 1.0)
|
|
16
|
+
return tuple(float(x) for x in rgba[:4])
|
|
17
|
+
|
|
18
|
+
class BinaryWriter:
|
|
19
|
+
def __init__(self): self.buf = bytearray()
|
|
20
|
+
def write_raw(self, b: bytes): self.buf.extend(b)
|
|
21
|
+
def write_u8(self, v: int): self.buf.extend(struct.pack("<B", int(v) & 0xFF))
|
|
22
|
+
def write_bool(self, v: bool): self.write_u8(1 if v else 0)
|
|
23
|
+
def write_i32(self, v: int): self.buf.extend(struct.pack("<i", int(v)))
|
|
24
|
+
def write_i64(self, v: int): self.buf.extend(struct.pack("<q", int(v)))
|
|
25
|
+
def write_f32(self, v: float): self.buf.extend(struct.pack("<f", float(v)))
|
|
26
|
+
def write_varint(self, v: int):
|
|
27
|
+
v = int(v)
|
|
28
|
+
while v >= 0x80:
|
|
29
|
+
self.write_u8((v & 0x7F) | 0x80)
|
|
30
|
+
v >>= 7
|
|
31
|
+
self.write_u8(v)
|
|
32
|
+
def write_str(self, s: str):
|
|
33
|
+
raw = str(s).encode("utf-8")
|
|
34
|
+
self.write_varint(len(raw))
|
|
35
|
+
self.buf.extend(raw)
|
|
36
|
+
def write_vec2(self, vec): self.write_f32(vec[0]); self.write_f32(vec[1])
|
|
37
|
+
def write_color(self, rgba):
|
|
38
|
+
for c in parse_color(rgba): self.write_f32(c)
|
|
39
|
+
def write_datetime_now(self):
|
|
40
|
+
ticks = int(time.time() * 10_000_000) + _CS_EPOCH_TICKS
|
|
41
|
+
self.write_i64(ticks | _CS_KIND_UTC)
|
|
42
|
+
def write_vec(self, items, fn):
|
|
43
|
+
self.write_i32(len(items))
|
|
44
|
+
for item in items: fn(item)
|
|
45
|
+
def write_option(self, val, fn):
|
|
46
|
+
if val is None: self.write_bool(False)
|
|
47
|
+
else: self.write_bool(True); fn(val)
|
|
48
|
+
def to_bytes(self) -> bytes: return bytes(self.buf)
|
exopy/constants.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
THEMES = {
|
|
2
|
+
"mountains": "mountains",
|
|
3
|
+
"halloween": "halloween",
|
|
4
|
+
"christmas": "christmas",
|
|
5
|
+
"custom": "custom",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
DEFAULT_SETTINGS = {
|
|
9
|
+
"music": None,
|
|
10
|
+
"AllowDirectionChange": False,
|
|
11
|
+
"DisableRevivePads": False,
|
|
12
|
+
"DisableStartAnim": False,
|
|
13
|
+
"DisableReplays": False,
|
|
14
|
+
"EnableSensors": False,
|
|
15
|
+
"DisableScreenRotation": False,
|
|
16
|
+
"CenterCamera": False,
|
|
17
|
+
"Private": False,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
TILE_IDS = {
|
|
21
|
+
"start": -1356673834,
|
|
22
|
+
"finish": -957301678,
|
|
23
|
+
"terrain": 1078723247,
|
|
24
|
+
"text": 589791300,
|
|
25
|
+
"rect": -1718767673,
|
|
26
|
+
"rect_outline": -168878848,
|
|
27
|
+
"sprite": 1718870758,
|
|
28
|
+
"booster": 968991814,
|
|
29
|
+
"pattern_quad": -319845761,
|
|
30
|
+
"arc": 2044847310,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
OBJECT_PROPERTIES = {
|
|
34
|
+
"Color": (0, "color"), "Resolution": (1, "i32"), "FillMode": (2, "i32"),
|
|
35
|
+
"SecondaryColor": (3, "color"), "Thickness": (4, "f32"), "TotalAngle": (5, "i32"),
|
|
36
|
+
"Corners": (6, "i32"), "Blending": (7, "i32"), "GridOffset": (8, "vec2"),
|
|
37
|
+
"CornerRadius": (9, "f32"), "Width": (10, "f32"), "Height": (11, "f32"),
|
|
38
|
+
"BorderColor": (12, "color"), "BorderThickness": (13, "f32"), "PhysicsType": (14, "i32"),
|
|
39
|
+
"Friction": (15, "f32"), "TerrainCorners": (16, "tcorners"), "Direction": (17, "i32"),
|
|
40
|
+
"Impulse": (18, "i32"), "Killer": (19, "bool"), "RoundReflexAngles": (20, "bool"),
|
|
41
|
+
"RoundCollider": (21, "bool"), "Radius": (22, "f32"), "Size": (23, "f32"),
|
|
42
|
+
"ReverseDirection": (24, "bool"), "CollisionDetector": (25, "bool"), "Pattern": (26, "i32"),
|
|
43
|
+
"PatternTiling": (27, "vec2"), "PatternOffset": (28, "vec2"), "Bounce": (32, "bool"),
|
|
44
|
+
"RestoreVelocity": (34, "bool"), "Sprite": (35, "str"), "Trigger": (36, "bool"),
|
|
45
|
+
"Health": (37, "f32"), "DamageFromJump": (38, "bool"), "DamageFromDash": (39, "bool"),
|
|
46
|
+
"ReverseDirOnDamage": (40, "bool"), "Floating": (41, "bool"), "LinkedObjects": (42, "vi32"),
|
|
47
|
+
"FlipX": (43, "bool"), "FlipY": (44, "bool"), "Text": (45, "str"),
|
|
48
|
+
"FontSize": (46, "f32"), "EditorColor": (47, "color"), "Color2": (48, "color"),
|
|
49
|
+
"Color3": (49, "color"), "Color4": (50, "color"), "ParticleTexture": (51, "str"),
|
|
50
|
+
"Duration": (52, "f32"), "Delay": (53, "f32"), "Loop": (54, "bool"),
|
|
51
|
+
"AutoPlay": (55, "bool"), "LifetimeMin": (56, "f32"), "LifetimeMax": (57, "f32"),
|
|
52
|
+
"SimulationSpace": (58, "i32"), "Rate": (59, "f32"), "Burst": (60, "i32"),
|
|
53
|
+
"EmitterShape": (61, "i32"), "EmitterWidth": (62, "f32"), "EmitterHeight": (63, "f32"),
|
|
54
|
+
"EmitterTotalAngle": (64, "f32"), "SizeMin": (65, "f32"), "SizeMax": (66, "f32"),
|
|
55
|
+
"SizeOverLifetime": (67, "bool"), "StartSizeMultiplier": (68, "f32"),
|
|
56
|
+
"EndSizeMultiplier": (69, "f32"), "SpeedMin": (71, "f32"), "SpeedMax": (72, "f32"),
|
|
57
|
+
"SpeedLimit": (73, "f32"), "SpeedDampen": (74, "f32"), "RotationMin": (75, "f32"),
|
|
58
|
+
"RotationMax": (76, "f32"), "RotationSpeed": (77, "f32"), "ColorOverLifetime": (78, "bool"),
|
|
59
|
+
"StartColorMultiplier": (79, "color"), "EndColorMultiplier": (80, "color"),
|
|
60
|
+
"GravityMultiplier": (81, "f32"), "AnchorPos": (82, "vec2"),
|
|
61
|
+
"MoonInnerRadius": (83, "f32"), "MoonOffset": (84, "f32"),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
class StaticType:
|
|
65
|
+
Bool, Int, Float, String, Color, Vector = 0, 1, 2, 3, 4, 5
|
|
66
|
+
Sound, Music, Object, ObjectSet, Transition = 6, 7, 8, 9, 10
|
|
67
|
+
Easing, Sprite, Script, Layer = 11, 12, 13, 14
|
|
68
|
+
|
|
69
|
+
class DynamicType:
|
|
70
|
+
BoolConstant, BoolVariable, BoolNot, BoolAnd, BoolOr = 0, 1, 2, 3, 4
|
|
71
|
+
BoolEqualBool, BoolEqualNumber, BoolNotEqualNumber = 5, 6, 12
|
|
72
|
+
BoolLess, BoolLessOrEqual, BoolGreater, BoolGreaterOrEqual = 17, 18, 19, 20
|
|
73
|
+
IntConstant, IntVariable = 38, 39
|
|
74
|
+
IntAdd, IntSubtract, IntMultiply, IntDivide, IntModulo = 40, 41, 42, 43, 44
|
|
75
|
+
IntRandom = 52
|
|
76
|
+
FloatConstant, FloatVariable = 56, 57
|
|
77
|
+
FloatAdd, FloatSubtract, FloatMultiply, FloatDivide = 58, 59, 60, 61
|
|
78
|
+
FloatVectorDistance = 85
|
|
79
|
+
StringConstant, StringVariable, StringFromInt, StringFromFloat, StringConcat = 94, 95, 96, 97, 98
|
|
80
|
+
ColorConstant, ColorVariable = 99, 101
|
|
81
|
+
VectorConstant, VectorVariable = 103, 105
|
|
82
|
+
VectorObjectPos, VectorObjectGlobalPos = 113, 114
|
|
83
|
+
SoundConstant, SoundVariable, MusicConstant, MusicVariable = 119, 120, 121, 122
|
|
84
|
+
ObjectConstant, ObjectVariable, ObjectPlayer = 123, 124, 132
|
|
85
|
+
ObjectSetConstant, ObjectSetVariable, ObjectSetPlayers, ObjectSetObjectsWithTag = 134, 135, 137, 138
|
|
86
|
+
TransitionConstant, TransitionVariable, EasingConstant, EasingVariable = 139, 140, 141, 142
|
|
87
|
+
FloatLevelTime = 145
|
|
88
|
+
SpriteConstant, SpriteVariable, ScriptConstant, ScriptVariable = 148, 149, 150, 151
|
|
89
|
+
# Function Parameter References
|
|
90
|
+
BoolParameter = 152
|
|
91
|
+
IntParameter = 153
|
|
92
|
+
FloatParameter = 154
|
|
93
|
+
StringParameter = 155
|
|
94
|
+
ColorParameter = 156
|
|
95
|
+
VectorParameter = 157
|
|
96
|
+
SoundParameter = 158
|
|
97
|
+
MusicParameter = 159
|
|
98
|
+
ObjectParameter = 160
|
|
99
|
+
ObjectSetParameter = 161
|
|
100
|
+
TransitionParameter = 162
|
|
101
|
+
EasingParameter = 163
|
|
102
|
+
SpriteParameter = 164
|
|
103
|
+
ScriptParameter = 165
|
|
104
|
+
LayerConstant, LayerVariable, LayerParameter = 177, 178, 179
|
|
105
|
+
VectorPointerPosition, VectorPointerWorldPosition = 186, 187
|
|
106
|
+
BoolPointerDown, BoolPointerHeld, BoolPointerReleased = 188, 189, 190
|
|
107
|
+
|
|
108
|
+
class ActionID:
|
|
109
|
+
Repeat, RepeatWhile, ConditionBlock, Wait, WaitFrames = 0, 1, 2, 3, 4
|
|
110
|
+
Move, Scale, Rotate, RotateAround = 5, 6, 7, 8
|
|
111
|
+
SetVariable, ResetVariable, ResetObject = 9, 10, 11
|
|
112
|
+
SetColor, SetTransparency, SetSecondaryColor, SetSecondaryTransparency = 12, 13, 14, 15
|
|
113
|
+
SetBorderColor, SetBorderTransparency, SetSprite, SetText, SetEnabled = 16, 17, 18, 19, 20
|
|
114
|
+
Activate, Deactivate, Damage, Kill, GameFinish = 21, 22, 23, 24, 25
|
|
115
|
+
CameraPan, CameraFollowPlayer, CameraZoom, CameraZoomReset = 26, 27, 28, 29
|
|
116
|
+
CameraOffset, CameraOffsetReset, CameraShake = 30, 31, 32
|
|
117
|
+
PlaySound, PlayMusic, SetDirection, SetGravity, SetVelocity = 33, 34, 35, 36, 37
|
|
118
|
+
SetCinematic, SetInputEnabled, SetTimerEnabled, GameTextShow = 38, 39, 40, 41
|
|
119
|
+
DialogueShow, StopScript, TransitionIn, TransitionOut, TimeScale = 42, 43, 44, 45, 46
|
|
120
|
+
RunFunction, SetVariableOverTime, RepeatForEachObject = 47, 48, 49
|
|
121
|
+
StopSound, PlayParticleSystem, StopParticleSystem = 50, 51, 52
|