/obj/item/paicard name = "personal AI device" desc = "A handheld device that allows you to install an artificial intelligence to be your companion." icon = 'icons/obj/aicards.dmi' icon_state = "pai" item_state = "electronic" w_class = WEIGHT_CLASS_SMALL slot_flags = SLOT_FLAG_BELT origin_tech = "programming=2" var/request_cooldown = 5 // five seconds var/last_request var/obj/item/radio/radio var/looking_for_personality = 0 var/mob/living/silicon/pai/pai var/list/faction = list("neutral") // The factions the pAI will inherit from the card var/current_emotion = 1 resistance_flags = FIRE_PROOF | ACID_PROOF | INDESTRUCTIBLE /obj/item/paicard/syndicate name = "syndicate personal AI device" faction = list("syndicate") /obj/item/paicard/New() ..() overlays += "pai-off" /obj/item/paicard/Destroy() if(pai) pai.ghostize() QDEL_NULL(pai) QDEL_NULL(radio) return ..() /obj/item/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 += {"
Configure Directives
"} if(pai && (!pai.master_dna || !pai.master)) dat += {"
Imprint Master DNA
"} dat += "
" if(radio) dat += "Radio Uplink" dat += {"
Transmit: [radio.broadcasting ? "En" : "Dis" ]abled
Receive: [radio.listening ? "En" : "Dis" ]abled

"} else dat += "Radio Uplink
" dat += "Radio firmware not loaded. Please install a pAI personality to load firmware.
" dat += {"
Wipe current pAI personality
"} 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, please wait...

Refresh available personalities

"} else dat += {" pAI Request Module

No personality is installed.

Request personality

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/paicard/Topic(href, href_list) var/mob/U = usr if(!usr || usr.stat) return if(pai) if(!in_range(src, U)) U << browse(null, "window=paicard") usr.unset_machine() return if(href_list["setdna"]) if(pai.master_dna) return var/mob/M = usr if(!iscarbon(M)) to_chat(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 to_chat(pai, "

You have been bound to a new master.

") if(href_list["request"]) var/delta = (world.time / 10) - last_request if(request_cooldown > delta) var/cooldown_time = round(request_cooldown - ((world.time / 10) - last_request), 1) to_chat(usr, "The request system is currently offline. Please wait another [cooldown_time] seconds.") return last_request = world.time / 10 looking_for_personality = 1 GLOB.paiController.findPAI(src, usr) if(href_list["wipe"]) var/confirm = tgui_alert(usr, "Are you certain you wish to delete the current personality? This action cannot be undone.", "Personality Wipe", list("No", "Yes")) if(confirm == "Yes") for(var/mob/M in src) to_chat(M, "

You feel yourself slipping away from reality.

") to_chat(M, "

Byte by byte you lose your sense of self.

") to_chat(M, "

Your mental faculties leave you.

") to_chat(M, "
oblivion...
") var/mob/living/silicon/pai/P = M if(istype(P)) if(IS_HORIZONTAL(P)) P.close_up() M.death(0, 1) 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 = tgui_input_text(usr, "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) if(newlaws) pai.pai_laws = newlaws to_chat(pai, "Your supplemental directives have been updated. Your new directives are:") to_chat(pai, "Prime Directive:
[pai.pai_law0]") to_chat(pai, "Supplemental Directives:
[pai.pai_laws]") attack_self(usr) // WIRE_SIGNAL = 1 // WIRE_RECEIVE = 2 // WIRE_TRANSMIT = 4 /obj/item/paicard/proc/setPersonality(mob/living/silicon/pai/personality) pai = personality overlays += "pai-happy" /obj/item/paicard/proc/removePersonality() pai = null overlays.Cut() overlays += "pai-off" /obj/item/paicard/proc/setEmotion(emotion) if(pai) overlays.Cut() switch(emotion) if(1) overlays += "pai-happy" if(2) overlays += "pai-cat" if(3) overlays += "pai-extremely-happy" if(4) overlays += "pai-face" if(5) overlays += "pai-laugh" if(6) overlays += "pai-off" if(7) overlays += "pai-sad" if(8) overlays += "pai-angry" if(9) overlays += "pai-what" current_emotion = emotion /obj/item/paicard/proc/alertUpdate() var/turf/T = get_turf(loc) for(var/mob/M in viewers(T)) M.show_message("[src] flashes a message across its screen, \"Additional personalities available for download.\"", 3, "[src] bleeps electronically.", 2) /obj/item/paicard/emp_act(severity) for(var/mob/M in src) M.emp_act(severity) ..() /obj/item/paicard/extinguish_light(force = FALSE) if(pai) pai.extinguish_light() set_light(0)