Fix rule suggestions + placement highlights

- JoinCustomLobbyResponse now includes ActiveRules so the guest's rule editor
  pre-populates from the lobby's current effective rules instead of hardcoded
  defaults; previously all fields in a suggestion were sent as defaults, causing
  accepted suggestions to reset rules to defaults.
- game_screen.gd: placement tile highlights are now re-applied on every state
  update while the player hasn't placed yet, not only on the first entry into
  PLACEMENT mode; fixes highlights disappearing when the opponent places their
  ArchSpirit and a delta arrives mid-placement.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-21 10:22:29 -04:00
co-authored by Claude Happy
parent 97b8391608
commit b812372514
3 changed files with 31 additions and 6 deletions
@@ -477,7 +477,7 @@ func _fetch_skybox() -> void:
Network.request("content.get_skybox_config", {},
func(_type: String, resp: Variant) -> void:
var d := resp as Dictionary
var skybox := d.get("skybox", null)
var skybox : Dictionary = d.get("skybox", null)
if skybox == null:
return # no active skybox — keep procedural sky
var cdn_path : String = str(skybox.get("cdnPath", ""))
@@ -2952,8 +2952,8 @@ func _update_hud(state: Dictionary) -> void:
_phase_lbl.text = "Phase: Placement — click a tile to place your ArchSpirit"
if _mode != Mode.PLACEMENT:
_set_mode(Mode.PLACEMENT)
_clear_highlights()
_highlight_tiles(_valid_placement_tiles(), HI_GREEN)
_clear_highlights()
_highlight_tiles(_valid_placement_tiles(), HI_GREEN)
else:
_phase_lbl.text = "Phase: Placement — waiting for opponent…"
if _mode == Mode.PLACEMENT:
+4 -3
View File
@@ -233,9 +233,10 @@ public sealed record CreateCustomLobbyResponse(
CustomRulesDto ActiveRules);
public sealed record JoinCustomLobbyResponse(
Guid LobbyId,
string Status, // "WaitingForReady"
Guid? GameSessionId); // always null; reserved for future use
Guid LobbyId,
string Status, // "WaitingForReady"
CustomRulesDto ActiveRules,
Guid? GameSessionId); // always null; reserved for future use
public sealed record LeaveCustomLobbyResponse(Guid LobbyId);
@@ -66,6 +66,29 @@ internal sealed class GameJoinCustomLobbyHandler : GameHandlerBase, IMessageHand
await _gameDb.SaveChangesAsync(ct);
// Build effective rules so the guest can pre-populate their rule editor.
var effective = new GameRules
{
OpeningHandSize = lobby.OpeningHandSizeOverride ?? GameRules.Default.OpeningHandSize,
FirstPlayerSkipsDraw = lobby.FirstPlayerSkipsDrawOverride ?? GameRules.Default.FirstPlayerSkipsDraw,
SpAccumulationPerTurn = lobby.SpAccumulationPerTurnOverride ?? GameRules.Default.SpAccumulationPerTurn,
DrawPerTurn = lobby.DrawPerTurnOverride ?? GameRules.Default.DrawPerTurn,
SpHasCap = lobby.SpHasCapOverride ?? GameRules.Default.SpHasCap,
SpCap = lobby.SpCapOverride ?? GameRules.Default.SpCap,
BoardWidth = lobby.BoardWidthOverride ?? GameRules.Default.BoardWidth,
BoardHeight = lobby.BoardHeightOverride ?? GameRules.Default.BoardHeight,
HandSizeCap = lobby.HandSizeCapOverride ?? GameRules.Default.HandSizeCap,
DiscardOnMaxHand = lobby.DiscardOnMaxHandOverride ?? GameRules.Default.DiscardOnMaxHand,
MaxDeckSize = lobby.MaxDeckSizeOverride ?? GameRules.Default.MaxDeckSize,
MinDeckSize = lobby.MinDeckSizeOverride ?? GameRules.Default.MinDeckSize,
MaxArchTier1 = lobby.MaxArchTier1Override ?? GameRules.Default.MaxArchTier1,
TurnTimerSeconds = lobby.TurnTimerSecondsOverride ?? GameRules.Default.TurnTimerSeconds,
TimeLimitMinutes = lobby.TimeLimitMinutesOverride ?? GameRules.Default.TimeLimitMinutes,
TurnLimit = lobby.TurnLimitOverride ?? GameRules.Default.TurnLimit,
MpBuff = lobby.MpBuffOverride ?? GameRules.Default.MpBuff,
StartingRandomTilePct = lobby.StartingRandomTilePctOverride ?? GameRules.Default.StartingRandomTilePct,
};
// Notify the host that their guest has arrived.
await _clientPush.PushAsync(lobby.HostAccountId.ToString(),
ServerMessage.Push("game.custom.lobby.guest_joined",
@@ -78,6 +101,7 @@ internal sealed class GameJoinCustomLobbyHandler : GameHandlerBase, IMessageHand
new JoinCustomLobbyResponse(
LobbyId : lobby.Id,
Status : "WaitingForReady",
ActiveRules : GameCreateCustomLobbyHandler.ToDto(effective, lobby.Password != null),
GameSessionId: null));
}
}