From 710c686283600ca68976a131ae06c76f0f11a5fd Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 23 Jun 2022 07:12:26 +0200 Subject: [PATCH] [MIRROR] Fixes laser pointer crashing [MDB IGNORE] (#14454) * Fixes laser pointer crashing (#67907) Fixes #67885. I don't know if this works because I can't reproduce locally, but I can reproduce on servers so I'll let you know next Sybil round It works * Fixes laser pointer crashing Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- .../wiremod/components/action/laserpointer.dm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/code/modules/wiremod/components/action/laserpointer.dm b/code/modules/wiremod/components/action/laserpointer.dm index d3eb5e13a1e..6f11f69f73c 100644 --- a/code/modules/wiremod/components/action/laserpointer.dm +++ b/code/modules/wiremod/components/action/laserpointer.dm @@ -1,4 +1,3 @@ - /** * # laser pointer Component * @@ -10,9 +9,6 @@ category = "Action" circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL -/// The Laser Pointer Variables - var/turf/pointer_loc - /// The input port var/datum/port/input/target_input var/datum/port/input/image_pixel_x = 0 @@ -47,7 +43,7 @@ var/atom/target = target_input.value var/atom/movable/shell = parent.shell - var/turf/targloc = get_turf(target) + var/turf/target_location = get_turf(target) var/pointer_icon_state = lasercolour_option.value @@ -56,20 +52,17 @@ if(get_dist(current_turf, target) > max_range || current_turf.z != target.z) return - /// only has cyborg flashing since felinid moving spikes time dilation when spammed and the other two features of laserpointers would be unbalanced when spammed + // only has cyborg flashing since felinid moving spikes time dilation when spammed and the other two features of laserpointers would be unbalanced when spammed if(iscyborg(target)) var/mob/living/silicon/silicon = target log_combat(shell, silicon, "shone in the sensors", src) - silicon.flash_act(affect_silicon = 1) /// no stunning, just a blind + silicon.flash_act(affect_silicon = TRUE) /// no stunning, just a blind to_chat(silicon, span_danger("Your sensors were overloaded by a weakened laser shone by [shell]!")) - - ///laserpointer image - var/image/laser_location = image('icons/obj/guns/projectiles.dmi',targloc,"[pointer_icon_state]_laser",10) + var/image/laser_location = image('icons/obj/guns/projectiles.dmi',target_location,"[pointer_icon_state]_laser",10) laser_location.pixel_x = clamp(target.pixel_x + image_pixel_x.value,-15,15) laser_location.pixel_y = clamp(target.pixel_y + image_pixel_y.value,-15,15) - flick_overlay_view(laser_location, targloc, 10) - - + target_location.add_overlay(laser_location) + addtimer(CALLBACK(target_location, /atom/proc/cut_overlay, laser_location), 1 SECONDS)