Even More Circuit Changes

See PR for changes.
This commit is contained in:
Neerti
2017-07-31 10:58:03 -04:00
parent 91b06c20d1
commit 36b0f5fa99
38 changed files with 1210 additions and 774 deletions

View File

@@ -3,7 +3,7 @@
/obj/item/device/electronic_assembly
name = "electronic assembly"
desc = "It's a case, for building electronics with."
desc = "It's a case, for building small electronics with."
w_class = ITEMSIZE_SMALL
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "setup_small"
@@ -17,6 +17,7 @@
/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
icon_state = "setup_medium"
desc = "It's a case, for building medium-sized electronics with."
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 2
max_complexity = IC_COMPLEXITY_BASE * 2
@@ -24,6 +25,7 @@
/obj/item/device/electronic_assembly/large
name = "electronic machine"
icon_state = "setup_large"
desc = "It's a case, for building large electronics with."
w_class = ITEMSIZE_LARGE
max_components = IC_COMPONENTS_BASE * 4
max_complexity = IC_COMPLEXITY_BASE * 4
@@ -31,6 +33,7 @@
/obj/item/device/electronic_assembly/drone
name = "electronic drone"
icon_state = "setup_drone"
desc = "It's a case, for building mobile electronics with."
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 1.5
max_complexity = IC_COMPLEXITY_BASE * 1.5
@@ -38,9 +41,10 @@
/obj/item/device/electronic_assembly/implant
name = "electronic implant"
icon_state = "setup_implant"
desc = "It's a case, for building very tiny electronics with."
w_class = ITEMSIZE_TINY
max_components = IC_COMPONENTS_BASE / 4
max_complexity = IC_COMPLEXITY_BASE / 4
max_components = IC_COMPONENTS_BASE / 2
max_complexity = IC_COMPLEXITY_BASE / 2
var/obj/item/weapon/implant/integrated_circuit/implant = null
/obj/item/device/electronic_assembly/New()

View File

@@ -1,8 +1,22 @@
/obj/item/integrated_circuit/proc/setup_io(var/list/io_list, var/io_type)
/obj/item/integrated_circuit/proc/setup_io(var/list/io_list, var/io_type, var/list/io_default_list)
var/list/io_list_copy = io_list.Copy()
io_list.Cut()
var/i = 0
for(var/io_entry in io_list_copy)
io_list.Add(new io_type(src, io_entry, io_list_copy[io_entry]))
var/default_data = null
var/io_type_override = null
// Override the default data.
if(io_default_list && io_default_list.len) // List containing special pin types that need to be added.
default_data = io_default_list["[i]"] // This is deliberately text because the index is a number in text form.
// Override the pin type.
if(io_list_copy[io_entry])
io_type_override = io_list_copy[io_entry]
if(io_type_override)
// world << "io_type_override is now [io_type_override] on [src]."
io_list.Add(new io_type_override(src, io_entry, default_data))
else
io_list.Add(new io_type(src, io_entry, default_data))
/obj/item/integrated_circuit/proc/set_pin_data(var/pin_type, var/pin_number, var/new_data)
var/datum/integrated_io/pin = get_pin_ref(pin_type, pin_number)

View File

@@ -11,10 +11,10 @@ a creative player the means to solve many problems. Circuits are held inside an
// This should be used when someone is examining while the case is opened.
/obj/item/integrated_circuit/proc/internal_examine(mob/user)
to_chat(user, "This board has [inputs.len] input pin\s, [outputs.len] output pin\s and [activators.len] activation pin\s.")
for(var/datum/integrated_io/input/I in inputs)
for(var/datum/integrated_io/I in inputs)
if(I.linked.len)
to_chat(user, "The '[I]' is connected to [I.get_linked_to_desc()].")
for(var/datum/integrated_io/output/O in outputs)
for(var/datum/integrated_io/O in outputs)
if(O.linked.len)
to_chat(user, "The '[O]' is connected to [O.get_linked_to_desc()].")
for(var/datum/integrated_io/activate/A in activators)
@@ -34,8 +34,8 @@ a creative player the means to solve many problems. Circuits are held inside an
displayed_name = name
if(!size) size = w_class
if(size == -1) size = 0
setup_io(inputs, /datum/integrated_io/input)
setup_io(outputs, /datum/integrated_io/output)
setup_io(inputs, /datum/integrated_io, inputs_default)
setup_io(outputs, /datum/integrated_io, outputs_default)
setup_io(activators, /datum/integrated_io/activate)
..()
@@ -85,8 +85,8 @@ a creative player the means to solve many problems. Circuits are held inside an
/obj/item/integrated_circuit/interact(mob/user)
if(!check_interactivity(user))
return
if(!assembly)
return
// if(!assembly)
// return
var/window_height = 350
var/window_width = 600
@@ -128,7 +128,7 @@ a creative player the means to solve many problems. Circuits are held inside an
if(1)
io = get_pin_ref(IC_INPUT, i)
if(io)
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.display_pin_type()] [io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data(io.data)]</a></b><br>"
if(io.linked.len)
for(var/datum/integrated_io/linked in io.linked)
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
@@ -139,14 +139,14 @@ a creative player the means to solve many problems. Circuits are held inside an
height = 1
if(2)
if(i == 1)
words += "[src.displayed_name]<br>([src.name])<hr>[src.desc]"
words += "[src.displayed_name]<br>[src.name != src.displayed_name ? "([src.name])":""]<hr>[src.desc]"
height = row_height
else
continue
if(3)
io = get_pin_ref(IC_OUTPUT, i)
if(io)
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.display_pin_type()] [io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data(io.data)]</a></b><br>"
if(io.linked.len)
for(var/datum/integrated_io/linked in io.linked)
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
@@ -162,7 +162,7 @@ a creative player the means to solve many problems. Circuits are held inside an
var/datum/integrated_io/io = activator
var/words = list()
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]><font color='FF0000'>[io.data?"\<PULSE IN\>":"\<PULSE OUT\>"]</font></a></b><br>"
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]><font color='FF0000'>[io.data?"\<PULSE OUT\>":"\<PULSE IN\>"]</font></a></b><br>"
if(io.linked.len)
for(var/datum/integrated_io/linked in io.linked)
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
@@ -176,10 +176,8 @@ a creative player the means to solve many problems. Circuits are held inside an
HTML += "</table>"
HTML += "</div>"
if(autopulse != -1)
HTML += "<br><font color='33CC33'>Meta Variables;</font>"
HTML += "<br><font color='33CC33'><a href='?src=\ref[src];autopulse=1'>\[Autopulse\]</a> = <b>[autopulse ? "ON" : "OFF"]</b></font>"
HTML += "<br>"
// HTML += "<br><font color='33CC33'>Meta Variables;</font>" // If more meta vars get introduced, uncomment this.
// HTML += "<br>"
HTML += "<br><font color='0000AA'>Complexity: [complexity]</font>"
if(power_draw_idle)
@@ -235,6 +233,8 @@ a creative player the means to solve many problems. Circuits are held inside an
else
var/datum/integrated_io/io = pin
io.ask_for_pin_data(usr) // The pins themselves will determine how to ask for data, and will validate the data.
/*
if(io.io_type == DATA_CHANNEL)
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number", "null")
@@ -260,6 +260,7 @@ a creative player the means to solve many problems. Circuits are held inside an
else if(io.io_type == PULSE_CHANNEL)
io.holder.check_then_do_work(ignore_power = TRUE)
to_chat(usr, "<span class='notice'>You pulse \the [io.holder]'s [io] pin.</span>")
*/
if(href_list["pin_unwire"])
@@ -313,10 +314,6 @@ a creative player the means to solve many problems. Circuits are held inside an
else
to_chat(usr, "<span class='warning'>You need a multitool/debugger set to 'ref' mode to do that.</span>")
if(href_list["autopulse"])
if(autopulse != -1)
autopulse = !autopulse
if(href_list["return"])
if(A)
update_to_assembly = 1
@@ -354,11 +351,11 @@ a creative player the means to solve many problems. Circuits are held inside an
/obj/item/integrated_circuit/proc/push_data()
for(var/datum/integrated_io/output/O in outputs)
for(var/datum/integrated_io/O in outputs)
O.push_data()
/obj/item/integrated_circuit/proc/pull_data()
for(var/datum/integrated_io/input/I in inputs)
for(var/datum/integrated_io/I in inputs)
I.push_data()
/obj/item/integrated_circuit/proc/draw_idle_power()
@@ -391,9 +388,9 @@ a creative player the means to solve many problems. Circuits are held inside an
return
/obj/item/integrated_circuit/proc/disconnect_all()
for(var/datum/integrated_io/input/I in inputs)
for(var/datum/integrated_io/I in inputs)
I.disconnect()
for(var/datum/integrated_io/output/O in outputs)
for(var/datum/integrated_io/O in outputs)
O.disconnect()
for(var/datum/integrated_io/activate/A in activators)
A.disconnect()

View File

@@ -25,10 +25,11 @@ D [1]/ ||
var/list/linked = list()
var/io_type = DATA_CHANNEL
/datum/integrated_io/New(var/newloc, var/name, var/data)
/datum/integrated_io/New(var/newloc, var/name, var/new_data)
..()
src.name = name
src.data = data
if(new_data)
src.data = new_data
holder = newloc
if(!istype(holder))
message_admins("ERROR: An integrated_io ([src.name]) spawned without a valid holder! This is a bug.")
@@ -50,17 +51,43 @@ D [1]/ ||
var/output = w.resolve()
return istype(output, as_type) ? output : null
/datum/integrated_io/proc/display_data()
if(isnull(data))
/datum/integrated_io/proc/display_data(var/input)
if(isnull(input))
return "(null)" // Empty data means nothing to show.
if(istext(data))
return "(\"[data]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'.
if(isweakref(data))
var/weakref/w = data
if(istext(input))
return "(\"[input]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'.
/*
list[](
"A",
"B",
"C"
)
*/
if(islist(input))
var/list/my_list = input
var/result = "list\[[my_list.len]\]("
if(my_list.len)
result += "<br>"
var/pos = 0
for(var/line in my_list)
result += "[display_data(line)]"
pos++
if(pos != my_list.len)
result += ",<br>"
result += "<br>"
result += ")"
return result
if(isweakref(input))
var/weakref/w = input
var/atom/A = w.resolve()
//return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
return A ? "(\ref[A] \[Ref\])" : "(null)"
return "([data])" // Nothing special needed for numbers or other stuff.
return "([input])" // Nothing special needed for numbers or other stuff.
/datum/integrated_io/activate/display_data()
return "(\[pulse\])"
@@ -117,23 +144,44 @@ D [1]/ ||
//Now that we're removed from them, we gotta remove them from us.
src.linked.Remove(their_io)
/datum/integrated_io/input
name = "input pin"
/datum/integrated_io/proc/ask_for_data_type(mob/user, var/default, var/list/allowed_data_types = list("string","number","null"))
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in allowed_data_types
if(!holder.check_interactivity(user))
return
/datum/integrated_io/output
name = "output pin"
var/new_data = null
switch(type_to_use)
if("string")
new_data = input("Now type in a string.","[src] string writing", istext(default) ? default : null) as null|text
if(istext(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
return new_data
if("number")
new_data = input("Now type in a number.","[src] number writing", isnum(default) ? default : null) as null|num
if(isnum(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
return new_data
if("null")
if(holder.check_interactivity(user))
to_chat(user, "<span class='notice'>You clear the pin's memory.</span>")
return new_data
// Basically a null check
/datum/integrated_io/proc/is_valid()
return !isnull(data)
// This proc asks for the data to write, then writes it.
/datum/integrated_io/proc/ask_for_pin_data(mob/user)
var/new_data = ask_for_data_type(user)
write_data_to_pin(new_data)
/datum/integrated_io/activate/ask_for_pin_data(mob/user) // This just pulses the pin.
holder.check_then_do_work(ignore_power = TRUE)
to_chat(user, "<span class='notice'>You pulse \the [holder]'s [src] pin.</span>")
/datum/integrated_io/activate
name = "activation pin"
io_type = PULSE_CHANNEL
/datum/integrated_io/list
name = "list pin"
/datum/integrated_io/list/write_data_to_pin(var/new_data)
if(islist(new_data))
data = new_data
holder.on_data_written()
/datum/integrated_io/list/display_pin_type()
return IC_FORMAT_LIST
/datum/integrated_io/activate/out // All this does is just make the UI say 'out' instead of 'in'
data = 1

View File

@@ -0,0 +1,25 @@
// These pins only contain 0 or 1. Null is not allowed.
/datum/integrated_io/boolean
name = "boolean pin"
data = FALSE
/datum/integrated_io/boolean/ask_for_pin_data(mob/user) // 'Ask' is a bit misleading, acts more like a toggle.
var/new_data = !data
write_data_to_pin(new_data)
/datum/integrated_io/boolean/write_data_to_pin(var/new_data)
if(new_data == FALSE || new_data == TRUE)
data = new_data
holder.on_data_written()
/datum/integrated_io/boolean/scramble()
write_data_to_pin(rand(FALSE,TRUE))
push_data()
/datum/integrated_io/boolean/display_pin_type()
return IC_FORMAT_BOOLEAN
/datum/integrated_io/boolean/display_data(var/input)
if(data == TRUE)
return "(True)"
return "(False)"

View File

@@ -0,0 +1,27 @@
// These pins can only contain a 1 character string or null.
/datum/integrated_io/char
name = "char pin"
/datum/integrated_io/char/ask_for_pin_data(mob/user)
var/new_data = input("Please type in one character.","[src] char writing") as null|text
if(holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data ? "new_data" : "NULL"] into the pin.</span>")
write_data_to_pin(new_data)
/datum/integrated_io/char/write_data_to_pin(var/new_data)
if(isnull(new_data) || istext(new_data))
if(length(new_data) > 1)
return
data = new_data
holder.on_data_written()
// This makes the text go from "A" to "%".
/datum/integrated_io/char/scramble()
if(!is_valid())
return
var/list/options = list("!","@","#","$","%","^","&","*") + alphabet_uppercase
data = pick(options)
push_data()
/datum/integrated_io/char/display_pin_type()
return IC_FORMAT_CHAR

View File

@@ -0,0 +1,51 @@
// These pins can only contain a color (in the form of #FFFFFF) or null.
/datum/integrated_io/color
name = "color pin"
/datum/integrated_io/color/ask_for_pin_data(mob/user)
var/new_data = input("Please select a color.","[src] color writing") as null|color
if(holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input a <font color='[new_data]'>new color</font> into the pin.</span>")
world << "new_data equals [new_data]."
write_data_to_pin(new_data)
/datum/integrated_io/color/write_data_to_pin(var/new_data)
// Since this is storing the color as a string hex color code, we need to make sure it's actually one.
if(isnull(new_data) || istext(new_data))
if(istext(new_data))
new_data = uppertext(new_data)
if(length(new_data) != 7) // We can hex if we want to, we can leave your strings behind
world << "Wrong length."
return // Cause your strings don't hex and if they don't hex
var/friends = copytext(new_data, 2, 8) // Well they're are no strings of mine
world << "friends equal [friends]."
// I say, we can go where we want to, a place where they will never find
var/safety_dance = 1
while(safety_dance >= 7) // And we can act like we come from out of this world.log
var/hex = copytext(friends, safety_dance, safety_dance+1)
world << "Checking [hex]."
if(!(hex in list("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")))
world << "Hex [hex] failed"
return // Leave the fake one far behind,
safety_dance++
data = new_data // And we can hex
holder.on_data_written()
world << "Done."
world << "Rip."
// This randomizes the color.
/datum/integrated_io/color/scramble()
if(!is_valid())
return
var/new_data = get_random_colour(simple = FALSE, lower = 0, upper = 255)
data = new_data
push_data()
/datum/integrated_io/color/display_pin_type()
return IC_FORMAT_COLOR
/datum/integrated_io/color/display_data(var/input)
if(!isnull(data))
return "(<font color='[data]'>[data]</font>)"
return ..()

View File

@@ -0,0 +1,33 @@
// These pins can only contain directions (1,2,4,8...) or null.
/datum/integrated_io/dir
name = "dir pin"
/datum/integrated_io/dir/ask_for_pin_data(mob/user)
var/new_data = input("Please type in a valid dir number. \
Valid dirs are;\n\
North/Fore = [NORTH],\n\
South/Aft = [SOUTH],\n\
East/Starboard = [EAST],\n\
West/Port = [WEST],\n\
Northeast = [NORTHEAST],\n\
Northwest = [NORTHWEST],\n\
Southeast = [SOUTHEAST],\n\
Southwest = [SOUTHWEST],\n\
Up = [UP],\n\
Down = [DOWN]","[src] dir writing") as null|num
if(isnum(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
write_data_to_pin(new_data)
/datum/integrated_io/dir/write_data_to_pin(var/new_data)
if(isnull(new_data) || new_data in alldirs + list(UP, DOWN))
data = new_data
holder.on_data_written()
/datum/integrated_io/dir/display_pin_type()
return IC_FORMAT_DIR
/datum/integrated_io/dir/display_data(var/input)
if(!isnull(data))
return "([dir2text(data)])"
return ..()

View File

@@ -0,0 +1,150 @@
// These pins contain a list. Null is not allowed.
/datum/integrated_io/list
name = "list pin"
data = list()
/datum/integrated_io/list/ask_for_pin_data(mob/user)
interact(user)
/datum/integrated_io/list/proc/interact(mob/user)
var/list/my_list = data
var/t = "<h2>[src]</h2><br>"
t += "List length: [my_list.len]<br>"
t += "<a href='?src=\ref[src]'>\[Refresh\]</a> | "
t += "<a href='?src=\ref[src];add=1'>\[Add\]</a> | "
t += "<a href='?src=\ref[src];swap=1'>\[Swap\]</a> | "
t += "<a href='?src=\ref[src];clear=1'>\[Clear\]</a><br>"
t += "<hr>"
var/i = 0
for(var/line in my_list)
i++
t += "#[i] | [display_data(line)] | "
t += "<a href='?src=\ref[src];edit=1;pos=[i]'>\[Edit\]</a> | "
t += "<a href='?src=\ref[src];remove=1;pos=[i]'>\[Remove\]</a><br>"
user << browse(t, "window=list_pin_\ref[src];size=500x400")
/datum/integrated_io/list/proc/add_to_list(mob/user, var/new_entry)
if(!new_entry && user)
new_entry = ask_for_data_type(user)
if(is_valid(new_entry))
Add(new_entry)
/datum/integrated_io/list/proc/Add(var/new_entry)
var/list/my_list = data
if(my_list.len > IC_MAX_LIST_LENGTH)
my_list.Cut(Start=1,End=2)
my_list.Add(new_entry)
/datum/integrated_io/list/proc/remove_from_list_by_position(mob/user, var/position)
var/list/my_list = data
if(!my_list.len)
to_chat(user, "<span class='warning'>The list is empty, there's nothing to remove.</span>")
return
if(!position)
return
var/target_entry = my_list.Find(position)
if(target_entry)
my_list.Remove(target_entry)
/datum/integrated_io/list/proc/remove_from_list(mob/user, var/target_entry)
var/list/my_list = data
if(!my_list.len)
to_chat(user, "<span class='warning'>The list is empty, there's nothing to remove.</span>")
return
if(!target_entry)
target_entry = input("Which piece of data do you want to remove?", "Remove") as null|anything in my_list
if(target_entry)
my_list.Remove(target_entry)
/datum/integrated_io/list/proc/edit_in_list(mob/user, var/target_entry)
var/list/my_list = data
if(!my_list.len)
to_chat(user, "<span class='warning'>The list is empty, there's nothing to modify.</span>")
return
if(!target_entry)
target_entry = input("Which piece of data do you want to edit?", "Edit") as null|anything in my_list
if(target_entry)
var/edited_entry = ask_for_data_type(user, target_entry)
if(edited_entry)
target_entry = edited_entry
/datum/integrated_io/list/proc/edit_in_list_by_position(mob/user, var/position)
var/list/my_list = data
if(!my_list.len)
to_chat(user, "<span class='warning'>The list is empty, there's nothing to modify.</span>")
return
if(!position)
return
var/target_entry = my_list.Find(position)
if(target_entry)
var/edited_entry = ask_for_data_type(user, target_entry)
if(edited_entry)
target_entry = edited_entry
/datum/integrated_io/list/proc/swap_inside_list(mob/user, var/first_target, var/second_target)
var/list/my_list = data
if(my_list.len <= 1)
to_chat(user, "<span class='warning'>The list is empty, or too small to do any meaningful swapping.</span>")
return
if(!first_target)
first_target = input("Which piece of data do you want to swap? (1)", "Swap") as null|anything in my_list
if(first_target)
if(!second_target)
second_target = input("Which piece of data do you want to swap? (2)", "Swap") as null|anything in my_list - first_target
if(second_target)
var/first_pos = my_list.Find(first_target)
var/second_pos = my_list.Find(second_target)
my_list.Swap(first_pos, second_pos)
/datum/integrated_io/list/proc/clear_list(mob/user)
var/list/my_list = data
my_list.Cut()
/datum/integrated_io/list/scramble()
var/list/my_list = data
my_list = shuffle(my_list)
push_data()
/datum/integrated_io/list/write_data_to_pin(var/new_data)
if(islist(new_data))
var/list/new_list = new_data
data = new_list.Copy()
holder.on_data_written()
/datum/integrated_io/list/display_pin_type()
return IC_FORMAT_LIST
/datum/integrated_io/list/Topic(href, href_list, state = interactive_state)
if(!holder.check_interactivity(usr))
return
if(..())
return 1
if(href_list["add"])
add_to_list(usr)
if(href_list["swap"])
swap_inside_list(usr)
if(href_list["clear"])
clear_list(usr)
if(href_list["remove"])
world << "Removing [href_list["pos"]]"
if(href_list["pos"])
remove_from_list_by_position(usr, text2num(href_list["pos"]))
else
remove_from_list(usr)
if(href_list["edit"])
if(href_list["pos"])
edit_in_list_by_position(usr, text2num(href_list["pos"]))
else
edit_in_list(usr)
holder.interact(usr) // Refresh the main UI,
interact(usr) // and the list UI.

View File

@@ -0,0 +1,18 @@
// These pins can only contain numbers (int and floating point) or null.
/datum/integrated_io/number
name = "number pin"
// data = 0
/datum/integrated_io/number/ask_for_pin_data(mob/user)
var/new_data = input("Please type in a number.","[src] number writing") as null|num
if(isnum(new_data) && holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data] into the pin.</span>")
write_data_to_pin(new_data)
/datum/integrated_io/number/write_data_to_pin(var/new_data)
if(isnull(new_data) || isnum(new_data))
data = new_data
holder.on_data_written()
/datum/integrated_io/number/display_pin_type()
return IC_FORMAT_NUMBER

View File

@@ -0,0 +1,14 @@
// These pins only contain weakrefs or null.
/datum/integrated_io/ref
name = "ref pin"
/datum/integrated_io/ref/ask_for_pin_data(mob/user) // This clears the pin.
write_data_to_pin(null)
/datum/integrated_io/ref/write_data_to_pin(var/new_data)
if(isnull(new_data) || isweakref(new_data))
data = new_data
holder.on_data_written()
/datum/integrated_io/ref/display_pin_type()
return IC_FORMAT_REF

View File

@@ -0,0 +1,29 @@
// These pins can only contain text and null.
/datum/integrated_io/string
name = "string pin"
/datum/integrated_io/string/ask_for_pin_data(mob/user)
var/new_data = input("Please type in a string.","[src] string writing") as null|text
if(holder.check_interactivity(user) )
to_chat(user, "<span class='notice'>You input [new_data ? "new_data" : "NULL"] into the pin.</span>")
write_data_to_pin(new_data)
/datum/integrated_io/string/write_data_to_pin(var/new_data)
if(isnull(new_data) || istext(new_data))
data = new_data
holder.on_data_written()
// This makes the text go "from this" to "#G&*!HD$%L"
/datum/integrated_io/string/scramble()
if(!is_valid())
return
var/string_length = length(data)
var/list/options = list("!","@","#","$","%","^","&","*") + alphabet_uppercase
var/new_data = ""
while(string_length)
new_data += pick(options)
string_length--
push_data()
/datum/integrated_io/string/display_pin_type()
return IC_FORMAT_STRING