Commit Graph

51 Commits

Author SHA1 Message Date
26b5f1201e Refactor player entry initialization and optimize building state update logic 2025-12-14 22:27:43 +01:00
9ee675ac19 Implement multiplayer session cleanup on client disconnection 2025-12-14 22:12:50 +01:00
3124f82a2f alap 2025-12-14 21:08:19 +01:00
3a7b81bfd7 save 2025-12-14 21:04:22 +01:00
5f67f488f6 Fix compilation warnings and namespace issue
Fixed issues:
1. Added missing using directive for KCM.Packets namespace
   - Fixes ShowModal class not found error in Main.cs

2. Removed unused 'callTree' variable (Main.cs:460)
   - Variable was defined but never used

3. Removed unused 'awake' field (ServerLobbyScript.cs:63)
   - Field was assigned but never used

All compilation warnings resolved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-14 20:12:08 +01:00
b0f790cb6e Fix 3 critical bugs: server shutdown, building placement crashes
Fixed issues:
1. Server now stops when host returns to menu (Main.cs:342-356)
   - Notifies clients with "Host disconnected" modal
   - Prevents server from running in background

2. PlayerAddBuildingHook NullReferenceException (Main.cs:762-806)
   - Added comprehensive null checks for reflection fields
   - Added array bounds validation for landMass index
   - Added registry initialization checks
   - Fixes 98% building placement failure rate

3. IndexOutOfRangeException in WorldPlace (WorldPlace.cs:167-183)
   - LandMassNames array auto-expands when needed
   - Defensive code prevents index out of bounds errors

Updated README.md:
- Removed fixed issues from bug tracker
- Added "Fixed Issues" section documenting changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-14 20:06:53 +01:00
c4e25f6c12 Add advanced sync logging for debugging host-client sync issues
- Add LogSync() helper method in Main.cs for consistent sync logging
- Log all packet send/receive events in PacketHandler and Packet classes
- Add detailed building placement logging in WorldPlace.cs (all properties, final state)
- Add building state update logging in BuildingStatePacket.cs
- Add building state send logging in BuildingStateManager.cs

All sync logs are prefixed with [SYNC] for easy filtering.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 15:35:57 +01:00
dca0140aab Improve multiplayer sync stability 2025-12-14 14:51:46 +01:00
a918262d99 Always point save dir to multiplayer folder 2025-12-14 14:18:03 +01:00
87f65320c0 Broadcast villager positions from FixedUpdate 2025-12-14 14:15:45 +01:00
97bbf059a9 Specify villager update signature 2025-12-14 14:14:21 +01:00
739eba8289 Cast villager to Component via object 2025-12-14 13:33:44 +01:00
1e6f09df18 Guard villager movement snapshot with component 2025-12-14 13:31:49 +01:00
15cad47b52 Broadcast villager movement from server 2025-12-14 13:30:23 +01:00
b05c3415f2 codex talán fixálta idk 2025-12-14 13:09:32 +01:00
5dba8137c3 Fix: Remove AddBuilding from ProcessBuildingHook
The original PlayerSaveData.Unpack calls AddBuilding, PlaceFromLoad,
and UnpackStage2 after ProcessBuilding returns. The hook should only
create and initialize the building, not call these methods.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 11:58:00 +01:00
b3d7108574 Debug: Add detailed logging to ProcessBuildingHook
Added step-by-step logging to identify where building load fails:
- GetPlaceableByUniqueName result
- Each initialization step
- Exception details if any step fails

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 11:50:31 +01:00
ce1c067fca Fix: Add PlaceFromLoad and UnpackStage2 in ProcessBuildingHook
The hook was missing the critical World.inst.PlaceFromLoad() call which:
- Places building in world cells
- Sets up pathing data for villager navigation
- Registers building properly

Also added UnpackStage2() for complete building initialization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 11:45:59 +01:00
5d086776cf Fix: Add missing BakePathing() call in PlayerAddBuildingHook
The hook was skipping the original AddBuilding method but not calling
BakePathing(), which is required for villager pathfinding to work.
Without this, villagers cannot find paths to buildings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 11:42:20 +01:00
89586ad8df Fix: Remove TeleportTo calls that break villager AI/movement
- Remove post-load villager TeleportTo refresh (breaks pathfinding)
- Remove periodic villager position sync (TeleportTo interrupts movement)
- Keep ClearVillagerPositionCache for API compatibility

The TeleportTo calls were resetting villager AI state and preventing
them from continuing their movement/work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 11:39:03 +01:00
dd17030e56 Fix: Add periodic villager position sync from server
- Server syncs villager positions every ~3 seconds to clients
- Only syncs villagers that moved more than 0.5 units (bandwidth optimization)
- Maintains position cache to detect movement
- Clears cache on lobby leave to prevent stale data

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 10:58:37 +01:00
eab7931f52 Fix: Add position sync for villagers and duplicate check
- Add position property to AddVillagerPacket
- Teleport villager to correct position on client
- Add duplicate guid check to prevent double villager creation
- Send position from Main.cs hook

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 10:52:39 +01:00
f03e13236f asd 2025-12-14 01:45:02 +01:00
60d509344c fix? 2025-12-14 01:42:22 +01:00
3fbaac2346 na még 1x 2025-12-14 01:27:26 +01:00
0e87108b56 sexy fix 2025-12-14 01:25:29 +01:00
224ba3f912 Merge branch 'main' of https://git.devbeni.lol/devbeni/K-C-Multiplayer 2025-12-14 01:19:31 +01:00
914650c211 asd 2025-12-14 01:17:20 +01:00
93c55dd482 bruh 2025-12-14 01:10:03 +01:00
414ab90afc aha persze talán most nem szia 2025-12-14 01:05:37 +01:00
42a86419ca jaj aja nem hinnem xd 2025-12-14 00:59:48 +01:00
2140fc3868 nem tudom most claude talán megoldja xd 2025-12-14 00:54:55 +01:00
77f4d4fed0 talán???? 2025-12-14 00:34:42 +01:00
3ee6fc4dc6 asd 2025-12-14 00:30:59 +01:00
e0b1b736c3 pls :( 2 2025-12-14 00:27:17 +01:00
28e342b1e3 pls :( 2025-12-14 00:23:06 +01:00
f82ae76a3e talán fix geic végre big-pickle 2025-12-13 23:03:10 +01:00
dc50bf2892 fix??? 2025-12-13 21:46:58 +01:00
e636ad6e19 asd 2025-12-13 20:57:23 +01:00
fbb947a23b fix 2025-12-13 20:24:54 +01:00
a2d87106ba talán 2025-12-13 20:21:25 +01:00
0f8f3ce818 fix 69 istenem segíts 2025-12-13 20:06:47 +01:00
f45402af9a fix 2 2025-12-13 19:42:49 +01:00
6bf74dda43 kisebb fixek elv. 2025-12-13 19:29:33 +01:00
7fc86a804a syx 2025-12-13 18:35:44 +01:00
c6c60a7e07 fix? 2025-12-13 17:11:00 +01:00
cb59d5a918 network fix 2025-12-13 16:39:02 +01:00
efa6016fe5 íyx 2025-12-13 16:08:37 +01:00
0b16efc4be Farm és save desync feltérképezése 2025-12-13 16:01:09 +01:00
e523122561 bug fix 2025-12-13 15:17:11 +01:00