Merge pull request #16043 from SandPoot/stacks
Make stacks show how much there are in inventory
This commit is contained in:
@@ -261,7 +261,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
//Blank
|
//Blank
|
||||||
menu_holder = image(icon='icons/effects/effects.dmi',loc=anchor,icon_state="nothing",layer = ABOVE_HUD_LAYER)
|
menu_holder = image(icon='icons/effects/effects.dmi',loc=anchor,icon_state="nothing",layer = ABOVE_HUD_LAYER)
|
||||||
menu_holder.plane = ABOVE_HUD_PLANE
|
menu_holder.plane = ABOVE_HUD_PLANE
|
||||||
menu_holder.appearance_flags |= KEEP_APART|NO_CLIENT_COLOR|RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM
|
menu_holder.appearance_flags |= APPEARANCE_UI_IGNORE_ALPHA | KEEP_APART
|
||||||
menu_holder.vis_contents += elements + close_button
|
menu_holder.vis_contents += elements + close_button
|
||||||
current_user.images += menu_holder
|
current_user.images += menu_holder
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
if(!istype(I) || QDELETED(I)) //We're specialized stack storage, just ignore non stacks.
|
if(!istype(I) || QDELETED(I)) //We're specialized stack storage, just ignore non stacks.
|
||||||
continue
|
continue
|
||||||
if(!.[I.merge_type])
|
if(!.[I.merge_type])
|
||||||
.[I.merge_type] = new /datum/numbered_display(I, I.amount)
|
.[I.merge_type] = new /datum/numbered_display(I, I.amount, src)
|
||||||
else
|
else
|
||||||
var/datum/numbered_display/ND = .[I.merge_type]
|
var/datum/numbered_display/ND = .[I.merge_type]
|
||||||
ND.number += I.amount
|
ND.number += I.amount
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
anchored = TRUE
|
anchored = TRUE
|
||||||
layer = GHOST_LAYER
|
layer = GHOST_LAYER
|
||||||
color = "#ff0000" // text color
|
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
|
vis_flags = VIS_INHERIT_ID
|
||||||
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
|
var/text_size = 3 // larger values clip when the displayed text is larger than 2 digits.
|
||||||
var/started = FALSE
|
var/started = FALSE
|
||||||
|
|||||||
@@ -216,7 +216,7 @@
|
|||||||
|
|
||||||
/obj/item/stack/medical/gauze/cyborg
|
/obj/item/stack/medical/gauze/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 250
|
cost = 250
|
||||||
|
|
||||||
/obj/item/stack/medical/suture
|
/obj/item/stack/medical/suture
|
||||||
@@ -440,7 +440,7 @@
|
|||||||
|
|
||||||
/obj/item/stack/medical/bone_gel/cyborg
|
/obj/item/stack/medical/bone_gel/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 250
|
cost = 250
|
||||||
|
|
||||||
/obj/item/stack/medical/aloe
|
/obj/item/stack/medical/aloe
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
|
|||||||
|
|
||||||
/obj/item/stack/rods/cyborg
|
/obj/item/stack/rods/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 250
|
cost = 250
|
||||||
|
|
||||||
/obj/item/stack/rods/cyborg/ComponentInitialize()
|
/obj/item/stack/rods/cyborg/ComponentInitialize()
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
|||||||
|
|
||||||
/obj/item/stack/sheet/glass/cyborg
|
/obj/item/stack/sheet/glass/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 500
|
cost = 500
|
||||||
|
|
||||||
/obj/item/stack/sheet/glass/fifty
|
/obj/item/stack/sheet/glass/fifty
|
||||||
@@ -178,6 +178,7 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
|
|||||||
|
|
||||||
/obj/item/stack/sheet/rglass/cyborg
|
/obj/item/stack/sheet/rglass/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
|
is_cyborg = TRUE
|
||||||
var/datum/robot_energy_storage/glasource
|
var/datum/robot_energy_storage/glasource
|
||||||
var/metcost = 250
|
var/metcost = 250
|
||||||
var/glacost = 500
|
var/glacost = 500
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
|
|||||||
|
|
||||||
/obj/item/stack/sheet/metal/cyborg
|
/obj/item/stack/sheet/metal/cyborg
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 500
|
cost = 500
|
||||||
|
|
||||||
/obj/item/stack/sheet/metal/get_main_recipes()
|
/obj/item/stack/sheet/metal/get_main_recipes()
|
||||||
|
|||||||
@@ -132,6 +132,16 @@
|
|||||||
else
|
else
|
||||||
icon_state = "[initial(icon_state)]_3"
|
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)
|
/obj/item/stack/examine(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
if (is_cyborg)
|
if (is_cyborg)
|
||||||
@@ -151,6 +161,14 @@
|
|||||||
. += "There is [get_amount()] in the stack."
|
. += "There is [get_amount()] in the stack."
|
||||||
. += "<span class='notice'>Alt-click to take a custom amount.</span>"
|
. += "<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()
|
/obj/item/stack/proc/get_amount()
|
||||||
if(is_cyborg)
|
if(is_cyborg)
|
||||||
. = round(source?.energy / cost)
|
. = round(source?.energy / cost)
|
||||||
@@ -491,7 +509,11 @@
|
|||||||
F.forceMove(user.drop_location())
|
F.forceMove(user.drop_location())
|
||||||
add_fingerprint(user)
|
add_fingerprint(user)
|
||||||
F.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)
|
/obj/item/stack/attackby(obj/item/W, mob/user, params)
|
||||||
if(can_merge(W))
|
if(can_merge(W))
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/obj/item/stack/arcadeticket/update_icon()
|
/obj/item/stack/arcadeticket/update_icon_state()
|
||||||
var/amount = get_amount()
|
var/amount = get_amount()
|
||||||
if((amount >= 12) && (amount > 0))
|
if((amount >= 12) && (amount > 0))
|
||||||
icon_state = "arcade-ticket_4"
|
icon_state = "arcade-ticket_4"
|
||||||
|
|||||||
@@ -535,7 +535,7 @@
|
|||||||
|
|
||||||
/obj/item/stack/tile/plasteel/cyborg
|
/obj/item/stack/tile/plasteel/cyborg
|
||||||
custom_materials = null // All other Borg versions of items have no Metal or Glass - RR
|
custom_materials = null // All other Borg versions of items have no Metal or Glass - RR
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
cost = 125
|
cost = 125
|
||||||
|
|
||||||
/obj/item/stack/tile/material
|
/obj/item/stack/tile/material
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
|||||||
used_skills = list(/datum/skill/level/job/wiring)
|
used_skills = list(/datum/skill/level/job/wiring)
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/cyborg
|
/obj/item/stack/cable_coil/cyborg
|
||||||
is_cyborg = 1
|
is_cyborg = TRUE
|
||||||
custom_materials = null
|
custom_materials = null
|
||||||
cost = 1
|
cost = 1
|
||||||
|
|
||||||
@@ -572,7 +572,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
|||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|
||||||
/obj/item/stack/cable_coil/update_icon()
|
/obj/item/stack/cable_coil/update_icon_state()
|
||||||
icon_state = "[initial(item_state)][amount < 3 ? amount : ""]"
|
icon_state = "[initial(item_state)][amount < 3 ? amount : ""]"
|
||||||
name = "cable [amount < 3 ? "piece" : "coil"]"
|
name = "cable [amount < 3 ? "piece" : "coil"]"
|
||||||
|
|
||||||
|
|||||||
@@ -554,7 +554,7 @@
|
|||||||
|
|
||||||
if(sheets.len > 0)
|
if(sheets.len > 0)
|
||||||
var/obj/item/stack/sheet/S = pick(sheets)
|
var/obj/item/stack/sheet/S = pick(sheets)
|
||||||
S.amount++
|
S.add(1) // Dare var edit directly again and i'll strangle you.
|
||||||
to_chat(owner, "<span class='notice'>[linked_extract] adds a layer of slime to [S], which metamorphosizes into another sheet of material!</span>")
|
to_chat(owner, "<span class='notice'>[linked_extract] adds a layer of slime to [S], which metamorphosizes into another sheet of material!</span>")
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
var/list/paths = subtypesof(/obj/item/stack) - blacklist
|
var/list/paths = subtypesof(/obj/item/stack) - blacklist
|
||||||
|
|
||||||
for(var/stackpath in paths)
|
for(var/obj/item/stack/stackpath as anything in paths)
|
||||||
|
if(initial(stackpath.is_cyborg))
|
||||||
|
continue
|
||||||
var/obj/item/stack/stack = new stackpath
|
var/obj/item/stack/stack = new stackpath
|
||||||
if(!stack.merge_type)
|
if(!stack.merge_type)
|
||||||
Fail("([stack]) lacks set merge_type variable!")
|
Fail("([stack]) lacks set merge_type variable!")
|
||||||
|
|||||||
@@ -1081,9 +1081,9 @@ GLOBAL_LIST_INIT(hay_recipes, list ( \
|
|||||||
attack_verb = list("tickled", "poked", "whipped")
|
attack_verb = list("tickled", "poked", "whipped")
|
||||||
hitsound = 'sound/weapons/grenadelaunch.ogg'
|
hitsound = 'sound/weapons/grenadelaunch.ogg'
|
||||||
|
|
||||||
/obj/item/stack/sheet/hay/Initialize(mapload, new_amount, merge = TRUE)
|
/obj/item/stack/sheet/hay/get_main_recipes()
|
||||||
recipes = GLOB.hay_recipes
|
. = ..()
|
||||||
return ..()
|
. += GLOB.hay_recipes
|
||||||
|
|
||||||
/obj/item/stack/sheet/hay/fifty
|
/obj/item/stack/sheet/hay/fifty
|
||||||
amount = 50
|
amount = 50
|
||||||
@@ -1098,7 +1098,7 @@ GLOBAL_LIST_INIT(hay_recipes, list ( \
|
|||||||
amount = 5
|
amount = 5
|
||||||
|
|
||||||
|
|
||||||
/obj/item/stack/sheet/hay/update_icon()
|
/obj/item/stack/sheet/hay/update_icon_state()
|
||||||
var/amount = get_amount()
|
var/amount = get_amount()
|
||||||
if((amount <= 4) && (amount > 0))
|
if((amount <= 4) && (amount > 0))
|
||||||
icon_state = "hay[amount]"
|
icon_state = "hay[amount]"
|
||||||
|
|||||||
Reference in New Issue
Block a user