Merge pull request #38456 from theo2003/circuit_scan

Players who edited a circuit assembly can scan it as a ghost.
This commit is contained in:
Jordan Brown
2018-06-15 15:03:48 -04:00
committed by letterjay
parent 4780f3a20b
commit 3bee10c653
2 changed files with 26 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
flags_1 = NOBLUDGEON_1
materials = list() // To be filled later
var/list/assembly_components = list()
var/list/ckeys_allowed_to_scan = list() // Players who built the circuit can scan it as a ghost.
var/max_components = IC_MAX_SIZE_BASE
var/max_complexity = IC_COMPLEXITY_BASE
var/opened = TRUE
@@ -62,6 +63,9 @@
else
to_chat(user, "<span class='notice'>The maintainence panel [opened ? "can be" : "is"] <b>screwed</b> in place.</span>")
if(isobserver(user) && ckeys_allowed_to_scan[user.ckey])
to_chat(user, "You can <a href='?src=[REF(src)];ghostscan=1'>scan</a> this circuit.");
/obj/item/electronic_assembly/proc/check_interactivity(mob/user)
return user.canUseTopic(src, BE_CLOSE)
@@ -181,6 +185,15 @@
if(..())
return 1
if(href_list["ghostscan"])
if(isobserver(usr) && ckeys_allowed_to_scan[usr.ckey])
if(assembly_components.len)
var/saved = "On circuit printers with cloning enabled, you may use the code below to clone the circuit:<br><br><code>[SScircuit.save_electronic_assembly(src)]</code>"
usr << browse(saved, "window=circuit_scan;size=500x600;border=1;can_resize=1;can_close=1;can_minimize=1")
else
to_chat(usr, "<span class='warning'>The circuit is empty!</span>")
return
if(href_list["rename"])
rename(usr)
@@ -201,6 +214,8 @@
if(!component.removable)
return
add_allowed_scanner(usr.ckey)
var/current_pos = assembly_components.Find(component)
// Find the position of a first removable component
@@ -264,6 +279,9 @@
to_chat(M, "<span class='notice'>The machine now has a label reading '[input]'.</span>")
name = input
/obj/item/electronic_assembly/proc/add_allowed_scanner(ckey)
ckeys_allowed_to_scan[ckey] = TRUE
/obj/item/electronic_assembly/proc/can_move()
return FALSE
@@ -329,6 +347,7 @@
to_chat(user, "<span class='notice'>You slide [IC] inside [src].</span>")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
add_allowed_scanner(user.ckey)
add_component(IC)
return TRUE
@@ -367,6 +386,7 @@
to_chat(user, "<span class='notice'>You pop \the [IC] out of the case, and slide it out.</span>")
playsound(src, 'sound/items/crowbar.ogg', 50, 1)
user.put_in_hands(IC)
add_allowed_scanner(user.ckey)
return TRUE

View File

@@ -247,11 +247,14 @@ a creative player the means to solve many problems. Circuits are held inside an
if(href_list["rename"])
rename_component(usr)
if(assembly)
assembly.add_allowed_scanner(usr.ckey)
if(href_list["pin"])
var/datum/integrated_io/pin = locate(href_list["pin"]) in inputs + outputs + activators
if(pin)
var/datum/integrated_io/linked
var/success = TRUE
if(href_list["link"])
linked = locate(href_list["link"]) in pin.linked
@@ -259,6 +262,9 @@ a creative player the means to solve many problems. Circuits are held inside an
pin.handle_wire(linked, held_item, href_list["act"], usr)
else
to_chat(usr, "<span class='warning'>You can't do a whole lot without the proper tools.</span>")
success = FALSE
if(success && assembly)
assembly.add_allowed_scanner(usr.ckey)
if(href_list["scan"])
if(istype(held_item, /obj/item/integrated_electronics/debugger))