1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add pit spawn points #34

This commit is contained in:
NG (Graham)
2025-09-13 17:36:35 -04:00
parent 82cc2dcf1b
commit c85d4bbc38
11 changed files with 2186 additions and 260 deletions

View File

@@ -193,6 +193,7 @@ LOGIN_MESSAGES = [
"Warning, live without warning\nI say, warning, live without warning\nWithout, all right",
"Spitzer Damn!",
"Stop Killing Games",
"Also check out RC15",
]
def guess_category(name: str, sprite: str) -> str:

84
utils/generate_sub_spawns.py Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/env python3
import json
import argparse
import requests
import urllib
def print_transform(child_json):
local_x = child_json["m_LocalPosition"]["m_X"]
local_y = child_json["m_LocalPosition"]["m_Y"]
local_z = child_json["m_LocalPosition"]["m_Z"]
rot_w = child_json["m_LocalRotation"]["m_W"]
rot_x = child_json["m_LocalRotation"]["m_X"]
rot_y = child_json["m_LocalRotation"]["m_Y"]
rot_z = child_json["m_LocalRotation"]["m_Z"]
# valid Rust code (to be inserted into a vec![here])
print(f"""SpawnPoint {{
team: None,
x: {local_x:.3f},
y: {local_y:.3f},
z: {local_z:.3f},
}}/*.with_rotation(num_quaternion::Quaternion {{
x: {rot_x:.6f},
y: {rot_y:.6f},
z: {rot_z:.6f},
w: {rot_w:.6f},
}})*/,""")
def gen_by_children(path: str, start: int, end: int):
path_json = json.loads(path)
url_path = str(path)
if "\"" in path:
url_path = urllib.parse.quote(path)
asset_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
asset_json = asset_resp.json()
if end is None:
end = len(asset_json["m_Children"])
for (i, child) in enumerate(asset_json["m_Children"][start:end]):
#print(i, child)
path_json["D"] = child["m_PathID"]
url_path = urllib.parse.quote(json.dumps(path_json))
child_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
child_json = child_resp.json()
print_transform(child_json)
def gen_by_mono(path: str, start: int, end: int):
path_json = json.loads(path)
url_path = str(path)
if "\"" in path:
url_path = urllib.parse.quote(path)
asset_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
asset_json = asset_resp.json()
points = asset_json["m_Structure"]["spawningPoints"]
if end is None:
end = len(points)
for (i, child) in enumerate(points):
#print(i, child)
path_json["D"] = child["m_PathID"]
url_path = urllib.parse.quote(json.dumps(path_json))
gameobj_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
gameobj_json = gameobj_resp.json()
path_json["D"] = gameobj_json["m_GameObject"]["m_PathID"]
url_path = urllib.parse.quote(json.dumps(path_json))
point_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
point_json = point_resp.json()
path_json["D"] = point_json["m_Components"][0]["m_Component"]["m_PathID"]
url_path = urllib.parse.quote(json.dumps(path_json))
child_resp = requests.get(f"http://127.0.0.1:38723/Assets/Json?Path={url_path}")
child_json = child_resp.json()
print_transform(child_json)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--start", type=int, default=0)
parser.add_argument("--end", type=int, default=None)
parser.add_argument("--mono", action='store_true')
parser.add_argument("initial_path")
args = parser.parse_args()
if args.mono:
# this works better
gen_by_mono(args.initial_path, args.start, args.end)
else:
# maybe for desperate measures
gen_by_children(args.initial_path, args.start, args.end)