Point Refactor (#8718)

This commit is contained in:
Guti
2024-08-02 00:43:05 +02:00
committed by GitHub
parent c9606a7fe5
commit fd715eb60d
9 changed files with 127 additions and 8 deletions

View File

@@ -0,0 +1,2 @@
///from base of /mob/verb/pointed: (atom/A)
#define COMSIG_MOB_POINTED "mob_pointed"

View File

@@ -73,3 +73,9 @@
cut_overlay(source) cut_overlay(source)
if(em_block == source) if(em_block == source)
em_block = null 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)

View File

@@ -1,3 +1,4 @@
/* CHOMPEdit - This is now in modular_chomp/modules/point/point.dm
/obj/effect/decal/point /obj/effect/decal/point
name = "arrow" name = "arrow"
desc = "It's an arrow hanging in mid-air. There may be a wizard about." desc = "It's an arrow hanging in mid-air. There may be a wizard about."
@@ -6,9 +7,9 @@
plane = ABOVE_PLANE plane = ABOVE_PLANE
anchored = TRUE anchored = TRUE
mouse_opacity = 0 mouse_opacity = 0
*/
// Used for spray that you spray at walls, tables, hydrovats etc // Used for spray that you spray at walls, tables, hydrovats etc
/obj/effect/decal/spraystill /obj/effect/decal/spraystill
density = FALSE density = FALSE
anchored = TRUE anchored = TRUE
plane = ABOVE_PLANE plane = ABOVE_PLANE

View File

@@ -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.add_hiddenprint(src)
W.visible_message("<span class='filter_notice'>[span_red("Invisible fingers crudely paint something in blood on [T]...")]</span>") W.visible_message("<span class='filter_notice'>[span_red("Invisible fingers crudely paint something in blood on [T]...")]</span>")
// CHOMPEdit Start - Point Refactor
/*
/mob/observer/dead/pointed(atom/A as mob|obj|turf in view()) /mob/observer/dead/pointed(atom/A as mob|obj|turf in view())
if(!..()) if(!..())
return 0 return 0
usr.visible_message("<span class='deadsay'><b>[src]</b> points to [A].</span>") usr.visible_message("<span class='deadsay'><b>[src]</b> points to [A].</span>")
return 1 return 1
*/
/mob/observer/dead/_pointed(atom/pointed_at)
if(!..())
return FALSE
visible_message(span_deadsay("<b>[src]</b> points to [pointed_at]."))
/mob/observer/dead/proc/manifest(mob/user) /mob/observer/dead/proc/manifest(mob/user)
is_manifest = TRUE is_manifest = TRUE

View File

@@ -87,16 +87,26 @@
return return
//mob verbs are faster than object verbs. See above. //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()) if(src.stat || src.restrained())
return 0 return FALSE
if(src.status_flags & FAKEDEATH) if(src.status_flags & FAKEDEATH)
return 0 return FALSE
/*
if(!..()) if(!..())
return 0 return 0
usr.visible_message("<span class='filter_notice'><b>[src]</b> points to [A].</span>") usr.visible_message("<span class='filter_notice'><b>[src]</b> points to [A].</span>")
return 1 */
return ..()
/mob/living/_pointed(atom/pointing_at)
if(!..())
return FALSE
visible_message(span_info("<b>[src]</b> points at [pointing_at]."), span_info("You point at [pointing_at]."))
// CHOMPEdit End
/mob/living/verb/succumb() /mob/living/verb/succumb()
set name = "Succumb to death" set name = "Succumb to death"

View File

@@ -230,7 +230,7 @@
client.perspective = EYE_PERSPECTIVE client.perspective = EYE_PERSPECTIVE
client.eye = loc client.eye = loc
return TRUE return TRUE
/* CHOMPEdit - Moved to modular_chomp/modules/point/point.dm
/mob/verb/pointed(atom/A as mob|obj|turf in view()) /mob/verb/pointed(atom/A as mob|obj|turf in view())
set name = "Point To" set name = "Point To"
set category = "Object" set category = "Object"
@@ -260,7 +260,7 @@
face_atom(A) face_atom(A)
return 1 return 1
*/
/mob/proc/ret_grab(list/L, flag) /mob/proc/ret_grab(list/L, flag)
return return

View File

@@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 682 B

View File

@@ -172,6 +172,7 @@
#include "code\__defines\dcs\signals.dm" #include "code\__defines\dcs\signals.dm"
#include "code\__defines\dcs\signals_ch.dm" #include "code\__defines\dcs\signals_ch.dm"
#include "code\__defines\dcs\signals_ch\signals_subsystem.dm" #include "code\__defines\dcs\signals_ch\signals_subsystem.dm"
#include "code\__defines\dcs\signals_ch\signals_mob\signals_mob_main_ch.dm"
#include "code\__defines\traits\_traits.dm" #include "code\__defines\traits\_traits.dm"
#include "code\_global_vars\_regexes.dm" #include "code\_global_vars\_regexes.dm"
#include "code\_global_vars\bitfields.dm" #include "code\_global_vars\bitfields.dm"
@@ -5005,6 +5006,7 @@
#include "modular_chomp\code\modules\planet\sif.dm" #include "modular_chomp\code\modules\planet\sif.dm"
#include "modular_chomp\code\modules\planet\smokestar\turf.dm" #include "modular_chomp\code\modules\planet\smokestar\turf.dm"
#include "modular_chomp\code\modules\player_tips\player_tips_list.dm" #include "modular_chomp\code\modules\player_tips\player_tips_list.dm"
#include "modular_chomp\code\modules\point\point.dm"
#include "modular_chomp\code\modules\power\cells\device_cells.dm" #include "modular_chomp\code\modules\power\cells\device_cells.dm"
#include "modular_chomp\code\modules\power\cells\esoteric_cells.dm" #include "modular_chomp\code\modules\power\cells\esoteric_cells.dm"
#include "modular_chomp\code\modules\power\cells\power_cells.dm" #include "modular_chomp\code\modules\power\cells\power_cells.dm"