mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-31 20:42:27 +00:00
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
218 lines
7.0 KiB
Plaintext
218 lines
7.0 KiB
Plaintext
/**
|
|
* Multitool -- A multitool is used for hacking electronic devices.
|
|
*
|
|
*/
|
|
|
|
/obj/item/device/multitool
|
|
name = "multitool"
|
|
desc = "This small, handheld device is made of durable, insulated plastic. It has a electrode jack, perfect for interfacing with numerous machines, as well as an in-built NT-SmartTrack! system."
|
|
desc_info = "You can use this on airlocks or APCs to try to hack them without cutting wires. You can also use it to wire circuits, and track APCs by using it in-hand."
|
|
icon = 'icons/obj/item/tools/multitool.dmi'
|
|
icon_state = "multitool"
|
|
item_state = "multitool"
|
|
item_icons = null
|
|
contained_sprite = TRUE
|
|
flags = CONDUCT
|
|
force = 5.0
|
|
w_class = ITEMSIZE_SMALL
|
|
throwforce = 5.0
|
|
throw_range = 15
|
|
throw_speed = 3
|
|
drop_sound = 'sound/items/drop/multitool.ogg'
|
|
pickup_sound = 'sound/items/pickup/multitool.ogg'
|
|
|
|
matter = list(DEFAULT_WALL_MATERIAL = 50, MATERIAL_GLASS = 20)
|
|
|
|
origin_tech = list(TECH_MAGNET = 1, TECH_ENGINEERING = 1)
|
|
|
|
var/obj/machinery/buffer // simple machine buffer for device linkage
|
|
var/obj/machinery/clonepod/connecting //same for cryopod linkage
|
|
var/buffer_name
|
|
var/atom/buffer_object
|
|
|
|
var/tracking_apc = FALSE
|
|
var/mutable_appearance/apc_indicator
|
|
|
|
var/datum/integrated_io/selected_io = null
|
|
var/mode = 0
|
|
|
|
/obj/item/device/multitool/Destroy()
|
|
unregister_buffer(buffer_object)
|
|
QDEL_NULL(apc_indicator)
|
|
return ..()
|
|
|
|
/obj/item/device/multitool/ismultitool()
|
|
return TRUE
|
|
|
|
/obj/item/device/multitool/proc/get_buffer(var/typepath)
|
|
// Only allow clearing the buffer name when someone fetches the buffer.
|
|
// Means you cannot be sure the source hasn't been destroyed until the very moment it's needed.
|
|
get_buffer_name(TRUE)
|
|
if(buffer_object && (!typepath || istype(buffer_object, typepath)))
|
|
return buffer_object
|
|
|
|
/obj/item/device/multitool/proc/get_buffer_name(var/null_name_if_missing = FALSE)
|
|
if(buffer_object)
|
|
buffer_name = buffer_object.name
|
|
else if(null_name_if_missing)
|
|
buffer_name = null
|
|
return buffer_name
|
|
|
|
/obj/item/device/multitool/proc/set_buffer(var/atom/buffer)
|
|
if(!buffer || istype(buffer))
|
|
buffer_name = buffer ? buffer.name : null
|
|
if(buffer != buffer_object)
|
|
unregister_buffer(buffer_object)
|
|
buffer_object = buffer
|
|
if(buffer_object)
|
|
destroyed_event.register(buffer_object, src, PROC_REF(unregister_buffer))
|
|
update_icon()
|
|
|
|
/obj/item/device/multitool/proc/unregister_buffer(var/atom/buffer_to_unregister)
|
|
// Only remove the buffered object, don't reset the name
|
|
// This means one cannot know if the buffer has been destroyed until one attempts to use it.
|
|
if(buffer_to_unregister == buffer_object && buffer_object)
|
|
destroyed_event.unregister(buffer_object, src)
|
|
buffer_object = null
|
|
update_icon()
|
|
|
|
/obj/item/device/multitool/resolve_attackby(atom/A, mob/user, var/click_parameters)
|
|
if(!isobj(A))
|
|
return ..(A, user, click_parameters)
|
|
|
|
var/obj/O = A
|
|
var/datum/component/multitool/MT = O.GetComponent(/datum/component/multitool)
|
|
if(!MT)
|
|
return ..(A, user, click_parameters)
|
|
|
|
user.AddTopicPrint(src)
|
|
MT.interact(src, user)
|
|
return 1
|
|
|
|
/obj/item/device/multitool/attack_self(mob/user)
|
|
interact(user)
|
|
|
|
/obj/item/device/multitool/interact(mob/user)
|
|
ui_interact(user)
|
|
|
|
/obj/item/device/multitool/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "Multitool", "Multitool", 300, 250)
|
|
ui.open()
|
|
|
|
/obj/item/device/multitool/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["tracking_apc"] = tracking_apc
|
|
|
|
if(selected_io)
|
|
data["selected_io"] = list("name" = selected_io.name, "type" = selected_io.io_type)
|
|
return data
|
|
|
|
/obj/item/device/multitool/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return TRUE
|
|
|
|
switch(action)
|
|
if("track_apc")
|
|
tracking_apc = !tracking_apc
|
|
if(tracking_apc)
|
|
START_PROCESSING(SSprocessing, src)
|
|
apc_indicator = mutable_appearance(icon, "lost")
|
|
add_overlay(apc_indicator)
|
|
else
|
|
STOP_PROCESSING(SSprocessing, src)
|
|
QDEL_NULL(apc_indicator)
|
|
. = TRUE
|
|
|
|
if("clear_io")
|
|
selected_io = null
|
|
. = TRUE
|
|
|
|
update_icon()
|
|
|
|
/obj/item/device/multitool/update_icon()
|
|
if(tracking_apc)
|
|
icon_state = "multitool_clear"
|
|
else if(selected_io)
|
|
if(buffer || connecting || buffer_object)
|
|
icon_state = "multitool_tracking"
|
|
else
|
|
icon_state = "multitool_red"
|
|
else
|
|
if(buffer || connecting || buffer_object)
|
|
icon_state = "multitool_tracking_fail"
|
|
else
|
|
icon_state = "multitool"
|
|
|
|
/obj/item/device/multitool/process()
|
|
if(!apc_indicator)
|
|
return PROCESS_KILL
|
|
|
|
var/turf/T = get_turf(src)
|
|
var/area/A = T.loc
|
|
var/obj/machinery/power/apc/APC = A.apc
|
|
|
|
if(!APC || (APC.z != T.z))
|
|
apc_indicator.icon_state = "lost"
|
|
else
|
|
// shamelessly stolen from technomancer
|
|
dir = get_dir(T, APC.loc) // overlays can't have different dirs than their atoms, but the multitool only has one dir sprite, so this works
|
|
switch(get_dist(T, APC.loc))
|
|
if(-1 to 0)
|
|
apc_indicator.icon_state = "direct"
|
|
if(1 to 8)
|
|
apc_indicator.icon_state = "close"
|
|
if(9 to 16)
|
|
apc_indicator.icon_state = "medium"
|
|
if(16 to INFINITY)
|
|
apc_indicator.icon_state = "far"
|
|
set_overlays(apc_indicator)
|
|
|
|
/obj/item/device/multitool/proc/wire(datum/integrated_io/io, mob/user)
|
|
if(!io.holder.assembly)
|
|
to_chat(user, "<span class='warning'>\The [io.holder] needs to be secured inside an assembly first.</span>")
|
|
return
|
|
|
|
if(selected_io)
|
|
if(io == selected_io)
|
|
to_chat(user, "<span class='warning'>Wiring \the [selected_io.holder]'s '[selected_io.name]' pin into itself is rather pointless.</span>")
|
|
return
|
|
if(io.io_type != selected_io.io_type)
|
|
to_chat(user, "<span class='warning'>Those two types of channels are incompatable. The first is a [selected_io.io_type], \
|
|
while the second is a [io.io_type].</span>")
|
|
return
|
|
if(io.holder.assembly && io.holder.assembly != selected_io.holder.assembly)
|
|
to_chat(user, "<span class='warning'>Both \the [io.holder] and \the [selected_io.holder] need to be inside the same assembly.</span>")
|
|
return
|
|
selected_io.linked |= io
|
|
io.linked |= selected_io
|
|
|
|
to_chat(user, "<span class='notice'>You connect \the [selected_io.holder]'s '[selected_io.name]' pin to \the [io.holder]'s '[io.name]' pin.</span>")
|
|
selected_io.holder.interact(user) // This is to update the UI.
|
|
selected_io = null
|
|
|
|
else
|
|
selected_io = io
|
|
to_chat(user, "<span class='notice'>You link \the multitool to \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
|
|
|
|
update_icon()
|
|
|
|
/obj/item/device/multitool/proc/unwire(datum/integrated_io/io1, datum/integrated_io/io2, mob/user)
|
|
if(!io1.linked.len || !io2.linked.len)
|
|
to_chat(user, "<span class='warning'>There is nothing connected to the data channel.</span>")
|
|
return
|
|
|
|
if(!(io1 in io2.linked) || !(io2 in io1.linked) )
|
|
to_chat(user, "<span class='warning'>These data pins aren't connected!</span>")
|
|
return
|
|
else
|
|
io1.linked.Remove(io2)
|
|
io2.linked.Remove(io1)
|
|
to_chat(user, "<span class='notice'>You clip the data connection between the [io1.holder.displayed_name]'s \
|
|
'[io1.name]' pin and the [io2.holder.displayed_name]'s '[io2.name]' pin.</span>")
|
|
io1.holder.interact(user) // This is to update the UI.
|
|
update_icon()
|