mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 21:17:44 +01:00
[MIRROR] Adds the scanner shell. (#7048)
* Adds the scanner shell. (#60325) Adds the scanner shell that lets you scan objects. Not much else than that. * Adds the scanner shell. Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* # Scanner
|
||||
*
|
||||
* A handheld device that lets you flash it over people.
|
||||
*/
|
||||
/obj/item/wiremod_scanner
|
||||
name = "scanner"
|
||||
icon = 'icons/obj/wiremod.dmi'
|
||||
icon_state = "setup_small"
|
||||
inhand_icon_state = "electronic"
|
||||
worn_icon_state = "electronic"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
light_system = MOVABLE_LIGHT_DIRECTIONAL
|
||||
light_on = FALSE
|
||||
|
||||
/obj/item/wiremod_scanner/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/shell, list(
|
||||
new /obj/item/circuit_component/wiremod_scanner()
|
||||
), SHELL_CAPACITY_SMALL)
|
||||
|
||||
/obj/item/circuit_component/wiremod_scanner
|
||||
display_name = "Scanner"
|
||||
display_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/Initialize()
|
||||
. = ..()
|
||||
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/Destroy()
|
||||
attacker = null
|
||||
attacking = null
|
||||
signal = null
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/wiremod_scanner/register_shell(atom/movable/shell)
|
||||
RegisterSignal(shell, COMSIG_ITEM_AFTERATTACK, .proc/handle_afterattack)
|
||||
|
||||
/obj/item/circuit_component/wiremod_scanner/unregister_shell(atom/movable/shell)
|
||||
UnregisterSignal(shell, COMSIG_ITEM_AFTERATTACK)
|
||||
|
||||
/**
|
||||
* Called when the shell item attacks something
|
||||
*/
|
||||
/obj/item/circuit_component/wiremod_scanner/proc/handle_afterattack(atom/source, atom/target, mob/user, proximity_flag)
|
||||
SIGNAL_HANDLER
|
||||
if(!proximity_flag)
|
||||
return
|
||||
source.balloon_alert(user, "scanned object")
|
||||
playsound(source, get_sfx("terminal_type"), 25, FALSE)
|
||||
attacker.set_output(user)
|
||||
attacking.set_output(target)
|
||||
signal.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
Reference in New Issue
Block a user