mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-14 09:27:45 +01:00
New Check (#11304)
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/spell/hand
|
||||
var/min_range = 0
|
||||
var/list/compatible_targets = list()
|
||||
var/casts = 1
|
||||
var/spell_delay = 5
|
||||
var/move_delay
|
||||
var/click_delay
|
||||
var/hand_state = "magic"
|
||||
|
||||
/spell/hand/choose_targets(mob/user = usr)
|
||||
return list(user)
|
||||
|
||||
/spell/hand/cast(list/targets, mob/user)
|
||||
for(var/mob/M in targets)
|
||||
if(M.get_active_hand())
|
||||
to_chat(user, "<span class='warning'>You need an empty hand to cast this spell.</span>")
|
||||
return
|
||||
var/obj/item/magic_hand/H = new(src)
|
||||
if(!M.put_in_active_hand(H))
|
||||
qdel(H)
|
||||
return
|
||||
to_chat(user, "You ready the [name] spell ([casts]/[casts] charges).")
|
||||
|
||||
/spell/hand/proc/valid_target(var/atom/a,var/mob/user) //we use seperate procs for our target checking for the hand spells.
|
||||
var/distance = get_dist(a,user)
|
||||
if((min_range && distance < min_range) || (range && distance > range))
|
||||
return 0
|
||||
if(!is_type_in_list(a,compatible_targets))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/spell/hand/proc/cast_hand(var/atom/a,var/mob/user) //same for casting.
|
||||
return 1
|
||||
@@ -1,56 +0,0 @@
|
||||
/*much like grab this item is used primarily for the utility it provides.
|
||||
Basically: I can use it to target things where I click. I can then pass these targets to a spell and target things not using a list.
|
||||
*/
|
||||
|
||||
/obj/item/magic_hand
|
||||
name = "Magic Hand"
|
||||
icon = 'icons/mob/screen/generic.dmi'
|
||||
flags = 0
|
||||
abstract = 1
|
||||
w_class = ITEMSIZE_HUGE
|
||||
icon_state = "grabbed1"
|
||||
var/next_spell_time = 0
|
||||
var/spell/hand/hand_spell
|
||||
var/casts = 0
|
||||
|
||||
/obj/item/magic_hand/New(var/spell/hand/S)
|
||||
hand_spell = S
|
||||
name = "[name] ([S.name])"
|
||||
casts = S.casts
|
||||
icon_state = S.hand_state
|
||||
|
||||
/obj/item/magic_hand/attack() //can't be used to actually bludgeon things
|
||||
return 1
|
||||
|
||||
/obj/item/magic_hand/afterattack(atom/A, mob/living/user)
|
||||
if(!hand_spell) //no spell? Die.
|
||||
user.drop_from_inventory(src)
|
||||
|
||||
if(!hand_spell.valid_target(A,user))
|
||||
return
|
||||
if(world.time < next_spell_time)
|
||||
to_chat(user, "<span class='warning'>The spell isn't ready yet!</span>")
|
||||
return
|
||||
|
||||
if(hand_spell.cast_hand(A,user))
|
||||
next_spell_time = world.time + hand_spell.spell_delay
|
||||
casts--
|
||||
if(hand_spell.move_delay)
|
||||
user.setMoveCooldown(hand_spell.move_delay)
|
||||
if(hand_spell.click_delay)
|
||||
user.setClickCooldown(hand_spell.move_delay)
|
||||
if(!casts)
|
||||
user.drop_from_inventory(src)
|
||||
return
|
||||
to_chat(user, "[casts]/[hand_spell.casts] charges left.")
|
||||
|
||||
/obj/item/magic_hand/throw_at() //no throwing pls
|
||||
usr.drop_from_inventory(src)
|
||||
|
||||
/obj/item/magic_hand/dropped() //gets deleted on drop
|
||||
loc = null
|
||||
qdel(src)
|
||||
|
||||
/obj/item/magic_hand/Destroy() //better save than sorry.
|
||||
hand_spell = null
|
||||
return ..()
|
||||
Reference in New Issue
Block a user