mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 12:08:28 +01:00
Integrated Circuitry improvements (#18032)
* Minor circuitry improvements * remove redundant, badly worded comment * Minor circuitry logic improvements final cleanup. * Indentation fix
This commit is contained in:
@@ -72,8 +72,8 @@
|
||||
power_draw_per_use = 4
|
||||
|
||||
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
|
||||
var/new_input = tgui_input_text(user, "Enter some words, please.","Number pad", get_pin_data(IC_OUTPUT, 1),MAX_NAME_LEN)
|
||||
new_input = sanitize(new_input,MAX_NAME_LEN)
|
||||
var/new_input = tgui_input_text(user, "Enter some words, please.","Number pad", get_pin_data(IC_OUTPUT, 1),MAX_NAME_LEN, encode=FALSE)
|
||||
new_input = sanitize(new_input,MAX_KEYPAD_INPUT_LEN) // Slightly increase the size of the character limit.
|
||||
if(istext(new_input) && CanInteract(user, GLOB.tgui_physical_state))
|
||||
set_pin_data(IC_OUTPUT, 1, new_input)
|
||||
push_data()
|
||||
@@ -179,7 +179,10 @@
|
||||
relative coordinates, total amount of reagents, and maximum amount of reagents of the referenced object."
|
||||
icon_state = "video_camera"
|
||||
complexity = 6
|
||||
inputs = list("target" = IC_PINTYPE_REF)
|
||||
inputs = list(
|
||||
"target" = IC_PINTYPE_REF,
|
||||
"ignore dead" = IC_PINTYPE_BOOLEAN
|
||||
)
|
||||
outputs = list(
|
||||
"name" = IC_PINTYPE_STRING,
|
||||
"description" = IC_PINTYPE_STRING,
|
||||
@@ -188,6 +191,7 @@
|
||||
"distance" = IC_PINTYPE_NUMBER,
|
||||
"max reagents" = IC_PINTYPE_NUMBER,
|
||||
"amount of reagents" = IC_PINTYPE_NUMBER,
|
||||
"is living" = IC_PINTYPE_BOOLEAN
|
||||
)
|
||||
activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT, "not scanned" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
@@ -199,10 +203,10 @@
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(H)) //Invalid input
|
||||
return
|
||||
|
||||
if(get_pin_data(IC_INPUT, 2) == TRUE) // Ignore mob, if ignore dead is enabled.
|
||||
if(ismob(H) && H:stat == DEAD)
|
||||
return
|
||||
if(H in view(T)) // This is a camera. It can't examine thngs,that it can't see.
|
||||
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, H.name)
|
||||
set_pin_data(IC_OUTPUT, 2, H.desc)
|
||||
set_pin_data(IC_OUTPUT, 3, H.x-T.x)
|
||||
@@ -215,6 +219,7 @@
|
||||
tr = H.reagents.total_volume
|
||||
set_pin_data(IC_OUTPUT, 6, mr)
|
||||
set_pin_data(IC_OUTPUT, 7, tr)
|
||||
set_pin_data(IC_OUTPUT, 8, H:stat == DEAD ? FALSE : TRUE)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
else
|
||||
@@ -285,11 +290,15 @@
|
||||
name = "advanced locator"
|
||||
desc = "This is needed for certain devices that demand a reference for a target to act upon. This type locates something \
|
||||
that is standing in given radius of up to 7 meters"
|
||||
extended_desc = "The first pin requires a ref to a kind of object that you want the locator to acquire. This means that it will \
|
||||
extended_desc = "The first pin requires a reference, or string reference for a mob type. This means that it will \
|
||||
give refs to nearby objects that are similar to given sample. If this pin is a string, the locator will search for\
|
||||
item by matching desired text in name + description. If more than one valid object is found nearby, it will choose one of them at \
|
||||
item by matches in name / description / mobtype. If more than one valid object is found nearby, it will choose one of them at \
|
||||
random. The second pin is a radius."
|
||||
inputs = list("desired type" = IC_PINTYPE_ANY, "radius" = IC_PINTYPE_NUMBER)
|
||||
inputs = list(
|
||||
"desired type" = IC_PINTYPE_ANY,
|
||||
"radius" = IC_PINTYPE_NUMBER,
|
||||
"ignore dead" = IC_PINTYPE_BOOLEAN
|
||||
)
|
||||
outputs = list("located ref")
|
||||
activators = list("locate" = IC_PINTYPE_PULSE_IN,"found" = IC_PINTYPE_PULSE_OUT,"not found" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
@@ -315,15 +324,32 @@
|
||||
var/desired_type = A.type
|
||||
if(desired_type)
|
||||
for(var/atom/thing in nearby_things)
|
||||
var/atom/movable/M = thing
|
||||
if(ismob(M) && M:stat == DEAD && get_pin_data(IC_INPUT, 3) == TRUE) // Ignore dead mobs if requested.
|
||||
continue
|
||||
if(thing.is_incorporeal())
|
||||
continue
|
||||
if(thing.type == desired_type)
|
||||
if(istype(thing, desired_type))
|
||||
valid_things.Add(thing)
|
||||
else if(istext(I.data))
|
||||
if (length(I.data) > 2) // Ensure string is not empty.
|
||||
if (copytext(I.data, 1, 2) == "/")
|
||||
var/desired_type = text2path(I.data)
|
||||
for(var/atom/thing in nearby_things)
|
||||
var/atom/movable/M = thing
|
||||
if(ismob(M) && M:stat == DEAD && get_pin_data(IC_INPUT, 3) == TRUE) // Ignore dead mobs if requested.
|
||||
continue
|
||||
if(thing.is_incorporeal())
|
||||
continue
|
||||
if(istype(thing, desired_type))
|
||||
valid_things.Add(thing)
|
||||
var/DT = I.data
|
||||
for(var/atom/thing in nearby_things)
|
||||
if(thing.is_incorporeal())
|
||||
continue
|
||||
var/atom/movable/M = thing
|
||||
if(ismob(M) && M == DEAD && get_pin_data(IC_INPUT, 3) == TRUE) // Ignore dead mobs if requested.
|
||||
continue
|
||||
if(findtext(addtext(thing.name," ",thing.desc), DT, 1, 0) )
|
||||
valid_things.Add(thing)
|
||||
if(valid_things.len)
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/equals/do_compare(var/datum/integrated_io/A, var/datum/integrated_io/B)
|
||||
if(istext(A.data) && istext(B.data)) // Also compare strings to better match circuit description.
|
||||
return lowertext(A.data) == lowertext(B.data)
|
||||
return A.data == B.data
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/jklatch
|
||||
@@ -154,6 +156,8 @@
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/not_equals/do_compare(var/datum/integrated_io/A, var/datum/integrated_io/B)
|
||||
if(istext(A.data) && istext(B.data)) // Also compare strings to better match circuit description.
|
||||
return lowertext(A.data) != lowertext(B.data)
|
||||
return A.data != B.data
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/and
|
||||
|
||||
@@ -256,81 +256,85 @@
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 1)
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera
|
||||
name = "video camera circuit"
|
||||
desc = "This small camera allows a remote viewer to see what it sees."
|
||||
var/list/networks = list(
|
||||
"research" = NETWORK_CIRCUITS,
|
||||
"engine" = NETWORK_ENGINE,
|
||||
"engineering" = NETWORK_ENGINEERING,
|
||||
"mining" = NETWORK_MINE,
|
||||
"medical" = NETWORK_MEDICAL,
|
||||
"entertainment" = NETWORK_THUNDER,
|
||||
"security" = NETWORK_SECURITY,
|
||||
"command" = NETWORK_COMMAND
|
||||
)
|
||||
icon_state = "video_camera"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
complexity = 10
|
||||
inputs = list(
|
||||
"camera name" = IC_PINTYPE_STRING,
|
||||
"camera network" = IC_PINTYPE_STRING,
|
||||
"camera active" = IC_PINTYPE_BOOLEAN
|
||||
)
|
||||
inputs_default = list(
|
||||
"1" = "video camera circuit",
|
||||
"2" = "research"
|
||||
)
|
||||
outputs = list()
|
||||
activators = list()
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_idle = 5 // Raises to 80 when on.
|
||||
var/obj/machinery/camera/network/circuits/camera
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/Initialize(mapload)
|
||||
. = ..()
|
||||
extended_desc = list()
|
||||
extended_desc += "Network choices are; "
|
||||
extended_desc += jointext(networks, ", ")
|
||||
extended_desc += "."
|
||||
extended_desc = jointext(extended_desc, null)
|
||||
camera = new(src)
|
||||
on_data_written()
|
||||
// Temporarily removing video camera circuit due to excessive server load it can cause.
|
||||
// And being badly implemented at present. (We have handheld camera's anyway)
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/Destroy()
|
||||
QDEL_NULL(camera)
|
||||
return ..()
|
||||
// /obj/item/integrated_circuit/output/video_camera
|
||||
// name = "video camera circuit"
|
||||
// desc = "This small camera allows a remote viewer to see what it sees."
|
||||
// var/list/networks = list(
|
||||
// "research" = NETWORK_CIRCUITS,
|
||||
// "engine" = NETWORK_ENGINE,
|
||||
// "engineering" = NETWORK_ENGINEERING,
|
||||
// "mining" = NETWORK_MINE,
|
||||
// "medical" = NETWORK_MEDICAL,
|
||||
// "entertainment" = NETWORK_THUNDER,
|
||||
// "security" = NETWORK_SECURITY,
|
||||
// "command" = NETWORK_COMMAND
|
||||
// )
|
||||
// icon_state = "video_camera"
|
||||
// w_class = ITEMSIZE_SMALL
|
||||
// complexity = 10
|
||||
// inputs = list(
|
||||
// "camera name" = IC_PINTYPE_STRING,
|
||||
// "camera network" = IC_PINTYPE_STRING,
|
||||
// "camera active" = IC_PINTYPE_BOOLEAN
|
||||
// )
|
||||
// inputs_default = list(
|
||||
// "1" = "video camera circuit",
|
||||
// "2" = "research"
|
||||
// )
|
||||
// outputs = list()
|
||||
// activators = list()
|
||||
// spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
// power_draw_idle = 5 // Raises to 80 when on.
|
||||
// var/obj/machinery/camera/network/circuits/camera
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status)
|
||||
if(camera)
|
||||
camera.set_status(status)
|
||||
power_draw_idle = camera.status ? 80 : 5
|
||||
if(camera.status) // Ensure that there's actually power.
|
||||
if(!draw_idle_power())
|
||||
power_fail()
|
||||
// /obj/item/integrated_circuit/output/video_camera/Initialize(mapload)
|
||||
// . = ..()
|
||||
// extended_desc = list()
|
||||
// extended_desc += "Network choices are; "
|
||||
// extended_desc += jointext(networks, ", ")
|
||||
// extended_desc += "."
|
||||
// extended_desc = jointext(extended_desc, null)
|
||||
// camera = new(src)
|
||||
// on_data_written()
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/on_data_written()
|
||||
if(camera)
|
||||
var/cam_name = get_pin_data(IC_INPUT, 1)
|
||||
var/cam_network = get_pin_data(IC_INPUT, 2)
|
||||
var/cam_active = get_pin_data(IC_INPUT, 3)
|
||||
if(!isnull(cam_name))
|
||||
camera.c_tag = cam_name
|
||||
camera.replace_networks(list(cam_network))
|
||||
set_camera_status(cam_active)
|
||||
if(isnull(cam_network))
|
||||
camera.clear_all_networks()
|
||||
return
|
||||
var/selected_network = networks[cam_network]
|
||||
if(!selected_network)
|
||||
camera.clear_all_networks()
|
||||
return
|
||||
camera.replace_networks(list(selected_network))
|
||||
// /obj/item/integrated_circuit/output/video_camera/Destroy()
|
||||
// QDEL_NULL(camera)
|
||||
// return ..()
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/power_fail()
|
||||
if(camera)
|
||||
set_camera_status(0)
|
||||
set_pin_data(IC_INPUT, 2, FALSE)
|
||||
// /obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status)
|
||||
// if(camera)
|
||||
// camera.set_status(status)
|
||||
// power_draw_idle = camera.status ? 80 : 5
|
||||
// if(camera.status) // Ensure that there's actually power.
|
||||
// if(!draw_idle_power())
|
||||
// power_fail()
|
||||
|
||||
// /obj/item/integrated_circuit/output/video_camera/on_data_written()
|
||||
// if(camera)
|
||||
// var/cam_name = get_pin_data(IC_INPUT, 1)
|
||||
// var/cam_network = get_pin_data(IC_INPUT, 2)
|
||||
// var/cam_active = get_pin_data(IC_INPUT, 3)
|
||||
// if(!isnull(cam_name))
|
||||
// camera.c_tag = cam_name
|
||||
// camera.replace_networks(list(cam_network))
|
||||
// set_camera_status(cam_active)
|
||||
// if(isnull(cam_network))
|
||||
// camera.clear_all_networks()
|
||||
// return
|
||||
// var/selected_network = networks[cam_network]
|
||||
// if(!selected_network)
|
||||
// camera.clear_all_networks()
|
||||
// return
|
||||
// camera.replace_networks(list(selected_network))
|
||||
|
||||
// /obj/item/integrated_circuit/output/video_camera/power_fail()
|
||||
// if(camera)
|
||||
// set_camera_status(0)
|
||||
// set_pin_data(IC_INPUT, 2, FALSE)
|
||||
|
||||
/obj/item/integrated_circuit/output/led
|
||||
name = "light-emitting diode"
|
||||
|
||||
Reference in New Issue
Block a user