mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
[MIRROR] Allows cyborgs to quicken their self untip time with roleplay [MDB IGNORE] (#10887)
* Allows cyborgs to quicken their self untip time with roleplay (#64228) (halves their untip timer when they emote, only works once) * Allows cyborgs to quicken their self untip time with roleplay * E Co-authored-by: Seth Scherer <supernovaa41@gmx.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
co-authored by
Seth Scherer
Gandalf
parent
0cd772f36a
commit
417f544543
@@ -16,9 +16,18 @@
|
||||
var/datum/callback/post_tipped_callback
|
||||
/// Callback to additional behavior after being untipped.
|
||||
var/datum/callback/post_untipped_callback
|
||||
/// Callback to any extra roleplay behaviour
|
||||
var/datum/callback/roleplay_callback
|
||||
///The timer given until they untip themselves
|
||||
var/self_untip_timer
|
||||
|
||||
///Should we accept roleplay?
|
||||
var/roleplay_friendly
|
||||
///Have we roleplayed?
|
||||
var/roleplayed = FALSE
|
||||
///List of emotes that will half their untip time
|
||||
var/list/roleplay_emotes
|
||||
|
||||
/datum/component/tippable/Initialize(
|
||||
tip_time = 3 SECONDS,
|
||||
untip_time = 1 SECONDS,
|
||||
@@ -26,6 +35,9 @@
|
||||
datum/callback/pre_tipped_callback,
|
||||
datum/callback/post_tipped_callback,
|
||||
datum/callback/post_untipped_callback,
|
||||
roleplay_friendly = FALSE,
|
||||
roleplay_emotes,
|
||||
datum/callback/roleplay_callback,
|
||||
)
|
||||
|
||||
if(!isliving(parent))
|
||||
@@ -37,9 +49,15 @@
|
||||
src.pre_tipped_callback = pre_tipped_callback
|
||||
src.post_tipped_callback = post_tipped_callback
|
||||
src.post_untipped_callback = post_untipped_callback
|
||||
src.roleplay_friendly = roleplay_friendly
|
||||
src.roleplay_emotes = roleplay_emotes
|
||||
src.roleplay_callback = roleplay_callback
|
||||
|
||||
/datum/component/tippable/RegisterWithParent()
|
||||
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND_SECONDARY, .proc/interact_with_tippable)
|
||||
if (roleplay_friendly)
|
||||
RegisterSignal(parent, COMSIG_MOB_EMOTE, .proc/accept_roleplay)
|
||||
|
||||
|
||||
/datum/component/tippable/UnregisterFromParent()
|
||||
UnregisterSignal(parent, COMSIG_ATOM_ATTACK_HAND_SECONDARY)
|
||||
@@ -51,6 +69,8 @@
|
||||
QDEL_NULL(post_tipped_callback)
|
||||
if(post_untipped_callback)
|
||||
QDEL_NULL(post_untipped_callback)
|
||||
if(roleplay_callback)
|
||||
QDEL_NULL(roleplay_callback)
|
||||
return ..()
|
||||
|
||||
/*
|
||||
@@ -212,3 +232,18 @@
|
||||
else
|
||||
tipped_mob.transform = turn(tipped_mob.transform, -180)
|
||||
REMOVE_TRAIT(tipped_mob, TRAIT_IMMOBILIZED, TIPPED_OVER)
|
||||
|
||||
/datum/component/tippable/proc/accept_roleplay(mob/living/user, datum/emote/emote)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (!is_tipped)
|
||||
return
|
||||
if (roleplayed)
|
||||
return
|
||||
if (!is_type_in_list(emote, roleplay_emotes))
|
||||
return
|
||||
var/time_left = timeleft(self_untip_timer)
|
||||
deltimer(self_untip_timer)
|
||||
self_untip_timer = addtimer(CALLBACK(src, .proc/right_self, user), time_left * 0.75, TIMER_UNIQUE | TIMER_STOPPABLE)
|
||||
roleplayed = TRUE
|
||||
roleplay_callback?.Invoke(user)
|
||||
|
||||
Reference in New Issue
Block a user