Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions assets/ci
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ if [ "${#packaged_maps[@]}" -eq 0 ]; then
exit 1
fi

# Sauerbraten loads autoexec.cfg after its stock menu catalog. Generate that
# native config from the same exact map list passed to the asset packager, so
# every in-game map picker only exposes maps that are actually in this build.
# Sauerbraten's stock menus include hundreds of maps even when this hosted build
# only packages a small vetted set. Generate both autoexec.cfg and a direct
# menus.cfg catalog patch from the same exact ASSET_MAPS list so every native
# in-game map picker and custom-game creator only offers maps that exist here.
PACKAGED_MAPS="$asset_maps" python3 - <<'PY'
import os
import re
from pathlib import Path

maps = []
Expand Down Expand Up @@ -64,8 +66,25 @@ lines.extend([
'',
])

path = Path("sour/autoexec.cfg")
path.write_text("\n".join(lines))
catalog_text = "\n".join(lines)
Path("sour/autoexec.cfg").write_text(catalog_text)

menus_path = Path("sour/data/menus.cfg")
menus = menus_path.read_text()
menus = re.sub(
r'//17\n\nffamaps1 = .*?\nallmaps = \(concat \$allffamaps \$allcapturemaps \$allctfmaps \$conceptmaps \$spmaps \$rpgmaps\)',
'//17\n\n' + catalog_text.rstrip(),
menus,
count=1,
flags=re.S,
)
menus = re.sub(
r'showcustommaps = \[\n custommaps = ""\n loopfiles curmap "packages/base" "ogz" \[\n if \(< \(indexof \$allmaps \$curmap\) 0\) \[\n custommaps = \(concat \$custommaps \(escape \$curmap\)\)\n \]\n \]\n custommaps = \(sortlist \$custommaps x y \[naturalsort \$x \$y\]\)\n showgui custommaps\n\]',
'showcustommaps = [\n custommaps = $packagedmaps\n showgui custommaps\n]',
menus,
count=1,
)
menus_path.write_text(menus)
print(f"native packaged map catalog ({len(maps)}): {catalog}")
PY

Expand Down
2 changes: 1 addition & 1 deletion pkg/gameserver/packet_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (s *Server) HandlePacket(client *Client, channelID uint8, message P.Message
}
log.Printf("Spawning client %d (CN: %d) with life sequence %d", client.SessionID, client.CN, client.LifeSequence+1)
s.Spawn(client)
client.Send(P.SpawnState{int32(client.CN), client.ToWire()})
s.Clients.Broadcast(P.SpawnState{Client: int32(client.CN), EntityState: client.ToWire()})

case P.N_SPAWN:
msg := message.(P.SpawnRequest)
Expand Down
Loading