Makes it possible for the AI to make station wide announcements. Improved AI verb handling in case of death/restoration.

This commit is contained in:
PsiOmega
2014-08-19 11:58:58 +02:00
parent df6723deb0
commit a2253617cf
9 changed files with 121 additions and 52 deletions

View File

@@ -1,5 +1,6 @@
/proc/captain_announce(var/text)
world << "<h1 class='alert'>Priority Announcement</h1>"
world << "<span class='alert'>[html_encode(text)]</span>"
world << "<br>"
/proc/captain_announce(message as text, title = "Priority Announcement", announcer = "")
world << "<h1 class='alert'>[html_encode(title)]</h1>"
world << "<span class='alert'>[html_encode(message)]</span>"
if(announcer)
world << "<span class='alert'> -[html_encode(announcer)]</span>"
world << "<br>"

View File

@@ -231,6 +231,7 @@ That prevents a few funky behaviors.
new /obj/structure/AIcore/deactivated(T.loc)
T.aiRestorePowerRoutine = 0
T.control_disabled = 1
T.aiRadio.disabledAi = 1
T.loc = C
C.AI = T
T.cancel_camera()
@@ -245,6 +246,7 @@ That prevents a few funky behaviors.
var/mob/living/silicon/ai/A = locate() in C//I love locate(). Best proc ever.
if(A)//If AI exists on the card. Else nothing since both are empty.
A.control_disabled = 0
A.aiRadio.disabledAi = 0
A.loc = T.loc//To replace the terminal.
C.icon_state = "aicard"
C.name = "inteliCard"

View File

@@ -87,13 +87,14 @@
src.occupant.adjustToxLoss(-1)
src.occupant.adjustBruteLoss(-1)
src.occupant.updatehealth()
if (src.occupant.health >= 0 && src.occupant.stat == 2)
src.occupant.stat = 0
if (src.occupant.health >= 0 && src.occupant.stat == DEAD)
src.occupant.stat = CONSCIOUS
src.occupant.lying = 0
dead_mob_list -= src.occupant
living_mob_list += src.occupant
src.overlays -= image('icons/obj/computer.dmi', "ai-fixer-404")
src.overlays += image('icons/obj/computer.dmi', "ai-fixer-full")
src.occupant.add_ai_verbs()
src.updateUsrDialog()
sleep(10)
src.active = 0

View File

@@ -1,4 +1,28 @@
#define AI_CHECK_WIRELESS 1
#define AI_CHECK_RADIO 2
var/list/ai_list = list()
var/list/ai_verbs_default = list(
/mob/living/silicon/ai/proc/ai_announcement,
/mob/living/silicon/ai/proc/ai_call_shuttle,
// /mob/living/silicon/ai/proc/ai_recall_shuttle,
/mob/living/silicon/ai/proc/ai_camera_track,
/mob/living/silicon/ai/proc/ai_camera_list,
/mob/living/silicon/ai/proc/ai_goto_location,
/mob/living/silicon/ai/proc/ai_remove_location,
/mob/living/silicon/ai/proc/ai_hologram_change,
/mob/living/silicon/ai/proc/ai_network_change,
/mob/living/silicon/ai/proc/pick_icon,
/mob/living/silicon/ai/proc/ai_roster,
/mob/living/silicon/ai/proc/ai_statuschange,
/mob/living/silicon/ai/proc/ai_store_location,
/mob/living/silicon/ai/proc/checklaws,
/mob/living/silicon/ai/proc/control_integrated_radio,
/mob/living/silicon/ai/proc/core,
/mob/living/silicon/ai/proc/show_laws_verb,
/mob/living/silicon/ai/proc/toggle_acceleration,
/mob/living/silicon/ai/proc/toggle_camera_light
)
//Not sure why this is necessary...
/proc/AutoUpdateAI(obj/subject)
@@ -53,19 +77,12 @@ var/list/ai_list = list()
var/datum/trackable/track = null
var/last_announcement = ""
proc/add_ai_verbs(var/mob/M)
M.verbs += /mob/living/silicon/ai/proc/ai_call_shuttle
M.verbs += /mob/living/silicon/ai/proc/ai_camera_track
M.verbs += /mob/living/silicon/ai/proc/ai_camera_list
M.verbs += /mob/living/silicon/ai/proc/ai_goto_location
M.verbs += /mob/living/silicon/ai/proc/ai_remove_location
M.verbs += /mob/living/silicon/ai/proc/ai_hologram_change
M.verbs += /mob/living/silicon/ai/proc/ai_network_change
M.verbs += /mob/living/silicon/ai/proc/ai_roster
M.verbs += /mob/living/silicon/ai/proc/ai_statuschange
M.verbs += /mob/living/silicon/ai/proc/ai_store_location
M.verbs += /mob/living/silicon/ai/proc/control_integrated_radio
M.verbs += /mob/living/silicon/ai/proc/toggle_camera_light
/mob/living/silicon/ai/proc/add_ai_verbs()
src.verbs += ai_verbs_default
/mob/living/silicon/ai/proc/remove_ai_verbs()
src.verbs -= ai_verbs_default
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
@@ -95,8 +112,6 @@ proc/add_ai_verbs(var/mob/M)
else
laws = new base_law_type
verbs += /mob/living/silicon/ai/proc/show_laws_verb
aiPDA = new/obj/item/device/pda/ai(src)
aiPDA.owner = name
aiPDA.ownjob = "AI"
@@ -193,7 +208,7 @@ proc/add_ai_verbs(var/mob/M)
if(powered_ai.anchored)
use_power = 2
/mob/living/silicon/ai/verb/pick_icon()
/mob/living/silicon/ai/proc/pick_icon()
set category = "AI Commands"
set name = "Set AI Core Display"
if(stat || aiRestorePowerRoutine)
@@ -288,20 +303,43 @@ proc/add_ai_verbs(var/mob/M)
set name = "Show Crew Manifest"
show_station_manifest()
/mob/living/silicon/ai/var/message_cooldown = 0
/mob/living/silicon/ai/proc/ai_announcement()
set category = "AI Commands"
set name = "Make Station Announcement"
if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO))
return
if(message_cooldown)
src << "Please allow one minute to pass between announcements."
return
var/input = stripped_input(usr, "Please write a message to announce to the station crew.", "A.I. Announcement")
if(!input)
return
if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO))
return
captain_announce(input, "A.I. Announcement", src.name)
log_say("[key_name(usr)] has made an AI announcement: [input]")
message_admins("[key_name_admin(usr)] has made an AI announcement.", 1)
message_cooldown = 1
spawn(600)//One minute cooldown
message_cooldown = 0
/mob/living/silicon/ai/proc/ai_call_shuttle()
set category = "AI Commands"
set name = "Call Emergency Shuttle"
if(src.stat == 2)
src << "You can't call the shuttle because you are dead!"
if(check_unable(AI_CHECK_WIRELESS))
return
if(istype(usr,/mob/living/silicon/ai))
var/mob/living/silicon/ai/AI = src
if(AI.control_disabled)
usr << "Wireless control is disabled!"
return
var/confirm = alert("Are you sure you want to call the shuttle?", "Confirm Shuttle Call", "Yes", "No")
if(check_unable(AI_CHECK_WIRELESS))
return
if(confirm == "Yes")
call_shuttle_proc(src)
@@ -311,20 +349,19 @@ proc/add_ai_verbs(var/mob/M)
if(C)
C.post_status("shuttle")
return
/mob/living/silicon/ai/proc/ai_cancel_call()
/mob/living/silicon/ai/proc/ai_recall_shuttle()
set category = "AI Commands"
if(src.stat == 2)
src << "You can't send the shuttle back because you are dead!"
set name = "Recall Emergency Shuttle"
if(check_unable(AI_CHECK_WIRELESS))
return
if(istype(usr,/mob/living/silicon/ai))
var/mob/living/silicon/ai/AI = src
if(AI.control_disabled)
src << "Wireless control is disabled!"
return
cancel_call_proc(src)
return
var/confirm = alert("Are you sure you want to recall the shuttle?", "Confirm Shuttle Recall", "Yes", "No")
if(check_unable(AI_CHECK_WIRELESS))
return
if(confirm == "Yes")
cancel_call_proc(src)
/mob/living/silicon/ai/check_eye(var/mob/user as mob)
if (!current)
@@ -534,7 +571,7 @@ proc/add_ai_verbs(var/mob/M)
src.cameraFollow = null
if (!C || stat == 2) //C.can_use())
if (!C || stat == DEAD) //C.can_use())
return 0
if(!src.eyeobj)
@@ -587,8 +624,7 @@ proc/add_ai_verbs(var/mob/M)
src.cameraFollow = null
var/cameralist[0]
if(usr.stat == 2)
usr << "You can't change your camera network because you are dead!"
if(check_unable())
return
var/mob/living/silicon/ai/U = usr
@@ -631,9 +667,9 @@ proc/add_ai_verbs(var/mob/M)
set category = "AI Commands"
set name = "AI Status"
if(usr.stat == 2)
usr <<"You cannot change your emotional status because you are dead!"
if(check_unable(AI_CHECK_WIRELESS))
return
var/list/ai_emotions = list("Very Happy", "Happy", "Neutral", "Unsure", "Confused", "Surprised", "Sad", "Upset", "Angry", "Awesome", "BSOD", "Blank", "Problems?", "Facepalm", "Friend Computer")
var/emote = input("Please, select a status!", "AI Status", null, null) in ai_emotions
for (var/obj/machinery/M in machines) //change status
@@ -656,6 +692,9 @@ proc/add_ai_verbs(var/mob/M)
set desc = "Change the default hologram available to AI to something else."
set category = "AI Commands"
if(check_unable())
return
var/input
if(alert("Would you like to select a hologram based on a crew member or switch to unique avatar?",,"Crew Member","Unique")=="Crew Member")
@@ -704,6 +743,9 @@ proc/add_ai_verbs(var/mob/M)
set desc = "Toggles the light on the camera the AI is looking through."
set category = "AI Commands"
if(check_unable())
return
camera_light_on = !camera_light_on
src << "Camera lights [camera_light_on ? "activated" : "deactivated"]."
if(!camera_light_on)
@@ -766,6 +808,25 @@ proc/add_ai_verbs(var/mob/M)
set desc = "Allows you to change settings of your radio."
set category = "AI Commands"
if(check_unable(AI_CHECK_RADIO))
return
src << "Accessing Subspace Transceiver control..."
if (src.aiRadio)
src.aiRadio.interact(src)
/mob/living/silicon/ai/proc/check_unable(var/flags = 0)
if(stat == DEAD)
usr << "\red You are dead!"
return 1
if((flags & AI_CHECK_WIRELESS) && src.control_disabled)
usr << "\red Wireless control is disabled!"
return 1
if((flags & AI_CHECK_RADIO) && src.aiRadio.disabledAi)
src << "\red System Error - Transceiver Disabled!"
return 1
return 0
#undef AI_CHECK_WIRELESS
#undef AI_CHECK_RADIO

View File

@@ -11,6 +11,7 @@
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
remove_ai_verbs(src)
var/callshuttle = 0

View File

@@ -119,7 +119,7 @@
// Return to the Core.
/mob/living/silicon/ai/verb/core()
/mob/living/silicon/ai/proc/core()
set category = "AI Commands"
set name = "AI Core"
@@ -145,7 +145,7 @@
for(var/datum/camerachunk/c in eyeobj.visibleCameraChunks)
c.remove(eyeobj)
/mob/living/silicon/ai/verb/toggle_acceleration()
/mob/living/silicon/ai/proc/toggle_acceleration()
set category = "AI Commands"
set name = "Toggle Camera Acceleration"

View File

@@ -1,4 +1,3 @@
/mob/living/silicon/ai/proc/show_laws_verb()
set category = "AI Commands"
set name = "Show Laws"
@@ -107,7 +106,7 @@
sleep(10)
number++
/mob/living/silicon/ai/verb/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
/mob/living/silicon/ai/proc/checklaws() //Gives you a link-driven interface for deciding what laws the statelaws() proc will share with the crew. --NeoFite
set category = "AI Commands"
set name = "State Laws"

View File

@@ -182,3 +182,7 @@
health = 100 - getOxyLoss() - getToxLoss() - getBruteLoss()
else
health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss()
/mob/living/silicon/ai/rejuvenate()
..()
add_ai_verbs(src)

View File

@@ -120,7 +120,7 @@
O.show_laws()
O << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
add_ai_verbs(O)
O.add_ai_verbs()
O.job = "AI"
O.rename_self("ai",1)