Skip to content

Fix setLowLODElement accepting LOD cycles on buildings - #5543

Open
Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/building-lod-cycles
Open

Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/building-lod-cycles

Conversation

@Flashmyname

Copy link
Copy Markdown
Contributor

Summary

setLowLODElement accepted a building as its own LOD, directly or through a chain, and the building lost its collision. Calling it on a group that holds the LOD did the same to the LOD.

Motivation

Builds on #5521.

Test plan

crun setElementPosition(localPlayer,0,0,4) k=createBuilding(1337,3,0,10) m=createBuilding(1337,3,4,10)
crun return setLowLODElement(k,k), isLineOfSightClear(3,0,13,3,0,9,true,false,false,false)
crun return setLowLODElement(m,k), setLowLODElement(k,m), isLineOfSightClear(3,4,13,3,4,9,true,false,false,false)
run a=createBuilding(8661,0,240,12) return setLowLODElement(a,a)

Master returns true, true, true, true, true and true, with the fix false, false, true, false, false and false.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 18:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the client and server changes intended to prevent cyclic building LOD links.

No open issues 🎉

What changed in this PR

Builds on #5521’s building LOD-link fixes by rejecting direct and indirect LOD cycles on both the client and server, preventing the collision loss described in the PR.

Changes:

  • Walk the proposed LOD chain and reject links that lead back to the current building.
  • Validate before removing the existing LOD link, preserving it when a cyclic assignment is rejected.

Include the goals, reasoning, and test results in the commit message.

File Description
Server/​mods/​deathmatch/​logic/​CBuilding.cpp Rejects cyclic building LOD assignments before modifying server-side links.
Client/​mods/​deathmatch/​logic/​CClientBuilding.cpp Adds matching cycle validation before modifying client-side links.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants