Files
Paradise/code/modules/ninja/energy_katana.dm
T
warriorstar-orionandGitHub 525c68d617 Attack chain, initial setup. (pull *immediately* for *any* TM issues) (#26834)
* refactor: Attack chain, initial setup.

* migrate curtain to make dreamchecker happy

* update thurible

* don't call attacked_by separately for legacy attack chain

* remove duplicate proc

* condense similar code, put allowances for legacy code in new procs

* update docs, include diagram source

* add comment on how to update diagram

* fix admonition

* mindflayer updates

* remove commented out code

* clarify all steps

* after_attack should be overridable

* whoops

* retrofit recent changes

* duh, can't restrict this yet because of tool_acts

* i hate ore bags with the fire of a thousand suns

* return correct value for object attack logic

* Various cleanups.

We don't want to attempt to pull stuff out of `/obj/item/attackby`,
because those pieces are part of the related objects' migrations, not
`/obj/item` itself. Attempting to do this causes knockon effects where
things expected to call e.g. `/obj/item/storage/attackby` in the call
chain were not ferried over to the new item interaction code, because
the related objects hadn't actually been migrated over yet.

I've used refactoring /obj/vehicle as the example for migrating
`attackby` methods instead.

* simplify some argument names

* fuck it

* make it do the thing

* Rename CI module call

* Prove that CI works

* improve test output

* aaand fix it again

* fix curtain tool interactions

* fix compile error

* fix compile error

* Better docs, introduce migration plan tool.
2024-12-02 23:36:36 +00:00

81 lines
2.5 KiB
Plaintext

/obj/item/katana/energy
name = "energy katana"
desc = "A katana infused with a strong energy."
icon = 'icons/obj/weapons/energy_melee.dmi'
icon_state = "energy_katana"
item_state = "energy_katana"
force = 40
throwforce = 20
armour_penetration_percentage = 50
armour_penetration_flat = 10
var/cooldown = 0 // Because spam aint cool, yo.
var/datum/effect_system/spark_spread/spark_system
/obj/item/katana/energy/attack__legacy__attackchain(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
playsound(user, 'sound/weapons/blade1.ogg', 50, TRUE, -1)
return ..()
/obj/item/katana/energy/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag, click_parameters)
if(!user || !target)
return
if(proximity_flag && user.mind.special_role == "Ninja" && !cooldown && isobj(target))
cooldown = 1
spark_system.start()
playsound(user, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
playsound(user, 'sound/weapons/blade1.ogg', 50, 1)
user.visible_message("<span class='danger'>[user] masterfully slices [target]!</span>", "<span class='notice'>You masterfully slice [target]!</span>")
target.emag_act(user)
sleep(15)
cooldown = 0
/*/obj/item/katana/energy/throw_impact(atom/hit_atom)
if(ishuman(hit_atom))
var/mob/living/carbon/human/H = hit_atom
if(istype(H.wear_suit, /obj/item/clothing/suit/space/space_ninja))
var/obj/item/clothing/suit/space/space_ninja/SN = H.wear_suit
if(SN.energyKatana && SN.energyKatana == src)
returnToOwner(H, 0, 1)
return
..()*/
/obj/item/katana/energy/proc/returnToOwner(mob/living/carbon/human/user, doSpark = 1, caught = 0)
if(!istype(user))
return
loc = get_turf(src)
if(doSpark)
spark_system.start()
playsound(get_turf(src), "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
var/msg = ""
if(user.put_in_hands(src))
msg = "Your Energy Katana teleports into your hand!"
else if(user.equip_to_slot_if_possible(src, ITEM_SLOT_BELT, FALSE, TRUE))
msg = "Your Energy Katana teleports back to you, sheathing itself as it does so!</span>"
else
loc = get_turf(user)
msg = "Your Energy Katana teleports to your location!"
if(caught)
if(loc == user)
msg = "You catch your Energy Katana!"
else
msg = "Your Energy Katana lands at your feet!"
if(msg)
to_chat(user, "<span class='notice'>[msg]</span>")
/obj/item/katana/energy/New()
..()
spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
/obj/item/katana/energy/Destroy()
QDEL_NULL(spark_system)
return ..()