/obj/item/device/paicard
name = "personal AI device"
icon = 'icons/obj/pda.dmi'
icon_state = "pai"
item_state = "electronic"
w_class = 2.0
flags = FPRINT | TABLEPASS
slot_flags = SLOT_BELT
origin_tech = "programming=2"
var/obj/item/device/radio/radio
var/looking_for_personality = 0
var/mob/living/silicon/pai/pai
/*/obj/item/device/paicard/relaymove(var/mob/user, var/direction)
if(src.loc && istype(src.loc.loc, /obj/item/rig_module))
var/obj/item/rig_module/module = src.loc.loc
if(!module.holder || !direction)
return
module.holder.forced_move(direction)*/
/obj/item/device/paicard/New()
..()
overlays += "pai-off"
/obj/item/device/paicard/Del()
//Will stop people throwing friend pAIs into the singularity so they can respawn
if(!isnull(pai))
pai.death(0)
..()
/obj/item/device/paicard/attack_self(mob/user)
if (!in_range(src, user))
return
user.set_machine(src)
var/dat = {"
"}
if(pai)
dat += {"
Personal AI Device
| Installed Personality: |
[pai.name] |
| Prime directive: |
[pai.pai_law0] |
| Additional directives: |
[pai.pai_laws] |
"}
dat += {"
"}
if(pai && (!pai.master_dna || !pai.master))
dat += {"
"}
dat += "
"
if(radio)
dat += "Radio Uplink"
dat += {"
"}
else
dat += "Radio Uplink
"
dat += "Radio firmware not loaded. Please install a pAI personality to load firmware.
"
dat += {"
"}
else
if(looking_for_personality)
dat += {"
pAI Request Module
Requesting AI personalities from central database... If there are no entries, or if a suitable entry is not listed, check again later as more personalities may be added.
Searching for personalities
"}
else
dat += {"
pAI Request Module
No personality is installed.
Each time this button is pressed, a request will be sent out to any available personalities. Check back often give plenty of time for personalities to respond. This process could take anywhere from 15 seconds to several minutes, depending on the available personalities' timeliness.
"}
user << browse(dat, "window=paicard")
onclose(user, "paicard")
return
/obj/item/device/paicard/Topic(href, href_list)
if(!usr || usr.stat)
return
if(href_list["setdna"])
if(pai.master_dna)
return
var/mob/M = usr
if(!istype(M, /mob/living/carbon))
usr << "You don't have any DNA, or your DNA is incompatible with this device."
else
var/datum/dna/dna = usr.dna
pai.master = M.real_name
pai.master_dna = dna.unique_enzymes
pai << "You have been bound to a new master.
"
if(href_list["request"])
src.looking_for_personality = 1
paiController.findPAI(src, usr)
if(href_list["wipe"])
var/confirm = input("Are you CERTAIN you wish to delete the current personality? This action cannot be undone.", "Personality Wipe") in list("Yes", "No")
if(confirm == "Yes")
for(var/mob/M in src)
M << "You feel yourself slipping away from reality.
"
M << "Byte by byte you lose your sense of self.
"
M << "Your mental faculties leave you.
"
M << "oblivion...
"
M.death(0)
removePersonality()
if(href_list["wires"])
var/t1 = text2num(href_list["wires"])
switch(t1)
if(4)
radio.ToggleBroadcast()
if(2)
radio.ToggleReception()
if(href_list["setlaws"])
var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.pai_laws) as message),1,MAX_MESSAGE_LEN)
if(newlaws)
pai.pai_laws = newlaws
pai << "Your supplemental directives have been updated. Your new directives are:"
pai << "Prime Directive:
[pai.pai_law0]"
pai << "Supplemental Directives:
[pai.pai_laws]"
attack_self(usr)
// WIRE_SIGNAL = 1
// WIRE_RECEIVE = 2
// WIRE_TRANSMIT = 4
/obj/item/device/paicard/proc/setPersonality(mob/living/silicon/pai/personality)
src.pai = personality
src.overlays += "pai-happy"
/obj/item/device/paicard/proc/removePersonality()
src.pai = null
src.overlays.Cut()
src.overlays += "pai-off"
/obj/item/device/paicard/proc/setEmotion(var/emotion)
if(pai)
src.overlays.Cut()
switch(emotion)
if(1) src.overlays += "pai-happy"
if(2) src.overlays += "pai-cat"
if(3) src.overlays += "pai-extremely-happy"
if(4) src.overlays += "pai-face"
if(5) src.overlays += "pai-laugh"
if(6) src.overlays += "pai-off"
if(7) src.overlays += "pai-sad"
if(8) src.overlays += "pai-angry"
if(9) src.overlays += "pai-what"
/obj/item/device/paicard/proc/alertUpdate()
var/turf/T = get_turf_or_move(src.loc)
for (var/mob/M in viewers(T))
M.show_message("\blue [src] flashes a message across its screen, \"Additional personalities available for download.\"", 3, "\blue [src] bleeps electronically.", 2)
/obj/item/device/paicard/emp_act(severity)
for(var/mob/M in src)
M.emp_act(severity)
..()
/obj/item/device/paicard/ex_act(severity)
if(pai)
pai.ex_act(severity)
else
del(src)