More Additions

You can now cancel inputting on a text or numberpad.
Zero is now displayed properly on the UI and not be shown as null.
The small and medium assemblies now have real sprites.
Total health percentage for med scanners and advanced med scanners now reports a proper percentage and not 1 or 0.
The constant memory chip now can be set by using it in hand, making it usable.
The constant memory chip now accepts refs as data to store.  To use, select 'ref' when using inhand, then hit it against the thing you want to store.
This commit is contained in:
Neerti
2016-09-15 08:23:22 -04:00
parent 38c5431702
commit 5412d7e113
5 changed files with 39 additions and 15 deletions
@@ -277,7 +277,7 @@
..()
/datum/integrated_io/proc/display_data()
if(!data)
if(isnull(data))
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'.
@@ -3,19 +3,21 @@
desc = "It's a case, for building electronics with."
w_class = 2
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "setup"
icon_state = "setup_small"
var/max_components = 10
var/max_complexity = 30
var/opened = 0
/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
icon_state = "setup_medium"
w_class = 3
max_components = 20
max_complexity = 50
/obj/item/device/electronic_assembly/large
name = "electronic machine"
icon_state = "setup"
w_class = 4
max_components = 30
max_complexity = 60
@@ -35,6 +37,12 @@
IC.work()
*/
/obj/item/device/electronic_assembly/update_icon()
if(opened)
icon_state = initial(icon_state) + "-open"
else
icon_state = initial(icon_state)
/obj/item/device/electronic_assembly/examine(mob/user)
..()
if(user.Adjacent(src))
@@ -87,6 +95,7 @@
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
opened = !opened
user << "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>"
update_icon()
if(istype(I, /obj/item/device/integrated_electronics/wirer))
if(opened)
var/obj/item/integrated_circuit/IC = input(user, "Which circuit do you want to examine?", "Examination") as null|anything in contents
@@ -41,7 +41,7 @@
)
/obj/item/integrated_circuit/input/numberpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter a number, please.","Number pad") as num
var/new_input = input(user, "Enter a number, please.","Number pad") as null|num
if(isnum(new_input))
var/datum/integrated_io/O = outputs[1]
O.data = new_input
@@ -67,7 +67,7 @@
)
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter some words, please.","Number pad") as text
var/new_input = input(user, "Enter some words, please.","Number pad") as null|text
if(new_input && istext(new_input))
var/datum/integrated_io/O = outputs[1]
O.data = new_input
@@ -101,7 +101,7 @@
return
var/mob/living/carbon/human/H = I.data
if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range.
var/total_health = round(H.health/H.maxHealth)*100
var/total_health = round(H.health/H.maxHealth, 0.1)*100
var/missing_health = H.maxHealth - H.health
var/datum/integrated_io/total = outputs[1]
@@ -144,7 +144,7 @@
return
var/mob/living/carbon/human/H = I.data
if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range.
var/total_health = round(H.health/H.maxHealth)*100
var/total_health = round(H.health/H.maxHealth, 0.1)*100
var/missing_health = H.maxHealth - H.health
var/datum/integrated_io/total = outputs[1]
+24 -9
View File
@@ -58,26 +58,41 @@
number_of_outputs = 1
number_of_activators = 1
activator_names = list(
"trigger output"
"push data"
)
var/accepting_refs = 0
/obj/item/integrated_circuit/memory/constant/work()
if(..())
var/datum/integrated_io/O = outputs[1]
O.push_data()
/obj/item/integrated_circuit/memory/constant/attack_hand(mob/user)
var/datum/integrated_io/O = outputs[1]
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number")
O.push_data()
/obj/item/integrated_circuit/memory/constant/attack_self(mob/user)
var/datum/integrated_io/O = outputs[1]
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref")
var/new_data = null
switch(type_to_use)
if("string")
accepting_refs = 0
new_data = input("Now type in a string.","[src] string writing") as null|text
if(istext(new_data))
O.data = new_data
user << "<span class='notice'>You set \the [src]'s memory to '[new_data]'.</span>"
user << "<span class='notice'>You set \the [src]'s memory to [O.display_data()].</span>"
if("number")
accepting_refs = 0
new_data = input("Now type in a number.","[src] number writing") as null|num
if(isnum(new_data))
O.data = new_data
user << "<span class='notice'>You set \the [src]'s memory to '[new_data]'.</span>"
user << "<span class='notice'>You set \the [src]'s memory to [O.display_data()].</span>"
if("ref")
accepting_refs = 1
user << "<span class='notice'>You turn \the [src]'s ref scanner on. Slide it across \
an object for a ref of that object to save it in memory.</span>"
/obj/item/integrated_circuit/memory/constant/afterattack(atom/target, mob/living/user, proximity)
if(accepting_refs && proximity)
var/datum/integrated_io/O = outputs[1]
O.data = target
visible_message("<span class='notice'>[user] slides \a [src]'s over \the [target].</span>")
user << "<span class='notice'>You set \the [src]'s memory to a reference to [O.display_data()]. The ref scanner is \
now off.</span>"
accepting_refs = 0