mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-18 10:37:54 +01:00
+37






![tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)


Alexis
GitHub
tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
ArcaneMusic
MrMelbert
Rhials
rageguy505
LemonInTheDark
John Willard
Aliceee2ch
Time-Green
Tsar-Salat
SmArtKar
Maxipat
SyncIt21
deltanedas
SimplyLogan
loganuk
Leland Kemble
FalloutFalcon
Roxy
Lucy
siliconOpossum
Isratosh
TheRyeGuyWhoWillNowDie
Neocloudy
Alexander V.
ElGitificador
Twaticus
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bloop
Cameron Lennox
Tim
Iamgoofball
Layzu666
Arturlang
_0Steven
mrmanlikesbt
Ben10Omintrix
John F. Kennedy
Cursor
Josh
Josh Powell
Yobrocharlie
Hardly3D
shayoki
LT3
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
178 lines
6.0 KiB
Plaintext
178 lines
6.0 KiB
Plaintext
/// Datum tracker for storage UI
|
|
/datum/storage_interface
|
|
/// UI elements for this theme
|
|
var/atom/movable/screen/close/closer
|
|
var/atom/movable/screen/storage/cell/cells
|
|
var/atom/movable/screen/storage/corner/corner_top_left
|
|
var/atom/movable/screen/storage/corner/top_right/corner_top_right
|
|
var/atom/movable/screen/storage/corner/bottom_left/corner_bottom_left
|
|
var/atom/movable/screen/storage/corner/bottom_right/corner_bottom_right
|
|
var/atom/movable/screen/storage/rowjoin/rowjoin_left
|
|
var/atom/movable/screen/storage/rowjoin/right/rowjoin_right
|
|
|
|
/// Storage that owns us
|
|
var/datum/storage/parent_storage
|
|
|
|
/datum/storage_interface/New(ui_style, datum/storage/parent_storage, mob/user)
|
|
..()
|
|
src.parent_storage = parent_storage
|
|
var/datum/hud/owner_hud = user.hud_used
|
|
closer = new(null, owner_hud, parent_storage)
|
|
cells = new(null, owner_hud, parent_storage)
|
|
corner_top_left = new(null, owner_hud, parent_storage)
|
|
corner_top_right = new(null, owner_hud, parent_storage)
|
|
corner_bottom_left = new(null, owner_hud, parent_storage)
|
|
corner_bottom_right = new(null, owner_hud, parent_storage)
|
|
rowjoin_left = new(null, owner_hud, parent_storage)
|
|
rowjoin_right = new(null, owner_hud, parent_storage)
|
|
for (var/atom/movable/screen/ui_elem as anything in list_ui_elements(initializing = TRUE))
|
|
ui_elem.icon = ui_style
|
|
|
|
/// Returns all UI elements under this theme
|
|
/datum/storage_interface/proc/list_ui_elements(initializing = FALSE)
|
|
return list(cells, corner_top_left, corner_top_right, corner_bottom_left, corner_bottom_right, rowjoin_left, rowjoin_right, closer)
|
|
|
|
/datum/storage_interface/Destroy(force)
|
|
QDEL_NULL(closer)
|
|
QDEL_NULL(cells)
|
|
QDEL_NULL(corner_top_left)
|
|
QDEL_NULL(corner_top_right)
|
|
QDEL_NULL(corner_bottom_left)
|
|
QDEL_NULL(corner_bottom_right)
|
|
QDEL_NULL(rowjoin_left)
|
|
QDEL_NULL(rowjoin_right)
|
|
parent_storage = null
|
|
return ..()
|
|
|
|
/// Updates position of all UI elements
|
|
/datum/storage_interface/proc/update_position(
|
|
screen_start_x,
|
|
screen_pixel_x,
|
|
screen_start_y,
|
|
screen_pixel_y,
|
|
columns,
|
|
rows,
|
|
mob/user_looking,
|
|
atom/real_location,
|
|
list/datum/numbered_display/numbered_contents,
|
|
)
|
|
var/number_of_hands = user_looking.held_items.len
|
|
while(number_of_hands > user_looking.default_hand_amount)
|
|
number_of_hands /= user_looking.default_hand_amount
|
|
screen_start_y++
|
|
var/start_pixel_x = screen_start_x * 32 + screen_pixel_x
|
|
var/start_pixel_y = screen_start_y * 32 + screen_pixel_y
|
|
var/end_pixel_x = start_pixel_x + (columns - 1) * 32
|
|
var/end_pixel_y = start_pixel_y + (rows - 1) * 32
|
|
|
|
cells.screen_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, end_pixel_x, end_pixel_y)
|
|
var/left_edge_loc = spanning_screen_loc(min(start_pixel_x + 32, end_pixel_x), start_pixel_y, end_pixel_x, end_pixel_y)
|
|
var/right_edge_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, max(start_pixel_x, end_pixel_x - 32), end_pixel_y)
|
|
corner_top_left.screen_loc = left_edge_loc
|
|
corner_bottom_left.screen_loc = left_edge_loc
|
|
corner_top_right.screen_loc = right_edge_loc
|
|
corner_bottom_right.screen_loc = right_edge_loc
|
|
|
|
var/row_left_loc = spanning_screen_loc(start_pixel_x, start_pixel_y + 27, start_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32)
|
|
rowjoin_left.screen_loc = row_left_loc
|
|
rowjoin_left.alpha = (rows > 1) * 255
|
|
|
|
var/row_right_loc = spanning_screen_loc(end_pixel_x, start_pixel_y + 27, end_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32)
|
|
rowjoin_right.screen_loc = row_right_loc
|
|
rowjoin_right.alpha = (rows > 1) * 255
|
|
|
|
closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x - 5],[screen_start_y]:[screen_pixel_y]"
|
|
|
|
add_items(arglist(args))
|
|
|
|
/datum/storage_interface/proc/add_items(
|
|
screen_start_x,
|
|
screen_pixel_x,
|
|
screen_start_y,
|
|
screen_pixel_y,
|
|
columns,
|
|
rows,
|
|
mob/user_looking,
|
|
atom/real_location,
|
|
list/datum/numbered_display/numbered_contents,
|
|
)
|
|
|
|
var/current_x = screen_start_x
|
|
var/current_y = screen_start_y
|
|
var/turf/our_turf = get_turf(real_location)
|
|
|
|
var/list/obj/storage_contents = list()
|
|
if (islist(numbered_contents))
|
|
for(var/content_type in numbered_contents)
|
|
var/datum/numbered_display/numberdisplay = numbered_contents[content_type]
|
|
storage_contents[numberdisplay.sample_object] = MAPTEXT("<font color='white'>[(numberdisplay.number > 1)? "[numberdisplay.number]" : ""]</font>")
|
|
else
|
|
for(var/obj/item as anything in real_location)
|
|
storage_contents[item] = ""
|
|
|
|
for(var/obj/item as anything in storage_contents)
|
|
item.mouse_opacity = MOUSE_OPACITY_OPAQUE
|
|
item.screen_loc = "[current_x]:[screen_pixel_x],[current_y]:[screen_pixel_y]"
|
|
if(parent_storage.numerical_stacking)
|
|
item.maptext = storage_contents[item]
|
|
SET_PLANE(item, ABOVE_HUD_PLANE, our_turf)
|
|
current_x++
|
|
if(current_x - screen_start_x < columns)
|
|
continue
|
|
current_x = screen_start_x
|
|
|
|
current_y++
|
|
if(current_y - screen_start_y >= rows)
|
|
break
|
|
|
|
///Silicon subtype of storage interface used by their model storage.
|
|
/datum/storage_interface/silicon
|
|
var/obj/item/robot_model/robot_model
|
|
|
|
/datum/storage_interface/silicon/New(ui_style, datum/storage/parent_storage, mob/user)
|
|
. = ..()
|
|
robot_model = parent_storage.real_location
|
|
|
|
/datum/storage_interface/silicon/add_items(
|
|
screen_start_x,
|
|
screen_pixel_x,
|
|
screen_start_y,
|
|
screen_pixel_y,
|
|
columns,
|
|
rows,
|
|
mob/user_looking,
|
|
atom/real_location,
|
|
list/datum/numbered_display/numbered_contents,
|
|
)
|
|
var/list/usable_modules = robot_model.get_usable_modules()
|
|
|
|
var/current_x = screen_start_x
|
|
var/current_y = screen_start_y
|
|
var/turf/our_turf = get_turf(real_location)
|
|
|
|
for(var/i in 1 to length(usable_modules))
|
|
var/atom/movable/item = usable_modules[i]
|
|
if(item in robot_model.robot.held_items)
|
|
current_x++
|
|
if(current_x - screen_start_x < columns)
|
|
continue
|
|
current_x = screen_start_x
|
|
|
|
current_y++
|
|
if(current_y - screen_start_y >= rows)
|
|
break
|
|
//Module is currently active
|
|
continue
|
|
|
|
item.mouse_opacity = MOUSE_OPACITY_OPAQUE
|
|
SET_PLANE(item, ABOVE_HUD_PLANE, our_turf)
|
|
item.screen_loc = "[current_x]:[screen_pixel_x],[current_y]:[screen_pixel_y]"
|
|
|
|
current_x++
|
|
if(current_x - screen_start_x < columns)
|
|
continue
|
|
current_x = screen_start_x
|
|
current_y++
|
|
if(current_y - screen_start_y >= rows)
|
|
break
|