Files
Bubberstation/code/modules/research/nanites/nanite_programs/sensor.dm
T
XDTM d9e691f393 [Ready] [Reviewed] Nanites 2 (#37922)
* Adds programmable nanites to robotics

* Oh yeah i might want to actually PR the files

* nanite injectors, nanite printer, nanite analyzer

* We're back

* remove some reagent stuff

* more removal

* those too

* cool icons!

* might pass travis now

* lotsa code

* tgui fixes/misc fixes

* WE'RE FUNCTIONAL BOYS

* some ui stuff

* Misc fixes, cloud update, access nanites

* activation check

* stuff

* preparing for new chamber sprite

* Physical backups, sensor nanite programs

* techweb sensor nanites

* fix

* include

* fix again

* revert

* blinding nanites

* minor change

* minor tweaks

* makes minor shocks interfere with nanites

* fix

* split trigger file into the others, for consistency

* cleanup, added mindshield nanites to techwebs

* include n all

* how'd that even happen

* Fixed HUD, readded missing remote icon, added nanite scanner, health analyzers can now detect nanites, added stealth program

* cost tweaks

* better term

* new icon! by MrDoomBringer

* icons/tweaks

* tgui build

* boards

* fix

* fixes implants not updating mindshield status

* move implant hud to living

* new remote sprite

* scanner sprite

* biotype checks

* some nerfs

* new open chamber sprite

* Fixes mindshield implants not updating the HUD, fixes uninstalling always removing the first program, adds 25% and 75% health sensors

* correction

* nerfs antistun nanites

* fixes scanners and minor tweaks

* fixes revs with mindshield

* oh yeah haha

* Fixes wonky techweb

* Moves pyro program to weapon node

* Adds defib program and some investigate logging

* mistype

* fix

* fix2

* save your files before committing

* emps can desync from cloud

* pretty outdated

* Cloud backups are now tied to the cloud consoles; you can no longer build a new console to access existing backups.

* UI fix

* more fix

* okay fix for real

* tested and working

* Extra Settings rework, sensor nanites vastly better

* non-unique glitches

* Public chamber, extra settings rework, new sensors, speech program

* Mute and mind control nanites

* mind control into hazard

* better description

* fixes

* fixes relay nanites

* fixes TK access

* mind control costs less

* UI update

* removed pointless code bit

* tgui build

* compiles

* dammit

* paralysis keeps victim upright

* Adds sounds to consoles

* some feedback for some subtle effects

* new chem lore

* Viral nanite customization

* fix

* tgui build

* Added mitosis nanites

* removes glitched nanites from techwebs

* Added flesh eating nanites, poison nanites, hallucination nanites

* ,

* #traviscoding

* Adds memory leak, renames nanite roam node to nanite smart

* Voice sensor + some techweb desc tweaks

* hallucination and Hear() fix

* changes signal registering to the new method

* 75% done, i think

* should be all

* more fix

* more changes

* okay should be fine now

* ninja

* inheritance

* i don't care about originality!

* line endings

* line endings 2

* maybe

* fixes program installation

* new review

* line endings?

* line endings??

* line endings???

* wait do i even use this

* fixes public nanite chamber cloud id

* maint overlay for chambers

* args doesn't work well here

* antiabuse checks

* compile tho

* fixes locked remotes

* disk renaming

* skull echo nanites

* self scan program

* Condenses a lot of sensors into a few generic but customizable versions

* fixes machinery runtimes. Hacky, but a proper fix would likely require a refactor of machinery typing.

* forgot to save

* empty

* metastation nanite lab

* Removes duplicate APC

* fix for nanite chamber

* Raise max programs

* UI Tweaks, aggr. replication rebalance, minor fixes

* let's not do that again

* Fixes nanites meta merge conflict

* Merge conflict v2

* fuck this HDD is slow

* What the fuck did you just fucking say about me, you little leaf? I'll have you know I graduated top of my class in the Lawyer School, and I've been involved in numerous secret DMCA raids. I am trained in law violations warfare and you are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on BYOND, mark my fucking words. You think you can get away with changing the code? Think again, fucker. As we speak I am contacting my secret network of attorneys in the Fox and your IP is being traced right now so you better prepare for an outstanding warrant, maggot. The storm that wipes out the pathetic little thing you call your leaked code. You're fucking done, kid. I can file for an injunction anywhere, anytime, and I can take legal actions in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the Florida Statute and I will use it to its full extent to wipe your miserable ass off the face of Canada, you little shit. If only you could have known what unholy retribution your little "clever" action was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will send you to spend time in a Florida State Penitentiary if you ever decide to travel from Canada to the U.S. You're fucking done, kiddo.

* Adds virus symptoms that interact with nanites

* Fixes spreading nanites being more infective the more protection the victims have

* Review plus public chamber tweak

* . = ..()

* ball

* cloud

* . = ..()

* always press save all before committing

* missed a couple
2018-08-20 14:46:04 +03:00

392 lines
12 KiB
Plaintext

/datum/nanite_program/sensor
name = "Sensor Nanites"
desc = "These nanites send a signal code when a certain condition is met."
unique = FALSE
extra_settings = list("Sent Code")
var/sent_code = 0
/datum/nanite_program/sensor/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
/datum/nanite_program/sensor/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
/datum/nanite_program/sensor/copy_extra_settings_to(datum/nanite_program/sensor/target)
target.sent_code = sent_code
/datum/nanite_program/sensor/proc/check_event()
return FALSE
/datum/nanite_program/sensor/proc/send_code()
if(activated)
SEND_SIGNAL(host_mob, COMSIG_NANITE_SIGNAL, sent_code, "a [name] program")
/datum/nanite_program/sensor/active_effect()
if(sent_code && check_event())
send_code()
/datum/nanite_program/sensor/repeat
name = "Signal Repeater"
desc = "When triggered, sends another signal to the nanites, optionally with a delay."
can_trigger = TRUE
trigger_cost = 0
trigger_cooldown = 10
extra_settings = list("Sent Code","Delay")
var/spent = FALSE
var/delay = 0
/datum/nanite_program/sensor/repeat/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Delay")
var/new_delay = input(user, "Set the delay in seconds:", name, null) as null|num
if(isnull(new_delay))
return
delay = (CLAMP(round(new_delay, 1), 0, 3600)) * 10 //max 1 hour
/datum/nanite_program/sensor/repeat/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Delay")
return "[delay/10] seconds"
/datum/nanite_program/sensor/repeat/copy_extra_settings_to(datum/nanite_program/sensor/repeat/target)
target.sent_code = sent_code
target.delay = delay
/datum/nanite_program/sensor/repeat/trigger()
if(!..())
return
addtimer(CALLBACK(src, .proc/send_code), delay)
/datum/nanite_program/sensor/relay_repeat
name = "Relay Signal Repeater"
desc = "When triggered, sends another signal to a relay channel, optionally with a delay."
can_trigger = TRUE
trigger_cost = 0
trigger_cooldown = 10
extra_settings = list("Sent Code","Relay Channel","Delay")
var/spent = FALSE
var/delay = 0
var/relay_channel = 0
/datum/nanite_program/sensor/relay_repeat/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Relay Channel")
var/new_channel = input(user, "Set the relay channel (1-9999):", name, null) as null|num
if(isnull(new_channel))
return
relay_channel = CLAMP(round(new_channel, 1), 1, 9999)
if(setting == "Delay")
var/new_delay = input(user, "Set the delay in seconds:", name, null) as null|num
if(isnull(new_delay))
return
delay = (CLAMP(round(new_delay, 1), 0, 3600)) * 10 //max 1 hour
/datum/nanite_program/sensor/relay_repeat/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Relay Channel")
return relay_channel
if(setting == "Delay")
return "[delay/10] seconds"
/datum/nanite_program/sensor/relay_repeat/copy_extra_settings_to(datum/nanite_program/sensor/relay_repeat/target)
target.sent_code = sent_code
target.delay = delay
target.relay_channel = relay_channel
/datum/nanite_program/sensor/relay_repeat/trigger()
if(!..())
return
addtimer(CALLBACK(src, .proc/send_code), delay)
/datum/nanite_program/sensor/relay_repeat/send_code()
if(activated && relay_channel)
for(var/X in SSnanites.nanite_relays)
var/datum/nanite_program/relay/N = X
N.relay_signal(sent_code, relay_channel, "a [name] program")
/datum/nanite_program/sensor/health
name = "Health Sensor"
desc = "The nanites receive a signal when the host's health is above/below a target percentage."
extra_settings = list("Sent Code","Health Percent","Direction")
var/spent = FALSE
var/percent = 50
var/direction = "Above"
/datum/nanite_program/sensor/health/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Health Percent")
var/new_percent = input(user, "Set the health percentage:", name, null) as null|num
if(isnull(new_percent))
return
percent = CLAMP(round(new_percent, 1), -99, 100)
if(setting == "Direction")
if(direction == "Above")
direction = "Below"
else
direction = "Above"
/datum/nanite_program/sensor/health/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Health Percent")
return "[percent]%"
if(setting == "Direction")
return direction
/datum/nanite_program/sensor/health/copy_extra_settings_to(datum/nanite_program/sensor/health/target)
target.sent_code = sent_code
target.percent = percent
target.direction = direction
/datum/nanite_program/sensor/health/check_event()
var/health_percent = host_mob.health / host_mob.maxHealth * 100
var/detected = FALSE
if(direction == "Above")
if(health_percent >= percent)
detected = TRUE
else
if(health_percent < percent)
detected = TRUE
if(detected)
if(!spent)
spent = TRUE
return TRUE
return FALSE
else
spent = FALSE
return FALSE
/datum/nanite_program/sensor/crit
name = "Critical Health Sensor"
desc = "The nanites receive a signal when the host first reaches critical health."
var/spent = FALSE
/datum/nanite_program/sensor/crit/check_event()
if(host_mob.InCritical())
if(!spent)
spent = TRUE
return TRUE
return FALSE
else
spent = FALSE
return FALSE
/datum/nanite_program/sensor/death
name = "Death Sensor"
desc = "The nanites receive a signal when they detect the host is dead."
var/spent = FALSE
/datum/nanite_program/sensor/death/on_death()
send_code()
/datum/nanite_program/sensor/nanite_volume
name = "Nanite Volume Sensor"
desc = "The nanites receive a signal when the nanite supply is above/below a certain percentage."
extra_settings = list("Sent Code","Nanite Percent","Direction")
var/spent = FALSE
var/percent = 50
var/direction = "Above"
/datum/nanite_program/sensor/nanite_volume/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Nanite Percent")
var/new_percent = input(user, "Set the nanite percentage:", name, null) as null|num
if(isnull(new_percent))
return
percent = CLAMP(round(new_percent, 1), 1, 100)
if(setting == "Direction")
if(direction == "Above")
direction = "Below"
else
direction = "Above"
/datum/nanite_program/sensor/nanite_volume/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Nanite Percent")
return "[percent]%"
if(setting == "Direction")
return direction
/datum/nanite_program/sensor/nanite_volume/copy_extra_settings_to(datum/nanite_program/sensor/nanite_volume/target)
target.sent_code = sent_code
target.percent = percent
target.direction = direction
/datum/nanite_program/sensor/nanite_volume/check_event()
var/nanite_percent = (nanites.nanite_volume - nanites.safety_threshold)/(nanites.max_nanites - nanites.safety_threshold)*100
var/detected = FALSE
if(direction == "Above")
if(nanite_percent >= percent)
detected = TRUE
else
if(nanite_percent < percent)
detected = TRUE
if(detected)
if(!spent)
spent = TRUE
return TRUE
return FALSE
else
spent = FALSE
return FALSE
/datum/nanite_program/sensor/damage
name = "Damage Sensor"
desc = "The nanites receive a signal when a host's specific damage type is above/below a target value."
extra_settings = list("Sent Code","Damage Type","Damage","Direction")
var/spent = FALSE
var/damage_type = "Brute"
var/damage = 50
var/direction = "Above"
/datum/nanite_program/sensor/damage/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Damage")
var/new_damage = input(user, "Set the damage threshold:", name, null) as null|num
if(isnull(new_damage))
return
damage = CLAMP(round(new_damage, 1), 0, 500)
if(setting == "Damage Type")
var/list/damage_types = list("Brute","Burn","Toxin","Oxygen","Cellular")
var/new_damage_type = input("Choose the damage type", name) as null|anything in damage_types
if(!new_damage_type)
return
damage_type = new_damage_type
if(setting == "Direction")
if(direction == "Above")
direction = "Below"
else
direction = "Above"
/datum/nanite_program/sensor/damage/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Damage")
return damage
if(setting == "Damage Type")
return damage_type
if(setting == "Direction")
return direction
/datum/nanite_program/sensor/damage/copy_extra_settings_to(datum/nanite_program/sensor/damage/target)
target.sent_code = sent_code
target.damage = damage
target.damage_type = damage_type
target.direction = direction
/datum/nanite_program/sensor/damage/check_event()
var/reached_threshold = FALSE
var/check_above = (direction == "Above")
var/damage_amt = 0
switch(damage_type)
if("Brute")
damage_amt = host_mob.getBruteLoss()
if("Burn")
damage_amt = host_mob.getFireLoss()
if("Toxin")
damage_amt = host_mob.getToxLoss()
if("Oxygen")
damage_amt = host_mob.getOxyLoss()
if("Cellular")
damage_amt = host_mob.getCloneLoss()
if(damage_amt >= damage)
if(check_above)
reached_threshold = TRUE
else if(!check_above)
reached_threshold = TRUE
if(reached_threshold)
if(!spent)
spent = TRUE
return TRUE
return FALSE
else
spent = FALSE
return FALSE
/datum/nanite_program/sensor/voice
name = "Voice Sensor"
desc = "Sends a signal when the nanites hear a determined word or sentence."
extra_settings = list("Sent Code","Sentence","Inclusive Mode")
var/spent = FALSE
var/sentence = ""
var/inclusive = TRUE
/datum/nanite_program/sensor/voice/set_extra_setting(user, setting)
if(setting == "Sent Code")
var/new_code = input(user, "Set the sent code (1-9999):", name, null) as null|num
if(isnull(new_code))
return
sent_code = CLAMP(round(new_code, 1), 1, 9999)
if(setting == "Sentence")
var/new_sentence = stripped_input(user, "Choose the sentence that triggers the sensor.", "Sentence", sentence, MAX_MESSAGE_LEN)
if(!new_sentence)
return
sentence = new_sentence
if(setting == "Inclusive Mode")
var/new_inclusive = input("Should the sensor detect the sentence if contained within another sentence?", name) as null|anything in list("Inclusive","Exclusive")
if(!new_inclusive)
return
inclusive = (new_inclusive == "Inclusive")
/datum/nanite_program/sensor/voice/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Sentence")
return sentence
if(setting == "Inclusive Mode")
if(inclusive)
return "Inclusive"
else
return "Exclusive"
/datum/nanite_program/sensor/voice/copy_extra_settings_to(datum/nanite_program/sensor/voice/target)
target.sent_code = sent_code
target.sentence = sentence
target.inclusive = inclusive
/datum/nanite_program/sensor/voice/on_hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
if(!sentence)
return
//To make it not case sensitive
var/low_message = lowertext(raw_message)
var/low_sentence = lowertext(sentence)
if(inclusive)
if(findtext(low_message, low_sentence))
send_code()
else
if(low_message == low_sentence)
send_code()