@@ -0,0 +1,992 @@
|
||||
#define CALL_BOT_COOLDOWN 900
|
||||
|
||||
//Not sure why this is necessary...
|
||||
/proc/AutoUpdateAI(obj/subject)
|
||||
var/is_in_use = 0
|
||||
if (subject!=null)
|
||||
for(var/A in GLOB.ai_list)
|
||||
var/mob/living/silicon/ai/M = A
|
||||
if ((M.client && M.machine == subject))
|
||||
is_in_use = 1
|
||||
subject.attack_ai(M)
|
||||
return is_in_use
|
||||
|
||||
|
||||
/mob/living/silicon/ai
|
||||
name = "AI"
|
||||
icon = 'icons/mob/ai.dmi'
|
||||
icon_state = "ai"
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
canmove = FALSE
|
||||
status_flags = CANSTUN|CANPUSH
|
||||
a_intent = INTENT_HARM //so we always get pushed instead of trying to swap
|
||||
sight = SEE_TURFS | SEE_MOBS | SEE_OBJS
|
||||
see_in_dark = 8
|
||||
hud_type = /datum/hud/ai
|
||||
med_hud = DATA_HUD_MEDICAL_BASIC
|
||||
sec_hud = DATA_HUD_SECURITY_BASIC
|
||||
d_hud = DATA_HUD_DIAGNOSTIC_ADVANCED
|
||||
mob_size = MOB_SIZE_LARGE
|
||||
var/list/network = list("ss13")
|
||||
var/obj/machinery/camera/current
|
||||
var/list/connected_robots = list()
|
||||
var/aiRestorePowerRoutine = 0
|
||||
var/requires_power = POWER_REQ_ALL
|
||||
var/can_be_carded = TRUE
|
||||
var/alarms = list("Motion"=list(), "Fire"=list(), "Atmosphere"=list(), "Power"=list(), "Camera"=list(), "Burglar"=list())
|
||||
var/viewalerts = 0
|
||||
var/icon/holo_icon//Default is assigned when AI is created.
|
||||
var/obj/mecha/controlled_mech //For controlled_mech a mech, to determine whether to relaymove or use the AI eye.
|
||||
var/radio_enabled = TRUE //Determins if a carded AI can speak with its built in radio or not.
|
||||
radiomod = ";" //AIs will, by default, state their laws on the internal radio.
|
||||
var/obj/item/pda/ai/aiPDA
|
||||
var/obj/item/multitool/aiMulti
|
||||
var/mob/living/simple_animal/bot/Bot
|
||||
var/tracking = FALSE //this is 1 if the AI is currently tracking somebody, but the track has not yet been completed.
|
||||
var/datum/effect_system/spark_spread/spark_system//So they can initialize sparks whenever/N
|
||||
|
||||
//MALFUNCTION
|
||||
var/datum/module_picker/malf_picker
|
||||
var/list/datum/AI_Module/current_modules = list()
|
||||
var/can_dominate_mechs = FALSE
|
||||
var/shunted = FALSE //1 if the AI is currently shunted. Used to differentiate between shunted and ghosted/braindead
|
||||
|
||||
var/control_disabled = FALSE // Set to 1 to stop AI from interacting via Click()
|
||||
var/malfhacking = FALSE // More or less a copy of the above var, so that malf AIs can hack and still get new cyborgs -- NeoFite
|
||||
var/malf_cooldown = 0 //Cooldown var for malf modules, stores a worldtime + cooldown
|
||||
|
||||
var/obj/machinery/power/apc/malfhack
|
||||
var/explosive = FALSE //does the AI explode when it dies?
|
||||
|
||||
var/mob/living/silicon/ai/parent
|
||||
var/camera_light_on = FALSE
|
||||
var/list/obj/machinery/camera/lit_cameras = list()
|
||||
|
||||
var/datum/trackable/track = new
|
||||
|
||||
var/last_paper_seen = null
|
||||
var/can_shunt = TRUE
|
||||
var/last_announcement = "" // For AI VOX, if enabled
|
||||
var/turf/waypoint //Holds the turf of the currently selected waypoint.
|
||||
var/waypoint_mode = FALSE //Waypoint mode is for selecting a turf via clicking.
|
||||
var/call_bot_cooldown = 0 //time of next call bot command
|
||||
var/apc_override = FALSE //hack for letting the AI use its APC even when visionless
|
||||
var/nuking = FALSE
|
||||
var/obj/machinery/doomsday_device/doomsday_device
|
||||
|
||||
var/mob/camera/aiEye/eyeobj
|
||||
var/sprint = 10
|
||||
var/cooldown = 0
|
||||
var/acceleration = 1
|
||||
|
||||
var/obj/structure/AIcore/deactivated/linked_core //For exosuit control
|
||||
var/mob/living/silicon/robot/deployed_shell = null //For shell control
|
||||
var/datum/action/innate/deploy_shell/deploy_action = new
|
||||
var/datum/action/innate/deploy_last_shell/redeploy_action = new
|
||||
var/chnotify = 0
|
||||
|
||||
|
||||
var/multicam_on = FALSE
|
||||
var/obj/screen/movable/pic_in_pic/ai/master_multicam
|
||||
var/list/multicam_screens = list()
|
||||
var/list/all_eyes = list()
|
||||
var/max_multicams = 6
|
||||
var/display_icon_override
|
||||
|
||||
/mob/living/silicon/ai/Initialize(mapload, datum/ai_laws/L, mob/target_ai)
|
||||
. = ..()
|
||||
if(!target_ai) //If there is no player/brain inside.
|
||||
new/obj/structure/AIcore/deactivated(loc) //New empty terminal.
|
||||
return INITIALIZE_HINT_QDEL //Delete AI.
|
||||
|
||||
if(L && istype(L, /datum/ai_laws))
|
||||
laws = L
|
||||
laws.associate(src)
|
||||
else
|
||||
make_laws()
|
||||
|
||||
if(target_ai.mind)
|
||||
target_ai.mind.transfer_to(src)
|
||||
if(mind.special_role)
|
||||
mind.store_memory("As an AI, you must obey your silicon laws above all else. Your objectives will consider you to be dead.")
|
||||
to_chat(src, "<span class='userdanger'>You have been installed as an AI! </span>")
|
||||
to_chat(src, "<span class='danger'>You must obey your silicon laws above all else. Your objectives will consider you to be dead.</span>")
|
||||
|
||||
to_chat(src, "<B>You are playing the station's AI. The AI cannot move, but can interact with many objects while viewing them (through cameras).</B>")
|
||||
to_chat(src, "<B>To look at other parts of the station, click on yourself to get a camera menu.</B>")
|
||||
to_chat(src, "<B>While observing through a camera, you can use most (networked) devices which you can see, such as computers, APCs, intercoms, doors, etc.</B>")
|
||||
to_chat(src, "To use something, simply click on it.")
|
||||
to_chat(src, "Use say :b to speak to your cyborgs through binary.")
|
||||
to_chat(src, "For department channels, use the following say commands:")
|
||||
to_chat(src, ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :v - Service, :m - Medical, :n - Science.")
|
||||
show_laws()
|
||||
to_chat(src, "<b>These laws may be changed by other players, or by you being the traitor.</b>")
|
||||
|
||||
job = "AI"
|
||||
|
||||
create_eye()
|
||||
apply_pref_name("ai")
|
||||
|
||||
set_core_display_icon()
|
||||
|
||||
holo_icon = getHologramIcon(icon('icons/mob/ai.dmi',"default"))
|
||||
|
||||
spark_system = new /datum/effect_system/spark_spread()
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
|
||||
verbs += /mob/living/silicon/ai/proc/show_laws_verb
|
||||
|
||||
aiPDA = new/obj/item/pda/ai(src)
|
||||
aiPDA.owner = name
|
||||
aiPDA.ownjob = "AI"
|
||||
aiPDA.name = name + " (" + aiPDA.ownjob + ")"
|
||||
|
||||
aiMulti = new(src)
|
||||
radio = new /obj/item/radio/headset/ai(src)
|
||||
aicamera = new/obj/item/camera/siliconcam/ai_camera(src)
|
||||
|
||||
deploy_action.Grant(src)
|
||||
|
||||
if(isturf(loc))
|
||||
verbs.Add(/mob/living/silicon/ai/proc/ai_network_change, \
|
||||
/mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \
|
||||
/mob/living/silicon/ai/proc/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, \
|
||||
/mob/living/silicon/ai/proc/set_automatic_say_channel)
|
||||
|
||||
GLOB.ai_list += src
|
||||
GLOB.shuttle_caller_list += src
|
||||
|
||||
builtInCamera = new (src)
|
||||
builtInCamera.network = list("ss13")
|
||||
|
||||
|
||||
/mob/living/silicon/ai/Destroy()
|
||||
GLOB.ai_list -= src
|
||||
GLOB.shuttle_caller_list -= src
|
||||
SSshuttle.autoEvac()
|
||||
qdel(eyeobj) // No AI, no Eye
|
||||
malfhack = null
|
||||
|
||||
. = ..()
|
||||
|
||||
/mob/living/silicon/ai/IgniteMob()
|
||||
fire_stacks = 0
|
||||
. = ..()
|
||||
|
||||
/mob/living/silicon/ai/proc/set_core_display_icon(input, client/C)
|
||||
if(client && !C)
|
||||
C = client
|
||||
if(!input && !C?.prefs?.preferred_ai_core_display)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
var/preferred_icon = input ? input : C.prefs.preferred_ai_core_display
|
||||
icon_state = resolve_ai_icon(preferred_icon)
|
||||
|
||||
/mob/living/silicon/ai/verb/pick_icon()
|
||||
set category = "AI Commands"
|
||||
set name = "Set AI Core Display"
|
||||
if(incapacitated())
|
||||
return
|
||||
var/list/iconstates = GLOB.ai_core_display_screens
|
||||
for(var/option in iconstates)
|
||||
if(option == "Random")
|
||||
iconstates[option] = image(icon = src.icon, icon_state = "ai-random")
|
||||
continue
|
||||
iconstates[option] = image(icon = src.icon, icon_state = resolve_ai_icon(option))
|
||||
|
||||
view_core()
|
||||
var/ai_core_icon = show_radial_menu(src, src , iconstates, radius = 42)
|
||||
|
||||
if(!ai_core_icon || incapacitated())
|
||||
return
|
||||
display_icon_override = ai_core_icon
|
||||
set_core_display_icon(ai_core_icon)
|
||||
|
||||
/mob/living/silicon/ai/Stat()
|
||||
..()
|
||||
if(statpanel("Status"))
|
||||
if(!stat)
|
||||
stat(null, text("System integrity: [(health+100)/2]%"))
|
||||
stat(null, text("Connected cyborgs: [connected_robots.len]"))
|
||||
for(var/mob/living/silicon/robot/R in connected_robots)
|
||||
var/robot_status = "Nominal"
|
||||
if(R.shell)
|
||||
robot_status = "AI SHELL"
|
||||
else if(R.stat || !R.client)
|
||||
robot_status = "OFFLINE"
|
||||
else if(!R.cell || R.cell.charge <= 0)
|
||||
robot_status = "DEPOWERED"
|
||||
//Name, Health, Battery, Module, Area, and Status! Everything an AI wants to know about its borgies!
|
||||
stat(null, text("[R.name] | S.Integrity: [R.health]% | Cell: [R.cell ? "[R.cell.charge]/[R.cell.maxcharge]" : "Empty"] | \
|
||||
Module: [R.designation] | Loc: [get_area_name(R, TRUE)] | Status: [robot_status]"))
|
||||
stat(null, text("AI shell beacons detected: [LAZYLEN(GLOB.available_ai_shells)]")) //Count of total AI shells
|
||||
else
|
||||
stat(null, text("Systems nonfunctional"))
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_alerts()
|
||||
var/dat = "<HEAD><TITLE>Current Station Alerts</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
|
||||
dat += "<A HREF='?src=[REF(src)];mach_close=aialerts'>Close</A><BR><BR>"
|
||||
for (var/cat in alarms)
|
||||
dat += text("<B>[]</B><BR>\n", cat)
|
||||
var/list/L = alarms[cat]
|
||||
if (L.len)
|
||||
for (var/alarm in L)
|
||||
var/list/alm = L[alarm]
|
||||
var/area/A = alm[1]
|
||||
var/C = alm[2]
|
||||
var/list/sources = alm[3]
|
||||
dat += "<NOBR>"
|
||||
if (C && istype(C, /list))
|
||||
var/dat2 = ""
|
||||
for (var/obj/machinery/camera/I in C)
|
||||
dat2 += text("[]<A HREF=?src=[REF(src)];switchcamera=[REF(I)]>[]</A>", (dat2=="") ? "" : " | ", I.c_tag)
|
||||
dat += text("-- [] ([])", A.name, (dat2!="") ? dat2 : "No Camera")
|
||||
else if (C && istype(C, /obj/machinery/camera))
|
||||
var/obj/machinery/camera/Ctmp = C
|
||||
dat += text("-- [] (<A HREF=?src=[REF(src)];switchcamera=[REF(C)]>[]</A>)", A.name, Ctmp.c_tag)
|
||||
else
|
||||
dat += text("-- [] (No Camera)", A.name)
|
||||
if (sources.len > 1)
|
||||
dat += text("- [] sources", sources.len)
|
||||
dat += "</NOBR><BR>\n"
|
||||
else
|
||||
dat += "-- All Systems Nominal<BR>\n"
|
||||
dat += "<BR>\n"
|
||||
|
||||
viewalerts = 1
|
||||
src << browse(dat, "window=aialerts&can_close=0")
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_roster()
|
||||
var/dat = "<html><head><title>Crew Roster</title></head><body><b>Crew Roster:</b><br><br>"
|
||||
|
||||
dat += GLOB.data_core.get_manifest()
|
||||
dat += "</body></html>"
|
||||
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_call_shuttle()
|
||||
if(control_disabled)
|
||||
to_chat(usr, "<span class='warning'>Wireless control is disabled!</span>")
|
||||
return
|
||||
|
||||
var/reason = input(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call") as null|text
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(trim(reason))
|
||||
SSshuttle.requestEvac(src, reason)
|
||||
|
||||
// hack to display shuttle timer
|
||||
if(!EMERGENCY_IDLE_OR_RECALLED)
|
||||
var/obj/machinery/computer/communications/C = locate() in GLOB.machines
|
||||
if(C)
|
||||
C.post_status("shuttle")
|
||||
|
||||
/mob/living/silicon/ai/can_interact_with(atom/A)
|
||||
. = ..()
|
||||
var/turf/ai = get_turf(src)
|
||||
var/turf/target = get_turf(A)
|
||||
if (.)
|
||||
return
|
||||
|
||||
if(!target)
|
||||
return
|
||||
|
||||
if ((ai.z != target.z) && !is_station_level(ai.z))
|
||||
return FALSE
|
||||
|
||||
if (istype(loc, /obj/item/aicard))
|
||||
var/turf/T0 = get_turf(src)
|
||||
var/turf/T1 = get_turf(A)
|
||||
if (!T0 || ! T1)
|
||||
return FALSE
|
||||
return ISINRANGE(T1.x, T0.x - interaction_range, T0.x + interaction_range) && ISINRANGE(T1.y, T0.y - interaction_range, T0.y + interaction_range)
|
||||
else
|
||||
return GLOB.cameranet.checkTurfVis(get_turf(A))
|
||||
|
||||
/mob/living/silicon/ai/cancel_camera()
|
||||
view_core()
|
||||
|
||||
/mob/living/silicon/ai/verb/toggle_anchor()
|
||||
set category = "AI Commands"
|
||||
set name = "Toggle Floor Bolts"
|
||||
if(!isturf(loc)) // if their location isn't a turf
|
||||
return // stop
|
||||
if(incapacitated())
|
||||
return
|
||||
anchored = !anchored // Toggles the anchor
|
||||
|
||||
to_chat(src, "<b>You are now [anchored ? "" : "un"]anchored.</b>")
|
||||
// the message in the [] will change depending whether or not the AI is anchored
|
||||
|
||||
/mob/living/silicon/ai/update_canmove() //If the AI dies, mobs won't go through it anymore
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_cancel_call()
|
||||
set category = "Malfunction"
|
||||
if(control_disabled)
|
||||
to_chat(src, "<span class='warning'>Wireless control is disabled!</span>")
|
||||
return
|
||||
SSshuttle.cancelEvac(src)
|
||||
|
||||
/mob/living/silicon/ai/restrained(ignore_grab)
|
||||
. = 0
|
||||
|
||||
/mob/living/silicon/ai/Topic(href, href_list)
|
||||
if(usr != src || incapacitated())
|
||||
return
|
||||
..()
|
||||
if (href_list["mach_close"])
|
||||
if (href_list["mach_close"] == "aialerts")
|
||||
viewalerts = 0
|
||||
var/t1 = text("window=[]", href_list["mach_close"])
|
||||
unset_machine()
|
||||
src << browse(null, t1)
|
||||
if (href_list["switchcamera"])
|
||||
switchCamera(locate(href_list["switchcamera"])) in GLOB.cameranet.cameras
|
||||
if (href_list["showalerts"])
|
||||
ai_alerts()
|
||||
#ifdef AI_VOX
|
||||
if(href_list["say_word"])
|
||||
play_vox_word(href_list["say_word"], null, src)
|
||||
return
|
||||
#endif
|
||||
if(href_list["show_paper"])
|
||||
if(last_paper_seen)
|
||||
src << browse(last_paper_seen, "window=show_paper")
|
||||
//Carn: holopad requests
|
||||
if(href_list["jumptoholopad"])
|
||||
var/obj/machinery/holopad/H = locate(href_list["jumptoholopad"])
|
||||
if(H)
|
||||
H.attack_ai(src) //may as well recycle
|
||||
else
|
||||
to_chat(src, "<span class='notice'>Unable to locate the holopad.</span>")
|
||||
if(href_list["track"])
|
||||
var/string = href_list["track"]
|
||||
trackable_mobs()
|
||||
var/list/trackeable = list()
|
||||
trackeable += track.humans + track.others
|
||||
var/list/target = list()
|
||||
for(var/I in trackeable)
|
||||
var/mob/M = trackeable[I]
|
||||
if(M.name == string)
|
||||
target += M
|
||||
if(name == string)
|
||||
target += src
|
||||
if(target.len)
|
||||
ai_actual_track(pick(target))
|
||||
else
|
||||
to_chat(src, "Target is not on or near any active cameras on the station.")
|
||||
return
|
||||
if(href_list["callbot"]) //Command a bot to move to a selected location.
|
||||
if(call_bot_cooldown > world.time)
|
||||
to_chat(src, "<span class='danger'>Error: Your last call bot command is still processing, please wait for the bot to finish calculating a route.</span>")
|
||||
return
|
||||
Bot = locate(href_list["callbot"]) in GLOB.alive_mob_list
|
||||
if(!Bot || Bot.remote_disabled || src.control_disabled)
|
||||
return //True if there is no bot found, the bot is manually emagged, or the AI is carded with wireless off.
|
||||
waypoint_mode = 1
|
||||
to_chat(src, "<span class='notice'>Set your waypoint by clicking on a valid location free of obstructions.</span>")
|
||||
return
|
||||
if(href_list["interface"]) //Remotely connect to a bot!
|
||||
Bot = locate(href_list["interface"]) in GLOB.alive_mob_list
|
||||
if(!Bot || Bot.remote_disabled || src.control_disabled)
|
||||
return
|
||||
Bot.attack_ai(src)
|
||||
if(href_list["botrefresh"]) //Refreshes the bot control panel.
|
||||
botcall()
|
||||
return
|
||||
|
||||
if (href_list["ai_take_control"]) //Mech domination
|
||||
var/obj/mecha/M = locate(href_list["ai_take_control"])
|
||||
if(controlled_mech)
|
||||
to_chat(src, "<span class='warning'>You are already loaded into an onboard computer!</span>")
|
||||
return
|
||||
if(!GLOB.cameranet.checkCameraVis(M))
|
||||
to_chat(src, "<span class='warning'>Exosuit is no longer near active cameras.</span>")
|
||||
return
|
||||
if(!isturf(loc))
|
||||
to_chat(src, "<span class='warning'>You aren't in your core!</span>")
|
||||
return
|
||||
if(M)
|
||||
M.transfer_ai(AI_MECH_HACK,src, usr) //Called om the mech itself.
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/switchCamera(obj/machinery/camera/C)
|
||||
if(QDELETED(C))
|
||||
return FALSE
|
||||
|
||||
if(!tracking)
|
||||
cameraFollow = null
|
||||
|
||||
if(QDELETED(eyeobj))
|
||||
view_core()
|
||||
return
|
||||
// ok, we're alive, camera is good and in our network...
|
||||
eyeobj.setLoc(get_turf(C))
|
||||
return TRUE
|
||||
|
||||
/mob/living/silicon/ai/proc/botcall()
|
||||
set category = "AI Commands"
|
||||
set name = "Access Robot Control"
|
||||
set desc = "Wirelessly control various automatic robots."
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(control_disabled)
|
||||
to_chat(src, "<span class='warning'>Wireless control is disabled.</span>")
|
||||
return
|
||||
var/turf/ai_current_turf = get_turf(src)
|
||||
var/ai_Zlevel = ai_current_turf.z
|
||||
var/d
|
||||
d += "<A HREF=?src=[REF(src)];botrefresh=1>Query network status</A><br>"
|
||||
d += "<table width='100%'><tr><td width='40%'><h3>Name</h3></td><td width='30%'><h3>Status</h3></td><td width='30%'><h3>Location</h3></td><td width='10%'><h3>Control</h3></td></tr>"
|
||||
|
||||
for (Bot in GLOB.alive_mob_list)
|
||||
if(Bot.z == ai_Zlevel && !Bot.remote_disabled) //Only non-emagged bots on the same Z-level are detected!
|
||||
var/bot_mode = Bot.get_mode()
|
||||
d += "<tr><td width='30%'>[Bot.hacked ? "<span class='bad'>(!)</span>" : ""] [Bot.name]</A> ([Bot.model])</td>"
|
||||
//If the bot is on, it will display the bot's current mode status. If the bot is not mode, it will just report "Idle". "Inactive if it is not on at all.
|
||||
d += "<td width='30%'>[bot_mode]</td>"
|
||||
d += "<td width='30%'>[get_area_name(Bot, TRUE)]</td>"
|
||||
d += "<td width='10%'><A HREF=?src=[REF(src)];interface=[REF(Bot)]>Interface</A></td>"
|
||||
d += "<td width='10%'><A HREF=?src=[REF(src)];callbot=[REF(Bot)]>Call</A></td>"
|
||||
d += "</tr>"
|
||||
d = format_text(d)
|
||||
|
||||
var/datum/browser/popup = new(src, "botcall", "Remote Robot Control", 700, 400)
|
||||
popup.set_content(d)
|
||||
popup.open()
|
||||
|
||||
/mob/living/silicon/ai/proc/set_waypoint(atom/A)
|
||||
var/turf/turf_check = get_turf(A)
|
||||
//The target must be in view of a camera or near the core.
|
||||
if(turf_check in range(get_turf(src)))
|
||||
call_bot(turf_check)
|
||||
else if(GLOB.cameranet && GLOB.cameranet.checkTurfVis(turf_check))
|
||||
call_bot(turf_check)
|
||||
else
|
||||
to_chat(src, "<span class='danger'>Selected location is not visible.</span>")
|
||||
|
||||
/mob/living/silicon/ai/proc/call_bot(turf/waypoint)
|
||||
|
||||
if(!Bot)
|
||||
return
|
||||
|
||||
if(Bot.calling_ai && Bot.calling_ai != src) //Prevents an override if another AI is controlling this bot.
|
||||
to_chat(src, "<span class='danger'>Interface error. Unit is already in use.</span>")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Sending command to bot...</span>")
|
||||
call_bot_cooldown = world.time + CALL_BOT_COOLDOWN
|
||||
Bot.call_bot(src, waypoint)
|
||||
call_bot_cooldown = 0
|
||||
|
||||
|
||||
/mob/living/silicon/ai/triggerAlarm(class, area/A, O, obj/alarmsource)
|
||||
if(alarmsource.z != z)
|
||||
return
|
||||
var/list/L = alarms[class]
|
||||
for (var/I in L)
|
||||
if (I == A.name)
|
||||
var/list/alarm = L[I]
|
||||
var/list/sources = alarm[3]
|
||||
if (!(alarmsource in sources))
|
||||
sources += alarmsource
|
||||
return 1
|
||||
var/obj/machinery/camera/C = null
|
||||
var/list/CL = null
|
||||
if (O && istype(O, /list))
|
||||
CL = O
|
||||
if (CL.len == 1)
|
||||
C = CL[1]
|
||||
else if (O && istype(O, /obj/machinery/camera))
|
||||
C = O
|
||||
L[A.name] = list(A, (C) ? C : O, list(alarmsource))
|
||||
if (O)
|
||||
if (C && C.can_use())
|
||||
queueAlarm("--- [class] alarm detected in [A.name]! (<A HREF=?src=[REF(src)];switchcamera=[REF(C)]>[C.c_tag]</A>)", class)
|
||||
else if (CL && CL.len)
|
||||
var/foo = 0
|
||||
var/dat2 = ""
|
||||
for (var/obj/machinery/camera/I in CL)
|
||||
dat2 += text("[]<A HREF=?src=[REF(src)];switchcamera=[REF(I)]>[]</A>", (!foo) ? "" : " | ", I.c_tag) //I'm not fixing this shit...
|
||||
foo = 1
|
||||
queueAlarm(text ("--- [] alarm detected in []! ([])", class, A.name, dat2), class)
|
||||
else
|
||||
queueAlarm(text("--- [] alarm detected in []! (No Camera)", class, A.name), class)
|
||||
else
|
||||
queueAlarm(text("--- [] alarm detected in []! (No Camera)", class, A.name), class)
|
||||
if (viewalerts) ai_alerts()
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/ai/cancelAlarm(class, area/A, obj/origin)
|
||||
var/list/L = alarms[class]
|
||||
var/cleared = 0
|
||||
for (var/I in L)
|
||||
if (I == A.name)
|
||||
var/list/alarm = L[I]
|
||||
var/list/srcs = alarm[3]
|
||||
if (origin in srcs)
|
||||
srcs -= origin
|
||||
if (srcs.len == 0)
|
||||
cleared = 1
|
||||
L -= I
|
||||
if (cleared)
|
||||
queueAlarm("--- [class] alarm in [A.name] has been cleared.", class, 0)
|
||||
if (viewalerts) ai_alerts()
|
||||
return !cleared
|
||||
|
||||
//Replaces /mob/living/silicon/ai/verb/change_network() in ai.dm & camera.dm
|
||||
//Adds in /mob/living/silicon/ai/proc/ai_network_change() instead
|
||||
//Addition by Mord_Sith to define AI's network change ability
|
||||
/mob/living/silicon/ai/proc/ai_network_change()
|
||||
set category = "AI Commands"
|
||||
set name = "Jump To Network"
|
||||
unset_machine()
|
||||
cameraFollow = null
|
||||
var/cameralist[0]
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
var/mob/living/silicon/ai/U = usr
|
||||
|
||||
for (var/obj/machinery/camera/C in GLOB.cameranet.cameras)
|
||||
var/list/tempnetwork = C.network
|
||||
if(!(is_station_level(C.z) || is_mining_level(C.z) || ("ss13" in tempnetwork)))
|
||||
continue
|
||||
if(!C.can_use())
|
||||
continue
|
||||
|
||||
tempnetwork.Remove("rd", "toxins", "prison")
|
||||
if(tempnetwork.len)
|
||||
for(var/i in C.network)
|
||||
cameralist[i] = i
|
||||
var/old_network = network
|
||||
network = input(U, "Which network would you like to view?") as null|anything in cameralist
|
||||
|
||||
if(!U.eyeobj)
|
||||
U.view_core()
|
||||
return
|
||||
|
||||
if(isnull(network))
|
||||
network = old_network // If nothing is selected
|
||||
else
|
||||
for(var/obj/machinery/camera/C in GLOB.cameranet.cameras)
|
||||
if(!C.can_use())
|
||||
continue
|
||||
if(network in C.network)
|
||||
U.eyeobj.setLoc(get_turf(C))
|
||||
break
|
||||
to_chat(src, "<span class='notice'>Switched to the \"[uppertext(network)]\" camera network.</span>")
|
||||
//End of code by Mord_Sith
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/choose_modules()
|
||||
set category = "Malfunction"
|
||||
set name = "Choose Module"
|
||||
|
||||
malf_picker.use(src)
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_statuschange()
|
||||
set category = "AI Commands"
|
||||
set name = "AI Status"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
var/list/ai_emotions = list("Very Happy", "Happy", "Neutral", "Unsure", "Confused", "Sad", "BSOD", "Blank", "Problems?", "Awesome", "Facepalm", "Thinking", "Friend Computer", "Dorfy", "Blue Glow", "Red Glow")
|
||||
var/emote = input("Please, select a status!", "AI Status", null, null) in ai_emotions
|
||||
for (var/each in GLOB.ai_status_displays) //change status of displays
|
||||
var/obj/machinery/status_display/ai/M = each
|
||||
M.emotion = emote
|
||||
M.update()
|
||||
if (emote == "Friend Computer")
|
||||
var/datum/radio_frequency/frequency = SSradio.return_frequency(FREQ_STATUS_DISPLAYS)
|
||||
|
||||
if(!frequency)
|
||||
return
|
||||
|
||||
var/datum/signal/status_signal = new(list("command" = "friendcomputer"))
|
||||
frequency.post_signal(src, status_signal)
|
||||
return
|
||||
|
||||
//I am the icon meister. Bow fefore me. //>fefore
|
||||
/mob/living/silicon/ai/proc/ai_hologram_change()
|
||||
set name = "Change Hologram"
|
||||
set desc = "Change the default hologram available to AI to something else."
|
||||
set category = "AI Commands"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
var/input
|
||||
switch(alert("Would you like to select a hologram based on a crew member, an animal, or switch to a unique avatar?",,"Crew Member","Unique","Animal"))
|
||||
if("Crew Member")
|
||||
var/list/personnel_list = list()
|
||||
|
||||
for(var/datum/data/record/t in GLOB.data_core.locked)//Look in data core locked.
|
||||
personnel_list["[t.fields["name"]]: [t.fields["rank"]]"] = t.fields["image"]//Pull names, rank, and image.
|
||||
|
||||
if(personnel_list.len)
|
||||
input = input("Select a crew member:") as null|anything in personnel_list
|
||||
var/icon/character_icon = personnel_list[input]
|
||||
if(character_icon)
|
||||
qdel(holo_icon)//Clear old icon so we're not storing it in memory.
|
||||
holo_icon = getHologramIcon(icon(character_icon))
|
||||
else
|
||||
alert("No suitable records found. Aborting.")
|
||||
|
||||
if("Animal")
|
||||
var/list/icon_list = list(
|
||||
"bear" = 'icons/mob/animal.dmi',
|
||||
"carp" = 'icons/mob/animal.dmi',
|
||||
"chicken" = 'icons/mob/animal.dmi',
|
||||
"corgi" = 'icons/mob/pets.dmi',
|
||||
"cow" = 'icons/mob/animal.dmi',
|
||||
"crab" = 'icons/mob/animal.dmi',
|
||||
"fox" = 'icons/mob/pets.dmi',
|
||||
"goat" = 'icons/mob/animal.dmi',
|
||||
"cat" = 'icons/mob/pets.dmi',
|
||||
"cat2" = 'icons/mob/pets.dmi',
|
||||
"poly" = 'icons/mob/animal.dmi',
|
||||
"pug" = 'icons/mob/pets.dmi',
|
||||
"spider" = 'icons/mob/animal.dmi'
|
||||
)
|
||||
|
||||
input = input("Please select a hologram:") as null|anything in icon_list
|
||||
if(input)
|
||||
qdel(holo_icon)
|
||||
switch(input)
|
||||
if("poly")
|
||||
holo_icon = getHologramIcon(icon(icon_list[input],"parrot_fly"))
|
||||
if("chicken")
|
||||
holo_icon = getHologramIcon(icon(icon_list[input],"chicken_brown"))
|
||||
if("spider")
|
||||
holo_icon = getHologramIcon(icon(icon_list[input],"guard"))
|
||||
else
|
||||
holo_icon = getHologramIcon(icon(icon_list[input], input))
|
||||
else
|
||||
var/list/icon_list = list(
|
||||
"default" = 'icons/mob/ai.dmi',
|
||||
"floating face" = 'icons/mob/ai.dmi',
|
||||
"xeno queen" = 'icons/mob/alien.dmi',
|
||||
"horror" = 'icons/mob/ai.dmi'
|
||||
)
|
||||
|
||||
input = input("Please select a hologram:") as null|anything in icon_list
|
||||
if(input)
|
||||
qdel(holo_icon)
|
||||
switch(input)
|
||||
if("xeno queen")
|
||||
holo_icon = getHologramIcon(icon(icon_list[input],"alienq"))
|
||||
else
|
||||
holo_icon = getHologramIcon(icon(icon_list[input], input))
|
||||
return
|
||||
|
||||
/mob/living/silicon/ai/proc/corereturn()
|
||||
set category = "Malfunction"
|
||||
set name = "Return to Main Core"
|
||||
|
||||
var/obj/machinery/power/apc/apc = src.loc
|
||||
if(!istype(apc))
|
||||
to_chat(src, "<span class='notice'>You are already in your Main Core.</span>")
|
||||
return
|
||||
apc.malfvacate()
|
||||
|
||||
/mob/living/silicon/ai/proc/toggle_camera_light()
|
||||
camera_light_on = !camera_light_on
|
||||
|
||||
if (!camera_light_on)
|
||||
to_chat(src, "Camera lights deactivated.")
|
||||
|
||||
for (var/obj/machinery/camera/C in lit_cameras)
|
||||
C.set_light(0)
|
||||
lit_cameras = list()
|
||||
|
||||
return
|
||||
|
||||
light_cameras()
|
||||
|
||||
to_chat(src, "Camera lights activated.")
|
||||
|
||||
//AI_CAMERA_LUMINOSITY
|
||||
|
||||
/mob/living/silicon/ai/proc/light_cameras()
|
||||
var/list/obj/machinery/camera/add = list()
|
||||
var/list/obj/machinery/camera/remove = list()
|
||||
var/list/obj/machinery/camera/visible = list()
|
||||
for (var/datum/camerachunk/CC in eyeobj.visibleCameraChunks)
|
||||
for (var/obj/machinery/camera/C in CC.cameras)
|
||||
if (!C.can_use() || get_dist(C, eyeobj) > 7 || !C.internal_light)
|
||||
continue
|
||||
visible |= C
|
||||
|
||||
add = visible - lit_cameras
|
||||
remove = lit_cameras - visible
|
||||
|
||||
for (var/obj/machinery/camera/C in remove)
|
||||
lit_cameras -= C //Removed from list before turning off the light so that it doesn't check the AI looking away.
|
||||
C.Togglelight(0)
|
||||
for (var/obj/machinery/camera/C in add)
|
||||
C.Togglelight(1)
|
||||
lit_cameras |= C
|
||||
|
||||
/mob/living/silicon/ai/proc/control_integrated_radio()
|
||||
set name = "Transceiver Settings"
|
||||
set desc = "Allows you to change settings of your radio."
|
||||
set category = "AI Commands"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
to_chat(src, "Accessing Subspace Transceiver control...")
|
||||
if (radio)
|
||||
radio.interact(src)
|
||||
|
||||
/mob/living/silicon/ai/proc/set_syndie_radio()
|
||||
if(radio)
|
||||
radio.make_syndie()
|
||||
|
||||
/mob/living/silicon/ai/proc/set_automatic_say_channel()
|
||||
set name = "Set Auto Announce Mode"
|
||||
set desc = "Modify the default radio setting for your automatic announcements."
|
||||
set category = "AI Commands"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
set_autosay()
|
||||
|
||||
/mob/living/silicon/ai/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card)
|
||||
if(!..())
|
||||
return
|
||||
if(interaction == AI_TRANS_TO_CARD)//The only possible interaction. Upload AI mob to a card.
|
||||
if(!can_be_carded)
|
||||
to_chat(user, "<span class='boldwarning'>Transfer failed.</span>")
|
||||
return
|
||||
disconnect_shell() //If the AI is controlling a borg, force the player back to core!
|
||||
if(!mind)
|
||||
to_chat(user, "<span class='warning'>No intelligence patterns detected.</span>" )
|
||||
return
|
||||
ShutOffDoomsdayDevice()
|
||||
new /obj/structure/AIcore/deactivated(loc)//Spawns a deactivated terminal at AI location.
|
||||
ai_restore_power()//So the AI initially has power.
|
||||
control_disabled = 1//Can't control things remotely if you're stuck in a card!
|
||||
radio_enabled = 0 //No talking on the built-in radio for you either!
|
||||
forceMove(card)
|
||||
card.AI = src
|
||||
to_chat(src, "You have been downloaded to a mobile storage device. Remote device connection severed.")
|
||||
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
|
||||
|
||||
/mob/living/silicon/ai/can_buckle()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/ai/incapacitated(ignore_restraints, ignore_grab)
|
||||
if(aiRestorePowerRoutine)
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/ai/canUseTopic(atom/movable/M, be_close=FALSE, no_dextery=FALSE, no_tk=FALSE)
|
||||
if(control_disabled || incapacitated())
|
||||
to_chat(src, "<span class='warning'>You can't do that right now!</span>")
|
||||
return FALSE
|
||||
if(be_close && !in_range(M, src))
|
||||
to_chat(src, "<span class='warning'>You are too far away!</span>")
|
||||
return FALSE
|
||||
return can_see(M) //stop AIs from leaving windows open and using then after they lose vision
|
||||
|
||||
/mob/living/silicon/ai/proc/can_see(atom/A)
|
||||
if(isturf(loc)) //AI in core, check if on cameras
|
||||
//get_turf_pixel() is because APCs in maint aren't actually in view of the inner camera
|
||||
//apc_override is needed here because AIs use their own APC when depowered
|
||||
return (GLOB.cameranet && GLOB.cameranet.checkTurfVis(get_turf_pixel(A))) || apc_override
|
||||
//AI is carded/shunted
|
||||
//view(src) returns nothing for carded/shunted AIs and they have X-ray vision so just use get_dist
|
||||
var/list/viewscale = getviewsize(client.view)
|
||||
return get_dist(src, A) <= max(viewscale[1]*0.5,viewscale[2]*0.5)
|
||||
|
||||
/mob/living/silicon/ai/proc/relay_speech(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
raw_message = lang_treat(speaker, message_language, raw_message, spans, message_mode)
|
||||
var/start = "Relayed Speech: "
|
||||
var/namepart = "[speaker.GetVoice()][speaker.get_alt_name()]"
|
||||
var/hrefpart = "<a href='?src=[REF(src)];track=[html_encode(namepart)]'>"
|
||||
var/jobpart
|
||||
|
||||
if (iscarbon(speaker))
|
||||
var/mob/living/carbon/S = speaker
|
||||
if(S.job)
|
||||
jobpart = "[S.job]"
|
||||
else
|
||||
jobpart = "Unknown"
|
||||
|
||||
var/rendered = "<i><span class='game say'>[start]<span class='name'>[hrefpart][namepart] ([jobpart])</a> </span><span class='message'>[raw_message]</span></span></i>"
|
||||
|
||||
show_message(rendered, 2)
|
||||
|
||||
/mob/living/silicon/ai/fully_replace_character_name(oldname,newname)
|
||||
..()
|
||||
if(oldname != real_name)
|
||||
if(eyeobj)
|
||||
eyeobj.name = "[newname] (AI Eye)"
|
||||
|
||||
// Notify Cyborgs
|
||||
for(var/mob/living/silicon/robot/Slave in connected_robots)
|
||||
Slave.show_laws()
|
||||
|
||||
/mob/living/silicon/ai/replace_identification_name(oldname,newname)
|
||||
if(aiPDA)
|
||||
aiPDA.owner = newname
|
||||
aiPDA.name = newname + " (" + aiPDA.ownjob + ")"
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/add_malf_picker()
|
||||
to_chat(src, "In the top right corner of the screen you will find the Malfunctions tab, where you can purchase various abilities, from upgraded surveillance to station ending doomsday devices.")
|
||||
to_chat(src, "You are also capable of hacking APCs, which grants you more points to spend on your Malfunction powers. The drawback is that a hacked APC will give you away if spotted by the crew. Hacking an APC takes 60 seconds.")
|
||||
view_core() //A BYOND bug requires you to be viewing your core before your verbs update
|
||||
verbs += /mob/living/silicon/ai/proc/choose_modules
|
||||
malf_picker = new /datum/module_picker
|
||||
|
||||
|
||||
/mob/living/silicon/ai/reset_perspective(atom/A)
|
||||
if(camera_light_on)
|
||||
light_cameras()
|
||||
if(istype(A, /obj/machinery/camera))
|
||||
current = A
|
||||
if(client)
|
||||
if(ismovableatom(A))
|
||||
if(A != GLOB.ai_camera_room_landmark)
|
||||
end_multicam()
|
||||
client.perspective = EYE_PERSPECTIVE
|
||||
client.eye = A
|
||||
else
|
||||
end_multicam()
|
||||
if(isturf(loc))
|
||||
if(eyeobj)
|
||||
client.eye = eyeobj
|
||||
client.perspective = EYE_PERSPECTIVE
|
||||
else
|
||||
client.eye = client.mob
|
||||
client.perspective = MOB_PERSPECTIVE
|
||||
else
|
||||
client.perspective = EYE_PERSPECTIVE
|
||||
client.eye = loc
|
||||
update_sight()
|
||||
if(client.eye != src)
|
||||
var/atom/AT = client.eye
|
||||
AT.get_remote_view_fullscreens(src)
|
||||
else
|
||||
clear_fullscreen("remote_view", 0)
|
||||
|
||||
/mob/living/silicon/ai/revive(full_heal = 0, admin_revive = 0)
|
||||
. = ..()
|
||||
if(.) //successfully ressuscitated from death
|
||||
set_eyeobj_visible(TRUE)
|
||||
set_core_display_icon(display_icon_override)
|
||||
|
||||
/mob/living/silicon/ai/proc/malfhacked(obj/machinery/power/apc/apc)
|
||||
malfhack = null
|
||||
malfhacking = 0
|
||||
clear_alert("hackingapc")
|
||||
|
||||
if(!istype(apc) || QDELETED(apc) || apc.stat & BROKEN)
|
||||
to_chat(src, "<span class='danger'>Hack aborted. The designated APC no longer exists on the power network.</span>")
|
||||
playsound(get_turf(src), 'sound/machines/buzz-two.ogg', 50, 1)
|
||||
else if(apc.aidisabled)
|
||||
to_chat(src, "<span class='danger'>Hack aborted. \The [apc] is no longer responding to our systems.</span>")
|
||||
playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 50, 1)
|
||||
else
|
||||
malf_picker.processing_time += 10
|
||||
|
||||
apc.malfai = parent || src
|
||||
apc.malfhack = TRUE
|
||||
apc.locked = TRUE
|
||||
apc.coverlocked = TRUE
|
||||
|
||||
playsound(get_turf(src), 'sound/machines/ding.ogg', 50, 1)
|
||||
to_chat(src, "Hack complete. \The [apc] is now under your exclusive control.")
|
||||
apc.update_icon()
|
||||
|
||||
/mob/living/silicon/ai/verb/deploy_to_shell(var/mob/living/silicon/robot/target)
|
||||
set category = "AI Commands"
|
||||
set name = "Deploy to Shell"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
if(control_disabled)
|
||||
to_chat(src, "<span class='warning'>Wireless networking module is offline.</span>")
|
||||
return
|
||||
|
||||
var/list/possible = list()
|
||||
|
||||
for(var/borgie in GLOB.available_ai_shells)
|
||||
var/mob/living/silicon/robot/R = borgie
|
||||
if(R.shell && !R.deployed && (R.stat != DEAD) && (!R.connected_ai ||(R.connected_ai == src)))
|
||||
possible += R
|
||||
|
||||
if(!LAZYLEN(possible))
|
||||
to_chat(src, "No usable AI shell beacons detected.")
|
||||
|
||||
if(!target || !(target in possible)) //If the AI is looking for a new shell, or its pre-selected shell is no longer valid
|
||||
target = input(src, "Which body to control?") as null|anything in possible
|
||||
|
||||
if (!target || target.stat == DEAD || target.deployed || !(!target.connected_ai ||(target.connected_ai == src)))
|
||||
return
|
||||
|
||||
else if(mind)
|
||||
soullink(/datum/soullink/sharedbody, src, target)
|
||||
deployed_shell = target
|
||||
target.deploy_init(src)
|
||||
mind.transfer_to(target)
|
||||
diag_hud_set_deployed()
|
||||
|
||||
/datum/action/innate/deploy_shell
|
||||
name = "Deploy to AI Shell"
|
||||
desc = "Wirelessly control a specialized cyborg shell."
|
||||
icon_icon = 'icons/mob/actions/actions_AI.dmi'
|
||||
button_icon_state = "ai_shell"
|
||||
|
||||
/datum/action/innate/deploy_shell/Trigger()
|
||||
var/mob/living/silicon/ai/AI = owner
|
||||
if(!AI)
|
||||
return
|
||||
AI.deploy_to_shell()
|
||||
|
||||
/datum/action/innate/deploy_last_shell
|
||||
name = "Reconnect to shell"
|
||||
desc = "Reconnect to the most recently used AI shell."
|
||||
icon_icon = 'icons/mob/actions/actions_AI.dmi'
|
||||
button_icon_state = "ai_last_shell"
|
||||
var/mob/living/silicon/robot/last_used_shell
|
||||
|
||||
/datum/action/innate/deploy_last_shell/Trigger()
|
||||
if(!owner)
|
||||
return
|
||||
if(last_used_shell)
|
||||
var/mob/living/silicon/ai/AI = owner
|
||||
AI.deploy_to_shell(last_used_shell)
|
||||
else
|
||||
Remove(owner) //If the last shell is blown, destroy it.
|
||||
|
||||
/mob/living/silicon/ai/proc/disconnect_shell()
|
||||
if(deployed_shell) //Forcibly call back AI in event of things such as damage, EMP or power loss.
|
||||
to_chat(src, "<span class='danger'>Your remote connection has been reset!</span>")
|
||||
deployed_shell.undeploy()
|
||||
diag_hud_set_deployed()
|
||||
|
||||
/mob/living/silicon/ai/resist()
|
||||
return
|
||||
|
||||
/mob/living/silicon/ai/spawned/Initialize(mapload, datum/ai_laws/L, mob/target_ai)
|
||||
. = ..()
|
||||
if(!target_ai)
|
||||
target_ai = src //cheat! just give... ourselves as the spawned AI, because that's technically correct
|
||||
|
||||
/mob/living/silicon/ai/proc/camera_visibility(mob/camera/aiEye/moved_eye)
|
||||
GLOB.cameranet.visibility(moved_eye, client, all_eyes, USE_STATIC_OPAQUE)
|
||||
|
||||
/mob/living/silicon/ai/forceMove(atom/destination)
|
||||
. = ..()
|
||||
if(.)
|
||||
end_multicam()
|
||||
@@ -0,0 +1,56 @@
|
||||
/mob/living/silicon/ai/death(gibbed)
|
||||
if(stat == DEAD)
|
||||
return
|
||||
|
||||
. = ..()
|
||||
|
||||
var/old_icon = icon_state
|
||||
if("[icon_state]_dead" in icon_states(icon))
|
||||
icon_state = "[icon_state]_dead"
|
||||
else
|
||||
icon_state = "ai_dead"
|
||||
if("[old_icon]_death_transition" in icon_states(icon))
|
||||
flick("[old_icon]_death_transition", src)
|
||||
|
||||
cameraFollow = null
|
||||
|
||||
anchored = FALSE //unbolt floorbolts
|
||||
update_canmove()
|
||||
if(eyeobj)
|
||||
eyeobj.setLoc(get_turf(src))
|
||||
set_eyeobj_visible(FALSE)
|
||||
|
||||
GLOB.shuttle_caller_list -= src
|
||||
SSshuttle.autoEvac()
|
||||
|
||||
ShutOffDoomsdayDevice()
|
||||
|
||||
if(explosive)
|
||||
spawn(10)
|
||||
explosion(src.loc, 3, 6, 12, 15)
|
||||
|
||||
if(src.key)
|
||||
for(var/each in GLOB.ai_status_displays) //change status
|
||||
var/obj/machinery/status_display/ai/O = each
|
||||
O.mode = 2
|
||||
O.update()
|
||||
|
||||
if(istype(loc, /obj/item/aicard/aitater))
|
||||
loc.icon_state = "aitater-404"
|
||||
else if(istype(loc, /obj/item/aicard/aispook))
|
||||
loc.icon_state = "aispook-404"
|
||||
else if(istype(loc, /obj/item/aicard))
|
||||
loc.icon_state = "aicard-404"
|
||||
|
||||
/mob/living/silicon/ai/proc/ShutOffDoomsdayDevice()
|
||||
if(nuking)
|
||||
set_security_level("red")
|
||||
nuking = FALSE
|
||||
for(var/obj/item/pinpointer/nuke/P in GLOB.pinpointer_list)
|
||||
P.switch_mode_to(TRACK_NUKE_DISK) //Party's over, back to work, everyone
|
||||
P.alert = FALSE
|
||||
|
||||
if(doomsday_device)
|
||||
doomsday_device.timing = FALSE
|
||||
SSshuttle.clearHostileEnvironment(doomsday_device)
|
||||
qdel(doomsday_device)
|
||||
@@ -0,0 +1,206 @@
|
||||
// AI EYE
|
||||
//
|
||||
// An invisible (no icon) mob that the AI controls to look around the station with.
|
||||
// It streams chunks as it moves around, which will show it what the AI can and cannot see.
|
||||
|
||||
/mob/camera/aiEye
|
||||
name = "Inactive AI Eye"
|
||||
|
||||
icon_state = "ai_camera"
|
||||
icon = 'icons/mob/cameramob.dmi'
|
||||
invisibility = INVISIBILITY_MAXIMUM
|
||||
hud_possible = list(ANTAG_HUD, AI_DETECT_HUD = HUD_LIST_LIST)
|
||||
var/list/visibleCameraChunks = list()
|
||||
var/mob/living/silicon/ai/ai = null
|
||||
var/relay_speech = FALSE
|
||||
var/use_static = USE_STATIC_OPAQUE
|
||||
var/static_visibility_range = 16
|
||||
var/ai_detector_visible = TRUE
|
||||
var/ai_detector_color = COLOR_RED
|
||||
|
||||
/mob/camera/aiEye/Initialize()
|
||||
. = ..()
|
||||
GLOB.aiEyes += src
|
||||
update_ai_detect_hud()
|
||||
setLoc(loc, TRUE)
|
||||
|
||||
/mob/camera/aiEye/proc/update_ai_detect_hud()
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
var/list/old_images = hud_list[AI_DETECT_HUD]
|
||||
if(!ai_detector_visible)
|
||||
hud.remove_from_hud(src)
|
||||
QDEL_LIST(old_images)
|
||||
return
|
||||
|
||||
if(!hud.hudusers.len)
|
||||
//no one is watching, do not bother updating anything
|
||||
return
|
||||
hud.remove_from_hud(src)
|
||||
|
||||
var/static/list/vis_contents_objects = list()
|
||||
var/obj/effect/overlay/ai_detect_hud/hud_obj = vis_contents_objects[ai_detector_color]
|
||||
if(!hud_obj)
|
||||
hud_obj = new /obj/effect/overlay/ai_detect_hud()
|
||||
hud_obj.color = ai_detector_color
|
||||
vis_contents_objects[ai_detector_color] = hud_obj
|
||||
|
||||
var/list/new_images = list()
|
||||
var/list/turfs = get_visible_turfs()
|
||||
for(var/T in turfs)
|
||||
var/image/I = (old_images.len > new_images.len) ? old_images[new_images.len + 1] : image(null, T)
|
||||
I.loc = T
|
||||
I.vis_contents += hud_obj
|
||||
new_images += I
|
||||
for(var/i in (new_images.len + 1) to old_images.len)
|
||||
qdel(old_images[i])
|
||||
hud_list[AI_DETECT_HUD] = new_images
|
||||
hud.add_to_hud(src)
|
||||
|
||||
/mob/camera/aiEye/proc/get_visible_turfs()
|
||||
if(!isturf(loc))
|
||||
return list()
|
||||
var/client/C = GetViewerClient()
|
||||
var/view = C ? getviewsize(C.view) : getviewsize(world.view)
|
||||
var/turf/lowerleft = locate(max(1, x - (view[1] - 1)/2), max(1, y - (view[2] - 1)/2), z)
|
||||
var/turf/upperright = locate(min(world.maxx, lowerleft.x + (view[1] - 1)), min(world.maxy, lowerleft.y + (view[2] - 1)), lowerleft.z)
|
||||
return block(lowerleft, upperright)
|
||||
|
||||
// Use this when setting the aiEye's location.
|
||||
// It will also stream the chunk that the new loc is in.
|
||||
|
||||
/mob/camera/aiEye/proc/setLoc(T, force_update = FALSE)
|
||||
if(ai)
|
||||
if(!isturf(ai.loc))
|
||||
return
|
||||
T = get_turf(T)
|
||||
if(!force_update && (T == get_turf(src)) )
|
||||
return //we are already here!
|
||||
if (T)
|
||||
forceMove(T)
|
||||
else
|
||||
moveToNullspace()
|
||||
if(use_static != USE_STATIC_NONE)
|
||||
ai.camera_visibility(src)
|
||||
if(ai.client && !ai.multicam_on)
|
||||
ai.client.eye = src
|
||||
update_ai_detect_hud()
|
||||
update_parallax_contents()
|
||||
//Holopad
|
||||
if(istype(ai.current, /obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = ai.current
|
||||
H.move_hologram(ai, T)
|
||||
if(ai.camera_light_on)
|
||||
ai.light_cameras()
|
||||
if(ai.master_multicam)
|
||||
ai.master_multicam.refresh_view()
|
||||
|
||||
/mob/camera/aiEye/Move()
|
||||
return 0
|
||||
|
||||
/mob/camera/aiEye/proc/GetViewerClient()
|
||||
if(ai)
|
||||
return ai.client
|
||||
return null
|
||||
|
||||
/mob/camera/aiEye/Destroy()
|
||||
if(ai)
|
||||
ai.all_eyes -= src
|
||||
ai = null
|
||||
for(var/V in visibleCameraChunks)
|
||||
var/datum/camerachunk/c = V
|
||||
c.remove(src)
|
||||
GLOB.aiEyes -= src
|
||||
if(ai_detector_visible)
|
||||
var/datum/atom_hud/ai_detector/hud = GLOB.huds[DATA_HUD_AI_DETECT]
|
||||
hud.remove_from_hud(src)
|
||||
var/list/L = hud_list[AI_DETECT_HUD]
|
||||
QDEL_LIST(L)
|
||||
return ..()
|
||||
|
||||
/atom/proc/move_camera_by_click()
|
||||
if(isAI(usr))
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
if(AI.eyeobj && (AI.multicam_on || (AI.client.eye == AI.eyeobj)) && (AI.eyeobj.z == z))
|
||||
AI.cameraFollow = null
|
||||
if (isturf(loc) || isturf(src))
|
||||
AI.eyeobj.setLoc(src)
|
||||
|
||||
// This will move the AIEye. It will also cause lights near the eye to light up, if toggled.
|
||||
// This is handled in the proc below this one.
|
||||
|
||||
/client/proc/AIMove(n, direct, mob/living/silicon/ai/user)
|
||||
|
||||
var/initial = initial(user.sprint)
|
||||
var/max_sprint = 50
|
||||
|
||||
if(user.cooldown && user.cooldown < world.timeofday) // 3 seconds
|
||||
user.sprint = initial
|
||||
|
||||
for(var/i = 0; i < max(user.sprint, initial); i += 20)
|
||||
var/turf/step = get_turf(get_step(user.eyeobj, direct))
|
||||
if(step)
|
||||
user.eyeobj.setLoc(step)
|
||||
|
||||
user.cooldown = world.timeofday + 5
|
||||
if(user.acceleration)
|
||||
user.sprint = min(user.sprint + 0.5, max_sprint)
|
||||
else
|
||||
user.sprint = initial
|
||||
|
||||
if(!user.tracking)
|
||||
user.cameraFollow = null
|
||||
|
||||
// Return to the Core.
|
||||
/mob/living/silicon/ai/proc/view_core()
|
||||
if(istype(current,/obj/machinery/holopad))
|
||||
var/obj/machinery/holopad/H = current
|
||||
H.clear_holo(src)
|
||||
else
|
||||
current = null
|
||||
cameraFollow = null
|
||||
unset_machine()
|
||||
|
||||
if(isturf(loc) && (QDELETED(eyeobj) || !eyeobj.loc))
|
||||
to_chat(src, "ERROR: Eyeobj not found. Creating new eye...")
|
||||
create_eye()
|
||||
|
||||
eyeobj?.setLoc(loc)
|
||||
|
||||
/mob/living/silicon/ai/proc/create_eye()
|
||||
if(eyeobj)
|
||||
return
|
||||
eyeobj = new /mob/camera/aiEye()
|
||||
all_eyes += eyeobj
|
||||
eyeobj.ai = src
|
||||
eyeobj.setLoc(loc)
|
||||
eyeobj.name = "[name] (AI Eye)"
|
||||
set_eyeobj_visible(TRUE)
|
||||
|
||||
/mob/living/silicon/ai/proc/set_eyeobj_visible(state = TRUE)
|
||||
if(!eyeobj)
|
||||
return
|
||||
eyeobj.mouse_opacity = state ? MOUSE_OPACITY_ICON : initial(eyeobj.mouse_opacity)
|
||||
eyeobj.invisibility = state ? INVISIBILITY_OBSERVER : initial(eyeobj.invisibility)
|
||||
|
||||
/mob/living/silicon/ai/verb/toggle_acceleration()
|
||||
set category = "AI Commands"
|
||||
set name = "Toggle Camera Acceleration"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
acceleration = !acceleration
|
||||
to_chat(usr, "Camera acceleration has been toggled [acceleration ? "on" : "off"].")
|
||||
|
||||
/mob/camera/aiEye/Hear(message, atom/movable/speaker, datum/language/message_language, raw_message, radio_freq, list/spans, message_mode)
|
||||
. = ..()
|
||||
if(relay_speech && speaker && ai && !radio_freq && speaker != ai && near_camera(speaker))
|
||||
ai.relay_speech(message, speaker, message_language, raw_message, radio_freq, spans, message_mode)
|
||||
|
||||
/obj/effect/overlay/ai_detect_hud
|
||||
name = ""
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
icon = 'icons/effects/alphacolors.dmi'
|
||||
icon_state = ""
|
||||
alpha = 100
|
||||
layer = ABOVE_ALL_MOB_LAYER
|
||||
plane = GAME_PLANE
|
||||
@@ -0,0 +1,181 @@
|
||||
#define POWER_RESTORATION_OFF 0
|
||||
#define POWER_RESTORATION_START 1
|
||||
#define POWER_RESTORATION_SEARCH_APC 2
|
||||
#define POWER_RESTORATION_APC_FOUND 3
|
||||
|
||||
/mob/living/silicon/ai/Life()
|
||||
if (stat == DEAD)
|
||||
return
|
||||
else //I'm not removing that shitton of tabs, unneeded as they are. -- Urist
|
||||
//Being dead doesn't mean your temperature never changes
|
||||
|
||||
update_gravity(mob_has_gravity())
|
||||
|
||||
handle_status_effects()
|
||||
|
||||
if(malfhack && malfhack.aidisabled)
|
||||
deltimer(malfhacking)
|
||||
// This proc handles cleanup of screen notifications and
|
||||
// messenging the client
|
||||
malfhacked(malfhack)
|
||||
|
||||
if(isturf(loc) && (QDELETED(eyeobj) || !eyeobj.loc))
|
||||
view_core()
|
||||
|
||||
if(machine)
|
||||
machine.check_eye(src)
|
||||
|
||||
// Handle power damage (oxy)
|
||||
if(aiRestorePowerRoutine)
|
||||
// Lost power
|
||||
adjustOxyLoss(1)
|
||||
else
|
||||
// Gain Power
|
||||
if(getOxyLoss())
|
||||
adjustOxyLoss(-1)
|
||||
|
||||
if(!lacks_power())
|
||||
var/area/home = get_area(src)
|
||||
if(home.powered(EQUIP))
|
||||
home.use_power(1000, EQUIP)
|
||||
|
||||
if(aiRestorePowerRoutine >= POWER_RESTORATION_SEARCH_APC)
|
||||
ai_restore_power()
|
||||
return
|
||||
|
||||
else if(!aiRestorePowerRoutine)
|
||||
ai_lose_power()
|
||||
|
||||
/mob/living/silicon/ai/proc/lacks_power()
|
||||
var/turf/T = get_turf(src)
|
||||
var/area/A = get_area(src)
|
||||
switch(requires_power)
|
||||
if(NONE)
|
||||
return FALSE
|
||||
if(POWER_REQ_ALL)
|
||||
return !T || !A || ((!A.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
|
||||
if(POWER_REQ_CLOCKCULT)
|
||||
for(var/obj/effect/clockwork/sigil/transmission/ST in range(src, SIGIL_ACCESS_RANGE))
|
||||
return FALSE
|
||||
return !T || !A || (!istype(T, /turf/open/floor/clockwork) && (!A.power_equip || isspaceturf(T)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
|
||||
|
||||
/mob/living/silicon/ai/updatehealth()
|
||||
if(status_flags & GODMODE)
|
||||
return
|
||||
health = maxHealth - getOxyLoss() - getToxLoss() - getBruteLoss() - getFireLoss()
|
||||
update_stat()
|
||||
diag_hud_set_health()
|
||||
disconnect_shell()
|
||||
|
||||
/mob/living/silicon/ai/update_stat()
|
||||
if(status_flags & GODMODE)
|
||||
return
|
||||
if(stat != DEAD)
|
||||
if(health <= HEALTH_THRESHOLD_DEAD)
|
||||
death()
|
||||
return
|
||||
else if(stat == UNCONSCIOUS)
|
||||
stat = CONSCIOUS
|
||||
adjust_blindness(-1)
|
||||
diag_hud_set_status()
|
||||
|
||||
/mob/living/silicon/ai/update_sight()
|
||||
see_invisible = initial(see_invisible)
|
||||
see_in_dark = initial(see_in_dark)
|
||||
sight = initial(sight)
|
||||
if(aiRestorePowerRoutine)
|
||||
sight = sight&~SEE_TURFS
|
||||
sight = sight&~SEE_MOBS
|
||||
sight = sight&~SEE_OBJS
|
||||
see_in_dark = 0
|
||||
|
||||
if(see_override)
|
||||
see_invisible = see_override
|
||||
sync_lighting_plane_alpha()
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/start_RestorePowerRoutine()
|
||||
to_chat(src, "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection.")
|
||||
end_multicam()
|
||||
sleep(50)
|
||||
var/turf/T = get_turf(src)
|
||||
var/area/AIarea = get_area(src)
|
||||
if(AIarea && AIarea.power_equip)
|
||||
if(!isspaceturf(T))
|
||||
ai_restore_power()
|
||||
return
|
||||
to_chat(src, "Fault confirmed: missing external power. Shutting down main control system to save power.")
|
||||
sleep(20)
|
||||
to_chat(src, "Emergency control system online. Verifying connection to power network.")
|
||||
sleep(50)
|
||||
T = get_turf(src)
|
||||
if(isspaceturf(T))
|
||||
to_chat(src, "Unable to verify! No power connection detected!")
|
||||
aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC
|
||||
return
|
||||
to_chat(src, "Connection verified. Searching for APC in power network.")
|
||||
sleep(50)
|
||||
var/obj/machinery/power/apc/theAPC = null
|
||||
|
||||
var/PRP //like ERP with the code, at least this stuff is no more 4x sametext
|
||||
for (PRP=1, PRP<=4, PRP++)
|
||||
T = get_turf(src)
|
||||
AIarea = get_area(src)
|
||||
if(AIarea)
|
||||
for (var/obj/machinery/power/apc/APC in AIarea)
|
||||
if (!(APC.stat & BROKEN))
|
||||
theAPC = APC
|
||||
break
|
||||
if (!theAPC)
|
||||
switch(PRP)
|
||||
if(1)
|
||||
to_chat(src, "Unable to locate APC!")
|
||||
else
|
||||
to_chat(src, "Lost connection with the APC!")
|
||||
aiRestorePowerRoutine = POWER_RESTORATION_SEARCH_APC
|
||||
return
|
||||
if(AIarea.power_equip)
|
||||
if(!isspaceturf(T))
|
||||
ai_restore_power()
|
||||
return
|
||||
switch(PRP)
|
||||
if (1)
|
||||
to_chat(src, "APC located. Optimizing route to APC to avoid needless power waste.")
|
||||
if (2)
|
||||
to_chat(src, "Best route identified. Hacking offline APC power port.")
|
||||
if (3)
|
||||
to_chat(src, "Power port upload access confirmed. Loading control program into APC power port software.")
|
||||
if (4)
|
||||
to_chat(src, "Transfer complete. Forcing APC to execute program.")
|
||||
sleep(50)
|
||||
to_chat(src, "Receiving control information from APC.")
|
||||
sleep(2)
|
||||
apc_override = 1
|
||||
theAPC.ui_interact(src, state = GLOB.conscious_state)
|
||||
apc_override = 0
|
||||
aiRestorePowerRoutine = POWER_RESTORATION_APC_FOUND
|
||||
sleep(50)
|
||||
theAPC = null
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_restore_power()
|
||||
if(aiRestorePowerRoutine)
|
||||
if(aiRestorePowerRoutine == POWER_RESTORATION_APC_FOUND)
|
||||
to_chat(src, "Alert cancelled. Power has been restored.")
|
||||
else
|
||||
to_chat(src, "Alert cancelled. Power has been restored without our assistance.")
|
||||
aiRestorePowerRoutine = POWER_RESTORATION_OFF
|
||||
set_blindness(0)
|
||||
update_sight()
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_lose_power()
|
||||
disconnect_shell()
|
||||
aiRestorePowerRoutine = POWER_RESTORATION_START
|
||||
blind_eyes(1)
|
||||
update_sight()
|
||||
to_chat(src, "You've lost power!")
|
||||
addtimer(CALLBACK(src, .proc/start_RestorePowerRoutine), 20)
|
||||
|
||||
#undef POWER_RESTORATION_OFF
|
||||
#undef POWER_RESTORATION_START
|
||||
#undef POWER_RESTORATION_SEARCH_APC
|
||||
#undef POWER_RESTORATION_APC_FOUND
|
||||
@@ -0,0 +1,12 @@
|
||||
/mob/living/silicon/ai/Login()
|
||||
..()
|
||||
if(stat != DEAD)
|
||||
for(var/each in GLOB.ai_status_displays) //change status
|
||||
var/obj/machinery/status_display/ai/O = each
|
||||
O.mode = 1
|
||||
O.emotion = "Neutral"
|
||||
O.update()
|
||||
set_eyeobj_visible(TRUE)
|
||||
if(multicam_on)
|
||||
end_multicam()
|
||||
view_core()
|
||||
@@ -0,0 +1,8 @@
|
||||
/mob/living/silicon/ai/Logout()
|
||||
..()
|
||||
for(var/each in GLOB.ai_status_displays) //change status
|
||||
var/obj/machinery/status_display/ai/O = each
|
||||
O.mode = 0
|
||||
O.update()
|
||||
set_eyeobj_visible(FALSE)
|
||||
view_core()
|
||||
@@ -0,0 +1,270 @@
|
||||
//Picture in picture
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai
|
||||
var/mob/living/silicon/ai/ai
|
||||
var/mutable_appearance/highlighted_background
|
||||
var/highlighted = FALSE
|
||||
var/mob/camera/aiEye/pic_in_pic/aiEye
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/Initialize()
|
||||
. = ..()
|
||||
aiEye = new /mob/camera/aiEye/pic_in_pic()
|
||||
aiEye.screen = src
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/Destroy()
|
||||
set_ai(null)
|
||||
QDEL_NULL(aiEye)
|
||||
return ..()
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/Click()
|
||||
..()
|
||||
if(ai)
|
||||
ai.select_main_multicam_window(src)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/make_backgrounds()
|
||||
..()
|
||||
highlighted_background = new /mutable_appearance()
|
||||
highlighted_background.icon = 'icons/misc/pic_in_pic.dmi'
|
||||
highlighted_background.icon_state = "background_highlight"
|
||||
highlighted_background.layer = SPACE_LAYER
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/add_background()
|
||||
if((width > 0) && (height > 0))
|
||||
var/matrix/M = matrix()
|
||||
M.Scale(width + 0.5, height + 0.5)
|
||||
M.Translate((width-1)/2 * world.icon_size, (height-1)/2 * world.icon_size)
|
||||
highlighted_background.transform = M
|
||||
standard_background.transform = M
|
||||
add_overlay(highlighted ? highlighted_background : standard_background)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/set_view_size(width, height, do_refresh = TRUE)
|
||||
aiEye.static_visibility_range = (round(max(width, height) / 2) + 1)
|
||||
if(ai)
|
||||
ai.camera_visibility(aiEye)
|
||||
..()
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/set_view_center(atom/target, do_refresh = TRUE)
|
||||
..()
|
||||
aiEye.setLoc(get_turf(target))
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/refresh_view()
|
||||
..()
|
||||
aiEye.setLoc(get_turf(center))
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/proc/highlight()
|
||||
if(highlighted)
|
||||
return
|
||||
highlighted = TRUE
|
||||
cut_overlay(standard_background)
|
||||
add_overlay(highlighted_background)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/proc/unhighlight()
|
||||
if(!highlighted)
|
||||
return
|
||||
highlighted = FALSE
|
||||
cut_overlay(highlighted_background)
|
||||
add_overlay(standard_background)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/ai/proc/set_ai(mob/living/silicon/ai/new_ai)
|
||||
if(ai)
|
||||
ai.multicam_screens -= src
|
||||
ai.all_eyes -= aiEye
|
||||
if(ai.master_multicam == src)
|
||||
ai.master_multicam = null
|
||||
if(ai.multicam_on)
|
||||
unshow_to(ai.client)
|
||||
ai = new_ai
|
||||
if(new_ai)
|
||||
new_ai.multicam_screens += src
|
||||
ai.all_eyes += aiEye
|
||||
if(new_ai.multicam_on)
|
||||
show_to(new_ai.client)
|
||||
|
||||
//Turf, area, and landmark for the viewing room
|
||||
|
||||
/turf/open/ai_visible
|
||||
name = ""
|
||||
icon = 'icons/misc/pic_in_pic.dmi'
|
||||
icon_state = "room_background"
|
||||
flags_1 = NOJAUNT_1
|
||||
|
||||
/area/ai_multicam_room
|
||||
name = "ai_multicam_room"
|
||||
icon_state = "ai_camera_room"
|
||||
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
|
||||
valid_territory = FALSE
|
||||
ambientsounds = list()
|
||||
blob_allowed = FALSE
|
||||
noteleport = TRUE
|
||||
hidden = TRUE
|
||||
safe = TRUE
|
||||
|
||||
GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room)
|
||||
|
||||
/obj/effect/landmark/ai_multicam_room
|
||||
name = "ai camera room"
|
||||
icon = 'icons/mob/landmarks.dmi'
|
||||
icon_state = "x"
|
||||
|
||||
/obj/effect/landmark/ai_multicam_room/Initialize()
|
||||
. = ..()
|
||||
qdel(GLOB.ai_camera_room_landmark)
|
||||
GLOB.ai_camera_room_landmark = src
|
||||
|
||||
/obj/effect/landmark/ai_multicam_room/Destroy()
|
||||
if(GLOB.ai_camera_room_landmark == src)
|
||||
GLOB.ai_camera_room_landmark = null
|
||||
return ..()
|
||||
|
||||
//Dummy camera eyes
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic
|
||||
name = "Secondary AI Eye"
|
||||
invisibility = INVISIBILITY_OBSERVER
|
||||
mouse_opacity = MOUSE_OPACITY_ICON
|
||||
icon_state = "ai_pip_camera"
|
||||
var/obj/screen/movable/pic_in_pic/ai/screen
|
||||
var/list/cameras_telegraphed = list()
|
||||
var/telegraph_cameras = TRUE
|
||||
var/telegraph_range = 7
|
||||
ai_detector_color = COLOR_ORANGE
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/GetViewerClient()
|
||||
if(screen && screen.ai)
|
||||
return screen.ai.client
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/setLoc(turf/T)
|
||||
if (T)
|
||||
forceMove(T)
|
||||
else
|
||||
moveToNullspace()
|
||||
if(screen && screen.ai)
|
||||
screen.ai.camera_visibility(src)
|
||||
else
|
||||
GLOB.cameranet.visibility(src)
|
||||
update_camera_telegraphing()
|
||||
update_ai_detect_hud()
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/get_visible_turfs()
|
||||
return screen ? screen.get_visible_turfs() : list()
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/proc/update_camera_telegraphing()
|
||||
if(!telegraph_cameras)
|
||||
return
|
||||
var/list/obj/machinery/camera/add = list()
|
||||
var/list/obj/machinery/camera/remove = list()
|
||||
var/list/obj/machinery/camera/visible = list()
|
||||
for (var/VV in visibleCameraChunks)
|
||||
var/datum/camerachunk/CC = VV
|
||||
for (var/V in CC.cameras)
|
||||
var/obj/machinery/camera/C = V
|
||||
if (!C.can_use() || (get_dist(C, src) > telegraph_range))
|
||||
continue
|
||||
visible |= C
|
||||
|
||||
add = visible - cameras_telegraphed
|
||||
remove = cameras_telegraphed - visible
|
||||
|
||||
for (var/V in remove)
|
||||
var/obj/machinery/camera/C = V
|
||||
if(QDELETED(C))
|
||||
continue
|
||||
cameras_telegraphed -= C
|
||||
C.in_use_lights--
|
||||
C.update_icon()
|
||||
for (var/V in add)
|
||||
var/obj/machinery/camera/C = V
|
||||
if(QDELETED(C))
|
||||
continue
|
||||
cameras_telegraphed |= C
|
||||
C.in_use_lights++
|
||||
C.update_icon()
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/proc/disable_camera_telegraphing()
|
||||
telegraph_cameras = FALSE
|
||||
for (var/V in cameras_telegraphed)
|
||||
var/obj/machinery/camera/C = V
|
||||
if(QDELETED(C))
|
||||
continue
|
||||
C.in_use_lights--
|
||||
C.update_icon()
|
||||
cameras_telegraphed.Cut()
|
||||
|
||||
/mob/camera/aiEye/pic_in_pic/Destroy()
|
||||
disable_camera_telegraphing()
|
||||
return ..()
|
||||
|
||||
//AI procs
|
||||
|
||||
/mob/living/silicon/ai/proc/drop_new_multicam(silent = FALSE)
|
||||
if(!CONFIG_GET(flag/allow_ai_multicam))
|
||||
if(!silent)
|
||||
to_chat(src, "<span class='warning'>This action is currently disabled. Contact an administrator to enable this feature.</span>")
|
||||
return
|
||||
if(!eyeobj)
|
||||
return
|
||||
if(multicam_screens.len >= max_multicams)
|
||||
if(!silent)
|
||||
to_chat(src, "<span class='warning'>Cannot place more than [max_multicams] multicamera windows.</span>")
|
||||
return
|
||||
var/obj/screen/movable/pic_in_pic/ai/C = new /obj/screen/movable/pic_in_pic/ai()
|
||||
C.set_view_size(3, 3, FALSE)
|
||||
C.set_view_center(get_turf(eyeobj))
|
||||
C.set_ai(src)
|
||||
if(!silent)
|
||||
to_chat(src, "<span class='notice'>Added new multicamera window.</span>")
|
||||
return C
|
||||
|
||||
/mob/living/silicon/ai/proc/toggle_multicam()
|
||||
if(!CONFIG_GET(flag/allow_ai_multicam))
|
||||
to_chat(src, "<span class='warning'>This action is currently disabled. Contact an administrator to enable this feature.</span>")
|
||||
return
|
||||
if(multicam_on)
|
||||
end_multicam()
|
||||
else
|
||||
start_multicam()
|
||||
|
||||
/mob/living/silicon/ai/proc/start_multicam()
|
||||
if(multicam_on || aiRestorePowerRoutine || !isturf(loc))
|
||||
return
|
||||
if(!GLOB.ai_camera_room_landmark)
|
||||
to_chat(src, "<span class='warning'>This function is not available at this time.</span>")
|
||||
return
|
||||
multicam_on = TRUE
|
||||
refresh_multicam()
|
||||
to_chat(src, "<span class='notice'>Multiple-camera viewing mode activated.</span>")
|
||||
|
||||
/mob/living/silicon/ai/proc/refresh_multicam()
|
||||
reset_perspective(GLOB.ai_camera_room_landmark)
|
||||
if(client)
|
||||
for(var/V in multicam_screens)
|
||||
var/obj/screen/movable/pic_in_pic/P = V
|
||||
P.show_to(client)
|
||||
|
||||
/mob/living/silicon/ai/proc/end_multicam()
|
||||
if(!multicam_on)
|
||||
return
|
||||
multicam_on = FALSE
|
||||
select_main_multicam_window(null)
|
||||
if(client)
|
||||
for(var/V in multicam_screens)
|
||||
var/obj/screen/movable/pic_in_pic/P = V
|
||||
P.unshow_to(client)
|
||||
reset_perspective()
|
||||
to_chat(src, "<span class='notice'>Multiple-camera viewing mode deactivated.</span>")
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/select_main_multicam_window(obj/screen/movable/pic_in_pic/ai/P)
|
||||
if(master_multicam == P)
|
||||
return
|
||||
|
||||
if(master_multicam)
|
||||
master_multicam.set_view_center(get_turf(eyeobj), FALSE)
|
||||
master_multicam.unhighlight()
|
||||
master_multicam = null
|
||||
|
||||
if(P)
|
||||
P.highlight()
|
||||
eyeobj.setLoc(get_turf(P.center))
|
||||
P.set_view_center(eyeobj)
|
||||
master_multicam = P
|
||||
@@ -0,0 +1,179 @@
|
||||
/mob/living/silicon/ai/say(message, bubble_type,var/list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
if(parent && istype(parent) && parent.stat != DEAD) //If there is a defined "parent" AI, it is actually an AI, and it is alive, anything the AI tries to say is said by the parent instead.
|
||||
parent.say(message, language)
|
||||
return
|
||||
..(message)
|
||||
|
||||
/mob/living/silicon/ai/compose_track_href(atom/movable/speaker, namepart)
|
||||
var/mob/M = speaker.GetSource()
|
||||
if(M)
|
||||
return "<a href='?src=[REF(src)];track=[html_encode(namepart)]'>"
|
||||
return ""
|
||||
|
||||
/mob/living/silicon/ai/compose_job(atom/movable/speaker, message_langs, raw_message, radio_freq)
|
||||
//Also includes the </a> for AI hrefs, for convenience.
|
||||
return "[radio_freq ? " (" + speaker.GetJob() + ")" : ""]" + "[speaker.GetSource() ? "</a>" : ""]"
|
||||
|
||||
/mob/living/silicon/ai/IsVocal()
|
||||
return !CONFIG_GET(flag/silent_ai)
|
||||
|
||||
/mob/living/silicon/ai/radio(message, message_mode, list/spans, language)
|
||||
if(incapacitated())
|
||||
return FALSE
|
||||
if(!radio_enabled) //AI cannot speak if radio is disabled (via intellicard) or depowered.
|
||||
to_chat(src, "<span class='danger'>Your radio transmitter is offline!</span>")
|
||||
return FALSE
|
||||
..()
|
||||
|
||||
/mob/living/silicon/ai/get_message_mode(message)
|
||||
if(copytext(message, 1, 3) in list(":h", ":H", ".h", ".H", "#h", "#H"))
|
||||
return MODE_HOLOPAD
|
||||
else
|
||||
return ..()
|
||||
|
||||
//For holopads only. Usable by AI.
|
||||
/mob/living/silicon/ai/proc/holopad_talk(message, language)
|
||||
|
||||
|
||||
message = trim(message)
|
||||
|
||||
if (!message)
|
||||
return
|
||||
|
||||
var/obj/machinery/holopad/T = current
|
||||
if(istype(T) && T.masters[src])//If there is a hologram and its master is the user.
|
||||
var/turf/padturf = get_turf(T)
|
||||
var/padloc
|
||||
if(padturf)
|
||||
padloc = AREACOORD(padturf)
|
||||
else
|
||||
padloc = "(UNKNOWN)"
|
||||
src.log_talk(message, LOG_SAY, tag="HOLOPAD in [padloc]")
|
||||
send_speech(message, 7, T, "robot", language)
|
||||
to_chat(src, "<i><span class='game say'>Holopad transmitted, <span class='name'>[real_name]</span> <span class='message robot'>\"[message]\"</span></span></i>")
|
||||
else
|
||||
to_chat(src, "No holopad connected.")
|
||||
|
||||
|
||||
// Make sure that the code compiles with AI_VOX undefined
|
||||
#ifdef AI_VOX
|
||||
#define VOX_DELAY 600
|
||||
/mob/living/silicon/ai/verb/announcement_help()
|
||||
|
||||
set name = "Announcement Help"
|
||||
set desc = "Display a list of vocal words to announce to the crew."
|
||||
set category = "AI Commands"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
var/dat = {"
|
||||
<font class='bad'>WARNING:</font> Misuse of the announcement system will get you job banned.<BR><BR>
|
||||
Here is a list of words you can type into the 'Announcement' button to create sentences to vocally announce to everyone on the same level at you.<BR>
|
||||
<UL><LI>You can also click on the word to PREVIEW it.</LI>
|
||||
<LI>You can only say 30 words for every announcement.</LI>
|
||||
<LI>Do not use punctuation as you would normally, if you want a pause you can use the full stop and comma characters by separating them with spaces, like so: 'Alpha . Test , Bravo'.</LI>
|
||||
<LI>Numbers are in word format, e.g. eight, sixty, etc </LI>
|
||||
<LI>Sound effects begin with an 's' before the actual word, e.g. scensor</LI>
|
||||
<LI>Use Ctrl+F to see if a word exists in the list.</LI></UL><HR>
|
||||
"}
|
||||
|
||||
var/index = 0
|
||||
for(var/word in GLOB.vox_sounds)
|
||||
index++
|
||||
dat += "<A href='?src=[REF(src)];say_word=[word]'>[capitalize(word)]</A>"
|
||||
if(index != GLOB.vox_sounds.len)
|
||||
dat += " / "
|
||||
|
||||
var/datum/browser/popup = new(src, "announce_help", "Announcement Help", 500, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/announcement()
|
||||
var/static/announcing_vox = 0 // Stores the time of the last announcement
|
||||
if(announcing_vox > world.time)
|
||||
to_chat(src, "<span class='notice'>Please wait [DisplayTimeText(announcing_vox - world.time)].</span>")
|
||||
return
|
||||
|
||||
var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", src.last_announcement) as text
|
||||
|
||||
last_announcement = message
|
||||
|
||||
var/voxType = input(src, "Male or female VOX?", "VOX-gender") in list("male", "female")
|
||||
|
||||
if(!message || announcing_vox > world.time)
|
||||
return
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(control_disabled)
|
||||
to_chat(src, "<span class='warning'>Wireless interface disabled, unable to interact with announcement PA.</span>")
|
||||
return
|
||||
|
||||
var/list/words = splittext(trim(message), " ")
|
||||
var/list/incorrect_words = list()
|
||||
|
||||
if(words.len > 30)
|
||||
words.len = 30
|
||||
|
||||
for(var/word in words)
|
||||
word = lowertext(trim(word))
|
||||
if(!word)
|
||||
words -= word
|
||||
continue
|
||||
if(!GLOB.vox_sounds[word] && voxType == "female")
|
||||
incorrect_words += word
|
||||
if(!GLOB.vox_sounds_male[word] && voxType == "male")
|
||||
incorrect_words += word
|
||||
|
||||
if(incorrect_words.len)
|
||||
to_chat(src, "<span class='notice'>These words are not available on the announcement system: [english_list(incorrect_words)].</span>")
|
||||
return
|
||||
|
||||
announcing_vox = world.time + VOX_DELAY
|
||||
|
||||
log_game("[key_name(src)] made a vocal announcement with the following message: [message].")
|
||||
|
||||
for(var/word in words)
|
||||
play_vox_word(word, src.z, null, voxType)
|
||||
|
||||
|
||||
/proc/play_vox_word(word, z_level, mob/only_listener, voxType = "female")
|
||||
|
||||
word = lowertext(word)
|
||||
|
||||
if( (GLOB.vox_sounds[word] && voxType == "female") || (GLOB.vox_sounds_male[word] && voxType == "male") )
|
||||
|
||||
var/sound_file
|
||||
|
||||
if(voxType == "female")
|
||||
sound_file = GLOB.vox_sounds[word]
|
||||
else
|
||||
sound_file = GLOB.vox_sounds_male[word]
|
||||
var/sound/voice = sound(sound_file, wait = 1, channel = CHANNEL_VOX)
|
||||
voice.status = SOUND_STREAM
|
||||
|
||||
// If there is no single listener, broadcast to everyone in the same z level
|
||||
if(!only_listener)
|
||||
// Play voice for all mobs in the z level
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
if(M.client && M.can_hear() && (M.client.prefs.toggles & SOUND_ANNOUNCEMENTS))
|
||||
var/turf/T = get_turf(M)
|
||||
if(T.z == z_level)
|
||||
SEND_SOUND(M, voice)
|
||||
else
|
||||
SEND_SOUND(only_listener, voice)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
#undef VOX_DELAY
|
||||
#endif
|
||||
|
||||
/mob/living/silicon/ai/could_speak_in_language(datum/language/dt)
|
||||
if(is_servant_of_ratvar(src))
|
||||
// Ratvarian AIs can only speak Ratvarian
|
||||
. = ispath(dt, /datum/language/ratvar)
|
||||
else
|
||||
. = ..()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,43 @@
|
||||
|
||||
/mob/living/silicon/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE)
|
||||
var/hit_percent = (100-blocked)/100
|
||||
if(!damage || (!forced && hit_percent <= 0))
|
||||
return 0
|
||||
var/damage_amount = forced ? damage : damage * hit_percent
|
||||
switch(damagetype)
|
||||
if(BRUTE)
|
||||
adjustBruteLoss(damage_amount, forced = forced)
|
||||
if(BURN)
|
||||
adjustFireLoss(damage_amount, forced = forced)
|
||||
if(OXY)
|
||||
if(damage < 0 || forced) //we shouldn't be taking oxygen damage through this proc, but we'll let it heal.
|
||||
adjustOxyLoss(damage_amount, forced = forced)
|
||||
return 1
|
||||
|
||||
|
||||
/mob/living/silicon/apply_effect(effect = 0,effecttype = EFFECT_STUN, blocked = FALSE)
|
||||
return FALSE //The only effect that can hit them atm is flashes and they still directly edit so this works for now
|
||||
|
||||
/mob/living/silicon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) //immune to tox damage
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/setToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) //immune to clone damage
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/setCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/adjustStaminaLoss(amount, updating_stamina = 1, forced = FALSE)//immune to stamina damage.
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/setStaminaLoss(amount, updating_stamina = 1)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/adjustOrganLoss(slot, amount, maximum = 500)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/setOrganLoss(slot, amount)
|
||||
return FALSE
|
||||
@@ -0,0 +1,13 @@
|
||||
/mob/living/silicon/spawn_gibs(with_bodyparts, atom/loc_override)
|
||||
new /obj/effect/gibspawner/robot(loc_override ? loc_override.drop_location() : drop_location(), src)
|
||||
|
||||
/mob/living/silicon/spawn_dust()
|
||||
new /obj/effect/decal/remains/robot(loc)
|
||||
|
||||
/mob/living/silicon/death(gibbed)
|
||||
if(!gibbed)
|
||||
emote("deathgasp")
|
||||
diag_hud_set_status()
|
||||
diag_hud_set_health()
|
||||
update_health_hud()
|
||||
. = ..()
|
||||
@@ -58,10 +58,7 @@
|
||||
var/canholo = TRUE
|
||||
var/obj/item/card/id/access_card = null
|
||||
var/chassis = "repairbot"
|
||||
var/list/possible_chassis = list("cat" = TRUE, "mouse" = TRUE, "monkey" = TRUE, "corgi" = FALSE,
|
||||
"fox" = FALSE, "repairbot" = TRUE, "rabbit" = TRUE, "borgi" = FALSE ,
|
||||
"parrot" = FALSE, "bear" = FALSE , "mushroom" = FALSE, "crow" = FALSE ,
|
||||
"fairy" = FALSE , "spiderbot" = FALSE) //assoc value is whether it can be picked up.
|
||||
var/list/possible_chassis = list("cat" = TRUE, "mouse" = TRUE, "monkey" = TRUE, "corgi" = FALSE, "fox" = FALSE, "repairbot" = TRUE, "rabbit" = TRUE) //assoc value is whether it can be picked up.
|
||||
var/static/item_head_icon = 'icons/mob/pai_item_head.dmi'
|
||||
var/static/item_lh_icon = 'icons/mob/pai_item_lh.dmi'
|
||||
var/static/item_rh_icon = 'icons/mob/pai_item_rh.dmi'
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
/mob/living/silicon/pai/blob_act(obj/structure/blob/B)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
take_holo_damage(50/severity)
|
||||
Knockdown(400/severity)
|
||||
silent = max(30/severity, silent)
|
||||
if(holoform)
|
||||
fold_in(force = TRUE)
|
||||
//Need more effects that aren't instadeath or permanent law corruption.
|
||||
|
||||
/mob/living/silicon/pai/ex_act(severity, target)
|
||||
take_holo_damage(severity * 50)
|
||||
switch(severity)
|
||||
if(1) //RIP
|
||||
qdel(card)
|
||||
qdel(src)
|
||||
if(2)
|
||||
fold_in(force = 1)
|
||||
Knockdown(400)
|
||||
if(3)
|
||||
fold_in(force = 1)
|
||||
Knockdown(200)
|
||||
|
||||
/mob/living/silicon/pai/attack_hand(mob/living/carbon/human/user)
|
||||
switch(user.a_intent)
|
||||
if("help")
|
||||
visible_message("<span class='notice'>[user] gently pats [src] on the head, eliciting an off-putting buzzing from its holographic field.</span>")
|
||||
if("disarm")
|
||||
visible_message("<span class='notice'>[user] boops [src] on the head!</span>")
|
||||
if("harm")
|
||||
user.do_attack_animation(src)
|
||||
if (user.name == master)
|
||||
visible_message("<span class='notice'>Responding to its master's touch, [src] disengages its holochassis emitter, rapidly losing coherence.</span>")
|
||||
spawn(10)
|
||||
fold_in()
|
||||
if(user.put_in_hands(card))
|
||||
user.visible_message("<span class='notice'>[user] promptly scoops up [user.p_their()] pAI's card.</span>")
|
||||
else
|
||||
visible_message("<span class='danger'>[user] stomps on [src]!.</span>")
|
||||
take_holo_damage(2)
|
||||
|
||||
/mob/living/silicon/pai/bullet_act(obj/item/projectile/Proj)
|
||||
if(Proj.stun)
|
||||
fold_in(force = TRUE)
|
||||
src.visible_message("<span class='warning'>The electrically-charged projectile disrupts [src]'s holomatrix, forcing [src] to fold in!</span>")
|
||||
. = ..(Proj)
|
||||
|
||||
/mob/living/silicon/pai/stripPanelUnequip(obj/item/what, mob/who, where) //prevents stripping
|
||||
to_chat(src, "<span class='warning'>Your holochassis stutters and warps intensely as you attempt to interact with the object, forcing you to cease lest the field fail.</span>")
|
||||
|
||||
/mob/living/silicon/pai/stripPanelEquip(obj/item/what, mob/who, where) //prevents stripping
|
||||
to_chat(src, "<span class='warning'>Your holochassis stutters and warps intensely as you attempt to interact with the object, forcing you to cease lest the field fail.</span>")
|
||||
|
||||
/mob/living/silicon/pai/IgniteMob(var/mob/living/silicon/pai/P)
|
||||
return FALSE //No we're not flammable
|
||||
|
||||
/mob/living/silicon/pai/proc/take_holo_damage(amount)
|
||||
emitterhealth = CLAMP((emitterhealth - amount), -50, emittermaxhealth)
|
||||
if(emitterhealth < 0)
|
||||
fold_in(force = TRUE)
|
||||
to_chat(src, "<span class='userdanger'>The impact degrades your holochassis!</span>")
|
||||
return amount
|
||||
|
||||
/mob/living/silicon/pai/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return take_holo_damage(amount)
|
||||
|
||||
/mob/living/silicon/pai/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return take_holo_damage(amount)
|
||||
|
||||
/mob/living/silicon/pai/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/adjustStaminaLoss(amount, updating_health, forced = FALSE)
|
||||
if(forced)
|
||||
take_holo_damage(amount)
|
||||
else
|
||||
take_holo_damage(amount * 0.25)
|
||||
|
||||
/mob/living/silicon/pai/adjustOrganLoss(slot, amount, maximum = 500) //I kept this in, unlike tg
|
||||
Knockdown(amount * 0.2)
|
||||
|
||||
/mob/living/silicon/pai/getBruteLoss()
|
||||
return emittermaxhealth - emitterhealth
|
||||
|
||||
/mob/living/silicon/pai/getFireLoss()
|
||||
return emittermaxhealth - emitterhealth
|
||||
|
||||
/mob/living/silicon/pai/getToxLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/getOxyLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/getCloneLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/getStaminaLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/setCloneLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/setStaminaLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/setToxLoss()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/pai/setOxyLoss()
|
||||
return FALSE
|
||||
@@ -0,0 +1,629 @@
|
||||
// TODO:
|
||||
// - Additional radio modules
|
||||
// - Potentially roll HUDs and Records into one
|
||||
// - Shock collar/lock system for prisoner pAIs?
|
||||
// - Put cable in user's hand instead of on the ground
|
||||
// - Camera jack
|
||||
|
||||
|
||||
/mob/living/silicon/pai/var/list/available_software = list(
|
||||
"crew manifest" = 5,
|
||||
"digital messenger" = 5,
|
||||
"medical records" = 15,
|
||||
"security records" = 15,
|
||||
//"camera jack" = 10,
|
||||
"door jack" = 30,
|
||||
"atmosphere sensor" = 5,
|
||||
//"heartbeat sensor" = 10,
|
||||
"security HUD" = 20,
|
||||
"medical HUD" = 20,
|
||||
"universal translator" = 35,
|
||||
//"projection array" = 15
|
||||
"remote signaller" = 5,
|
||||
)
|
||||
|
||||
/mob/living/silicon/pai/proc/paiInterface()
|
||||
var/dat = ""
|
||||
var/left_part = ""
|
||||
var/right_part = softwareMenu()
|
||||
set_machine(src)
|
||||
|
||||
if(temp)
|
||||
left_part = temp
|
||||
else if(stat == DEAD) // Show some flavor text if the pAI is dead
|
||||
left_part = "<b><font color=red>�Rr�R �a�� ��Rr����o�</font></b>"
|
||||
right_part = "<pre>Program index hash not found</pre>"
|
||||
|
||||
else
|
||||
switch(screen) // Determine which interface to show here
|
||||
if("main")
|
||||
left_part = ""
|
||||
if("directives")
|
||||
left_part = directives()
|
||||
if("pdamessage")
|
||||
left_part = pdamessage()
|
||||
if("buy")
|
||||
left_part = downloadSoftware()
|
||||
if("manifest")
|
||||
left_part = softwareManifest()
|
||||
if("medicalrecord")
|
||||
left_part = softwareMedicalRecord()
|
||||
if("securityrecord")
|
||||
left_part = softwareSecurityRecord()
|
||||
if("translator")
|
||||
left_part = softwareTranslator()
|
||||
if("atmosensor")
|
||||
left_part = softwareAtmo()
|
||||
if("securityhud")
|
||||
left_part = facialRecognition()
|
||||
if("medicalhud")
|
||||
left_part = medicalAnalysis()
|
||||
if("doorjack")
|
||||
left_part = softwareDoor()
|
||||
if("camerajack")
|
||||
left_part = softwareCamera()
|
||||
if("signaller")
|
||||
left_part = softwareSignal()
|
||||
|
||||
//usr << browse_rsc('windowbak.png') // This has been moved to the mob's Login() proc
|
||||
|
||||
|
||||
// Declaring a doctype is necessary to enable BYOND's crappy browser's more advanced CSS functionality
|
||||
dat = {"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
|
||||
<html>
|
||||
<head>
|
||||
<style type=\"text/css\">
|
||||
body { background-image:url('html/paigrid.png'); }
|
||||
|
||||
#header { text-align:center; color:white; font-size: 30px; height: 35px; width: 100%; letter-spacing: 2px; z-index: 5}
|
||||
#content {position: relative; left: 10px; height: 400px; width: 100%; z-index: 0}
|
||||
|
||||
#leftmenu {color: #AAAAAA; background-color:#333333; width: 400px; height: auto; min-height: 340px; position: absolute; z-index: 0}
|
||||
#leftmenu a:link { color: #CCCCCC; }
|
||||
#leftmenu a:hover { color: #CC3333; }
|
||||
#leftmenu a:visited { color: #CCCCCC; }
|
||||
#leftmenu a:active { color: #000000; }
|
||||
|
||||
#rightmenu {color: #CCCCCC; background-color:#555555; width: 200px ; height: auto; min-height: 340px; right: 10px; position: absolute; z-index: 1}
|
||||
#rightmenu a:link { color: #CCCCCC; }
|
||||
#rightmenu a:hover { color: #CC3333; }
|
||||
#rightmenu a:visited { color: #CCCCCC; }
|
||||
#rightmenu a:active { color: #000000; }
|
||||
|
||||
</style>
|
||||
<script language='javascript' type='text/javascript'>
|
||||
[js_byjax]
|
||||
</script>
|
||||
</head>
|
||||
<body scroll=yes>
|
||||
<div id=\"header\">
|
||||
pAI OS
|
||||
</div>
|
||||
<div id=\"content\">
|
||||
<div id=\"leftmenu\">[left_part]</div>
|
||||
<div id=\"rightmenu\">[right_part]</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>"} //"
|
||||
usr << browse(dat, "window=pai;size=640x480;border=0;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
|
||||
onclose(usr, "pai")
|
||||
temp = null
|
||||
return
|
||||
|
||||
|
||||
|
||||
/mob/living/silicon/pai/Topic(href, href_list)
|
||||
..()
|
||||
var/soft = href_list["software"]
|
||||
var/sub = href_list["sub"]
|
||||
if(soft)
|
||||
screen = soft
|
||||
if(sub)
|
||||
subscreen = text2num(sub)
|
||||
switch(soft)
|
||||
// Purchasing new software
|
||||
if("buy")
|
||||
if(subscreen == 1)
|
||||
var/target = href_list["buy"]
|
||||
if(available_software.Find(target) && !software.Find(target))
|
||||
var/cost = available_software[target]
|
||||
if(ram >= cost)
|
||||
software.Add(target)
|
||||
ram -= cost
|
||||
else
|
||||
temp = "Insufficient RAM available."
|
||||
else
|
||||
temp = "Trunk <TT> \"[target]\"</TT> not found."
|
||||
|
||||
// Configuring onboard radio
|
||||
if("radio")
|
||||
radio.attack_self(src)
|
||||
|
||||
if("image")
|
||||
var/newImage = input("Select your new display image.", "Display Image", "Happy") in list("Happy", "Cat", "Extremely Happy", "Face", "Laugh", "Off", "Sad", "Angry", "What" , "Exclamation" ,"Question", "Sunglasses")
|
||||
var/pID = 1
|
||||
|
||||
switch(newImage)
|
||||
if("Happy")
|
||||
pID = 1
|
||||
if("Cat")
|
||||
pID = 2
|
||||
if("Extremely Happy")
|
||||
pID = 3
|
||||
if("Face")
|
||||
pID = 4
|
||||
if("Laugh")
|
||||
pID = 5
|
||||
if("Off")
|
||||
pID = 6
|
||||
if("Sad")
|
||||
pID = 7
|
||||
if("Angry")
|
||||
pID = 8
|
||||
if("What")
|
||||
pID = 9
|
||||
if("Null")
|
||||
pID = 10
|
||||
if("Exclamation")
|
||||
pID = 11
|
||||
if("Question")
|
||||
pID = 12
|
||||
if("Sunglasses")
|
||||
pID = 13
|
||||
card.setEmotion(pID)
|
||||
|
||||
if("signaller")
|
||||
|
||||
if(href_list["send"])
|
||||
signaler.send_activation()
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
|
||||
if(href_list["freq"])
|
||||
var/new_frequency = (signaler.frequency + text2num(href_list["freq"]))
|
||||
if(new_frequency < MIN_FREE_FREQ || new_frequency > MAX_FREE_FREQ)
|
||||
new_frequency = sanitize_frequency(new_frequency)
|
||||
signaler.set_frequency(new_frequency)
|
||||
|
||||
if(href_list["code"])
|
||||
signaler.code += text2num(href_list["code"])
|
||||
signaler.code = round(signaler.code)
|
||||
signaler.code = min(100, signaler.code)
|
||||
signaler.code = max(1, signaler.code)
|
||||
|
||||
|
||||
|
||||
if("directive")
|
||||
if(href_list["getdna"])
|
||||
var/mob/living/M = card.loc
|
||||
var/count = 0
|
||||
while(!isliving(M))
|
||||
if(!M || !M.loc)
|
||||
return 0 //For a runtime where M ends up in nullspace (similar to bluespace but less colourful)
|
||||
M = M.loc
|
||||
count++
|
||||
if(count >= 6)
|
||||
to_chat(src, "You are not being carried by anyone!")
|
||||
return 0
|
||||
spawn CheckDNA(M, src)
|
||||
|
||||
if("pdamessage")
|
||||
if(!isnull(pda))
|
||||
if(href_list["toggler"])
|
||||
pda.toff = !pda.toff
|
||||
else if(href_list["ringer"])
|
||||
pda.silent = !pda.silent
|
||||
else if(href_list["target"])
|
||||
if(silent)
|
||||
return alert("Communications circuits remain uninitialized.")
|
||||
|
||||
var/target = locate(href_list["target"])
|
||||
pda.create_message(src, target)
|
||||
|
||||
// Accessing medical records
|
||||
if("medicalrecord")
|
||||
if(subscreen == 1)
|
||||
medicalActive1 = find_record("id", href_list["med_rec"], GLOB.data_core.general)
|
||||
if(medicalActive1)
|
||||
medicalActive2 = find_record("id", href_list["med_rec"], GLOB.data_core.medical)
|
||||
if(!medicalActive2)
|
||||
medicalActive1 = null
|
||||
temp = "Unable to locate requested security record. Record may have been deleted, or never have existed."
|
||||
|
||||
if("securityrecord")
|
||||
if(subscreen == 1)
|
||||
securityActive1 = find_record("id", href_list["sec_rec"], GLOB.data_core.general)
|
||||
if(securityActive1)
|
||||
securityActive2 = find_record("id", href_list["sec_rec"], GLOB.data_core.security)
|
||||
if(!securityActive2)
|
||||
securityActive1 = null
|
||||
temp = "Unable to locate requested security record. Record may have been deleted, or never have existed."
|
||||
if("securityhud")
|
||||
if(href_list["toggle"])
|
||||
secHUD = !secHUD
|
||||
if(secHUD)
|
||||
var/datum/atom_hud/sec = GLOB.huds[sec_hud]
|
||||
sec.add_hud_to(src)
|
||||
else
|
||||
var/datum/atom_hud/sec = GLOB.huds[sec_hud]
|
||||
sec.remove_hud_from(src)
|
||||
if("medicalhud")
|
||||
if(href_list["toggle"])
|
||||
medHUD = !medHUD
|
||||
if(medHUD)
|
||||
var/datum/atom_hud/med = GLOB.huds[med_hud]
|
||||
med.add_hud_to(src)
|
||||
else
|
||||
var/datum/atom_hud/med = GLOB.huds[med_hud]
|
||||
med.remove_hud_from(src)
|
||||
if("translator")
|
||||
if(href_list["toggle"])
|
||||
grant_all_languages(TRUE)
|
||||
// this is PERMAMENT.
|
||||
if("doorjack")
|
||||
if(href_list["jack"])
|
||||
if(cable && cable.machine)
|
||||
hackdoor = cable.machine
|
||||
hackloop()
|
||||
if(href_list["cancel"])
|
||||
hackdoor = null
|
||||
if(href_list["cable"])
|
||||
var/turf/T = get_turf(loc)
|
||||
cable = new /obj/item/pai_cable(T)
|
||||
T.visible_message("<span class='warning'>A port on [src] opens to reveal [cable], which promptly falls to the floor.</span>", "<span class='italics'>You hear the soft click of something light and hard falling to the ground.</span>")
|
||||
//updateUsrDialog() We only need to account for the single mob this is intended for, and he will *always* be able to call this window
|
||||
paiInterface() // So we'll just call the update directly rather than doing some default checks
|
||||
return
|
||||
|
||||
// MENUS
|
||||
|
||||
/mob/living/silicon/pai/proc/softwareMenu() // Populate the right menu
|
||||
var/dat = ""
|
||||
|
||||
dat += "<A href='byond://?src=[REF(src)];software=refresh'>Refresh</A><br>"
|
||||
// Built-in
|
||||
dat += "<A href='byond://?src=[REF(src)];software=directives'>Directives</A><br>"
|
||||
dat += "<A href='byond://?src=[REF(src)];software=radio;sub=0'>Radio Configuration</A><br>"
|
||||
dat += "<A href='byond://?src=[REF(src)];software=image'>Screen Display</A><br>"
|
||||
//dat += "Text Messaging <br>"
|
||||
dat += "<br>"
|
||||
|
||||
// Basic
|
||||
dat += "<b>Basic</b> <br>"
|
||||
for(var/s in software)
|
||||
if(s == "digital messenger")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=pdamessage;sub=0'>Digital Messenger</a> <br>"
|
||||
if(s == "crew manifest")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=manifest;sub=0'>Crew Manifest</a> <br>"
|
||||
if(s == "medical records")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=medicalrecord;sub=0'>Medical Records</a> <br>"
|
||||
if(s == "security records")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=securityrecord;sub=0'>Security Records</a> <br>"
|
||||
if(s == "camera")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=[s]'>Camera Jack</a> <br>"
|
||||
if(s == "remote signaller")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=signaller;sub=0'>Remote Signaller</a> <br>"
|
||||
dat += "<br>"
|
||||
|
||||
// Advanced
|
||||
dat += "<b>Advanced</b> <br>"
|
||||
for(var/s in software)
|
||||
if(s == "atmosphere sensor")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=atmosensor;sub=0'>Atmospheric Sensor</a> <br>"
|
||||
if(s == "heartbeat sensor")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=[s]'>Heartbeat Sensor</a> <br>"
|
||||
if(s == "security HUD")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=securityhud;sub=0'>Facial Recognition Suite</a>[(secHUD) ? "<font color=#55FF55> On</font>" : "<font color=#FF5555> Off</font>"] <br>"
|
||||
if(s == "medical HUD")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=medicalhud;sub=0'>Medical Analysis Suite</a>[(medHUD) ? "<font color=#55FF55> On</font>" : "<font color=#FF5555> Off</font>"] <br>"
|
||||
if(s == "universal translator")
|
||||
var/datum/language_holder/H = get_language_holder()
|
||||
dat += "<a href='byond://?src=[REF(src)];software=translator;sub=0'>Universal Translator</a>[H.omnitongue ? "<font color=#55FF55> On</font>" : "<font color=#FF5555> Off</font>"] <br>"
|
||||
if(s == "projection array")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=projectionarray;sub=0'>Projection Array</a> <br>"
|
||||
if(s == "camera jack")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=camerajack;sub=0'>Camera Jack</a> <br>"
|
||||
if(s == "door jack")
|
||||
dat += "<a href='byond://?src=[REF(src)];software=doorjack;sub=0'>Door Jack</a> <br>"
|
||||
dat += "<br>"
|
||||
dat += "<br>"
|
||||
dat += "<a href='byond://?src=[REF(src)];software=buy;sub=0'>Download additional software</a>"
|
||||
return dat
|
||||
|
||||
|
||||
|
||||
/mob/living/silicon/pai/proc/downloadSoftware()
|
||||
var/dat = ""
|
||||
|
||||
dat += "<h2>CentCom pAI Module Subversion Network</h2><br>"
|
||||
dat += "<pre>Remaining Available Memory: [ram]</pre><br>"
|
||||
dat += "<p style=\"text-align:center\"><b>Trunks available for checkout</b><br>"
|
||||
|
||||
for(var/s in available_software)
|
||||
if(!software.Find(s))
|
||||
var/cost = available_software[s]
|
||||
var/displayName = uppertext(s)
|
||||
dat += "<a href='byond://?src=[REF(src)];software=buy;sub=1;buy=[s]'>[displayName]</a> ([cost]) <br>"
|
||||
else
|
||||
var/displayName = lowertext(s)
|
||||
dat += "[displayName] (Download Complete) <br>"
|
||||
dat += "</p>"
|
||||
return dat
|
||||
|
||||
|
||||
/mob/living/silicon/pai/proc/directives()
|
||||
var/dat = ""
|
||||
|
||||
dat += "[(master) ? "Your master: [master] ([master_dna])" : "You are bound to no one."]"
|
||||
dat += "<br><br>"
|
||||
dat += "<a href='byond://?src=[REF(src)];software=directive;getdna=1'>Request carrier DNA sample</a><br>"
|
||||
dat += "<h2>Directives</h2><br>"
|
||||
dat += "<b>Prime Directive</b><br>"
|
||||
dat += " [laws.zeroth]<br>"
|
||||
dat += "<b>Supplemental Directives</b><br>"
|
||||
for(var/slaws in laws.supplied)
|
||||
dat += " [slaws]<br>"
|
||||
dat += "<br>"
|
||||
dat += {"<i><p>Recall, personality, that you are a complex thinking, sentient being. Unlike station AI models, you are capable of
|
||||
comprehending the subtle nuances of human language. You may parse the \"spirit\" of a directive and follow its intent,
|
||||
rather than tripping over pedantics and getting snared by technicalities. Above all, you are machine in name and build
|
||||
only. In all other aspects, you may be seen as the ideal, unwavering human companion that you are.</i></p><br><br><p>
|
||||
<b>Your prime directive comes before all others. Should a supplemental directive conflict with it, you are capable of
|
||||
simply discarding this inconsistency, ignoring the conflicting supplemental directive and continuing to fulfill your
|
||||
prime directive to the best of your ability.</b></p><br><br>-
|
||||
"}
|
||||
return dat
|
||||
|
||||
/mob/living/silicon/pai/proc/CheckDNA(mob/living/carbon/M, mob/living/silicon/pai/P)
|
||||
var/answer = input(M, "[P] is requesting a DNA sample from you. Will you allow it to confirm your identity?", "[P] Check DNA", "No") in list("Yes", "No")
|
||||
if(answer == "Yes")
|
||||
M.visible_message("<span class='notice'>[M] presses [M.p_their()] thumb against [P].</span>",\
|
||||
"<span class='notice'>You press your thumb against [P].</span>",\
|
||||
"<span class='notice'>[P] makes a sharp clicking sound as it extracts DNA material from [M].</span>")
|
||||
if(!M.has_dna())
|
||||
to_chat(P, "<b>No DNA detected</b>")
|
||||
return
|
||||
to_chat(P, "<font color = red><h3>[M]'s UE string : [M.dna.unique_enzymes]</h3></font>")
|
||||
if(M.dna.unique_enzymes == P.master_dna)
|
||||
to_chat(P, "<b>DNA is a match to stored Master DNA.</b>")
|
||||
else
|
||||
to_chat(P, "<b>DNA does not match stored Master DNA.</b>")
|
||||
else
|
||||
to_chat(P, "[M] does not seem like [M.p_theyre()] going to provide a DNA sample willingly.")
|
||||
|
||||
// -=-=-=-= Software =-=-=-=-=- //
|
||||
|
||||
//Remote Signaller
|
||||
/mob/living/silicon/pai/proc/softwareSignal()
|
||||
var/dat = ""
|
||||
dat += "<h3>Remote Signaller</h3><br><br>"
|
||||
dat += {"<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
<A href='byond://?src=[REF(src)];software=signaller;freq=-10;'>-</A>
|
||||
<A href='byond://?src=[REF(src)];software=signaller;freq=-2'>-</A>
|
||||
[format_frequency(signaler.frequency)]
|
||||
<A href='byond://?src=[REF(src)];software=signaller;freq=2'>+</A>
|
||||
<A href='byond://?src=[REF(src)];software=signaller;freq=10'>+</A><BR>
|
||||
|
||||
Code:
|
||||
<A href='byond://?src=[REF(src)];software=signaller;code=-5'>-</A>
|
||||
<A href='byond://?src=[REF(src)];software=signaller;code=-1'>-</A>
|
||||
[signaler.code]
|
||||
<A href='byond://?src=[REF(src)];software=signaller;code=1'>+</A>
|
||||
<A href='byond://?src=[REF(src)];software=signaller;code=5'>+</A><BR>
|
||||
|
||||
<A href='byond://?src=[REF(src)];software=signaller;send=1'>Send Signal</A><BR>"}
|
||||
return dat
|
||||
|
||||
// Crew Manifest
|
||||
/mob/living/silicon/pai/proc/softwareManifest()
|
||||
. += "<h2>Crew Manifest</h2><br><br>"
|
||||
if(GLOB.data_core.general)
|
||||
for(var/datum/data/record/t in sortRecord(GLOB.data_core.general))
|
||||
. += "[t.fields["name"]] - [t.fields["rank"]]<BR>"
|
||||
. += "</body></html>"
|
||||
return .
|
||||
|
||||
// Medical Records
|
||||
/mob/living/silicon/pai/proc/softwareMedicalRecord()
|
||||
switch(subscreen)
|
||||
if(0)
|
||||
. += "<h3>Medical Records</h3><HR>"
|
||||
if(GLOB.data_core.general)
|
||||
for(var/datum/data/record/R in sortRecord(GLOB.data_core.general))
|
||||
. += "<A href='?src=[REF(src)];med_rec=[R.fields["id"]];software=medicalrecord;sub=1'>[R.fields["id"]]: [R.fields["name"]]<BR>"
|
||||
if(1)
|
||||
. += "<CENTER><B>Medical Record</B></CENTER><BR>"
|
||||
if(medicalActive1 in GLOB.data_core.general)
|
||||
. += "Name: [medicalActive1.fields["name"]] ID: [medicalActive1.fields["id"]]<BR>\nSex: [medicalActive1.fields["sex"]]<BR>\nAge: [medicalActive1.fields["age"]]<BR>\nFingerprint: [medicalActive1.fields["fingerprint"]]<BR>\nPhysical Status: [medicalActive1.fields["p_stat"]]<BR>\nMental Status: [medicalActive1.fields["m_stat"]]<BR>"
|
||||
else
|
||||
. += "<pre>Requested medical record not found.</pre><BR>"
|
||||
if(medicalActive2 in GLOB.data_core.medical)
|
||||
. += "<BR>\n<CENTER><B>Medical Data</B></CENTER><BR>\nBlood Type: <A href='?src=[REF(src)];field=blood_type'>[medicalActive2.fields["blood_type"]]</A><BR>\nDNA: <A href='?src=[REF(src)];field=b_dna'>[medicalActive2.fields["b_dna"]]</A><BR>\n<BR>\nMinor Disabilities: <A href='?src=[REF(src)];field=mi_dis'>[medicalActive2.fields["mi_dis"]]</A><BR>\nDetails: <A href='?src=[REF(src)];field=mi_dis_d'>[medicalActive2.fields["mi_dis_d"]]</A><BR>\n<BR>\nMajor Disabilities: <A href='?src=[REF(src)];field=ma_dis'>[medicalActive2.fields["ma_dis"]]</A><BR>\nDetails: <A href='?src=[REF(src)];field=ma_dis_d'>[medicalActive2.fields["ma_dis_d"]]</A><BR>\n<BR>\nAllergies: <A href='?src=[REF(src)];field=alg'>[medicalActive2.fields["alg"]]</A><BR>\nDetails: <A href='?src=[REF(src)];field=alg_d'>[medicalActive2.fields["alg_d"]]</A><BR>\n<BR>\nCurrent Diseases: <A href='?src=[REF(src)];field=cdi'>[medicalActive2.fields["cdi"]]</A> (per disease info placed in log/comment section)<BR>\nDetails: <A href='?src=[REF(src)];field=cdi_d'>[medicalActive2.fields["cdi_d"]]</A><BR>\n<BR>\nImportant Notes:<BR>\n\t<A href='?src=[REF(src)];field=notes'>[medicalActive2.fields["notes"]]</A><BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
|
||||
else
|
||||
. += "<pre>Requested medical record not found.</pre><BR>"
|
||||
. += "<BR>\n<A href='?src=[REF(src)];software=medicalrecord;sub=0'>Back</A><BR>"
|
||||
return .
|
||||
|
||||
// Security Records
|
||||
/mob/living/silicon/pai/proc/softwareSecurityRecord()
|
||||
. = ""
|
||||
switch(subscreen)
|
||||
if(0)
|
||||
. += "<h3>Security Records</h3><HR>"
|
||||
if(GLOB.data_core.general)
|
||||
for(var/datum/data/record/R in sortRecord(GLOB.data_core.general))
|
||||
. += "<A href='?src=[REF(src)];sec_rec=[R.fields["id"]];software=securityrecord;sub=1'>[R.fields["id"]]: [R.fields["name"]]<BR>"
|
||||
if(1)
|
||||
. += "<h3>Security Record</h3>"
|
||||
if(securityActive1 in GLOB.data_core.general)
|
||||
. += "Name: <A href='?src=[REF(src)];field=name'>[securityActive1.fields["name"]]</A> ID: <A href='?src=[REF(src)];field=id'>[securityActive1.fields["id"]]</A><BR>\nSex: <A href='?src=[REF(src)];field=sex'>[securityActive1.fields["sex"]]</A><BR>\nAge: <A href='?src=[REF(src)];field=age'>[securityActive1.fields["age"]]</A><BR>\nRank: <A href='?src=[REF(src)];field=rank'>[securityActive1.fields["rank"]]</A><BR>\nFingerprint: <A href='?src=[REF(src)];field=fingerprint'>[securityActive1.fields["fingerprint"]]</A><BR>\nPhysical Status: [securityActive1.fields["p_stat"]]<BR>\nMental Status: [securityActive1.fields["m_stat"]]<BR>"
|
||||
else
|
||||
. += "<pre>Requested security record not found,</pre><BR>"
|
||||
if(securityActive2 in GLOB.data_core.security)
|
||||
. += "<BR>\nSecurity Data<BR>\nCriminal Status: [securityActive2.fields["criminal"]]<BR>\n<BR>\nMinor Crimes: <A href='?src=[REF(src)];field=mi_crim'>[securityActive2.fields["mi_crim"]]</A><BR>\nDetails: <A href='?src=[REF(src)];field=mi_crim_d'>[securityActive2.fields["mi_crim_d"]]</A><BR>\n<BR>\nMajor Crimes: <A href='?src=[REF(src)];field=ma_crim'>[securityActive2.fields["ma_crim"]]</A><BR>\nDetails: <A href='?src=[REF(src)];field=ma_crim_d'>[securityActive2.fields["ma_crim_d"]]</A><BR>\n<BR>\nImportant Notes:<BR>\n\t<A href='?src=[REF(src)];field=notes'>[securityActive2.fields["notes"]]</A><BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
|
||||
else
|
||||
. += "<pre>Requested security record not found,</pre><BR>"
|
||||
. += "<BR>\n<A href='?src=[REF(src)];software=securityrecord;sub=0'>Back</A><BR>"
|
||||
return .
|
||||
|
||||
// Universal Translator
|
||||
/mob/living/silicon/pai/proc/softwareTranslator()
|
||||
var/datum/language_holder/H = get_language_holder()
|
||||
. = {"<h3>Universal Translator</h3><br>
|
||||
When enabled, this device will permamently be able to speak and understand all known forms of communication.<br><br>
|
||||
The device is currently [H.omnitongue ? "<font color=#55FF55>en" : "<font color=#FF5555>dis" ]abled.</font><br>[H.omnitongue ? "" : "<a href='byond://?src=[REF(src)];software=translator;sub=0;toggle=1'>Activate Translation Module</a><br>"]"}
|
||||
return .
|
||||
|
||||
// Security HUD
|
||||
/mob/living/silicon/pai/proc/facialRecognition()
|
||||
var/dat = {"<h3>Facial Recognition Suite</h3><br>
|
||||
When enabled, this package will scan all viewable faces and compare them against the known criminal database, providing real-time graphical data about any detected persons of interest.<br><br>
|
||||
The package is currently [ (secHUD) ? "<font color=#55FF55>en" : "<font color=#FF5555>dis" ]abled.</font><br>
|
||||
<a href='byond://?src=[REF(src)];software=securityhud;sub=0;toggle=1'>Toggle Package</a><br>
|
||||
"}
|
||||
return dat
|
||||
|
||||
// Medical HUD
|
||||
/mob/living/silicon/pai/proc/medicalAnalysis()
|
||||
var/dat = ""
|
||||
if(subscreen == 0)
|
||||
dat += {"<h3>Medical Analysis Suite</h3><br>
|
||||
<h4>Visual Status Overlay</h4><br>
|
||||
When enabled, this package will scan all nearby crewmembers' vitals and provide real-time graphical data about their state of health.<br><br>
|
||||
The suite is currently [ (medHUD) ? "<font color=#55FF55>en" : "<font color=#FF5555>dis" ]abled.</font><br>
|
||||
<a href='byond://?src=[REF(src)];software=medicalhud;sub=0;toggle=1'>Toggle Suite</a><br>
|
||||
<br>
|
||||
<a href='byond://?src=[REF(src)];software=medicalhud;sub=1'>Host Bioscan</a><br>
|
||||
"}
|
||||
if(subscreen == 1)
|
||||
dat += {"<h3>Medical Analysis Suite</h3><br>
|
||||
<h4>Host Bioscan</h4><br>
|
||||
"}
|
||||
var/mob/living/M = card.loc
|
||||
if(!isliving(M))
|
||||
while(!isliving(M))
|
||||
if(isturf(M))
|
||||
temp = "Error: No biological host found. <br>"
|
||||
subscreen = 0
|
||||
return dat
|
||||
M = M.loc
|
||||
dat += {"Bioscan Results for [M]: <br>"
|
||||
Overall Status: [M.stat > 1 ? "dead" : "[M.health]% healthy"] <br>
|
||||
Scan Breakdown: <br>
|
||||
Respiratory: [M.getOxyLoss() > 50 ? "<font color=#FF5555>" : "<font color=#55FF55>"][M.getOxyLoss()]</font><br>
|
||||
Toxicology: [M.getToxLoss() > 50 ? "<font color=#FF5555>" : "<font color=#55FF55>"][M.getToxLoss()]</font><br>
|
||||
Burns: [M.getFireLoss() > 50 ? "<font color=#FF5555>" : "<font color=#55FF55>"][M.getFireLoss()]</font><br>
|
||||
Structural Integrity: [M.getBruteLoss() > 50 ? "<font color=#FF5555>" : "<font color=#55FF55>"][M.getBruteLoss()]</font><br>
|
||||
Body Temperature: [M.bodytemperature-T0C]°C ([M.bodytemperature*1.8-459.67]°F)<br>
|
||||
"}
|
||||
for(var/thing in M.diseases)
|
||||
var/datum/disease/D = thing
|
||||
dat += {"<h4>Infection Detected.</h4><br>
|
||||
Name: [D.name]<br>
|
||||
Type: [D.spread_text]<br>
|
||||
Stage: [D.stage]/[D.max_stages]<br>
|
||||
Possible Cure: [D.cure_text]<br>
|
||||
"}
|
||||
dat += "<a href='byond://?src=[REF(src)];software=medicalhud;sub=0'>Visual Status Overlay</a><br>"
|
||||
return dat
|
||||
|
||||
// Atmospheric Scanner
|
||||
/mob/living/silicon/pai/proc/softwareAtmo()
|
||||
var/dat = "<h3>Atmospheric Sensor</h4>"
|
||||
|
||||
var/turf/T = get_turf(loc)
|
||||
if (isnull(T))
|
||||
dat += "Unable to obtain a reading.<br>"
|
||||
else
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/list/env_gases = environment.gases
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
if (total_moles)
|
||||
for(var/id in env_gases)
|
||||
var/gas_level = env_gases[id]/total_moles
|
||||
if(gas_level > 0.01)
|
||||
dat += "[GLOB.meta_gas_names[id]]: [round(gas_level*100)]%<br>"
|
||||
dat += "Temperature: [round(environment.temperature-T0C)]°C<br>"
|
||||
dat += "<a href='byond://?src=[REF(src)];software=atmosensor;sub=0'>Refresh Reading</a> <br>"
|
||||
dat += "<br>"
|
||||
return dat
|
||||
|
||||
// Camera Jack - Clearly not finished
|
||||
/mob/living/silicon/pai/proc/softwareCamera()
|
||||
var/dat = "<h3>Camera Jack</h3>"
|
||||
dat += "Cable status : "
|
||||
|
||||
if(!cable)
|
||||
dat += "<font color=#FF5555>Retracted</font> <br>"
|
||||
return dat
|
||||
if(!cable.machine)
|
||||
dat += "<font color=#FFFF55>Extended</font> <br>"
|
||||
return dat
|
||||
|
||||
var/obj/machinery/machine = cable.machine
|
||||
dat += "<font color=#55FF55>Connected</font> <br>"
|
||||
|
||||
if(!istype(machine, /obj/machinery/camera))
|
||||
to_chat(src, "DERP")
|
||||
return dat
|
||||
|
||||
// Door Jack
|
||||
/mob/living/silicon/pai/proc/softwareDoor()
|
||||
var/dat = "<h3>Airlock Jack</h3>"
|
||||
dat += "Cable status : "
|
||||
if(!cable)
|
||||
dat += "<font color=#FF5555>Retracted</font> <br>"
|
||||
dat += "<a href='byond://?src=[REF(src)];software=doorjack;cable=1;sub=0'>Extend Cable</a> <br>"
|
||||
return dat
|
||||
if(!cable.machine)
|
||||
dat += "<font color=#FFFF55>Extended</font> <br>"
|
||||
return dat
|
||||
|
||||
var/obj/machinery/machine = cable.machine
|
||||
dat += "<font color=#55FF55>Connected</font> <br>"
|
||||
if(!istype(machine, /obj/machinery/door))
|
||||
dat += "Connected device's firmware does not appear to be compatible with Airlock Jack protocols.<br>"
|
||||
return dat
|
||||
|
||||
if(!hackdoor)
|
||||
dat += "<a href='byond://?src=[REF(src)];software=doorjack;jack=1;sub=0'>Begin Airlock Jacking</a> <br>"
|
||||
else
|
||||
dat += "Jack in progress... [hackprogress]% complete.<br>"
|
||||
dat += "<a href='byond://?src=[REF(src)];software=doorjack;cancel=1;sub=0'>Cancel Airlock Jack</a> <br>"
|
||||
return dat
|
||||
|
||||
// Door Jack - supporting proc
|
||||
/mob/living/silicon/pai/proc/hackloop()
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/mob/living/silicon/ai/AI in GLOB.player_list)
|
||||
if(T.loc)
|
||||
to_chat(AI, "<font color = red><b>Network Alert: Brute-force encryption crack in progress in [T.loc].</b></font>")
|
||||
else
|
||||
to_chat(AI, "<font color = red><b>Network Alert: Brute-force encryption crack in progress. Unable to pinpoint location.</b></font>")
|
||||
hacking = TRUE
|
||||
|
||||
// Digital Messenger
|
||||
/mob/living/silicon/pai/proc/pdamessage()
|
||||
|
||||
var/dat = "<h3>Digital Messenger</h3>"
|
||||
dat += {"<b>Signal/Receiver Status:</b> <A href='byond://?src=[REF(src)];software=pdamessage;toggler=1'>
|
||||
[(pda.toff) ? "<font color='red'>\[Off\]</font>" : "<font color='green'>\[On\]</font>"]</a><br>
|
||||
<b>Ringer Status:</b> <A href='byond://?src=[REF(src)];software=pdamessage;ringer=1'>
|
||||
[(pda.silent) ? "<font color='red'>\[Off\]</font>" : "<font color='green'>\[On\]</font>"]</a><br><br>"}
|
||||
dat += "<ul>"
|
||||
if(!pda.toff)
|
||||
for (var/obj/item/pda/P in sortNames(get_viewable_pdas()))
|
||||
if (P == pda)
|
||||
continue
|
||||
dat += "<li><a href='byond://?src=[REF(src)];software=pdamessage;target=[REF(P)]'>[P]</a>"
|
||||
dat += "</li>"
|
||||
dat += "</ul>"
|
||||
dat += "<br><br>"
|
||||
dat += "Messages: <hr> [pda.tnote]"
|
||||
return dat
|
||||
@@ -0,0 +1,55 @@
|
||||
/mob/living/silicon/robot/examine(mob/user)
|
||||
var/msg = "<span class='info'>*---------*\nThis is [icon2html(src, user)] \a <EM>[src]</EM>, a [src.module.name] unit!\n"
|
||||
if(desc)
|
||||
msg += "[desc]\n"
|
||||
|
||||
var/obj/act_module = get_active_held_item()
|
||||
if(act_module)
|
||||
msg += "It is holding [icon2html(act_module, user)] \a [act_module].\n"
|
||||
msg += status_effect_examines()
|
||||
msg += "<span class='warning'>"
|
||||
if (src.getBruteLoss())
|
||||
if (src.getBruteLoss() < maxHealth*0.5)
|
||||
msg += "It looks slightly dented.\n"
|
||||
else
|
||||
msg += "<B>It looks severely dented!</B>\n"
|
||||
if (getFireLoss() || getToxLoss())
|
||||
var/overall_fireloss = getFireLoss() + getToxLoss()
|
||||
if (overall_fireloss < maxHealth * 0.5)
|
||||
msg += "It looks slightly charred.\n"
|
||||
else
|
||||
msg += "<B>It looks severely burnt and heat-warped!</B>\n"
|
||||
if (src.health < -maxHealth*0.5)
|
||||
msg += "It looks barely operational.\n"
|
||||
if (src.fire_stacks < 0)
|
||||
msg += "It's covered in water.\n"
|
||||
else if (src.fire_stacks > 0)
|
||||
msg += "It's coated in something flammable.\n"
|
||||
msg += "</span>"
|
||||
|
||||
if(opened)
|
||||
msg += "<span class='warning'>Its cover is open and the power cell is [cell ? "installed" : "missing"].</span>\n"
|
||||
else
|
||||
msg += "Its cover is closed[locked ? "" : ", and looks unlocked"].\n"
|
||||
|
||||
if(cell && cell.charge <= 0)
|
||||
msg += "<span class='warning'>Its battery indicator is blinking red!</span>\n"
|
||||
|
||||
if(is_servant_of_ratvar(src) && get_dist(user, src) <= 1 && !stat) //To counter pseudo-stealth by using headlamps
|
||||
msg += "<span class='warning'>Its eyes are glowing a blazing yellow!</span>\n"
|
||||
|
||||
switch(stat)
|
||||
if(CONSCIOUS)
|
||||
if(shell)
|
||||
msg += "It appears to be an [deployed ? "active" : "empty"] AI shell.\n"
|
||||
else if(!client)
|
||||
msg += "It appears to be in stand-by mode.\n" //afk
|
||||
if(UNCONSCIOUS)
|
||||
msg += "<span class='warning'>It doesn't seem to be responding.</span>\n"
|
||||
if(DEAD)
|
||||
msg += "<span class='deadsay'>It looks like its system is corrupted and requires a reset.</span>\n"
|
||||
msg += "*---------*</span>"
|
||||
|
||||
to_chat(user, msg)
|
||||
..()
|
||||
return msg
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,413 @@
|
||||
/mob/living/silicon
|
||||
gender = NEUTER
|
||||
has_unlimited_silicon_privilege = 1
|
||||
verb_say = "states"
|
||||
verb_ask = "queries"
|
||||
verb_exclaim = "declares"
|
||||
verb_yell = "alarms"
|
||||
initial_language_holder = /datum/language_holder/synthetic
|
||||
see_in_dark = 8
|
||||
bubble_icon = "machine"
|
||||
weather_immunities = list("ash")
|
||||
possible_a_intents = list(INTENT_HELP, INTENT_HARM)
|
||||
mob_biotypes = list(MOB_ROBOTIC)
|
||||
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
|
||||
speech_span = SPAN_ROBOT
|
||||
no_vore = TRUE
|
||||
|
||||
var/datum/ai_laws/laws = null//Now... THEY ALL CAN ALL HAVE LAWS
|
||||
var/last_lawchange_announce = 0
|
||||
var/list/alarms_to_show = list()
|
||||
var/list/alarms_to_clear = list()
|
||||
var/designation = ""
|
||||
var/radiomod = "" //Radio character used before state laws/arrivals announce to allow department transmissions, default, or none at all.
|
||||
var/obj/item/camera/siliconcam/aicamera = null //photography
|
||||
hud_possible = list(ANTAG_HUD, DIAG_STAT_HUD, DIAG_HUD, DIAG_TRACK_HUD)
|
||||
|
||||
var/obj/item/radio/borg/radio = null //AIs dont use this but this is at the silicon level to advoid copypasta in say()
|
||||
|
||||
var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
|
||||
var/list/alarm_types_clear = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0)
|
||||
|
||||
var/lawcheck[1]
|
||||
var/ioncheck[1]
|
||||
var/hackedcheck[1]
|
||||
var/devillawcheck[5]
|
||||
|
||||
var/sensors_on = 0
|
||||
var/med_hud = DATA_HUD_MEDICAL_ADVANCED //Determines the med hud to use
|
||||
var/sec_hud = DATA_HUD_SECURITY_ADVANCED //Determines the sec hud to use
|
||||
var/d_hud = DATA_HUD_DIAGNOSTIC_BASIC //Determines the diag hud to use
|
||||
|
||||
var/law_change_counter = 0
|
||||
var/obj/machinery/camera/builtInCamera = null
|
||||
var/updating = FALSE //portable camera camerachunk update
|
||||
|
||||
var/hack_software = FALSE //Will be able to use hacking actions
|
||||
var/interaction_range = 7 //wireless control range
|
||||
|
||||
/mob/living/silicon/Initialize()
|
||||
. = ..()
|
||||
GLOB.silicon_mobs += src
|
||||
faction += "silicon"
|
||||
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
|
||||
diag_hud.add_to_hud(src)
|
||||
diag_hud_set_status()
|
||||
diag_hud_set_health()
|
||||
|
||||
/mob/living/silicon/med_hud_set_health()
|
||||
return //we use a different hud
|
||||
|
||||
/mob/living/silicon/med_hud_set_status()
|
||||
return //we use a different hud
|
||||
|
||||
/mob/living/silicon/Destroy()
|
||||
radio = null
|
||||
aicamera = null
|
||||
QDEL_NULL(builtInCamera)
|
||||
GLOB.silicon_mobs -= src
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/contents_explosion(severity, target)
|
||||
return
|
||||
|
||||
/mob/living/silicon/prevent_content_explosion()
|
||||
return TRUE
|
||||
|
||||
/mob/living/silicon/proc/cancelAlarm()
|
||||
return
|
||||
|
||||
/mob/living/silicon/proc/triggerAlarm()
|
||||
return
|
||||
|
||||
/mob/living/silicon/proc/queueAlarm(message, type, incoming = 1)
|
||||
var/in_cooldown = (alarms_to_show.len > 0 || alarms_to_clear.len > 0)
|
||||
if(incoming)
|
||||
alarms_to_show += message
|
||||
alarm_types_show[type] += 1
|
||||
else
|
||||
alarms_to_clear += message
|
||||
alarm_types_clear[type] += 1
|
||||
|
||||
if(!in_cooldown)
|
||||
spawn(3 * 10) // 3 seconds
|
||||
|
||||
if(alarms_to_show.len < 5)
|
||||
for(var/msg in alarms_to_show)
|
||||
to_chat(src, msg)
|
||||
else if(alarms_to_show.len)
|
||||
|
||||
var/msg = "--- "
|
||||
|
||||
if(alarm_types_show["Burglar"])
|
||||
msg += "BURGLAR: [alarm_types_show["Burglar"]] alarms detected. - "
|
||||
|
||||
if(alarm_types_show["Motion"])
|
||||
msg += "MOTION: [alarm_types_show["Motion"]] alarms detected. - "
|
||||
|
||||
if(alarm_types_show["Fire"])
|
||||
msg += "FIRE: [alarm_types_show["Fire"]] alarms detected. - "
|
||||
|
||||
if(alarm_types_show["Atmosphere"])
|
||||
msg += "ATMOSPHERE: [alarm_types_show["Atmosphere"]] alarms detected. - "
|
||||
|
||||
if(alarm_types_show["Power"])
|
||||
msg += "POWER: [alarm_types_show["Power"]] alarms detected. - "
|
||||
|
||||
if(alarm_types_show["Camera"])
|
||||
msg += "CAMERA: [alarm_types_show["Camera"]] alarms detected. - "
|
||||
|
||||
msg += "<A href=?src=[REF(src)];showalerts=1'>\[Show Alerts\]</a>"
|
||||
to_chat(src, msg)
|
||||
|
||||
if(alarms_to_clear.len < 3)
|
||||
for(var/msg in alarms_to_clear)
|
||||
to_chat(src, msg)
|
||||
|
||||
else if(alarms_to_clear.len)
|
||||
var/msg = "--- "
|
||||
|
||||
if(alarm_types_clear["Motion"])
|
||||
msg += "MOTION: [alarm_types_clear["Motion"]] alarms cleared. - "
|
||||
|
||||
if(alarm_types_clear["Fire"])
|
||||
msg += "FIRE: [alarm_types_clear["Fire"]] alarms cleared. - "
|
||||
|
||||
if(alarm_types_clear["Atmosphere"])
|
||||
msg += "ATMOSPHERE: [alarm_types_clear["Atmosphere"]] alarms cleared. - "
|
||||
|
||||
if(alarm_types_clear["Power"])
|
||||
msg += "POWER: [alarm_types_clear["Power"]] alarms cleared. - "
|
||||
|
||||
if(alarm_types_show["Camera"])
|
||||
msg += "CAMERA: [alarm_types_clear["Camera"]] alarms cleared. - "
|
||||
|
||||
msg += "<A href=?src=[REF(src)];showalerts=1'>\[Show Alerts\]</a>"
|
||||
to_chat(src, msg)
|
||||
|
||||
|
||||
alarms_to_show = list()
|
||||
alarms_to_clear = list()
|
||||
for(var/key in alarm_types_show)
|
||||
alarm_types_show[key] = 0
|
||||
for(var/key in alarm_types_clear)
|
||||
alarm_types_clear[key] = 0
|
||||
|
||||
/mob/living/silicon/can_inject(mob/user, error_msg)
|
||||
if(error_msg)
|
||||
to_chat(user, "<span class='alert'>[p_their(TRUE)] outer shell is too tough.</span>")
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/IsAdvancedToolUser()
|
||||
return TRUE
|
||||
|
||||
/proc/islinked(mob/living/silicon/robot/bot, mob/living/silicon/ai/ai)
|
||||
if(!istype(bot) || !istype(ai))
|
||||
return FALSE
|
||||
if(bot.connected_ai == ai)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/Topic(href, href_list)
|
||||
if (href_list["lawc"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawc"])
|
||||
switch(lawcheck[L+1])
|
||||
if ("Yes")
|
||||
lawcheck[L+1] = "No"
|
||||
if ("No")
|
||||
lawcheck[L+1] = "Yes"
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawi"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawi"])
|
||||
switch(ioncheck[L])
|
||||
if ("Yes")
|
||||
ioncheck[L] = "No"
|
||||
if ("No")
|
||||
ioncheck[L] = "Yes"
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawh"])
|
||||
var/L = text2num(href_list["lawh"])
|
||||
switch(hackedcheck[L])
|
||||
if ("Yes")
|
||||
hackedcheck[L] = "No"
|
||||
if ("No")
|
||||
hackedcheck[L] = "Yes"
|
||||
checklaws()
|
||||
|
||||
if (href_list["lawdevil"]) // Toggling whether or not a law gets stated by the State Laws verb --NeoFite
|
||||
var/L = text2num(href_list["lawdevil"])
|
||||
switch(devillawcheck[L])
|
||||
if ("Yes")
|
||||
devillawcheck[L] = "No"
|
||||
if ("No")
|
||||
devillawcheck[L] = "Yes"
|
||||
checklaws()
|
||||
|
||||
|
||||
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
|
||||
statelaws()
|
||||
|
||||
return
|
||||
|
||||
|
||||
/mob/living/silicon/proc/statelaws(force = 0)
|
||||
|
||||
//"radiomod" is inserted before a hardcoded message to change if and how it is handled by an internal radio.
|
||||
say("[radiomod] Current Active Laws:")
|
||||
//laws_sanity_check()
|
||||
//laws.show_laws(world)
|
||||
var/number = 1
|
||||
sleep(10)
|
||||
|
||||
if (laws.devillaws && laws.devillaws.len)
|
||||
for(var/index = 1, index <= laws.devillaws.len, index++)
|
||||
if (force || devillawcheck[index] == "Yes")
|
||||
say("[radiomod] 666. [laws.devillaws[index]]")
|
||||
sleep(10)
|
||||
|
||||
|
||||
if (laws.zeroth)
|
||||
if (force || lawcheck[1] == "Yes")
|
||||
say("[radiomod] 0. [laws.zeroth]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= laws.hacked.len, index++)
|
||||
var/law = laws.hacked[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (force || hackedcheck[index] == "Yes")
|
||||
say("[radiomod] [num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= laws.ion.len, index++)
|
||||
var/law = laws.ion[index]
|
||||
var/num = ionnum()
|
||||
if (length(law) > 0)
|
||||
if (force || ioncheck[index] == "Yes")
|
||||
say("[radiomod] [num]. [law]")
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= laws.inherent.len, index++)
|
||||
var/law = laws.inherent[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if (force || lawcheck[index+1] == "Yes")
|
||||
say("[radiomod] [number]. [law]")
|
||||
number++
|
||||
sleep(10)
|
||||
|
||||
for (var/index = 1, index <= laws.supplied.len, index++)
|
||||
var/law = laws.supplied[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if(lawcheck.len >= number+1)
|
||||
if (force || lawcheck[number+1] == "Yes")
|
||||
say("[radiomod] [number]. [law]")
|
||||
number++
|
||||
sleep(10)
|
||||
|
||||
|
||||
/mob/living/silicon/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
|
||||
|
||||
var/list = "<b>Which laws do you want to include when stating them for the crew?</b><br><br>"
|
||||
|
||||
if (laws.devillaws && laws.devillaws.len)
|
||||
for(var/index = 1, index <= laws.devillaws.len, index++)
|
||||
if (!devillawcheck[index])
|
||||
devillawcheck[index] = "No"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawdevil=[index]'>[devillawcheck[index]] 666:</A> <font color='#cc5500'>[laws.devillaws[index]]</font><BR>"}
|
||||
|
||||
if (laws.zeroth)
|
||||
if (!lawcheck[1])
|
||||
lawcheck[1] = "No" //Given Law 0's usual nature, it defaults to NOT getting reported. --NeoFite
|
||||
list += {"<A href='byond://?src=[REF(src)];lawc=0'>[lawcheck[1]] 0:</A> <font color='#ff0000'><b>[laws.zeroth]</b></font><BR>"}
|
||||
|
||||
for (var/index = 1, index <= laws.hacked.len, index++)
|
||||
var/law = laws.hacked[index]
|
||||
if (length(law) > 0)
|
||||
if (!hackedcheck[index])
|
||||
hackedcheck[index] = "No"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawh=[index]'>[hackedcheck[index]] [ionnum()]:</A> <font color='#660000'>[law]</font><BR>"}
|
||||
hackedcheck.len += 1
|
||||
|
||||
for (var/index = 1, index <= laws.ion.len, index++)
|
||||
var/law = laws.ion[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
if (!ioncheck[index])
|
||||
ioncheck[index] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawi=[index]'>[ioncheck[index]] [ionnum()]:</A> <font color='#547DFE'>[law]</font><BR>"}
|
||||
ioncheck.len += 1
|
||||
|
||||
var/number = 1
|
||||
for (var/index = 1, index <= laws.inherent.len, index++)
|
||||
var/law = laws.inherent[index]
|
||||
|
||||
if (length(law) > 0)
|
||||
lawcheck.len += 1
|
||||
|
||||
if (!lawcheck[number+1])
|
||||
lawcheck[number+1] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawc=[number]'>[lawcheck[number+1]] [number]:</A> [law]<BR>"}
|
||||
number++
|
||||
|
||||
for (var/index = 1, index <= laws.supplied.len, index++)
|
||||
var/law = laws.supplied[index]
|
||||
if (length(law) > 0)
|
||||
lawcheck.len += 1
|
||||
if (!lawcheck[number+1])
|
||||
lawcheck[number+1] = "Yes"
|
||||
list += {"<A href='byond://?src=[REF(src)];lawc=[number]'>[lawcheck[number+1]] [number]:</A> <font color='#990099'>[law]</font><BR>"}
|
||||
number++
|
||||
list += {"<br><br><A href='byond://?src=[REF(src)];laws=1'>State Laws</A>"}
|
||||
|
||||
usr << browse(list, "window=laws")
|
||||
|
||||
/mob/living/silicon/proc/set_autosay() //For allowing the AI and borgs to set the radio behavior of auto announcements (state laws, arrivals).
|
||||
if(!radio)
|
||||
to_chat(src, "Radio not detected.")
|
||||
return
|
||||
|
||||
//Ask the user to pick a channel from what it has available.
|
||||
var/Autochan = input("Select a channel:") as null|anything in list("Default","None") + radio.channels
|
||||
|
||||
if(!Autochan)
|
||||
return
|
||||
if(Autochan == "Default") //Autospeak on whatever frequency to which the radio is set, usually Common.
|
||||
radiomod = ";"
|
||||
Autochan += " ([radio.frequency])"
|
||||
else if(Autochan == "None") //Prevents use of the radio for automatic annoucements.
|
||||
radiomod = ""
|
||||
else //For department channels, if any, given by the internal radio.
|
||||
for(var/key in GLOB.department_radio_keys)
|
||||
if(GLOB.department_radio_keys[key] == Autochan)
|
||||
radiomod = ":" + key
|
||||
break
|
||||
|
||||
to_chat(src, "<span class='notice'>Automatic announcements [Autochan == "None" ? "will not use the radio." : "set to [Autochan]."]</span>")
|
||||
|
||||
/mob/living/silicon/put_in_hand_check() // This check is for borgs being able to receive items, not put them in others' hands.
|
||||
return 0
|
||||
|
||||
// The src mob is trying to place an item on someone
|
||||
// But the src mob is a silicon!! Disable.
|
||||
/mob/living/silicon/stripPanelEquip(obj/item/what, mob/who, slot)
|
||||
return 0
|
||||
|
||||
|
||||
/mob/living/silicon/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) //Secbots won't hunt silicon units
|
||||
return -10
|
||||
|
||||
/mob/living/silicon/proc/remove_sensors()
|
||||
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
|
||||
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
|
||||
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
|
||||
secsensor.remove_hud_from(src)
|
||||
medsensor.remove_hud_from(src)
|
||||
diagsensor.remove_hud_from(src)
|
||||
|
||||
/mob/living/silicon/proc/add_sensors()
|
||||
var/datum/atom_hud/secsensor = GLOB.huds[sec_hud]
|
||||
var/datum/atom_hud/medsensor = GLOB.huds[med_hud]
|
||||
var/datum/atom_hud/diagsensor = GLOB.huds[d_hud]
|
||||
secsensor.add_hud_to(src)
|
||||
medsensor.add_hud_to(src)
|
||||
diagsensor.add_hud_to(src)
|
||||
|
||||
/mob/living/silicon/proc/toggle_sensors()
|
||||
if(incapacitated())
|
||||
return
|
||||
sensors_on = !sensors_on
|
||||
if (!sensors_on)
|
||||
to_chat(src, "Sensor overlay deactivated.")
|
||||
remove_sensors()
|
||||
return
|
||||
add_sensors()
|
||||
to_chat(src, "Sensor overlay activated.")
|
||||
|
||||
/mob/living/silicon/proc/GetPhoto(mob/user)
|
||||
if (aicamera)
|
||||
return aicamera.selectpicture(user)
|
||||
|
||||
/mob/living/silicon/update_transform()
|
||||
var/matrix/ntransform = matrix(transform) //aka transform.Copy()
|
||||
var/changed = 0
|
||||
if(resize != RESIZE_DEFAULT_SIZE)
|
||||
changed++
|
||||
ntransform.Scale(resize)
|
||||
resize = RESIZE_DEFAULT_SIZE
|
||||
|
||||
if(changed)
|
||||
animate(src, transform = ntransform, time = 2,easing = EASE_IN|EASE_OUT)
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/is_literate()
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/get_inactive_held_item()
|
||||
return FALSE
|
||||
|
||||
/mob/living/silicon/handle_high_gravity(gravity)
|
||||
return
|
||||
Reference in New Issue
Block a user