diff --git a/code/__DEFINES/construction/material.dm b/code/__DEFINES/construction/material.dm index f01ea621183..462e69334ae 100644 --- a/code/__DEFINES/construction/material.dm +++ b/code/__DEFINES/construction/material.dm @@ -68,7 +68,7 @@ */ #define MATERIAL_NO_EDIBILITY (1<<6) -//Special return values of [/datum/component/material_container/insert_item] +//Special return values of [/datum/material_container/insert_item] /// No material was found inside them item #define MATERIAL_INSERT_ITEM_NO_MATS -1 /// The container does not have the space for the item diff --git a/code/__DEFINES/dcs/signals/signals_material_container.dm b/code/__DEFINES/dcs/signals/signals_material_container.dm index 86056976bce..f5faf4b9a67 100644 --- a/code/__DEFINES/dcs/signals/signals_material_container.dm +++ b/code/__DEFINES/dcs/signals/signals_material_container.dm @@ -1,13 +1,13 @@ //Material Container Signals -/// Called from datum/component/material_container/proc/can_hold_material() : (mat) +/// Called from datum/material_container/proc/can_hold_material() : (mat) #define COMSIG_MATCONTAINER_MAT_CHECK "matcontainer_mat_check" #define MATCONTAINER_ALLOW_MAT (1<<0) -/// Called from datum/component/material_container/proc/user_insert() : (target_item, user) +/// Called from datum/material_container/proc/user_insert() : (target_item, user) #define COMSIG_MATCONTAINER_PRE_USER_INSERT "matcontainer_pre_user_insert" #define MATCONTAINER_BLOCK_INSERT (1<<1) -/// Called from datum/component/material_container/proc/insert_item() : (item, primary_mat, mats_consumed, material_amount, context) +/// Called from datum/material_container/proc/insert_item() : (item, primary_mat, mats_consumed, material_amount, context) #define COMSIG_MATCONTAINER_ITEM_CONSUMED "matcontainer_item_consumed" -/// Called from datum/component/material_container/proc/retrieve_stack() : (new_stack, context) +/// Called from datum/material_container/proc/retrieve_stack() : (new_stack, context) #define COMSIG_MATCONTAINER_STACK_RETRIEVED "matcontainer_stack_retrieved" //mat container signals but from the ore silo's perspective diff --git a/code/datums/components/material/material_container.dm b/code/datums/material/material_container.dm similarity index 89% rename from code/datums/components/material/material_container.dm rename to code/datums/material/material_container.dm index a5a735dec96..4990e5bf764 100644 --- a/code/datums/components/material/material_container.dm +++ b/code/datums/material/material_container.dm @@ -12,7 +12,9 @@ //The full item was consumed #define MATERIAL_INSERT_ITEM_SUCCESS 1 -/datum/component/material_container +/datum/material_container + ///Parent to which this container is attached to + VAR_PRIVATE/atom/movable/parent /// The maximum amount of materials this material container can contain var/max_amount /// Map of material ref -> amount @@ -29,7 +31,8 @@ var/list/registered_signals /// Sets up the proper signals and fills the list of materials with the appropriate references. -/datum/component/material_container/Initialize( +/datum/material_container/New( + target, list/init_mats, max_amt = 0, _mat_container_flags = NONE, @@ -38,8 +41,7 @@ list/container_signals ) - if(!isatom(parent)) - return COMPONENT_INCOMPATIBLE + parent = target materials = list() max_amount = max(0, max_amt) @@ -67,52 +69,34 @@ for(var/signal in container_signals) parent.RegisterSignal(src, signal, container_signals[signal]) -/datum/component/material_container/Destroy(force) - materials = null - allowed_materials = null - return ..() - -/datum/component/material_container/RegisterWithParent() - . = ..() - - var/atom/atom_target = parent - //can we insert into this container if(!(mat_container_flags & MATCONTAINER_NO_INSERT)) //to insert stuff into the container - RegisterSignal(atom_target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert)) - RegisterSignal(atom_target, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert)) + RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_insert)) + RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION_SECONDARY, PROC_REF(on_secondary_insert)) //screen tips for inserting items - atom_target.flags_1 |= HAS_CONTEXTUAL_SCREENTIPS_1 - RegisterSignal(atom_target, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_requesting_context_from_item)) + parent.flags_1 |= HAS_CONTEXTUAL_SCREENTIPS_1 + RegisterSignal(parent, COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM, PROC_REF(on_requesting_context_from_item)) //to see available materials if(mat_container_flags & MATCONTAINER_EXAMINE) - RegisterSignal(atom_target, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) + RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) //drop sheets when the object is deconstructed but not deleted RegisterSignal(parent, COMSIG_OBJ_DECONSTRUCT, PROC_REF(drop_sheets)) -/datum/component/material_container/UnregisterFromParent() - var/list/signals = list() +/datum/material_container/Destroy(force) + materials = null + allowed_materials = null + return ..() - if(!(mat_container_flags & MATCONTAINER_NO_INSERT)) - signals += COMSIG_ATOM_ITEM_INTERACTION - signals += COMSIG_ATOM_ITEM_INTERACTION_SECONDARY - signals += COMSIG_ATOM_REQUESTING_CONTEXT_FROM_ITEM - if(mat_container_flags & MATCONTAINER_EXAMINE) - signals += COMSIG_ATOM_EXAMINE - signals += COMSIG_OBJ_DECONSTRUCT - - UnregisterSignal(parent, signals) - -/datum/component/material_container/proc/drop_sheets() +/datum/material_container/proc/drop_sheets() SIGNAL_HANDLER retrieve_all() -/datum/component/material_container/proc/on_examine(datum/source, mob/user, list/examine_texts) +/datum/material_container/proc/on_examine(datum/source, mob/user, list/examine_texts) SIGNAL_HANDLER for(var/I in materials) @@ -121,7 +105,7 @@ if(amt) examine_texts += span_notice("It has [amt] sheets of [LOWER_TEXT(M.name)] stored.") -/datum/component/material_container/vv_edit_var(var_name, var_value) +/datum/material_container/vv_edit_var(var_name, var_value) var/old_flags = mat_container_flags . = ..() if(var_name == NAMEOF(src, mat_container_flags) && parent) @@ -162,7 +146,7 @@ * chance to process the item * - user_data: in the form rendered by ID_DATA(user), for material logging (and if this component is connected to a silo, also for permission checking) */ -/datum/component/material_container/proc/insert_item_materials(obj/item/source, multiplier = 1, atom/context = parent, alist/user_data) +/datum/material_container/proc/insert_item_materials(obj/item/source, multiplier = 1, atom/context = parent, alist/user_data) var/primary_mat var/max_mat_value = 0 var/material_amount = 0 @@ -194,7 +178,7 @@ * - amt: amount of said material to insert * - mat: the material type to insert */ -/datum/component/material_container/proc/insert_amount_mat(amt, datum/material/mat) +/datum/material_container/proc/insert_amount_mat(amt, datum/material/mat) if(amt <= 0) return 0 amt = OPTIMAL_COST(amt) @@ -228,7 +212,7 @@ * * - delete_item: should we delete the item after its materials are consumed. does not apply to stacks if they were split due to lack of space * * - user_data - in the form rendered by ID_DATA(user), for material logging (and if this component is connected to a silo, also for permission checking) */ -/datum/component/material_container/proc/insert_item(obj/item/weapon, multiplier = 1, atom/context = parent, delete_item = TRUE, alist/user_data) +/datum/material_container/proc/insert_item(obj/item/weapon, multiplier = 1, atom/context = parent, delete_item = TRUE, alist/user_data) if(QDELETED(weapon)) return MATERIAL_INSERT_ITEM_NO_MATS multiplier = CEILING(multiplier, 0.01) @@ -278,7 +262,7 @@ * * user - the mob inserting this item * * context - the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_ITEM_CONSUMED and is used mostly for silo logging */ -/datum/component/material_container/proc/user_insert(obj/item/held_item, mob/living/user, atom/context = parent) +/datum/material_container/proc/user_insert(obj/item/held_item, mob/living/user, atom/context = parent) set waitfor = FALSE . = 0 @@ -489,18 +473,18 @@ if(!QDELETED(deleting)) //deleting parents also delete their children so we check qdel(deleting) -/datum/component/material_container/proc/on_item_insert(datum/source, mob/living/user, obj/item/weapon) +/datum/material_container/proc/on_item_insert(datum/source, mob/living/user, obj/item/weapon) SIGNAL_HANDLER // Don't insert material items with left click if (isstack(weapon)) return attempt_insert(user, weapon) -/datum/component/material_container/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/weapon) +/datum/material_container/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/weapon) SIGNAL_HANDLER return attempt_insert(user, weapon) /// Proc that allows players to fill the parent with mats -/datum/component/material_container/proc/attempt_insert(mob/living/user, obj/item/weapon) +/datum/material_container/proc/attempt_insert(mob/living/user, obj/item/weapon) //Allows you to attack the machine with iron sheets for e.g. if(!(mat_container_flags & MATCONTAINER_ANY_INTENT) && user.combat_mode) return @@ -524,7 +508,7 @@ * Arguments: * * amt - can this container hold this much amount of materials */ -/datum/component/material_container/proc/has_space(amt = 0) +/datum/material_container/proc/has_space(amt = 0) return (total_amount() + amt) <= max_amount /** @@ -533,7 +517,7 @@ * Arguments: * - [mat][/atom/material]: The material we are checking for insertability. */ -/datum/component/material_container/proc/can_hold_material(datum/material/mat) +/datum/material_container/proc/can_hold_material(datum/material/mat) if(mat in allowed_materials) return TRUE if(istype(mat) && ((mat.id in allowed_materials) || (mat.type in allowed_materials))) @@ -556,7 +540,7 @@ * b) If it's text then its an category material & there is no way to deal with it so return 0 * c) If normal material proceeds as usual */ -/datum/component/material_container/proc/get_material_amount(datum/material/mat) +/datum/material_container/proc/get_material_amount(datum/material/mat) if(!istype(mat)) mat = GET_MATERIAL_REF(mat) return materials[mat] @@ -568,7 +552,7 @@ * Arguments: * - [I][obj/item]: the item whos materials must be retrieved */ -/datum/component/material_container/proc/get_item_material_amount(obj/item/item) +/datum/material_container/proc/get_item_material_amount(obj/item/item) if(!istype(item) || !item.custom_materials) return 0 var/material_amount = 0 @@ -583,7 +567,7 @@ //=========================================HIGH LEVEL========================================== /// returns the total amount of material in the container -/datum/component/material_container/proc/total_amount() +/datum/material_container/proc/total_amount() . = 0 for(var/i in materials) . += get_material_amount(i) @@ -595,7 +579,7 @@ * - [req_mat][datum/material]: the material to check for * - amount: how much material do we need */ -/datum/component/material_container/proc/has_enough_of_material(datum/material/req_mat, amount = 1) +/datum/material_container/proc/has_enough_of_material(datum/material/req_mat, amount = 1) return get_material_amount(req_mat) >= OPTIMAL_COST(amount) @@ -608,7 +592,7 @@ * - coefficient: scaling applied to 1 unit of material in the mats list * - multiplier: how many units(after scaling) do we require */ -/datum/component/material_container/proc/has_materials(list/mats, coefficient = 1, multiplier = 1) +/datum/material_container/proc/has_materials(list/mats, coefficient = 1, multiplier = 1) if(!length(mats)) return FALSE @@ -632,7 +616,7 @@ * - amt: amount of said material to use * - [mat][datum/material]: type of mat to use */ -/datum/component/material_container/proc/use_amount_mat(amt, datum/material/mat) +/datum/material_container/proc/use_amount_mat(amt, datum/material/mat) //round amount amt = OPTIMAL_COST(amt) @@ -658,7 +642,7 @@ * - coefficient: how much fraction of unit material in the mats list must be consumed. This is usually your machines efficiency * - multiplier: how many units of material in the mats list(after each unit is multiplied and rounded with coefficient) must be consumed, This is usually your print quantity */ -/datum/component/material_container/proc/use_materials(list/mats, coefficient = 1, multiplier = 1) +/datum/material_container/proc/use_materials(list/mats, coefficient = 1, multiplier = 1) if(!mats || !length(mats)) return FALSE @@ -682,7 +666,7 @@ * [atom][context]: context - the atom performing the operation, this is the last argument sent in COMSIG_MATCONTAINER_STACK_RETRIEVED and is used mostly for silo logging * user_data - in the form rendered by ID_DATA(user), for material logging (and if this component is connected to a silo, also for permission checking) */ -/datum/component/material_container/proc/retrieve_stack(stack_amt, datum/material/material, atom/target = null, atom/context = parent, alist/user_data) +/datum/material_container/proc/retrieve_stack(stack_amt, datum/material/material, atom/target = null, atom/context = parent, alist/user_data) //do we support sheets of this material if(!material.sheet_type) return 0 //Add greyscale sheet handling here later @@ -736,7 +720,7 @@ * - target: drop location of the sheets * - context: the atom which is ejecting the sheets. Used mostly in silo logging */ -/datum/component/material_container/proc/retrieve_all(target = null, atom/context = parent) +/datum/material_container/proc/retrieve_all(target = null, atom/context = parent) var/result = 0 for(var/MAT in materials) result += retrieve_stack(amount2sheet(materials[MAT]), MAT, target, context, user_data = ID_DATA(null)) @@ -744,13 +728,13 @@ //============================================================================================ -/datum/component/material_container/ui_static_data(mob/user) +/datum/material_container/ui_static_data(mob/user) var/list/data = list() data["SHEET_MATERIAL_AMOUNT"] = SHEET_MATERIAL_AMOUNT return data /// List format is list(material_name = list(amount = ..., ref = ..., etc.)) -/datum/component/material_container/ui_data(mob/user) +/datum/material_container/ui_data(mob/user) var/list/data = list() for(var/datum/material/material as anything in materials) @@ -773,7 +757,7 @@ * * held_item - refers to the item that has materials accepted by the material container * * user - refers to user who will see the screentip when the proper context and tool are there */ -/datum/component/material_container/proc/on_requesting_context_from_item(datum/source, list/context, obj/item/held_item, mob/living/user) +/datum/material_container/proc/on_requesting_context_from_item(datum/source, list/context, obj/item/held_item, mob/living/user) SIGNAL_HANDLER if(isnull(held_item)) diff --git a/code/datums/components/material/remote_materials.dm b/code/datums/material/remote_materials.dm similarity index 84% rename from code/datums/components/material/remote_materials.dm rename to code/datums/material/remote_materials.dm index 1a930e48e70..9f15f3d0cb5 100644 --- a/code/datums/components/material/remote_materials.dm +++ b/code/datums/material/remote_materials.dm @@ -5,16 +5,18 @@ fallback to a local material storage in case remote storage is unavailable, and handles linking back and forth. */ -/datum/component/remote_materials +/datum/remote_materials // Three possible states: // 1. silo exists, materials is parented to silo // 2. silo is null, materials is parented to parent // 3. silo is null, materials is null + ///Movable this connection is attached to + var/atom/movable/parent ///The silo machine this container is connected to var/obj/machinery/ore_silo/silo ///Material container. the value is either the silo or local - var/datum/component/material_container/mat_container + var/datum/material_container/mat_container ///Should we create a local storage if we can't connect to silo var/allow_standalone ///Local size of container when silo = null @@ -26,15 +28,15 @@ handles linking back and forth. ///Callback for round start silo connections. Have to cancel this if the parent gets destroyed before round start VAR_PRIVATE/datum/callback/connection -/datum/component/remote_materials/Initialize( +/datum/remote_materials/New( + parent, mapload, allow_standalone = TRUE, force_connect = FALSE, mat_container_flags = NONE, list/mat_container_signals = null, ) - if (!isatom(parent)) - return COMPONENT_INCOMPATIBLE + src.parent = parent src.allow_standalone = allow_standalone src.mat_container_flags = mat_container_flags @@ -60,7 +62,7 @@ handles linking back and forth. * connect_to_silo- if true connect to global silo. If not successfull then go to local storage * only if allow_standalone = TRUE, else you a null mat_container */ -/datum/component/remote_materials/proc/_PrepareStorage(connect_to_silo) +/datum/remote_materials/proc/_PrepareStorage(connect_to_silo) PRIVATE_PROC(TRUE) connection = null @@ -75,25 +77,24 @@ handles linking back and forth. if (!mat_container && allow_standalone) _MakeLocal() -/datum/component/remote_materials/Destroy() +/datum/remote_materials/Destroy() if(connection) LAZYREMOVE(SSticker.round_start_events, connection) connection = null if(silo) allow_standalone = FALSE disconnect() - if(mat_container) - mat_container = null + QDEL_NULL(mat_container) return ..() -/datum/component/remote_materials/proc/_MakeLocal() +/datum/remote_materials/proc/_MakeLocal() PRIVATE_PROC(TRUE) silo = null - mat_container = parent.AddComponent( \ - /datum/component/material_container, \ + mat_container = new ( \ + parent, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ local_size, \ mat_container_flags, \ @@ -102,7 +103,7 @@ handles linking back and forth. ) /// Adds/Removes this connection from the silo -/datum/component/remote_materials/proc/toggle_holding() +/datum/remote_materials/proc/toggle_holding() if(isnull(silo)) return @@ -117,13 +118,13 @@ handles linking back and forth. * * * size - the new size for local storage. measured in SHEET_MATERIAL_SIZE units */ -/datum/component/remote_materials/proc/set_local_size(size) +/datum/remote_materials/proc/set_local_size(size) local_size = size if (!silo && mat_container) mat_container.max_amount = size ///Disconnects this component from the silo -/datum/component/remote_materials/proc/disconnect() +/datum/remote_materials/proc/disconnect() if(isnull(silo)) return @@ -133,7 +134,7 @@ handles linking back and forth. if (allow_standalone) _MakeLocal() -/datum/component/remote_materials/proc/OnMultitool(datum/source, mob/user, obj/item/multitool/M) +/datum/remote_materials/proc/OnMultitool(datum/source, mob/user, obj/item/multitool/M) SIGNAL_HANDLER . = NONE @@ -146,7 +147,7 @@ handles linking back and forth. return ITEM_INTERACT_BLOCKING var/obj/machinery/ore_silo/new_silo = M.buffer - var/datum/component/material_container/new_container = new_silo.GetComponent(/datum/component/material_container) + var/datum/material_container/new_container = new_silo.materials if (silo) silo.disconnect_receptacle(src, parent) else if (mat_container) @@ -166,18 +167,18 @@ handles linking back and forth. to_chat(user, span_notice("You connect [parent] to [silo] from the multitool's buffer.")) return ITEM_INTERACT_SUCCESS -/datum/component/remote_materials/proc/on_item_insert(datum/source, mob/living/user, obj/item/target) +/datum/remote_materials/proc/on_item_insert(datum/source, mob/living/user, obj/item/target) SIGNAL_HANDLER // Only insert stacks with left click if(isstack(target)) return attempt_insert(user, target) -/datum/component/remote_materials/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/target) +/datum/remote_materials/proc/on_secondary_insert(datum/source, mob/living/user, obj/item/target) SIGNAL_HANDLER return attempt_insert(user, target) /// Insert mats into silo -/datum/component/remote_materials/proc/attempt_insert(mob/living/user, obj/item/target) +/datum/remote_materials/proc/attempt_insert(mob/living/user, obj/item/target) if(!(mat_container_flags & MATCONTAINER_ANY_INTENT) && user.combat_mode) return @@ -194,14 +195,14 @@ handles linking back and forth. * * Returns true if both are on the station or same z level */ -/datum/component/remote_materials/proc/check_z_level(obj/silo_to_check = silo) +/datum/remote_materials/proc/check_z_level(obj/silo_to_check = silo) if(isnull(silo_to_check)) return FALSE return is_valid_z_level(get_turf(silo_to_check), get_turf(parent)) /// returns TRUE if this connection put on hold by the silo -/datum/component/remote_materials/proc/on_hold() +/datum/remote_materials/proc/on_hold() return check_z_level() ? silo.holds[src] : FALSE /** @@ -214,7 +215,7 @@ handles linking back and forth. * * check_hold - should we check if the silo is on hold * * user_data - in the form rendered by ID_DATA(user); used as a reference for silo bans and access checks */ -/datum/component/remote_materials/proc/can_use_resource(check_hold = TRUE, alist/user_data) +/datum/remote_materials/proc/can_use_resource(check_hold = TRUE, alist/user_data) var/atom/movable/movable_parent = parent if (!istype(movable_parent)) return FALSE @@ -240,7 +241,7 @@ handles linking back and forth. * name- For logging only. the design you are trying to build e.g. matter bin, etc. * user_data - in the form rendered by ID_DATA(user), for material logging and (if this component is connected to a silo), permission checking */ -/datum/component/remote_materials/proc/use_materials(list/mats, coefficient = 1, multiplier = 1, action = "processed", name = "design", alist/user_data) +/datum/remote_materials/proc/use_materials(list/mats, coefficient = 1, multiplier = 1, action = "processed", name = "design", alist/user_data) if(!can_use_resource(user_data = user_data)) return 0 @@ -263,7 +264,7 @@ handles linking back and forth. * [drop_target][atom]- optional where to drop the sheets. null means it is dropped at this components parent location * user_data - in the form rendered by ID_DATA(user), for material logging and (if this component is connected to a silo), permission checking */ -/datum/component/remote_materials/proc/eject_sheets(datum/material/material_ref, eject_amount, atom/drop_target = null, alist/user_data) +/datum/remote_materials/proc/eject_sheets(datum/material/material_ref, eject_amount, atom/drop_target = null, alist/user_data) if(!can_use_resource(user_data = user_data)) return 0 @@ -281,7 +282,7 @@ handles linking back and forth. * * multiplier - the multiplier applied on the materials consumed * * user_data - an alist in the form rendered by ID_DATA(user), for logging who/where/when the item was inserted */ -/datum/component/remote_materials/proc/insert_item(obj/item/weapon, multiplier = 1, alist/user_data) +/datum/remote_materials/proc/insert_item(obj/item/weapon, multiplier = 1, alist/user_data) // Inserting materials automatically shouldn't be permission-restricted if(!islist(user_data)) user_data = ID_DATA(null) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 5fa595c1de1..1636380afe3 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -26,7 +26,7 @@ ///Designs imported from technology disks that we can print. var/list/imported_designs = list() ///The container to hold materials - var/datum/component/material_container/materials + var/datum/material_container/materials ///direction we output onto (if 0, on top of us) var/drop_direction = 0 //looping sound for printing items @@ -34,8 +34,8 @@ /obj/machinery/autolathe/Initialize(mapload) print_sound = new(src, FALSE) - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_ITEM_MATERIAL], \ 0, \ MATCONTAINER_EXAMINE|MATCONTAINER_ACCEPT_ALLOYS, \ @@ -52,7 +52,7 @@ /obj/machinery/autolathe/Destroy() QDEL_NULL(print_sound) - materials = null + QDEL_NULL(materials) return ..() /obj/machinery/autolathe/examine(mob/user) diff --git a/code/game/machinery/drone_dispenser.dm b/code/game/machinery/drone_dispenser.dm index f51ffc466b1..1bce7764543 100644 --- a/code/game/machinery/drone_dispenser.dm +++ b/code/game/machinery/drone_dispenser.dm @@ -66,12 +66,12 @@ /// Sound that the drone dispnser plays when it's broken. var/break_sound = 'sound/machines/warning-buzzer.ogg' /// Reference to the object's internal storage for materials. - var/datum/component/material_container/materials + var/datum/material_container/materials /obj/machinery/drone_dispenser/Initialize(mapload) . = ..() - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ list(/datum/material/iron, /datum/material/glass), \ SHEET_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, \ MATCONTAINER_EXAMINE, \ @@ -84,7 +84,7 @@ REGISTER_REQUIRED_MAP_ITEM(1, 1) /obj/machinery/drone_dispenser/Destroy() - materials = null + QDEL_NULL(materials) return ..() /obj/machinery/drone_dispenser/preloaded diff --git a/code/game/machinery/flatpacker.dm b/code/game/machinery/flatpacker.dm index 15dc0ed2fc3..011ddf7f1b1 100644 --- a/code/game/machinery/flatpacker.dm +++ b/code/game/machinery/flatpacker.dm @@ -16,7 +16,7 @@ /// Coefficient applied to consumed materials. Lower values result in lower material consumption. var/creation_efficiency = 2 ///The container to hold materials - var/datum/component/material_container/materials + var/datum/material_container/materials /// The inserted board var/obj/item/circuitboard/machine/inserted_board /// List of components that need to be packed along with the circuitboard @@ -33,8 +33,8 @@ /obj/machinery/flatpacker/Initialize(mapload) register_context() - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ 0, \ MATCONTAINER_EXAMINE, \ @@ -44,10 +44,10 @@ return ..() /obj/machinery/flatpacker/Destroy() - materials = null + QDEL_NULL(materials) QDEL_NULL(inserted_board) QDEL_LIST(flatpacked_components) - . = ..() + return ..() /obj/machinery/flatpacker/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = NONE diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index e8a0a823871..3eacf7b7f9f 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -16,14 +16,14 @@ var/datum/callback/charge_cell ///Whether we're sending iron and glass to a cyborg. Requires Silo connection. var/sendmats = FALSE - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials /obj/machinery/recharge_station/Initialize(mapload) . = ..() - materials = AddComponent( - /datum/component/remote_materials, \ + materials = new ( + src, \ mapload, \ mat_container_flags = MATCONTAINER_NO_INSERT, \ ) @@ -46,7 +46,7 @@ GLOB.roundstart_station_borgcharger_areas += area_name /obj/machinery/recharge_station/Destroy() - materials = null + QDEL_NULL(materials) charge_cell = null return ..() diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index eb937cc538b..fc17fbf1740 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -16,11 +16,11 @@ var/crush_damage = 1000 var/eat_victim_items = TRUE var/item_recycle_sound = 'sound/items/tools/welder.ogg' - var/datum/component/material_container/materials + var/datum/material_container/materials /obj/machinery/recycler/Initialize(mapload) - materials = AddComponent( - /datum/component/material_container, \ + materials = new ( + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ INFINITY, \ MATCONTAINER_NO_INSERT \ @@ -45,7 +45,7 @@ AddElement(/datum/element/connect_loc, loc_connections) /obj/machinery/recycler/Destroy() - materials = null + QDEL_NULL(materials) return ..() /obj/machinery/recycler/RefreshParts() diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index 815b35213b9..c689318ddc4 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -7,12 +7,12 @@ circuit = /obj/item/circuitboard/machine/sheetifier layer = BELOW_OBJ_LAYER var/busy_processing = FALSE - var/datum/component/material_container/materials + var/datum/material_container/materials /obj/machinery/sheetifier/Initialize(mapload) . = ..() - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ list(/datum/material/meat, /datum/material/hauntium), \ SHEET_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, \ MATCONTAINER_EXAMINE, \ @@ -24,7 +24,7 @@ ) /obj/machinery/sheetifier/Destroy() - materials = null + QDEL_NULL(materials) return ..() /obj/machinery/sheetifier/update_overlays() diff --git a/code/game/objects/items/rcd/RHD.dm b/code/game/objects/items/rcd/RHD.dm index 065982a94d7..ccd2b9f5063 100644 --- a/code/game/objects/items/rcd/RHD.dm +++ b/code/game/objects/items/rcd/RHD.dm @@ -35,7 +35,7 @@ /// bitflags for banned upgrades var/banned_upgrades = NONE /// remote connection to the silo - var/datum/component/remote_materials/silo_mats + var/datum/remote_materials/silo_mats /// switch to use internal or remote storage var/silo_link = FALSE /// has the blueprint design changed @@ -51,9 +51,13 @@ spark_system.set_up(5, 0, src) spark_system.attach(src) if(construction_upgrades & RCD_UPGRADE_SILO_LINK) - silo_mats = AddComponent(/datum/component/remote_materials, mapload, FALSE) + silo_mats = new (src, mapload, FALSE) update_appearance() +/obj/item/construction/Destroy() + QDEL_NULL(silo_mats) + return ..() + ///An do_after() specially designed for rhd devices /obj/item/construction/proc/build_delay(mob/user, delay, atom/target) if(delay <= 0) @@ -122,7 +126,7 @@ return FALSE construction_upgrades |= design_disk.upgrade if((design_disk.upgrade & RCD_UPGRADE_SILO_LINK) && !silo_mats) - silo_mats = AddComponent(/datum/component/remote_materials, FALSE, FALSE) + silo_mats = new (src, FALSE, FALSE) playsound(loc, 'sound/machines/click.ogg', 50, TRUE) qdel(design_disk) update_static_data_for_all_viewers() diff --git a/code/modules/admin/verbs/map_export.dm b/code/modules/admin/verbs/map_export.dm index 398f85170fe..27a58116634 100644 --- a/code/modules/admin/verbs/map_export.dm +++ b/code/modules/admin/verbs/map_export.dm @@ -56,7 +56,7 @@ ADMIN_VERB(map_export, R_DEBUG, "Map Export", "Select a part of the map by coord // Save resources in silo /obj/machinery/ore_silo/on_object_saved() var/data - var/datum/component/material_container/material_holder = GetComponent(/datum/component/material_container) + var/datum/material_container/material_holder = materials for(var/each in material_holder.materials) var/amount = material_holder.materials[each] / 100 var/datum/material/material_datum = each diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 909f835b1c9..2dd1efe85a5 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -14,13 +14,13 @@ /// Typepath of created banana var/banana_type = /obj/item/grown/bananapeel/specialpeel /// Material container for bananium - var/datum/component/material_container/bananium + var/datum/material_container/bananium /obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize(mapload) . = ..() AddElement(/datum/element/update_icon_updates_onmob) - bananium = AddComponent( - /datum/component/material_container, \ + bananium = new ( + src, \ list(/datum/material/bananium), \ 100 * SHEET_MATERIAL_AMOUNT, \ MATCONTAINER_EXAMINE | MATCONTAINER_ANY_INTENT | MATCONTAINER_SILENT, \ @@ -32,7 +32,7 @@ LAZYOR(clothing_traits, TRAIT_NO_SLIP_WATER) /obj/item/clothing/shoes/clown_shoes/banana_shoes/Destroy() - bananium = null + QDEL_NULL(bananium) return ..() /obj/item/clothing/shoes/clown_shoes/banana_shoes/proc/toggle_clowning_action() diff --git a/code/modules/manufactorio/machines/lathe.dm b/code/modules/manufactorio/machines/lathe.dm index d2a4e65f677..6a32b3ed953 100644 --- a/code/modules/manufactorio/machines/lathe.dm +++ b/code/modules/manufactorio/machines/lathe.dm @@ -8,7 +8,7 @@ /// design id we print var/design_id ///The container to hold materials - var/datum/component/material_container/materials + var/datum/material_container/materials //looping sound for printing items var/datum/looping_sound/lathe_print/print_sound ///Designs related to the autolathe @@ -20,8 +20,8 @@ /obj/machinery/power/manufacturing/lathe/Initialize(mapload) print_sound = new(src, FALSE) - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_ITEM_MATERIAL], \ 0, \ MATCONTAINER_EXAMINE|MATCONTAINER_NO_INSERT, \ @@ -32,6 +32,10 @@ GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe] = new /datum/techweb/autounlocking/autolathe stored_research = GLOB.autounlock_techwebs[/datum/techweb/autounlocking/autolathe] +/obj/machinery/power/manufacturing/lathe/Destroy() + QDEL_NULL(materials) + return ..() + /obj/machinery/power/manufacturing/lathe/add_context(atom/source, list/context, obj/item/held_item, mob/user) . = NONE if(isnull(held_item)) diff --git a/code/modules/mining/boulder_processing/_boulder_processing.dm b/code/modules/mining/boulder_processing/_boulder_processing.dm index 8bb923b9645..39cc7266b65 100644 --- a/code/modules/mining/boulder_processing/_boulder_processing.dm +++ b/code/modules/mining/boulder_processing/_boulder_processing.dm @@ -16,7 +16,7 @@ /// What sound plays when a thing operates? var/usage_sound = 'sound/machines/mining/wooping_teleport.ogg' /// Silo link to its materials list. - var/datum/component/remote_materials/silo_materials + var/datum/remote_materials/silo_materials /// Mining points held by the machine for miners. var/points_held = 0 ///The action verb to display to players @@ -30,8 +30,8 @@ /obj/machinery/bouldertech/Initialize(mapload) . = ..() - silo_materials = AddComponent( - /datum/component/remote_materials, \ + silo_materials = new ( + src, \ mapload, \ mat_container_flags = MATCONTAINER_NO_INSERT \ ) @@ -46,7 +46,7 @@ AddElement(/datum/element/connect_loc, loc_connections) /obj/machinery/bouldertech/Destroy() - silo_materials = null + QDEL_NULL(silo_materials) return ..() /obj/machinery/bouldertech/on_deconstruction(disassembled) diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index a2515ac76dd..f41c0aeef17 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -142,7 +142,7 @@ ///Proximity monitor associated with this atom, needed for proximity checks. var/datum/proximity_monitor/proximity_monitor ///Material container for materials - var/datum/component/material_container/materials + var/datum/material_container/materials /// What can be input into the machine? var/accepted_type = /obj/item/stack @@ -150,8 +150,8 @@ . = ..() proximity_monitor = new(src, 1) - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ INFINITY, \ MATCONTAINER_EXAMINE, \ @@ -163,7 +163,8 @@ selected_material = GET_MATERIAL_REF(/datum/material/iron) /obj/machinery/mineral/processing_unit/Destroy() - materials = null + QDEL_NULL(proximity_monitor) + QDEL_NULL(materials) mineral_machine = null stored_research = null return ..() diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 580c5bf7b58..e32783b5e25 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -41,7 +41,7 @@ /// References the alloys the smelter can create var/datum/techweb/stored_research /// Linkage to the ORM silo - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials /obj/machinery/mineral/ore_redemption/offstation circuit = /obj/item/circuitboard/machine/ore_redemption/offstation @@ -59,8 +59,8 @@ local_signals = list( COMSIG_MATCONTAINER_ITEM_CONSUMED = TYPE_PROC_REF(/obj/machinery/mineral/ore_redemption, local_redeem_points) ) - materials = AddComponent( \ - /datum/component/remote_materials, \ + materials = new ( \ + src, \ mapload, \ mat_container_signals = local_signals \ ) @@ -70,7 +70,7 @@ /obj/machinery/mineral/ore_redemption/Destroy() stored_research = null - materials = null + QDEL_NULL(materials) return ..() /obj/machinery/mineral/ore_redemption/examine(mob/user) @@ -92,7 +92,7 @@ /// Returns the amount of a specific alloy design, based on the accessible materials /obj/machinery/mineral/ore_redemption/proc/can_smelt_alloy(datum/design/D) - var/datum/component/material_container/mat_container = materials.mat_container + var/datum/material_container/mat_container = materials.mat_container if(!mat_container || D.make_reagent) return FALSE @@ -119,7 +119,7 @@ /// Sends a message to the request consoles that signed up for ore updates /obj/machinery/mineral/ore_redemption/proc/send_console_message() - var/datum/component/material_container/mat_container = materials.mat_container + var/datum/material_container/mat_container = materials.mat_container if(!mat_container || !is_station_level(z)) return @@ -250,7 +250,7 @@ var/list/data = list() data["unclaimedPoints"] = points data["materials"] = list() - var/datum/component/material_container/mat_container = materials.mat_container + var/datum/material_container/mat_container = materials.mat_container if (mat_container) for(var/datum/material/material as anything in mat_container.materials) var/amount = mat_container.materials[material] @@ -310,7 +310,7 @@ . = ..() if(.) return - var/datum/component/material_container/mat_container = materials.mat_container + var/datum/material_container/mat_container = materials.mat_container switch(action) if("Claim") //requires silo but silo not in range diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index d408ef29592..27eae573c87 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -38,9 +38,9 @@ /// List of all connected components that are on hold from accessing materials. var/list/holds = list() /// List of all components that are sharing ores with this silo. - var/list/datum/component/remote_materials/ore_connected_machines = list() + var/list/datum/remote_materials/ore_connected_machines = list() /// Material Container - var/datum/component/material_container/materials + var/datum/material_container/materials /// A list of names of bank account IDs that are banned from using this ore silo. var/list/banned_users = list() ///The machine's internal radio, used to broadcast alerts. @@ -71,8 +71,8 @@ /obj/machinery/ore_silo/Initialize(mapload) . = ..() - materials = AddComponent( \ - /datum/component/material_container, \ + materials = new ( \ + src, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ INFINITY, \ MATCONTAINER_EXAMINE, \ @@ -95,11 +95,11 @@ if (GLOB.ore_silo_default == src) GLOB.ore_silo_default = null - for(var/datum/component/remote_materials/mats as anything in ore_connected_machines) + for(var/datum/remote_materials/mats as anything in ore_connected_machines) mats.disconnect() ore_connected_machines = null - materials = null + QDEL_NULL(materials) QDEL_NULL(radio) return ..() @@ -146,14 +146,14 @@ context[SCREENTIP_CONTEXT_LMB] = "Deconstruct" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/ore_silo/proc/on_item_consumed(datum/component/material_container/container, obj/item/item_inserted, last_inserted_id, mats_consumed, amount_inserted, atom/context, alist/user_data) +/obj/machinery/ore_silo/proc/on_item_consumed(datum/material_container/container, obj/item/item_inserted, last_inserted_id, mats_consumed, amount_inserted, atom/context, alist/user_data) SIGNAL_HANDLER silo_log(context, "DEPOSITED", amount_inserted, item_inserted.name, mats_consumed, user_data) SEND_SIGNAL(context, COMSIG_SILO_ITEM_CONSUMED, container, item_inserted, last_inserted_id, mats_consumed, amount_inserted) -/obj/machinery/ore_silo/proc/log_sheets_ejected(datum/component/material_container/container, obj/item/stack/sheet/sheets, atom/context, alist/user_data) +/obj/machinery/ore_silo/proc/log_sheets_ejected(datum/material_container/container, obj/item/stack/sheet/sheets, atom/context, alist/user_data) SIGNAL_HANDLER silo_log(context, "WITHDRAWN", -sheets.amount * SHEET_MATERIAL_AMOUNT, "[sheets.name]", sheets.custom_materials, user_data) @@ -178,12 +178,12 @@ * The logic for disconnecting a remote receptacle (RCD, fabricator, etc.) is collected here for sanity's sake * rather than being on specific types. Serves to agnosticize the remote_materials component somewhat rather than * snowflaking code for silos into the component. - * * receptacle - The datum/component/remote_materials component that is getting connected. + * * receptacle - The datum/remote_materials component that is getting connected. * * physical_receptacle - the actual object in the game world that was connected to our material supply. Typed as atom/movable for * future-proofing against anything that may conceivably one day have remote silo access, such as a cyborg, an implant, structures, vehicles, * and so-on. */ -/obj/machinery/ore_silo/proc/connect_receptacle(datum/component/remote_materials/receptacle, atom/movable/physical_receptacle) +/obj/machinery/ore_silo/proc/connect_receptacle(datum/remote_materials/receptacle, atom/movable/physical_receptacle) ore_connected_machines += receptacle receptacle.mat_container = src.materials receptacle.silo = src @@ -192,12 +192,12 @@ /** * The logic for disconnecting a remote receptacle (RCD, fabricator, etc.) is collected here for sanity's sake * rather than being on specific types. Cleans up references to us and to the receptacle. - * * receptacle - The datum/component/remote_materials component that is getting destroyed. + * * receptacle - The datum/remote_materials component that is getting destroyed. * * physical_receptacle - the actual object in the game world that was connected to our material supply. Typed as atom/movable for * future-proofing against anything that may conceivably one day have remote silo access, such as a cyborg, an implant, structures, vehicles, * and so-on. */ -/obj/machinery/ore_silo/proc/disconnect_receptacle(datum/component/remote_materials/receptacle, atom/movable/physical_receptacle) +/obj/machinery/ore_silo/proc/disconnect_receptacle(datum/remote_materials/receptacle, atom/movable/physical_receptacle) ore_connected_machines -= receptacle receptacle.mat_container = null receptacle.silo = null @@ -249,7 +249,7 @@ data["materials"] = materials.ui_data() data["machines"] = list() - for(var/datum/component/remote_materials/remote as anything in ore_connected_machines) + for(var/datum/remote_materials/remote as anything in ore_connected_machines) var/atom/parent = remote.parent data["machines"] += list( list( @@ -294,7 +294,7 @@ if(isnull(index)) return - var/datum/component/remote_materials/remote = ore_connected_machines[index] + var/datum/remote_materials/remote = ore_connected_machines[index] if(isnull(remote)) return @@ -310,7 +310,7 @@ if(isnull(index)) return - var/datum/component/remote_materials/remote = ore_connected_machines[index] + var/datum/remote_materials/remote = ore_connected_machines[index] if(isnull(remote)) return diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm index cf04c6e86ac..bcab99a54be 100644 --- a/code/modules/mining/machine_stacking.dm +++ b/code/modules/mining/machine_stacking.dm @@ -99,7 +99,7 @@ var/stk_amt = list() var/stack_list[0] //Key: Type. Value: Instance of type. var/stack_amt = 50 //amount to stack before releassing - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials var/force_connect = FALSE ///Proximity monitor associated with this atom, needed for proximity checks. var/datum/proximity_monitor/proximity_monitor @@ -112,8 +112,8 @@ /obj/machinery/mineral/stacking_machine/Initialize(mapload) . = ..() proximity_monitor = new(src, 1) - materials = AddComponent( - /datum/component/remote_materials, \ + materials = new ( + src, \ mapload, \ FALSE, \ (mapload && force_connect) \ @@ -123,7 +123,8 @@ if(!isnull(console)) console.machine = null console = null - materials = null + QDEL_NULL(proximity_monitor) + QDEL_NULL(materials) return ..() /obj/machinery/mineral/stacking_machine/HasProximity(atom/movable/entered) diff --git a/code/modules/mob/living/silicon/robot/robot_model.dm b/code/modules/mob/living/silicon/robot/robot_model.dm index fbdccc3e1f3..13fd3d53d4b 100644 --- a/code/modules/mob/living/silicon/robot/robot_model.dm +++ b/code/modules/mob/living/silicon/robot/robot_model.dm @@ -197,7 +197,7 @@ if(!istype(charger)) return - var/datum/component/material_container/mat_container = charger.materials.mat_container + var/datum/material_container/mat_container = charger.materials.mat_container if(!mat_container || charger.materials.on_hold()) charger.sendmats = FALSE return diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index 5cbe35c77d0..e9f6d1543a7 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -830,7 +830,7 @@ ) /// Materials that will be extracted. var/list/accepted_mats - var/datum/component/material_container/container + var/datum/material_container/container /obj/item/mod/module/recycler/Initialize(mapload) . = ..() @@ -838,8 +838,8 @@ if(!length(accepted_mats)) accepted_mats = SSmaterials.materials_by_category[MAT_CATEGORY_SILO] - container = AddComponent( \ - /datum/component/material_container, \ + container = new ( \ + src, \ accepted_mats, \ 50 * SHEET_MATERIAL_AMOUNT, \ MATCONTAINER_EXAMINE | MATCONTAINER_NO_INSERT, \ @@ -849,7 +849,7 @@ ) /obj/item/mod/module/recycler/Destroy() - container = null + QDEL_NULL(container) return ..() /obj/item/mod/module/recycler/on_activation(mob/activator) diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 9fc61e3d135..03fba49ac07 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -8,7 +8,7 @@ /// The efficiency coefficient. Material costs and print times are multiplied by this number; var/efficiency_coeff = 1 /// The material storage used by this fabricator. - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials /// Which departments are allowed to process this design var/allowed_department_flags = ALL /// Icon state when production has started @@ -28,8 +28,8 @@ /obj/machinery/rnd/production/Initialize(mapload) print_sound = new(src, FALSE) - materials = AddComponent( - /datum/component/remote_materials, \ + materials = new ( + src, \ mapload, \ mat_container_signals = list( \ COMSIG_MATCONTAINER_ITEM_CONSUMED = TYPE_PROC_REF(/obj/machinery/rnd/production, local_material_insert) @@ -53,9 +53,9 @@ update_icon(UPDATE_OVERLAYS) /obj/machinery/rnd/production/Destroy() - QDEL_NULL(print_sound) - materials = null cached_designs = null + QDEL_NULL(print_sound) + QDEL_NULL(materials) return ..() // Stuff for the stripe on the department machines diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index a8fc1e07726..4175c1fc0b6 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -45,7 +45,7 @@ var/link_on_init = TRUE /// Reference to a remote material inventory, such as an ore silo. - var/datum/component/remote_materials/rmat + var/datum/remote_materials/rmat /// All designs in the techweb that can be fabricated by this machine, since the last update. var/list/datum/design/cached_designs @@ -58,11 +58,12 @@ /obj/machinery/mecha_part_fabricator/Initialize(mapload) print_sound = new(src, FALSE) - rmat = AddComponent(/datum/component/remote_materials, mapload && link_on_init) + rmat = new (src, mapload && link_on_init) cached_designs = list() return ..() /obj/machinery/mecha_part_fabricator/Destroy() + QDEL_NULL(rmat) QDEL_NULL(print_sound) return ..() @@ -224,7 +225,7 @@ if(!D || length(D.reagents_list)) return FALSE - var/datum/component/material_container/materials = rmat.mat_container + var/datum/material_container/materials = rmat.mat_container if (!materials) if(verbose) say("No access to material storage, please contact the quartermaster.") diff --git a/code/modules/wiremod/core/component_printer.dm b/code/modules/wiremod/core/component_printer.dm index c1f39f3d48d..48baef54b89 100644 --- a/code/modules/wiremod/core/component_printer.dm +++ b/code/modules/wiremod/core/component_printer.dm @@ -7,7 +7,7 @@ circuit = /obj/item/circuitboard/machine/component_printer /// The internal material bus - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials density = TRUE @@ -22,7 +22,7 @@ /obj/machinery/component_printer/Initialize(mapload) . = ..() - materials = AddComponent(/datum/component/remote_materials, mapload) + materials = new (src, mapload) /obj/machinery/component_printer/post_machine_initialize() . = ..() @@ -31,6 +31,10 @@ if(techweb) on_connected_techweb() +/obj/machinery/component_printer/Destroy(force) + QDEL_NULL(materials) + return ..() + /obj/machinery/component_printer/proc/connect_techweb(datum/techweb/new_techweb) if(techweb) UnregisterSignal(techweb, list(COMSIG_TECHWEB_ADD_DESIGN, COMSIG_TECHWEB_REMOVE_DESIGN)) @@ -338,7 +342,7 @@ density = TRUE ///The internal material bus - var/datum/component/remote_materials/materials + var/datum/remote_materials/materials ///List of designs scanned and saved var/list/scanned_designs = list() ///Constant material cost per component @@ -349,7 +353,11 @@ /obj/machinery/module_duplicator/Initialize(mapload) . = ..() - materials = AddComponent(/datum/component/remote_materials, mapload) + materials = new (src, mapload) + +/obj/machinery/module_duplicator/Destroy(force) + QDEL_NULL(materials) + return ..() /obj/machinery/module_duplicator/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/tgstation.dme b/tgstation.dme index 59abb3670be..bc2fd3fba4f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1393,8 +1393,6 @@ #include "code\datums\components\food\ghost_edible.dm" #include "code\datums\components\food\golem_food.dm" #include "code\datums\components\food\ice_cream_holder.dm" -#include "code\datums\components\material\material_container.dm" -#include "code\datums\components\material\remote_materials.dm" #include "code\datums\components\pet_commands\fetch.dm" #include "code\datums\components\pet_commands\obeys_commands.dm" #include "code\datums\components\pet_commands\pet_command.dm" @@ -1777,6 +1775,8 @@ #include "code\datums\martial\sleeping_carp.dm" #include "code\datums\martial\spiders_bite.dm" #include "code\datums\martial\wrestling.dm" +#include "code\datums\material\material_container.dm" +#include "code\datums\material\remote_materials.dm" #include "code\datums\materials\_material.dm" #include "code\datums\materials\alloys.dm" #include "code\datums\materials\basemats.dm"