From 0b1cef09198223c54619dd70effa6d8a120990db Mon Sep 17 00:00:00 2001 From: Anorak2024 Date: Thu, 31 Oct 2024 15:53:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/__DEFINES/mobs.dm | 2 + code/datums/components/spy_bug.dm | 44 +++++++++++ code/datums/spells/bloodcrawl.dm | 2 +- .../demons/shadow_demon/shadow_demon.dm | 2 +- .../gamemodes/miniantags/revenant/revenant.dm | 4 +- code/game/objects/items/devices/uplinks.dm | 6 +- .../affiliates/items/mi13/sound_ring.dm | 75 ++++++------------- .../traitor/affiliates/items/mi13/spy_kit.dm | 44 ----------- code/modules/mob/holder_pet_carrier.dm | 2 +- paradise.dme | 1 + 10 files changed, 79 insertions(+), 103 deletions(-) create mode 100644 code/datums/components/spy_bug.dm diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 234865da160..5eb7fac9bb5 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -298,6 +298,8 @@ #define isdemon(A) (istype((A), /mob/living/simple_animal/demon)) #define ismorph(A) (istype((A), /mob/living/simple_animal/hostile/morph)) #define isborer(A) (istype((A), /mob/living/simple_animal/borer)) +#define isrevenant(A) (istype((A), /mob/living/simple_animal/revenant)) +#define isshadowdemon(A) (istype((A), /mob/living/simple_animal/demon/shadow)) #define issilicon(A) (istype((A), /mob/living/silicon)) #define isAI(A) (istype((A), /mob/living/silicon/ai)) diff --git a/code/datums/components/spy_bug.dm b/code/datums/components/spy_bug.dm new file mode 100644 index 00000000000..f21c99f7a12 --- /dev/null +++ b/code/datums/components/spy_bug.dm @@ -0,0 +1,44 @@ +/datum/component/spy_bug + var/obj/item/spy_bug/bug + +/datum/component/spy_bug/RegisterWithParent() + var/atom/par = parent + for (var/obj/item/spy_bug/spy_bug in par.contents) + bug = spy_bug + + RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine)) + RegisterSignal(parent, COMSIG_CLICK_ALT, PROC_REF(on_altclick)) + RegisterSignal(parent, COMSIG_PREQDELETED, PROC_REF(deleted_handler)) + +/datum/component/spy_bug/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_PARENT_EXAMINE) + UnregisterSignal(parent, COMSIG_CLICK_ALT) + UnregisterSignal(parent, COMSIG_PREQDELETED) + +/datum/component/spy_bug/proc/on_examine(datum/source, mob/living/carbon/human/user, list/examine_list) + SIGNAL_HANDLER + + if(!istype(user)) + return + + examine_list += span_warning("Вы видите небольшое устройство с микрофоном и камерой.") + +/datum/component/spy_bug/proc/on_altclick(datum/source, mob/living/carbon/human/user) + SIGNAL_HANDLER + + if(!istype(user)) + return + + if(!user.Adjacent(parent)) + return + + if(user.stat) + return + + if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return + + bug.unhook(user) + +/datum/component/spy_bug/proc/deleted_handler() + bug.unhook() diff --git a/code/datums/spells/bloodcrawl.dm b/code/datums/spells/bloodcrawl.dm index eea2fe4ead2..dfb950a4de7 100644 --- a/code/datums/spells/bloodcrawl.dm +++ b/code/datums/spells/bloodcrawl.dm @@ -295,7 +295,7 @@ /obj/effect/proc_holder/spell/bloodcrawl/shadow_crawl/post_phase_in(mob/living/user, obj/effect/dummy/slaughter/holder) ..() - if(!istype(user, /mob/living/simple_animal/demon/shadow)) + if(!isshadowdemon(user)) return var/mob/living/simple_animal/demon/shadow/demon = user demon.RegisterSignal(holder, COMSIG_MOVABLE_MOVED, TYPE_PROC_REF(/mob/living/simple_animal/demon/shadow, check_darkness)) diff --git a/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm b/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm index 8a367f482ba..f5ae19c106c 100644 --- a/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm +++ b/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm @@ -286,7 +286,7 @@ /datum/objective/wrap/check_completion() var/wrap_count = 0 for(var/datum/mind/player in get_owners()) - if(!istype(player.current, /mob/living/simple_animal/demon/shadow) || QDELETED(player.current)) + if(!isshadowdemon(player.current) || QDELETED(player.current)) continue var/mob/living/simple_animal/demon/shadow/demon = player.current diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index a9c47c8f336..7d009daa19b 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -130,7 +130,7 @@ for(var/mob/M in GLOB.mob_list) var/rendered = "[src] [(isobserver(M) ? ("([ghost_follow_link(src, ghost=M)])") : "")] says, \"[message]\"" - if(istype(M, /mob/living/simple_animal/revenant) || isobserver(M)) + if(isrevenant(M) || isobserver(M)) to_chat(M, rendered) @@ -355,7 +355,7 @@ var/total_essence = 0 for(var/datum/mind/player in get_owners()) - if(!istype(player.current, /mob/living/simple_animal/revenant) || QDELETED(player.current)) + if(!isrevenant(player.current) || QDELETED(player.current)) continue var/mob/living/simple_animal/revenant/revenant = player.current diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index 02aff094cf3..663723c7f57 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -559,10 +559,10 @@ GLOBAL_LIST_EMPTY(world_uplinks) malfs += ismalfAI(M) borers += isborer(M) morphs += ismorph(M) - revenants += istype(M, /mob/living/simple_animal/revenant) + revenants += isrevenant(M) demons += isdemon(M) - shadow_demons += istype(M, /mob/living/simple_animal/demon/shadow) - pulse_demons += istype(M, /mob/living/simple_animal/demon/pulse_demon) + shadow_demons += isshadowdemon(M) + pulse_demons += ispulsedemon(M) crew += ishuman(M) diff --git a/code/modules/antagonists/traitor/affiliates/items/mi13/sound_ring.dm b/code/modules/antagonists/traitor/affiliates/items/mi13/sound_ring.dm index 9ece472c974..b5a429b5782 100644 --- a/code/modules/antagonists/traitor/affiliates/items/mi13/sound_ring.dm +++ b/code/modules/antagonists/traitor/affiliates/items/mi13/sound_ring.dm @@ -18,57 +18,30 @@ changing = TRUE - var/list/choices // only types that we can meet in the game - - if(!stud) - choices = list( - "iron" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "ironring"), - "silver" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "silverring"), - "gold" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "goldring"), - "plasma" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "plasmaring"), - "uranium" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "uraniumring") - ) - else - choices = list( - "iron" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "d_ironring"), - "silver" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "d_silverring"), - "gold" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "d_goldring"), - "plasma" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "d_plasmaring"), - "uranium" = image(icon = 'icons/obj/clothing/rings.dmi', icon_state = "d_uraniumring") - ) - - var/selected_chameleon = show_radial_menu(usr, loc, choices, require_near = TRUE) - switch(selected_chameleon) - if("iron") - name = "iron ring" - icon_state = "ironring" - material = "iron" - ring_color = "iron" - if("silver") - name = "silver ring" - icon_state = "silverring" - material = "silver" - ring_color = "silver" - if("gold") - name = "gold ring" - icon_state = "goldring" - material = "gold" - ring_color = "gold" - if("plasma") - name = "plasma ring" - icon_state = "plasmaring" - material = "plasma" - ring_color = "plasma" - if("uranium") - name = "uranium ring" - icon_state = "uraniumring" - material = "uranium" - ring_color = "uranium" - else - changing = FALSE - return - - user.visible_message(span_warning("[user] changes the look of his ring!"), span_notice("[selected_chameleon] selected.")) + // only types that we can meet in the game + var/list/possible = list("iron ring", "silver ring", "gold ring", "plasma ring", "uranium ring") + var/list/obj/item/clothing/gloves/ring/choices = list() + for(var/type in typesof(/obj/item/clothing/gloves/ring)) + if(type == src.type) + continue + + if(!(name in possible)) + continue + + var/obj/item/clothing/gloves/ring/ring = new type + ring.stud = stud + choices[ring] = image(icon = ring.icon, icon_state = ring.icon_state) + + var/obj/item/clothing/gloves/ring/selected_chameleon = show_radial_menu(usr, loc, choices, require_near = TRUE) + if(!selected_chameleon) + return + + name = selected_chameleon.name + icon_state = selected_chameleon.icon_state + material = selected_chameleon.material + ring_color = selected_chameleon.ring_color + + user.visible_message(span_warning("[user] изменяет внешний вид кольца!"), span_notice("[selected_chameleon] selected.")) playsound(loc, 'sound/items/screwdriver2.ogg', 50, 1) to_chat(user, span_notice("Смена маскировки...")) update_icon(UPDATE_ICON_STATE) diff --git a/code/modules/antagonists/traitor/affiliates/items/mi13/spy_kit.dm b/code/modules/antagonists/traitor/affiliates/items/mi13/spy_kit.dm index 77fd489ca52..4f55ddd5d29 100644 --- a/code/modules/antagonists/traitor/affiliates/items/mi13/spy_kit.dm +++ b/code/modules/antagonists/traitor/affiliates/items/mi13/spy_kit.dm @@ -86,50 +86,6 @@ c_tag = new_name camera = new(src, network, c_tag) -/datum/component/spy_bug - var/obj/item/spy_bug/bug - -/datum/component/spy_bug/RegisterWithParent() - var/atom/par = parent - for (var/obj/item/spy_bug/spy_bug in par.contents) - bug = spy_bug - - RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine)) - RegisterSignal(parent, COMSIG_CLICK_ALT, PROC_REF(on_altclick)) - RegisterSignal(parent, COMSIG_PREQDELETED, PROC_REF(deleted_handler)) - -/datum/component/spy_bug/UnregisterFromParent() - UnregisterSignal(parent, COMSIG_PARENT_EXAMINE) - UnregisterSignal(parent, COMSIG_CLICK_ALT) - UnregisterSignal(parent, COMSIG_PREQDELETED) - -/datum/component/spy_bug/proc/on_examine(datum/source, mob/living/carbon/human/user, list/examine_list) - SIGNAL_HANDLER - - if(!istype(user)) - return - - examine_list += span_warning("Вы видите небольшое устройство с микрофоном и камерой.") - -/datum/component/spy_bug/proc/on_altclick(datum/source, mob/living/carbon/human/user) - SIGNAL_HANDLER - - if(!istype(user)) - return - - if(!user.Adjacent(parent)) - return - - if(user.stat) - return - - if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return - - bug.unhook(user) - -/datum/component/spy_bug/proc/deleted_handler() - bug.unhook() /obj/item/camera_bug/spy_monitor name = "spy monitor" diff --git a/code/modules/mob/holder_pet_carrier.dm b/code/modules/mob/holder_pet_carrier.dm index 951a65a199c..b554732bd10 100644 --- a/code/modules/mob/holder_pet_carrier.dm +++ b/code/modules/mob/holder_pet_carrier.dm @@ -79,7 +79,7 @@ if(target.mob_size > mob_size) to_chat(user, span_warning("Ваша переноска слишком мала!")) return FALSE - if(istype(target, /mob/living/simple_animal/revenant)) + if(!isrevenant(target)) return FALSE target.forceMove(src) diff --git a/paradise.dme b/paradise.dme index 0f6e225c10d..a384fefcd35 100644 --- a/paradise.dme +++ b/paradise.dme @@ -464,6 +464,7 @@ #include "code\datums\components\slippery.dm" #include "code\datums\components\spawner.dm" #include "code\datums\components\spooky.dm" +#include "code\datums\components\spy_bug.dm" #include "code\datums\components\squeak.dm" #include "code\datums\components\surgery_initiator.dm" #include "code\datums\components\swarming.dm"