mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-10 23:47:08 +01:00
Ore Detectors (#10182)
Replaced ore radars with ore detectors. It display pings in the darkness when it spots the ore, even through walls.
Mining stationbounds and drones now get ore detectors.
You can now see psi-pings through walls again.
This commit is contained in:
@@ -85,6 +85,7 @@
|
||||
#include "code\_helpers\global_lists.dm"
|
||||
#include "code\_helpers\icon_smoothing.dm"
|
||||
#include "code\_helpers\icons.dm"
|
||||
#include "code\_helpers\images.dm"
|
||||
#include "code\_helpers\lists.dm"
|
||||
#include "code\_helpers\logging.dm"
|
||||
#include "code\_helpers\maths.dm"
|
||||
@@ -1848,6 +1849,7 @@
|
||||
#include "code\modules\mining\mint.dm"
|
||||
#include "code\modules\mining\ore.dm"
|
||||
#include "code\modules\mining\ore_datum.dm"
|
||||
#include "code\modules\mining\ore_detector.dm"
|
||||
#include "code\modules\mining\ore_satchel.dm"
|
||||
#include "code\modules\mining\satchel_ore_boxdm.dm"
|
||||
#include "code\modules\mining\drilling\drill.dm"
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/proc/pixel_shift_to_turf(var/image/I, var/turf/source_turf, var/turf/target_turf)
|
||||
var/y_shift = (target_turf.y - source_turf.y) * world.icon_size
|
||||
var/x_shift = (target_turf.x - source_turf.x) * world.icon_size
|
||||
I.pixel_y += y_shift
|
||||
I.pixel_x += x_shift
|
||||
@@ -25,7 +25,7 @@
|
||||
new /obj/item/shovel(src)
|
||||
new /obj/item/pickaxe(src)
|
||||
new /obj/item/gun/custom_ka/frame01/prebuilt(src)
|
||||
new /obj/item/ore_radar(src)
|
||||
new /obj/item/ore_detector(src)
|
||||
new /obj/item/key/minecarts(src)
|
||||
new /obj/item/device/gps/mining(src)
|
||||
new /obj/item/book/manual/ka_custom(src)
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
/obj/item/ore_detector
|
||||
name = "ore detector"
|
||||
desc = "A device capable of locating and displaying ores to the average untrained hole explorer."
|
||||
icon = 'icons/obj/contained_items/tools/ore_scanner.dmi'
|
||||
icon_state = "ore_scanner"
|
||||
item_state = "ore_scanner"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
force = 1
|
||||
var/active = FALSE
|
||||
var/datum/weakref/our_user
|
||||
var/list/search_ores = list()
|
||||
var/ping_rate = 4 SECONDS
|
||||
var/last_ping = 0
|
||||
|
||||
var/list/ore_names
|
||||
|
||||
/obj/item/ore_detector/examine(mob/user, distance)
|
||||
if(..(user, 1))
|
||||
to_chat(user, FONT_SMALL(SPAN_NOTICE("Alt-click to set the ore you wish to search for.")))
|
||||
|
||||
/obj/item/ore_detector/Destroy()
|
||||
deactivate()
|
||||
return ..()
|
||||
|
||||
/obj/item/ore_detector/update_icon()
|
||||
icon_state = "ore_scanner[active ? "-active" : ""]"
|
||||
|
||||
/obj/item/ore_detector/attack_self(mob/user)
|
||||
if(!length(search_ores))
|
||||
to_chat(user, SPAN_WARNING("You haven't set an ore to search for yet!"))
|
||||
return
|
||||
active = !active
|
||||
var/msg = "You [active ? "activate" : "deactivate"] \the [src]."
|
||||
to_chat(user, SPAN_NOTICE(msg))
|
||||
if(active)
|
||||
activate(user)
|
||||
else
|
||||
deactivate()
|
||||
|
||||
/obj/item/ore_detector/AltClick(mob/user)
|
||||
if(!length(ore_names))
|
||||
ore_names = list()
|
||||
for(var/ore_n in ore_data)
|
||||
var/ore/O = ore_data[ore_n]
|
||||
var/ore_name = O.display_name
|
||||
ore_names += ore_name
|
||||
if(loc == user)
|
||||
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
|
||||
if(!ui)
|
||||
ui = new(user, src, "devices-oredetector", 320, 220, capitalize_first_letters(name))
|
||||
ui.open()
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/ore_detector/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
|
||||
if(!data)
|
||||
data = list()
|
||||
|
||||
VUEUI_SET_CHECK_LIST(data["ore_names"], ore_names, ., data)
|
||||
VUEUI_SET_CHECK_LIST(data["selected_ores"], search_ores, ., data)
|
||||
|
||||
/obj/item/ore_detector/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(href_list["chosen_ore"])
|
||||
if(href_list["chosen_ore"] in search_ores)
|
||||
search_ores -= href_list["chosen_ore"]
|
||||
else
|
||||
search_ores += href_list["chosen_ore"]
|
||||
|
||||
SSvueui.check_uis_for_change(src)
|
||||
|
||||
/obj/item/ore_detector/process()
|
||||
if(last_ping + ping_rate > world.time)
|
||||
return
|
||||
if(isnull(our_user))
|
||||
deactivate()
|
||||
return
|
||||
var/mob/M = our_user.resolve()
|
||||
if(loc != M && loc.loc != M)
|
||||
deactivate()
|
||||
return
|
||||
last_ping = world.time
|
||||
var/turf/our_turf = get_turf(src)
|
||||
for(var/turf/simulated/mineral/mine_turf in RANGE_TURFS(7, our_turf))
|
||||
if(isnull(our_user)) // in the event it's dropped midsweep
|
||||
return
|
||||
if(mine_turf.mineral && (mine_turf.mineral.display_name in search_ores))
|
||||
var/image/ore_ping = image(icon = 'icons/obj/contained_items/tools/ore_scanner.dmi', icon_state = "signal_overlay", loc = our_turf, layer = OBFUSCATION_LAYER + 0.1)
|
||||
pixel_shift_to_turf(ore_ping, our_turf, mine_turf)
|
||||
M << ore_ping
|
||||
QDEL_IN(ore_ping, 4 SECONDS)
|
||||
|
||||
/obj/item/ore_detector/emp_act()
|
||||
deactivate()
|
||||
|
||||
/obj/item/ore_detector/proc/activate(var/mob/user)
|
||||
if(!length(search_ores))
|
||||
return
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
our_user = WEAKREF(user)
|
||||
update_icon()
|
||||
|
||||
/obj/item/ore_detector/proc/deactivate()
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
our_user = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/ore_detector/throw_at()
|
||||
..()
|
||||
deactivate()
|
||||
|
||||
/obj/item/ore_detector/dropped()
|
||||
..()
|
||||
deactivate()
|
||||
|
||||
/obj/item/ore_detector/on_give()
|
||||
deactivate()
|
||||
@@ -690,6 +690,7 @@ var/global/list/robot_modules = list(
|
||||
src.modules += new /obj/item/storage/bag/sheetsnatcher/borg(src)
|
||||
src.modules += new /obj/item/gripper/miner(src)
|
||||
src.modules += new /obj/item/rfd/mining(src)
|
||||
src.modules += new /obj/item/ore_detector(src)
|
||||
src.modules += new /obj/item/mining_scanner(src)
|
||||
src.modules += new /obj/item/ore_radar(src)
|
||||
src.modules += new /obj/item/pen/robopen(src)
|
||||
@@ -977,6 +978,7 @@ var/global/list/robot_modules = list(
|
||||
modules += new /obj/item/tank/jetpack/carbondioxide(src)
|
||||
modules += new /obj/item/rfd/mining(src)
|
||||
modules += new /obj/item/tethering_device(src)
|
||||
modules += new /obj/item/ore_detector(src)
|
||||
|
||||
var/datum/matter_synth/metal = new /datum/matter_synth/metal(20000)
|
||||
synths += metal
|
||||
|
||||
@@ -296,15 +296,15 @@
|
||||
if(!do_after(user, 3 SECONDS))
|
||||
return
|
||||
var/list/dirs = list()
|
||||
var/turf/our_turf = get_turf(user)
|
||||
for(var/mob/living/L in range(20))
|
||||
var/turf/T = get_turf(L)
|
||||
if(!T || L == user || L.stat == DEAD || L.invisibility == INVISIBILITY_LEVEL_TWO)
|
||||
continue
|
||||
if(L.is_psi_blocked())
|
||||
continue
|
||||
var/image/ping_image = image(icon = 'icons/effects/effects.dmi', icon_state = "sonar_ping", loc = T)
|
||||
ping_image.plane = LIGHTING_LAYER+1
|
||||
ping_image.layer = LIGHTING_LAYER+1
|
||||
var/image/ping_image = image(icon = 'icons/effects/effects.dmi', icon_state = "sonar_ping", loc = our_turf, layer = OBFUSCATION_LAYER + 0.1)
|
||||
pixel_shift_to_turf(ping_image, our_turf, T)
|
||||
user << ping_image
|
||||
addtimer(CALLBACK(GLOBAL_PROC, /proc/qdel, ping_image), 8)
|
||||
var/direction = num2text(get_dir(user, L))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
author: Geeves, Happy Fox
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Replaced ore radars with ore detectors. It display pings in the darkness when it spots the ore, even through walls."
|
||||
- rscadd: "Mining stationbounds and drones now get ore detectors."
|
||||
- bugfix: "You can now see psi-pings through walls again."
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<div class="ores">
|
||||
<h3>Selected Ores:</h3>
|
||||
<div v-for="ore in ore_names" :key="ore">
|
||||
<vui-button :class="{'selected': selected_ores.includes(ore)}" :params="{'chosen_ore': ore}">{{ ore }}</vui-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return this.$root.$data.state;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ores {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user