From 7fc44f1280f1bad32e83c0649b0df9b7c0fc3ed8 Mon Sep 17 00:00:00 2001 From: Antoonij <42318445+Antoonij@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:11:05 +0200 Subject: [PATCH] some fixes --- code/datums/components/ritual_object.dm | 12 +++++++++--- code/datums/rituals.dm | 13 ++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/code/datums/components/ritual_object.dm b/code/datums/components/ritual_object.dm index d3975f469a6..4ba065ebbfc 100644 --- a/code/datums/components/ritual_object.dm +++ b/code/datums/components/ritual_object.dm @@ -21,6 +21,7 @@ if(!isobj(parent)) return COMPONENT_INCOMPATIBLE + src.attacking_item_type = attacking_item_type src.allowed_categories = allowed_categories src.allowed_species = allowed_species @@ -35,10 +36,13 @@ /datum/component/ritual_object/proc/get_rituals() // We'll get all rituals for flexibility. LAZYCLEARLIST(rituals) + for(var/datum/ritual/ritual as anything in typecacheof(allowed_categories)) - if(ritual.name) - rituals += new ritual - ritual.link_object(parent) + if(!ritual.name) + continue + + rituals += new ritual + ritual.ritual_object = parent return @@ -56,6 +60,7 @@ return var/mob/living/carbon/human/human = user + if(attacking_item_type && !istype(item, attacking_item_type)) return @@ -92,6 +97,7 @@ /datum/component/ritual_object/proc/get_available_rituals(mob/living/carbon/human/human) var/list/rituals_list = list() + for(var/datum/ritual/ritual as anything in rituals) if(ritual.charges == 0) continue diff --git a/code/datums/rituals.dm b/code/datums/rituals.dm index 4d42d263693..bffa124b4cb 100644 --- a/code/datums/rituals.dm +++ b/code/datums/rituals.dm @@ -37,10 +37,7 @@ var/list/invokers = list() /// If defined - do_after will be added to your ritual var/cast_time - -/datum/ritual/proc/link_object(obj/obj) - ritual_object = obj - + /datum/ritual/Destroy(force) ritual_object = null LAZYNULL(used_things) @@ -179,8 +176,8 @@ var/needed_amount = required_things[thing] var/current_amount = 0 - for(var/obj in range(finding_range, ritual_object)) - if(!ispath(obj, thing)) + for(var/atom/obj in range(finding_range, ritual_object)) + if(!istype(obj, thing)) continue if(obj == invoker) @@ -349,7 +346,6 @@ return RITUAL_FAILED_ON_PROCEED message_admins("[key_name(human)] accomplished mindtransfer ritual on [key_name(invoker)]") - return RITUAL_SUCCESSFUL /datum/ritual/ashwalker/mind_transfer/disaster(obj/item/item, mob/living/carbon/human/invoker) @@ -368,7 +364,6 @@ return . = ..(bitflags) - return . /datum/ritual/ashwalker/summon @@ -400,6 +395,7 @@ var/obj/item/stack/sheet/sinew/sinew = locate() in used_things var/obj/item/stack/sheet/animalhide/goliath_hide/hide = locate() in used_things var/obj/item/organ/internal/regenerative_core/core = locate() in used_things + sinew.use(3) hide.use(1) qdel(core) @@ -420,7 +416,6 @@ return RITUAL_FAILED_ON_PROCEED human.forceMove(ritual_object) - return RITUAL_SUCCESSFUL /datum/ritual/ashwalker/summon/disaster(obj/item/item, mob/living/carbon/human/invoker)