Skip to content

Commit 73fb1b8

Browse files
authored
Subnautica: updates (#759)
* Subnautica: add more goals * Subnautica: fix wrongly positioned Databox * Subnautica: allow techs to remain vanilla * Subnautica: make zipimport compatible * Subnautica: force two Seaglide fragments into local sphere 1
1 parent 8e15fe5 commit 73fb1b8

File tree

9 files changed

+1067
-723
lines changed

9 files changed

+1067
-723
lines changed

Main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ def precollect_hint(location):
363363
for location in world.get_filled_locations():
364364
if type(location.address) == int:
365365
assert location.item.code is not None, "item code None should be event, " \
366-
"location.address should then also be None"
366+
"location.address should then also be None. Location: " \
367+
f" {location}"
367368
locations_data[location.player][location.address] = \
368369
location.item.code, location.item.player, location.item.flags
369370
if location.name in world.start_location_hints[location.player]:

worlds/subnautica/Items.py

+348-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,353 @@
1-
import json
2-
import os
3-
4-
with open(os.path.join(os.path.dirname(__file__), 'items.json'), 'r') as file:
5-
item_table = json.loads(file.read())
6-
7-
lookup_id_to_name = {}
8-
lookup_name_to_item = {}
9-
advancement_item_names = set()
10-
non_advancement_item_names = set()
11-
12-
for item in item_table:
13-
item_name = item["name"]
14-
lookup_id_to_name[item["id"]] = item_name
15-
lookup_name_to_item[item_name] = item
16-
if item["progression"]:
1+
from BaseClasses import ItemClassification
2+
from typing import TypedDict, Dict, Set
3+
4+
5+
class ItemDict(TypedDict):
6+
classification: ItemClassification
7+
count: int
8+
name: str
9+
tech_type: str
10+
11+
12+
item_table: Dict[int, ItemDict] = {
13+
35000: {'classification': ItemClassification.useful,
14+
'count': 1,
15+
'name': 'Compass',
16+
'tech_type': 'Compass'},
17+
35001: {'classification': ItemClassification.progression,
18+
'count': 1,
19+
'name': 'Lightweight High Capacity Tank',
20+
'tech_type': 'PlasteelTank'},
21+
35002: {'classification': ItemClassification.progression,
22+
'count': 1,
23+
'name': 'Vehicle Upgrade Console',
24+
'tech_type': 'BaseUpgradeConsole'},
25+
35003: {'classification': ItemClassification.progression,
26+
'count': 1,
27+
'name': 'Ultra Glide Fins',
28+
'tech_type': 'UltraGlideFins'},
29+
35004: {'classification': ItemClassification.useful,
30+
'count': 1,
31+
'name': 'Cyclops Sonar Upgrade',
32+
'tech_type': 'CyclopsSonarModule'},
33+
35005: {'classification': ItemClassification.useful,
34+
'count': 1,
35+
'name': 'Reinforced Dive Suit',
36+
'tech_type': 'ReinforcedDiveSuit'},
37+
35006: {'classification': ItemClassification.useful,
38+
'count': 1,
39+
'name': 'Cyclops Thermal Reactor Module',
40+
'tech_type': 'CyclopsThermalReactorModule'},
41+
35007: {'classification': ItemClassification.filler,
42+
'count': 1,
43+
'name': 'Stillsuit',
44+
'tech_type': 'Stillsuit'},
45+
35008: {'classification': ItemClassification.filler,
46+
'count': 2,
47+
'name': 'Alien Containment Fragment',
48+
'tech_type': 'BaseWaterParkFragment'},
49+
35009: {'classification': ItemClassification.useful,
50+
'count': 1,
51+
'name': 'Creature Decoy',
52+
'tech_type': 'CyclopsDecoy'},
53+
35010: {'classification': ItemClassification.useful,
54+
'count': 1,
55+
'name': 'Cyclops Fire Suppression System',
56+
'tech_type': 'CyclopsFireSuppressionModule'},
57+
35011: {'classification': ItemClassification.useful,
58+
'count': 1,
59+
'name': 'Swim Charge Fins',
60+
'tech_type': 'SwimChargeFins'},
61+
35012: {'classification': ItemClassification.useful,
62+
'count': 1,
63+
'name': 'Repulsion Cannon',
64+
'tech_type': 'RepulsionCannon'},
65+
35013: {'classification': ItemClassification.useful,
66+
'count': 1,
67+
'name': 'Cyclops Decoy Tube Upgrade',
68+
'tech_type': 'CyclopsDecoyModule'},
69+
35014: {'classification': ItemClassification.progression,
70+
'count': 1,
71+
'name': 'Cyclops Shield Generator',
72+
'tech_type': 'CyclopsShieldModule'},
73+
35015: {'classification': ItemClassification.progression,
74+
'count': 1,
75+
'name': 'Cyclops Depth Module MK1',
76+
'tech_type': 'CyclopsHullModule1'},
77+
35016: {'classification': ItemClassification.useful,
78+
'count': 1,
79+
'name': 'Cyclops Docking Bay Repair Module',
80+
'tech_type': 'CyclopsSeamothRepairModule'},
81+
35017: {'classification': ItemClassification.useful,
82+
'count': 2,
83+
'name': 'Battery Charger fragment',
84+
'tech_type': 'BatteryChargerFragment'},
85+
35018: {'classification': ItemClassification.filler,
86+
'count': 2,
87+
'name': 'Beacon Fragment',
88+
'tech_type': 'BeaconFragment'},
89+
35019: {'classification': ItemClassification.useful,
90+
'count': 2,
91+
'name': 'Bioreactor Fragment',
92+
'tech_type': 'BaseBioReactorFragment'},
93+
35020: {'classification': ItemClassification.progression,
94+
'count': 3,
95+
'name': 'Cyclops Bridge Fragment',
96+
'tech_type': 'CyclopsBridgeFragment'},
97+
35021: {'classification': ItemClassification.progression,
98+
'count': 3,
99+
'name': 'Cyclops Engine Fragment',
100+
'tech_type': 'CyclopsEngineFragment'},
101+
35022: {'classification': ItemClassification.progression,
102+
'count': 3,
103+
'name': 'Cyclops Hull Fragment',
104+
'tech_type': 'CyclopsHullFragment'},
105+
35023: {'classification': ItemClassification.filler,
106+
'count': 2,
107+
'name': 'Grav Trap Fragment',
108+
'tech_type': 'GravSphereFragment'},
109+
35024: {'classification': ItemClassification.progression,
110+
'count': 3,
111+
'name': 'Laser Cutter Fragment',
112+
'tech_type': 'LaserCutterFragment'},
113+
35025: {'classification': ItemClassification.filler,
114+
'count': 1,
115+
'name': 'Light Stick Fragment',
116+
'tech_type': 'TechlightFragment'},
117+
35026: {'classification': ItemClassification.progression,
118+
'count': 3,
119+
'name': 'Mobile Vehicle Bay Fragment',
120+
'tech_type': 'ConstructorFragment'},
121+
35027: {'classification': ItemClassification.progression,
122+
'count': 3,
123+
'name': 'Modification Station Fragment',
124+
'tech_type': 'WorkbenchFragment'},
125+
35028: {'classification': ItemClassification.progression,
126+
'count': 2,
127+
'name': 'Moonpool Fragment',
128+
'tech_type': 'MoonpoolFragment'},
129+
35029: {'classification': ItemClassification.useful,
130+
'count': 3,
131+
'name': 'Nuclear Reactor Fragment',
132+
'tech_type': 'BaseNuclearReactorFragment'},
133+
35030: {'classification': ItemClassification.useful,
134+
'count': 2,
135+
'name': 'Power Cell Charger Fragment',
136+
'tech_type': 'PowerCellChargerFragment'},
137+
35031: {'classification': ItemClassification.filler,
138+
'count': 1,
139+
'name': 'Power Transmitter Fragment',
140+
'tech_type': 'PowerTransmitterFragment'},
141+
35032: {'classification': ItemClassification.progression,
142+
'count': 4,
143+
'name': 'Prawn Suit Fragment',
144+
'tech_type': 'ExosuitFragment'},
145+
35033: {'classification': ItemClassification.useful,
146+
'count': 2,
147+
'name': 'Prawn Suit Drill Arm Fragment',
148+
'tech_type': 'ExosuitDrillArmFragment'},
149+
35034: {'classification': ItemClassification.useful,
150+
'count': 2,
151+
'name': 'Prawn Suit Grappling Arm Fragment',
152+
'tech_type': 'ExosuitGrapplingArmFragment'},
153+
35035: {'classification': ItemClassification.useful,
154+
'count': 2,
155+
'name': 'Prawn Suit Propulsion Cannon Fragment',
156+
'tech_type': 'ExosuitPropulsionArmFragment'},
157+
35036: {'classification': ItemClassification.useful,
158+
'count': 2,
159+
'name': 'Prawn Suit Torpedo Arm Fragment',
160+
'tech_type': 'ExosuitTorpedoArmFragment'},
161+
35037: {'classification': ItemClassification.useful,
162+
'count': 3,
163+
'name': 'Scanner Room Fragment',
164+
'tech_type': 'BaseMapRoomFragment'},
165+
35038: {'classification': ItemClassification.progression,
166+
'count': 5,
167+
'name': 'Seamoth Fragment',
168+
'tech_type': 'SeamothFragment'},
169+
35039: {'classification': ItemClassification.useful,
170+
'count': 2,
171+
'name': 'Stasis Rifle Fragment',
172+
'tech_type': 'StasisRifleFragment'},
173+
35040: {'classification': ItemClassification.useful,
174+
'count': 2,
175+
'name': 'Thermal Plant Fragment',
176+
'tech_type': 'ThermalPlantFragment'},
177+
35041: {'classification': ItemClassification.progression,
178+
'count': 2,
179+
'name': 'Seaglide Fragment',
180+
'tech_type': 'SeaglideFragment'},
181+
35042: {'classification': ItemClassification.progression,
182+
'count': 1,
183+
'name': 'Radiation Suit',
184+
'tech_type': 'RadiationSuit'},
185+
35043: {'classification': ItemClassification.progression,
186+
'count': 2,
187+
'name': 'Propulsion Cannon Fragment',
188+
'tech_type': 'PropulsionCannonFragment'},
189+
35044: {'classification': ItemClassification.progression,
190+
'count': 1,
191+
'name': 'Neptune Launch Platform',
192+
'tech_type': 'RocketBase'},
193+
35045: {'classification': ItemClassification.progression,
194+
'count': 1,
195+
'name': 'Ion Power Cell',
196+
'tech_type': 'PrecursorIonPowerCell'},
197+
35046: {'classification': ItemClassification.filler,
198+
'count': 2,
199+
'name': 'Exterior Growbed Fragment',
200+
'tech_type': 'FarmingTrayFragment'},
201+
35047: {'classification': ItemClassification.filler,
202+
'count': 1,
203+
'name': 'Picture Frame',
204+
'tech_type': 'PictureFrameFragment'},
205+
35048: {'classification': ItemClassification.filler,
206+
'count': 2,
207+
'name': 'Bench Fragment',
208+
'tech_type': 'BenchFragment'},
209+
35049: {'classification': ItemClassification.filler,
210+
'count': 1,
211+
'name': 'Basic Plant Pot',
212+
'tech_type': 'PlanterPotFragment'},
213+
35050: {'classification': ItemClassification.filler,
214+
'count': 1,
215+
'name': 'Interior Growbed',
216+
'tech_type': 'PlanterBoxFragment'},
217+
35051: {'classification': ItemClassification.filler,
218+
'count': 1,
219+
'name': 'Plant Shelf',
220+
'tech_type': 'PlanterShelfFragment'},
221+
35052: {'classification': ItemClassification.filler,
222+
'count': 2,
223+
'name': 'Observatory Fragment',
224+
'tech_type': 'BaseObservatoryFragment'},
225+
35053: {'classification': ItemClassification.filler,
226+
'count': 2,
227+
'name': 'Multipurpose Room Fragment',
228+
'tech_type': 'BaseRoomFragment'},
229+
35054: {'classification': ItemClassification.useful,
230+
'count': 2,
231+
'name': 'Bulkhead Fragment',
232+
'tech_type': 'BaseBulkheadFragment'},
233+
35055: {'classification': ItemClassification.filler,
234+
'count': 1,
235+
'name': 'Spotlight',
236+
'tech_type': 'Spotlight'},
237+
35056: {'classification': ItemClassification.filler,
238+
'count': 2,
239+
'name': 'Desk',
240+
'tech_type': 'StarshipDesk'},
241+
35057: {'classification': ItemClassification.filler,
242+
'count': 1,
243+
'name': 'Swivel Chair',
244+
'tech_type': 'StarshipChair'},
245+
35058: {'classification': ItemClassification.filler,
246+
'count': 1,
247+
'name': 'Office Chair',
248+
'tech_type': 'StarshipChair2'},
249+
35059: {'classification': ItemClassification.filler,
250+
'count': 1,
251+
'name': 'Command Chair',
252+
'tech_type': 'StarshipChair3'},
253+
35060: {'classification': ItemClassification.filler,
254+
'count': 2,
255+
'name': 'Counter',
256+
'tech_type': 'LabCounter'},
257+
35061: {'classification': ItemClassification.filler,
258+
'count': 1,
259+
'name': 'Single Bed',
260+
'tech_type': 'NarrowBed'},
261+
35062: {'classification': ItemClassification.filler,
262+
'count': 1,
263+
'name': 'Basic Double Bed',
264+
'tech_type': 'Bed1'},
265+
35063: {'classification': ItemClassification.filler,
266+
'count': 1,
267+
'name': 'Quilted Double Bed',
268+
'tech_type': 'Bed2'},
269+
35064: {'classification': ItemClassification.filler,
270+
'count': 2,
271+
'name': 'Coffee Vending Machine',
272+
'tech_type': 'CoffeeVendingMachine'},
273+
35065: {'classification': ItemClassification.filler,
274+
'count': 2,
275+
'name': 'Trash Can',
276+
'tech_type': 'Trashcans'},
277+
35066: {'classification': ItemClassification.filler,
278+
'count': 1,
279+
'name': 'Floodlight',
280+
'tech_type': 'Techlight'},
281+
35067: {'classification': ItemClassification.filler,
282+
'count': 1,
283+
'name': 'Bar Table',
284+
'tech_type': 'BarTable'},
285+
35068: {'classification': ItemClassification.filler,
286+
'count': 1,
287+
'name': 'Vending Machine',
288+
'tech_type': 'VendingMachine'},
289+
35069: {'classification': ItemClassification.filler,
290+
'count': 1,
291+
'name': 'Single Wall Shelf',
292+
'tech_type': 'SingleWallShelf'},
293+
35070: {'classification': ItemClassification.filler,
294+
'count': 1,
295+
'name': 'Wall Shelves',
296+
'tech_type': 'WallShelves'},
297+
35071: {'classification': ItemClassification.filler,
298+
'count': 1,
299+
'name': 'Round Plant Pot',
300+
'tech_type': 'PlanterPot2'},
301+
35072: {'classification': ItemClassification.filler,
302+
'count': 1,
303+
'name': 'Chic Plant Pot',
304+
'tech_type': 'PlanterPot3'},
305+
35073: {'classification': ItemClassification.filler,
306+
'count': 1,
307+
'name': 'Nuclear Waste Disposal',
308+
'tech_type': 'LabTrashcan'},
309+
35074: {'classification': ItemClassification.filler,
310+
'count': 1,
311+
'name': 'Wall Planter',
312+
'tech_type': 'BasePlanter'},
313+
35075: {'classification': ItemClassification.progression,
314+
'count': 1,
315+
'name': 'Ion Battery',
316+
'tech_type': 'PrecursorIonBattery'},
317+
35076: {'classification': ItemClassification.progression,
318+
'count': 1,
319+
'name': 'Neptune Gantry',
320+
'tech_type': 'RocketBaseLadder'},
321+
35077: {'classification': ItemClassification.progression,
322+
'count': 1,
323+
'name': 'Neptune Boosters',
324+
'tech_type': 'RocketStage1'},
325+
35078: {'classification': ItemClassification.progression,
326+
'count': 1,
327+
'name': 'Neptune Fuel Reserve',
328+
'tech_type': 'RocketStage2'},
329+
35079: {'classification': ItemClassification.progression,
330+
'count': 1,
331+
'name': 'Neptune Cockpit',
332+
'tech_type': 'RocketStage3'},
333+
35080: {'classification': ItemClassification.filler,
334+
'count': 1,
335+
'name': 'Water Filtration Machine',
336+
'tech_type': 'BaseFiltrationMachine'}}
337+
338+
advancement_item_names: Set[str] = set()
339+
non_advancement_item_names: Set[str] = set()
340+
341+
for item_id, item_data in item_table.items():
342+
item_name = item_data["name"]
343+
if ItemClassification.progression in item_data["classification"]:
17344
advancement_item_names.add(item_name)
18345
else:
19346
non_advancement_item_names.add(item_name)
20347

21-
lookup_id_to_name[None] = "Victory"
348+
if False: # turn to True to export for Subnautica mod
349+
payload = {item_id: item_data["tech_type"] for item_id, item_data in item_table.items()}
350+
import json
22351

23-
lookup_name_to_id = {name: id for id, name in lookup_id_to_name.items()}
352+
with open("items.json", "w") as f:
353+
json.dump(payload, f)

0 commit comments

Comments
 (0)