[MIRROR] Fixes riding abilities by sharing action buttons. [MDB IGNORE] (#8688)

* Fixes riding abilities by sharing action buttons (#61854)

* Fixes riding abilities by sharing action buttons.

Co-authored-by: Krysonism <49783092+Krysonism@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-10-08 08:24:01 -04:00
committed by GitHub
co-authored by Krysonism
parent 55db3f6bc7
commit fc024162f1
4 changed files with 99 additions and 23 deletions
@@ -54,8 +54,16 @@
action_icon_state = "tentacle_slap"
action_background_icon_state = "bg_revenant"
ranged_mousepointer = 'icons/effects/mouse_pointers/supplypod_target.dmi'
base_action = /datum/action/cooldown/spell_like
///How long cooldown before we can use the ability again
var/cooldown = 12 SECONDS
var/current_cooldown = 0
/obj/effect/proc_holder/tentacle_slap/Initialize(mapload, mob/living/new_owner)
. = ..()
if(!action)
return
var/datum/action/cooldown/our_action = action
our_action.cooldown_time = cooldown
/obj/effect/proc_holder/tentacle_slap/Click(location, control, params)
. = ..()
@@ -63,14 +71,11 @@
return TRUE
fire(usr)
/obj/effect/proc_holder/tentacle_slap/fire(mob/living/carbon/user)
if(current_cooldown > world.time)
to_chat(user, span_notice("This ability is still on cooldown."))
return
/obj/effect/proc_holder/tentacle_slap/fire(mob/living/user)
if(active)
remove_ranged_ability(span_notice("You stop preparing to tentacle slap."))
else
add_ranged_ability(user, span_notice("You prepare your pimp-tentacle. <B>Left-click to slap a target!</B>"), TRUE)
add_ranged_ability(user, span_notice("You prepare [(IS_WEAKREF_OF(user, owner)) ? "your" : "their"] pimp-tentacle. <B>Left-click to slap a target!</B>"), TRUE)
/obj/effect/proc_holder/tentacle_slap/InterceptClickOn(mob/living/caller, params, atom/target)
. = ..()
@@ -86,7 +91,7 @@
remove_ranged_ability()
return
if(!caller.Adjacent(target))
if(!beast_owner.Adjacent(target))
return
if(!isliving(target))
@@ -94,11 +99,20 @@
var/mob/living/living_target = target
if(!action.IsAvailable()) //extra check for safety since the ability is shared
remove_ranged_ability()
to_chat(caller, span_notice("This ability is still on cooldown."))
return
beast_owner.visible_message("<span class='warning>[beast_owner] slaps [living_target] with its tentacle!</span>", span_notice("You slap [living_target] with your tentacle."))
playsound(beast_owner, 'sound/effects/assslap.ogg', 90)
var/atom/throw_target = get_edge_target_turf(target, ranged_ability_user.dir)
var/atom/throw_target = get_edge_target_turf(target, beast_owner.dir)
living_target.throw_at(throw_target, 6, 4, beast_owner)
living_target.apply_damage(30)
current_cooldown = world.time + cooldown
remove_ranged_ability()
var/datum/action/cooldown/our_action = action
our_action.StartCooldown()
return TRUE