mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
Subnautica: filler items distribution (#3104)
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
import typing
|
||||
from dataclasses import dataclass
|
||||
from functools import cached_property
|
||||
|
||||
from Options import (
|
||||
Choice,
|
||||
Range,
|
||||
DeathLink,
|
||||
Toggle,
|
||||
DefaultOnToggle,
|
||||
StartInventoryPool,
|
||||
ItemDict,
|
||||
PerGameCommonOptions,
|
||||
)
|
||||
|
||||
from Options import Choice, Range, DeathLink, Toggle, DefaultOnToggle, StartInventoryPool
|
||||
from .creatures import all_creatures, Definitions
|
||||
from .items import ItemType, item_names_by_type
|
||||
|
||||
|
||||
class SwimRule(Choice):
|
||||
@@ -103,13 +116,28 @@ class SubnauticaDeathLink(DeathLink):
|
||||
Note: can be toggled via in-game console command "deathlink"."""
|
||||
|
||||
|
||||
option_definitions = {
|
||||
"swim_rule": SwimRule,
|
||||
"early_seaglide": EarlySeaglide,
|
||||
"free_samples": FreeSamples,
|
||||
"goal": Goal,
|
||||
"creature_scans": CreatureScans,
|
||||
"creature_scan_logic": AggressiveScanLogic,
|
||||
"death_link": SubnauticaDeathLink,
|
||||
"start_inventory_from_pool": StartInventoryPool,
|
||||
}
|
||||
class FillerItemsDistribution(ItemDict):
|
||||
"""Random chance weights of various filler resources that can be obtained.
|
||||
Available items: """
|
||||
__doc__ += ", ".join(f"\"{item_name}\"" for item_name in item_names_by_type[ItemType.resource])
|
||||
_valid_keys = frozenset(item_names_by_type[ItemType.resource])
|
||||
default = {item_name: 1 for item_name in item_names_by_type[ItemType.resource]}
|
||||
display_name = "Filler Items Distribution"
|
||||
|
||||
@cached_property
|
||||
def weights_pair(self) -> typing.Tuple[typing.List[str], typing.List[int]]:
|
||||
from itertools import accumulate
|
||||
return list(self.value.keys()), list(accumulate(self.value.values()))
|
||||
|
||||
|
||||
@dataclass
|
||||
class SubnauticaOptions(PerGameCommonOptions):
|
||||
swim_rule: SwimRule
|
||||
early_seaglide: EarlySeaglide
|
||||
free_samples: FreeSamples
|
||||
goal: Goal
|
||||
creature_scans: CreatureScans
|
||||
creature_scan_logic: AggressiveScanLogic
|
||||
death_link: SubnauticaDeathLink
|
||||
start_inventory_from_pool: StartInventoryPool
|
||||
filler_items_distribution: FillerItemsDistribution
|
||||
|
Reference in New Issue
Block a user