Skip to content

Commit 532c4c0

Browse files
committed
Subnautica: revamp filler item pool
1 parent b077b2a commit 532c4c0

File tree

4 files changed

+203
-396
lines changed

4 files changed

+203
-396
lines changed

worlds/subnautica/Exports.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@
1313
sys.path.append(new_home)
1414

1515
from worlds.subnautica.Locations import Vector, location_table
16-
from worlds.subnautica.Items import item_table, group_items
16+
from worlds.subnautica.Items import item_table, group_items, items_by_type
1717
from NetUtils import encode
1818

19+
export_folder = os.path.join(new_home, "Subnautica Export")
20+
os.makedirs(export_folder, exist_ok=True)
21+
22+
def in_export_folder(path: str) -> str:
23+
return os.path.join(export_folder, path)
24+
1925
payload = {location_id: location_data["position"] for location_id, location_data in location_table.items()}
20-
with open("locations.json", "w") as f:
26+
with open(in_export_folder("locations.json"), "w") as f:
2127
json.dump(payload, f)
2228

2329
# copy-paste from Rules
@@ -49,17 +55,22 @@ def far_away(pos: Vector):
4955
"751": [location_id for location_id, location_data
5056
in location_table.items() if far_away(location_data["position"])],
5157
}
52-
with open("logic.json", "w") as f:
58+
with open(in_export_folder("logic.json"), "w") as f:
5359
json.dump(payload, f)
5460

55-
itemcount = sum(item_data["count"] for item_data in item_table.values())
61+
itemcount = sum(item_data.count for item_data in item_table.values())
5662
assert itemcount == len(location_table), f"{itemcount} != {len(location_table)}"
57-
payload = {item_id: item_data["tech_type"] for item_id, item_data in item_table.items()}
63+
payload = {item_id: item_data.tech_type for item_id, item_data in item_table.items()}
5864
import json
5965

60-
with open("items.json", "w") as f:
66+
with open(in_export_folder("items.json"), "w") as f:
6167
json.dump(payload, f)
62-
with open("group_items.json", "w") as f:
68+
69+
with open(in_export_folder("group_items.json"), "w") as f:
70+
# encode to convert set to list
6371
f.write(encode(group_items))
6472

65-
print(f"Subnautica exports dumped to {new_home}")
73+
with open(in_export_folder("item_types.json"), "w") as f:
74+
json.dump(items_by_type, f)
75+
76+
print(f"Subnautica exports dumped to {in_export_folder('')}")

0 commit comments

Comments
 (0)