Minor action datum refactor and spellcasting fix.
This commit is contained in:
@@ -45,6 +45,12 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
/obj/effect/proc_holder/singularity_pull()
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/Click()
|
||||
return Trigger(usr, FALSE)
|
||||
|
||||
/obj/effect/proc_holder/proc/Trigger(mob/user)
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/proc/InterceptClickOn(mob/living/caller, params, atom/A)
|
||||
if(caller.ranged_ability != src || ranged_ability_user != caller) //I'm not actually sure how these would trigger, but, uh, safety, I guess?
|
||||
to_chat(caller, "<span class='warning'><b>[caller.ranged_ability.name]</b> has been disabled.</span>")
|
||||
@@ -150,8 +156,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
if(mobs_blacklist)
|
||||
mobs_blacklist = typecacheof(mobs_blacklist)
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = FALSE, 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
|
||||
if(!can_cast(user, skipcharge))
|
||||
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = FALSE, mob/user = usr, skip_can_cast = FALSE) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
|
||||
if(!skip_can_cast && !can_cast(user, skipcharge))
|
||||
return FALSE
|
||||
|
||||
if(!skipcharge)
|
||||
@@ -183,15 +189,17 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
/obj/effect/proc_holder/spell/proc/invocation(mob/user = usr) //spelling the spell out and setting it on recharge/reducing charges amount
|
||||
switch(invocation_type)
|
||||
if("shout")
|
||||
if(prob(50))//Auto-mute? Fuck that noise
|
||||
user.say(invocation, forced = "spell")
|
||||
else
|
||||
user.say(replacetext(invocation," ","`"), forced = "spell")
|
||||
if(user.can_speak_vocal(invocation))
|
||||
if(prob(50))//Auto-mute? Fuck that noise
|
||||
user.say(invocation, forced = "spell")
|
||||
else
|
||||
user.say(replacetext(invocation," ","`"), forced = "spell")
|
||||
if("whisper")
|
||||
if(prob(50))
|
||||
user.whisper(invocation)
|
||||
else
|
||||
user.whisper(replacetext(invocation," ","`"))
|
||||
if(user.can_speak_vocal(invocation))
|
||||
if(prob(50))
|
||||
user.whisper(invocation)
|
||||
else
|
||||
user.whisper(replacetext(invocation," ","`"))
|
||||
if("emote")
|
||||
user.visible_message(invocation, invocation_emote_self) //same style as in mob/living/emote.dm
|
||||
|
||||
@@ -210,8 +218,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
qdel(action)
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/Click()
|
||||
if(cast_check())
|
||||
/obj/effect/proc_holder/spell/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(cast_check(FALSE, user, skip_can_cast))
|
||||
choose_targets()
|
||||
return 1
|
||||
|
||||
@@ -432,7 +440,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/can_cast(mob/user = usr, skipcharge = FALSE, silent = FALSE)
|
||||
var/magic_flags = SEND_SIGNAL(user, COMSIG_MOB_SPELL_CAST_CHECK, src)
|
||||
var/magic_flags = SEND_SIGNAL(user, COMSIG_MOB_SPELL_CAN_CAST, src)
|
||||
if(magic_flags & SPELL_SKIP_ALL_REQS)
|
||||
return TRUE
|
||||
|
||||
@@ -448,9 +456,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
to_chat(user, "<span class='notice'>You can't cast this spell here.</span>")
|
||||
return FALSE
|
||||
|
||||
if(!skipcharge)
|
||||
if(!charge_check(user))
|
||||
return FALSE
|
||||
if(!skipcharge && !charge_check(user, silent))
|
||||
return FALSE
|
||||
|
||||
if(user.stat && !stat_allowed && !(magic_flags & SPELL_SKIP_STAT))
|
||||
if(!silent)
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
var/current_amount = 0 //How many projectiles left.
|
||||
var/projectiles_per_fire = 1 //Projectiles per fire. Probably not a good thing to use unless you override ready_projectile().
|
||||
|
||||
/obj/effect/proc_holder/spell/aimed/Click()
|
||||
var/mob/living/user = usr
|
||||
/obj/effect/proc_holder/spell/aimed/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(!istype(user))
|
||||
return
|
||||
var/msg
|
||||
if(!can_cast(user, FALSE, TRUE))
|
||||
if(!skip_can_cast && !can_cast(user, FALSE, TRUE))
|
||||
msg = "<span class='warning'>You can no longer cast [name]!</span>"
|
||||
remove_ranged_ability(msg)
|
||||
return
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
action_icon_state = "lightning"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/tesla/Click()
|
||||
if(!ready && cast_check())
|
||||
StartChargeup()
|
||||
/obj/effect/proc_holder/spell/targeted/tesla/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(!ready && cast_check(FALSE, user, skip_can_cast))
|
||||
StartChargeup(user)
|
||||
return 1
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/tesla/proc/StartChargeup(mob/user = usr)
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
action_icon_state = "mime"
|
||||
action_background_icon_state = "bg_mime"
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/mime_wall/Click()
|
||||
if(usr && usr.mind)
|
||||
if(!usr.mind.miming)
|
||||
/obj/effect/proc_holder/spell/aoe_turf/conjure/mime_wall/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(user.mind)
|
||||
if(!user.mind.miming)
|
||||
to_chat(usr, "<span class='notice'>You must dedicate yourself to silence first.</span>")
|
||||
return
|
||||
invocation = "<B>[usr.real_name]</B> looks as if a wall is in front of [usr.p_them()]."
|
||||
invocation = "<B>[user.real_name]</B> looks as if a wall is in front of [user.p_them()]."
|
||||
else
|
||||
invocation_type ="none"
|
||||
..()
|
||||
@@ -41,17 +41,12 @@
|
||||
action_icon_state = "mime"
|
||||
action_background_icon_state = "bg_mime"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/mime/speak/Click()
|
||||
if(!usr)
|
||||
return
|
||||
if(!ishuman(usr))
|
||||
return
|
||||
var/mob/living/carbon/human/H = usr
|
||||
if(H.mind.miming)
|
||||
/obj/effect/proc_holder/spell/targeted/mime/speak/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(user.mind?.miming)
|
||||
still_recharging_msg = "<span class='warning'>You can't break your vow of silence that fast!</span>"
|
||||
else
|
||||
still_recharging_msg = "<span class='warning'>You'll have to wait before you can give your vow of silence again!</span>"
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/mime/speak/cast(list/targets,mob/user = usr)
|
||||
for(var/mob/living/carbon/human/H in targets)
|
||||
@@ -82,15 +77,15 @@
|
||||
action_icon_state = "mime"
|
||||
action_background_icon_state = "bg_mime"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/mime/Click()
|
||||
if(usr && usr.mind)
|
||||
if(!usr.mind.miming)
|
||||
/obj/effect/proc_holder/spell/targeted/forcewall/mime/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(user.mind)
|
||||
if(!user.mind.miming)
|
||||
to_chat(usr, "<span class='notice'>You must dedicate yourself to silence first.</span>")
|
||||
return
|
||||
invocation = "<B>[usr.real_name]</B> looks as if a blockade is in front of [usr.p_them()]."
|
||||
invocation = "<B>[user.real_name]</B> looks as if a blockade is in front of [user.p_them()]."
|
||||
else
|
||||
invocation_type ="none"
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/aimed/finger_guns
|
||||
name = "Finger Guns"
|
||||
@@ -114,19 +109,18 @@
|
||||
base_icon_state = "mime"
|
||||
|
||||
|
||||
/obj/effect/proc_holder/spell/aimed/finger_guns/Click()
|
||||
var/mob/living/carbon/human/owner = usr
|
||||
if(owner.incapacitated())
|
||||
to_chat(owner, "<span class='warning'>You can't properly point your fingers while incapacitated.</span>")
|
||||
/obj/effect/proc_holder/spell/aimed/finger_guns/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(user.incapacitated())
|
||||
to_chat(user, "<span class='warning'>You can't properly point your fingers while incapacitated.</span>")
|
||||
return
|
||||
if(usr && usr.mind)
|
||||
if(!usr.mind.miming)
|
||||
if(user.mind)
|
||||
if(!user.mind.miming)
|
||||
to_chat(usr, "<span class='notice'>You must dedicate yourself to silence first.</span>")
|
||||
return
|
||||
invocation = "<B>[usr.real_name]</B> fires [usr.p_their()] finger gun!"
|
||||
invocation = "<B>[user.real_name]</B> fires [user.p_their()] finger gun!"
|
||||
else
|
||||
invocation_type ="none"
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/touch/mimerope
|
||||
name = "Invisible Rope"
|
||||
@@ -144,8 +138,8 @@
|
||||
action_background_icon_state = "bg_mime"
|
||||
hand_path = /obj/item/melee/touch_attack/mimerope
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/touch/mimerope/Click()
|
||||
if(usr && usr.mind)
|
||||
/obj/effect/proc_holder/spell/targeted/touch/mimerope/Trigger(mob/user, skip_can_cast = TRUE)
|
||||
if(user.mind)
|
||||
if(!usr.mind.miming)
|
||||
to_chat(usr, "<span class='notice'>You must dedicate yourself to silence first.</span>")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user