From f0fd530032e85b19becddacdb7fa7f9dd07b8a75 Mon Sep 17 00:00:00 2001 From: Coffee Date: Tue, 21 Jun 2022 11:04:27 -0400 Subject: [PATCH] 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 --- .../antagonists/wizard/equipment/spellbook.dm | 12 ++++++++---- code/modules/clothing/outfits/standard.dm | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm index 2113572e716..6e011ea3143 100644 --- a/code/modules/antagonists/wizard/equipment/spellbook.dm +++ b/code/modules/antagonists/wizard/equipment/spellbook.dm @@ -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) diff --git a/code/modules/clothing/outfits/standard.dm b/code/modules/clothing/outfits/standard.dm index 40f8aba297c..04c45a2cdbc 100644 --- a/code/modules/clothing/outfits/standard.dm +++ b/code/modules/clothing/outfits/standard.dm @@ -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"