mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
Santa Claus can now hear prayers that mention him or christmas. (#96406)
## About The Pull Request Santa Claus can hear prayers that contain the words "santa", "claus", "christmas" or "xmas". Prayers containing the word "satan" have a 40% probability to being "erroneously" relayed to Santa instead. Talk about a terrible typo. I'm toooootally sure nobody will do it on purpose (totally forced joke ik ik). Santa cannot know who the person praying is if not told inside the prayer itself, however he can tell if the person is naughty (either antag or has the evil trait) or not, so be mindful of that. If tired or harassed by unwanted prayers, Santa can also click an action button at any time to silence them. The prayers will still be sent to admins, they just won't be heard by Mr. Claus. This PR comes with a new component and a mild refactor of prayers. For admins, the message from the pray verb is now wrapped in boxed message spans. This will make prayers a bit easier to notice, since the lack of message box coupled with lack of sound (for now, unless it's the chaplain praying) makes them easy to miss. Also tinfoil hats prevent you from hearing prayers, Santa (redundant with the action button, this is just a little touch). ## Why It's Good For The Game Early Christmas PR ! Yeah, I know, headsets exist and Santa Claus is very capable of wearing one, but he's the same guy who rides a flying sleight, climb down chimneys (notwithstanding his corpulent body). The prayer thing makes a bit sense if you think of the more religious roots of the character, though our Santa Claus is a bit more secular ya know, and this is more of an excuse to give him something extra. Oh, yeah, if people will abuse the feature, I guess I could add an incapacitated check for the praying mob so that Santa won't hear prayers from people dying or restrained, or remove the tidbit that says if the person who sent the prayer is naughty or not. ## Changelog 🆑 admin: Prayers from players are now boxed (like examine messages and some health readouts for example), making them easier to tell apart from the constant stream of text in your chat tabs. add: Santa Claus can now hear prayers that mention him or Christmas. He won't know who's praying unless told, though he can tell if they're naughty. /🆑
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* A component that allows the attached mind to listen prayers from other mobs.
|
||||
* Unlike admins, they cannot smite the person for it, also the prayers are anonymous unless the person says who he's in the message.
|
||||
*/
|
||||
/datum/component/listen_prayers
|
||||
///A callback called before the prayer is heard. May alter the message or prevent it from being heard if it returns FALSE
|
||||
var/datum/callback/pre_prayer_callback
|
||||
///This will be affixed to the "deities" that have heard this message.
|
||||
var/deity_name
|
||||
///The action that the owner can use to ignore the prayers
|
||||
var/datum/action/innate/listen_prayers/toggle
|
||||
///The description we give to the instance of the listen_prayers toggle.
|
||||
var/toggle_desc
|
||||
|
||||
/datum/component/listen_prayers/Initialize(datum/callback/pre_prayer_callback, deity_name, toggle_desc)
|
||||
if (!istype(parent, /datum/mind))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
src.pre_prayer_callback = pre_prayer_callback
|
||||
src.deity_name = deity_name
|
||||
src.toggle_desc = toggle_desc
|
||||
|
||||
/datum/component/listen_prayers/Destroy()
|
||||
pre_prayer_callback = null
|
||||
return ..()
|
||||
|
||||
/datum/component/listen_prayers/RegisterWithParent()
|
||||
RegisterSignal(SSdcs, COMSIG_GLOB_SEND_PRAYER, PROC_REF(on_sent_prayer))
|
||||
var/datum/mind/mind = parent
|
||||
|
||||
var/datum/action/innate/listen_prayers/toggle = new(mind)
|
||||
if(toggle_desc)
|
||||
toggle.desc = toggle_desc
|
||||
if(mind.current)
|
||||
toggle.Grant(mind.current)
|
||||
|
||||
/datum/component/listen_prayers/UnregisterFromParent()
|
||||
UnregisterSignal(SSdcs, COMSIG_GLOB_SEND_PRAYER)
|
||||
QDEL_NULL(toggle)
|
||||
|
||||
/datum/component/listen_prayers/proc/on_sent_prayer(source, mob/praying, message, prayer_type, symbol, list/deities_that_listened)
|
||||
SIGNAL_HANDLER
|
||||
var/datum/mind/mind = parent
|
||||
if(!mind.current || mind.current.stat >= UNCONSCIOUS || !mind.current.client) //You can't hear prayers if unconscious or disconnected
|
||||
return
|
||||
if(!isliving(praying) || praying.stat == DEAD)
|
||||
return FALSE //I don't see any reason in hell to why dead people should be allowed into this. This isn't a knockoff TRAIT_SIXTHSENSE.
|
||||
if(praying == mind.current) //Ignore prayers coming from ourselves.
|
||||
return
|
||||
if(mind.current.client in GLOB.admins) //This is redundant if we're adminning
|
||||
return
|
||||
if(HAS_MIND_TRAIT(mind.current, TRAIT_DONT_HEAR_PRAYERS))
|
||||
return
|
||||
var/list/arguments = args.Copy(2)
|
||||
if(pre_prayer_callback && !pre_prayer_callback.Invoke(args))
|
||||
return
|
||||
prayer_type = arguments[ARG_PRAYER_TYPE]
|
||||
symbol = arguments[ARG_PRAYER_SYMBOL]
|
||||
message = "[icon2html(arguments[ARG_PRAYER_SYMBOL], mind.current.client)]<b><font color=[GLOB.prayer_type_to_font_color[prayer_type]]>[prayer_type]: </font></b> [span_notice(arguments[ARG_PRAYER_MSG])]"
|
||||
to_chat(mind.current, custom_boxed_message(GLOB.prayer_type_to_message_box[prayer_type], message))
|
||||
SEND_SOUND(mind.current, sound('sound/effects/pray.ogg'))
|
||||
if(deity_name)
|
||||
deities_that_listened += deity_name
|
||||
|
||||
///An action to stop hearing prayers on command. Doesn't do a whole lot without the associated component
|
||||
/datum/action/innate/listen_prayers
|
||||
name = "Listen Prayers"
|
||||
button_icon = 'icons/hud/actions.dmi'
|
||||
button_icon_state = "pray"
|
||||
desc = "Allows you to eavesdrop on prayers from the world around you."
|
||||
active = TRUE
|
||||
|
||||
/datum/action/innate/listen_prayers/Destroy()
|
||||
REMOVE_TRAIT(owner, TRAIT_DONT_HEAR_PRAYERS, ACTION_TRAIT)
|
||||
return ..()
|
||||
|
||||
/datum/action/innate/listen_prayers/is_action_active(atom/movable/screen/movable/action_button/current_button)
|
||||
return !HAS_TRAIT_FROM(owner, TRAIT_DONT_HEAR_PRAYERS, ACTION_TRAIT)
|
||||
|
||||
/datum/action/innate/listen_prayers/Activate()
|
||||
active = TRUE
|
||||
REMOVE_TRAIT(owner, TRAIT_DONT_HEAR_PRAYERS, ACTION_TRAIT)
|
||||
to_chat(owner, span_green("You are ready to listen to prayers once again."))
|
||||
build_all_button_icons(UPDATE_BUTTON_BACKGROUND)
|
||||
|
||||
/datum/action/innate/listen_prayers/Deactivate()
|
||||
active = FALSE
|
||||
ADD_TRAIT(owner, TRAIT_DONT_HEAR_PRAYERS, ACTION_TRAIT)
|
||||
to_chat(owner, span_green("You stop listening to prayers."))
|
||||
build_all_button_icons(UPDATE_BUTTON_BACKGROUND)
|
||||
Reference in New Issue
Block a user