mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Fixed phylactery not dusting on zlevel change, converted mind transfer to lazy event (#27787)
This commit is contained in:
@@ -70,7 +70,15 @@
|
||||
// rads: The amount of radiation.
|
||||
/lazy_event/on_irradiate
|
||||
|
||||
// Called whenever an atom's z-level changes.
|
||||
// Seems to be invoked all over the place, actually. Someone should sort this out.
|
||||
// Arguments:
|
||||
// atom/movable/user: The atom that moved.
|
||||
// to_z: The new z.
|
||||
// from_z: The old z.
|
||||
/lazy_event/on_z_transition
|
||||
|
||||
// TODO: docs
|
||||
/lazy_event/on_post_z_transition
|
||||
|
||||
// Called whenever an /atom/movable moves.
|
||||
@@ -152,6 +160,11 @@
|
||||
// atom/target: the atom that's being bumped into.
|
||||
/lazy_event/on_bumped
|
||||
|
||||
// Called when mind/transfer_to() finishes.
|
||||
// Arguments:
|
||||
// datum/mind/mind: the mind that just got transferred.
|
||||
/lazy_event/after_mind_transfer
|
||||
|
||||
/datum
|
||||
/// Associative list of type path -> list(),
|
||||
/// where the type path is a descendant of /event_type.
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
//fix scrying raging mages issue.
|
||||
var/isScrying = 0
|
||||
var/list/heard_before = list()
|
||||
var/event/on_transfer_end
|
||||
|
||||
var/nospells = 0 //Can't cast spells.
|
||||
var/hasbeensacrificed = FALSE
|
||||
@@ -74,7 +73,6 @@
|
||||
|
||||
/datum/mind/New(var/key)
|
||||
src.key = key
|
||||
on_transfer_end = new(owner = src)
|
||||
|
||||
/datum/mind/proc/transfer_to(mob/new_character)
|
||||
if (!current)
|
||||
@@ -109,7 +107,7 @@
|
||||
|
||||
if (hasFactionsWithHUDIcons())
|
||||
update_faction_icons()
|
||||
INVOKE_EVENT(on_transfer_end, list("mind" = src))
|
||||
lazy_invoke_event(/lazy_event/after_mind_transfer, list("mind" = src))
|
||||
|
||||
/datum/mind/proc/transfer_to_without_current(var/mob/new_character)
|
||||
new_character.attack_log += "\[[time_stamp()]\]: mind transfer from a body-less observer to [new_character]"
|
||||
|
||||
@@ -196,7 +196,6 @@
|
||||
icon = 'icons/obj/wizard.dmi'
|
||||
icon_state = "phylactery_empty_noglow"
|
||||
var/charges = 0
|
||||
var/mindbound
|
||||
var/mob/bound_soul
|
||||
var/datum/mind/bound_mind
|
||||
|
||||
@@ -296,29 +295,27 @@
|
||||
bound_soul = to_bind
|
||||
|
||||
/obj/item/phylactery/proc/unbind_mind()
|
||||
if(bound_mind.on_transfer_end)
|
||||
bound_mind.on_transfer_end.Remove(mindbound)
|
||||
mindbound = null
|
||||
if(bound_mind)
|
||||
bound_mind.lazy_unregister_event(/lazy_event/after_mind_transfer, src, .proc/follow_mind)
|
||||
bound_mind = null
|
||||
|
||||
/obj/item/phylactery/proc/bind_mind(var/datum/mind/to_bind)
|
||||
mindbound = to_bind.on_transfer_end.Add(src, "follow_mind")
|
||||
to_bind.lazy_register_event(/lazy_event/after_mind_transfer, src, .proc/follow_mind)
|
||||
bound_mind = to_bind
|
||||
|
||||
/obj/item/phylactery/proc/follow_mind(list/arguments)
|
||||
/obj/item/phylactery/proc/follow_mind()
|
||||
unbind()
|
||||
bind(bound_mind.current)
|
||||
update_icon()
|
||||
|
||||
/obj/item/phylactery/proc/z_block(list/arguments)
|
||||
var/mob/user = arguments["user"]
|
||||
/obj/item/phylactery/proc/z_block(mob/user, to_z, from_z)
|
||||
if(user != bound_soul)
|
||||
unbind()
|
||||
return
|
||||
if(is_holder_of(user, src))
|
||||
return //We're in their pocket, you ash-happy bottle of soul!
|
||||
var/turf/T = get_turf(src)
|
||||
if(arguments["to_z"] != T.z)
|
||||
if(to_z != T.z)
|
||||
to_chat(user, "<span class = 'warning'><b>As you stray further and further away from \the [src], you feel your form unravel!</b></span>")
|
||||
spawn(rand(5 SECONDS, 15 SECONDS)) //Mr. Wizman, I don't feel so good
|
||||
if(user.gcDestroyed)
|
||||
|
||||
Reference in New Issue
Block a user