From 2c1fdb41ebc6a26e3bb7f401222a3fc8354a3e2a Mon Sep 17 00:00:00 2001 From: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Date: Tue, 1 Oct 2019 19:39:01 -0500 Subject: [PATCH] Places bought wizard items into your hand instead of on the floor (#12470) --- code/game/gamemodes/wizard/spellbook.dm | 22 ++++++++++--------- .../mob/living/carbon/human/inventory.dm | 11 ++++++---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm index d2842c21c24..088088ee365 100644 --- a/code/game/gamemodes/wizard/spellbook.dm +++ b/code/game/gamemodes/wizard/spellbook.dm @@ -14,11 +14,13 @@ /datum/spellbook_entry/proc/IsSpellAvailable() // For config prefs / gamemode restrictions - these are round applied return 1 -/datum/spellbook_entry/proc/CanBuy(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) // Specific circumstances + +/datum/spellbook_entry/proc/CanBuy(mob/living/carbon/human/user, obj/item/spellbook/book) // Specific circumstances if(book.usesYou have learned [S.name].") return 1 -/datum/spellbook_entry/proc/CanRefund(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) +/datum/spellbook_entry/proc/CanRefund(mob/living/carbon/human/user, obj/item/spellbook/book) if(!refundable) return 0 if(!S) @@ -66,7 +68,7 @@ return 1 return 0 -/datum/spellbook_entry/proc/Refund(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) //return point value or -1 for failure +/datum/spellbook_entry/proc/Refund(mob/living/carbon/human/user, obj/item/spellbook/book) //return point value or -1 for failure var/area/wizard_station/A = locate() if(!(user in A.contents)) to_chat(user, "You can only refund spells at the wizard lair") @@ -384,8 +386,8 @@ buy_word = "Summon" var/item_path = null -/datum/spellbook_entry/item/Buy(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) - new item_path(get_turf(user)) +/datum/spellbook_entry/item/Buy(mob/living/carbon/human/user, obj/item/spellbook/book) + user.put_in_hands(new item_path) feedback_add_details("wizard_spell_learned", log_name) return 1 @@ -413,7 +415,7 @@ log_name = "SO" category = "Artefacts" -/datum/spellbook_entry/item/scryingorb/Buy(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) +/datum/spellbook_entry/item/scryingorb/Buy(mob/living/carbon/human/user, obj/item/spellbook/book) if(..()) if(!(XRAY in user.mutations)) user.mutations.Add(XRAY) @@ -430,7 +432,7 @@ log_name = "SS" category = "Artefacts" -/datum/spellbook_entry/item/soulstones/Buy(var/mob/living/carbon/human/user,var/obj/item/spellbook/book) +/datum/spellbook_entry/item/soulstones/Buy(mob/living/carbon/human/user, obj/item/spellbook/book) . = ..() if(.) user.mind.AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/conjure/construct(null)) @@ -637,7 +639,7 @@ OB.limit++ qdel(O) -/obj/item/spellbook/proc/GetCategoryHeader(var/category) +/obj/item/spellbook/proc/GetCategoryHeader(category) var/dat = "" switch(category) if("Offensive") @@ -672,7 +674,7 @@ dat += "Items are not bound to you and can be stolen. Additionaly they cannot typically be returned once purchased.
" return dat -/obj/item/spellbook/proc/wrap(var/content) +/obj/item/spellbook/proc/wrap(content) var/dat = "" dat +="Spellbook" dat += {" diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index f0d4a3e9a79..68ae7fe3af0 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -310,10 +310,13 @@ else to_chat(src, "You are trying to equip this item to an unsupported inventory slot. Report this to a coder!") -/mob/living/carbon/human/put_in_hands(obj/item/W) - if(!W) return 0 - if(put_in_active_hand(W)) return 1 - else if(put_in_inactive_hand(W)) return 1 +/mob/living/carbon/human/put_in_hands(obj/item/I) + if(!I) + return FALSE + if(put_in_active_hand(I)) + return TRUE + else if(put_in_inactive_hand(I)) + return TRUE else . = ..()