diff --git a/code/__DEFINES/mob.dm b/code/__DEFINES/mob.dm index 8779d6e8860..cab30ebe8de 100644 --- a/code/__DEFINES/mob.dm +++ b/code/__DEFINES/mob.dm @@ -96,4 +96,8 @@ #define I_HELP "help" #define I_DISARM "disarm" #define I_GRAB "grab" -#define I_HARM "harm" \ No newline at end of file +#define I_HARM "harm" + +// AI wire/radio settings +#define AI_CHECK_WIRELESS 1 +#define AI_CHECK_RADIO 2 \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 286b2eebd64..4c7d3fe57b1 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1,9 +1,7 @@ -#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/announcement, + /mob/living/silicon/ai/proc/ai_announcement_text, /mob/living/silicon/ai/proc/ai_call_shuttle, /mob/living/silicon/ai/proc/ai_camera_track, /mob/living/silicon/ai/proc/ai_camera_list, @@ -79,6 +77,7 @@ var/list/ai_verbs_default = list( var/last_paper_seen = null var/can_shunt = 1 var/last_announcement = "" + var/datum/announcement/priority/announcement var/obj/machinery/bot/Bot var/turf/waypoint //Holds the turf of the currently selected waypoint. var/waypoint_mode = 0 //Waypoint mode is for selecting a turf via clicking. @@ -97,6 +96,12 @@ var/list/ai_verbs_default = list( src.verbs -= silicon_subsystems /mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0) + announcement = new() + announcement.title = "A.I. Announcement" + announcement.announcement_type = "A.I. Announcement" + announcement.announcer = name + announcement.newscast = 1 + var/list/possibleNames = ai_names var/pickedName = null @@ -210,6 +215,8 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/SetName(pickedName as text) ..() + + announcement.announcer = name if(eyeobj) eyeobj.name = "[pickedName] (AI Eye)" @@ -325,15 +332,35 @@ var/list/ai_verbs_default = list( set name = "Show Crew Manifest" set category = "AI Commands" show_station_manifest() + +/mob/living/silicon/ai/var/message_cooldown = 0 +/mob/living/silicon/ai/proc/ai_announcement_text() + 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 = input(usr, "Please write a message to announce to the station crew.", "A.I. Announcement") as message|null + if(!input) + return + + if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO)) + return + + announcement.Announce(input) + message_cooldown = 1 + spawn(600)//One minute cooldown + message_cooldown = 0 /mob/living/silicon/ai/proc/ai_call_shuttle() set name = "Call Emergency Shuttle" set category = "AI Commands" - if(src.stat == DEAD) - src << "You can't call the shuttle because you are dead!" - return - if(check_unable(AI_CHECK_WIRELESS)) return @@ -356,11 +383,7 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/proc/ai_cancel_call() set name = "Recall Emergency Shuttle" set category = "AI Commands" - - if(src.stat == 2) - src << "You can't send the shuttle back because you are dead!" - return - + if(check_unable(AI_CHECK_WIRELESS)) return @@ -394,10 +417,6 @@ var/list/ai_verbs_default = list( set desc = "Create a vocal announcement by typing in the available words to create a sentence." set category = "AI Commands" - if(src.stat == 2) - src << "You can't call make an announcement because you are dead!" - return - if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO)) return @@ -949,14 +968,14 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/proc/check_unable(var/flags = 0) if(stat == DEAD) - usr << "\red You are dead!" + usr << "You are dead!" return 1 if((flags & AI_CHECK_WIRELESS) && src.control_disabled) - usr << "\red Wireless control is disabled!" + usr << "Wireless control is disabled!" return 1 if((flags & AI_CHECK_RADIO) && src.aiRadio.disabledAi) - src << "\red System Error - Transceiver Disabled!" + src << "System Error - Transceiver Disabled!" return 1 return 0 @@ -980,7 +999,3 @@ var/list/ai_verbs_default = list( loc = card//Throw AI into the card. src << "You have been downloaded to a mobile storage device. Remote device connection severed." user << "Transfer successful: [name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory." - -#undef AI_CHECK_WIRELESS -#undef AI_CHECK_RADIO - diff --git a/code/modules/mob/living/silicon/ai/say.dm b/code/modules/mob/living/silicon/ai/say.dm index 96954d82d25..55eed0a2570 100644 --- a/code/modules/mob/living/silicon/ai/say.dm +++ b/code/modules/mob/living/silicon/ai/say.dm @@ -28,13 +28,19 @@ var/const/VOX_PATH = "sound/vox_fem/" popup.open() /mob/living/silicon/ai/proc/ai_announcement() + if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO)) + return + if(announcing_vox > world.time) - src << "Please wait [round((announcing_vox - world.time) / 10)] seconds." + src << "Please wait [round((announcing_vox - world.time) / 10)] seconds." 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 + var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", last_announcement) as message|null last_announcement = message + + if(check_unable(AI_CHECK_WIRELESS | AI_CHECK_RADIO)) + return if(!message || announcing_vox > world.time) return @@ -54,7 +60,7 @@ var/const/VOX_PATH = "sound/vox_fem/" incorrect_words += word if(incorrect_words.len) - src << "These words are not available on the announcement system: [english_list(incorrect_words)]." + src << "These words are not available on the announcement system: [english_list(incorrect_words)]." return announcing_vox = world.time + VOX_DELAY