Files
Paradise/code/game/objects/items/weapons/scrolls.dm
warriorstar-orion 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

76 lines
2.5 KiB
Plaintext

/obj/item/teleportation_scroll
name = "scroll of teleportation"
desc = "A scroll for moving around."
icon = 'icons/obj/wizard.dmi'
icon_state = "scroll"
var/uses = 4
w_class = WEIGHT_CLASS_SMALL
item_state = "paper"
throw_speed = 4
throw_range = 20
origin_tech = "bluespace=6"
resistance_flags = FLAMMABLE
/obj/item/teleportation_scroll/apprentice
name = "lesser scroll of teleportation"
uses = 1
origin_tech = "bluespace=5"
/obj/item/teleportation_scroll/examine(mob/user)
. = ..()
. += "<span class='notice'>Number of uses: [uses]. This scroll will vanish after the final use.</span>"
. += "<span class='notice'>P.S. Don't forget to bring your gear, you'll need it to cast most spells.</span>"
/obj/item/teleportation_scroll/attack_self__legacy__attackchain(mob/living/user)
if(!uses) //somehow?
to_chat(user, "<span class='warning'>You attempt to read the scroll but it disintegrates in your hand, it appears that is has run out of charges!</span>")
qdel(src)
return
var/picked_area
picked_area = tgui_input_list(user, "Area to jump to", "Teleport where?", SSmapping.teleportlocs)
if(!picked_area)
return
var/area/thearea = SSmapping.teleportlocs[picked_area]
if(user.stat || user.restrained())
return
if(!(user == loc || (in_range(src, user) && isturf(user.loc))))
return //They can't use it if they put it in their bag or drop it and walk off, but if they are stood 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 class='warning'>A mysterious force disrupts your arcane spell matrix, and you remain where you are.</span>")
return
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(is_blocked_turf(T))
continue
L.Add(T)
if(!length(L))
to_chat(user, "<span class='warning'>The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry.</span>")
return
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--
if(!uses)
to_chat(user, "<span class='warning'>The scroll fizzles out of existence as the last of the magic within fades.</span>")
qdel(src)
user.update_action_buttons_icon() //Update action buttons as some spells might now be castable