Merge pull request #3103 from Citadel-Station-13/upstream-merge-31222
[MIRROR] Ports dash weapons to the dash datum
This commit is contained in:
@@ -592,49 +592,3 @@
|
||||
var/datum/language_holder/H = M.get_language_holder()
|
||||
H.open_language_menu(usr)
|
||||
|
||||
/datum/action/innate/dash
|
||||
name = "Dash"
|
||||
desc = "Teleport to the targeted location."
|
||||
icon_icon = 'icons/mob/actions/actions_items.dmi'
|
||||
button_icon_state = "jetboot"
|
||||
var/charged = TRUE
|
||||
var/charge_rate = 250
|
||||
var/mob/living/carbon/human/holder
|
||||
var/obj/item/dashing_item
|
||||
var/dash_sound = 'sound/magic/blink.ogg'
|
||||
var/recharge_sound = 'sound/magic/charge.ogg'
|
||||
var/beam_effect = "blur"
|
||||
var/phasein = /obj/effect/temp_visual/dir_setting/ninja/phase
|
||||
var/phaseout = /obj/effect/temp_visual/dir_setting/ninja/phase/out
|
||||
|
||||
/datum/action/innate/dash/Grant(mob/user, obj/dasher)
|
||||
. = ..()
|
||||
dashing_item = dasher
|
||||
holder = user
|
||||
|
||||
/datum/action/innate/dash/IsAvailable()
|
||||
if(charged)
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/datum/action/innate/dash/Activate()
|
||||
dashing_item.attack_self(holder) //Used to toggle dash behavior in the dashing item
|
||||
|
||||
/datum/action/innate/dash/proc/Teleport(mob/user, atom/target)
|
||||
var/turf/T = get_turf(target)
|
||||
if(target in view(user.client.view, get_turf(user)))
|
||||
var/obj/spot1 = new phaseout(get_turf(user), user.dir)
|
||||
user.forceMove(T)
|
||||
playsound(T, dash_sound, 25, 1)
|
||||
var/obj/spot2 = new phasein(get_turf(user), user.dir)
|
||||
spot1.Beam(spot2,beam_effect,time=20)
|
||||
charged = FALSE
|
||||
holder.update_action_buttons_icon()
|
||||
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
||||
|
||||
/datum/action/innate/dash/proc/charge()
|
||||
charged = TRUE
|
||||
holder.update_action_buttons_icon()
|
||||
playsound(dashing_item, recharge_sound, 50, 1)
|
||||
to_chat(holder, "<span class='warning'>[dashing_item] is ready for another jaunt.</span>")
|
||||
50
code/datums/dash_weapon.dm
Normal file
50
code/datums/dash_weapon.dm
Normal file
@@ -0,0 +1,50 @@
|
||||
/datum/action/innate/dash
|
||||
name = "Dash"
|
||||
desc = "Teleport to the targeted location."
|
||||
icon_icon = 'icons/mob/actions/actions_items.dmi'
|
||||
button_icon_state = "jetboot"
|
||||
var/current_charges = 1
|
||||
var/max_charges = 1
|
||||
var/charge_rate = 250
|
||||
var/mob/living/carbon/human/holder
|
||||
var/obj/item/dashing_item
|
||||
var/dash_sound = 'sound/magic/blink.ogg'
|
||||
var/recharge_sound = 'sound/magic/charge.ogg'
|
||||
var/beam_effect = "blur"
|
||||
var/phasein = /obj/effect/temp_visual/dir_setting/ninja/phase
|
||||
var/phaseout = /obj/effect/temp_visual/dir_setting/ninja/phase/out
|
||||
|
||||
/datum/action/innate/dash/Grant(mob/user, obj/dasher)
|
||||
. = ..()
|
||||
dashing_item = dasher
|
||||
holder = user
|
||||
|
||||
/datum/action/innate/dash/IsAvailable()
|
||||
if(current_charges > 0)
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/datum/action/innate/dash/Activate()
|
||||
dashing_item.attack_self(holder) //Used to toggle dash behavior in the dashing item
|
||||
|
||||
/datum/action/innate/dash/proc/Teleport(mob/user, atom/target)
|
||||
if(!IsAvailable())
|
||||
return
|
||||
var/turf/T = get_turf(target)
|
||||
if(target in view(user.client.view, get_turf(user)))
|
||||
var/obj/spot1 = new phaseout(get_turf(user), user.dir)
|
||||
user.forceMove(T)
|
||||
playsound(T, dash_sound, 25, 1)
|
||||
var/obj/spot2 = new phasein(get_turf(user), user.dir)
|
||||
spot1.Beam(spot2,beam_effect,time=20)
|
||||
current_charges--
|
||||
holder.update_action_buttons_icon()
|
||||
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
||||
|
||||
/datum/action/innate/dash/proc/charge()
|
||||
current_charges = Clamp(current_charges + 1, 0, max_charges)
|
||||
holder.update_action_buttons_icon()
|
||||
if(recharge_sound)
|
||||
playsound(dashing_item, recharge_sound, 50, 1)
|
||||
to_chat(holder, "<span class='notice'>[src] now has [current_charges]/[max_charges] charges.</span>")
|
||||
@@ -98,7 +98,6 @@
|
||||
var/datum/action/innate/cult/spin2win/linked_action
|
||||
var/spinning = FALSE
|
||||
var/spin_cooldown = 250
|
||||
var/list/shards = list()
|
||||
var/dash_toggled = TRUE
|
||||
|
||||
/obj/item/twohanded/required/cult_bastard/Initialize()
|
||||
@@ -174,11 +173,12 @@
|
||||
if(H.stat != CONSCIOUS)
|
||||
var/obj/item/device/soulstone/SS = new /obj/item/device/soulstone(src)
|
||||
SS.attack(H, user)
|
||||
shards += SS
|
||||
return
|
||||
if(!LAZYLEN(SS.contents))
|
||||
qdel(SS)
|
||||
if(istype(target, /obj/structure/constructshell) && contents.len)
|
||||
var/obj/item/device/soulstone/SS = contents[1]
|
||||
if(istype(SS) && SS.transfer_soul("CONSTRUCT",target,user))
|
||||
if(istype(SS))
|
||||
SS.transfer_soul("CONSTRUCT",target,user)
|
||||
qdel(SS)
|
||||
|
||||
/datum/action/innate/dash/cult
|
||||
@@ -193,7 +193,7 @@
|
||||
phaseout = /obj/effect/temp_visual/dir_setting/cult/phase/out
|
||||
|
||||
/datum/action/innate/dash/cult/IsAvailable()
|
||||
if(iscultist(holder) && charged)
|
||||
if(iscultist(holder) && current_charges)
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
@@ -162,7 +162,7 @@ GLOBAL_LIST_INIT(bibleitemstates, list("bible", "koran", "scrapbook", "bible",
|
||||
playsound(src,'sound/hallucinations/veryfar_noise.ogg',40,1)
|
||||
if(do_after(user, 40, target = sword))
|
||||
playsound(src,'sound/effects/pray_chaplain.ogg',60,1)
|
||||
for(var/obj/item/device/soulstone/SS in sword.shards)
|
||||
for(var/obj/item/device/soulstone/SS in sword.contents)
|
||||
SS.usability = TRUE
|
||||
for(var/mob/living/simple_animal/shade/EX in SS)
|
||||
SSticker.mode.remove_cultist(EX.mind, 1, 0)
|
||||
|
||||
@@ -307,7 +307,7 @@
|
||||
/obj/item/melee/supermatter_sword,
|
||||
/obj/item/shield/changeling,
|
||||
/obj/item/lava_staff,
|
||||
/obj/item/dash/energy_katana,
|
||||
/obj/item/energy_katana,
|
||||
/obj/item/hierophant_club,
|
||||
/obj/item/his_grace,
|
||||
/obj/item/gun/ballistic/minigun,
|
||||
|
||||
@@ -1,60 +1,4 @@
|
||||
/obj/item/dash
|
||||
name = "abstract dash weapon"
|
||||
var/max_charges = 3
|
||||
var/current_charges = 3
|
||||
var/charge_rate = 30 //In deciseconds
|
||||
var/dash_toggled = TRUE
|
||||
|
||||
var/bypass_density = FALSE //Can we beam past windows/airlocks/etc
|
||||
|
||||
var/start_effect_type = /obj/effect/temp_visual/dir_setting/ninja/phase/out
|
||||
var/end_effect_type = /obj/effect/temp_visual/dir_setting/ninja/phase
|
||||
var/beam_icon_state = "blur"
|
||||
var/dash_beam_type = /obj/effect/ebeam
|
||||
|
||||
/obj/item/dash/proc/charge()
|
||||
current_charges = Clamp(current_charges + 1, 0, max_charges)
|
||||
if(istype(loc, /mob/living))
|
||||
to_chat(loc, "<span class='notice'>[src] now has [current_charges]/[max_charges] charges.</span>")
|
||||
|
||||
/obj/item/dash/attack_self(mob/user)
|
||||
dash_toggled = !dash_toggled
|
||||
to_chat(user, "<span class='notice'>You [dash_toggled ? "enable" : "disable"] the dash function on [src].</span>")
|
||||
|
||||
/obj/item/dash/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
if(dash_toggled)
|
||||
dash(user, target)
|
||||
return
|
||||
|
||||
/obj/item/dash/proc/dash(mob/user, atom/target)
|
||||
if(!current_charges)
|
||||
return
|
||||
|
||||
if(Adjacent(target))
|
||||
return
|
||||
|
||||
if(target.density)
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(target)
|
||||
|
||||
if(!bypass_density)
|
||||
for(var/turf/turf in getline(get_turf(user),T))
|
||||
for(var/atom/A in turf)
|
||||
if(A.density)
|
||||
return
|
||||
|
||||
if(target in view(user.client.view, get_turf(user)))
|
||||
var/obj/spot1 = new start_effect_type(T, user.dir)
|
||||
user.forceMove(T)
|
||||
playsound(T, 'sound/magic/blink.ogg', 25, 1)
|
||||
playsound(T, "sparks", 50, 1)
|
||||
var/obj/spot2 = new end_effect_type(get_turf(user), user.dir)
|
||||
spot1.Beam(spot2, beam_icon_state,time = 2, maxdistance = 20, beam_type = dash_beam_type)
|
||||
current_charges--
|
||||
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
||||
|
||||
/obj/item/dash/energy_katana
|
||||
/obj/item/energy_katana
|
||||
name = "energy katana"
|
||||
desc = "A katana infused with strong energy."
|
||||
icon_state = "energy_katana"
|
||||
@@ -73,23 +17,40 @@
|
||||
sharpness = IS_SHARP
|
||||
max_integrity = 200
|
||||
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
|
||||
bypass_density = TRUE
|
||||
var/datum/effect_system/spark_spread/spark_system
|
||||
var/datum/action/innate/dash/ninja/jaunt
|
||||
var/dash_toggled = TRUE
|
||||
|
||||
/obj/item/dash/energy_katana/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
/obj/item/energy_katana/Initialize()
|
||||
. = ..()
|
||||
jaunt = new(src)
|
||||
spark_system = new /datum/effect_system/spark_spread()
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
|
||||
/obj/item/energy_katana/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
|
||||
if(dash_toggled)
|
||||
return ..()
|
||||
jaunt.Teleport(user, target)
|
||||
if(proximity_flag && (isobj(target) || issilicon(target)))
|
||||
spark_system.start()
|
||||
playsound(user, "sparks", 50, 1)
|
||||
playsound(user, 'sound/weapons/blade1.ogg', 50, 1)
|
||||
target.emag_act(user)
|
||||
|
||||
/obj/item/energy_katana/pickup(mob/living/user)
|
||||
. = ..()
|
||||
jaunt.Grant(user, src)
|
||||
user.update_icons()
|
||||
|
||||
/obj/item/energy_katana/dropped(mob/user)
|
||||
. = ..()
|
||||
jaunt.Remove(user)
|
||||
user.update_icons()
|
||||
|
||||
//If we hit the Ninja who owns this Katana, they catch it.
|
||||
//Works for if the Ninja throws it or it throws itself or someone tries
|
||||
//To throw it at the ninja
|
||||
/obj/item/dash/energy_katana/throw_impact(atom/hit_atom)
|
||||
/obj/item/energy_katana/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))
|
||||
@@ -100,7 +61,7 @@
|
||||
|
||||
..()
|
||||
|
||||
/obj/item/dash/energy_katana/proc/returnToOwner(mob/living/carbon/human/user, doSpark = 1, caught = 0)
|
||||
/obj/item/energy_katana/proc/returnToOwner(mob/living/carbon/human/user, doSpark = 1, caught = 0)
|
||||
if(!istype(user))
|
||||
return
|
||||
forceMove(get_turf(user))
|
||||
@@ -127,12 +88,15 @@
|
||||
if(msg)
|
||||
to_chat(user, "<span class='notice'>[msg]</span>")
|
||||
|
||||
/obj/item/dash/energy_katana/Initialize()
|
||||
. = ..()
|
||||
spark_system = new /datum/effect_system/spark_spread()
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
|
||||
/obj/item/dash/energy_katana/Destroy()
|
||||
/obj/item/energy_katana/Destroy()
|
||||
QDEL_NULL(spark_system)
|
||||
return ..()
|
||||
|
||||
/datum/action/innate/dash/ninja
|
||||
current_charges = 3
|
||||
max_charges = 3
|
||||
charge_rate = 30
|
||||
recharge_sound = null
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
l_pocket = /obj/item/grenade/plastic/x4
|
||||
r_pocket = /obj/item/tank/internals/emergency_oxygen
|
||||
internals_slot = slot_r_store
|
||||
belt = /obj/item/dash/energy_katana
|
||||
belt = /obj/item/energy_katana
|
||||
implants = list(/obj/item/implant/explosive)
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ Contents:
|
||||
var/datum/effect_system/spark_spread/spark_system
|
||||
var/list/stored_research = list()//For stealing station research.
|
||||
var/obj/item/disk/tech_disk/t_disk//To copy design onto disk.
|
||||
var/obj/item/dash/energy_katana/energyKatana //For teleporting the katana back to the ninja (It's an ability)
|
||||
var/obj/item/energy_katana/energyKatana //For teleporting the katana back to the ninja (It's an ability)
|
||||
|
||||
//Other articles of ninja gear worn together, used to easily reference them after initializing.
|
||||
var/obj/item/clothing/head/helmet/space/space_ninja/n_hood
|
||||
|
||||
Reference in New Issue
Block a user