Files
Paradise/code/game/objects/items/scrolls.dm
Alan c5c0990eb1 Migrate salvage and teleport scroll to new attack chain. (#32237)
* Migrate salvage and teleport scroll to new attack chain.

* Apply suggestion from CRUNCH review.

Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

* Add fingerprint.

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
2026-07-24 19:43:43 +00:00

86 lines
2.9 KiB
Plaintext

/obj/item/teleportation_scroll
name = "scroll of teleportation"
desc = "A scroll for moving around."
icon = 'icons/obj/wizard.dmi'
icon_state = "scroll"
inhand_icon_state = "paper"
w_class = WEIGHT_CLASS_SMALL
throw_speed = 4
throw_range = 20
origin_tech = "bluespace=6"
resistance_flags = FLAMMABLE
var/uses = 4
new_attack_chain = TRUE
/obj/item/teleportation_scroll/apprentice
name = "lesser scroll of teleportation"
uses = 1
origin_tech = "bluespace=5"
/obj/item/teleportation_scroll/examine(mob/user)
. = ..()
. += SPAN_NOTICE("Number of uses: [uses]. This scroll will vanish after the final use.")
. += SPAN_NOTICE("P.S. Don't forget to bring your gear, you'll need it to cast most spells.")
/obj/item/teleportation_scroll/activate_self(mob/living/user)
if(..())
return ITEM_INTERACT_COMPLETE
if(!uses) // Somehow?
to_chat(user, SPAN_WARNING("You attempt to read the scroll but it disintegrates in your hand! It appears that is has run out of charges!"))
qdel(src)
return ITEM_INTERACT_COMPLETE
if(!length(SSmapping.teleportlocs)) // Prevent a runtime. Yes, this actually happened during testing.
to_chat(user, SPAN_WARNING("There's nowhere to teleport to!"))
return ITEM_INTERACT_COMPLETE
var/picked_area
picked_area = tgui_input_list(user, "Area to jump to", "Teleport where?", SSmapping.teleportlocs)
if(!picked_area)
return ITEM_INTERACT_COMPLETE
var/area/thearea = SSmapping.teleportlocs[picked_area]
if(user.stat || user.restrained())
return ITEM_INTERACT_COMPLETE
if(!(user == loc || (in_range(src, user) && isturf(user.loc))))
return ITEM_INTERACT_COMPLETE // They can't use it if they put it in their bag or drop it and walk off, but if they are next to it they can.
if(thearea.tele_proof && !istype(thearea, /area/wizard_station)) // Nowhere in SSmapping.teleportlocs should be tele_proof, but better safe than sorry.
to_chat(user, SPAN_WARNING("A mysterious force disrupts your arcane spell matrix and you remain where you are!"))
return ITEM_INTERACT_COMPLETE
var/datum/effect_system/smoke_spread/smoke = new
smoke.set_up(5, FALSE, get_turf(user))
smoke.attach(user)
smoke.start()
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
if(T.is_blocked_turf())
continue
L.Add(T)
if(!length(L))
to_chat(user, SPAN_WARNING("The spell matrix was unable to locate a suitable teleport destination for an unknown reason! Sorry."))
return ITEM_INTERACT_COMPLETE
if(user && user.buckled)
user.unbuckle(force = TRUE)
if(user?.has_buckled_mobs())
user.unbuckle_all_mobs(force = TRUE)
user.forceMove(pick(L))
smoke.start()
uses--
add_fingerprint(user)
if(!uses)
to_chat(user, SPAN_WARNING("The scroll fizzles out of existence as the last of the magic within fades."))
qdel(src)
user.update_action_buttons_icon() // Update action buttons as some spells might now be castable.
return ITEM_INTERACT_COMPLETE