bugfix / tweaks (#6959)

This commit is contained in:
silicons
2025-01-10 17:34:32 +01:00
committed by GitHub
parent a0e8babdf1
commit aed3013410
60 changed files with 677 additions and 287 deletions
+33 -8
View File
@@ -36,16 +36,19 @@
origin_tech = list(TECH_MATERIAL = 1)
icon = 'icons/obj/stacks.dmi'
item_flags = ITEM_CAREFUL_BLUDGEON | ITEM_ENCUMBERS_WHILE_HELD
/// Always create this type when splitting, instead of our own type.
var/split_type
/// The type we actually are. This is what is used when things try to consume an amount of us.
/// * null = this current type
var/stack_type
var/singular_name
var/amount = 1
/// See stack recipes initialisation, param "max_res_amount" must be equal to this max_amount.
var/max_amount = 50
/// Determines whether different stack types can merge.
var/stacktype
/// enforce a certain type when splitting; useful if you have an infinite stack you don't want to be split into another one
var/split_type
/// Used when directly applied to a turf.
var/build_type = null
var/stacktype_legacy
var/uses_charge = 0
var/list/charge_costs = null
var/list/datum/matter_synth/synths = null
@@ -70,8 +73,8 @@
explicit_recipes = typelist(NAMEOF(src, explicit_recipes), generate_explicit_recipes())
if(new_amount != null)
amount = new_amount
if(!stacktype)
stacktype = type
if(!stacktype_legacy)
stacktype_legacy = type
. = ..()
if(merge)
for(var/obj/item/stack/S in loc)
@@ -189,7 +192,7 @@
return FALSE
if((strict_color_stacking || other.strict_color_stacking) && (color != other.color))
return FALSE
return other.stacktype == stacktype
return other.stacktype_legacy == stacktype_legacy
/obj/item/stack/proc/use(used)
if (!can_use(used))
@@ -424,3 +427,25 @@
return FALSE
update_icon()
return TRUE
//* Types *//
/**
* Get our 'use as type'.
*/
/obj/item/stack/proc/get_use_as_type()
return stack_type || type
/**
* We can be used as a specific stack type.
*/
/obj/item/stack/proc/can_use_as_type(path)
return stack_type == path || type == path
/**
* Can merge into a type
*
* todo: use this instead of raw stacktype_legacy checks
*/
/obj/item/stack/proc/can_merge_into_type(path)
CRASH("Not implemented.")