Files
Bubberstation/code/modules/wiremod/shell/scanner.dm
Joshua Kidder 3690bd3d8a Add distance output to direction circuit component, resizes several shells (#86577)
## About The Pull Request

The direction component outputs the direction of an entity if it's
within 7 tiles of the circuit. Since it already checks the distance, I
added distance as one of its outputs.

Besides that, I did a pass over the generics and shells and resized many
of them. Most I resized to be small or tiny, except for the airlock
shell, which I set to be bulky because it's a whole ass door. The shells
I didn't touch remain at 'normal' size.

1) All handheld shells set to small, compact remote set to tiny 
2) all components and the generic of the circuit set to tiny
3) drone shell set to small
4) airlock shell set to bulky
## Why It's Good For The Game

Returning the distance spares any would be circuiteers from having to do
a labyrinthine set of calculations to determine distance themselves.

Making most circuits more portable makes them more attractive for people
to tote around.
## Changelog
🆑 Bisar
qol: The 'direction' circuit component now also returns the distance of
its target.
balance: Most circuit shells and the generic component and generic
circuit have had their size reduced.
balance: The airlock circuit shell has had its size increased.
/🆑

---------

Co-authored-by: Metekillot <ubuntu@ip-172-26-7-23.us-east-2.compute.internal>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-09-14 22:54:07 +00:00

61 lines
1.9 KiB
Plaintext

/**
* # Scanner
*
* A handheld device that lets you flash it over people.
*/
/obj/item/wiremod_scanner
name = "scanner"
icon = 'icons/obj/science/circuits.dmi'
icon_state = "setup_small"
inhand_icon_state = "electronic"
worn_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
light_system = OVERLAY_LIGHT_DIRECTIONAL
light_on = FALSE
w_class = WEIGHT_CLASS_SMALL
/obj/item/wiremod_scanner/Initialize(mapload)
. = ..()
AddComponent(/datum/component/shell, list(
new /obj/item/circuit_component/wiremod_scanner()
), SHELL_CAPACITY_SMALL)
/obj/item/circuit_component/wiremod_scanner
display_name = "Scanner"
desc = "Used to receive scanned entities from the scanner."
/// Called when afterattack is called on the shell.
var/datum/port/output/signal
/// The attacker
var/datum/port/output/attacker
/// The entity being attacked
var/datum/port/output/attacking
/obj/item/circuit_component/wiremod_scanner/populate_ports()
attacker = add_output_port("Scanner", PORT_TYPE_ATOM)
attacking = add_output_port("Scanned Entity", PORT_TYPE_ATOM)
signal = add_output_port("Scanned", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/wiremod_scanner/register_shell(atom/movable/shell)
RegisterSignal(shell, COMSIG_ITEM_INTERACTING_WITH_ATOM, PROC_REF(handle_interaction))
/obj/item/circuit_component/wiremod_scanner/unregister_shell(atom/movable/shell)
UnregisterSignal(shell, COMSIG_ITEM_INTERACTING_WITH_ATOM)
/**
* Called when the shell item attacks something
*/
/obj/item/circuit_component/wiremod_scanner/proc/handle_interaction(atom/source, mob/user, atom/target, ...)
SIGNAL_HANDLER
source.balloon_alert(user, "scanned object")
playsound(source, SFX_TERMINAL_TYPE, 25, FALSE)
attacker.set_output(user)
attacking.set_output(target)
signal.set_output(COMPONENT_SIGNAL)
return ITEM_INTERACT_SUCCESS