mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-04-23 16:57:09 +01:00
Done using this command sed -Ei 's/(\s*\S+)\s*\t+/\1 /g' code/**/*.dm We have countless examples in the codebase with this style gone wrong, and defines and such being on hideously different levels of indentation. Fixing this to keep the alignment involves tainting the blames of code your PR doesn't need to be touching at all. And ultimately, it's hideous. There are some files that this sed makes uglier. I can fix these when they are pointed out, but I believe this is ultimately for the greater good of readability. I'm more concerned with if any strings relied on this. Hi codeowners! Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
69 lines
2.0 KiB
Plaintext
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.merge_type == S.merge_type)
|
|
_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
|