Files
NodeCames/src/main/apworld/world.py
T
2026-09-26 02:15:02 +02:00

63 lines
1.7 KiB
Python

from collections.abc import Mapping
from typing import Any
from worlds.AutoWorld import World
from . import items, locations, regions, rules
from . import options as nodecames_options
class NodecamesWorld(World):
"""
Nodecames is a word game, inspired by Code Names by Vlaada Chvátil
"""
game = "Nodecames"
options_dataclass = nodecames_options.NodecamesOptions
options: nodecames_options.NodecamesOptions
location_name_to_id = locations.LOCATION_NAME_TO_ID
item_name_to_id = items.ITEM_NAME_TO_ID
origin_region_name = "Overworld"
def create_regions(self) -> None:
regions.create_and_connect_regions(self)
locations.create_all_locations(self)
def set_rules(self) -> None:
rules.set_all_rules(self)
def create_items(self) -> None:
items.create_all_items(self)
# Create an item from name
def create_item(self, name: str) -> items.NodecamesItem:
return items.create_item_with_correct_classification(self, name)
# Create one filler item
def get_filler_item_name(self) -> str:
return items.get_random_filler_item_name(self)
# Data sent to the client
def fill_slot_data(self) -> Mapping[str, Any]:
return self.options.as_dict(
"worlds_locked",
"start_hint_count",
"max_hint_count",
"start_hint_length",
"max_hint_length",
"zero_hint",
"infinity_hint",
"one_more_guess",
"end_guessing",
"only_one_green_green",
"sudden_death",
"structured_grid",
"hints_in_a_row",
"anyone_starts",
"world_count",
"victory_condition",
)