From 002241f0e1502104879d8fee6aa9eee25df7bda4 Mon Sep 17 00:00:00 2001 From: Bond <58570888+TheBonded@users.noreply.github.com> Date: Tue, 19 Apr 2022 09:55:48 -0600 Subject: [PATCH] Circuit laserpointers (#66175) * unfinished circuit laserpointer module If this makes a pr I will be very mad * Almost done making it function * adds it to the research path * lets it be logged * Makes it work and printable * removes felinid moving to save time dilation + removes cyborg stun because just no * minor changes * removes unused var oops * guh?? (alphabet) --- .../research/designs/wiremod_designs.dm | 5 ++ code/modules/research/techweb/all_nodes.dm | 1 + .../wiremod/components/action/laserpointer.dm | 75 +++++++++++++++++++ tgstation.dme | 1 + 4 files changed, 82 insertions(+) create mode 100644 code/modules/wiremod/components/action/laserpointer.dm diff --git a/code/modules/research/designs/wiremod_designs.dm b/code/modules/research/designs/wiremod_designs.dm index fda9f051550..1025fef2990 100644 --- a/code/modules/research/designs/wiremod_designs.dm +++ b/code/modules/research/designs/wiremod_designs.dm @@ -133,6 +133,11 @@ id = "comp_speech" build_path = /obj/item/circuit_component/speech +/datum/design/component/laserpointer + name = "Laser Pointer Component" + id = "comp_laserpointer" + build_path = /obj/item/circuit_component/laserpointer + /datum/design/component/timepiece name = "Timepiece Component" id = "comp_timepiece" diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index 11636a323c9..9e713449b0d 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -253,6 +253,7 @@ "comp_index", "comp_index_assoc", "comp_index_table", + "comp_laserpointer", "comp_length", "comp_light", "comp_list_add", diff --git a/code/modules/wiremod/components/action/laserpointer.dm b/code/modules/wiremod/components/action/laserpointer.dm new file mode 100644 index 00000000000..d3eb5e13a1e --- /dev/null +++ b/code/modules/wiremod/components/action/laserpointer.dm @@ -0,0 +1,75 @@ + +/** + * # laser pointer Component + * + * Points a laser at a tile or mob + */ +/obj/item/circuit_component/laserpointer + display_name = "Laser Pointer" + desc = "A component that shines a high powered light at a target." + 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 + var/datum/port/input/image_pixel_y = 0 + + var/max_range = 7 + + var/datum/port/input/option/lasercolour_option + + +/obj/item/circuit_component/laserpointer/get_ui_notices() + . = ..() + . += create_ui_notice("Maximum Range: [max_range] tiles", "orange", "info") + +/obj/item/circuit_component/laserpointer/populate_options() + var/static/component_options = list( + "red", + "green", + "blue", + "purple", + ) + lasercolour_option = add_option_port("Laser Colour", component_options) + + +/obj/item/circuit_component/laserpointer/populate_ports() + target_input = add_input_port("Target", PORT_TYPE_ATOM) + image_pixel_x = add_input_port("X-Axis Shift", PORT_TYPE_NUMBER) + image_pixel_y = add_input_port("Y-Axis Shift", PORT_TYPE_NUMBER) + + +/obj/item/circuit_component/laserpointer/input_received(datum/port/input/port) + + var/atom/target = target_input.value + var/atom/movable/shell = parent.shell + var/turf/targloc = get_turf(target) + + + var/pointer_icon_state = lasercolour_option.value + + var/turf/current_turf = get_location() + 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 + 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 + 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) + + 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) + + diff --git a/tgstation.dme b/tgstation.dme index 641792afea3..a009acf21aa 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4271,6 +4271,7 @@ #include "code\modules\wiremod\components\abstract\list_variable.dm" #include "code\modules\wiremod\components\abstract\module.dm" #include "code\modules\wiremod\components\abstract\variable.dm" +#include "code\modules\wiremod\components\action\laserpointer.dm" #include "code\modules\wiremod\components\action\light.dm" #include "code\modules\wiremod\components\action\mmi.dm" #include "code\modules\wiremod\components\action\pathfind.dm"