Suffering and co

This commit is contained in:
Artur
2020-02-11 20:18:32 +02:00
parent c8a62e7acf
commit a9a167b9d3
35 changed files with 1445 additions and 1281 deletions
@@ -9,6 +9,9 @@
use_power = IDLE_POWER_USE
anchored = TRUE
density = TRUE
flags_1 = HEAR_1
ui_x = 420
ui_y = 550
/obj/machinery/nanite_programmer/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/disk/nanite_program))
@@ -17,7 +20,7 @@
eject(user)
if(user.transferItemToLoc(N, src))
to_chat(user, "<span class='notice'>You insert [N] into [src]</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
disk = N
program = N.program
else
@@ -32,9 +35,9 @@
program = null
/obj/machinery/nanite_programmer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
SStgui.try_update_ui(user, src, ui_key, ui, force_open)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "nanite_programmer", name, 600, 800, master_ui, state)
ui = new(user, src, ui_key, "nanite_programmer", name, ui_x, ui_y, master_ui, state)
ui.open()
/obj/machinery/nanite_programmer/ui_data()
@@ -50,20 +53,16 @@
data["trigger_cooldown"] = program.trigger_cooldown / 10
data["activated"] = program.activated
data["activation_delay"] = program.activation_delay
data["timer"] = program.timer
data["activation_code"] = program.activation_code
data["deactivation_code"] = program.deactivation_code
data["kill_code"] = program.kill_code
data["trigger_code"] = program.trigger_code
data["timer_type"] = program.get_timer_type_text()
data["timer_restart"] = program.timer_restart / 10
data["timer_shutdown"] = program.timer_shutdown / 10
data["timer_trigger"] = program.timer_trigger / 10
data["timer_trigger_delay"] = program.timer_trigger_delay / 10
var/list/extra_settings = list()
for(var/X in program.extra_settings)
var/list/setting = list()
setting["name"] = X
setting["value"] = program.get_extra_setting(X)
extra_settings += list(setting)
var/list/extra_settings = program.get_extra_settings_frontend()
data["extra_settings"] = extra_settings
if(LAZYLEN(extra_settings))
data["has_extra_settings"] = TRUE
@@ -78,20 +77,12 @@
eject(usr)
. = TRUE
if("toggle_active")
playsound(src, "terminal_type", 25, 0)
playsound(src, "terminal_type", 25, FALSE)
program.activated = !program.activated //we don't use the activation procs since we aren't in a mob
if(program.activated)
program.activation_delay = 0
. = TRUE
if("set_code")
var/new_code = input("Set code (0000-9999):", name, null) as null|num
if(!isnull(new_code))
playsound(src, "terminal_type", 25, 0)
new_code = CLAMP(round(new_code, 1),0,9999)
else
return
playsound(src, "terminal_type", 25, 0)
var/new_code = text2num(params["code"])
playsound(src, "terminal_type", 25, FALSE)
var/target_code = params["target_code"]
switch(target_code)
if("activation")
@@ -104,37 +95,44 @@
program.trigger_code = CLAMP(round(new_code, 1),0,9999)
. = TRUE
if("set_extra_setting")
program.set_extra_setting(usr, params["target_setting"])
playsound(src, "terminal_type", 25, 0)
program.set_extra_setting(params["target_setting"], params["value"])
playsound(src, "terminal_type", 25, FALSE)
. = TRUE
if("set_activation_delay")
var/delay = input("Set activation delay in seconds (0-1800):", name, program.activation_delay) as null|num
if(!isnull(delay))
playsound(src, "terminal_type", 25, 0)
delay = CLAMP(round(delay, 1),0,1800)
program.activation_delay = delay
if(delay)
program.activated = FALSE
. = TRUE
if("set_timer")
var/timer = input("Set timer in seconds (10-3600):", name, program.timer) as null|num
if("set_restart_timer")
var/timer = text2num(params["delay"])
if(!isnull(timer))
playsound(src, "terminal_type", 25, 0)
if(!timer == 0)
timer = CLAMP(round(timer, 1),10,3600)
program.timer = timer
playsound(src, "terminal_type", 25, FALSE)
timer = CLAMP(round(timer, 1), 0, 3600)
timer *= 10 //convert to deciseconds
program.timer_restart = timer
. = TRUE
if("set_timer_type")
var/new_type = input("Choose the timer effect","Timer Effect") as null|anything in list("Deactivate","Self-Delete","Trigger","Reset Activation Timer")
if(new_type)
playsound(src, "terminal_type", 25, 0)
switch(new_type)
if("Deactivate")
program.timer_type = NANITE_TIMER_DEACTIVATE
if("Self-Delete")
program.timer_type = NANITE_TIMER_SELFDELETE
if("Trigger")
program.timer_type = NANITE_TIMER_TRIGGER
if("Reset Activation Timer")
program.timer_type = NANITE_TIMER_RESET
. = TRUE
if("set_shutdown_timer")
var/timer = text2num(params["delay"])
if(!isnull(timer))
playsound(src, "terminal_type", 25, FALSE)
timer = CLAMP(round(timer, 1), 0, 3600)
timer *= 10 //convert to deciseconds
program.timer_shutdown = timer
. = TRUE
if("set_trigger_timer")
var/timer = text2num(params["delay"])
if(!isnull(timer))
playsound(src, "terminal_type", 25, FALSE)
timer = CLAMP(round(timer, 1), 0, 3600)
timer *= 10 //convert to deciseconds
program.timer_trigger = timer
. = TRUE
if("set_timer_trigger_delay")
var/timer = text2num(params["delay"])
if(!isnull(timer))
playsound(src, "terminal_type", 25, FALSE)
timer = CLAMP(round(timer, 1), 0, 3600)
timer *= 10 //convert to deciseconds
program.timer_trigger_delay = timer
. = TRUE
/obj/machinery/nanite_programmer/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode)
. = ..()
var/static/regex/when = regex("(?:^\\W*when|when\\W*$)", "i") //starts or ends with when
if(findtext(raw_message, when) && !istype(speaker, /obj/machinery/nanite_programmer))
say("When you code it!!")