mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-24 08:02:57 +00:00
Why It's Good For The Game Ninja code is pretty bad, I think it's best to move away into nice modular stuff instead. Changelog cl Fikou, PositiveEntropy, Nerevar, InfraRedBaron refactor: the ninja space suit is now a modsuit fix: fixes dash beams not working /cl
66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
/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/obj/item/dashing_item
|
|
var/dash_sound = 'sound/magic/blink.ogg'
|
|
var/recharge_sound = 'sound/magic/charge.ogg'
|
|
var/beam_effect = "blur"
|
|
var/beam_length = 2 SECONDS
|
|
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
|
|
|
|
/datum/action/innate/dash/Destroy()
|
|
dashing_item = null
|
|
return ..()
|
|
|
|
/datum/action/innate/dash/IsAvailable()
|
|
if(current_charges > 0)
|
|
return TRUE
|
|
else
|
|
return FALSE
|
|
|
|
/datum/action/innate/dash/Activate()
|
|
dashing_item.attack_self(owner) //Used to toggle dash behavior in the dashing item
|
|
|
|
/// Teleports user to target using do_teleport. Returns TRUE if teleport successful, FALSE otherwise.
|
|
/datum/action/innate/dash/proc/teleport(mob/user, atom/target)
|
|
if(!IsAvailable())
|
|
user.balloon_alert(user, "no charges!")
|
|
return FALSE
|
|
|
|
var/turf/current_turf = get_turf(user)
|
|
var/turf/target_turf = get_turf(target)
|
|
if(target in view(user.client.view, user))
|
|
if(!do_teleport(user, target_turf, no_effects = TRUE))
|
|
user.balloon_alert(user, "dash blocked by location!")
|
|
return FALSE
|
|
var/obj/spot1 = new phaseout(current_turf, user.dir)
|
|
var/obj/spot2 = new phasein(target_turf, user.dir)
|
|
spot1.Beam(spot2,beam_effect, time = beam_length)
|
|
playsound(target_turf, dash_sound, 25, TRUE)
|
|
current_charges--
|
|
owner.update_action_buttons_icon()
|
|
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
|
return TRUE
|
|
|
|
return FALSE
|
|
|
|
/datum/action/innate/dash/proc/charge()
|
|
current_charges = clamp(current_charges + 1, 0, max_charges)
|
|
if(recharge_sound)
|
|
playsound(dashing_item, recharge_sound, 50, TRUE)
|
|
|
|
if(!owner)
|
|
return
|
|
owner.update_action_buttons_icon()
|
|
dashing_item.balloon_alert(owner, "[current_charges]/[max_charges] dash charges")
|