Files
Yogstation/code/datums/components/religious_tool.dm
Redd 9d88851f02 [READY] Mass English Fixes PHASE 1 (#16484)
* fixes contractions to proper english in negative.dm

* fixes possessives in miscellaneous.dm

* fixes capitalization in brain_item.dm

* fixes capitalization in liver.dm

* Fixes negative.dm typo

* adds a missing i to ai _DEFINES

* Fixes typo in cargo defines to spell auxiliary properly

* fixes contractions in code\datums\action.dm

* fixes capitalization in code\datums\components\religious_tool.dm

* Fixes spelling of sudoriferous in code\datums\diseases\advance\symptoms\fire.dm

* changes necrotizing tissues and organs to necrosing tissues and organs in code\datums\diseases\advance\symptoms\flesh_eating.dm

necrosing is proper english here

* Fixes a missing letter in code\datums\diseases\advance\symptoms\itching.dm

* Changes s to z in code\datums\diseases\advance\symptoms\radiation.dm

* Updates clarity in code\datums\diseases\brainrot.dm

* spells vengeance properly in code\datums\diseases\parrotpossession.dm

* fixes grammar in code\datums\diseases\wizarditis.dm

* fixes the spelling of "casualties" in code\datums\ert.dm

* removes extra t in code\datums\martial\cqc.dm

* Updates code\datums\martial\flying_fang.dm to match style of previous code

* adds t to code\datums\mutations\antenna.dm

* spells agitation right in code\datums\mutations\hulk.dm

* spells perceive right in code\datums\mutations\sight.dm

* fixes a contraction in code\datums\ruins\lavaland.dm

* changes "unbreachable" to "impenetrable" and "tradestation" to "trade station", as well as fixing a typo in code\datums\ruins\space.dm

* fixes typos in code\datums\shuttles.dm

* fixes a typo in code\datums\station_traits\negative_traits.dm

* Fixes a typo in code\datums\station_traits\positive_traits.dm

* Fixes spelling in code\datums\wires\mech_fabricator.dm

* fixes typo in code\datums\wounds\burns.dm

* resanguination is not a real word

* fixes typo in code\game\gamemodes\changeling\traitor_chan.dm

* fixes typos in code\game\gamemodes\clock_cult\clock_cult.dm

* fixes spelling in code\game\gamemodes\cult\cult.dm

* adds an s to posses in code\game\gamemodes\eldritch_cult\eldritch_cult.dm

* fixes a spelling mistake in code\game\gamemodes\hivemind\radar.dm

* fixes a typo in code\game\gamemodes\malfunction\malf.dm

* fixes spelling mistake in code\game\gamemodes\wizard\wizard.dm

* Fixes a spelling mistake in code\game\machinery\bounty_board.dm

* fixes whatever the fuck medical kiosks were spelling wise

* removes a t and lowercases bluespace as it isn't a proper noun in code\game\machinery\sci_bombardment.dm

* Fixes spelling mistake in code\game\machinery\shuttle\shuttle_heater.dm

* Fixes spelling issue in code\game\machinery\stasis.dm

* Fixes spelling issue in code\game\machinery\telecomms\computers\logbrowser.dm

* oranges can't fucking spell in code\game\mecha\equipment\tools\medical_tools.dm

* authentication is now spelled correctly in code\game\mecha\mech_fabricator.dm

* fixes spelling mistake in code\game\mecha\mecha.dm

* Updates "Defence" to "Defense" to be more in line with sprite information

* Fixes spelling issue in code\game\objects\items\grenades\chem_grenade.dm

* updates mecha defence mode to defense mode to be more in line with what is written as the icon_state

* Fixes english in code\game\objects\items\implants\implant_greytide.dm

* fixes spelling issue in code\game\objects\items\robot\robot_parts.dm

* fixes spelling issues in code\game\objects\items\storage\lockbox.dm

* Revert "Changes s to z in code\datums\diseases\advance\symptoms\radiation.dm"

This reverts commit 170f514f67 to change the z back to an s

* updates an extra m in object path in code\game\objects\structures\signs\signs_departments.dm

* spelling fix in code\game\objects\structures\crates_lockers\closets\bodybag.dm

* spells otherworldly correctly in code\game\objects\items\twohanded.dm

* food service is 2 separate words in code\game\objects\structures\crates_lockers\closets\job_closets.dm

* Fixes a spelling mistake in code\game\objects\items\toys.dm

* Fixes spelling of Nanotrasen in code\game\objects\items\supermatter_delaminator.dm

* Adderall is a proper noun in code\game\objects\items\sharpener.dm

* fixes spelling mistake in code\game\objects\items\religion.dm

* code\game\objects\items\puzzle_pieces.dm

* Janitalia is a proper noun

* Fixes spelling of occurrence in code\game\objects\items\miscellaneous.dm

* fixes the spelling of nurture and fixes a title in code\game\objects\items\manuals.dm

* @cuackles can't capitalize in code\game\objects\items\holy_weapons.dm

* nobody can spell environment in code\game\objects\items\holosign_creator.dm

* code\game\objects\items\gems.dm spelling fix

* spelling fix in code\game\objects\items\cards_ids.dm

* spelling fix code\game\objects\items\airlock_painter.dm

* map object paths updated for the one letter change to an object path

* more fixes

* Revert "updates an extra m in object path in code\game\objects\structures\signs\signs_departments.dm"

This reverts commit 98cb63b396.

* Revert "map object paths updated for the one letter change to an object path"

This reverts commit f4220a3505.

* Update mecha_topic.dm

* i hate myself
2022-11-26 15:52:14 +00:00

150 lines
6.1 KiB
Plaintext

/**
*
* Allows the parent to act similarly to the Altar of Gods with modularity. Invoke and Sect Selection is done via attacking with a bible. This means you cannot sacrifice Bibles (you shouldn't want to do this anyways although now that I mentioned it you probably will want to).
*
*/
/datum/component/religious_tool
dupe_mode = COMPONENT_DUPE_UNIQUE
/// Enables access to the global sect directly
var/datum/religion_sect/easy_access_sect
/// What extent do we want this religious tool to act? In case you don't want full access to the list. Generated on New
var/operation_flags
/// The rite currently being invoked
var/datum/religion_rites/performing_rite
///Sets the type for catalyst
var/catalyst_type = /obj/item/storage/book/bible
///Enables overide of COMPONENT_NO_AFTERATTACK, not recommended as it means you can potentially cause damage to the item using the catalyst.
var/force_catalyst_afterattack = FALSE
var/datum/callback/after_sect_select_cb
/datum/component/religious_tool/Initialize(_flags = ALL, _force_catalyst_afterattack = FALSE, _after_sect_select_cb, override_catalyst_type)
. = ..()
SetGlobalToLocal() //attempt to connect on start in case one already exists!
operation_flags = _flags
force_catalyst_afterattack = _force_catalyst_afterattack
after_sect_select_cb = _after_sect_select_cb
if(override_catalyst_type)
catalyst_type = override_catalyst_type
/datum/component/religious_tool/RegisterWithParent()
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY,.proc/AttemptActions)
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
/datum/component/religious_tool/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PARENT_ATTACKBY, COMSIG_PARENT_EXAMINE))
/**
* Sets the easy access variable to the global if it exists.
*/
/datum/component/religious_tool/proc/SetGlobalToLocal()
if(easy_access_sect)
return TRUE
if(!GLOB.religious_sect)
return FALSE
easy_access_sect = GLOB.religious_sect
after_sect_select_cb.Invoke()
return TRUE
/**
* Since all of these involve attackby, we require mega proc. Handles Invocation, Sacrificing, And Selection of Sects.
*/
/datum/component/religious_tool/proc/AttemptActions(datum/source, obj/item/the_item, mob/living/user)
/**********Sect Selection**********/
if(!SetGlobalToLocal())
if(!(operation_flags & RELIGION_TOOL_SECTSELECT))
return
. = COMPONENT_NO_AFTERATTACK //At this point you're intentionally trying to select a sect.
if(user.mind.holy_role != HOLY_ROLE_HIGHPRIEST)
to_chat(user, "<span class='warning'>You are not the high priest, and therefore cannot select a religious sect.")
return
var/list/available_options = generate_available_sects(user)
if(!available_options)
return
var/sect_select = input(user,"Select a sect (You CANNOT revert this decision!)","Select a Sect",null) in available_options
if(!sect_select || !user.canUseTopic(parent, BE_CLOSE, FALSE, NO_TK))
to_chat(user,"<span class ='warning'>You cannot select a sect at this time.</span>")
return
var/type_selected = available_options[sect_select]
GLOB.religious_sect = new type_selected()
for(var/i in GLOB.player_list)
if(!isliving(i))
continue
var/mob/living/am_i_holy_living = i
if(!am_i_holy_living.mind?.holy_role)
continue
GLOB.religious_sect.on_conversion(am_i_holy_living)
easy_access_sect = GLOB.religious_sect
after_sect_select_cb.Invoke()
return
/**********Rite Invocation**********/
else if(istype(the_item, catalyst_type))
if(!(operation_flags & RELIGION_TOOL_INVOKE))
return
. = force_catalyst_afterattack ? null : COMPONENT_NO_AFTERATTACK
if(!easy_access_sect.rites_list)
to_chat(user, "<span class='notice'>Your sect doesn't have any rites to perform!")
return
if(performing_rite)
to_chat(user, "<span class='notice'>There is a rite currently being performed here already!")
return
var/rite_select = input(user,"Select a rite to perform!","Select a rite",null) in easy_access_sect.rites_list
if(!rite_select || !user.canUseTopic(parent, BE_CLOSE, FALSE, NO_TK))
to_chat(user,"<span class ='warning'>You cannot perform the rite at this time.</span>")
return
var/selection2type = easy_access_sect.rites_list[rite_select]
performing_rite = new selection2type(parent)
if(!performing_rite.perform_rite(user, parent))
QDEL_NULL(performing_rite)
else
performing_rite.invoke_effect(user, parent)
easy_access_sect.adjust_favor(-performing_rite.favor_cost)
QDEL_NULL(performing_rite)
return
/**********Sacrificing**********/
else if(operation_flags & RELIGION_TOOL_SACRIFICE)
if(!easy_access_sect?.can_sacrifice(the_item,user))
return
easy_access_sect.on_sacrifice(the_item,user)
return COMPONENT_NO_AFTERATTACK
/**
* Generates a list of available sects to the user. Intended to support custom-availability sects. Because these are not instanced, we cannot put the availability on said sect beyond variables.
*/
/datum/component/religious_tool/proc/generate_available_sects(mob/user)
. = list()
for(var/i in subtypesof(/datum/religion_sect))
var/datum/religion_sect/not_a_real_instance_rs = i
if(initial(not_a_real_instance_rs.starter))
. += list(initial(not_a_real_instance_rs.name) = i)
/**
* Appends to examine so the user knows it can be used for religious purposes.
*/
/datum/component/religious_tool/proc/on_examine(datum/source, mob/user, list/examine_list)
var/can_i_see = FALSE
if(isobserver(user))
can_i_see = TRUE
else if(isliving(user))
var/mob/living/L = user
if(L.mind?.holy_role)
can_i_see = TRUE
if(!can_i_see)
return
if(!easy_access_sect)
if(operation_flags & RELIGION_TOOL_SECTSELECT)
examine_list += span_notice("This looks like it can be used to select a sect.")
return
examine_list += span_notice("The sect currently has [round(easy_access_sect.favor)] favor with [GLOB.deity].[(operation_flags & RELIGION_TOOL_SACRIFICE) ? "Desired items can be used on this to increase favor." : ""]")
if(!easy_access_sect.rites_list)
return //if we dont have rites it doesnt do us much good if the object can be used to invoke them!
if(operation_flags & RELIGION_TOOL_INVOKE)
examine_list += "List of available rites:"
examine_list += easy_access_sect.rites_list