Circuit logging and etc (#39582)

* need to merge before I conflict

* more logging, and etc.

* fix some mess

* forgot the switch statement
This commit is contained in:
Garen Crownguard
2018-08-19 08:51:10 -05:00
committed by yogstation13-bot
parent 4abf575bdd
commit f1c42d1644
4 changed files with 44 additions and 41 deletions

View File

@@ -75,7 +75,13 @@
to_chat(user, "<span class='notice'>The maintenance panel [opened ? "can be" : "is"] <b>screwed</b> in place.</span>")
if((isobserver(user) && ckeys_allowed_to_scan[user.ckey]) || IsAdminGhost(user))
to_chat(user, "You can <a href='?src=[REF(src)];ghostscan=1'>scan</a> this circuit.");
to_chat(user, "You can <a href='?src=[REF(src)];ghostscan=1'>scan</a> this circuit.")
for(var/I in assembly_components)
var/obj/item/integrated_circuit/IC = I
IC.external_examine(user)
if(opened)
interact(user)
/obj/item/electronic_assembly/proc/check_interactivity(mob/user)
return user.canUseTopic(src, BE_CLOSE)
@@ -311,14 +317,6 @@
detail_overlay.color = detail_color
add_overlay(detail_overlay)
/obj/item/electronic_assembly/examine(mob/user)
..()
for(var/I in assembly_components)
var/obj/item/integrated_circuit/IC = I
IC.external_examine(user)
if(opened)
interact(user)
/obj/item/electronic_assembly/proc/return_total_complexity()
. = 0
var/obj/item/integrated_circuit/part

View File

@@ -20,7 +20,7 @@
var/passkey = strtohex(XorEncrypt(json_encode(access), SScircuit.cipherkey))
if(assembly)
assembly.access_card.access = access
assembly.access_card.access |= access
if(card) // An ID card.
set_pin_data(IC_OUTPUT, 1, card.registered_name)

View File

@@ -129,6 +129,7 @@
//Shooting Code:
A.preparePixelProjectile(target, src)
A.fire()
log_attack("[assembly] [REF(assembly)] has fired [installed_gun].")
return A
/obj/item/integrated_circuit/manipulation/locomotion
@@ -350,7 +351,7 @@
name = "grabber"
desc = "A circuit with its own inventory for items. Used to grab and store things."
icon_state = "grabber"
extended_desc = "This circuit accepts a reference to an object to be grabbed, and can store up to 10 objects. Modes: 1 to grab, 0 to eject the first object, and -1 to eject all objects. If you throw something from a grabber's inventory with a thrower, the grabber will update its outputs accordingly."
extended_desc = "This circuit accepts a reference to an object to be grabbed, and can store up to 10 objects. Modes: 1 to grab, 0 to eject the first object, -1 to eject all objects, and -2 to eject the target. If you throw something from a grabber's inventory with a thrower, the grabber will update its outputs accordingly."
w_class = WEIGHT_CLASS_SMALL
size = 3
cooldown_per_use = 5
@@ -364,33 +365,42 @@
var/max_items = 10
/obj/item/integrated_circuit/manipulation/grabber/do_work()
var/max_w_class = assembly.w_class
var/atom/movable/acting_object = get_object()
var/turf/T = get_turf(acting_object)
var/obj/item/AM = get_pin_data_as_type(IC_INPUT, 1, /obj/item)
if(!QDELETED(AM) && !istype(AM, /obj/item/electronic_assembly) && !istype(AM, /obj/item/transfer_valve) && !istype(AM, /obj/item/twohanded) && !istype(assembly.loc, /obj/item/implant/storage))
var/mode = get_pin_data(IC_INPUT, 2)
if(mode == 1)
if(check_target(AM))
var/weightcheck = FALSE
if (AM.w_class <= max_w_class)
weightcheck = TRUE
else
weightcheck = FALSE
if((contents.len < max_items) && (weightcheck))
AM.forceMove(src)
if(mode == 0)
if(contents.len)
var/obj/item/U = contents[1]
U.forceMove(T)
if(mode == -1)
if(contents.len)
var/obj/item/U
for(U in contents)
U.forceMove(T)
switch(mode)
if(1)
grab(AM)
if(0)
if(contents.len)
drop(contents[1])
if(-1)
drop_all()
if(-2)
drop(AM)
update_outputs()
activate_pin(2)
/obj/item/integrated_circuit/manipulation/grabber/proc/grab(obj/item/AM)
var/max_w_class = assembly.w_class
if(check_target(AM))
if(contents.len < max_items && AM.w_class <= max_w_class)
var/atom/A = get_object()
A.investigate_log("picked up ([AM]) with [src].", INVESTIGATE_CIRCUIT)
AM.forceMove(src)
/obj/item/integrated_circuit/manipulation/grabber/proc/drop(obj/item/AM, turf/T = drop_location())
var/atom/A = get_object()
A.investigate_log("dropped ([AM]) from [src].", INVESTIGATE_CIRCUIT)
AM.forceMove(T)
/obj/item/integrated_circuit/manipulation/grabber/proc/drop_all()
if(contents.len)
var/turf/T = drop_location()
var/obj/item/U
for(U in src)
drop(U, T)
/obj/item/integrated_circuit/manipulation/grabber/proc/update_outputs()
if(contents.len)
set_pin_data(IC_OUTPUT, 1, WEAKREF(contents[1]))
@@ -403,11 +413,7 @@
push_data()
/obj/item/integrated_circuit/manipulation/grabber/attack_self(var/mob/user)
if(contents.len)
var/turf/T = get_turf(src)
var/obj/item/U
for(U in contents)
U.forceMove(T)
drop_all()
update_outputs()
push_data()
@@ -437,6 +443,7 @@
mode = CLAMP(mode, GRAB_PASSIVE, max_grab)
if(AM)
if(check_target(AM, exclude_contents = TRUE))
acting_object.investigate_log("grabbed ([AM]) using [src].", INVESTIGATE_CIRCUIT)
acting_object.start_pulling(AM,mode)
if(acting_object.pulling)
set_pin_data(IC_OUTPUT, 1, TRUE)

View File

@@ -126,10 +126,8 @@
return
vol = CLAMP(vol ,0 , 100)
playsound(get_turf(src), selected_sound, vol, freq, -1)
if(assembly)
assembly.investigate_log("played a sound ([selected_sound]) with [type].", INVESTIGATE_CIRCUIT)
else
investigate_log("played a sound ([selected_sound]) as [type].", INVESTIGATE_CIRCUIT)
var/atom/A = get_object()
A.investigate_log("played a sound ([selected_sound]) as [type].", INVESTIGATE_CIRCUIT)
/obj/item/integrated_circuit/output/sound/on_data_written()
power_draw_per_use = get_pin_data(IC_INPUT, 2) * 15