mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 03:55:05 +01:00
Add an admin-spawn-only syndicate scanner (#26434)
* Add admin-spawn-only syndicate scanner. * Add cooldown and sound on hit. * Vars cooldown time. * Update code/game/objects/items/devices/traitordevices.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Update code/game/objects/items/devices/traitordevices.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> * Code quality. * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> --------- Signed-off-by: Charlie Nolan <funnyman3595@gmail.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
@@ -465,3 +465,58 @@
|
||||
GLOB.mirrors -= src
|
||||
QDEL_NULL(appearance_changer_holder)
|
||||
return ..()
|
||||
|
||||
/// An admin-spawn item that will tell you roughly how close the nearest loyal Nanotrasen crewmember is.
|
||||
/obj/item/syndi_scanner
|
||||
name = "syndicate scanner"
|
||||
desc = "The Syndicate seem to have modified this T-ray scanner for a more nefarious purpose, allowing it to detect all loyal Nanotrasen crew."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "syndi-scanner"
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
throw_speed = 4
|
||||
throw_range = 10
|
||||
flags = CONDUCT
|
||||
item_state = "electronic"
|
||||
/// Split points for range_messages.
|
||||
var/list/ranges = list(5, 15, 30)
|
||||
/// Messages to output to the user.
|
||||
var/list/range_messages = list(
|
||||
"Very strong signal detected. Range: Within 5 meters.",
|
||||
"Strong signal detected. Range: Within 15 meters.",
|
||||
"Weak signal detected. Range: Within 30 meters.",
|
||||
"No signal detected."
|
||||
)
|
||||
var/cooldown_length = 10 SECONDS
|
||||
COOLDOWN_DECLARE(scan_cooldown)
|
||||
var/on_hit_sound = 'sound/effects/ping_hit.ogg'
|
||||
|
||||
/obj/item/syndi_scanner/attack_self(mob/user)
|
||||
if(!COOLDOWN_FINISHED(src, scan_cooldown))
|
||||
to_chat(user, "<span class='warning'>[src] is recharging!</span>")
|
||||
return
|
||||
|
||||
COOLDOWN_START(src, scan_cooldown, cooldown_length)
|
||||
var/turf/user_turf = get_turf(user)
|
||||
var/min_dist = INFINITY
|
||||
for(var/mob/living/player in GLOB.player_list)
|
||||
if(player.stat == DEAD || isnull(player.mind))
|
||||
continue
|
||||
if(!isnull(player.mind.special_role))
|
||||
continue
|
||||
var/turf/target_turf = get_turf(player)
|
||||
if(target_turf.z != user_turf.z)
|
||||
continue
|
||||
min_dist = min(min_dist, get_dist(target_turf, user_turf))
|
||||
|
||||
// By default, we're in the first range, less than any split point.
|
||||
var/range_index = 1
|
||||
for(var/test_range in ranges)
|
||||
if(min_dist > test_range)
|
||||
// Past this split point, move to the next.
|
||||
range_index++
|
||||
else
|
||||
// Found the right split point, and we're not past all of them, so play the on-hit sound effect.
|
||||
playsound(user, on_hit_sound, 75, TRUE)
|
||||
break
|
||||
to_chat(user, "<span class='notice'>[range_messages[range_index]]</span>")
|
||||
|
||||
Reference in New Issue
Block a user