Skip to content

Commit caaa0de

Browse files
authored
Stack items show amount as number next to sprite (in inventory) (#845)
1 parent 9f154ae commit caaa0de

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

code/datums/storage/storage.dm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
335335
SET_PLANE_IMPLICIT(thing, initial(thing.plane))
336336
thing.mouse_opacity = initial(thing.mouse_opacity)
337337
thing.screen_loc = null
338-
if(thing.maptext)
338+
if(numerical_stacking)
339339
thing.maptext = ""
340340

341341
/**
@@ -1079,7 +1079,8 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches)
10791079
for(var/obj/item as anything in storage_contents)
10801080
item.mouse_opacity = MOUSE_OPACITY_OPAQUE
10811081
item.screen_loc = "[current_x]:[screen_pixel_x],[current_y]:[screen_pixel_y]"
1082-
item.maptext = storage_contents[item]
1082+
if(numerical_stacking)
1083+
item.maptext = storage_contents[item]
10831084
SET_PLANE(item, ABOVE_HUD_PLANE, our_turf)
10841085
current_x++
10851086
if(current_x - screen_start_x < columns)

code/game/objects/items/stacks/stack.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@
754754

755755
/obj/item/stack/update_name(updates)
756756
. = ..()
757+
maptext = (ismob(loc) || loc?.atom_storage) ? MAPTEXT("<font color='white'>[amount]</font>") : ""
757758
if(!singular_name)
758759
return
759760
if(amount > 1)
@@ -764,3 +765,8 @@
764765
else
765766
name = singular_name
766767
gender = NEUTER
768+
769+
/obj/item/stack/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change)
770+
. = ..()
771+
if(ismob(loc) || ismob(old_loc) || loc?.atom_storage || old_loc?.atom_storage)
772+
update_appearance(UPDATE_NAME)

0 commit comments

Comments
 (0)