Files
Bubberstation/code/controllers/subsystem/communications.dm
coiax 3a1581d34d Adds Sscommunications subsystem (#23171)
* Adds SScommunications subsystem

🆑 coiax
add: Communication consoles now share cooldowns.
/🆑

Sharing cooldowns is good, having a central place to make announcements
is good. This moves some of the machinery for announcements out of the
consoles, which coincides with some plans I have for the communications
machinery of the station anyway.

* Oh yeah, AI's make vox announcements

* Removes priority for non-firing subsystem

* Moves the defines

* Removes dem defines

* Decoded input
2017-01-27 17:51:44 +01:00

38 lines
1.2 KiB
Plaintext

#define COMMUNICATION_COOLDOWN 600
#define COMMUNICATION_COOLDOWN_AI 600
var/datum/subsystem/communications/SScommunications
/datum/subsystem/communications
name = "Communications"
flags = SS_NO_INIT | SS_NO_FIRE
var/silicon_message_cooldown
var/nonsilicon_message_cooldown
/datum/subsystem/communications/New()
NEW_SS_GLOBAL(SScommunications)
/datum/subsystem/communications/proc/can_announce(mob/living/user, is_silicon)
if(is_silicon && silicon_message_cooldown > world.time)
. = FALSE
else if(!is_silicon && nonsilicon_message_cooldown > world.time)
. = FALSE
else
. = TRUE
/datum/subsystem/communications/proc/make_announcement(mob/living/user, is_silicon, input)
if(!can_announce(user, is_silicon))
return FALSE
if(is_silicon)
minor_announce(html_decode(input),"[user.name] Announces:")
silicon_message_cooldown = world.time + COMMUNICATION_COOLDOWN_AI
else
priority_announce(html_decode(input), null, 'sound/misc/announce.ogg', "Captain")
nonsilicon_message_cooldown = world.time + COMMUNICATION_COOLDOWN
log_say("[key_name(user)] has made a priority announcement: [input]")
message_admins("[key_name_admin(user)] has made a priority announcement.")
#undef COMMUNICATION_COOLDOWN
#undef COMMUNICATION_COOLDOWN_AI