Add typed pair route contracts
This commit is contained in:
+56
-10
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import re
|
||||
from typing import Any, Callable
|
||||
|
||||
@@ -373,7 +374,27 @@ def default_man_hardcore_clothing_entries(
|
||||
return entries
|
||||
|
||||
|
||||
def resolve_hardcore_pair_clothing(
|
||||
@dataclass(frozen=True)
|
||||
class HardcorePairClothingRoute:
|
||||
access_flags: dict[str, bool]
|
||||
woman_access: str
|
||||
default_man_hardcore_clothing: list[str]
|
||||
hardcore_clothing_state: str
|
||||
hardcore_clothing_sentence: str
|
||||
requires_body_exposure_scene: bool
|
||||
|
||||
def as_dict(self) -> dict[str, Any]:
|
||||
return {
|
||||
"access_flags": dict(self.access_flags),
|
||||
"woman_access": self.woman_access,
|
||||
"default_man_hardcore_clothing": list(self.default_man_hardcore_clothing),
|
||||
"hardcore_clothing_state": self.hardcore_clothing_state,
|
||||
"hardcore_clothing_sentence": self.hardcore_clothing_sentence,
|
||||
"requires_body_exposure_scene": self.requires_body_exposure_scene,
|
||||
}
|
||||
|
||||
|
||||
def resolve_hardcore_pair_clothing_result(
|
||||
*,
|
||||
hard_row: dict[str, Any],
|
||||
mode: str,
|
||||
@@ -384,7 +405,7 @@ def resolve_hardcore_pair_clothing(
|
||||
rng: Any,
|
||||
continuity_map: dict[str, str],
|
||||
choose: Callable[[Any, list[str]], str],
|
||||
) -> dict[str, Any]:
|
||||
) -> HardcorePairClothingRoute:
|
||||
access_flags = hardcore_row_access_flags(hard_row)
|
||||
woman_access = "lower" if access_flags["woman_lower"] else "upper" if access_flags["woman_upper"] else ""
|
||||
default_man_entries = default_man_hardcore_clothing_entries(
|
||||
@@ -412,14 +433,39 @@ def resolve_hardcore_pair_clothing(
|
||||
if str(part or "").strip()
|
||||
]
|
||||
hard_clothing_state = "; ".join(hard_clothing_parts)
|
||||
return {
|
||||
"access_flags": access_flags,
|
||||
"woman_access": woman_access,
|
||||
"default_man_hardcore_clothing": default_man_entries,
|
||||
"hardcore_clothing_state": hard_clothing_state,
|
||||
"hardcore_clothing_sentence": f"{hard_clothing_state}. " if hard_clothing_state else "",
|
||||
"requires_body_exposure_scene": (
|
||||
return HardcorePairClothingRoute(
|
||||
access_flags=access_flags,
|
||||
woman_access=woman_access,
|
||||
default_man_hardcore_clothing=default_man_entries,
|
||||
hardcore_clothing_state=hard_clothing_state,
|
||||
hardcore_clothing_sentence=f"{hard_clothing_state}. " if hard_clothing_state else "",
|
||||
requires_body_exposure_scene=(
|
||||
"body is fully exposed" in hard_clothing_state.lower()
|
||||
or "bare skin unobstructed" in hard_clothing_state.lower()
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def resolve_hardcore_pair_clothing(
|
||||
*,
|
||||
hard_row: dict[str, Any],
|
||||
mode: str,
|
||||
softcore_outfit: str,
|
||||
character_hardcore_clothing_entries: list[str],
|
||||
men_count: int,
|
||||
pov_labels: list[str] | None,
|
||||
rng: Any,
|
||||
continuity_map: dict[str, str],
|
||||
choose: Callable[[Any, list[str]], str],
|
||||
) -> dict[str, Any]:
|
||||
return resolve_hardcore_pair_clothing_result(
|
||||
hard_row=hard_row,
|
||||
mode=mode,
|
||||
softcore_outfit=softcore_outfit,
|
||||
character_hardcore_clothing_entries=character_hardcore_clothing_entries,
|
||||
men_count=men_count,
|
||||
pov_labels=pov_labels,
|
||||
rng=rng,
|
||||
continuity_map=continuity_map,
|
||||
choose=choose,
|
||||
).as_dict()
|
||||
|
||||
Reference in New Issue
Block a user