mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
announcement side
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
if(..())
|
||||
return
|
||||
var/mob/living/silicon/ai/AI = usr
|
||||
AI.announcement()
|
||||
AI.ai_announcement()
|
||||
|
||||
/atom/movable/screen/ai/call_shuttle
|
||||
name = "Call Emergency Shuttle"
|
||||
|
||||
@@ -104,6 +104,8 @@
|
||||
// TODO: Currently unused, needs port from TG.
|
||||
/// Station alert datum for showing alerts UI
|
||||
var/datum/station_alert/alert_control
|
||||
/// Announcement UI
|
||||
var/datum/ai_announcement/ai_announcement
|
||||
/// Lists possible spoken words for announcements
|
||||
var/datum/announcement_help/announcement_help
|
||||
///remember AI's last location
|
||||
@@ -206,6 +208,7 @@
|
||||
QDEL_NULL(doomsday_device)
|
||||
QDEL_NULL(robot_control)
|
||||
// QDEL_NULL(alert_control)
|
||||
QDEL_NULL(ai_announcement)
|
||||
QDEL_NULL(announcement_help)
|
||||
QDEL_NULL(aiMulti)
|
||||
QDEL_NULL(aiPDA)
|
||||
|
||||
55
code/modules/mob/living/silicon/ai/ai_announcement.dm
Normal file
55
code/modules/mob/living/silicon/ai/ai_announcement.dm
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifdef AI_VOX
|
||||
/mob/living/silicon/ai/verb/ai_announcement()
|
||||
set name = "Vox Announcement"
|
||||
set desc = "Make an audible announcement!"
|
||||
set category = "AI Commands"
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(!ai_announcement)
|
||||
ai_announcement = new(src)
|
||||
|
||||
ai_announcement.ui_interact(src)
|
||||
|
||||
/datum/ai_announcement
|
||||
var/mob/living/silicon/ai/owner
|
||||
|
||||
/datum/ai_announcement/New(mob/living/silicon/ai/new_owner)
|
||||
if(!istype(new_owner))
|
||||
qdel(src)
|
||||
owner = new_owner
|
||||
|
||||
/datum/ai_announcement/ui_status(mob/living/silicon/ai/user)
|
||||
if(owner == user && !owner.incapacitated())
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/datum/ai_announcement/ui_state(mob/user)
|
||||
return GLOB.always_state
|
||||
|
||||
/datum/ai_announcement/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "AIAnnouncement")
|
||||
ui.open()
|
||||
|
||||
/datum/ai_announcement/ui_static_data(mob/user)
|
||||
var/list/data = ..()
|
||||
data["last_announcement"] = owner.last_announcement
|
||||
data["vox_types"] = GLOB.vox_types
|
||||
return data
|
||||
|
||||
/datum/ai_announcement/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
switch(action)
|
||||
if("announce")
|
||||
var/vox_type = params["vox_type"]
|
||||
if(!vox_type)
|
||||
return
|
||||
var/to_speak = params["to_speak"]
|
||||
if(!to_speak)
|
||||
return
|
||||
owner.announcement(vox_type, to_speak)
|
||||
ui.close()
|
||||
#endif
|
||||
@@ -79,27 +79,23 @@
|
||||
|
||||
// Make sure that the code compiles with AI_VOX undefined
|
||||
#ifdef AI_VOX
|
||||
#define VOX_DELAY 600
|
||||
/mob/living/silicon/ai/proc/announcement()
|
||||
#define VOX_DELAY 1 MINUTES
|
||||
/mob/living/silicon/ai/proc/announcement(voxType = "Female", message)
|
||||
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>")
|
||||
to_chat(src, span_notice("Please wait [DisplayTimeText(announcing_vox - world.time)]."))
|
||||
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 GLOB.vox_types
|
||||
|
||||
if(!message || announcing_vox > world.time)
|
||||
if(!message || !GLOB.vox_types[voxType])
|
||||
return
|
||||
|
||||
if(incapacitated())
|
||||
return
|
||||
|
||||
if(control_disabled)
|
||||
to_chat(src, "<span class='warning'>Wireless interface disabled, unable to interact with announcement PA.</span>")
|
||||
to_chat(src, span_warning("Wireless interface disabled, unable to interact with announcement PA."))
|
||||
return
|
||||
|
||||
var/list/words = splittext(trim(message), " ")
|
||||
@@ -117,7 +113,7 @@
|
||||
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>")
|
||||
to_chat(src, span_notice("These words are not available on the announcement system: [english_list(incorrect_words)]."))
|
||||
return
|
||||
|
||||
announcing_vox = world.time + VOX_DELAY
|
||||
|
||||
Reference in New Issue
Block a user