Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serverside hologram position getting set to origin when parented #1975

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

thegrb93
Copy link
Owner

Fixes: #1974

@thegrb93
Copy link
Owner Author

thegrb93 commented Jan 12, 2025

@adamnejm do you know how to test if the original thing this was fixing isn't an issue now?

I think it was something to do with clientside holograms not keeping their offset?

@adamnejm
Copy link
Collaborator

adamnejm commented Jan 12, 2025

Yeah, the repro code is in #1407, it used to just set position of the little holograms to the parent hologram, without keeping the offset.

If the code from #1407 just shifts the entire thing keeping offsets between holos, that means it works. If anything else happens that means it's broken.

@adamnejm
Copy link
Collaborator

Yeah, I reverted to a commit before ac0a3bb and still cannot reproduce it, so pretty sure it got fixed by an update.

@thegrb93
Copy link
Owner Author

@adamnejm for me, all the child holos get sent to the center of the parent, which seems wrong.

@adamnejm
Copy link
Collaborator

That's weird, for me they keep the offset which is the correct behavior.
I also just tested the Windows version of the game (albeit using Wine on Linux) and it works fine too.

@adamnejm
Copy link
Collaborator

OK, I can reproduce it on 32-bit branch Linux version. Not 64-bit tho.

@thegrb93
Copy link
Owner Author

great, so its behavior varies by gmod branch.

@Cheatoid
Copy link
Contributor

Cheatoid commented Jan 13, 2025

Varies by OS, branch and singleplayer/multiplayer? That's some cursed conditionals!
I am on non-beta 32-bit branch, windows, singleplayer. Should make chart/grid...

@thegrb93
Copy link
Owner Author

Just branch and sp/mp I'm pretty sure.

@adamnejm
Copy link
Collaborator

After more testing, I determined that the fix is to only apply the workaround to clientside holograms. Duh... it should've been like that from the beginning :D

if self:EntIndex() == -1 then
    self:SetParent(Entity(0))
    self:SetParent()
end

After that, everything works perfectly. Tested multiplayer and singleplayer on 32-bit and 64-bit.

@adamnejm
Copy link
Collaborator

adamnejm commented Jan 14, 2025

PS. This also fixes holo:getRight() returning 0,0,0. Didn't test similar functions, but please include some info about that in the hack comment.
Certified Garry Moment.

@adamnejm
Copy link
Collaborator

Also while the fix is not needed on 64-bit, I'd just leave it in instead of doing branch checking, it doesn't have any negative side-effects.

@thegrb93
Copy link
Owner Author

Ahhh nice discovery

@thegrb93 thegrb93 merged commit 4aeb156 into master Jan 14, 2025
1 check passed
@thegrb93 thegrb93 deleted the holoparent-fix branch January 14, 2025 04:17
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.

Hologram:setParent is broken
3 participants