diff --git a/code/__defines/dcs/signals/signals_object.dm b/code/__defines/dcs/signals/signals_object.dm index 6145170995..fde35542b2 100644 --- a/code/__defines/dcs/signals/signals_object.dm +++ b/code/__defines/dcs/signals/signals_object.dm @@ -30,7 +30,7 @@ #define COMSIG_MACHINERY_POWER_RESTORED "machinery_power_restored" ///from /obj/machinery/set_occupant(atom/movable/O): (new_occupant) #define COMSIG_MACHINERY_SET_OCCUPANT "machinery_set_occupant" -///from /obj/machinery/destructive_scanner/proc/open(aggressive): Runs when the destructive scanner scans a group of objects. (list/scanned_atoms) +///from /obj/machinery/rnd/destructive_analyzer/proc/destroy_item(gain_research_points = FALSE): Runs when the destructive scanner scans a group of objects. (list/scanned_atoms) #define COMSIG_MACHINERY_DESTRUCTIVE_SCAN "machinery_destructive_scan" ///from /obj/machinery/computer/arcade/victory_tickets(tickets, sound = TRUE) #define COMSIG_ARCADE_VICTORY "arcade_victory" @@ -638,3 +638,10 @@ /// Sent from /obj/machinert/console/camera_advanced/attack_hand() : (mob/eye/camera/remote/new_camera) #define COMSIG_ADVANCED_CAMERA_EYE_CREATED "advanced_camera_eye_created" + + +//Non TG signals: +///from /proc/techweb_item_point_check(obj/item/I): Runs when assessing an item's techweb point value. +#define COMSIG_TECHWEB_POINT_CHECK "techweb_point_check" +///from /proc/techweb_item_point_check(obj/item/I): Runs when assessing an item's techweb point type. +#define COMSIG_TECHWEB_TYPE_CHECK "techweb_type_check" diff --git a/code/datums/components/deconstructable_research.dm b/code/datums/components/deconstructable_research.dm new file mode 100644 index 0000000000..7b3d01ed60 --- /dev/null +++ b/code/datums/components/deconstructable_research.dm @@ -0,0 +1,28 @@ +/datum/component/deconstructable_research + ///Used by R&D to determine how many points the item gives. + var/techweb_points = 0 + ///Used by R&D to determine what point type the item gives, if any + var/techweb_point_type = TECHWEB_POINT_TYPE_GENERIC + +/datum/component/deconstructable_research/Initialize(techweb_points, techweb_point_type) + if(!isobj(parent)) + return COMPONENT_INCOMPATIBLE + + if(!isnull(techweb_points)) + src.techweb_points = techweb_points + if(!isnull(techweb_point_type)) + src.techweb_point_type = techweb_point_type + +/datum/component/deconstructable_research/RegisterWithParent() + RegisterSignal(parent, COMSIG_TECHWEB_POINT_CHECK, PROC_REF(point_check)) + RegisterSignal(parent, COMSIG_TECHWEB_TYPE_CHECK, PROC_REF(type_check)) + +/datum/component/deconstructable_research/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_TECHWEB_POINT_CHECK) + UnregisterSignal(parent, COMSIG_TECHWEB_TYPE_CHECK) + +/datum/component/deconstructable_research/proc/point_check(atom/movable/source) + return techweb_points + +/datum/component/deconstructable_research/proc/type_check(atom/movable/source, list/modify_me) + modify_me["type"] = techweb_point_type diff --git a/code/modules/research/tg/machinery/destructive_analyzer.dm b/code/modules/research/tg/machinery/destructive_analyzer.dm index d568198044..ff0fef2156 100644 --- a/code/modules/research/tg/machinery/destructive_analyzer.dm +++ b/code/modules/research/tg/machinery/destructive_analyzer.dm @@ -280,7 +280,8 @@ It is used to destroy hand-held objects and advance technological research. Used var/list/point_value = techweb_item_point_check(thing) //If it has a point value and we haven't deconstructed it OR we've deconstructed it but it's a repeatable. if(point_value && (!stored_research.deconstructed_items[thing.type] || (stored_research.deconstructed_items[thing.type] && (thing.type in SSresearch.techweb_repeatable_items)))) - stored_research.deconstructed_items[thing.type] = TRUE + if(SSresearch.techweb_point_items[thing.type]) //Don't add things that have the deconstructable_research component + stored_research.deconstructed_items[thing.type] = TRUE stored_research.add_point_list(point_value) //Finally, let's add it to the material silo, if applicable. diff --git a/code/modules/research/tg/techwebs/__techweb_helpers.dm b/code/modules/research/tg/techwebs/__techweb_helpers.dm index aaddb0d23e..d346b9c0c3 100644 --- a/code/modules/research/tg/techwebs/__techweb_helpers.dm +++ b/code/modules/research/tg/techwebs/__techweb_helpers.dm @@ -18,6 +18,13 @@ /proc/techweb_item_point_check(obj/item/I) if(SSresearch.techweb_point_items[I.type]) return SSresearch.techweb_point_items[I.type] + + //cursed pointer usage lay here + var/list/type_pointer = list() //yes this is a pointer. + var/point_value = SEND_SIGNAL(I, COMSIG_TECHWEB_POINT_CHECK) + SEND_SIGNAL(I, COMSIG_TECHWEB_TYPE_CHECK, type_pointer) + if(point_value && LAZYLEN(type_pointer)) + return list(type_pointer["type"] = point_value) return FALSE /proc/techweb_point_display_generic(pointlist) diff --git a/code/modules/xenoarcheaology/finds/find_spawning.dm b/code/modules/xenoarcheaology/finds/find_spawning.dm index 193e481427..0fa89a4baf 100644 --- a/code/modules/xenoarcheaology/finds/find_spawning.dm +++ b/code/modules/xenoarcheaology/finds/find_spawning.dm @@ -851,6 +851,13 @@ if(become_anomalous) new_item.become_anomalous() + //Add the component that allows for deconstruction for points. + new_item.AddComponent( + /datum/component/deconstructable_research, \ + techweb_points = rand(20,60), \ + techweb_point_type = TECHWEB_POINT_TYPE_GENERIC \ + ) + var/turf/simulated/mineral/T = get_turf(new_item) if(istype(T)) T.last_find = new_item diff --git a/vorestation.dme b/vorestation.dme index b5ecb5782f..0d82208abc 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -715,6 +715,7 @@ #include "code\datums\components\connect_loc_behalf.dm" #include "code\datums\components\connect_mob_behalf.dm" #include "code\datums\components\connect_range.dm" +#include "code\datums\components\deconstructable_research.dm" #include "code\datums\components\effect_remover.dm" #include "code\datums\components\holographic_nature.dm" #include "code\datums\components\infective.dm"