mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-08 07:52:54 +00:00
## About The Pull Request Due to a mental breakdown caused by unfathomable abomination that is icons folder, I swore to myself to one day clean it. Today is kind of that day. Been at it for around 6, you gotta understand I need a rest. I tracked most changes in descriptions of commits if you are looking for details. ## Why It's Good For The Game Saner spriters make better sprites. And also, just helps keep track of things. ## Changelog 🆑 image: added sprites for different variants of scrolls. image: modified couple posters with ghost pixels. /🆑 --------- Co-authored-by: OrionTheFox <76465278+OrionTheFox@users.noreply.github.com>
67 lines
2.0 KiB
Plaintext
67 lines
2.0 KiB
Plaintext
/obj/item/teleportation_scroll
|
|
name = "scroll of teleportation"
|
|
desc = "A scroll for moving around."
|
|
icon = 'icons/obj/scrolls.dmi'
|
|
icon_state = "scroll"
|
|
worn_icon_state = "scroll"
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
inhand_icon_state = "paper"
|
|
throw_speed = 3
|
|
throw_range = 7
|
|
resistance_flags = FLAMMABLE
|
|
actions_types = list(/datum/action/cooldown/spell/teleport/area_teleport/wizard/scroll)
|
|
/// Number of uses the scroll gets.
|
|
var/uses = 4
|
|
|
|
/obj/item/teleportation_scroll/Initialize(mapload)
|
|
. = ..()
|
|
// In the future, this can be generalized into just "magic scrolls that give you a specific spell".
|
|
var/datum/action/cooldown/spell/teleport/area_teleport/wizard/scroll/teleport = locate() in actions
|
|
if(!teleport)
|
|
return
|
|
teleport.name = name
|
|
teleport.button_icon = icon
|
|
teleport.button_icon_state = icon_state
|
|
RegisterSignal(teleport, COMSIG_SPELL_AFTER_CAST, PROC_REF(on_spell_cast))
|
|
|
|
/// Deplete charges if spell is cast successfully
|
|
/obj/item/teleportation_scroll/proc/on_spell_cast(datum/action/cooldown/spell/cast_spell, mob/living/cast_on)
|
|
SIGNAL_HANDLER
|
|
uses--
|
|
if(uses > 0)
|
|
return
|
|
to_chat(cast_on, span_warning("[src] runs out of uses and crumbles to dust!"))
|
|
qdel(src)
|
|
|
|
/obj/item/teleportation_scroll/item_action_slot_check(slot, mob/user)
|
|
return (slot & ITEM_SLOT_HANDS)
|
|
|
|
/obj/item/teleportation_scroll/apprentice
|
|
name = "lesser scroll of teleportation"
|
|
uses = 1
|
|
|
|
/obj/item/teleportation_scroll/examine(mob/user)
|
|
. = ..()
|
|
if(uses > 0)
|
|
. += "It has [uses] use\s remaining."
|
|
|
|
/obj/item/teleportation_scroll/attack_self(mob/user)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
if(!uses)
|
|
return
|
|
if(!ishuman(user))
|
|
return
|
|
var/mob/living/carbon/human/human_user = user
|
|
if(human_user.incapacitated() || !human_user.is_holding(src))
|
|
return
|
|
var/datum/action/cooldown/spell/teleport/area_teleport/wizard/scroll/teleport = locate() in actions
|
|
if(!teleport)
|
|
to_chat(user, span_warning("[src] seems to be a faulty teleportation scroll, and has no magic associated."))
|
|
return
|
|
if(!teleport.Activate(user))
|
|
return
|
|
return TRUE
|