Merge pull request #3272 from LorenLuke/PDA-ID

Can remove ID from PDA via Alt-Clicking now.
This commit is contained in:
Anewbe
2017-04-14 17:51:42 -05:00
committed by GitHub
2 changed files with 92 additions and 45 deletions
+56 -45
View File
@@ -66,7 +66,19 @@ var/global/list/obj/item/device/pda/PDAs = list()
/obj/item/device/pda/examine(mob/user)
if(..(user, 1))
user << "The time [stationtime2text()] is displayed in the corner of the screen."
to_chat(user, "The time [stationtime2text()] is displayed in the corner of the screen.")
/obj/item/device/pda/AltClick()
if(issilicon(usr))
return
if ( can_use(usr) )
if(id)
remove_id()
else
to_chat(usr, "<span class='notice'>This PDA does not have an ID in it.</span>")
/obj/item/device/pda/medical
default_cartridge = /obj/item/weapon/cartridge/medical
@@ -247,7 +259,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
set name = "Send Message"
set src in usr
if(usr.stat == 2)
usr << "You can't send PDA messages because you are dead!"
to_chat(usr, "You can't send PDA messages because you are dead!")
return
var/list/plist = available_pdas()
if (plist)
@@ -262,28 +274,27 @@ var/global/list/obj/item/device/pda/PDAs = list()
set name = "Toggle Sender/Receiver"
set src in usr
if(usr.stat == 2)
usr << "You can't do that because you are dead!"
to_chat(usr, "You can't send PDA messages because you are dead!")
return
toff = !toff
usr << "<span class='notice'>PDA sender/receiver toggled [(toff ? "Off" : "On")]!</span>"
to_chat(usr, "<span class='notice'>PDA sender/receiver toggled [(toff ? "Off" : "On")]!</span>")
/obj/item/device/pda/ai/verb/cmd_toggle_pda_silent()
set category = "AI IM"
set name = "Toggle Ringer"
set src in usr
if(usr.stat == 2)
usr << "You can't do that because you are dead!"
to_chat(usr, "You can't send PDA messages because you are dead!")
return
message_silent=!message_silent
usr << "<span class='notice'>PDA ringer toggled [(message_silent ? "Off" : "On")]!</span>"
to_chat(usr, "<span class='notice'>PDA ringer toggled [(message_silent ? "Off" : "On")]!</span>")
/obj/item/device/pda/ai/verb/cmd_show_message_log()
set category = "AI IM"
set name = "Show Message Log"
set src in usr
if(usr.stat == 2)
usr << "You can't do that because you are dead!"
to_chat(usr, "You can't send PDA messages because you are dead!")
return
var/HTML = "<html><head><title>AI PDA Message Log</title></head><body>"
for(var/index in tnote)
@@ -809,7 +820,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (in_range(src, U) && loc == U)
if (t)
if(src.hidden_uplink && hidden_uplink.check_trigger(U, lowertext(t), lowertext(lock_code)))
U << "The PDA softly beeps."
to_chat(U, "The PDA softly beeps.")
ui.close()
else
t = sanitize(t, 20)
@@ -856,7 +867,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
U.show_message("<span class='notice'>Virus sent!</span>", 1)
P.honkamt = (rand(15,20))
else
U << "PDA not found."
to_chat(U, "PDA not found.")
else
ui.close()
return 0
@@ -872,7 +883,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
P.ttone = "silence"
P.newstone = "silence"
else
U << "PDA not found."
to_chat(U, "PDA not found.")
else
ui.close()
return 0
@@ -928,9 +939,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
message_admins("[key_name_admin(U)] just attempted to blow up [P] with the Detomatix cartridge and succeeded.", 1)
detonate_act(P)
else
U << "No charges left."
to_chat(U, "No charges left.")
else
U << "PDA not found."
to_chat(U, "PDA not found.")
else
U.unset_machine()
ui.close()
@@ -1048,7 +1060,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (ismob(loc))
var/mob/M = loc
M.put_in_hands(id)
usr << "<span class='notice'>You remove the ID from the [name].</span>"
to_chat(usr, "<span class='notice'>You remove the ID from the [name].</span>")
else
id.loc = get_turf(src)
id = null
@@ -1080,11 +1092,11 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(reception.message_server && (reception.telecomms_reception & TELECOMMS_RECEPTION_SENDER)) // only send the message if it's stable
if(reception.telecomms_reception & TELECOMMS_RECEPTION_RECEIVER == 0) // Does our recipient have a broadcaster on their level?
U << "ERROR: Cannot reach recipient."
to_chat(U, "ERROR: Cannot reach recipient.")
return
var/send_result = reception.message_server.send_pda_message("[P.owner]","[owner]","[t]")
if (send_result)
U << "ERROR: Messaging server rejected your message. Reason: contains '[send_result]'."
to_chat(U, "ERROR: Messaging server rejected your message. Reason: contains '[send_result]'.")
return
tnote.Add(list(list("sent" = 1, "owner" = "[P.owner]", "job" = "[P.ownjob]", "message" = "[t]", "target" = "\ref[P]")))
@@ -1113,7 +1125,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
P.new_message_from_pda(src, t)
nanomanager.update_user_uis(U, src) // Update the sending user's PDA UI so that they can see the new message
else
U << "<span class='notice'>ERROR: Messaging server is not responding.</span>"
to_chat(U, "<span class='notice'>ERROR: Messaging server is not responding.</span>")
/obj/item/device/pda/proc/new_info(var/beep_silent, var/message_tone, var/reception_message)
if (!beep_silent)
@@ -1176,9 +1188,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(can_use(usr))
mode = 0
nanomanager.update_uis(src)
usr << "<span class='notice'>You press the reset button on \the [src].</span>"
to_chat(usr, "<span class='notice'>You press the reset button on \the [src].</span>")
else
usr << "<span class='notice'>You cannot do this while restrained.</span>"
to_chat(usr, "<span class='notice'>You cannot do this while restrained.</span>")
/obj/item/device/pda/verb/verb_remove_id()
set category = "Object"
@@ -1192,9 +1204,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(id)
remove_id()
else
usr << "<span class='notice'>This PDA does not have an ID in it.</span>"
to_chat(usr, "<span class='notice'>This PDA does not have an ID in it.</span>")
else
usr << "<span class='notice'>You cannot do this while restrained.</span>"
to_chat(usr, "<span class='notice'>You cannot do this while restrained.</span>")
/obj/item/device/pda/verb/verb_remove_pen()
@@ -1212,13 +1224,13 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/mob/M = loc
if(M.get_active_hand() == null)
M.put_in_hands(O)
usr << "<span class='notice'>You remove \the [O] from \the [src].</span>"
to_chat(usr, "<span class='notice'>You remove \the [O] from \the [src].</span>")
return
O.loc = get_turf(src)
else
usr << "<span class='notice'>This PDA does not have a pen in it.</span>"
to_chat(usr, "<span class='notice'>This PDA does not have a pen in it.</span>")
else
usr << "<span class='notice'>You cannot do this while restrained.</span>"
to_chat(usr, "<span class='notice'>You cannot do this while restrained.</span>")
/obj/item/device/pda/verb/verb_remove_cartridge()
set category = "Object"
@@ -1241,9 +1253,9 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (cartridge.radio)
cartridge.radio.hostpda = null
cartridge = null
usr << "<span class='notice'>You remove \the [cartridge] from the [name].</span>"
to_chat(usr, "<span class='notice'>You remove \the [cartridge] from the [name].</span>")
else
usr << "<span class='notice'>You cannot do this while restrained.</span>"
to_chat(usr, "<span class='notice'>You cannot do this while restrained.</span>")
/obj/item/device/pda/proc/id_check(mob/user as mob, choice as num)//To check for IDs; 1 for in-pda use, 2 for out of pda use.
if(choice == 1)
@@ -1273,7 +1285,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
cartridge = C
user.drop_item()
cartridge.loc = src
user << "<span class='notice'>You insert [cartridge] into [src].</span>"
to_chat(usr, "<span class='notice'>You insert [cartridge] into [src].</span>")
nanomanager.update_uis(src) // update all UIs attached to src
if(cartridge.radio)
cartridge.radio.hostpda = src
@@ -1281,19 +1293,19 @@ var/global/list/obj/item/device/pda/PDAs = list()
else if(istype(C, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/idcard = C
if(!idcard.registered_name)
user << "<span class='notice'>\The [src] rejects the ID.</span>"
to_chat(user, "<span class='notice'>\The [src] rejects the ID.</span>")
return
if(!owner)
owner = idcard.registered_name
ownjob = idcard.assignment
ownrank = idcard.rank
name = "PDA-[owner] ([ownjob])"
user << "<span class='notice'>Card scanned.</span>"
to_chat(user, "<span class='notice'>Card scanned.</span>")
else
//Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand.
if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
if(id_check(user, 2))
user << "<span class='notice'>You put the ID into \the [src]'s slot.</span>"
to_chat(user, "<span class='notice'>You put the ID into \the [src]'s slot.</span>")
updateSelfDialog()//Update self dialog on success.
return //Return in case of failed check or when successful.
updateSelfDialog()//For the non-input related code.
@@ -1301,16 +1313,16 @@ var/global/list/obj/item/device/pda/PDAs = list()
user.drop_item()
C.loc = src
pai = C
user << "<span class='notice'>You slot \the [C] into [src].</span>"
to_chat(user, "<span class='notice'>You slot \the [C] into \the [src].</span>")
nanomanager.update_uis(src) // update all UIs attached to src
else if(istype(C, /obj/item/weapon/pen))
var/obj/item/weapon/pen/O = locate() in src
if(O)
user << "<span class='notice'>There is already a pen in \the [src].</span>"
to_chat(user, "<span class='notice'>There is already a pen in \the [src].</span>")
else
user.drop_item()
C.loc = src
user << "<span class='notice'>You slide \the [C] into \the [src].</span>"
to_chat(user, "<span class='notice'>You slot \the [C] into \the [src].</span>")
return
/obj/item/device/pda/attack(mob/living/C as mob, mob/living/user as mob)
@@ -1346,18 +1358,18 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(2)
if (!istype(C:dna, /datum/dna))
user << "<span class='notice'>No fingerprints found on [C]</span>"
to_chat(user, "<span class='notice'>No fingerprints found on [C]</span>")
else
user << text("<span class='notice'>\The [C]'s Fingerprints: [md5(C:dna.uni_identity)]</span>")
to_chat(user, text("<span class='notice'>\The [C]'s Fingerprints: [md5(C:dna.uni_identity)]</span>"))
if ( !(C:blood_DNA) )
user << "<span class='notice'>No blood found on [C]</span>"
to_chat(user, "<span class='notice'>No blood found on [C]</span>")
if(C:blood_DNA)
qdel(C:blood_DNA)
else
user << "<span class='notice'>Blood found on [C]. Analysing...</span>"
to_chat(user, "<span class='notice'>Blood found on [C]. Analysing...</span>")
spawn(15)
for(var/blood in C:blood_DNA)
user << "<span class='notice'>Blood type: [C:blood_DNA[blood]]\nDNA: [blood]</span>"
to_chat(user, "<span class='notice'>Blood type: [C:blood_DNA[blood]]\nDNA: [blood]</span>")
if(4)
for (var/mob/O in viewers(C, null))
@@ -1379,13 +1391,13 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(!isnull(A.reagents))
if(A.reagents.reagent_list.len > 0)
var/reagents_length = A.reagents.reagent_list.len
user << "<span class='notice'>[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.</span>"
to_chat(user, "<span class='notice'>[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.</span>")
for (var/re in A.reagents.reagent_list)
user << "<span class='notice'> [re]</span>"
to_chat(user,"<span class='notice'> [re]</span>")
else
user << "<span class='notice'>No active chemical agents found in [A].</span>"
to_chat(user,"<span class='notice'>No active chemical agents found in [A].</span>")
else
user << "<span class='notice'>No significant chemical agents found in [A].</span>"
to_chat(user,"<span class='notice'>No significantchemical agents found in [A].</span>")
if(5)
analyze_gases(A, user)
@@ -1437,8 +1449,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
// feature to the PDA, which would better convey the availability of the feature, but this will work for now.
// Inform the user
user << "<span class='notice'>Paper scanned and OCRed to notekeeper.</span>" //concept of scanning paper copyright brainoblivion 2009
to_chat(user,"<span class='notice'>Paper scanned and OCRed to notekeeper.</span>") //concept of scanning paper copyright brainoblivion 2009
/obj/item/device/pda/proc/explode() //This needs tuning. //Sure did.
@@ -1469,7 +1480,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
var/list/namecounts = list()
if (toff)
usr << "Turn on your receiver in order to send messages."
to_chat(usr, "Turn on your receiver in order to send messages.")
return
for (var/obj/item/device/pda/P in PDAs)