Files
Bubberstation/code/datums/components/storage/concrete/stack.dm
TemporalOroboros 1f1b58bb26 Adds Neon Carpet (#55782)
* Adds emissive carpet, adds plane support to decal element

- Adds a basic abstract/debugging emissive carpet
- Makes decals capable of supporting plane
- Adds auto-smoothing decals

* Adds simple neon carpet variations

* Adds neon carpet reagents and recipes

* Refactors emissive blockers to allow multiple layers of emissive / emissive blocking objects

- Splits the emissive and emissive blocker plane masters into several plane masters which handle different layers of emissiveness.

* Makes neon carpet tile stacks emissive

* Rearranges and docs some emissive plane masters

- Folds the overlay lighting plane master into the emissive planes since it is also used to mask the lighting plane

* Fixes null mats_per_unit stack recombining after splitting

- I think I broke this a while ago when I reworked how stacks handle materials. Whoops.
- This basically only effects carpet at the moment. Good thing I did this when I did!

* Adds neon carpets to cargo

- Adds a cargo supply crate containing a _lot_ of neon carpets for 3000 credits

* Fixes neon carpet highlights leaking through vending machines and such

- Turns out vending machines axed their own emissive blockers whenever they updated their icon because they cleared their managed_vis_overlays...
- Generic emissive blocking has been elementized and some update_overlays procs have been straightened out.

* Fixes id_arg_index for the emissive blocker element

* Commits @Rohsie's suggestions
2021-01-25 01:55:04 -08:00

69 lines
2.0 KiB
Plaintext

//Stack-only storage.
/datum/component/storage/concrete/stack
display_numerical_stacking = TRUE
var/max_combined_stack_amount = 300
max_w_class = WEIGHT_CLASS_NORMAL
max_combined_w_class = WEIGHT_CLASS_NORMAL * 14
/datum/component/storage/concrete/stack/proc/total_stack_amount()
. = 0
var/atom/real_location = real_location()
for(var/i in real_location)
var/obj/item/stack/S = i
if(!istype(S))
continue
. += S.amount
/datum/component/storage/concrete/stack/proc/remaining_space()
return max(0, max_combined_stack_amount - total_stack_amount())
//emptying procs do not need modification as stacks automatically merge.
/datum/component/storage/concrete/stack/_insert_physical_item(obj/item/I, override = FALSE)
if(!istype(I, /obj/item/stack))
if(override)
return ..()
return FALSE
var/atom/real_location = real_location()
var/obj/item/stack/S = I
var/can_insert = min(S.amount, remaining_space())
if(!can_insert)
return FALSE
for(var/i in real_location) //combine.
if(QDELETED(I))
return
var/obj/item/stack/_S = i
if(!istype(_S))
continue
if(S.can_merge(_S))
_S.add(can_insert)
S.use(can_insert, TRUE)
return TRUE
I = S.split_stack(null, can_insert)
return ..()
/datum/component/storage/concrete/stack/remove_from_storage(obj/item/I, atom/new_location)
var/atom/real_location = real_location()
var/obj/item/stack/S = I
if(!istype(S))
return ..()
if(S.amount > S.max_amount)
var/overrun = S.amount - S.max_amount
S.amount = S.max_amount
var/obj/item/stack/temp = new S.type(real_location, overrun)
handle_item_insertion(temp)
return ..(S, new_location)
/datum/component/storage/concrete/stack/_process_numerical_display()
var/atom/real_location = real_location()
. = list()
for(var/i in real_location)
var/obj/item/stack/I = i
if(!istype(I) || QDELETED(I)) //We're specialized stack storage, just ignore non stacks.
continue
if(!.[I.merge_type])
.[I.merge_type] = new /datum/numbered_display(I, I.amount)
else
var/datum/numbered_display/ND = .[I.merge_type]
ND.number += I.amount