From 1fd06a89b749a0e73aeff4c51ddc304b13641a1d Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Sat, 20 Mar 2021 16:27:52 -0700
Subject: [PATCH] Oh Boy
---
code/__DEFINES/dcs/signals.dm | 3 +++
code/datums/components/identification.dm | 1 +
code/game/objects/items.dm | 11 ++++++-----
.../objects/items/devices/traitordevices.dm | 18 +++++++++++++-----
4 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index 13e6c5772a..c36e21ae06 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -550,3 +550,6 @@
// twitch plays
/// Returns direction: (wipe_votes)
#define COMSIG_TWITCH_PLAYS_MOVEMENT_DATA "twitch_plays_movement_data"
+
+// /datum/component/identification signals
+#define COMSIG_IDENTIFICATION_KNOWLEDGE_CHECK "id_knowledge_check" // (mob/user) - returns a value from ID_COMPONENT_KNOWLEDGE_NONE to ID_COMPONENT_KNOWLEDGE_FULL
diff --git a/code/datums/components/identification.dm b/code/datums/components/identification.dm
index f7dc211504..474363b85b 100644
--- a/code/datums/components/identification.dm
+++ b/code/datums/components/identification.dm
@@ -24,6 +24,7 @@
identification_method_flags = id_method_flags
/datum/component/identification/RegisterWithParent()
+ RegisterSignal(parent, COMSIG_IDENFICATION_KNOWLEDGE_CHECK, .proc/check_knowledge)
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
if(identification_effect_flags & ID_COMPONENT_EFFECT_NO_ACTIONS)
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index c3b0ab0d26..330865c5b7 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -511,12 +511,13 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
*/
/obj/item/proc/equipped(mob/user, slot, initial = FALSE)
SHOULD_CALL_PARENT(TRUE)
- SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED, user, slot)
+ var/signal_flags = SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED, user, slot)
current_equipped_slot = slot
- for(var/X in actions)
- var/datum/action/A = X
- if(item_action_slot_check(slot, user, A)) //some items only give their actions buttons when in a specific slot.
- A.Grant(user)
+ if(!(signal_flags & COMPONENT_NO_GRANT_ACTIONS))
+ for(var/X in actions)
+ var/datum/action/A = X
+ if(item_action_slot_check(slot, user, A)) //some items only give their actions buttons when in a specific slot.
+ A.Grant(user)
item_flags |= IN_INVENTORY
// if(!initial)
// if(equip_sound && (slot_flags & slot))
diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm
index 70edd3f43d..6fb3aef083 100644
--- a/code/game/objects/items/devices/traitordevices.dm
+++ b/code/game/objects/items/devices/traitordevices.dm
@@ -79,21 +79,27 @@ effective or pretty fucking useless.
var/ui_x = 320
var/ui_y = 335
+/obj/item/healthanalyzer/rad_laser/Initialize()
+ . = ..()
+ AddComponent(/datum/component/identification/syndicate, ID_COMPONENT_DEL_ON_IDENTIFY, ID_COMPONENT_EFFECT_NO_ACTIONS, ID_COMPONENT_IDENTIFY_WITH_DECONSTRUCTOR)
+
/obj/item/healthanalyzer/rad_laser/attack(mob/living/M, mob/living/user)
if(!stealth || !irradiate)
- ..()
+ return ..()
+ var/knowledge = SEND_SIGNAL(COMSIG_IDENTIFICATION_KNOWLEDGE_CHECK, user) == ID_COMPONENT_KNOWLEDGE_FULL
if(!irradiate)
return
if(!used)
- log_combat(user, M, "irradiated", src)
+ log_combat(user, M, "[knowledge? "" : "unknowingly "]irradiated", src)
var/cooldown = get_cooldown()
used = TRUE
icon_state = "health1"
addtimer(VARSET_CALLBACK(src, used, FALSE), cooldown)
addtimer(VARSET_CALLBACK(src, icon_state, "health"), cooldown)
- to_chat(user, "Successfully irradiated [M].")
+ if(knowledge)
+ to_chat(user, "Successfully irradiated [M].")
addtimer(CALLBACK(src, .proc/radiation_aftereffect, M), (wavelength+(intensity*4))*5)
- else
+ else if(knowledge)
to_chat(user, "The radioactive microlaser is still recharging.")
/obj/item/healthanalyzer/rad_laser/proc/radiation_aftereffect(mob/living/M)
@@ -110,7 +116,9 @@ effective or pretty fucking useless.
interact(user)
/obj/item/healthanalyzer/rad_laser/interact(mob/user)
- ui_interact(user)
+ var/knowledge = SEND_SIGNAL(COMSIG_IDENTIFICATION_KNOWLEDGE_CHECK, user) == ID_COMPONENT_KNOWLEDGE_FULL
+ if(knowledge)
+ ui_interact(user)
/obj/item/healthanalyzer/rad_laser/ui_state(mob/user)
return GLOB.hands_state