mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-17 12:20:09 +01:00
d5849910e5
* Begin clickcode attack_self fix Begins the work to make everything call back to parent for attack_self so that signals are sacred. * Makes MORE things call the attack_self() parent Yes, I could make special_handling a var on obj/item HOWEVER i want it to be specific so it can be tracked down later and ONLY the objects that use it can be refactored instead of sitting there literally forever and it just becoming 'a thing'. * Finishes making the rest of attack_self call parent. As mentioned, things such as 'specialty_goggles' 'special_handling' and the such are only there to help with attack_self until the attack_self is recoded for those items. * begone foul demon * some more cleanup * These * GOD this was annoying * yeh * Fix this * fLARES * Thesee too * toys! * Even more! * More fixes * Even more * rest of em * these too * Update syndie.dm * hardref clear * Update code/game/gamemodes/nuclear/pinpointer.dm * Update code/game/objects/effects/mines.dm * Update code/game/objects/items/blueprints_vr.dm * Update code/game/objects/items/blueprints_vr.dm * Update code/game/objects/items/contraband_vr.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/gunbox.dm * Update code/game/objects/items/gunbox.dm * Update code/game/objects/items/gunbox_vr.dm * Update code/game/objects/items/gunbox_vr.dm * Update code/game/objects/items/weapons/gift_wrappaper.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/gunbox.dm * these too * Update maintpanel_stack.dm * angry warning * Fixes packaged snacks. Fixes improper var default. * Special handling for these * proper poly types * Fixes magclaws Makes the 'features' it had just part of base magboots that can be adjusted via varswap. * Fixes jackets Fixes https://github.com/VOREStation/VOREStation/issues/18941 * Small bugfix Makes p_Theyre properly capitialize Makes examine show proper wording * Update gift_wrappaper.dm
175 lines
4.7 KiB
Plaintext
175 lines
4.7 KiB
Plaintext
/*
|
|
Telekinetic attack:
|
|
|
|
By default, emulate the user's unarmed attack
|
|
*/
|
|
/atom/proc/attack_tk(mob/user)
|
|
if(user.stat) return
|
|
user.UnarmedAttack(src,0)
|
|
return
|
|
|
|
/*
|
|
This is similar to item attack_self, but applies to anything
|
|
that you can grab with a telekinetic grab.
|
|
|
|
It is used for manipulating things at range, for example, opening and closing closets.
|
|
There are not a lot of defaults at this time, add more where appropriate.
|
|
*/
|
|
/atom/proc/attack_self_tk(mob/user)
|
|
return
|
|
|
|
/obj/attack_tk(mob/user)
|
|
if(user.stat) return
|
|
if(anchored)
|
|
..()
|
|
return
|
|
|
|
var/obj/item/tk_grab/O = new(src)
|
|
user.put_in_active_hand(O)
|
|
O.host = user
|
|
O.focus_object(src)
|
|
return
|
|
|
|
/obj/item/attack_tk(mob/user)
|
|
if(user.stat || !isturf(loc)) return
|
|
if(user.has_telegrip() && !user.get_active_hand()) // both should already be true to get here
|
|
var/obj/item/tk_grab/O = new(src)
|
|
user.put_in_active_hand(O)
|
|
O.host = user
|
|
O.focus_object(src)
|
|
else
|
|
WARNING("Strange attack_tk(): TK([user.has_telegrip()]) empty hand([!user.get_active_hand()])")
|
|
return
|
|
|
|
|
|
/mob/attack_tk(mob/user)
|
|
return // needs more thinking about
|
|
|
|
/*
|
|
TK Grab Item (the workhorse of old TK)
|
|
|
|
* If you have not grabbed something, do a normal tk attack
|
|
* If you have something, throw it at the target. If it is already adjacent, do a normal attackby()
|
|
* If you click what you are holding, or attack_self(), do an attack_self_tk() on it.
|
|
* Deletes itself if it is ever not in your hand, or if you should have no access to TK.
|
|
*/
|
|
/obj/item/tk_grab
|
|
name = "Telekinetic Grab"
|
|
desc = "Magic"
|
|
icon = 'icons/obj/magic.dmi'//Needs sprites
|
|
icon_state = "2"
|
|
flags = NOBLUDGEON
|
|
//item_state = null
|
|
w_class = ITEMSIZE_NO_CONTAINER
|
|
layer = HUD_LAYER
|
|
|
|
var/last_throw = 0
|
|
var/atom/movable/focus = null
|
|
var/mob/living/host = null
|
|
item_flags = DROPDEL | NOSTRIP
|
|
|
|
/obj/item/tk_grab/dropped(mob/user)
|
|
..()
|
|
if(focus && user && loc != user && loc != user.loc) // drop_item() gets called when you tk-attack a table/closet with an item
|
|
if(focus.Adjacent(loc))
|
|
focus.loc = loc
|
|
|
|
//stops TK grabs being equipped anywhere but into hands
|
|
/obj/item/tk_grab/equipped(var/mob/user, var/slot)
|
|
..()
|
|
if( (slot == slot_l_hand) || (slot== slot_r_hand) ) return
|
|
qdel(src)
|
|
return
|
|
|
|
/obj/item/tk_grab/attack_self(mob/user)
|
|
. = ..(user)
|
|
if(.)
|
|
return TRUE
|
|
if(focus)
|
|
focus.attack_self_tk(user)
|
|
|
|
/obj/item/tk_grab/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity)//TODO: go over this
|
|
if(!target || !user) return
|
|
if(last_throw+3 > world.time) return
|
|
if(!host || host != user)
|
|
qdel(src)
|
|
return
|
|
if(!host.has_telegrip())
|
|
qdel(src)
|
|
return
|
|
if(isobj(target) && !isturf(target.loc))
|
|
return
|
|
|
|
if(user.is_remote_viewing()) // Extremely bad exploits if allowed to TK while remote viewing
|
|
to_chat(user, TK_DENIED_MESSAGE)
|
|
return
|
|
|
|
var/d = get_dist(user, target)
|
|
if(focus)
|
|
d = max(d, get_dist(user, focus)) // whichever is further
|
|
if(d > TK_MAXRANGE)
|
|
to_chat(user, TK_OUTRANGED_MESSAGE)
|
|
return
|
|
|
|
if(!focus)
|
|
focus_object(target, user)
|
|
return
|
|
|
|
if(target == focus)
|
|
target.attack_self_tk(user)
|
|
return // todo: something like attack_self not laden with assumptions inherent to attack_self
|
|
|
|
|
|
if(!istype(target, /turf) && istype(focus,/obj/item) && target.Adjacent(focus))
|
|
var/obj/item/I = focus
|
|
var/resolved = target.attackby(I, user, user:get_organ_target())
|
|
if(!resolved && target && I)
|
|
I.afterattack(target,user,1) // for splashing with beakers
|
|
else
|
|
apply_focus_overlay()
|
|
focus.throw_at(target, 10, 1, user)
|
|
last_throw = world.time
|
|
if(ishuman(user))
|
|
var/mob/living/carbon/human/H_user = user
|
|
if(istype(H_user.gloves,/obj/item/clothing/gloves/telekinetic))
|
|
var/obj/item/clothing/gloves/telekinetic/TKG = H_user.gloves
|
|
TKG.use_grip_power(user,TRUE)
|
|
if(!TKG.has_grip_power())
|
|
qdel(src) // Drop TK
|
|
return
|
|
|
|
/obj/item/tk_grab/attack(mob/living/M as mob, mob/living/user as mob, def_zone)
|
|
return
|
|
|
|
|
|
/obj/item/tk_grab/proc/focus_object(var/obj/target, var/mob/living/user)
|
|
if(!istype(target,/obj)) return//Cant throw non objects atm might let it do mobs later
|
|
if(target.anchored || !isturf(target.loc))
|
|
qdel(src)
|
|
return
|
|
focus = target
|
|
update_icon()
|
|
apply_focus_overlay()
|
|
return
|
|
|
|
/obj/item/tk_grab/proc/apply_focus_overlay()
|
|
if(!focus) return
|
|
var/obj/effect/overlay/O = new /obj/effect/overlay(locate(focus.x,focus.y,focus.z))
|
|
O.name = "sparkles"
|
|
O.anchored = TRUE
|
|
O.density = FALSE
|
|
O.layer = FLY_LAYER
|
|
O.set_dir(pick(GLOB.cardinal))
|
|
O.icon = 'icons/effects/effects.dmi'
|
|
O.icon_state = "nothing"
|
|
flick("empdisable",O)
|
|
spawn(5)
|
|
qdel(O)
|
|
return
|
|
|
|
/obj/item/tk_grab/update_icon()
|
|
cut_overlays()
|
|
if(focus && focus.icon && focus.icon_state)
|
|
add_overlay(icon(focus.icon, focus.icon_state))
|
|
return
|