mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-13 11:01:40 +00:00
* Refactor/deduplicate camera eye code Camera Eyes previously had duplicated logic across several files. This change uncooks the spaghetti. Additionally, half-baked support for TG's multicam feature has been removed, as it was not functional or in use. * lets ff now * Camera Eye refactor fixes and finishing touches This change completes a refactor of AI eyes, which were previously used by xenobio consoles, syndicate and abductor camera consoles, shuttle docking computers, holograms, and, of course, the AI. Duplicated logic has been extracted to an abstract base mob, /mob/camera/eye, from which new types for each of the above now derive. Functionality is largely the same, with only a few minor cosmetic differences (i.e. camera eyes are now appropriately named given their type and user), as well as a quality-of-life enhancement for holograms, slowing their movement speed to base run speed to prevent users from accidentally zooming out of calls. * Camera eye refactor: Fix AI acceleration toggle The acceleration toggle was broken in the camera eye refactor, as previously the boolean was stored on the AI rather than its eye. This change fixes that. * Camera eye refactor: Fix syndicate cam visibility With the camera eye refactor, the syndicate advanced camera consoles lost the ability to view maintenance tunnels and other areas without active cameras, seeing static in their place instead (as all other cameras do). This change reinstates the original behavior. * Camera eye refactor: Convert spaces to tabs * Camera eye refactor: Fix CRLF * Apply suggestions from code review General minor code quality improvements suggested by GDNgit Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * Apply suggestions from code review Rename parameter names to avoid src accesses, remove an ambiguous and unused mob_define and holopad range variable from a previous WIP, change the for loop in /mob/camera/eye/relaymove to a for-to loop, and change the chat message warning, sent when an AI Eye is created on an AI that already has one, to a stack trace * Adds toggle to AI commands for fast holograms * Refactor ripped Hologram Eye relaymove Previously, the relaymove proc for hologram eyes was redundant and nearly impossible to read. It has been separated out into a few different named procs, and has had its use of `spawn` removed. * Remove unnecessary src access * Fix bug involving shuttle placement outlines The camera eye refactor that this commit is a part of introduced a bug that prevented shuttle placement outlines from showing up on first use of the shuttle console. This change fixes that bug. * Unrevert some changes from #26306 lost in merge * Remove erroneous free xray vision on advanced cams * Autodoc camera acceleration vars * Remove redundant null var initialization per code review Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com> Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com> * Changed variables to camel_case, autodocs, cleanup Changed a number of camera eye-related variables to camel_case style, added appropriate autodoc comments, as per code review. Also removed an unused cameranet function, modified the call signature of a cameranet function to be more semantic, and changed a qdel-on-initialize in camera eyes to return INITIALIZE_HINT_QDEL instead. Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * Remove stray qdel(src) per code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com> --------- Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com> Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
193 lines
6.5 KiB
Plaintext
193 lines
6.5 KiB
Plaintext
#define PROXIMITY_NONE ""
|
|
#define PROXIMITY_ON_SCREEN "_red"
|
|
#define PROXIMITY_NEAR "_yellow"
|
|
|
|
/**
|
|
* Multitool -- A multitool is used for hacking electronic devices.
|
|
*/
|
|
|
|
/obj/item/multitool
|
|
name = "multitool"
|
|
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors."
|
|
icon = 'icons/obj/tools.dmi'
|
|
icon_state = "multitool"
|
|
belt_icon = "multitool"
|
|
flags = CONDUCT
|
|
force = 0
|
|
w_class = WEIGHT_CLASS_NORMAL
|
|
throwforce = 0
|
|
throw_range = 7
|
|
throw_speed = 3
|
|
drop_sound = 'sound/items/handling/multitool_drop.ogg'
|
|
pickup_sound = 'sound/items/handling/multitool_pickup.ogg'
|
|
materials = list(MAT_METAL = 300, MAT_GLASS = 140)
|
|
origin_tech = "magnets=1;engineering=2"
|
|
toolspeed = 1
|
|
tool_behaviour = TOOL_MULTITOOL
|
|
hitsound = 'sound/weapons/tap.ogg'
|
|
/// Reference to whatever machine is held in the buffer
|
|
var/obj/machinery/buffer // TODO - Make this a soft ref to tie into whats below
|
|
/// Soft-ref for linked stuff. This should be used over the above var.
|
|
var/buffer_uid
|
|
/// Cooldown for detecting APCs
|
|
COOLDOWN_DECLARE(cd_apc_scan)
|
|
|
|
/obj/item/multitool/multitool_check_buffer(user, silent = FALSE)
|
|
return TRUE
|
|
|
|
/obj/item/multitool/proc/set_multitool_buffer(mob/user, obj/machinery/M) //Loads a machine into memory, returns TRUE if it does
|
|
if(!ismachinery(M))
|
|
to_chat(user, "<span class='warning'>That's not a machine!</span>")
|
|
return
|
|
buffer = M
|
|
to_chat(user, "<span class='notice'>You load [M]'s identifying data into [src]'s internal buffer.</span>")
|
|
return TRUE
|
|
|
|
/obj/item/multitool/Destroy()
|
|
buffer = null
|
|
return ..()
|
|
|
|
/obj/item/multitool/attack_self__legacy__attackchain(mob/user)
|
|
if(!COOLDOWN_FINISHED(src, cd_apc_scan))
|
|
return
|
|
COOLDOWN_START(src, cd_apc_scan, 1.5 SECONDS)
|
|
var/area/local_area = get_area(src)
|
|
var/obj/machinery/power/apc/apc = local_area?.get_apc()
|
|
if(!apc)
|
|
to_chat(user, "<span class='warning'>No APC detected.</span>")
|
|
return
|
|
if(get_turf(src) == get_turf(apc)) // we're standing on top of it
|
|
to_chat(user, "<span class='notice'>APC detected 0 meters [dir2text(apc.dir)].</span>")
|
|
return
|
|
to_chat(user, "<span class='notice'>APC detected [get_dist(src, apc)] meter\s [dir2text(get_dir(src, apc))].</span>")
|
|
|
|
// Syndicate device disguised as a multitool; it will turn red when an AI camera is nearby.
|
|
/obj/item/multitool/ai_detect
|
|
var/track_cooldown = 0
|
|
var/track_delay = 10 //How often it checks for proximity
|
|
var/detect_state = PROXIMITY_NONE
|
|
var/rangealert = 8 //Glows red when inside
|
|
var/rangewarning = 20 //Glows yellow when inside
|
|
origin_tech = "magnets=1;engineering=2;syndicate=1"
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
|
|
/obj/item/multitool/ai_detect/Initialize(mapload)
|
|
. = ..()
|
|
START_PROCESSING(SSobj, src)
|
|
|
|
/obj/item/multitool/ai_detect/Destroy()
|
|
STOP_PROCESSING(SSobj, src)
|
|
return ..()
|
|
|
|
/obj/item/multitool/ai_detect/process()
|
|
if(track_cooldown > world.time)
|
|
return
|
|
detect_state = PROXIMITY_NONE
|
|
multitool_detect()
|
|
icon_state = "[initial(icon_state)][detect_state]"
|
|
belt_icon = "[initial(icon_state)][detect_state]"
|
|
track_cooldown = world.time + track_delay
|
|
if(istype(loc, /obj/item/storage/belt))
|
|
var/obj/item/storage/belt/B = loc
|
|
B.update_icon()
|
|
|
|
/obj/item/multitool/ai_detect/proc/multitool_detect()
|
|
var/turf/our_turf = get_turf(src)
|
|
for(var/mob/living/silicon/ai/AI in GLOB.ai_list)
|
|
if(AI.camera_follow == src)
|
|
detect_state = PROXIMITY_ON_SCREEN
|
|
break
|
|
|
|
if(!detect_state && GLOB.cameranet.chunk_generated(our_turf.x, our_turf.y, our_turf.z))
|
|
var/datum/camerachunk/chunk = GLOB.cameranet.get_camera_chunk(our_turf.x, our_turf.y, our_turf.z)
|
|
if(chunk)
|
|
if(length(chunk.seenby))
|
|
for(var/mob/camera/eye/ai/A in chunk.seenby)
|
|
//Checks if the A is to be detected or not
|
|
if(!A.ai_detector_visible)
|
|
continue
|
|
var/turf/detect_turf = get_turf(A)
|
|
if(get_dist(our_turf, detect_turf) < rangealert)
|
|
detect_state = PROXIMITY_ON_SCREEN
|
|
break
|
|
if(get_dist(our_turf, detect_turf) < rangewarning)
|
|
detect_state = PROXIMITY_NEAR
|
|
break
|
|
|
|
/obj/item/multitool/red
|
|
name = "suspicious multitool"
|
|
desc = "A sinister-looking multitool, used for pulsing wires to test which to cut."
|
|
icon_state = "multitool_syndi"
|
|
item_state = "multitool_syndi"
|
|
belt_icon = "multitool_syndi"
|
|
toolspeed = 0.95 // dangerously fast... not like multitools use speed anyways
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
origin_tech = "magnets=1;engineering=2;syndicate=1"
|
|
|
|
/obj/item/multitool/command
|
|
name = "command multitool"
|
|
desc = "Used for pulsing wires to test which to cut. Not recommended by the Captain."
|
|
icon_state = "multitool_command"
|
|
item_state = "multitool_command"
|
|
belt_icon = "multitool_command"
|
|
toolspeed = 0.95 //command those wires / that fireaxe cabinet!
|
|
var/list/victims = list()
|
|
|
|
/obj/item/multitool/command/suicide_act(mob/living/user)
|
|
user.visible_message("<span class='suicide'>[user] is attempting to command the command multitool! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
|
//basically just cleaned up and copied from the medical wrench code
|
|
if(!user)
|
|
return
|
|
|
|
user.Immobilize(10 SECONDS)
|
|
sleep(20)
|
|
add_fingerprint(user)
|
|
|
|
var/base_desc = "Used for pulsing wires to test which to cut. Not recommended by the Captain. Its screen displays the text \""
|
|
victims += user.name
|
|
|
|
if(length(victims) < 3)
|
|
desc = base_desc + english_list(victims) + ": executed for mutiny.\""
|
|
else
|
|
desc = base_desc + english_list(victims) + ", all executed for mutiny. Impressive.\""
|
|
|
|
playsound(loc, 'sound/effects/supermatter.ogg', 50, TRUE, -1)
|
|
for(var/obj/item/W in user)
|
|
user.drop_item_to_ground(W)
|
|
|
|
user.dust()
|
|
return OBLITERATION
|
|
|
|
/obj/item/multitool/ai_detect/admin
|
|
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors. Has a strange tag that says 'Grief in Safety'" //What else should I say for a meme item?
|
|
track_delay = 5
|
|
|
|
/obj/item/multitool/ai_detect/admin/Initialize(mapload)
|
|
. = ..()
|
|
ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT)
|
|
|
|
/obj/item/multitool/ai_detect/admin/multitool_detect()
|
|
var/turf/our_turf = get_turf(src)
|
|
for(var/mob/J in urange(rangewarning,our_turf))
|
|
if(check_rights(R_ADMIN, 0, J))
|
|
detect_state = PROXIMITY_NEAR
|
|
var/turf/detect_turf = get_turf(J)
|
|
if(get_dist(our_turf, detect_turf) < rangealert)
|
|
detect_state = PROXIMITY_ON_SCREEN
|
|
break
|
|
|
|
/obj/item/multitool/cyborg
|
|
name = "multitool"
|
|
desc = "Optimised and stripped-down version of a regular multitool."
|
|
toolspeed = 0.5
|
|
|
|
/obj/item/multitool/cyborg/drone
|
|
|
|
/obj/item/multitool/cyborg/drone/Initialize(mapload)
|
|
. = ..()
|
|
ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) // Drones are linked to the station
|
|
|
|
#undef PROXIMITY_NONE
|
|
#undef PROXIMITY_ON_SCREEN
|
|
#undef PROXIMITY_NEAR
|