Fixes wizard's spellbook becoming inaccessible (#67844)

Wizard spellbooks have a mechanic that binds the book to their first user, so other people can't use it. However, it binds the spellbook to the wizard's body, not their mind. This makes it so the spellbook is inaccessible to the wizard after becoming a lich or mindswapping, which doesn't seem to be intended. The PR just makes the spellbook check for the mind, not the body, to fix this. Fixes #64927 and #56216
This commit is contained in:
Coffee
2022-06-21 11:04:27 -04:00
committed by GitHub
parent f72a0939d8
commit f0fd530032
2 changed files with 12 additions and 8 deletions
@@ -647,7 +647,9 @@
/// Determines if this spellbook can refund anything.
var/can_refund = TRUE
var/mob/living/carbon/human/owner
/// The mind that first used the book. Automatically assigned when a wizard spawns.
var/datum/mind/owner
var/list/entries = list()
/obj/item/spellbook/examine(mob/user)
@@ -685,16 +687,18 @@
/obj/item/spellbook/attack_self(mob/user)
if(!owner)
if(!user.mind)
return
to_chat(user, span_notice("You bind the spellbook to yourself."))
owner = user
owner = user.mind
return
if(user != owner)
if(user.mind != owner)
if(user.mind.special_role == ROLE_WIZARD_APPRENTICE)
to_chat(user, "If you got caught sneaking a peek from your teacher's spellbook, you'd likely be expelled from the Wizard Academy. Better not.")
else
to_chat(user, span_warning("The [name] does not recognize you as its owner and refuses to open!"))
return
. = ..()
return ..()
/obj/item/spellbook/attackby(obj/item/O, mob/user, params)
if(!can_refund)
+4 -4
View File
@@ -329,13 +329,13 @@
r_pocket = /obj/item/teleportation_scroll
l_hand = /obj/item/staff
/datum/outfit/wizard/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
/datum/outfit/wizard/post_equip(mob/living/carbon/human/wizard, visualsOnly = FALSE)
if(visualsOnly)
return
var/obj/item/spellbook/S = locate() in H.back
if(S)
S.owner = H
var/obj/item/spellbook/new_spellbook = locate() in wizard.back
if(new_spellbook)
new_spellbook.owner = wizard.mind
/datum/outfit/wizard/apprentice
name = "Wizard Apprentice"