diff --git a/code/__defines/time.dm b/code/__defines/time.dm new file mode 100644 index 0000000000..c2a3632c74 --- /dev/null +++ b/code/__defines/time.dm @@ -0,0 +1,33 @@ +/// Define that just has the current in-universe year for use in whatever context you might want to display that in. (For example, 2022 -> 2562 given a 540 year offset) +#define CURRENT_STATION_YEAR (GLOB.year_integer + STATION_YEAR_OFFSET) + +/// In-universe, SS13 is set 300 years in the future from the real-world day, hence this number for determining the year-offset for the in-game year. +#define STATION_YEAR_OFFSET 300 + +#define MILISECOND * 0.01 +#define MILLISECONDS * 0.01 + +#define DECISECONDS *1 //the base unit all of these defines are scaled by, because byond uses that as a unit of measurement for some reason + +#define SECOND *10 +#define SECONDS *10 + +#define MINUTE *600 +#define MINUTES *600 + +#define HOUR *36000 +#define HOURS *36000 + +#define DAY *864000 +#define DAYS *864000 + +#define TICK *world.tick_lag +#define TICKS *world.tick_lag + +#define DS2TICKS(DS) ((DS)/world.tick_lag) + +#define TICKS2DS(T) ((T) TICKS) + +#define MS2DS(T) ((T) MILLISECONDS) + +#define DS2MS(T) ((T) * 100) diff --git a/code/_global_vars/time_vars.dm b/code/_global_vars/time_vars.dm new file mode 100644 index 0000000000..f05384ca49 --- /dev/null +++ b/code/_global_vars/time_vars.dm @@ -0,0 +1,2 @@ +GLOBAL_VAR_INIT(year, time2text(world.realtime,"YYYY")) +GLOBAL_VAR_INIT(year_integer, text2num(year)) // = 2013??? diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index 863354a46c..1a6c2dadf2 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -1,32 +1,8 @@ -#define MILISECOND * 0.01 -#define MILLISECONDS * 0.01 - -#define SECOND *10 -#define SECONDS *10 - -#define MINUTE *600 -#define MINUTES *600 - -#define HOUR *36000 -#define HOURS *36000 - -#define DAY *864000 -#define DAYS *864000 - #define TimeOfGame (get_game_time()) #define TimeOfTick (TICK_USAGE*0.01*world.tick_lag) -#define TICK *world.tick_lag -#define TICKS *world.tick_lag - -#define DS2TICKS(DS) ((DS)/world.tick_lag) // Convert deciseconds to ticks -#define TICKS2DS(T) ((T) TICKS) // Convert ticks to deciseconds #define DS2NEARESTTICK(DS) TICKS2DS(-round(-(DS2TICKS(DS)))) -#define MS2DS(T) ((T) MILLISECONDS) - -#define DS2MS(T) ((T) * 100) - var/world_startup_time /proc/get_game_time() diff --git a/code/controllers/subsystems/tgui.dm b/code/controllers/subsystems/tgui.dm index d70d06017a..eb0d566f4b 100644 --- a/code/controllers/subsystems/tgui.dm +++ b/code/controllers/subsystems/tgui.dm @@ -27,6 +27,7 @@ SUBSYSTEM_DEF(tgui) var/polyfill = file2text('tgui/public/tgui-polyfill.min.js') polyfill = "" basehtml = replacetextEx(basehtml, "", polyfill) + basehtml = replacetextEx(basehtml, "", "Nanotrasen (c) 2284-[CURRENT_STATION_YEAR]") /datum/controller/subsystem/tgui/Shutdown() close_all_uis() @@ -344,4 +345,4 @@ SUBSYSTEM_DEF(tgui) target.tgui_open_uis.Add(ui) // Clear the old list. source.tgui_open_uis.Cut() - return TRUE \ No newline at end of file + return TRUE diff --git a/tgui/packages/tgui/interfaces/Biogenerator.js b/tgui/packages/tgui/interfaces/Biogenerator.js index b63b6c387d..8292adcf51 100644 --- a/tgui/packages/tgui/interfaces/Biogenerator.js +++ b/tgui/packages/tgui/interfaces/Biogenerator.js @@ -3,7 +3,6 @@ import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, Collapsible, Dropdown, Flex, Input, Section } from '../components'; import { Window } from '../layouts'; -import { refocusLayout } from '../layouts'; const sortTypes = { 'Alphabetical': (a, b) => a - b, @@ -68,8 +67,17 @@ const BiogeneratorItems = (props, context) => { }); return ( +<<<<<<< HEAD refocusLayout()}> {has_contents ? contents : No items matching your criteria was found!} +======= + + {has_contents ? ( + contents + ) : ( + No items matching your criteria was found! + )} +>>>>>>> dd49b83167... Merge pull request #14964 from ItsSelis/selis-tgui-patch ); diff --git a/tgui/packages/tgui/interfaces/CasinoPrizeDispenserCh.js b/tgui/packages/tgui/interfaces/CasinoPrizeDispenserCh.js index 500b6ed0ab..d8f3778f8a 100644 --- a/tgui/packages/tgui/interfaces/CasinoPrizeDispenserCh.js +++ b/tgui/packages/tgui/interfaces/CasinoPrizeDispenserCh.js @@ -3,7 +3,6 @@ import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, Collapsible, Dropdown, Flex, Input, Section } from '../components'; import { Window } from '../layouts'; -import { refocusLayout } from '../layouts'; const sortTypes = { 'Alphabetical': (a, b) => a - b, @@ -90,8 +89,17 @@ const CasinoPrizeDispenserChItems = (props, context) => { }); return ( +<<<<<<< HEAD:tgui/packages/tgui/interfaces/CasinoPrizeDispenserCh.js refocusLayout()}> {has_contents ? contents : No items matching your criteria was found!} +======= + + {has_contents ? ( + contents + ) : ( + No items matching your criteria was found! + )} +>>>>>>> dd49b83167... Merge pull request #14964 from ItsSelis/selis-tgui-patch:tgui/packages/tgui/interfaces/CasinoPrizeDispenser.js ); diff --git a/tgui/packages/tgui/interfaces/ChemDispenser.js b/tgui/packages/tgui/interfaces/ChemDispenser.js index 51d7804ba0..7a7f4d4b22 100644 --- a/tgui/packages/tgui/interfaces/ChemDispenser.js +++ b/tgui/packages/tgui/interfaces/ChemDispenser.js @@ -26,24 +26,19 @@ const ChemDispenserSettings = (properties, context) => { - - {dispenseAmounts.map((a, i) => ( - - - act('amount', { - amount: a, - }) - } - /> - - ))} - + {dispenseAmounts.map((a, i) => ( + + act('amount', { + amount: a, + }) + } + /> + ))} { {medical.fields.map((field, i) => ( - - {field.value} - doEdit(context, field)} - /> + + + {field.value} + doEdit(context, field)} + /> + ))} diff --git a/tgui/packages/tgui/interfaces/MiningVendor.js b/tgui/packages/tgui/interfaces/MiningVendor.js index a4a074af36..5cb4e58ac3 100644 --- a/tgui/packages/tgui/interfaces/MiningVendor.js +++ b/tgui/packages/tgui/interfaces/MiningVendor.js @@ -2,7 +2,6 @@ import { createSearch } from 'common/string'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, Collapsible, Dropdown, Flex, Input, Section } from '../components'; import { Window } from '../layouts'; -import { refocusLayout } from '../layouts'; import { MiningUser } from './common/Mining'; const sortTypes = { @@ -55,8 +54,17 @@ const MiningVendorItems = (props, context) => { }); return ( +<<<<<<< HEAD refocusLayout()}> {has_contents ? contents : No items matching your criteria was found!} +======= + + {has_contents ? ( + contents + ) : ( + No items matching your criteria was found! + )} +>>>>>>> dd49b83167... Merge pull request #14964 from ItsSelis/selis-tgui-patch ); diff --git a/tgui/packages/tgui/interfaces/NtosCameraConsole.js b/tgui/packages/tgui/interfaces/NtosCameraConsole.js new file mode 100644 index 0000000000..3dcd0e1004 --- /dev/null +++ b/tgui/packages/tgui/interfaces/NtosCameraConsole.js @@ -0,0 +1,108 @@ +import { filter, sortBy } from '../../common/collections'; +import { flow } from '../../common/fp'; +import { createSearch } from '../../common/string'; +import { useBackend } from '../backend'; +import { Button, ByondUi } from '../components'; +import { NtosWindow } from '../layouts'; +import { CameraConsoleContent } from './CameraConsole'; + +/** + * Returns previous and next camera names relative to the currently + * active camera. + */ +export const prevNextCamera = (cameras, activeCamera) => { + if (!activeCamera) { + return []; + } + const index = cameras.findIndex( + (camera) => camera.name === activeCamera.name + ); + return [cameras[index - 1]?.name, cameras[index + 1]?.name]; +}; + +/** + * Camera selector. + * + * Filters cameras, applies search terms and sorts the alphabetically. + */ +export const selectCameras = (cameras, searchText = '', networkFilter = '') => { + const testSearch = createSearch(searchText, (camera) => camera.name); + return flow([ + // Null camera filter + filter((camera) => camera?.name), + // Optional search term + searchText && filter(testSearch), + // Optional network filter + networkFilter && + filter((camera) => camera.networks.includes(networkFilter)), + // Slightly expensive, but way better than sorting in BYOND + sortBy((camera) => camera.name), + ])(cameras); +}; + +export const NtosCameraConsole = (props, context) => { + const { act, data } = useBackend(context); + const { mapRef, activeCamera } = data; + const cameras = selectCameras(data.cameras); + const [prevCameraName, nextCameraName] = prevNextCamera( + cameras, + activeCamera + ); + return ( + + + + + + + + Camera: + {(activeCamera && activeCamera.name) || '—'} + + + SEL: + + act('switch_camera', { + name: prevCameraName, + }) + } + /> + + act('switch_camera', { + name: nextCameraName, + }) + } + /> + | PAN: + act('pan', { dir: 8 })} + /> + act('pan', { dir: 1 })} /> + act('pan', { dir: 4 })} + /> + act('pan', { dir: 2 })} + /> + + + + + + ); +}; diff --git a/tgui/packages/tgui/interfaces/NtosCameraConsole.tsx b/tgui/packages/tgui/interfaces/NtosCameraConsole.tsx deleted file mode 100644 index 5b1bdd5f77..0000000000 --- a/tgui/packages/tgui/interfaces/NtosCameraConsole.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { NtosWindow } from '../layouts'; -import { CameraConsoleContent } from './CameraConsole'; - -export const NtosCameraConsole = () => { - return ( - - - - - - ); -}; diff --git a/tgui/packages/tgui/interfaces/SecurityRecords.js b/tgui/packages/tgui/interfaces/SecurityRecords.js index a4cb133f56..234cb3ac67 100644 --- a/tgui/packages/tgui/interfaces/SecurityRecords.js +++ b/tgui/packages/tgui/interfaces/SecurityRecords.js @@ -191,14 +191,16 @@ const SecurityRecordsViewSecurity = (_properties, context) => { {security.fields.map((field, i) => ( - - {field.value} - doEdit(context, field)} - /> + + + {field.value} + doEdit(context, field)} + /> + ))} diff --git a/tgui/packages/tgui/interfaces/SuitCycler.js b/tgui/packages/tgui/interfaces/SuitCycler.js index a9ad1580ef..61641579f7 100644 --- a/tgui/packages/tgui/interfaces/SuitCycler.js +++ b/tgui/packages/tgui/interfaces/SuitCycler.js @@ -75,7 +75,7 @@ const SuitCyclerContent = (props, context) => { act('department', { department: val })} @@ -83,7 +83,7 @@ const SuitCyclerContent = (props, context) => { >>>>>> dd49b83167... Merge pull request #14964 from ItsSelis/selis-tgui-patch #include "code\_global_vars\typecache.dm" #include "code\_global_vars\lists\mapping.dm" #include "code\_global_vars\lists\misc.dm"