Skip to content

Commit

Permalink
Adds the dermal button program for nanites (tgstation#47071)
Browse files Browse the repository at this point in the history
* Adds the dermal button program for nanites

* visible message
  • Loading branch information
XDTM authored and Jordie0608 committed Oct 21, 2019
1 parent ac84eea commit 3227736
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
7 changes: 7 additions & 0 deletions code/modules/research/designs/nanite_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
program_type = /datum/nanite_program/triggered/self_scan
category = list("Utility Nanites")

/datum/design/nanites/dermal_button
name = "Dermal Button"
desc = "Displays a button on the host's skin, which can be used to send a signal to the nanites."
id = "dermal_button_nanites"
program_type = /datum/nanite_program/dermal_button
category = list("Utility Nanites")

/datum/design/nanites/stealth
name = "Stealth"
desc = "The nanites hide their activity and programming from superficial scans."
Expand Down
87 changes: 87 additions & 0 deletions code/modules/research/nanites/nanite_programs/utility.dm
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,90 @@
if(fault == src)
return
fault.software_error()

/datum/nanite_program/dermal_button
name = "Dermal Button"
desc = "Displays a button on the host's skin, which can be used to send a signal to the nanites."
extra_settings = list("Sent Code","Button Name","Icon","Color")
unique = FALSE
var/datum/action/innate/nanite_button/button
var/button_name = "Button"
var/icon = "power"
var/color = "green"
var/sent_code = 0

/datum/nanite_program/dermal_button/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 == "Button Name")
var/new_button_name = stripped_input(user, "Choose the name for the button.", "Button Name", button_name, MAX_NAME_LEN)
if(!new_button_name)
return
button_name = new_button_name
if(setting == "Icon")
var/new_icon = input("Select the icon to display on the button:", name) as null|anything in list("one","two","three","four","five","plus","minus","power")
if(!new_icon)
return
icon = new_icon
if(setting == "Color")
var/new_color = input("Select the color of the button's icon:", name) as null|anything in list("green","red","yellow","blue")
if(!new_color)
return
color = new_color

/datum/nanite_program/dermal_button/get_extra_setting(setting)
if(setting == "Sent Code")
return sent_code
if(setting == "Button Name")
return button_name
if(setting == "Icon")
return capitalize(icon)
if(setting == "Color")
return capitalize(color)

/datum/nanite_program/dermal_button/copy_extra_settings_to(datum/nanite_program/dermal_button/target)
target.sent_code = sent_code
target.button_name = button_name
target.icon = icon
target.color = color

/datum/nanite_program/dermal_button/enable_passive_effect()
. = ..()
if(!button)
button = new(src, button_name, icon, color)
button.target = host_mob
button.Grant(host_mob)

/datum/nanite_program/dermal_button/disable_passive_effect()
. = ..()
if(button)
button.Remove(host_mob)

/datum/nanite_program/dermal_button/on_mob_remove()
. = ..()
qdel(button)

/datum/nanite_program/dermal_button/proc/press()
if(activated)
host_mob.visible_message("<span class='notice'>[host_mob] presses a button on [host_mob.p_their()] forearm.</span>",
"<span class='notice'>You press the nanite button on your forearm.</span>", null, 2)
SEND_SIGNAL(host_mob, COMSIG_NANITE_SIGNAL, sent_code, "a [name] program")

/datum/action/innate/nanite_button
name = "Button"
icon_icon = 'icons/mob/actions/actions_items.dmi'
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUN|AB_CHECK_CONSCIOUS
button_icon_state = "power_green"
var/datum/nanite_program/dermal_button/program

/datum/action/innate/nanite_button/New(datum/nanite_program/dermal_button/_program, _name, _icon, _color)
..()
program = _program
name = _name
button_icon_state = "[_icon]_[_color]"

/datum/action/innate/nanite_button/Activate()
program.press()
2 changes: 1 addition & 1 deletion code/modules/research/techweb/all_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@
display_name = "Mesh Nanite Programming"
description = "Nanite programs that require static structures and membranes."
prereq_ids = list("nanite_base","engineering")
design_ids = list("hardening_nanites", "refractive_nanites", "cryo_nanites", "conductive_nanites", "shock_nanites", "emp_nanites", "temperature_nanites")
design_ids = list("hardening_nanites", "dermal_button_nanites", "refractive_nanites", "cryo_nanites", "conductive_nanites", "shock_nanites", "emp_nanites", "temperature_nanites")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand Down
Binary file modified icons/mob/actions/actions_items.dmi
Binary file not shown.

0 comments on commit 3227736

Please sign in to comment.