Skip to content

Commit

Permalink
Fix imaginary friend ears and icons (#4863)
Browse files Browse the repository at this point in the history
# About the pull request

This PR changes the imaginary friend ability to an orbit ability. The
reasoning for this is because if you have ghost ears set to only hear
nearby, merging would place you in the mob's contents so not in range to
hear anything.

This PR also fixes the hide ability not actually updating its icon
state.

# Explain why it's good for the game

Imaginary friends need to be able to hear who they are helping.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

https://youtu.be/95TtYocF2XQ

</details>


# Changelog
:cl: Drathek
fix: Fixed imaginary friend merge ability preventing hearing if ghost
ears are set to only nearby.
fix: Fixed imaginary friend hide ability not updating its icons.
/:cl:
  • Loading branch information
Drulikar committed Nov 9, 2023
1 parent c0bcea6 commit 80ca798
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions code/modules/mob/camera/imaginary_friend.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
var/hidden = FALSE
var/mob/living/owner

var/datum/action/innate/imaginary_join/join
var/datum/action/innate/imaginary_orbit/orbit
var/datum/action/innate/imaginary_hide/hide

var/list/outfit_choices = list(/datum/equipment_preset/uscm_ship/sea)
Expand All @@ -29,7 +29,7 @@
/mob/camera/imaginary_friend/Login()
. = ..()
setup_friend()
show()
update_image()

/mob/camera/imaginary_friend/Logout()
. = ..()
Expand All @@ -47,8 +47,8 @@

mouse_opacity = MOUSE_OPACITY_TRANSPARENT

join = new
join.give_to(src)
orbit = new
orbit.give_to(src)
hide = new
hide.give_to(src)

Expand Down Expand Up @@ -81,7 +81,7 @@
return out_icon

/// makes the friend update their icon and appear to themselves and, if not hidden, the owner
/mob/camera/imaginary_friend/proc/show()
/mob/camera/imaginary_friend/proc/update_image()
if(!client)
return

Expand All @@ -100,7 +100,6 @@

client.images |= current_image


/mob/camera/imaginary_friend/Destroy()
if(owner)
owner.client?.images.Remove(friend_image)
Expand Down Expand Up @@ -141,7 +140,7 @@
return
name = client.prefs.real_name
friend_image = get_flat_human_icon(null, outfit_choice, client.prefs)
show()
update_image()

/mob/camera/imaginary_friend/verb/toggle_hud()
set category = "Imaginary Friend"
Expand Down Expand Up @@ -236,16 +235,27 @@
/mob/camera/imaginary_friend/forceMove(atom/destination)
dir = get_dir(get_turf(src), destination)
loc = destination
show()
update_image()
orbiting?.end_orbit(src)

/mob/camera/imaginary_friend/stop_orbit(datum/component/orbiter/orbits)
. = ..()
// pixel_y = -2
animate(src, pixel_y = 0, time = 10, loop = -1)

/// returns the friend to the owner
/mob/camera/imaginary_friend/proc/recall()
if(QDELETED(owner))
deactivate()
return FALSE
if(loc == owner)
if(orbit_target == owner)
orbiting?.end_orbit(src)
return FALSE
forceMove(owner)
if(!hidden)
hide.action_activate()
dir = SOUTH
update_image()
orbit(owner)

/// logs the imaginary friend's removal, ghosts them and cleans up the friend
/mob/camera/imaginary_friend/proc/deactivate()
Expand All @@ -265,13 +275,14 @@
ghost.mind.original = aghosted_original_mob
return ghost

/datum/action/innate/imaginary_join
name = "Join"
/datum/action/innate/imaginary_orbit
name = "Orbit"
action_icon_state = "joinmob"

/datum/action/innate/imaginary_join/action_activate()
/datum/action/innate/imaginary_orbit/action_activate()
var/mob/camera/imaginary_friend/friend = owner
friend.recall()

/datum/action/innate/imaginary_hide
name = "Hide"
action_icon_state = "hidemob"
Expand All @@ -280,13 +291,17 @@
var/mob/camera/imaginary_friend/friend = owner
if(friend.hidden)
friend.hidden = FALSE
friend.show()
friend.update_image()
name = "Hide"
action_icon_state = "hidemob"
update_button_icon()
else
friend.hidden = TRUE
friend.show()
friend.update_image()
name = "Show"
action_icon_state = "unhidemob"
update_button_icon()

/datum/action/innate/imaginary_hide/update_button_icon()
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

0 comments on commit 80ca798

Please sign in to comment.