Files
Bubberstation/code/datums/components/sect_nullrod_bonus.dm
carlarctg da54aba8eb Fixed sect nullrod bonus component (#87692)
## About The Pull Request

Fixed sect nullrod bonus component by adding comsig_sect_change to
signals registered.

This didn't work if you picked nullrod before sect. Now it does!

## Why It's Good For The Game

bug

## Changelog

🆑
fix: Fixed sect nullrod bonus component
/🆑
2024-11-07 05:03:34 +01:00

36 lines
1.2 KiB
Plaintext

/**
* sect nullrod bonus component; for sekret rite combos
*
* Good example is the bow and pyre sect. pick the bow, get a special rite in the pyre sect.
*/
/datum/component/sect_nullrod_bonus
/// assoc list of nullrod type -> rites it unlocks
var/list/bonus_rites
/// has this component given the bonus yet
var/bonus_applied = FALSE
/datum/component/sect_nullrod_bonus/Initialize(list/bonus_rites)
if(!istype(parent, /datum/religion_sect))
return COMPONENT_INCOMPATIBLE
src.bonus_rites = bonus_rites
check_bonus_rites()
/datum/component/sect_nullrod_bonus/RegisterWithParent()
RegisterSignals(SSdcs, list(COMSIG_RELIGIOUS_SECT_CHANGED, COMSIG_GLOB_NULLROD_PICKED), PROC_REF(on_nullrod_picked))
/datum/component/sect_nullrod_bonus/UnregisterFromParent()
UnregisterSignal(SSdcs, list(COMSIG_RELIGIOUS_SECT_CHANGED, COMSIG_GLOB_NULLROD_PICKED))
/datum/component/sect_nullrod_bonus/proc/on_nullrod_picked(datum/source)
SIGNAL_HANDLER
check_bonus_rites()
/datum/component/sect_nullrod_bonus/proc/check_bonus_rites()
if(bonus_applied || !GLOB.holy_weapon_type)
return
var/list/unlocked_rites = bonus_rites[GLOB.holy_weapon_type]
if(!unlocked_rites || !GLOB.religious_sect)
return
GLOB.religious_sect.rites_list.Add(unlocked_rites)
bonus_applied = TRUE