Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Salzkorn committed Nov 23, 2024
1 parent f8d1a65 commit fdb2c71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion worlds/sc2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
KerriganPresence, KerriganPrimalStatus, kerrigan_unit_available, StarterUnit, SpearOfAdunPresence,
get_enabled_campaigns, SpearOfAdunAutonomouslyCastAbilityPresence, Starcraft2Options,
GrantStoryTech, GenericUpgradeResearch, GenericUpgradeItems, RequiredTactics,
upgrade_included_names
upgrade_included_names, EnableVoidTrade
)
from .rules import get_basic_units
from . import settings
Expand Down Expand Up @@ -188,6 +188,16 @@ def fill_slot_data(self):

if SC2Campaign.HOTS not in enabled_campaigns:
slot_data["kerrigan_presence"] = KerriganPresence.option_not_present

# Disable trade if there is no trade partner
traders = [
world
for world in self.multiworld.worlds.values()
if world.game == self.game and world.options.enable_void_trade == EnableVoidTrade.option_true
]
if len(traders) >= 2:
slot_data["enable_void_trade"] = EnableVoidTrade.option_false

return slot_data

def pre_fill(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions worlds/sc2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,12 +975,12 @@ async def trade_acquire_storage(self, keep_trying: bool = False) -> typing.Optio
# Make sure we're not past the waiting limit
# SC2 needs to be notified within 10 minutes (training time of the dummy units)
if self.trade_lock_start is not None:
if lock - self.trade_lock_start >= TRADE_LOCK_WAIT_LIMIT:
if self.last_bot.time - self.trade_lock_start >= TRADE_LOCK_WAIT_LIMIT:
self.trade_lock_wait = 0
self.trade_lock_start = None
return None
elif keep_trying:
self.trade_lock_start = lock
self.trade_lock_start = self.last_bot.time

message_uuid = str(uuid.uuid4())
await self.send_msgs([{
Expand Down
2 changes: 1 addition & 1 deletion worlds/sc2/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class EnableVoidTrade(Toggle):
Enables the Void Trade Wormhole to be built from the Advanced Construction tab of SCVs, Drones and Probes.
This structure allows sending units to the Archipelago server, as well as buying random units from the server.
This feature requires at least two Starcraft II worlds. You cannot receive units that you sent.
Note: Always disabled if there is no other Starcraft II world with Void Trade enabled in the multiworld. You cannot receive units that you send.
"""
display_name = "Enable Void Trade"

Expand Down

0 comments on commit fdb2c71

Please sign in to comment.