4
4
import itertools
5
5
from typing import List , Dict , Any , cast
6
6
7
- from BaseClasses import Region , Entrance , Location , Item , Tutorial , ItemClassification
7
+ from BaseClasses import Region , Location , Item , Tutorial , ItemClassification
8
8
from worlds .AutoWorld import World , WebWorld
9
9
from . import items
10
10
from . import locations
@@ -42,14 +42,16 @@ class SubnauticaWorld(World):
42
42
43
43
item_name_to_id = {data .name : item_id for item_id , data in items .item_table .items ()}
44
44
location_name_to_id = all_locations
45
- option_definitions = options .option_definitions
46
-
45
+ options_dataclass = options .SubnauticaOptions
46
+ options : options . SubnauticaOptions
47
47
data_version = 10
48
48
required_client_version = (0 , 4 , 1 )
49
49
50
50
creatures_to_scan : List [str ]
51
51
52
52
def generate_early (self ) -> None :
53
+ if not self .options .filler_items_distribution .weights_pair [1 ][- 1 ]:
54
+ raise Exception ("Filler Items Distribution needs at least one positive weight." )
53
55
if self .options .early_seaglide :
54
56
self .multiworld .local_early_items [self .player ]["Seaglide Fragment" ] = 2
55
57
@@ -98,7 +100,7 @@ def create_regions(self):
98
100
planet_region
99
101
]
100
102
101
- # refer to Rules .py
103
+ # refer to rules .py
102
104
set_rules = set_rules
103
105
104
106
def create_items (self ):
@@ -129,7 +131,7 @@ def create_items(self):
129
131
extras -= group_amount
130
132
131
133
for item_name in self .random .sample (
132
- # list of high-count important fragments as priority filler
134
+ # list of high-count important fragments as priority filler
133
135
[
134
136
"Cyclops Engine Fragment" ,
135
137
"Cyclops Hull Fragment" ,
@@ -140,7 +142,7 @@ def create_items(self):
140
142
"Modification Station Fragment" ,
141
143
"Moonpool Fragment" ,
142
144
"Laser Cutter Fragment" ,
143
- ],
145
+ ],
144
146
k = min (extras , 9 )):
145
147
item = self .create_item (item_name )
146
148
pool .append (item )
@@ -176,7 +178,10 @@ def create_item(self, name: str) -> SubnauticaItem:
176
178
item_id , player = self .player )
177
179
178
180
def get_filler_item_name (self ) -> str :
179
- return item_table [self .multiworld .random .choice (items_by_type [ItemType .resource ])].name
181
+ item_names , cum_item_weights = self .options .filler_items_distribution .weights_pair
182
+ return self .random .choices (item_names ,
183
+ cum_weights = cum_item_weights ,
184
+ k = 1 )[0 ]
180
185
181
186
182
187
class SubnauticaLocation (Location ):
0 commit comments