Allows us to drop NODROP items if there is other way to get rid of them (#21080)

* adds proc to check if we can drop nodrop items

* C:/Program Files/Git/obj/effect/proc_holder/spell/touch refactor, support for wizard spells, xeno spells and changeling shield

* bug fixes, cleanup

* moved to signals, added support for mime fingergun

* fixed bugs

* cleanup

* same proc for removing weapon from active or any hand

* changeling fast swap exist again

* cleanup

* fix runtime

* signals cleanup

* review update

* Update code/datums/spells/mime.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/datums/spells/mime.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/datums/spells/touch_attacks.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* review updates

* fixing bug

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
HMBGERDO
2023-06-15 20:18:17 +02:00
committed by GitHub
parent b05e27bb17
commit b74cd79c03
10 changed files with 127 additions and 52 deletions
@@ -25,10 +25,6 @@
to_chat(user, "<span class='noticealien'>You withdraw your [src].</span>")
..()
/obj/effect/proc_holder/spell/touch/alien_spell/cast(list/targets, mob/living/carbon/user)
user.add_plasma(plasma_cost)
..()
/obj/effect/proc_holder/spell/touch/alien_spell/write_custom_logs(list/targets, mob/user)
user.create_log(ATTACK_LOG, "Cast the spell [name]")
+18 -3
View File
@@ -99,17 +99,32 @@
action_icon_state = "fingergun"
action_background_icon_state = "bg_mime"
var/gun = /obj/item/gun/projectile/revolver/fingergun
var/obj/item/gun/projectile/revolver/fingergun/current_gun
/obj/effect/proc_holder/spell/mime/fingergun/cast(list/targets, mob/user = usr)
for(var/mob/living/carbon/human/C in targets)
if(!istype(C.get_active_hand(), gun) && !istype(C.get_inactive_hand(), gun))
if(!current_gun)
to_chat(user, "<span class='notice'>You draw your fingers!</span>")
current_gun = new gun(get_turf(user), src)
C.drop_item()
C.put_in_hands(new gun)
C.put_in_hands(current_gun)
RegisterSignal(C, COMSIG_MOB_WILLINGLY_DROP, PROC_REF(holster_hand))
else
to_chat(user, "<span class='notice'>Holster your fingers first.</span>")
holster_hand(user, TRUE)
revert_cast(user)
/obj/effect/proc_holder/spell/mime/fingergun/Destroy()
current_gun = null
return ..()
/obj/effect/proc_holder/spell/mime/fingergun/proc/holster_hand(atom/target, any=FALSE)
SIGNAL_HANDLER
if(!current_gun || !any && action.owner.get_active_hand() != current_gun)
return
to_chat(action.owner, "<span class='notice'>You holster your fingers. Another time perhaps...</span>")
QDEL_NULL(current_gun)
/obj/effect/proc_holder/spell/mime/fingergun/fake
desc = "Pretend you're shooting bullets out of your fingers! 3 bullets available per cast. Use your fingers to holster them manually."
gun = /obj/item/gun/projectile/revolver/fingergun/fake
+15 -17
View File
@@ -9,26 +9,14 @@
/obj/effect/proc_holder/spell/touch/Click(mob/user = usr)
if(attached_hand)
qdel(attached_hand)
cooldown_handler.revert_cast()
attached_hand = null
if(on_remove_message)
to_chat(user, "<span class='notice'>You draw the power out of your hand.</span>")
discharge_hand(user, TRUE)
return FALSE
..()
charge_hand(user)
/obj/effect/proc_holder/spell/touch/cast(list/targets, mob/user = usr)
for(var/mob/living/carbon/target in targets)
if(!attached_hand)
if(!ChargeHand(target))
return FALSE
while(attached_hand) //hibernate untill the spell is actually used
cooldown_handler.recharge_time++ // adds a tick onto the cooldown each tick
sleep(1)
/obj/effect/proc_holder/spell/touch/proc/ChargeHand(mob/living/carbon/user)
/obj/effect/proc_holder/spell/touch/proc/charge_hand(mob/living/carbon/user)
var/hand_handled = 1
attached_hand = new hand_path(src)
RegisterSignal(user, COMSIG_MOB_WILLINGLY_DROP, PROC_REF(discharge_hand))
if(isalien(user))
user.put_in_hands(attached_hand)
return
@@ -42,13 +30,23 @@
hand_handled = 0
if(!hand_handled)
qdel(attached_hand)
cooldown_handler.revert_cast()
attached_hand = null
to_chat(user, "<span class='warning'>Your hands are full!</span>")
return 0
to_chat(user, "<span class='notice'>You channel the power of the spell to your hand.</span>")
return 1
/obj/effect/proc_holder/spell/touch/proc/discharge_hand(atom/target, any = FALSE)
SIGNAL_HANDLER
var/mob/living/carbon/user = action.owner
if(!istype(attached_hand))
return
if(!any && attached_hand != user.get_active_hand())
return
QDEL_NULL(attached_hand)
if(on_remove_message)
to_chat(user, "<span class='notice'>You draw the power out of your hand.</span>")
/obj/effect/proc_holder/spell/touch/disintegrate
name = "Disintegrate"