Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subnautica: revamp filler item pool #1837

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions worlds/subnautica/Exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
sys.path.append(new_home)

from worlds.subnautica.Locations import Vector, location_table
from worlds.subnautica.Items import item_table, group_items
from worlds.subnautica.Items import item_table, group_items, items_by_type
from NetUtils import encode

export_folder = os.path.join(new_home, "Subnautica Export")
os.makedirs(export_folder, exist_ok=True)

def in_export_folder(path: str) -> str:
return os.path.join(export_folder, path)

payload = {location_id: location_data["position"] for location_id, location_data in location_table.items()}
with open("locations.json", "w") as f:
with open(in_export_folder("locations.json"), "w") as f:
json.dump(payload, f)

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

itemcount = sum(item_data["count"] for item_data in item_table.values())
itemcount = sum(item_data.count for item_data in item_table.values())
assert itemcount == len(location_table), f"{itemcount} != {len(location_table)}"
payload = {item_id: item_data["tech_type"] for item_id, item_data in item_table.items()}
payload = {item_id: item_data.tech_type for item_id, item_data in item_table.items()}
import json

with open("items.json", "w") as f:
with open(in_export_folder("items.json"), "w") as f:
json.dump(payload, f)
with open("group_items.json", "w") as f:

with open(in_export_folder("group_items.json"), "w") as f:
# encode to convert set to list
f.write(encode(group_items))

print(f"Subnautica exports dumped to {new_home}")
with open(in_export_folder("item_types.json"), "w") as f:
json.dump(items_by_type, f)

print(f"Subnautica exports dumped to {in_export_folder('')}")
Loading