mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
Small bible / bullet catcher component code cleanup (#81835)
## About The Pull Request Saw this weird use of storing a component in a var when it didn't really need to be so I just refactored it a little bit.
This commit is contained in:
@@ -77,29 +77,24 @@ GLOBAL_LIST_INIT(bibleitemstates, list(
|
||||
unique = TRUE
|
||||
/// Deity this bible is related to
|
||||
var/deity_name = "Space Jesus"
|
||||
/// Component which catches bullets for us
|
||||
var/datum/component/bullet_catcher
|
||||
|
||||
/obj/item/book/bible/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/anti_magic, MAGIC_RESISTANCE_HOLY)
|
||||
bullet_catcher = AddComponent(\
|
||||
AddComponent(\
|
||||
/datum/component/bullet_intercepting,\
|
||||
active_slots = ITEM_SLOT_SUITSTORE,\
|
||||
on_intercepted = CALLBACK(src, PROC_REF(on_intercepted_bullet)),\
|
||||
block_charges = 1,\
|
||||
)
|
||||
|
||||
/obj/item/book/bible/Destroy(force)
|
||||
QDEL_NULL(bullet_catcher)
|
||||
return ..()
|
||||
|
||||
/// Destroy the bible when it's shot by a bullet
|
||||
/obj/item/book/bible/proc/on_intercepted_bullet(mob/living/victim, obj/projectile/bullet)
|
||||
victim.add_mood_event("blessing", /datum/mood_event/blessing)
|
||||
playsound(victim, 'sound/magic/magic_block_holy.ogg', 50, TRUE)
|
||||
victim.visible_message(span_warning("\The [src] takes \the [bullet] in [victim]'s place!"))
|
||||
victim.visible_message(span_warning("[src] takes [bullet] in [victim]'s place!"))
|
||||
var/obj/structure/fluff/paper/stack/pages = new(get_turf(src))
|
||||
pages.dir = pick(GLOB.alldirs)
|
||||
pages.setDir(pick(GLOB.alldirs))
|
||||
name = "punctured bible"
|
||||
desc = "A memento of good luck, or perhaps divine intervention?"
|
||||
icon_state = "shot"
|
||||
@@ -107,7 +102,6 @@ GLOBAL_LIST_INIT(bibleitemstates, list(
|
||||
GLOB.bible_icon_state = "shot" // New symbol of your religion if you hadn't picked one
|
||||
atom_storage?.remove_all(get_turf(src))
|
||||
QDEL_NULL(atom_storage)
|
||||
QDEL_NULL(bullet_catcher)
|
||||
|
||||
/obj/item/book/bible/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user