From aae6dbb6db4dcf63e04c8297dcec4bd3af54225b Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Tue, 1 Jul 2025 08:29:48 -0500 Subject: [PATCH] Energy Katana Teleport Attack (and misc. tweaks) (#91825) ## About The Pull Request 1. The Energy Katana, when clicking on a mob, no longer refuses to teleport. It will instead teleport you adjacent to the mob (to the tile closest to your origin) and immediately perform an attack. 2. Energy Katana is now a bit more consistent about what you can and cannot teleport to, now abiding by the same rules as the heirophant staff - you can teleport onto tables, but you can't teleport into dense objects by clicking on the tile instead of the object. 3. The Energy Katana now has `NEEDS_PERMIT` flag, like the Energy Sword, meaning Beepsky will consider it a threat (but it won't hunt down Ninjas over it) Also added pass_flags_self bitfield and updated pass_flags bitfield. ## Why It's Good For The Game I ran around with it for like 3 seconds and found it a little clunky. So I just cleaned it up a bit to make it 1. easier to use 2. cooler to use The permit thing was just making it consistent with other melee weapons ## Changelog :cl: Melbert qol: Energy Katana is now a bit more consistent about what you can and cannot teleport to, now abiding by the same rules as the heirophant staff. IE, you can now teleport onto tables. add: Energy Katana now has a "teleport attack" - if you click on a mob, you will teleport adjacent to them and immediately perform an attack! add: Energy Katana is now considered a threatening weapon by secbots. Ninjas will be unaffected, but if you loot one off a dead ninja and don't have a weapons permit, it might chase after you. /:cl: --- code/_globalvars/bitfields.dm | 23 +++++++++++++++++++ code/datums/dash_weapon.dm | 4 +++- .../antagonists/ninja/energy_katana.dm | 19 +++++++++++++-- .../mining_loot/megafauna/hierophant.dm | 5 ---- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 01c5bfaf64e..9a808bb9ddb 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -337,13 +337,36 @@ DEFINE_BITFIELD(obj_flags, list( )) DEFINE_BITFIELD(pass_flags, list( + "PASSBLOB" = PASSBLOB, + "PASSCLOSEDTURF" = PASSCLOSEDTURF, + "PASSDOORS" = PASSDOORS, + "PASSFLAPS" = PASSFLAPS, + "PASSGLASS" = PASSGLASS, + "PASSGRILLE" = PASSGRILLE, + "PASSITEM" = PASSITEM, + "PASSMACHINE" = PASSMACHINE, + "PASSMOB" = PASSMOB, + "PASSSTRUCTURE" = PASSSTRUCTURE, + "PASSTABLE" = PASSTABLE, + "PASSVEHICLE" = PASSVEHICLE, + "PASSWINDOW" = PASSWINDOW, +)) + +DEFINE_BITFIELD(pass_flags_self, list( + "LETPASSCLICKS" = LETPASSCLICKS, "LETPASSTHROW" = LETPASSTHROW, "PASSBLOB" = PASSBLOB, "PASSCLOSEDTURF" = PASSCLOSEDTURF, + "PASSDOORS" = PASSDOORS, + "PASSFLAPS" = PASSFLAPS, "PASSGLASS" = PASSGLASS, "PASSGRILLE" = PASSGRILLE, + "PASSITEM" = PASSITEM, + "PASSMACHINE" = PASSMACHINE, "PASSMOB" = PASSMOB, + "PASSSTRUCTURE" = PASSSTRUCTURE, "PASSTABLE" = PASSTABLE, + "PASSVEHICLE" = PASSVEHICLE, "PASSWINDOW" = PASSWINDOW, )) diff --git a/code/datums/dash_weapon.dm b/code/datums/dash_weapon.dm index 146d3c2de07..8a02894bc1e 100644 --- a/code/datums/dash_weapon.dm +++ b/code/datums/dash_weapon.dm @@ -50,7 +50,9 @@ if(!(target in view(user.client.view, user))) user.balloon_alert(user, "out of view!") return FALSE - + if(target_turf.is_blocked_turf_ignore_climbable()) + user.balloon_alert(user, "destination blocked!") + return FALSE if(!do_teleport(user, target_turf, no_effects = TRUE)) user.balloon_alert(user, "dash blocked!") return FALSE diff --git a/code/modules/antagonists/ninja/energy_katana.dm b/code/modules/antagonists/ninja/energy_katana.dm index c26cb44d39c..1182bd56873 100644 --- a/code/modules/antagonists/ninja/energy_katana.dm +++ b/code/modules/antagonists/ninja/energy_katana.dm @@ -35,6 +35,7 @@ sharpness = SHARP_EDGED max_integrity = 200 resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF + item_flags = NEEDS_PERMIT var/datum/effect_system/spark_spread/spark_system var/datum/action/innate/dash/ninja/jaunt @@ -46,8 +47,10 @@ spark_system.attach(src) /obj/item/energy_katana/ranged_interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers) - if(!interacting_with.density) - jaunt?.teleport(user, interacting_with) + if(isliving(interacting_with)) + jaunt.attack_teleport(user, interacting_with) + return ITEM_INTERACT_SUCCESS + if(jaunt.teleport(user, interacting_with)) return ITEM_INTERACT_SUCCESS return NONE @@ -78,3 +81,15 @@ /datum/action/innate/dash/ninja/HideFrom(mob/viewer) return + +/// Teleports to a tile adjacent to a mob, then attacks it +/datum/action/innate/dash/ninja/proc/attack_teleport(mob/living/user, mob/living/stabbing) + var/list/turf/line = get_line(user, stabbing) + var/obj/item/sword = target + if(length(line) <= 1 || !teleport(user, line[length(line) - 1])) // teleports to the second last turf, should be adjacent to the target + return + if(!user.CanReach(stabbing, target)) + return + sword.melee_attack_chain(user, stabbing) + if(prob(5) && check_holidays(APRIL_FOOLS)) + user.say("Heh, nothin' personnel kid!", forced = "*teleports behind you**") diff --git a/code/modules/mining/lavaland/mining_loot/megafauna/hierophant.dm b/code/modules/mining/lavaland/mining_loot/megafauna/hierophant.dm index ef2bf0eff00..940ad9405d3 100644 --- a/code/modules/mining/lavaland/mining_loot/megafauna/hierophant.dm +++ b/code/modules/mining/lavaland/mining_loot/megafauna/hierophant.dm @@ -243,11 +243,6 @@ user.balloon_alert(user, "destination out of range!") return FALSE - var/turf/target_turf = get_turf(target) - if(target_turf.is_blocked_turf_ignore_climbable()) - user.balloon_alert(user, "destination blocked!") - return FALSE - . = ..() var/obj/item/hierophant_club/club = target