Improves nanite logging (#40639)

This commit is contained in:
ShizCalev
2018-10-02 18:21:28 -04:00
committed by vuonojenmustaturska
parent debc6b222f
commit c4cd5e2fdf
5 changed files with 29 additions and 21 deletions
@@ -228,4 +228,6 @@
/obj/machinery/nanite_chamber/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
return
close_machine(target)
if(close_machine(target))
log_combat(user, target, "inserted", null, "into [src].")
add_fingerprint(user)
@@ -121,14 +121,14 @@
if(!isnull(threshold))
chamber.set_safety(CLAMP(round(threshold, 1),0,500))
playsound(src, "terminal_type", 25, 0)
investigate_log("[key_name(chamber.occupant)]'s nanites' safety threshold was set to [threshold] by [key_name(usr)].", INVESTIGATE_NANITES)
chamber.occupant.investigate_log("'s nanites' safety threshold was set to [threshold] by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
. = TRUE
if("set_cloud")
var/cloud_id = input("Set cloud ID (1-100, 0 to disable):", name, null) as null|num
if(!isnull(cloud_id))
chamber.set_cloud(CLAMP(round(cloud_id, 1),0,100))
playsound(src, "terminal_type", 25, 0)
investigate_log("[key_name(chamber.occupant)]'s nanites' cloud id was set to [cloud_id] by [key_name(usr)].", INVESTIGATE_NANITES)
chamber.occupant.investigate_log("'s nanites' cloud id was set to [cloud_id] by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
. = TRUE
if("connect_chamber")
find_chamber()
@@ -136,14 +136,15 @@
if("nanite_injection")
playsound(src, 'sound/machines/terminal_prompt.ogg', 25, 0)
chamber.inject_nanites()
investigate_log("[key_name(chamber.occupant)] was injected with nanites by [key_name(usr)] using a nanite chamber.", INVESTIGATE_NANITES)
log_combat(usr, occupant, "injected", null, "with nanites via [src]")
chamber.occupant.investigate_log("was injected with nanites by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
. = TRUE
if("add_program")
if(!disk || !chamber || !chamber.occupant)
return
playsound(src, 'sound/machines/terminal_prompt.ogg', 25, 0)
chamber.install_program(disk.program)
investigate_log("Program of type [disk.program.type] was installed into [key_name(chamber.occupant)]'s nanites with a nanite chamber by [key_name(usr)].", INVESTIGATE_NANITES)
chamber.occupant.investigate_log("had program of type [disk.program.type] installed by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
. = TRUE
if("remove_program")
if(!chamber || !chamber.occupant)
@@ -154,5 +155,5 @@
if(LAZYLEN(nanite_programs))
var/datum/nanite_program/P = nanite_programs[text2num(params["program_id"])]
chamber.uninstall_program(P)
investigate_log("Program of type [P.type] was uninstalled from [key_name(chamber.occupant)]'s nanites with a nanite chamber by [key_name(usr)].", INVESTIGATE_NANITES)
. = TRUE
chamber.occupant.investigate_log("had program of type [P.type] uninstalled by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
. = TRUE
@@ -231,15 +231,15 @@
/datum/nanite_program/proc/receive_signal(code, source)
if(activation_code && code == activation_code && !activated)
activate()
host_mob.investigate_log("[host_mob]'s [name] nanite program was activated by [source] with code [code].", INVESTIGATE_NANITES)
host_mob.investigate_log("'s [name] nanite program was activated by [source] with code [code].", INVESTIGATE_NANITES)
else if(deactivation_code && code == deactivation_code && activated)
deactivate()
host_mob.investigate_log("[host_mob]'s [name] nanite program was deactivated by [source] with code [code].", INVESTIGATE_NANITES)
host_mob.investigate_log("'s [name] nanite program was deactivated by [source] with code [code].", INVESTIGATE_NANITES)
if(can_trigger && trigger_code && code == trigger_code)
trigger()
host_mob.investigate_log("[host_mob]'s [name] nanite program was triggered by [source] with code [code].", INVESTIGATE_NANITES)
host_mob.investigate_log("'s [name] nanite program was triggered by [source] with code [code].", INVESTIGATE_NANITES)
if(kill_code && code == kill_code)
host_mob.investigate_log("[host_mob]'s [name] nanite program was deleted by [source] with code [code].", INVESTIGATE_NANITES)
host_mob.investigate_log("'s [name] nanite program was deleted by [source] with code [code].", INVESTIGATE_NANITES)
qdel(src)
/datum/nanite_program/proc/get_timer_type_text()
@@ -243,7 +243,7 @@
//this will potentially take over existing nanites!
infectee.AddComponent(/datum/component/nanites, 10)
SEND_SIGNAL(infectee, COMSIG_NANITE_SYNC, nanites)
infectee.investigate_log("[key_name(infectee)] was infected by spreading nanites by [key_name(host_mob)]", INVESTIGATE_NANITES)
infectee.investigate_log("was infected by spreading nanites by [key_name(host_mob)] at [AREACOORD(infectee)].", INVESTIGATE_NANITES)
/datum/nanite_program/mitosis
name = "Mitosis"
@@ -32,7 +32,7 @@
busy_icon_state = working_icon
update_icon()
/obj/machinery/public_nanite_chamber/proc/inject_nanites()
/obj/machinery/public_nanite_chamber/proc/inject_nanites(mob/living/attacker)
if(stat & (NOPOWER|BROKEN))
return
if((stat & MAINT) || panel_open)
@@ -47,14 +47,17 @@
set_busy(TRUE, "[initial(icon_state)]_raising")
addtimer(CALLBACK(src, .proc/set_busy, TRUE, "[initial(icon_state)]_active"),20)
addtimer(CALLBACK(src, .proc/set_busy, TRUE, "[initial(icon_state)]_falling"),60)
addtimer(CALLBACK(src, .proc/complete_injection, locked_state),80)
addtimer(CALLBACK(src, .proc/complete_injection, locked_state, attacker),80)
/obj/machinery/public_nanite_chamber/proc/complete_injection(locked_state)
/obj/machinery/public_nanite_chamber/proc/complete_injection(locked_state, mob/living/attacker)
//TODO MACHINE DING
locked = locked_state
set_busy(FALSE)
if(!occupant)
return
if(attacker)
occupant.investigate_log("was injected with nanites by [key_name(attacker)] using [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
log_combat(attacker, occupant, "injected", null, "with nanites via [src]")
occupant.AddComponent(/datum/component/nanites, 75, cloud_id)
/obj/machinery/public_nanite_chamber/update_icon()
@@ -94,7 +97,7 @@
return
if(state_open)
close_machine()
close_machine(null, user)
return
else if(locked)
@@ -122,7 +125,7 @@
"<span class='notice'>You successfully break out of [src]!</span>")
open_machine()
/obj/machinery/public_nanite_chamber/close_machine(mob/living/carbon/user)
/obj/machinery/public_nanite_chamber/close_machine(mob/living/carbon/user, mob/living/attacker)
if(!state_open)
return FALSE
@@ -130,15 +133,15 @@
. = TRUE
addtimer(CALLBACK(src, .proc/try_inject_nanites), 30) //If someone is shoved in give them a chance to get out before the injection starts
addtimer(CALLBACK(src, .proc/try_inject_nanites, attacker), 30) //If someone is shoved in give them a chance to get out before the injection starts
/obj/machinery/public_nanite_chamber/proc/try_inject_nanites()
/obj/machinery/public_nanite_chamber/proc/try_inject_nanites(mob/living/attacker)
if(occupant)
var/mob/living/L = occupant
if(SEND_SIGNAL(L, COMSIG_HAS_NANITES))
return
if((MOB_ORGANIC in L.mob_biotypes) || (MOB_UNDEAD in L.mob_biotypes))
inject_nanites()
inject_nanites(attacker)
/obj/machinery/public_nanite_chamber/open_machine()
if(state_open)
@@ -175,4 +178,6 @@
/obj/machinery/public_nanite_chamber/MouseDrop_T(mob/target, mob/user)
if(user.stat || user.lying || !Adjacent(user) || !user.Adjacent(target) || !iscarbon(target) || !user.IsAdvancedToolUser())
return
close_machine(target)
if(close_machine(target, user))
log_combat(user, target, "inserted", null, "into [src].")
add_fingerprint(user)