Changed an attribute name to avoid confusion
This commit is contained in:
@ -233,7 +233,7 @@ class ExpansionsManager:
|
||||
Manager of the availability of the expansions.
|
||||
|
||||
Attributes:
|
||||
includedExpansions: tuple of str
|
||||
includeExpansions: tuple of str
|
||||
Container of the expansions to try making available
|
||||
activeExpansions: dict of Expansion
|
||||
Container of the relevent expansions
|
||||
@ -248,7 +248,7 @@ class ExpansionsManager:
|
||||
# (attributed players / types)
|
||||
# TODO Allow to get a list of expansions with a specific tag/player
|
||||
|
||||
def __init__(self, playersManager: PlayersManager, includedExpansions: tuple[str]=None):
|
||||
def __init__(self, playersManager: PlayersManager, includeExpansions: tuple[str]=None):
|
||||
"""
|
||||
Arguments:
|
||||
tryInclude: bool=False, tryActivate: bool=False
|
||||
@ -257,10 +257,10 @@ class ExpansionsManager:
|
||||
self.playersManager = playersManager
|
||||
self._playersLookUp = {}
|
||||
self._cfg = playersManager.config["expansions"]
|
||||
if includedExpansions is not None:
|
||||
self._includedExpansions = tuple(includedExpansions)
|
||||
if includeExpansions is not None:
|
||||
self._includeExpansions = tuple(includeExpansions)
|
||||
else:
|
||||
self._includedExpansions = ()
|
||||
self._includeExpansions = ()
|
||||
# Convert the required lists into tuples
|
||||
for expansionID in self._cfg["expansions"]:
|
||||
for key in self.keysConvert2Tuple:
|
||||
@ -288,18 +288,18 @@ class ExpansionsManager:
|
||||
return f"ExpansionsManager has {len(self._activeExpansions)} active expansions"
|
||||
|
||||
@property
|
||||
def includedExpansions(self):
|
||||
def includeExpansions(self):
|
||||
""" Dictionnary of the included expansions. """
|
||||
return self._includedExpansions
|
||||
return self._includeExpansions
|
||||
|
||||
@includedExpansions.setter
|
||||
def includedExpansions(self, newIncluded: tuple[str]):
|
||||
self._includedExpansions = tuple(newIncluded)
|
||||
@includeExpansions.setter
|
||||
def includeExpansions(self, newIncluded: tuple[str]):
|
||||
self._includeExpansions = tuple(newIncluded)
|
||||
self._includeChanged()
|
||||
|
||||
@includedExpansions.deleter
|
||||
def includedExpansions(self):
|
||||
self._includedExpansions = ()
|
||||
@includeExpansions.deleter
|
||||
def includeExpansions(self):
|
||||
self._includeExpansions = ()
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
@ -319,7 +319,7 @@ class ExpansionsManager:
|
||||
"""
|
||||
activePlayers = set(self.playersManager.keys())
|
||||
possiblyValidExpansions = [
|
||||
expansionID for expansionID in self._includedExpansions
|
||||
expansionID for expansionID in self._includeExpansions
|
||||
if hasattr(expansionsLib, self._getClassFillMissing(expansionID)) and
|
||||
not self._getPlayersFillMissing(expansionID).isdisjoint(activePlayers)
|
||||
]
|
||||
@ -352,7 +352,7 @@ class ExpansionsManager:
|
||||
|
||||
# Compute the expansions involved in the modification
|
||||
possiblyValidExpansions = set(self._listPossiblyValidExpansions())
|
||||
previousExpansions = set(self._includedExpansions)
|
||||
previousExpansions = set(self._includeExpansions)
|
||||
# Remove irrelevant expansions
|
||||
expansionsToRemove = previousExpansions.difference(possiblyValidExpansions)
|
||||
for expansionID in expansionsToRemove:
|
||||
@ -368,7 +368,7 @@ class ExpansionsManager:
|
||||
|
||||
def _activePlayerAdded(self, playerName):
|
||||
# Find the expansions that are to be created
|
||||
possibleAddition = set(self._includedExpansions).difference(self._activeExpansions)
|
||||
possibleAddition = set(self._includeExpansions).difference(self._activeExpansions)
|
||||
filteredAddition = [
|
||||
expansionID for expansionID in possibleAddition
|
||||
if hasattr(expansionsLib, self._getClassFillMissing(expansionID)) and
|
||||
|
||||
Reference in New Issue
Block a user