mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 17:12:12 +00:00
So i left over some basic `/whatever/proc/format` uses in the original PR this fixes it. Notable exceptions to the rule: - Paths in add_verb/remove_verb, we need full path instead of a name there to access verb metadata so we can't use proc ref macros there. - regex.Replace, found out that it does not accept call by name. Instead i added new REGEX_REPLACE_HANDLER so we can at least try to mark these. There's still leftover global procs that do not use GLOBAL_PROC_REF but they functionally equivalent so that's for later. I don't see any reasonable way to grep for this. But if you got any ideas please share.
69 lines
2.3 KiB
Plaintext
69 lines
2.3 KiB
Plaintext
/**
|
|
* # 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 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/target_location = 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 = TRUE) /// no stunning, just a blind
|
|
to_chat(silicon, span_danger("Your sensors were overloaded by a weakened laser shone by [shell]!"))
|
|
|
|
var/image/laser_location = image('icons/obj/weapons/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)
|
|
|
|
target_location.add_overlay(laser_location)
|
|
addtimer(CALLBACK(target_location, TYPE_PROC_REF(/atom, cut_overlay), laser_location), 1 SECONDS)
|