Adds the nanite remote for some programs
Adds a new remote function from tg
This commit is contained in:
@@ -36,6 +36,16 @@
|
||||
category = list("Electronics")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE
|
||||
|
||||
/datum/design/nanite_comm_remote
|
||||
name = "Nanite Communication Remote"
|
||||
desc = "Allows for the construction of a nanite communication remote."
|
||||
id = "nanite_comm_remote"
|
||||
build_type = PROTOLATHE
|
||||
materials = list(MAT_GLASS = 500, MAT_METAL = 500)
|
||||
build_path = /obj/item/nanite_remote/comm
|
||||
category = list("Electronics")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE
|
||||
|
||||
/datum/design/nanite_scanner
|
||||
name = "Nanite Scanner"
|
||||
desc = "Allows for the construction of a nanite scanner."
|
||||
|
||||
@@ -445,21 +445,21 @@
|
||||
name = "Skull Echo"
|
||||
desc = "The nanites echo a synthesized message inside the host's skull."
|
||||
id = "voice_nanites"
|
||||
program_type = /datum/nanite_program/triggered/voice
|
||||
program_type = /datum/nanite_program/triggered/comm/voice
|
||||
category = list("Suppression Nanites")
|
||||
|
||||
/datum/design/nanites/speech
|
||||
name = "Forced Speech"
|
||||
desc = "The nanites force the host to say a pre-programmed sentence when triggered."
|
||||
id = "speech_nanites"
|
||||
program_type = /datum/nanite_program/triggered/speech
|
||||
program_type = /datum/nanite_program/triggered/comm/speech
|
||||
category = list("Suppression Nanites")
|
||||
|
||||
/datum/design/nanites/hallucination
|
||||
name = "Hallucination"
|
||||
desc = "The nanites make the host see and hear things that aren't real."
|
||||
id = "hallucination_nanites"
|
||||
program_type = /datum/nanite_program/triggered/hallucination
|
||||
program_type = /datum/nanite_program/triggered/comm/hallucination
|
||||
category = list("Suppression Nanites")
|
||||
|
||||
////////////////////SENSOR NANITES//////////////////////////////////////
|
||||
|
||||
@@ -114,7 +114,19 @@
|
||||
. = ..()
|
||||
host_mob.cure_fakedeath("nanites")
|
||||
|
||||
/datum/nanite_program/triggered/speech
|
||||
//Can receive transmissions from a nanite communication remote for customized messages
|
||||
/datum/nanite_program/triggered/comm
|
||||
var/comm_code = 0
|
||||
var/comm_message = ""
|
||||
|
||||
/datum/nanite_program/triggered/comm/proc/receive_comm_signal(signal_comm_code, comm_message, comm_source)
|
||||
if(!activated || !comm_code)
|
||||
return
|
||||
if(signal_comm_code == comm_code)
|
||||
host_mob.investigate_log("'s [name] nanite program was messaged by [comm_source] with comm code [signal_comm_code] and message '[comm_message]'.", INVESTIGATE_NANITES)
|
||||
trigger(comm_message)
|
||||
|
||||
/datum/nanite_program/triggered/comm/speech
|
||||
name = "Forced Speech"
|
||||
desc = "The nanites force the host to say a pre-programmed sentence when triggered."
|
||||
unique = FALSE
|
||||
@@ -122,10 +134,10 @@
|
||||
trigger_cooldown = 20
|
||||
rogue_types = list(/datum/nanite_program/brain_misfire, /datum/nanite_program/brain_decay)
|
||||
|
||||
extra_settings = list("Sentence")
|
||||
extra_settings = list("Sentence","Comm Code")
|
||||
var/sentence = ""
|
||||
|
||||
/datum/nanite_program/triggered/speech/set_extra_setting(user, setting)
|
||||
/datum/nanite_program/triggered/comm/speech/set_extra_setting(user, setting)
|
||||
if(setting == "Sentence")
|
||||
var/new_sentence = stripped_input(user, "Choose the sentence that the host will be forced to say.", "Sentence", sentence, MAX_MESSAGE_LEN)
|
||||
if(!new_sentence)
|
||||
@@ -133,23 +145,34 @@
|
||||
if(copytext(new_sentence, 1, 2) == "*") //emotes are abusable, like surrender
|
||||
return
|
||||
sentence = new_sentence
|
||||
if(setting == "Comm Code")
|
||||
var/new_code = input(user, "Set the communication code (1-9999) or set to 0 to disable external signals.", name, null) as null|num
|
||||
if(isnull(new_code))
|
||||
return
|
||||
comm_code = CLAMP(round(new_code, 1), 0, 9999)
|
||||
|
||||
/datum/nanite_program/triggered/speech/get_extra_setting(setting)
|
||||
/datum/nanite_program/triggered/comm/speech/get_extra_setting(setting)
|
||||
if(setting == "Sentence")
|
||||
return sentence
|
||||
if(setting == "Comm Code")
|
||||
return comm_code
|
||||
|
||||
/datum/nanite_program/triggered/speech/copy_extra_settings_to(datum/nanite_program/triggered/speech/target)
|
||||
/datum/nanite_program/triggered/comm/speech/copy_extra_settings_to(datum/nanite_program/triggered/comm/speech/target)
|
||||
target.sentence = sentence
|
||||
target.comm_code = comm_code
|
||||
|
||||
/datum/nanite_program/triggered/speech/trigger()
|
||||
/datum/nanite_program/triggered/comm/speech/trigger(comm_message)
|
||||
if(!..())
|
||||
return
|
||||
var/sent_message = comm_message
|
||||
if(!comm_message)
|
||||
sent_message = sentence
|
||||
if(host_mob.stat == DEAD)
|
||||
return
|
||||
to_chat(host_mob, "<span class='warning'>You feel compelled to speak...</span>")
|
||||
host_mob.say(sentence, forced = "nanite speech")
|
||||
host_mob.say(sent_message, forced = "nanite speech")
|
||||
|
||||
/datum/nanite_program/triggered/voice
|
||||
/datum/nanite_program/triggered/comm/voice
|
||||
name = "Skull Echo"
|
||||
desc = "The nanites echo a synthesized message inside the host's skull."
|
||||
unique = FALSE
|
||||
@@ -157,44 +180,62 @@
|
||||
trigger_cooldown = 20
|
||||
rogue_types = list(/datum/nanite_program/brain_misfire, /datum/nanite_program/brain_decay)
|
||||
|
||||
extra_settings = list("Message")
|
||||
extra_settings = list("Message","Comm Code")
|
||||
var/message = ""
|
||||
|
||||
/datum/nanite_program/triggered/voice/set_extra_setting(user, setting)
|
||||
/datum/nanite_program/triggered/comm/voice/set_extra_setting(user, setting)
|
||||
if(setting == "Message")
|
||||
var/new_message = stripped_input(user, "Choose the message sent to the host.", "Message", message, MAX_MESSAGE_LEN)
|
||||
if(!new_message)
|
||||
return
|
||||
message = new_message
|
||||
if(setting == "Comm Code")
|
||||
var/new_code = input(user, "Set the communication code (1-9999) or set to 0 to disable external signals.", name, null) as null|num
|
||||
if(isnull(new_code))
|
||||
return
|
||||
comm_code = CLAMP(round(new_code, 1), 0, 9999)
|
||||
|
||||
/datum/nanite_program/triggered/voice/get_extra_setting(setting)
|
||||
/datum/nanite_program/triggered/comm/voice/get_extra_setting(setting)
|
||||
if(setting == "Message")
|
||||
return message
|
||||
if(setting == "Comm Code")
|
||||
return comm_code
|
||||
|
||||
/datum/nanite_program/triggered/voice/copy_extra_settings_to(datum/nanite_program/triggered/voice/target)
|
||||
/datum/nanite_program/triggered/comm/voice/copy_extra_settings_to(datum/nanite_program/triggered/comm/voice/target)
|
||||
target.message = message
|
||||
target.comm_code = comm_code
|
||||
|
||||
/datum/nanite_program/triggered/voice/trigger()
|
||||
/datum/nanite_program/triggered/comm/voice/trigger(comm_message)
|
||||
if(!..())
|
||||
return
|
||||
var/sent_message = comm_message
|
||||
if(!comm_message)
|
||||
sent_message = message
|
||||
if(host_mob.stat == DEAD)
|
||||
return
|
||||
to_chat(host_mob, "<i>You hear a strange, robotic voice in your head...</i> \"<span class='robot'>[message]</span>\"")
|
||||
to_chat(host_mob, "<i>You hear a strange, robotic voice in your head...</i> \"<span class='robot'>[sent_message]</span>\"")
|
||||
|
||||
/datum/nanite_program/triggered/hallucination
|
||||
/datum/nanite_program/triggered/comm/hallucination
|
||||
name = "Hallucination"
|
||||
desc = "The nanites make the host hallucinate something when triggered."
|
||||
trigger_cost = 4
|
||||
trigger_cooldown = 80
|
||||
unique = FALSE
|
||||
rogue_types = list(/datum/nanite_program/brain_misfire)
|
||||
extra_settings = list("Hallucination Type")
|
||||
extra_settings = list("Hallucination Type", "Comm Code")
|
||||
var/hal_type
|
||||
var/hal_details
|
||||
|
||||
/datum/nanite_program/triggered/hallucination/trigger()
|
||||
/datum/nanite_program/triggered/comm/hallucination/trigger(comm_message)
|
||||
if(!..())
|
||||
return
|
||||
|
||||
if(comm_message && (hal_type != "Message")) //Triggered via comm remote, but not set to a message hallucination
|
||||
return
|
||||
var/sent_message = comm_message //Comm remotes can send custom hallucination messages for the chat hallucination
|
||||
if(!sent_message)
|
||||
sent_message = hal_details
|
||||
|
||||
if(!iscarbon(host_mob))
|
||||
return
|
||||
var/mob/living/carbon/C = host_mob
|
||||
@@ -203,7 +244,7 @@
|
||||
else
|
||||
switch(hal_type)
|
||||
if("Message")
|
||||
new /datum/hallucination/chat(C, TRUE, null, hal_details)
|
||||
new /datum/hallucination/chat(C, TRUE, null, sent_message)
|
||||
if("Battle")
|
||||
new /datum/hallucination/battle(C, TRUE, hal_details)
|
||||
if("Sound")
|
||||
@@ -223,7 +264,13 @@
|
||||
if("Plasma Flood")
|
||||
new /datum/hallucination/fake_flood(C, TRUE)
|
||||
|
||||
/datum/nanite_program/triggered/hallucination/set_extra_setting(user, setting)
|
||||
/datum/nanite_program/triggered/comm/hallucination/set_extra_setting(user, setting)
|
||||
if(setting == "Comm Code")
|
||||
var/new_code = input(user, "(Only for Message) Set the communication code (1-9999) or set to 0 to disable external signals.", name, null) as null|num
|
||||
if(isnull(new_code))
|
||||
return
|
||||
comm_code = CLAMP(round(new_code, 1), 0, 9999)
|
||||
|
||||
if(setting == "Hallucination Type")
|
||||
var/list/possible_hallucinations = list("Random","Message","Battle","Sound","Weird Sound","Station Message","Health","Alert","Fire","Shock","Plasma Flood")
|
||||
var/hal_type_choice = input("Choose the hallucination type", name) as null|anything in possible_hallucinations
|
||||
@@ -299,13 +346,16 @@
|
||||
if("Plasma Flood")
|
||||
hal_type = "Plasma Flood"
|
||||
|
||||
/datum/nanite_program/triggered/hallucination/get_extra_setting(setting)
|
||||
/datum/nanite_program/triggered/comm/hallucination/get_extra_setting(setting)
|
||||
if(setting == "Hallucination Type")
|
||||
if(!hal_type)
|
||||
return "Random"
|
||||
else
|
||||
return hal_type
|
||||
if(setting == "Comm Code")
|
||||
return comm_code
|
||||
|
||||
/datum/nanite_program/triggered/hallucination/copy_extra_settings_to(datum/nanite_program/triggered/hallucination/target)
|
||||
/datum/nanite_program/triggered/comm/hallucination/copy_extra_settings_to(datum/nanite_program/triggered/comm/hallucination/target)
|
||||
target.hal_type = hal_type
|
||||
target.hal_details = hal_details
|
||||
target.hal_details = hal_details
|
||||
target.comm_code = comm_code
|
||||
@@ -197,6 +197,15 @@
|
||||
return
|
||||
SEND_SIGNAL(host_mob, COMSIG_NANITE_SIGNAL, code, source)
|
||||
|
||||
/datum/nanite_program/relay/proc/relay_comm_signal(comm_code, relay_code, comm_message)
|
||||
if(!activated)
|
||||
return
|
||||
if(!host_mob)
|
||||
return
|
||||
if(relay_code != relay_channel)
|
||||
return
|
||||
SEND_SIGNAL(host_mob, COMSIG_NANITE_COMM_SIGNAL, comm_code, comm_message)
|
||||
|
||||
/datum/nanite_program/metabolic_synthesis
|
||||
name = "Metabolic Synthesis"
|
||||
desc = "The nanites use the metabolic cycle of the host to speed up their replication rate, using their extra nutrition as fuel."
|
||||
|
||||
@@ -168,6 +168,109 @@
|
||||
. = TRUE
|
||||
|
||||
|
||||
/obj/item/nanite_remote/comm
|
||||
name = "nanite communication remote"
|
||||
desc = "A device that can send text messages to specific programs."
|
||||
icon_state = "nanite_comm_remote"
|
||||
var/comm_code = 0
|
||||
var/comm_message = ""
|
||||
|
||||
/obj/item/nanite_remote/comm/afterattack(atom/target, mob/user, etc)
|
||||
switch(mode)
|
||||
if(REMOTE_MODE_OFF)
|
||||
return
|
||||
if(REMOTE_MODE_SELF)
|
||||
to_chat(user, "<span class='notice'>You activate [src], signaling the nanites in your bloodstream.<span>")
|
||||
signal_mob(user, comm_code, comm_message)
|
||||
if(REMOTE_MODE_TARGET)
|
||||
if(isliving(target) && (get_dist(target, get_turf(src)) <= 7))
|
||||
to_chat(user, "<span class='notice'>You activate [src], signaling the nanites inside [target].<span>")
|
||||
signal_mob(target, code, comm_message, key_name(user))
|
||||
if(REMOTE_MODE_AOE)
|
||||
to_chat(user, "<span class='notice'>You activate [src], signaling the nanites inside every host around you.<span>")
|
||||
for(var/mob/living/L in view(user, 7))
|
||||
signal_mob(L, code, comm_message, key_name(user))
|
||||
if(REMOTE_MODE_RELAY)
|
||||
to_chat(user, "<span class='notice'>You activate [src], signaling all connected relay nanites.<span>")
|
||||
signal_relay(code, relay_code, comm_message, key_name(user))
|
||||
|
||||
/obj/item/nanite_remote/comm/signal_mob(mob/living/M, code, source)
|
||||
SEND_SIGNAL(M, COMSIG_NANITE_COMM_SIGNAL, comm_code, comm_message)
|
||||
|
||||
/obj/item/nanite_remote/comm/signal_relay(code, relay_code, source)
|
||||
for(var/X in SSnanites.nanite_relays)
|
||||
var/datum/nanite_program/relay/N = X
|
||||
N.relay_comm_signal(comm_code, relay_code, comm_message)
|
||||
|
||||
/obj/item/nanite_remote/comm/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state)
|
||||
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "nanite_comm_remote", name, 420, 800, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/item/nanite_remote/comm/ui_data()
|
||||
var/list/data = list()
|
||||
data["comm_code"] = comm_code
|
||||
data["relay_code"] = relay_code
|
||||
data["comm_message"] = comm_message
|
||||
data["mode"] = mode
|
||||
data["locked"] = locked
|
||||
data["saved_settings"] = saved_settings
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/nanite_remote/comm/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("set_comm_code")
|
||||
if(locked)
|
||||
return
|
||||
var/new_code = input("Set comm code (0000-9999):", name, code) as null|num
|
||||
if(!isnull(new_code))
|
||||
new_code = CLAMP(round(new_code, 1),0,9999)
|
||||
comm_code = new_code
|
||||
. = TRUE
|
||||
if("set_message")
|
||||
if(locked)
|
||||
return
|
||||
var/new_message = stripped_input(usr, "Set the message (Max 300 characters):", "Set Message", null , 300)
|
||||
if(!new_message)
|
||||
return
|
||||
comm_message = new_message
|
||||
. = TRUE
|
||||
if("comm_save")
|
||||
if(locked)
|
||||
return
|
||||
var/code_name = stripped_input(usr, "Set the setting name", "Set Name", null , 15)
|
||||
if(!code_name)
|
||||
return
|
||||
var/new_save = list()
|
||||
new_save["id"] = last_id + 1
|
||||
last_id++
|
||||
new_save["name"] = code_name
|
||||
new_save["code"] = comm_code
|
||||
new_save["mode"] = mode
|
||||
new_save["relay_code"] = relay_code
|
||||
new_save["message"] = comm_message
|
||||
|
||||
saved_settings += list(new_save)
|
||||
. = TRUE
|
||||
if("comm_load")
|
||||
var/code_id = params["save_id"]
|
||||
var/list/setting
|
||||
for(var/list/X in saved_settings)
|
||||
if(X["id"] == text2num(code_id))
|
||||
setting = X
|
||||
break
|
||||
if(setting)
|
||||
comm_code = setting["code"]
|
||||
mode = setting["mode"]
|
||||
relay_code = setting["relay_code"]
|
||||
comm_message = setting["message"]
|
||||
. = TRUE
|
||||
|
||||
|
||||
#undef REMOTE_MODE_OFF
|
||||
#undef REMOTE_MODE_SELF
|
||||
#undef REMOTE_MODE_TARGET
|
||||
|
||||
+1137
-1137
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user