Various Slime Based Fixes (#15366)

This commit is contained in:
Geeves
2022-12-19 15:28:12 +01:00
committed by GitHub
parent bb04ba3f87
commit 7387bd1250
5 changed files with 41 additions and 1 deletions
@@ -21,6 +21,28 @@
drop_sound = 'sound/items/drop/backpack.ogg'
pickup_sound = 'sound/items/pickup/backpack.ogg'
/obj/item/storage/slimes/orient2hud(mob/user as mob, defer_overlays = FALSE)
var/list/numbered_contents_by_name = list()
for(var/obj/item/I in contents)
var/datum/numbered_display/display = numbered_contents_by_name[I.name]
if(display)
display.number++
else
numbered_contents_by_name[I.name] = new /datum/numbered_display(I)
numbered_contents_by_name = sortAssoc(numbered_contents_by_name)
var/list/datum/numbered_display/numbered_contents = list()
for(var/display_name in numbered_contents_by_name)
numbered_contents += numbered_contents_by_name[display_name]
var/row_num = 0
var/col_count = force_column_number ? force_column_number : min(7, storage_slots) - 1
if(length(numbered_contents) > 7)
row_num = round((length(numbered_contents) - 1) / 7) // 7 is the maximum allowed width.
slot_orient_objs(row_num, col_count, numbered_contents)
/obj/item/storage/slimes/handle_name_initials(var/sample_name)
var/name_initials = ..()
return replacetext(name_initials, "SE", "")
@@ -182,6 +182,13 @@
LAZYREMOVE(is_seeing, M)
return cansee
/obj/item/storage/proc/update_storage_ui()
for(var/mob/seer as anything in is_seeing)
orient2hud(seer)
if(seer.s_active)
seer.s_active.show_to(seer)
//This proc draws out the inventory and places the items on it. tx and ty are the upper left tile and mx, my are the bottm right.
//The numbers are calculated from the bottom-left The bottom-left slot being 1,1.
/obj/item/storage/proc/orient_objs(tx, ty, mx, my)