From d7723a064c827b795cf6cbafb9aefceda9237389 Mon Sep 17 00:00:00 2001 From: Robustin Date: Fri, 29 Dec 2017 03:54:31 -0500 Subject: [PATCH] Spell action buttons finally fixed (#33882) * Action button fix * Action button fix * Spell action button fix * Spell action button fix * Update alien_powers.dm * Update spell.dm * Action button fix * Update touch_attacks.dm --- code/datums/action.dm | 2 ++ .../mob/living/carbon/alien/humanoid/alien_powers.dm | 2 +- code/modules/spells/spell.dm | 6 +++--- code/modules/spells/spell_types/touch_attacks.dm | 5 +++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/datums/action.dm b/code/datums/action.dm index ede0fa75a2..80f4789611 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -490,6 +490,8 @@ return FALSE return TRUE +/datum/action/spell_action/spell + /datum/action/spell_action/spell/IsAvailable() if(!target) return FALSE diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index 0760453094..6153c5629f 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -12,7 +12,7 @@ Doesn't work on other aliens/AI.*/ var/plasma_cost = 0 var/check_turf = FALSE has_action = TRUE - datum/action/spell_action/alien/action + base_action = /datum/action/spell_action/alien action_icon = 'icons/mob/actions/actions_xeno.dmi' action_icon_state = "spell_default" action_background_icon_state = "bg_alien" diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 85956b0c6d..d13f56b2cd 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -13,11 +13,12 @@ var/action_icon = 'icons/mob/actions/actions_spells.dmi' var/action_icon_state = "spell_default" var/action_background_icon_state = "bg_spell" + var/base_action = /datum/action/spell_action /obj/effect/proc_holder/Initialize() . = ..() if(has_action) - action = new(src) + action = new base_action(src) /obj/effect/proc_holder/proc/on_gain(mob/living/user) return @@ -103,6 +104,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th pass_flags = PASSTABLE density = FALSE opacity = 0 + base_action = /datum/action/spell_action/spell var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit? @@ -149,7 +151,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th action_icon = 'icons/mob/actions/actions_spells.dmi' action_icon_state = "spell_default" action_background_icon_state = "bg_spell" - datum/action/spell_action/spell/action /obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell @@ -255,7 +256,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th /obj/effect/proc_holder/spell/Initialize() . = ..() - action = new(src) START_PROCESSING(SSfastprocess, src) still_recharging_msg = "[name] is still recharging." diff --git a/code/modules/spells/spell_types/touch_attacks.dm b/code/modules/spells/spell_types/touch_attacks.dm index ffbee4789d..4a2f54e1f5 100644 --- a/code/modules/spells/spell_types/touch_attacks.dm +++ b/code/modules/spells/spell_types/touch_attacks.dm @@ -23,6 +23,11 @@ charge_counter = 0 stoplag(1) +/obj/effect/proc_holder/spell/targeted/touch/can_cast(mob/user = usr) + if(attached_hand) + return TRUE + return ..() + /obj/effect/proc_holder/spell/targeted/touch/proc/ChargeHand(mob/living/carbon/user) attached_hand = new hand_path(src) if(!user.put_in_hands(attached_hand))