From ae01e80fbeca7676e0120c93c402d44c4cdbfde9 Mon Sep 17 00:00:00 2001
From: DreamySkrell <107256943+DreamySkrell@users.noreply.github.com>
Date: Fri, 19 Jan 2024 12:32:05 +0100
Subject: [PATCH] Targeting console shows scan of target (#18212)
* a
* a
* aa
* :)
* cc
* f
---------
Co-authored-by: DreamySkrell <>
---
.../ship_weaponry/_targeting_console.dm | 5 +
.../DreamySkrell-target-console-scan.yml | 41 ++++++++
tgui/packages/tgui/interfaces/Gunnery.tsx | 11 +++
.../ShuttleControlConsoleMultiExplore.tsx | 95 ++----------------
.../tgui/interfaces/common/MinimapView.tsx | 97 +++++++++++++++++++
5 files changed, 160 insertions(+), 89 deletions(-)
create mode 100644 html/changelogs/DreamySkrell-target-console-scan.yml
create mode 100644 tgui/packages/tgui/interfaces/common/MinimapView.tsx
diff --git a/code/modules/overmap/ship_weaponry/_targeting_console.dm b/code/modules/overmap/ship_weaponry/_targeting_console.dm
index c2de72979db..bb1095dab50 100644
--- a/code/modules/overmap/ship_weaponry/_targeting_console.dm
+++ b/code/modules/overmap/ship_weaponry/_targeting_console.dm
@@ -77,6 +77,11 @@
else
selected_z = 0
data["selected_z"] = 0
+ var/obj/effect/entry_point = selected_entrypoint
+ if(istype(entry_point) && entry_point.z)
+ data["entry_point_map_image"] = SSholomap.minimaps_scan_base64[entry_point.z]
+ data["entry_point_x"] = entry_point.x
+ data["entry_point_y"] = entry_point.y
data["entry_points"] = copy_entrypoints(selected_z)
if(cannon)
data["cannon"] = get_gun_data(cannon);
diff --git a/html/changelogs/DreamySkrell-target-console-scan.yml b/html/changelogs/DreamySkrell-target-console-scan.yml
new file mode 100644
index 00000000000..6c0535e76de
--- /dev/null
+++ b/html/changelogs/DreamySkrell-target-console-scan.yml
@@ -0,0 +1,41 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: DreamySkrell
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - rscadd: "Targeting console shows a scan of the area when selecting a entry point."
diff --git a/tgui/packages/tgui/interfaces/Gunnery.tsx b/tgui/packages/tgui/interfaces/Gunnery.tsx
index cb5b90be52a..7c7ac777f3e 100644
--- a/tgui/packages/tgui/interfaces/Gunnery.tsx
+++ b/tgui/packages/tgui/interfaces/Gunnery.tsx
@@ -4,6 +4,7 @@ import { useBackend } from '../backend';
import { Button, Section, Box, LabeledList } from '../components';
import { Dropdown } from '../components/Dropdown';
import { Window } from '../layouts';
+import { MinimapView } from './common/MinimapView';
type ShipGun = {
name: string;
@@ -24,6 +25,9 @@ export type GunneryData = {
mobile_platform: BooleanLike;
platform_directions: string[];
platform_direction: string;
+ entry_point_map_image: any; // base64 icon
+ entry_point_x: number;
+ entry_point_y: number;
};
type Targeting = {
@@ -107,6 +111,13 @@ export const GunneryWindow = (props, context) => {
''
)}
+
+ {MinimapView({
+ map_image: data.entry_point_map_image,
+ x: data.entry_point_x,
+ y: data.entry_point_y,
+ })}
+
{
const { act, data } =
useBackend(context);
- const map_size = 255;
- const zoom_mod = 2.0;
- const center_point_x = data.destination_x;
- const center_point_y = data.destination_y;
-
- const rand = Math.random() * 1.0;
-
return (
@@ -100,88 +94,11 @@ export const ShuttleControlConsoleMultiExplore = (props, context) => {
{data.destination_map_image ? (
-
+ {MinimapView({
+ map_image: data.destination_map_image,
+ x: data.destination_x,
+ y: data.destination_y,
+ })}
) : (
''
diff --git a/tgui/packages/tgui/interfaces/common/MinimapView.tsx b/tgui/packages/tgui/interfaces/common/MinimapView.tsx
new file mode 100644
index 00000000000..ca650e93fa5
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/common/MinimapView.tsx
@@ -0,0 +1,97 @@
+import { NoticeBox } from 'tgui/components';
+
+type MinimapViewProps = {
+ map_image: any; // base64 icon
+ x: number;
+ y: number;
+};
+
+export const MinimapView = (props: MinimapViewProps) => {
+ const map_size = 255;
+ const zoom_mod = 2.0;
+ const center_point_x = props.x;
+ const center_point_y = props.y;
+ return props.map_image ? (
+
+ ) : (
+ No scan image available.
+ );
+};