[MIRROR] Bibles, Lighters, and Cowboy Hats can block bullets [MDB IGNORE] (#22282)

* Bibles, Lighters, and Cowboy Hats can block bullets (#76521)

## About The Pull Request

If you are wearing a bible or lighter in your suit slot, or a cowboy hat
on your head, there is a small (2%) chance that bullets (only bullets,
not lasers) will hit them instead of you.
This destroys lighters, removes the storage capacity of the bible, or
sends the hat flying off your head.

The Bounty Hunter's cowboy hat has a significantly higher chance to
intercept bullets.

## Why It's Good For The Game

Adds some fun flavour to these items.

## Changelog

🆑
add: A bible or lighter in your suit slot, or cowboy hat on your head
will occasionally intercept a bullet.
/🆑

* Bibles, Lighters, and Cowboy Hats can block bullets

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Bloop <vinylspiders@gmail.com>
This commit is contained in:
SkyratBot
2023-07-11 23:59:06 -04:00
committed by GitHub
co-authored by Jacquerel Bloop
parent 08ddf2a09e
commit 4a779bb4b6
9 changed files with 137 additions and 2 deletions
+27
View File
@@ -77,12 +77,39 @@ 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(\
/datum/component/bullet_intercepting,\
active_slots = ITEM_SLOT_SUITSTORE,\
on_intercepted = CALLBACK(src, PROC_REF(on_intercepted_bullet)),\
)
carve_out()
/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!"))
var/obj/structure/fluff/paper/stack/pages = new(get_turf(src))
pages.dir = pick(GLOB.alldirs)
name = "punctured bible"
desc = "A memento of good luck, or perhaps divine intervention?"
icon_state = "shot"
if (!GLOB.bible_icon_state)
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)
. = ..()
if(deity_name)