Files

133 lines
4.7 KiB
Plaintext

/**********************Mining Scanners**********************/
/obj/item/mining_scanner
desc = "A scanner that checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations."
name = "manual mining scanner"
icon = 'icons/obj/devices/scanner.dmi'
icon_state = "manual_mining"
inhand_icon_state = "analyzer"
worn_icon_state = "analyzer"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL
obj_flags = CONDUCTS_ELECTRICITY
slot_flags = ITEM_SLOT_BELT
/// The cooldown between scans.
var/cooldown = 35
/// Current time until the next scan can be performed.
var/current_cooldown = 0
/obj/item/mining_scanner/attack_self(mob/user)
if(!user.client)
return
if(current_cooldown <= world.time)
current_cooldown = world.time + cooldown
mineral_scan_pulse(get_turf(user), scanner = src)
//Debug item to identify all ore spread quickly
/obj/item/mining_scanner/admin
/obj/item/mining_scanner/admin/attack_self(mob/user)
for(var/turf/closed/mineral/mineral_turf in world)
if(mineral_turf.scan_state)
mineral_turf.icon = mineral_turf.scan_icon
mineral_turf.icon_state = mineral_turf.scan_state
qdel(src)
/obj/item/t_scanner/adv_mining_scanner
desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations. This one has an extended range."
name = "advanced automatic mining scanner"
icon_state = "advmining0"
inhand_icon_state = "analyzer"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
w_class = WEIGHT_CLASS_SMALL
obj_flags = CONDUCTS_ELECTRICITY
slot_flags = ITEM_SLOT_BELT
/// The cooldown between scans.
var/cooldown = 35
/// Current time until the next scan can be performed.
var/current_cooldown = 0
/// The range of the scanner in tiles.
var/range = 7
//get no effects from the t-ray scanner, which auto-shuts off.
/obj/item/t_scanner/adv_mining_scanner/cyborg_unequip(mob/user)
return
/obj/item/t_scanner/adv_mining_scanner/cyborg/Initialize(mapload)
. = ..()
toggle_on()
/obj/item/t_scanner/adv_mining_scanner/lesser
name = "automatic mining scanner"
desc = "A scanner that automatically checks surrounding rock for useful minerals; it can also be used to stop gibtonite detonations."
icon_state = "mining0"
range = 4
cooldown = 50
/obj/item/t_scanner/adv_mining_scanner/scan()
if(current_cooldown <= world.time)
current_cooldown = world.time + cooldown
var/turf/t = get_turf(src)
mineral_scan_pulse(t, range, src)
/proc/mineral_scan_pulse(turf/start_turf, range = world.view, obj/item/scanner)
var/vents_nearby = FALSE
var/undiscovered = FALSE
var/radar_volume = 30
for(var/obj/structure/ore_vent/vent in range(range, start_turf))
if(!vents_nearby && (!vent.discovered || !vent.tapped))
vents_nearby = TRUE
if(vent.discovered)
undiscovered = TRUE
var/potential_volume = 80 - (get_dist(scanner, vent) * 10)
radar_volume = max(potential_volume, radar_volume)
vent.add_mineral_overlays()
for(var/turf/closed/mineral/mineral in RANGE_TURFS(range, start_turf))
if(!mineral.scan_state)
continue
var/obj/effect/temp_visual/mining_overlay/scan_overlay = locate(/obj/effect/temp_visual/mining_overlay) in mineral
if(!scan_overlay)
scan_overlay = new(mineral)
scan_overlay.icon = mineral.scan_icon
scan_overlay.icon_state = mineral.scan_state
continue
deltimer(scan_overlay.timerid)
scan_overlay.timerid = QDEL_IN_STOPPABLE(scan_overlay, scan_overlay.duration)
animate(scan_overlay, alpha = 0, time = scan_overlay.duration, easing = scan_overlay.easing_style)
if(vents_nearby && scanner)
if(undiscovered)
playsound(scanner, 'sound/machines/radar-ping.ogg', radar_volume, FALSE)
scanner.balloon_alert_to_viewers("ore vent nearby")
else
playsound(scanner, 'sound/machines/sonar-ping.ogg', radar_volume, FALSE)
scanner.spasm_animation(1.5 SECONDS)
/obj/effect/temp_visual/mining_overlay
plane = HIGH_GAME_PLANE
layer = FLASH_LAYER
icon = 'icons/effects/ore_visuals.dmi'
appearance_flags = NONE // to avoid having TILE_BOUND in the flags, so that the 480x480 icon states let you see it no matter where you are
duration = 35
pixel_x = -224
pixel_y = -224
/// What animation easing to use when we create the ore overlay on rock walls/ore vents.
var/easing_style = EASE_IN
/obj/effect/temp_visual/mining_overlay/Initialize(mapload)
. = ..()
animate(src, alpha = 0, time = duration, easing = easing_style)
/obj/effect/temp_visual/mining_overlay/vent
icon = 'icons/effects/vent_overlays.dmi'
icon_state = "unknown"
duration = 45
pixel_x = 0
pixel_y = 0
easing_style = CIRCULAR_EASING|EASE_IN