Compare commits

..

1 Commits

Author SHA1 Message Date
NewSoupVi
c2fcaec6ad MultiServer.py: Another Hint Priority + Item Links bug oh boy
Basically, the hint for an item linked item gets stored in two players' hints.

1. The player whose location it is
2. **Every individual player** participating in the item link

Crucially, it is *not* stored as a hint for the itemlink world.

This makes `replace_hint` not act correctly when a receiving player of an itemlink item tries to change the priority.

I'm not sure if this has other implications, it probably warrants some testing.
2025-04-13 20:39:31 +02:00

View File

@@ -792,9 +792,10 @@ class Context:
return None return None
def replace_hint(self, team: int, slot: int, old_hint: Hint, new_hint: Hint) -> None: def replace_hint(self, team: int, slot: int, old_hint: Hint, new_hint: Hint) -> None:
if old_hint in self.hints[team, slot]: for real_slot in self.slot_set(slot):
self.hints[team, slot].remove(old_hint) if old_hint in self.hints[team, real_slot]:
self.hints[team, slot].add(new_hint) self.hints[team, real_slot].remove(old_hint)
self.hints[team, real_slot].add(new_hint)
# "events" # "events"
@@ -1982,13 +1983,11 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
new_hint = new_hint.re_prioritize(ctx, status) new_hint = new_hint.re_prioritize(ctx, status)
if hint == new_hint: if hint == new_hint:
return return
ctx.replace_hint(client.team, hint.finding_player, hint, new_hint)
concerning_slots = ctx.slot_set(hint.receiving_player) | {hint.finding_player} ctx.replace_hint(client.team, hint.receiving_player, hint, new_hint)
for slot in concerning_slots:
ctx.replace_hint(client.team, slot, hint, new_hint)
ctx.save() ctx.save()
for slot in concerning_slots: ctx.on_changed_hints(client.team, hint.finding_player)
ctx.on_changed_hints(client.team, slot) ctx.on_changed_hints(client.team, hint.receiving_player)
elif cmd == 'StatusUpdate': elif cmd == 'StatusUpdate':
update_client_status(ctx, client, args["status"]) update_client_status(ctx, client, args["status"])