Skip to content

Commit

Permalink
feat(point to): show cloud when pointing an object at oneself
Browse files Browse the repository at this point in the history
  • Loading branch information
Doster-d committed Mar 13, 2024
1 parent e3b97d6 commit 4323b14
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
1 change: 1 addition & 0 deletions code/__defines/__renderer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
//FLY_LAYER 5
#define CHAT_LAYER 5.0001
#define CHAT_LAYER_MAX 5.9999
#define POINT_PLANE 5
//OBSERVER
#define OBSERVER_LAYER 5.1

Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,12 @@
to_world_log("Can't find possible body_build. Gender = [gender], Species = [species]")
return 0

/mob/living/carbon/human/pointed(atom/A as mob|obj|turf in view(client.view, src))
if(A in organs)
return

return ..()

/mob/living/carbon/human/proc/bloody_doodle()
set category = "IC"
set name = "Write in blood"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
return

//mob verbs are faster than object verbs. See above.
/mob/living/pointed(atom/A as mob|obj|turf in view())
/mob/living/pointed(atom/A as mob|obj|turf in view(client.view, src))
if(incapacitated())
return 0
if(status_flags & FAKEDEATH)
Expand Down
47 changes: 45 additions & 2 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define POINT_TIME (2 SECONDS)

/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game.
STOP_PROCESSING(SSmobs, src)

Expand Down Expand Up @@ -297,7 +299,7 @@

if(last_time_pointed_at + 2 SECONDS >= world.time)
return
if(!src || !isturf(src.loc) || !(A in view(src.loc)))
if(!src || !(A in view(client?.view, src)))
return 0
if(istype(A, /obj/effect/decal/point))
return 0
Expand All @@ -308,14 +310,53 @@

last_time_pointed_at = world.time

if(A in src)
create_point_bubble(A)
return

var/obj/P = new /obj/effect/decal/point(tile)
P.set_invisibility(invisibility)
P.pixel_x = A.pixel_x
P.pixel_y = A.pixel_y
QDEL_IN(P, 2 SECONDS)
QDEL_IN(P, POINT_TIME)
face_atom(A)
return 1

/atom/movable/proc/create_point_bubble(atom/pointed_atom)
var/mutable_appearance/thought_bubble = mutable_appearance(
'icons/effects/effects.dmi',
"thought_bubble",
plane = POINT_PLANE,
flags = KEEP_APART,
)

var/mutable_appearance/pointed_atom_appearance = new(pointed_atom.appearance)
pointed_atom_appearance.blend_mode = BLEND_INSET_OVERLAY
pointed_atom_appearance.plane = FLOAT_PLANE
pointed_atom_appearance.layer = FLOAT_LAYER
pointed_atom_appearance.pixel_x = 0
pointed_atom_appearance.pixel_y = 0
thought_bubble.overlays += pointed_atom_appearance

pointed_atom_appearance.filters.Cut()

thought_bubble.pixel_x = 16
thought_bubble.pixel_y = 32
thought_bubble.alpha = 200

var/mutable_appearance/point_visual = mutable_appearance(
'icons/effects/effects.dmi',
"arrow"
)

thought_bubble.overlays += point_visual

AddOverlays(thought_bubble)
addtimer(CALLBACK(src, .proc/clear_point_bubble, thought_bubble), POINT_TIME)

/atom/movable/proc/clear_point_bubble(mutable_appearance/thought_bubble)
CutOverlays(thought_bubble)

//Gets the mob grab conga line.
/mob/proc/ret_grab(list/L)
if (!istype(l_hand, /obj/item/grab) && !istype(r_hand, /obj/item/grab))
Expand Down Expand Up @@ -1181,3 +1222,5 @@
set_sight(sight&(~SEE_BLACKNESS))
else
set_sight(sight|SEE_BLACKNESS)

#undef POINT_TIME
Binary file modified icons/effects/effects.dmi
Binary file not shown.

0 comments on commit 4323b14

Please sign in to comment.