Skip to content

Commit

Permalink
Ports multiple storage visual/QOL PRs of mine (#555)
Browse files Browse the repository at this point in the history
* Prettified storage UI (#84160)

## About The Pull Request

This PR rewrites some storage UI code to make it compose itself from
multiple elements (corners and row connectors) and allow it to be
affected by player's preferred UI theme.
Also resprites it and adds variations for all themes.

Midnight (Default UI theme, the example doesn't show it very well but
the cells are rather transparent)


![image](https://github.com/tgstation/tgstation/assets/44720187/62c54417-ee38-4000-bea2-a8fab3b935c4)

Some examples of other themes. (Shows transparency much better)


![изображение](https://github.com/tgstation/tgstation/assets/44720187/9323dab9-d127-4f51-9ea0-7057bb7e022c)

![изображение](https://github.com/tgstation/tgstation/assets/44720187/368e775a-6644-4372-b66a-0e33f790b7bf)
  • Loading branch information
SmArtKar authored Aug 10, 2024
1 parent 47f1bac commit ec99927
Show file tree
Hide file tree
Showing 15 changed files with 263 additions and 115 deletions.
12 changes: 12 additions & 0 deletions code/__HELPERS/screen_objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,15 @@
/proc/cut_relative_direction(fragment)
var/static/regex/regex = regex(@"([A-Z])\w+", "g")
return regex.Replace(fragment, "")

/// Returns a screen_loc format for a tiling screen objects from start and end positions. Start should be bottom left corner, and end top right corner.
/proc/spanning_screen_loc(start_px, start_py, end_px, end_py)
var/starting_tile_x = round(start_px / 32)
start_px -= starting_tile_x * 32
var/starting_tile_y = round(start_py/ 32)
start_py -= starting_tile_y * 32
var/ending_tile_x = round(end_px / 32)
end_px -= ending_tile_x * 32
var/ending_tile_y = round(end_py / 32)
end_py -= ending_tile_y * 32
return "[starting_tile_x]:[start_px],[starting_tile_y]:[start_py] to [ending_tile_x]:[end_px],[ending_tile_y]:[end_py]"
46 changes: 43 additions & 3 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@
/atom/movable/screen/close
name = "close"
plane = ABOVE_HUD_PLANE
icon_state = "backpack_close"
icon = 'icons/hud/screen_midnight.dmi'
icon_state = "storage_close"

/atom/movable/screen/close/Initialize(mapload, datum/hud/hud_owner, new_master)
. = ..()
Expand Down Expand Up @@ -395,8 +396,8 @@

/atom/movable/screen/storage
name = "storage"
icon_state = "block"
screen_loc = "7,7 to 10,8"
icon = 'icons/hud/screen_midnight.dmi'
icon_state = "storage_cell"
plane = HUD_PLANE

/atom/movable/screen/storage/Initialize(mapload, datum/hud/hud_owner, new_master)
Expand All @@ -421,6 +422,45 @@

return TRUE

/atom/movable/screen/storage/cell

/atom/movable/screen/storage/cell/MouseDrop_T(atom/target, mob/living/user, params) // NON-MODULAR CHANGE should be mouse_drop_receive with ACR
var/datum/storage/storage = master_ref?.resolve()

if (isnull(storage) || !istype(user) || storage != user.active_storage)
return

if (!user.can_perform_action(storage.parent, FORBID_TELEKINESIS_REACH))
return

if (target.loc != storage.real_location)
return

/// Due to items in storage ignoring transparency for click hitboxes, this only can happen if we drag onto a free cell - aka after all current contents
storage.real_location.contents -= target
storage.real_location.contents += target
storage.refresh_views()

/atom/movable/screen/storage/corner
icon_state = "storage_corner_topleft"

/atom/movable/screen/storage/corner/top_right
icon_state = "storage_corner_topright"

/atom/movable/screen/storage/corner/bottom_left
icon_state = "storage_corner_bottomleft"

/atom/movable/screen/storage/corner/bottom_right
icon_state = "storage_corner_bottomright"

/atom/movable/screen/storage/rowjoin
name = "storage"
icon_state = "storage_rowjoin_left"
alpha = 0

/atom/movable/screen/storage/rowjoin/right
icon_state = "storage_rowjoin_right"

/atom/movable/screen/throw_catch
name = "throw/catch"
icon = 'icons/hud/screen_midnight.dmi'
Expand Down
Loading

0 comments on commit ec99927

Please sign in to comment.