Merge pull request #16043 from SandPoot/stacks

Make stacks show how much there are in inventory
This commit is contained in:
deathride58
2023-12-29 22:57:38 -05:00
committed by GitHub
14 changed files with 44 additions and 19 deletions

View File

@@ -9,7 +9,7 @@
anchored = TRUE
layer = GHOST_LAYER
color = "#ff0000" // text color
appearance_flags = NO_CLIENT_COLOR | RESET_ALPHA | RESET_COLOR | RESET_TRANSFORM
appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
vis_flags = VIS_INHERIT_ID
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
var/started = FALSE

View File

@@ -216,7 +216,7 @@
/obj/item/stack/medical/gauze/cyborg
custom_materials = null
is_cyborg = 1
is_cyborg = TRUE
cost = 250
/obj/item/stack/medical/suture
@@ -440,7 +440,7 @@
/obj/item/stack/medical/bone_gel/cyborg
custom_materials = null
is_cyborg = 1
is_cyborg = TRUE
cost = 250
/obj/item/stack/medical/aloe

View File

@@ -76,7 +76,7 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
/obj/item/stack/rods/cyborg
custom_materials = null
is_cyborg = 1
is_cyborg = TRUE
cost = 250
/obj/item/stack/rods/cyborg/ComponentInitialize()

View File

@@ -51,7 +51,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
/obj/item/stack/sheet/glass/cyborg
custom_materials = null
is_cyborg = 1
is_cyborg = TRUE
cost = 500
/obj/item/stack/sheet/glass/fifty
@@ -178,6 +178,7 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
/obj/item/stack/sheet/rglass/cyborg
custom_materials = null
is_cyborg = TRUE
var/datum/robot_energy_storage/glasource
var/metcost = 250
var/glacost = 500

View File

@@ -163,7 +163,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
/obj/item/stack/sheet/metal/cyborg
custom_materials = null
is_cyborg = 1
is_cyborg = TRUE
cost = 500
/obj/item/stack/sheet/metal/get_main_recipes()

View File

@@ -132,6 +132,16 @@
else
icon_state = "[initial(icon_state)]_3"
/obj/item/stack/update_overlays()
. = ..()
if(isturf(loc))
return
if(locate(/atom/movable/screen/storage/item_holder) in vis_locs) // It's being handled by the storage we're in, forget about it.
return
var/mutable_appearance/number = mutable_appearance(appearance_flags = APPEARANCE_UI_IGNORE_ALPHA)
number.maptext = MAPTEXT(get_amount())
. += number
/obj/item/stack/examine(mob/user)
. = ..()
if (is_cyborg)
@@ -151,6 +161,14 @@
. += "There is [get_amount()] in the stack."
. += "<span class='notice'>Alt-click to take a custom amount.</span>"
/obj/item/stack/equipped(mob/user, slot)
. = ..()
update_icon()
/obj/item/stack/dropped(mob/user, slot)
. = ..()
update_icon()
/obj/item/stack/proc/get_amount()
if(is_cyborg)
. = round(source?.energy / cost)
@@ -491,7 +509,11 @@
F.forceMove(user.drop_location())
add_fingerprint(user)
F.add_fingerprint(user)
zero_amount()
if(!zero_amount())
var/atom/movable/screen/storage/item_holder/holder = locate(/atom/movable/screen/storage/item_holder) in vis_locs
if(holder.master && istype(holder.master, /datum/component/storage/concrete))
var/datum/component/storage/concrete/storage = holder.master
storage.refresh_mob_views()
/obj/item/stack/attackby(obj/item/W, mob/user, params)
if(can_merge(W))

View File

@@ -11,7 +11,7 @@
. = ..()
update_icon()
/obj/item/stack/arcadeticket/update_icon()
/obj/item/stack/arcadeticket/update_icon_state()
var/amount = get_amount()
if((amount >= 12) && (amount > 0))
icon_state = "arcade-ticket_4"

View File

@@ -535,7 +535,7 @@
/obj/item/stack/tile/plasteel/cyborg
custom_materials = null // All other Borg versions of items have no Metal or Glass - RR
is_cyborg = 1
is_cyborg = TRUE
cost = 125
/obj/item/stack/tile/material