FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.72k stars 401 forks source link

Placing objects in the floor or inside walls #14617

Open Regalis11 opened 4 days ago

Regalis11 commented 4 days ago

Discussed in https://github.com/FakeFishGames/Barotrauma/discussions/14614

Originally posted by **SAYtan47** September 13, 2024 ### Disclaimers - [X] I have searched the issue tracker to check if the issue has already been reported. - [ ] My issue happened while using mods. ### What happened? While placing components like water detectors/ garden pots theres a posibility to place it too deep in the floor and after that it will be uninteractable and practically wasted ![20240906145701_1](https://github.com/user-attachments/assets/5cf4016c-f7b5-4039-8ca4-77c603ed3936) ### Reproduction steps 1. Start a test in submarine editor 2. Give yourself water detector or a garden pot 3. Lead your cursor as low down as possible (might have to sit for it) 4. Under some angles the possibility to place item lower than usual will occur ### Bug prevalence Happens every time I play ### Single player or multiplayer? Happens in both single player and multiplayer ### - _No response_ ### Version v1.5.9.2 (Summer Update Hotfix 2) ### - _No response_ ### Which operating system did you encounter this bug on? Windows ### Relevant error messages and crash reports _No response_
Regalis11 commented 4 days ago

There should be some logic in Holdable.GetAttachPosition to prevent this, but seems it's bugged or not working correctly in some situation?

EDIT: it seems the issue is that when the cursor is just outside the wall, the raycast that checks whether the item would go inside a wall won't hit it and the prevention logic doesn't kick in, allowing the item to go inside when it's position is clamped to the grid.