Skip to content

Commit 4e69a72

Browse files
authored
Merge branch 'main' into client-cleanup
2 parents e4f50e8 + fb9026d commit 4e69a72

File tree

97 files changed

+2459
-2077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2459
-2077
lines changed

.dockerignore

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
.git
2+
.github
3+
.run
4+
docs
5+
test
6+
typings
7+
*Client.py
8+
9+
.idea
10+
.vscode
11+
12+
*_Spoiler.txt
13+
*.bmbp
14+
*.apbp
15+
*.apl2ac
16+
*.apm3
17+
*.apmc
18+
*.apz5
19+
*.aptloz
20+
*.apemerald
21+
*.pyc
22+
*.pyd
23+
*.sfc
24+
*.z64
25+
*.n64
26+
*.nes
27+
*.smc
28+
*.sms
29+
*.gb
30+
*.gbc
31+
*.gba
32+
*.wixobj
33+
*.lck
34+
*.db3
35+
*multidata
36+
*multisave
37+
*.archipelago
38+
*.apsave
39+
*.BIN
40+
*.puml
41+
42+
setups
43+
build
44+
bundle/components.wxs
45+
dist
46+
/prof/
47+
README.html
48+
.vs/
49+
EnemizerCLI/
50+
/Players/
51+
/SNI/
52+
/sni-*/
53+
/appimagetool*
54+
/host.yaml
55+
/options.yaml
56+
/config.yaml
57+
/logs/
58+
_persistent_storage.yaml
59+
mystery_result_*.yaml
60+
*-errors.txt
61+
success.txt
62+
output/
63+
Output Logs/
64+
/factorio/
65+
/Minecraft Forge Server/
66+
/WebHostLib/static/generated
67+
/freeze_requirements.txt
68+
/Archipelago.zip
69+
/setup.ini
70+
/installdelete.iss
71+
/data/user.kv
72+
/datapackage
73+
/custom_worlds
74+
75+
# Byte-compiled / optimized / DLL files
76+
__pycache__/
77+
*.py[cod]
78+
*$py.class
79+
80+
# C extensions
81+
*.so
82+
*.dll
83+
84+
# Distribution / packaging
85+
.Python
86+
build/
87+
develop-eggs/
88+
dist/
89+
downloads/
90+
eggs/
91+
.eggs/
92+
lib/
93+
lib64/
94+
parts/
95+
sdist/
96+
var/
97+
wheels/
98+
share/python-wheels/
99+
*.egg-info/
100+
.installed.cfg
101+
*.egg
102+
MANIFEST
103+
104+
# Installer logs
105+
pip-log.txt
106+
pip-delete-this-directory.txt
107+
installer.log
108+
109+
# Unit test / coverage reports
110+
htmlcov/
111+
.tox/
112+
.nox/
113+
.coverage
114+
.coverage.*
115+
.cache
116+
nosetests.xml
117+
coverage.xml
118+
*.cover
119+
*.py,cover
120+
.hypothesis/
121+
.pytest_cache/
122+
cover/
123+
124+
125+
# Flask stuff:
126+
instance/
127+
.webassets-cache
128+
129+
# Scrapy stuff:
130+
.scrapy
131+
132+
# Sphinx documentation
133+
docs/_build/
134+
135+
# PyBuilder
136+
.pybuilder/
137+
target/
138+
139+
# Jupyter Notebook
140+
.ipynb_checkpoints
141+
142+
# IPython
143+
profile_default/
144+
ipython_config.py
145+
146+
# vim editor
147+
*.swp
148+
149+
# SageMath parsed files
150+
*.sage.py
151+
152+
# Environments
153+
.env
154+
.venv*
155+
env/
156+
venv/
157+
/venv*/
158+
ENV/
159+
env.bak/
160+
venv.bak/
161+
*.code-workspace
162+
shell.nix
163+
164+
# Spyder project settings
165+
.spyderproject
166+
.spyproject
167+
168+
# Rope project settings
169+
.ropeproject
170+
171+
# mkdocs documentation
172+
/site
173+
174+
# mypy
175+
.mypy_cache/
176+
.dmypy.json
177+
dmypy.json
178+
179+
# Pyre type checker
180+
.pyre/
181+
182+
# pytype static type analyzer
183+
.pytype/
184+
185+
# Cython debug symbols
186+
cython_debug/
187+
188+
# Cython intermediates
189+
_speedups.c
190+
_speedups.cpp
191+
_speedups.html
192+
193+
# minecraft server stuff
194+
jdk*/
195+
minecraft*/
196+
minecraft_versions.json
197+
!worlds/minecraft/
198+
199+
# pyenv
200+
.python-version
201+
202+
#undertale stuff
203+
/Undertale/
204+
205+
# OS General Files
206+
.DS_Store
207+
.AppleDouble
208+
.LSOverride
209+
Thumbs.db
210+
[Dd]esktop.ini

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
shell: bash
9999
run: |
100100
cd build/exe*
101-
cp Players/Templates/Clique.yaml Players/
101+
cp Players/Templates/VVVVVV.yaml Players/
102102
timeout 30 ./ArchipelagoGenerate
103103
- name: Store 7z
104104
uses: actions/upload-artifact@v4
@@ -189,7 +189,7 @@ jobs:
189189
shell: bash
190190
run: |
191191
cd build/exe*
192-
cp Players/Templates/Clique.yaml Players/
192+
cp Players/Templates/VVVVVV.yaml Players/
193193
timeout 30 ./ArchipelagoGenerate
194194
- name: Store AppImage
195195
uses: actions/upload-artifact@v4

BaseClasses.py

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import random
77
import secrets
8+
import warnings
89
from argparse import Namespace
910
from collections import Counter, deque
1011
from collections.abc import Collection, MutableSequence
@@ -438,12 +439,27 @@ def get_entrance(self, entrance_name: str, player: int) -> Entrance:
438439
def get_location(self, location_name: str, player: int) -> Location:
439440
return self.regions.location_cache[player][location_name]
440441

441-
def get_all_state(self, use_cache: bool, allow_partial_entrances: bool = False,
442+
def get_all_state(self, use_cache: bool | None = None, allow_partial_entrances: bool = False,
442443
collect_pre_fill_items: bool = True, perform_sweep: bool = True) -> CollectionState:
443-
cached = getattr(self, "_all_state", None)
444-
if use_cache and cached:
445-
return cached.copy()
446-
444+
"""
445+
Creates a new CollectionState, and collects all precollected items, all items in the multiworld itempool, those
446+
specified in each worlds' `get_pre_fill_items()`, and then sweeps the multiworld collecting any other items
447+
it is able to reach, building as complete of a completed game state as possible.
448+
449+
:param use_cache: Deprecated and unused.
450+
:param allow_partial_entrances: Whether the CollectionState should allow for disconnected entrances while
451+
sweeping, such as before entrance randomization is complete.
452+
:param collect_pre_fill_items: Whether the items in each worlds' `get_pre_fill_items()` should be added to this
453+
state.
454+
:param perform_sweep: Whether this state should perform a sweep for reachable locations, collecting any placed
455+
items it can.
456+
457+
:return: The completed CollectionState.
458+
"""
459+
if __debug__ and use_cache is not None:
460+
# TODO swap to Utils.deprecate when we want this to crash on source and warn on frozen
461+
warnings.warn("multiworld.get_all_state no longer caches all_state and this argument will be removed.",
462+
DeprecationWarning)
447463
ret = CollectionState(self, allow_partial_entrances)
448464

449465
for item in self.itempool:
@@ -456,8 +472,6 @@ def get_all_state(self, use_cache: bool, allow_partial_entrances: bool = False,
456472
if perform_sweep:
457473
ret.sweep_for_advancements()
458474

459-
if use_cache:
460-
self._all_state = ret
461475
return ret
462476

463477
def get_items(self) -> List[Item]:
@@ -706,6 +720,12 @@ def all_done() -> bool:
706720
sphere.append(locations.pop(n))
707721

708722
if not sphere:
723+
if __debug__:
724+
from Fill import FillError
725+
raise FillError(
726+
f"Could not access required locations for accessibility check. Missing: {locations}",
727+
multiworld=self,
728+
)
709729
# ran out of places and did not finish yet, quit
710730
logging.warning(f"Could not access required locations for accessibility check."
711731
f" Missing: {locations}")
@@ -1150,13 +1170,13 @@ def __init__(self, region_manager: MultiWorld.RegionManager):
11501170
self.region_manager = region_manager
11511171

11521172
def __getitem__(self, index: int) -> Location:
1153-
return self._list.__getitem__(index)
1173+
return self._list[index]
11541174

11551175
def __setitem__(self, index: int, value: Location) -> None:
11561176
raise NotImplementedError()
11571177

11581178
def __len__(self) -> int:
1159-
return self._list.__len__()
1179+
return len(self._list)
11601180

11611181
def __iter__(self):
11621182
return iter(self._list)
@@ -1170,8 +1190,8 @@ def copy(self):
11701190

11711191
class LocationRegister(Register):
11721192
def __delitem__(self, index: int) -> None:
1173-
location: Location = self._list.__getitem__(index)
1174-
self._list.__delitem__(index)
1193+
location: Location = self._list[index]
1194+
del self._list[index]
11751195
del(self.region_manager.location_cache[location.player][location.name])
11761196

11771197
def insert(self, index: int, value: Location) -> None:
@@ -1182,8 +1202,8 @@ def insert(self, index: int, value: Location) -> None:
11821202

11831203
class EntranceRegister(Register):
11841204
def __delitem__(self, index: int) -> None:
1185-
entrance: Entrance = self._list.__getitem__(index)
1186-
self._list.__delitem__(index)
1205+
entrance: Entrance = self._list[index]
1206+
del self._list[index]
11871207
del(self.region_manager.entrance_cache[entrance.player][entrance.name])
11881208

11891209
def insert(self, index: int, value: Entrance) -> None:
@@ -1430,27 +1450,43 @@ def hint_text(self) -> str:
14301450

14311451

14321452
class ItemClassification(IntFlag):
1433-
filler = 0b0000
1453+
filler = 0b00000
14341454
""" aka trash, as in filler items like ammo, currency etc """
14351455

1436-
progression = 0b0001
1456+
progression = 0b00001
14371457
""" Item that is logically relevant.
14381458
Protects this item from being placed on excluded or unreachable locations. """
14391459

1440-
useful = 0b0010
1460+
useful = 0b00010
14411461
""" Item that is especially useful.
14421462
Protects this item from being placed on excluded or unreachable locations.
14431463
When combined with another flag like "progression", it means "an especially useful progression item". """
14441464

1445-
trap = 0b0100
1465+
trap = 0b00100
14461466
""" Item that is detrimental in some way. """
14471467

1448-
skip_balancing = 0b1000
1468+
skip_balancing = 0b01000
14491469
""" should technically never occur on its own
14501470
Item that is logically relevant, but progression balancing should not touch.
1451-
Typically currency or other counted items. """
1452-
1453-
progression_skip_balancing = 0b1001 # only progression gets balanced
1471+
1472+
Possible reasons for why an item should not be pulled ahead by progression balancing:
1473+
1. This item is quite insignificant, so pulling it earlier doesn't help (currency/etc.)
1474+
2. It is important for the player experience that this item is evenly distributed in the seed (e.g. goal items) """
1475+
1476+
deprioritized = 0b10000
1477+
""" Should technically never occur on its own.
1478+
Will not be considered for priority locations,
1479+
unless Priority Locations Fill runs out of regular progression items before filling all priority locations.
1480+
1481+
Should be used for items that would feel bad for the player to find on a priority location.
1482+
Usually, these are items that are plentiful or insignificant. """
1483+
1484+
progression_deprioritized_skip_balancing = 0b11001
1485+
""" Since a common case of both skip_balancing and deprioritized is "insignificant progression",
1486+
these items often want both flags. """
1487+
1488+
progression_skip_balancing = 0b01001 # only progression gets balanced
1489+
progression_deprioritized = 0b10001 # only progression can be placed during priority fill
14541490

14551491
def as_flag(self) -> int:
14561492
"""As Network API flag int."""
@@ -1498,6 +1534,10 @@ def useful(self) -> bool:
14981534
def trap(self) -> bool:
14991535
return ItemClassification.trap in self.classification
15001536

1537+
@property
1538+
def deprioritized(self) -> bool:
1539+
return ItemClassification.deprioritized in self.classification
1540+
15011541
@property
15021542
def filler(self) -> bool:
15031543
return not (self.advancement or self.useful or self.trap)

0 commit comments

Comments
 (0)