From 202e6349e06ca5d87d13e21676448c156f1e821d Mon Sep 17 00:00:00 2001 From: Ben <91219575+Ben10083@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:08:36 -0400 Subject: [PATCH] Portable Turret Fixes (#19056) Portable Turret can now access it's panel to control it's settings, as intended --------- Co-authored-by: Ben10083 --- code/game/machinery/portable_turret.dm | 2 +- html/changelogs/Ben10083 - PortaTurret.yml | 58 ++++++++++++ .../tgui/interfaces/TurretControl.tsx | 8 +- .../tgui/interfaces/TurretControlPorta.tsx | 88 +++++++++++++++++++ 4 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 html/changelogs/Ben10083 - PortaTurret.yml create mode 100644 tgui/packages/tgui/interfaces/TurretControlPorta.tsx diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index a3a1934ad0c..dbd0dd6253d 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -246,7 +246,7 @@ /obj/machinery/porta_turret/ui_interact(mob/user, var/datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "TurretControl", "Defense Systems Control Panel", 375, 725) + ui = new(user, src, "TurretControlPorta", "Defense Systems Control Panel", 375, 425) ui.open() /obj/machinery/porta_turret/proc/HasController() diff --git a/html/changelogs/Ben10083 - PortaTurret.yml b/html/changelogs/Ben10083 - PortaTurret.yml new file mode 100644 index 00000000000..1afa693a41b --- /dev/null +++ b/html/changelogs/Ben10083 - PortaTurret.yml @@ -0,0 +1,58 @@ +################################ +# 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 +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Ben10083 + +# 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, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Portable Turrets now work outside of areas with a turret controller, spawning a panel for itself as intended." diff --git a/tgui/packages/tgui/interfaces/TurretControl.tsx b/tgui/packages/tgui/interfaces/TurretControl.tsx index 4c10f532205..a452e1cff42 100644 --- a/tgui/packages/tgui/interfaces/TurretControl.tsx +++ b/tgui/packages/tgui/interfaces/TurretControl.tsx @@ -39,17 +39,17 @@ export const TurretControl = (props, context) => { ? 'Behaviour controls are locked.' : 'Behaviour controls are unlocked.'} - +
- +
); }; -export const ControlWindow = (props, context) => { +export const ControlSection = (props, context) => { const { act, data } = useBackend(context); return ( @@ -102,7 +102,7 @@ export const ControlWindow = (props, context) => { ); }; -export const TurretsWindow = (props, context) => { +export const TurretsSection = (props, context) => { const { act, data } = useBackend(context); return ( diff --git a/tgui/packages/tgui/interfaces/TurretControlPorta.tsx b/tgui/packages/tgui/interfaces/TurretControlPorta.tsx new file mode 100644 index 00000000000..df78ff36f30 --- /dev/null +++ b/tgui/packages/tgui/interfaces/TurretControlPorta.tsx @@ -0,0 +1,88 @@ +import { BooleanLike } from '../../common/react'; +import { useBackend } from '../backend'; +import { Button, LabeledList, NoticeBox, Section } from '../components'; +import { Window } from '../layouts'; + +export type TurretData = { + settings: Setting[]; + locked: BooleanLike; + enabled: BooleanLike; + is_lethal: BooleanLike; + lethal: BooleanLike; + can_switch: BooleanLike; +}; + +type Setting = { + category: string; + variable_name: string; + value: BooleanLike; +}; + +export const TurretControlPorta = (props, context) => { + const { act, data } = useBackend(context); + + return ( + + +
+ + {data.locked + ? 'Behaviour controls are locked.' + : 'Behaviour controls are unlocked.'} + + +
+
+
+ ); +}; + +export const ControlSection = (props, context) => { + const { act, data } = useBackend(context); + + return ( + + +