Pops up a little bubble when you're requesting a high-five, along with some other emotes (#20472)

* High five!

* Add in-hand use

* use in hand too

* closing remarks

* better looking

* Fixes daps

* grab my hand fat man

* hand shake

* Implement missed messages

* i can spell

* Update code/modules/mob/living/carbon/human/human_emote.dm

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Review concerns

* Add some auto-doc, minor changes

* more cleverly handles pointing

* Update code/modules/point/point.dm

Path clarity

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
Luc
2023-03-15 15:37:54 -04:00
committed by GitHub
parent 9838d84023
commit eafe04f41f
6 changed files with 159 additions and 103 deletions
@@ -55,14 +55,6 @@
muzzled_noises = list("weak", "pathetic", "sad")
emote_type = EMOTE_AUDIBLE
/datum/emote/living/carbon/human/dap
key = "dap"
key_third_person = "daps"
message = "sadly can't find anybody to give daps to, and daps themself. Shameful."
message_param = "give daps to %t."
emote_target_type = EMOTE_TARGET_MOB
hands_use_check = TRUE
/datum/emote/living/carbon/human/eyebrow
key = "eyebrow"
message = "raises an eyebrow."
@@ -283,9 +275,10 @@
/datum/emote/living/carbon/human/highfive
key = "highfive"
key_third_person = "highfives"
message = "requests a highfive."
hands_use_check = TRUE
cooldown = 3 SECONDS
cooldown = 5 SECONDS
/// Status effect to apply when this emote is used. Should be a subtype
var/status = STATUS_EFFECT_HIGHFIVE
/datum/emote/living/carbon/human/highfive/can_run_emote(mob/user, status_check, intentional)
. = ..()
@@ -293,81 +286,24 @@
if(user_carbon.restrained())
return FALSE
/datum/emote/living/carbon/human/highfive/proc/wiz_cleanup(mob/user, mob/highfived)
user.status_flags &= ~GODMODE
highfived.status_flags &= ~GODMODE
/datum/emote/living/carbon/human/highfive/run_emote(mob/user, params, type_override, intentional)
var/mob/living/carbon/user_carbon = user
if(user_carbon.has_status_effect(STATUS_EFFECT_HIGHFIVE))
user.visible_message("[user.name] shakes [user.p_their()] hand around slightly, impatiently waiting for someone to high-five them.")
if(user_carbon.has_status_effect(status))
user.visible_message("[user.name] shakes [user.p_their()] hand around slightly, impatiently waiting for someone to [key].")
return TRUE
user_carbon.apply_status_effect(STATUS_EFFECT_HIGHFIVE)
for(var/mob/living/L in orange(1))
if(L.has_status_effect(STATUS_EFFECT_HIGHFIVE) && L != user)
if(iswizard(user) && iswizard(L))
user.visible_message("<span class='biggerdanger'><b>[user.name]</b> and <b>[L.name]</b> high-five EPICALLY!</span>")
user_carbon.status_flags |= GODMODE
L.status_flags |= GODMODE
explosion(get_turf(user), 5, 2, 1, 3)
// explosions have a spawn so this makes sure that we don't get gibbed
addtimer(CALLBACK(src, PROC_REF(wiz_cleanup), user_carbon, L), 1)
user_carbon.remove_status_effect(STATUS_EFFECT_HIGHFIVE)
L.remove_status_effect(STATUS_EFFECT_HIGHFIVE)
return TRUE
user.visible_message("<b>[user.name]</b> and <b>[L.name]</b> high-five!")
playsound(user, 'sound/effects/snap.ogg', 50)
user_carbon.remove_status_effect(STATUS_EFFECT_HIGHFIVE)
L.remove_status_effect(STATUS_EFFECT_HIGHFIVE)
return TRUE
user_carbon.apply_status_effect(status)
return ..()
/datum/emote/living/carbon/human/handshake
/datum/emote/living/carbon/human/highfive/dap
key = "dap"
status = STATUS_EFFECT_DAP
key_third_person = "daps"
/datum/emote/living/carbon/human/highfive/handshake
key = "handshake"
message = "holds out their hand."
hands_use_check = TRUE
emote_target_type = EMOTE_TARGET_MOB
target_behavior = EMOTE_TARGET_BHVR_DEFAULT_TO_BASE
/datum/emote/living/carbon/human/handshake/act_on_target(mob/user, target)
. = ..()
if(!target)
user.visible_message(
"[user] seems to shake hands with empty space.",
"You shake the air's hand."
)
return EMOTE_ACT_STOP_EXECUTION
if(!user.Adjacent(target) || !ishuman(target))
message_param = "extends a hand towards %t."
return TRUE
var/mob/living/carbon/human/human_target = target
if(!HAS_TRAIT(human_target, TRAIT_HANDS_BLOCKED) && !human_target.r_hand && !human_target.restrained())
message_param = "shakes hands with %t."
else
message_param = "holds out [user.p_their()] hand to %t."
/datum/emote/living/carbon/human/handshake/run_emote(mob/user, params, type_override, intentional)
var/mob/living/target
for(var/mob/living/A in oview(5, user))
if(params == A.name)
target = A
if(!target)
user.visible_message(
"[user] seems to shake hands with empty space.",
"You shake the air's hand."
)
return TRUE
if(!HAS_TRAIT(target, TRAIT_HANDS_BLOCKED) && !target.r_hand && !target.restrained())
message_param = "shakes hands with %t."
else
message_param = "holds out [user.p_their()] hand to %t."
return ..()
key_third_person = "handshakes"
status = STATUS_EFFECT_HANDSHAKE
/datum/emote/living/carbon/human/snap
key = "snap"
+44 -11
View File
@@ -12,7 +12,7 @@
return
if((pointed_atom in src) || (pointed_atom.loc in src))
create_point_bubble(pointed_atom)
create_point_bubble_from_atom(pointed_atom)
return
var/turf/tile = get_turf(pointed_atom)
@@ -24,9 +24,16 @@
animate(visual, pixel_x = (tile.x - our_tile.x) * world.icon_size + pointed_atom.pixel_x, pixel_y = (tile.y - our_tile.y) * world.icon_size + pointed_atom.pixel_y, time = 1.7, easing = EASE_OUT)
/atom/movable/proc/create_point_bubble(atom/pointed_atom)
/// Create a bubble pointing at a particular icon and icon state.
/// See args for create_point_bubble_from_atom.
/atom/movable/proc/create_point_bubble(mutable_appearance/pointed_atom_appearance, include_arrow = TRUE)
var/obj/effect/thought_bubble_effect = new
pointed_atom_appearance.layer = POINT_LAYER
pointed_atom_appearance.blend_mode = BLEND_INSET_OVERLAY
pointed_atom_appearance.pixel_x = 0
pointed_atom_appearance.pixel_y = 0
var/mutable_appearance/thought_bubble = mutable_appearance(
'icons/effects/effects.dmi',
thought_bubble_image,
@@ -34,17 +41,8 @@
appearance_flags = KEEP_APART,
)
var/mutable_appearance/pointed_atom_appearance = new(pointed_atom.appearance)
pointed_atom_appearance.blend_mode = BLEND_INSET_OVERLAY
pointed_atom_appearance.layer = POINT_LAYER
pointed_atom_appearance.pixel_x = 0
pointed_atom_appearance.pixel_y = 0
thought_bubble.overlays += pointed_atom_appearance
var/hover_outline_index = pointed_atom.get_filter("hover_outline")
if (!isnull(hover_outline_index))
pointed_atom_appearance.filters.Cut(hover_outline_index, hover_outline_index + 1)
thought_bubble.pixel_x = 16
thought_bubble.pixel_y = 32
thought_bubble.alpha = 200
@@ -66,6 +64,41 @@
QDEL_IN(thought_bubble_effect, 2 SECONDS)
/**
* Create a point bubble towards a given item.
*
* Arguments:
* * pointed_atom - Atom to show in the bubble.
* * include_arrow - If true, show an arrow pointing downwards.
*/
/atom/movable/proc/create_point_bubble_from_atom(atom/pointed_atom, include_arrow = TRUE)
var/mutable_appearance/pointed_atom_appearance = new(pointed_atom.appearance)
var/hover_outline_index = pointed_atom.get_filter("hover_outline")
if (!isnull(hover_outline_index))
pointed_atom_appearance.filters.Cut(hover_outline_index, hover_outline_index + 1)
create_point_bubble(pointed_atom_appearance, include_arrow)
/**
* Create a point bubble towards a given item, from an icon/icon state.
*
* Arguments:
* * icon - Icon source for the bubble's icon.
* * icon_state - Icon state for the bubble's icon.
* * include_arrow - If true, show an arrow pointing downwards.
*/
/atom/movable/proc/create_point_bubble_from_icons(icon, icon_state, include_arrow = TRUE)
var/mutable_appearance/pointed_atom_appearance = mutable_appearance(
icon,
icon_state,
)
create_point_bubble(pointed_atom_appearance, include_arrow)
/// See above, this uses an uninstantiated path.
/atom/movable/proc/create_point_bubble_from_path(atom/pointed_atom_path, include_arrow = TRUE)
create_point_bubble_from_icons(initial(pointed_atom_path.icon), initial(pointed_atom_path.icon_state), include_arrow)
/obj/effect/temp_visual/point
name = "arrow"
desc = "It's an arrow hanging in mid-air. There may be a wizard about."