Files
2020-02-16 19:40:21 -08:00

111 lines
2.9 KiB
Plaintext

/obj/screen/ability/topBar/cruiser
clicked(params)
var/datum/targetable/cruiser/spell = owner
var/datum/abilityHolder/holder = owner.holder
if(params["left"] && params["ctrl"])
if(owner.waiting_for_hotkey)
holder.cancel_action_binding()
else
owner.waiting_for_hotkey = 1
boutput(usr, "<span style=\"color:blue\">Please press a number to bind this ability to...</span>")
else if(params["left"])
if (!istype(spell))
return
if (!spell.holder)
return
if (spell.targeted && usr:targeting_spell == owner)
usr:targeting_spell = null
usr.update_cursor()
return
if (spell.targeted)
if (world.time < spell.last_cast)
return
usr:targeting_spell = owner
usr.update_cursor()
return
else
SPAWN_DBG(0)
spell.handleCast()
owner.holder.updateButtons()
/datum/abilityHolder/cruiser
topBarRendered = 1
usesPoints = 0
regenRate = 0
tabName = "Cruiser Controls"
// ----------------------------------------
// Controls for the cruiser ships.
// ----------------------------------------
/datum/targetable/cruiser
icon = 'icons/mob/cruiser_ui.dmi'
icon_state = ""
cooldown = 0
last_cast = 0
check_range = 0
var/disabled = 0
var/toggled = 0
var/is_on = 0 // used if a toggle ability
preferred_holder_type = /datum/abilityHolder/cruiser
ignore_sticky_cooldown = 1
New()
var/obj/screen/ability/topBar/cruiser/B = new /obj/screen/ability/topBar/cruiser(null)
B.icon = src.icon
B.icon_state = src.icon_state
B.owner = src
B.name = src.name
B.desc = src.desc
src.object = B
updateObject()
..()
if (!src.object)
src.object = new /obj/screen/ability/topBar/cruiser()
object.icon = src.icon
object.owner = src
if (disabled)
object.name = "[src.name] (unavailable)"
object.icon_state = src.icon_state + "_cd"
else if (src.last_cast > world.time)
object.name = "[src.name] ([round((src.last_cast-world.time)/10)])"
object.icon_state = src.icon_state + "_cd"
else if (toggled)
if (is_on)
object.name = "[src.name] (on)"
object.icon_state = src.icon_state
else
object.name = "[src.name] (off)"
object.icon_state = src.icon_state + "_cd"
else
object.name = src.name
object.icon_state = src.icon_state
proc/incapacitationCheck()
var/mob/living/M = holder.owner
return M.restrained() || M.stat || M.getStatusDuration("paralysis") || M.getStatusDuration("stunned") || M.getStatusDuration("weakened")
castcheck()
if (incapacitationCheck())
boutput(holder.owner, __red("Not while incapacitated."))
return 0
if (disabled)
boutput(holder.owner, __red("You cannot use that ability at this time."))
return 0
return 1
doCooldown()
if (!holder)
return
last_cast = world.time + cooldown
holder.updateButtons()
SPAWN_DBG(cooldown + 5)
holder.updateButtons()
cast(atom/target)
. = ..()
actions.interrupt(holder.owner, INTERRUPT_ACT)