From fd715eb60d9bdf0cb038dccf080594d0309f0d4e Mon Sep 17 00:00:00 2001
From: Guti <32563288+TheCaramelion@users.noreply.github.com>
Date: Fri, 2 Aug 2024 00:43:05 +0200
Subject: [PATCH] Point Refactor (#8718)
---
.../signals_mob/signals_mob_main_ch.dm | 2 +
code/game/atoms_movable_ch.dm | 6 ++
code/game/objects/effects/decals/misc.dm | 5 +-
code/modules/mob/dead/observer/observer.dm | 9 ++
code/modules/mob/living/living.dm | 18 +++-
code/modules/mob/mob.dm | 4 +-
modular_chomp/code/modules/point/point.dm | 89 ++++++++++++++++++
modular_chomp/icons/effects/effects.dmi | Bin 489 -> 682 bytes
vorestation.dme | 2 +
9 files changed, 127 insertions(+), 8 deletions(-)
create mode 100644 code/__defines/dcs/signals_ch/signals_mob/signals_mob_main_ch.dm
create mode 100644 modular_chomp/code/modules/point/point.dm
diff --git a/code/__defines/dcs/signals_ch/signals_mob/signals_mob_main_ch.dm b/code/__defines/dcs/signals_ch/signals_mob/signals_mob_main_ch.dm
new file mode 100644
index 0000000000..ae06f69a02
--- /dev/null
+++ b/code/__defines/dcs/signals_ch/signals_mob/signals_mob_main_ch.dm
@@ -0,0 +1,2 @@
+///from base of /mob/verb/pointed: (atom/A)
+#define COMSIG_MOB_POINTED "mob_pointed"
diff --git a/code/game/atoms_movable_ch.dm b/code/game/atoms_movable_ch.dm
index b1ae68fb7c..e3ef8169ee 100644
--- a/code/game/atoms_movable_ch.dm
+++ b/code/game/atoms_movable_ch.dm
@@ -73,3 +73,9 @@
cut_overlay(source)
if(em_block == source)
em_block = null
+
+/atom/movable/proc/abstract_move(atom/new_loc)
+ var/atom/old_loc = loc
+ var/direction = get_dir(old_loc, new_loc)
+ loc = new_loc
+ Moved(old_loc, direction, TRUE)
diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm
index df2d3ee32b..31257f49de 100644
--- a/code/game/objects/effects/decals/misc.dm
+++ b/code/game/objects/effects/decals/misc.dm
@@ -1,3 +1,4 @@
+/* CHOMPEdit - This is now in modular_chomp/modules/point/point.dm
/obj/effect/decal/point
name = "arrow"
desc = "It's an arrow hanging in mid-air. There may be a wizard about."
@@ -6,9 +7,9 @@
plane = ABOVE_PLANE
anchored = TRUE
mouse_opacity = 0
-
+*/
// Used for spray that you spray at walls, tables, hydrovats etc
/obj/effect/decal/spraystill
density = FALSE
anchored = TRUE
- plane = ABOVE_PLANE
\ No newline at end of file
+ plane = ABOVE_PLANE
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index 76a1672a2e..5f5ac3c912 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -807,11 +807,20 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
W.add_hiddenprint(src)
W.visible_message("[span_red("Invisible fingers crudely paint something in blood on [T]...")]")
+// CHOMPEdit Start - Point Refactor
+/*
/mob/observer/dead/pointed(atom/A as mob|obj|turf in view())
if(!..())
return 0
usr.visible_message("[src] points to [A].")
return 1
+*/
+
+/mob/observer/dead/_pointed(atom/pointed_at)
+ if(!..())
+ return FALSE
+
+ visible_message(span_deadsay("[src] points to [pointed_at]."))
/mob/observer/dead/proc/manifest(mob/user)
is_manifest = TRUE
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index e39220357b..e54fb13d81 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -87,16 +87,26 @@
return
//mob verbs are faster than object verbs. See above.
-/mob/living/pointed(atom/A as mob|obj|turf in view())
+// CHOMPEdit Start - Point refactor
+/mob/living/pointed(atom/A as mob|obj|turf in view(client.view, src))
if(src.stat || src.restrained())
- return 0
+ return FALSE
if(src.status_flags & FAKEDEATH)
- return 0
+ return FALSE
+ /*
if(!..())
return 0
usr.visible_message("[src] points to [A].")
- return 1
+*/
+ return ..()
+
+/mob/living/_pointed(atom/pointing_at)
+ if(!..())
+ return FALSE
+
+ visible_message(span_info("[src] points at [pointing_at]."), span_info("You point at [pointing_at]."))
+// CHOMPEdit End
/mob/living/verb/succumb()
set name = "Succumb to death"
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index eaac9283de..d14b1f104b 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -230,7 +230,7 @@
client.perspective = EYE_PERSPECTIVE
client.eye = loc
return TRUE
-
+/* CHOMPEdit - Moved to modular_chomp/modules/point/point.dm
/mob/verb/pointed(atom/A as mob|obj|turf in view())
set name = "Point To"
set category = "Object"
@@ -260,7 +260,7 @@
face_atom(A)
return 1
-
+*/
/mob/proc/ret_grab(list/L, flag)
return
diff --git a/modular_chomp/code/modules/point/point.dm b/modular_chomp/code/modules/point/point.dm
new file mode 100644
index 0000000000..b4c9d90ba2
--- /dev/null
+++ b/modular_chomp/code/modules/point/point.dm
@@ -0,0 +1,89 @@
+#define POINT_TIME (2.5 SECONDS)
+
+/atom/movable/proc/point_at(atom/pointed_atom)
+ if(!isturf(loc))
+ return
+
+ if (pointed_atom in src)
+ create_point_bubble(pointed_atom)
+ return
+
+ var/turf/tile = get_turf(pointed_atom)
+ if (!tile)
+ return
+
+ var/turf/our_tile = get_turf(src)
+ var/obj/visual = new /obj/effect/temp_visual/point(our_tile, invisibility)
+
+ 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)
+ var/mutable_appearance/thought_bubble = mutable_appearance(
+ 'modular_chomp/icons/effects/effects.dmi',
+ "thought_bubble",
+ plane = PLANE_RUNECHAT,
+ 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.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
+
+ thought_bubble.pixel_x = 16
+ thought_bubble.pixel_y = 32
+ thought_bubble.alpha = 200
+ thought_bubble.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+
+ var/mutable_appearance/point_visual = mutable_appearance(
+ 'icons/mob/screen1.dmi',
+ "arrow"
+ )
+
+ thought_bubble.overlays += point_visual
+
+ add_overlay(thought_bubble)
+ LAZYADD(update_on_z, thought_bubble)
+ addtimer(CALLBACK(src, PROC_REF(clear_point_bubble), thought_bubble), POINT_TIME)
+
+/atom/movable/proc/clear_point_bubble(mutable_appearance/thought_bubble)
+ LAZYREMOVE(update_on_z, thought_bubble)
+ cut_overlay(thought_bubble)
+
+/obj/effect/temp_visual/point
+ name = "pointer"
+ icon = 'icons/mob/screen1.dmi'
+ icon_state = "arrow"
+ plane = ABOVE_PLANE
+ duration = POINT_TIME
+
+/obj/effect/temp_visual/point/Initialize(mapload, set_invis = 0)
+ . = ..()
+ var/atom/old_loc = loc
+ abstract_move(get_turf(src))
+ pixel_x = old_loc.pixel_x
+ pixel_y = old_loc.pixel_y
+ invisibility = set_invis
+
+#undef POINT_TIME
+
+/mob/verb/pointed(atom/A as mob|obj|turf in view())
+ set name = "Point To"
+ set category = "Object"
+
+ if(istype(A, /obj/effect/temp_visual/point))
+ return FALSE
+
+ DEFAULT_QUEUE_OR_CALL_VERB(VERB_CALLBACK(src, PROC_REF(_pointed), A))
+
+/mob/proc/_pointed(atom/pointing_at)
+ if(client && !(pointing_at in view(client.view, src)))
+ return FALSE
+
+ point_at(pointing_at)
+
+ SEND_SIGNAL(src, COMSIG_MOB_POINTED, pointing_at)
+ return TRUE
diff --git a/modular_chomp/icons/effects/effects.dmi b/modular_chomp/icons/effects/effects.dmi
index eca4771b5e3d0ba2c39c722f5726fc6483664fcc..d88ec3bd059a1507703659e2388406ec32c40ff0 100644
GIT binary patch
delta 540
zcmV+%0^|MZ1F8j(BsCjQOjJd{z`%6?8OeQ8^1-aHHvquEz@w+a-{9!=^YbE89FYJ3
z00DGTPE!Ct=GbNc005McP_mC_#c6*^o}<
zeOZLxFGs{YBE%jAmq9VT5K~8d2)N$z{E;HyBhNpnBRzo=U;#K-BQSp*Ft}gN^r4vU%w*$zMip0z)4>eQ+KtkpjNc~%zA4Ir#Wv^u=MC;tY*ILOg
zQZD{bf>~>+v}~PrsQUrXz;!O)DFXi}7{g_US|dpZpuvE{&|&YngSkg&hbId}1aO$T
z?hgUV0nkK$07Tw^?+o6*ga29T723e^n36chfbF>^abD}!*h*YlMj&yHr?v$LjdOH3
zEE_E1Jd`kolJK$LBOK>ZYhtE0QD*g%IB(#wthx%c;m2`q0I_Kvw|K>Q_>5e_1;=^g
emZ-DBt;KIJ#T*AY4M;%%0000c%S;5uM1?)Tkh`}t~oWand0002@Nkl;|B^%DEm8iA4V__Kyr{a>iQYw#xy&tmkz(02tuA
z*BH{iC?Gn>Jq+OW4g#Ws@+d&@dItf)k?|-%@j3?qTp$2TJ}4rQh^YC4asepo9Q`C-
s=XgcUf+N#9hbyWUT&Z)m;&