mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-22 05:17:38 +01:00
cc0a809b4c
This PR adds a feature requested of me by @Fyniiy , adding optional Filters to the Narrate panel that allow Storytellers to narrate only to people that meet a set condition. The conditions themselves were specifically requested to be "Psi Narrates" and "Synth Narrates", with optional variations on Synth narrates that include people with cranial implants. While I was touching these files, I've also fixed the improper message sanitization bug with admin messages in general. <img width="926" height="536" alt="image" src="https://github.com/user-attachments/assets/08dcfd2a-5399-48b0-a13d-2bfd3a2c88f0" /> Here's a breakdown of the filter options. 1. **Skrell-like Psi-sensitives**: Anyone with a Psi-sensitivity score of "At least 1". This will include Skrell, anyone with a Psi-receiver, and people with the High Psi-sensitivity trait. It will exclude people who are blocked from receiving telepathy for any reason, such as having a mindshield, mindblanker, or having the psi-suppression power active. Skrell with the Low Psi-sensitivity trait are counted as "Human-like Psi-sensitives", and so won't be caught by this filter. 2. **Human-like Psi-sensitives**: Anyone who isn't blocked from receiving telepathy, and also has a Psi-sensitivity score of "At least 0". This will basically catch "Most people who aren't a Vaurca, Synthetic, or Diona". It will ignore Humanoids with the Low Psi-sensitivity trait. 3. **Silicons**: Basically all of the possible robots/IPCs. 4. **Silicons + Implants**: It's fairly common practice during Hivebot related events for Storytellers to also include characters with brain implants. This filter automates that by including said brain implant owners in the "Are you a synthetic?" check. 5. **Hivenet**: Pretty simple, people with the Vaurca language. This would be Vaurca, plus anyone with the hivenet implants.
89 lines
4.1 KiB
Plaintext
89 lines
4.1 KiB
Plaintext
/// !DEPRECATED: GO USE check_psi_sensitivity() INSTEAD
|
|
/atom/movable/proc/has_psi_aug()
|
|
return FALSE
|
|
|
|
/mob/living/carbon/has_psi_aug()
|
|
var/obj/item/organ/internal/augment/bioaug/psi/psiaug = internal_organs_by_name[BP_AUG_PSI]
|
|
return psiaug && !psiaug.is_broken()
|
|
|
|
/**
|
|
* Checks via signal if the target is blocked from RECEIVING psionic messages.
|
|
* Traditionally, most organic life can in some way RECEIVE psionic messages via a Zona Bovinae, though some lack it.
|
|
* Implants, drugs, and some psi powers may temporarily block RECEIVING.
|
|
*
|
|
* User should be the "Caster" of the power if possible.
|
|
* Wide_Field should be set to TRUE for anything calling this inside For/While loops.
|
|
* Basically if you're searching a list, declare it TRUE so that lethal mind blankers don't instagib you.
|
|
* If it's single-target, keep it FALSE.
|
|
*
|
|
* This is NOT a check for "Can Receive?", if you need that go use check_psi_sensitivity().
|
|
*/
|
|
/atom/movable/proc/is_psi_blocked(mob/user, var/wide_field = FALSE)
|
|
var/cancelled = FALSE
|
|
var/cancel_return = SPAN_WARNING("[src]'s mind is inaccessible, like hitting a brick wall.")
|
|
SEND_SIGNAL(src, COMSIG_PSI_MIND_POWER, user, &cancelled, &cancel_return, wide_field)
|
|
if(cancelled || (!has_zona_bovinae() && !has_psi_aug()))
|
|
return cancel_return
|
|
|
|
/**
|
|
* Check the "effective psi-sensitivity" of a mob. AKA: The target's RECEIVING statistic.
|
|
* This can be influenced by anything wishing to reply to the signal, such as implants, drugs, other psi-powers, etc.
|
|
* It also includes the actual psi-sensitivity of real psionics such as Skrell.
|
|
* This returns a float that is any real number (including negatives).
|
|
*
|
|
* A typical human will (assuming they have no positive temporary modifiers) will return anywhere from -2 and 0,
|
|
* so for a "not-psi sensitive" check, you'll want to do check_psi_sensitivity() <= 0.
|
|
*
|
|
* A typical "real psionic" will return between 1 and 2. Possibly more.
|
|
* So to check for "Yes they're psychic", look for check_psi_sensitivity >= 1
|
|
*
|
|
* And for "Any positive mods allowed", use check_psi_sensitivity > 0
|
|
*/
|
|
/atom/movable/proc/check_psi_sensitivity()
|
|
var/effective_sensitivity = 0
|
|
// effective_sensitivity is being sent as a Pointer by marking it with the Ampersand (&)
|
|
// This means that components which have a RegisterSignal() associated with this will receive the memory address of the var/effective_sensitivity in this proc.
|
|
// They are then allowed to add or subtract to this proc's var directly, without needing to return a number.
|
|
// We have to do this with a pointer because it allows us to obtain a Sum of all psi-sensitivity modifiers.
|
|
// If we instead relied on a Return, we would only be able to get the modifier of the first component to respond.
|
|
SEND_SIGNAL(src, COMSIG_PSI_CHECK_SENSITIVITY, &effective_sensitivity)
|
|
|
|
// Pointers can be problematic if they're used to point to a value on a datum, since that can cause unintended hard deletes.
|
|
// Here however, their use is acceptable because the pointer will cease to exist as soon as the proc reaches this return statement.
|
|
return effective_sensitivity
|
|
|
|
/mob/living/check_psi_sensitivity()
|
|
var/effective_sensitivity = ..()
|
|
if(psi)
|
|
effective_sensitivity += psi.get_rank()
|
|
return effective_sensitivity
|
|
|
|
/atom/movable/proc/has_zona_bovinae()
|
|
return FALSE
|
|
|
|
/mob/living/has_zona_bovinae()
|
|
return TRUE
|
|
|
|
/mob/living/carbon/has_zona_bovinae()
|
|
if(HAS_TRAIT(src, TRAIT_PSIONICALLY_DEAF))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/atom/movable/proc/is_psi_pingable()
|
|
return !is_psi_blocked()
|
|
|
|
/mob/living/simple_animal/is_psi_pingable()
|
|
return psi_pingable
|
|
|
|
/**
|
|
* A common layered filter pattern for psionics. Helps with reducing the size of guard clauses.
|
|
* Includes every psionic check for RECEIVING starting with the Zona Bovina, and ending with Psi-sensitivity.
|
|
* Set the sensitivity_threshold for your desired minimum Psi-sensitivity to pass.
|
|
* The most common ones you might want are:
|
|
* 2 for "Antag-like".
|
|
* 1 for "Skrell-like".
|
|
* 0 for "Human-like".
|
|
*/
|
|
/atom/movable/proc/is_telepathy_blocked(var/sensitivity_threshold = 0)
|
|
return (!has_zona_bovinae() || is_psi_blocked() || check_psi_sensitivity() < sensitivity_threshold)
|