QOL OOGA BOOGA

This commit is contained in:
Sishen
2019-08-08 01:11:20 -04:00
parent d1548c7907
commit f59b60e83a
25 changed files with 726 additions and 662 deletions

View File

@@ -0,0 +1,52 @@
/obj/machinery/computer/prisoner
var/obj/item/card/id/prisoner/contained_id
/obj/machinery/computer/prisoner/Destroy()
if(contained_id)
contained_id.forceMove(get_turf(src))
return ..()
/obj/machinery/computer/prisoner/examine(mob/user)
. = ..()
if(contained_id)
. += "<span class='notice'><b>Alt-click</b> to eject the ID card.</span>"
/obj/machinery/computer/prisoner/AltClick(mob/user)
id_eject(user)
return ..()
/obj/machinery/computer/prisoner/proc/id_insert(mob/user, obj/item/card/id/prisoner/P)
if(istype(P))
if(contained_id)
to_chat(user, "<span class='warning'>There's already an ID card in the console!</span>")
return
if(!user.transferItemToLoc(P, src))
return
contained_id = P
user.visible_message("<span class='notice'>[user] inserts an ID card into the console.</span>", \
"<span class='notice'>You insert the ID card into the console.</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
updateUsrDialog()
/obj/machinery/computer/prisoner/proc/id_eject(mob/user)
if(!contained_id)
to_chat(user, "<span class='warning'>There's no ID card in the console!</span>")
return
else
contained_id.forceMove(drop_location())
if(!issilicon(user) && Adjacent(user))
user.put_in_hands(contained_id)
contained_id = null
user.visible_message("<span class='notice'>[user] gets an ID card from the console.</span>", \
"<span class='notice'>You get the ID card from the console.</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
updateUsrDialog()
/obj/machinery/computer/prisoner/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/card/id/prisoner))
id_insert(user, I)
else
return ..()

View File

@@ -0,0 +1,142 @@
//computer that handle the points and teleports the prisoner
/obj/machinery/computer/prisoner/gulag_teleporter_computer
name = "labor camp teleporter console"
desc = "Used to send criminals to the Labor Camp."
icon_screen = "explosive"
icon_keyboard = "security_key"
req_access = list(ACCESS_ARMORY)
circuit = /obj/item/circuitboard/computer/gulag_teleporter_console
var/default_goal = 200
var/obj/machinery/gulag_teleporter/teleporter = null
var/obj/structure/gulag_beacon/beacon = null
var/mob/living/carbon/human/prisoner = null
var/datum/data/record/temporary_record = null
light_color = LIGHT_COLOR_RED
/obj/machinery/computer/prisoner/gulag_teleporter_computer/Initialize()
. = ..()
scan_machinery()
/obj/machinery/computer/prisoner/gulag_teleporter_computer/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)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "gulag_console", name, 455, 440, master_ui, state)
ui.open()
/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_data(mob/user)
var/list/data = list()
var/list/prisoner_list = list()
var/can_teleport = FALSE
if(teleporter && (teleporter.occupant && ishuman(teleporter.occupant)))
prisoner = teleporter.occupant
prisoner_list["name"] = prisoner.real_name
if(contained_id)
can_teleport = TRUE
if(!isnull(GLOB.data_core.general))
for(var/r in GLOB.data_core.security)
var/datum/data/record/R = r
if(R.fields["name"] == prisoner_list["name"])
temporary_record = R
prisoner_list["crimstat"] = temporary_record.fields["criminal"]
data["prisoner"] = prisoner_list
if(teleporter)
data["teleporter"] = teleporter
data["teleporter_location"] = "([teleporter.x], [teleporter.y], [teleporter.z])"
data["teleporter_lock"] = teleporter.locked
data["teleporter_state_open"] = teleporter.state_open
if(beacon)
data["beacon"] = beacon
data["beacon_location"] = "([beacon.x], [beacon.y], [beacon.z])"
if(contained_id)
data["id"] = contained_id
data["id_name"] = contained_id.registered_name
data["goal"] = contained_id.goal
data["can_teleport"] = can_teleport
return data
/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_act(action, list/params)
if(isliving(usr))
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
if(..())
return
if(!allowed(usr))
to_chat(usr, "<span class='warning'>Access denied.</span>")
return
switch(action)
if("scan_teleporter")
teleporter = findteleporter()
if("scan_beacon")
beacon = findbeacon()
if("handle_id")
if(contained_id)
id_eject(usr)
else
id_insert(usr)
if("set_goal")
var/new_goal = input("Set the amount of points:", "Points", contained_id.goal) as num|null
if(!isnum(new_goal))
return
if(!new_goal)
new_goal = default_goal
if (new_goal > 1000)
to_chat(usr, "The entered amount of points is too large. Points have instead been set to the maximum allowed amount.")
contained_id.goal = CLAMP(new_goal, 0, 1000) //maximum 1000 points
if("toggle_open")
if(teleporter.locked)
to_chat(usr, "The teleporter is locked")
return
teleporter.toggle_open()
if("teleporter_lock")
if(teleporter.state_open)
to_chat(usr, "Close the teleporter before locking!")
return
teleporter.locked = !teleporter.locked
if("teleport")
if(!teleporter || !beacon)
return
addtimer(CALLBACK(src, .proc/teleport, usr), 5)
/obj/machinery/computer/prisoner/gulag_teleporter_computer/proc/scan_machinery()
teleporter = findteleporter()
beacon = findbeacon()
/obj/machinery/computer/prisoner/gulag_teleporter_computer/proc/findteleporter()
var/obj/machinery/gulag_teleporter/teleporterf = null
for(var/direction in GLOB.cardinals)
teleporterf = locate(/obj/machinery/gulag_teleporter, get_step(src, direction))
if(teleporterf && teleporterf.is_operational())
return teleporterf
/obj/machinery/computer/prisoner/gulag_teleporter_computer/proc/findbeacon()
return locate(/obj/structure/gulag_beacon)
/obj/machinery/computer/prisoner/gulag_teleporter_computer/proc/teleport(mob/user)
if(!contained_id) //incase the ID was removed after the transfer timer was set.
say("Warning: Unable to transfer prisoner without a valid Prisoner ID inserted!")
return
var/id_goal_not_set
if(!contained_id.goal)
id_goal_not_set = TRUE
contained_id.goal = default_goal
say("[contained_id]'s ID card goal defaulting to [contained_id.goal] points.")
log_game("[key_name(user)] teleported [key_name(prisoner)] to the Labor Camp [COORD(beacon)] for [id_goal_not_set ? "default goal of ":""][contained_id.goal] points.")
teleporter.handle_prisoner(contained_id, temporary_record)
playsound(src, 'sound/weapons/emitter.ogg', 50, 1)
prisoner.forceMove(get_turf(beacon))
prisoner.Stun(40) // small travel dizziness
to_chat(prisoner, "<span class='warning'>The teleportation makes you a little dizzy.</span>")
new /obj/effect/particle_effect/sparks(get_turf(prisoner))
playsound(src, "sparks", 50, 1)
if(teleporter.locked)
teleporter.locked = FALSE
teleporter.toggle_open()
contained_id = null
temporary_record = null

View File

@@ -0,0 +1,139 @@
/obj/machinery/computer/prisoner/management
name = "prisoner management console"
desc = "Used to manage tracking implants placed inside criminals."
icon_screen = "explosive"
icon_keyboard = "security_key"
req_access = list(ACCESS_BRIG)
var/id = 0
var/temp = null
var/status = 0
var/timeleft = 60
var/stop = 0
var/screen = 0 // 0 - No Access Denied, 1 - Access allowed
circuit = /obj/item/circuitboard/computer/prisoner
light_color = LIGHT_COLOR_RED
/obj/machinery/computer/prisoner/management/ui_interact(mob/user)
. = ..()
if(isliving(user))
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
var/dat = ""
if(screen == 0)
dat += "<HR><A href='?src=[REF(src)];lock=1'>{Log In}</A>"
else if(screen == 1)
dat += "<H3>Prisoner ID Management</H3>"
if(contained_id)
dat += text("<A href='?src=[REF(src)];id=eject'>[contained_id]</A><br>")
dat += text("Collected Points: [contained_id.points]. <A href='?src=[REF(src)];id=reset'>Reset.</A><br>")
dat += text("Card goal: [contained_id.goal]. <A href='?src=[REF(src)];id=setgoal'>Set </A><br>")
dat += text("Space Law recommends quotas of 100 points per minute they would normally serve in the brig.<BR>")
else
dat += text("<A href='?src=[REF(src)];id=insert'>Insert Prisoner ID.</A><br>")
dat += "<H3>Prisoner Implant Management</H3>"
dat += "<HR>Chemical Implants<BR>"
var/turf/Tr = null
for(var/obj/item/implant/chem/C in GLOB.tracked_chem_implants)
Tr = get_turf(C)
if((Tr) && (Tr.z != src.z))
continue//Out of range
if(!C.imp_in)
continue
dat += "ID: [C.imp_in.name] | Remaining Units: [C.reagents.total_volume] <BR>"
dat += "| Inject: "
dat += "<A href='?src=[REF(src)];inject1=[REF(C)]'>(<font class='bad'>(1)</font>)</A>"
dat += "<A href='?src=[REF(src)];inject5=[REF(C)]'>(<font class='bad'>(5)</font>)</A>"
dat += "<A href='?src=[REF(src)];inject10=[REF(C)]'>(<font class='bad'>(10)</font>)</A><BR>"
dat += "********************************<BR>"
dat += "<HR>Tracking Implants<BR>"
for(var/obj/item/implant/tracking/T in GLOB.tracked_implants)
if(!isliving(T.imp_in))
continue
Tr = get_turf(T)
if((Tr) && (Tr.z != src.z))
continue//Out of range
var/loc_display = "Unknown"
var/mob/living/M = T.imp_in
if(is_station_level(Tr.z) && !isspaceturf(M.loc))
var/turf/mob_loc = get_turf(M)
loc_display = mob_loc.loc
dat += "ID: [T.imp_in.name] | Location: [loc_display]<BR>"
dat += "<A href='?src=[REF(src)];warn=[REF(T)]'>(<font class='bad'><i>Message Holder</i></font>)</A> |<BR>"
dat += "********************************<BR>"
dat += "<HR><A href='?src=[REF(src)];lock=1'>{Log Out}</A>"
var/datum/browser/popup = new(user, "computer", "Prisoner Management Console", 400, 500)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
return
/obj/machinery/computer/prisoner/management/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/card/id))
if(screen)
id_insert(user)
else
to_chat(user, "<span class='danger'>Unauthorized access.</span>")
else
return ..()
/obj/machinery/computer/prisoner/management/process()
if(!..())
src.updateDialog()
return
/obj/machinery/computer/prisoner/management/Topic(href, href_list)
if(..())
return
if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)) || issilicon(usr))
usr.set_machine(src)
if(href_list["id"])
if(href_list["id"] =="insert" && !contained_id)
id_insert(usr)
else if(contained_id)
switch(href_list["id"])
if("eject")
id_eject(usr)
if("reset")
contained_id.points = 0
if("setgoal")
var/num = round(input(usr, "Choose prisoner's goal:", "Input an Integer", null) as num|null)
if(num >= 0)
num = min(num,1000) //Cap the quota to the equivilent of 10 minutes.
contained_id.goal = num
else if(href_list["inject1"])
var/obj/item/implant/I = locate(href_list["inject1"]) in GLOB.tracked_chem_implants
if(I && istype(I))
I.activate(1)
else if(href_list["inject5"])
var/obj/item/implant/I = locate(href_list["inject5"]) in GLOB.tracked_chem_implants
if(I && istype(I))
I.activate(5)
else if(href_list["inject10"])
var/obj/item/implant/I = locate(href_list["inject10"]) in GLOB.tracked_chem_implants
if(I && istype(I))
I.activate(10)
else if(href_list["lock"])
if(allowed(usr))
screen = !screen
playsound(src, 'sound/machines/terminal_on.ogg', 50, FALSE)
else
to_chat(usr, "<span class='danger'>Unauthorized access.</span>")
else if(href_list["warn"])
var/warning = copytext(sanitize(input(usr,"Message:","Enter your message here!","")),1,MAX_MESSAGE_LEN)
if(!warning)
return
var/obj/item/implant/I = locate(href_list["warn"]) in GLOB.tracked_implants
if(I && istype(I) && I.imp_in)
var/mob/living/R = I.imp_in
to_chat(R, "<span class='italics'>You hear a voice in your head saying: '[warning]'</span>")
log_directed_talk(usr, R, warning, LOG_SAY, "implant message")
src.add_fingerprint(usr)
src.updateUsrDialog()
return