mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Add our_view to screen_loc_to_offset in view_audit_buttons (#85300)
## About The Pull Request
Relative positions are calculated incorrectly in widescreen mode without
this. To demonstrate, call
```
screen_loc_to_offset("EAST-4,SOUTH", null) = [-128,32]
```
When passed to offset_to_screen_loc, this will be clamped to (32,32)
```
offset_to_screen_loc(-128, 32, view = our_view) = "1,1"
```
And returned as 1,1 - moving the action button incorrectly.
By including our_view in the call to `screen_loc_to_offset`, this entire
problem is avoided.
## Why It's Good For The Game
If someone sets a floating action button to be relative to EAST, SOUTH,
or CENTER, they run into this bug. As far as I can tell, nothing
currently does this and therefore it isn't meaningful, but I've run into
this twice now downstream.
## Changelog
🆑
fix: Fixed action buttons relative to EAST,SOUTH, or CENTER being
improperly moved during view_audit_buttons()
/🆑
This commit is contained in:
@@ -585,7 +585,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
listed_actions.check_against_view()
|
||||
palette_actions.check_against_view()
|
||||
for(var/atom/movable/screen/movable/action_button/floating_button as anything in floating_actions)
|
||||
var/list/current_offsets = screen_loc_to_offset(floating_button.screen_loc)
|
||||
var/list/current_offsets = screen_loc_to_offset(floating_button.screen_loc, our_view)
|
||||
// We set the view arg here, so the output will be properly hemm'd in by our new view
|
||||
floating_button.screen_loc = offset_to_screen_loc(current_offsets[1], current_offsets[2], view = our_view)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user