@@ -51,7 +62,9 @@ export const RequestManager = (props, context) => {
{request.owner_name}
{request.owner === null && ' [DC]'}
-
{request.timestamp_str}
+
+ {request.timestamp_str}
+
@@ -78,7 +91,11 @@ const displayTypeMap = {
const RequestType = (props) => {
const { requestType } = props;
- return {displayTypeMap[requestType]}:;
+ return (
+
+ {displayTypeMap[requestType]}:
+
+ );
};
const RequestControls = (props, context) => {
@@ -94,19 +111,33 @@ const RequestControls = (props, context) => {
- {request.req_type !== 'request_prayer' && }
- {request.req_type === 'request_nuke' && }
- {request.req_type === 'request_fax' && }
+ {request.req_type !== 'request_prayer' && (
+
+ )}
+ {request.req_type === 'request_nuke' && (
+
+ )}
+ {request.req_type === 'request_fax' && (
+
+ )}
);
};
const FilterPanel = (_, context) => {
- const [filterVisible, setFilterVisible] = useLocalState(context, 'filterVisible', false);
+ const [filterVisible, setFilterVisible] = useLocalState(
+ context,
+ 'filterVisible',
+ false
+ );
const [filteredTypes, setFilteredTypes] = useLocalState(
context,
'filteredTypes',
- Object.fromEntries(Object.entries(displayTypeMap).map(([type, _]) => [type, true]))
+ Object.fromEntries(
+ Object.entries(displayTypeMap).map(([type, _]) => [type, true])
+ )
);
return (
@@ -119,7 +150,8 @@ const FilterPanel = (_, context) => {
className="RequestManager__filterPanel"
style={{
display: filterVisible ? 'block' : 'none',
- }}>
+ }}
+ >
{Object.keys(displayTypeMap).map((type) => {
return (
@@ -142,7 +174,8 @@ const FilterPanel = (_, context) => {
})}
- }>
+ }
+ >
From e3bbecf1e6828f0c77b6befa98e20f1620392b75 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Mon, 22 Jan 2024 06:35:20 -0300
Subject: [PATCH 06/14] sigh
---
code/modules/paperwork/fax.dm | 7 +-
tgui/packages/tgui/interfaces/AdminFax.js | 97 +++++++++++++++++++----
2 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index faed28753efb..45d77dd48bfb 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -69,7 +69,7 @@
// should we make our message be important and be recieved in admin faxes
var/admin_fax_id
-/obj/machinery/fax/Initialize(mapload)
+/obj/machinery/fax/LateInitialize()
. = ..()
GLOB.fax_machines += src
if(!fax_id)
@@ -83,10 +83,7 @@
radio.canhear_range = 0
// Override in subtypes // no
radio.on = TRUE
-
- // Mapping Error checking
- if(!mapload)
- return
+ // mapping error check
for(var/obj/machinery/fax/fax as anything in GLOB.fax_machines)
if(fax == src) // skip self
continue
diff --git a/tgui/packages/tgui/interfaces/AdminFax.js b/tgui/packages/tgui/interfaces/AdminFax.js
index 89870f45451d..6b6b4f64bec4 100644
--- a/tgui/packages/tgui/interfaces/AdminFax.js
+++ b/tgui/packages/tgui/interfaces/AdminFax.js
@@ -1,5 +1,16 @@
import { useBackend, useLocalState } from '../backend';
-import { Section, Box, Dropdown, Button, Input, TextArea, Divider, NumberInput, Tooltip, Knob } from '../components';
+import {
+ Section,
+ Box,
+ Dropdown,
+ Button,
+ Input,
+ TextArea,
+ Divider,
+ NumberInput,
+ Tooltip,
+ Knob,
+} from '../components';
import { Window } from '../layouts';
export const AdminFax = (props, context) => {
@@ -21,8 +32,16 @@ export const FaxMainPanel = (props, context) => {
const [fromWho, setFromWho] = useLocalState(context, 'fromWho', '');
const [rawText, setRawText] = useLocalState(context, 'rawText', '');
const [stamp, setStamp] = useLocalState(context, 'stampType', '');
- const [stampCoordX, setStampCoordX] = useLocalState(context, 'stampCoordX', 0);
- const [stampCoordY, setStampCoordY] = useLocalState(context, 'stampCoordY', 0);
+ const [stampCoordX, setStampCoordX] = useLocalState(
+ context,
+ 'stampCoordX',
+ 0
+ );
+ const [stampCoordY, setStampCoordY] = useLocalState(
+ context,
+ 'stampCoordY',
+ 0
+ );
const [stampAngle, setStampAngle] = useLocalState(context, 'stampAngle', 0);
if (stamp && data.stamps[0] !== 'None') {
data.stamps.unshift('None');
@@ -40,11 +59,13 @@ export const FaxMainPanel = (props, context) => {
act('follow', {
faxName: fax,
})
- }>
+ }
+ >
Follow
- }>
+ }
+ >
{
act('preview', {
faxName: fax,
})
- }>
+ }
+ >
Preview
- }>
+ }
+ >
- setPaperName(v)} />
-
- setFromWho(v)} />
+ setFromWho(v)}
+ />
- setFromWho('Central Command')}>
+ setFromWho('Central Command')}
+ >
Central Command
- setFromWho('Syndicate')}>
+ setFromWho('Syndicate')}
+ >
Syndicate
@@ -133,7 +188,12 @@ export const FaxMainPanel = (props, context) => {
Y Coordinate:{' '}
- setStampCoordY(v)} />
+ setStampCoordY(v)}
+ />
@@ -161,7 +221,8 @@ export const FaxMainPanel = (props, context) => {
act('send', {
faxName: fax,
})
- }>
+ }
+ >
Send Fax
{
stampAngle: stampAngle,
fromWho: fromWho,
});
- }}>
+ }}
+ >
Save Changes
{
act('createPaper', {
faxName: fax,
})
- }>
+ }
+ >
Create Paper
From a832aa0857b5b7651fcd2070d342fbfb22c569e9 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Mon, 22 Jan 2024 07:28:02 -0300
Subject: [PATCH 07/14] fackx
---
code/modules/paperwork/fax.dm | 6 ++++--
tgui/packages/tgui/interfaces/Fax.tsx | 12 ++++++------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index 45d77dd48bfb..c2e15d050ff3 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -69,12 +69,12 @@
// should we make our message be important and be recieved in admin faxes
var/admin_fax_id
-/obj/machinery/fax/LateInitialize()
+/obj/machinery/fax/Initialize(mapload)
. = ..()
GLOB.fax_machines += src
if(!fax_id)
fax_id = SSnetworks.make_address()
- if(!fax_name)
+ if(fax_name == initial(fax_name))
fax_name = "[get_area_name(src)] Fax Machine"
wires = new /datum/wires/fax(src)
@@ -84,6 +84,8 @@
// Override in subtypes // no
radio.on = TRUE
// mapping error check
+ if(!mapload)
+ return
for(var/obj/machinery/fax/fax as anything in GLOB.fax_machines)
if(fax == src) // skip self
continue
diff --git a/tgui/packages/tgui/interfaces/Fax.tsx b/tgui/packages/tgui/interfaces/Fax.tsx
index 6c1689efe74f..c3b9896c37b8 100644
--- a/tgui/packages/tgui/interfaces/Fax.tsx
+++ b/tgui/packages/tgui/interfaces/Fax.tsx
@@ -9,7 +9,7 @@ type FaxData = {
fax_name: string;
visible: boolean;
has_paper: string;
- syndicate_network: boolean;
+ frontier_network: boolean;
fax_history: FaxHistory[];
special_faxes: FaxSpecial[];
};
@@ -19,7 +19,7 @@ type FaxInfo = {
fax_id: string;
visible: boolean;
has_paper: boolean;
- syndicate_network: boolean;
+ frontier_network: boolean;
};
type FaxHistory = {
@@ -40,11 +40,11 @@ export const Fax = (props, context) => {
const { data } = useBackend(context);
const faxes = data.faxes
? sortBy((sortFax: FaxInfo) => sortFax.fax_name)(
- data.syndicate_network
+ data.frontier_network
? data.faxes.filter((filterFax: FaxInfo) => filterFax.visible)
: data.faxes.filter(
(filterFax: FaxInfo) =>
- filterFax.visible && !filterFax.syndicate_network
+ filterFax.visible && !filterFax.frontier_network
)
)
: [];
@@ -82,7 +82,7 @@ export const Fax = (props, context) => {
{faxes.length !== 0 ? (
- {(data.syndicate_network
+ {(data.frontier_network
? data.special_faxes
: data.special_faxes.filter(
(fax: FaxSpecial) => !fax.emag_needed
@@ -108,7 +108,7 @@ export const Fax = (props, context) => {
key={fax.fax_id}
title={fax.fax_name}
disabled={!data.has_paper}
- color={fax.syndicate_network ? 'red' : 'blue'}
+ color={fax.frontier_network ? 'red' : 'blue'}
onClick={() =>
act('send', {
id: fax.fax_id,
From a21c79bbd7ca1413a784a5f52d631301c8367248 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Mon, 22 Jan 2024 07:54:46 -0300
Subject: [PATCH 08/14] removes check for duplicate faxes
---
code/modules/paperwork/fax.dm | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index c2e15d050ff3..c06b98b86b97 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -83,15 +83,6 @@
radio.canhear_range = 0
// Override in subtypes // no
radio.on = TRUE
- // mapping error check
- if(!mapload)
- return
- for(var/obj/machinery/fax/fax as anything in GLOB.fax_machines)
- if(fax == src) // skip self
- continue
- if(fax.fax_name == fax_name)
- fax_name = "Unregistered Fax Machine " + fax_id
- CRASH("Duplicate fax_name [fax.fax_name] detected! Loc 1 [AREACOORD(src)]; Loc 2 [AREACOORD(fax)]; Falling back on random names.")
/obj/machinery/fax/ruin
visible_to_network = FALSE
@@ -510,7 +501,7 @@
/obj/machinery/fax/admin
name = "Central Command Fax Machine"
- fax_name = "Central Command"
+ fax_name = "Nanotrasen Central Command"
radio_channel = RADIO_CHANNEL_CENTCOM
visible_to_network = FALSE
admin_fax_id = "nanotrasen"
From cd8bec64c880149091781f30d6a13ae94fa2822d Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Thu, 25 Jan 2024 01:20:40 -0300
Subject: [PATCH 09/14] removes the ammo box so it works with hunters' pride
---
_maps/map_files/generic/CentCom.dmm | 3 ---
1 file changed, 3 deletions(-)
diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm
index 723abcd9feca..d1f4dd733ecc 100644
--- a/_maps/map_files/generic/CentCom.dmm
+++ b/_maps/map_files/generic/CentCom.dmm
@@ -9988,9 +9988,6 @@
name = "white flag";
desc = "Show in case of Minutemen patrols."
},
-/obj/item/ammo_box/a762{
- pixel_x = 7
- },
/obj/item/radio/intercom/wideband/directional/north,
/turf/open/floor/plasteel/patterned/grid,
/area/centcom)
From 9a00495e2e2a109c4b98326a6530130f9f5aa2bb Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Thu, 25 Jan 2024 04:01:13 -0300
Subject: [PATCH 10/14] fix fax_name, ruins spawn with ruin subtype
---
_maps/RandomRuins/JungleRuins/jungle_cavecrew.dmm | 2 +-
_maps/RandomRuins/JungleRuins/jungle_syndicate.dmm | 2 +-
_maps/RandomRuins/SpaceRuins/corporate_mining.dmm | 2 +-
.../RandomRuins/WasteRuins/wasteplanet_fortress_of_solitide.dmm | 2 +-
_maps/outpost/hangar/nt_asteroid_20x20.dmm | 2 +-
_maps/outpost/hangar/nt_asteroid_40x20.dmm | 2 +-
_maps/outpost/nanotrasen_asteroid.dmm | 2 +-
_maps/outpost/nanotrasen_ice.dmm | 2 +-
code/modules/paperwork/fax.dm | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/_maps/RandomRuins/JungleRuins/jungle_cavecrew.dmm b/_maps/RandomRuins/JungleRuins/jungle_cavecrew.dmm
index cca97a317ce2..afa21c752a75 100644
--- a/_maps/RandomRuins/JungleRuins/jungle_cavecrew.dmm
+++ b/_maps/RandomRuins/JungleRuins/jungle_cavecrew.dmm
@@ -3119,7 +3119,7 @@
/obj/structure/table/reinforced{
color = "#c1b6a5"
},
-/obj/machinery/fax/frontiersmen,
+/obj/machinery/fax/ruin,
/turf/open/floor/plasteel/tech,
/area/ruin/jungle/cavecrew/bridge)
"Ls" = (
diff --git a/_maps/RandomRuins/JungleRuins/jungle_syndicate.dmm b/_maps/RandomRuins/JungleRuins/jungle_syndicate.dmm
index 018739e20dc4..ebd333289382 100644
--- a/_maps/RandomRuins/JungleRuins/jungle_syndicate.dmm
+++ b/_maps/RandomRuins/JungleRuins/jungle_syndicate.dmm
@@ -1330,7 +1330,7 @@
"OW" = (
/obj/structure/table/reinforced,
/obj/item/trash/syndi_cakes,
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/turf/open/floor/plating,
/area/ruin/jungle/syndifort/jerry)
"Ph" = (
diff --git a/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm b/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm
index 6ed5ed67825f..3585b4dcc1e3 100644
--- a/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm
+++ b/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm
@@ -956,7 +956,7 @@
/area/ruin/space)
"xK" = (
/obj/structure/table/wood,
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/turf/open/floor/wood,
/area/ruin/space/has_grav/corporatemine/crewquarters)
"xT" = (
diff --git a/_maps/RandomRuins/WasteRuins/wasteplanet_fortress_of_solitide.dmm b/_maps/RandomRuins/WasteRuins/wasteplanet_fortress_of_solitide.dmm
index 66ab48f18a92..e931e0091d26 100644
--- a/_maps/RandomRuins/WasteRuins/wasteplanet_fortress_of_solitide.dmm
+++ b/_maps/RandomRuins/WasteRuins/wasteplanet_fortress_of_solitide.dmm
@@ -401,7 +401,7 @@
/area/ruin/powered)
"dT" = (
/obj/structure/table/wood,
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/turf/open/floor/plating,
/area/ruin/powered)
"dU" = (
diff --git a/_maps/outpost/hangar/nt_asteroid_20x20.dmm b/_maps/outpost/hangar/nt_asteroid_20x20.dmm
index c3d35afcea10..159af62d17cf 100644
--- a/_maps/outpost/hangar/nt_asteroid_20x20.dmm
+++ b/_maps/outpost/hangar/nt_asteroid_20x20.dmm
@@ -1037,7 +1037,7 @@
/obj/structure/table/reinforced{
color = "#c1b6a5"
},
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/turf/open/floor/plasteel/dark{
planetary_atmos = 1
},
diff --git a/_maps/outpost/hangar/nt_asteroid_40x20.dmm b/_maps/outpost/hangar/nt_asteroid_40x20.dmm
index 959b27a5dd98..0d229e5d7af9 100644
--- a/_maps/outpost/hangar/nt_asteroid_40x20.dmm
+++ b/_maps/outpost/hangar/nt_asteroid_40x20.dmm
@@ -1233,7 +1233,7 @@
/obj/structure/table/reinforced{
color = "#c1b6a5"
},
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/obj/effect/turf_decal/techfloor{
dir = 4
},
diff --git a/_maps/outpost/nanotrasen_asteroid.dmm b/_maps/outpost/nanotrasen_asteroid.dmm
index 8f5c38ded0ea..d5ccb5e0af68 100644
--- a/_maps/outpost/nanotrasen_asteroid.dmm
+++ b/_maps/outpost/nanotrasen_asteroid.dmm
@@ -3558,7 +3558,7 @@
/area/outpost/crew/library)
"mZ" = (
/obj/structure/table/wood,
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/turf/open/floor/plasteel,
/area/outpost/crew/canteen)
"na" = (
diff --git a/_maps/outpost/nanotrasen_ice.dmm b/_maps/outpost/nanotrasen_ice.dmm
index bc92fdbc20c0..04b8040a6275 100644
--- a/_maps/outpost/nanotrasen_ice.dmm
+++ b/_maps/outpost/nanotrasen_ice.dmm
@@ -7463,7 +7463,7 @@
/area/outpost/security/armory)
"XG" = (
/obj/structure/table/reinforced,
-/obj/machinery/fax,
+/obj/machinery/fax/ruin,
/obj/machinery/light/directional/south,
/turf/open/floor/plasteel/telecomms_floor,
/area/outpost/security)
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index c06b98b86b97..42e475024172 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -74,7 +74,7 @@
GLOB.fax_machines += src
if(!fax_id)
fax_id = SSnetworks.make_address()
- if(fax_name == initial(fax_name))
+ if(fax_name == initial(fax_name) && !admin_fax_id)
fax_name = "[get_area_name(src)] Fax Machine"
wires = new /datum/wires/fax(src)
From 820e8ba3b8d82672ba4af43d50d60b553b36d422 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Fri, 26 Jan 2024 15:08:05 -0300
Subject: [PATCH 11/14] move the CMM fax over, plus some plants and a pie
---
_maps/map_files/generic/CentCom.dmm | 42 +++++++++++++++++++----------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm
index d1f4dd733ecc..6ee725216087 100644
--- a/_maps/map_files/generic/CentCom.dmm
+++ b/_maps/map_files/generic/CentCom.dmm
@@ -7447,6 +7447,7 @@
pixel_y = 28
},
/obj/machinery/light/directional/east,
+/obj/item/reagent_containers/food/snacks/pancakes/blueberry,
/turf/open/floor/plasteel,
/area/centcom)
"dMa" = (
@@ -9116,8 +9117,17 @@
/turf/open/floor/plasteel,
/area/centcom/supply)
"hba" = (
-/obj/machinery/fax/admin/minutemen,
/obj/structure/table/reinforced,
+/obj/item/paper_bin{
+ pixel_x = 5
+ },
+/obj/item/clothing/head/cowboy/sec/minutemen{
+ pixel_y = 8;
+ pixel_x = -4
+ },
+/obj/item/pen/fourcolor{
+ pixel_x = 5
+ },
/turf/open/floor/plasteel,
/area/centcom)
"hbh" = (
@@ -9538,7 +9548,8 @@
/obj/effect/decal/cleanable/dirt,
/obj/structure/fluff/paper/stack{
dir = 5;
- pixel_y = 25
+ pixel_y = 25;
+ layer = 2.89
},
/obj/structure/fluff/paper/stack{
dir = 4;
@@ -9623,6 +9634,10 @@
pixel_y = 11
},
/obj/machinery/light/directional/east,
+/obj/item/reagent_containers/food/drinks/bottle/rum{
+ pixel_x = -9;
+ pixel_y = 3
+ },
/turf/open/floor/plasteel,
/area/centcom)
"igW" = (
@@ -10688,10 +10703,7 @@
/obj/structure/sign/poster/minutemen/gold{
pixel_y = 32
},
-/obj/item/clothing/head/cowboy/sec/minutemen{
- pixel_y = 8;
- pixel_x = -4
- },
+/obj/machinery/fax/admin/minutemen,
/turf/open/floor/plasteel,
/area/centcom)
"kkV" = (
@@ -11449,15 +11461,9 @@
/area/tdome/arena_source)
"lQr" = (
/obj/structure/table/reinforced,
-/obj/item/paper_bin{
- pixel_x = 5
- },
-/obj/item/pen/fourcolor{
- pixel_x = 5
- },
/obj/item/flashlight/lamp{
- pixel_x = -8;
- pixel_y = 13
+ pixel_x = 8;
+ pixel_y = 3
},
/obj/structure/sign/minutemen{
pixel_y = 28
@@ -11864,6 +11870,10 @@
},
/obj/effect/turf_decal/corner_steel_grid/diagonal,
/obj/machinery/light/directional/east,
+/obj/effect/decal/cleanable/garbage{
+ pixel_x = 5;
+ pixel_y = -5
+ },
/turf/open/floor/plasteel/elevatorshaft{
color = "#808080"
},
@@ -15174,6 +15184,10 @@
/obj/effect/turf_decal/corner_steel_grid/full{
dir = 8
},
+/obj/item/trash/can{
+ pixel_x = -6;
+ pixel_y = 10
+ },
/turf/open/floor/plasteel/elevatorshaft{
color = "#808080"
},
From 6558636f2795ee5844126cd212035db825c88592 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Fri, 26 Jan 2024 15:08:35 -0300
Subject: [PATCH 12/14] oops
---
_maps/map_files/generic/CentCom.dmm | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm
index 6ee725216087..0eccbd8fc0d0 100644
--- a/_maps/map_files/generic/CentCom.dmm
+++ b/_maps/map_files/generic/CentCom.dmm
@@ -14177,6 +14177,14 @@
/obj/structure/extinguisher_cabinet/directional/east,
/turf/open/floor/plasteel/dark,
/area/centcom/control)
+"rjV" = (
+/obj/effect/turf_decal/corner/opaque/brown{
+ dir = 4
+ },
+/obj/effect/turf_decal/corner/opaque/yellow,
+/obj/item/kirbyplants/random,
+/turf/open/floor/plasteel,
+/area/centcom)
"rln" = (
/obj/machinery/door/airlock/centcom{
name = "CentCom Supply";
@@ -14555,6 +14563,16 @@
},
/turf/open/floor/plasteel,
/area/tdome/arena_source)
+"rUa" = (
+/obj/effect/turf_decal/corner/opaque/yellow{
+ dir = 1
+ },
+/obj/effect/turf_decal/corner/opaque/brown{
+ dir = 8
+ },
+/obj/item/kirbyplants/random,
+/turf/open/floor/plasteel,
+/area/centcom)
"rUH" = (
/obj/structure/table/reinforced,
/obj/item/reagent_containers/food/snacks/mint,
@@ -30788,7 +30806,7 @@ aaa
aPu
nYZ
mGE
-mGE
+rUa
mGE
odH
aPu
@@ -31816,7 +31834,7 @@ aaa
aPu
lKP
sQw
-sQw
+rjV
sQw
tvO
aPu
From 61eb8a2ba8b89292051c705e8ffe513726e2002e Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Tue, 30 Jan 2024 19:58:45 -0300
Subject: [PATCH 13/14] advanced_html
https://github.com/tgstation/tgstation/pull/72553/files
---
code/modules/admin/admin_fax_panel.dm | 2 +-
code/modules/paperwork/paper.dm | 11 +-
tgui/packages/tgui/interfaces/AdminFax.js | 4 +-
tgui/packages/tgui/interfaces/PaperSheet.tsx | 133 ++++---------------
4 files changed, 34 insertions(+), 116 deletions(-)
diff --git a/code/modules/admin/admin_fax_panel.dm b/code/modules/admin/admin_fax_panel.dm
index 746d3b2421af..32f523584a39 100644
--- a/code/modules/admin/admin_fax_panel.dm
+++ b/code/modules/admin/admin_fax_panel.dm
@@ -124,7 +124,7 @@
break
fax_paper.name = "paper — [default_paper_name]"
- fax_paper.add_raw_text(params["rawText"])
+ fax_paper.add_raw_text(params["rawText"], advanced_html = TRUE)
if(stamp)
fax_paper.add_stamp(stamp_class, params["stampX"], params["stampY"], params["stampAngle"], stamp)
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index b5ede755d62e..b47bed614b9a 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -164,12 +164,13 @@
* * bold - Whether this text should be rendered completely bold.
*/
-/obj/item/paper/proc/add_raw_text(text, font, color, bold)
+/obj/item/paper/proc/add_raw_text(text, font, color, bold, advanced_html)
var/new_input_datum = new /datum/paper_input(
text,
font,
color,
bold,
+ advanced_html,
)
input_field_count += get_input_field_count(text)
@@ -579,7 +580,7 @@
// Safe to assume there are writing implement details as user.can_write(...) fails with an invalid writing implement.
var/writing_implement_data = holding.get_writing_implement_details()
- add_raw_text(paper_input, writing_implement_data["font"], writing_implement_data["color"], writing_implement_data["use_bold"])
+ add_raw_text(paper_input, writing_implement_data["font"], writing_implement_data["color"], writing_implement_data["use_bold"], check_rights_for(user?.client, R_FUN))
log_paper("[key_name(user)] wrote to [name]: \"[paper_input]\"")
to_chat(user, "You have added to your paper masterpiece!");
@@ -666,12 +667,15 @@
var/colour = ""
/// Whether to render the font bold or not.
var/bold = FALSE
+ /// Whether the creator of this input field has the R_FUN permission, thus allowing less sanitization
+ var/advanced_html = FALSE
-/datum/paper_input/New(_raw_text, _font, _colour, _bold)
+/datum/paper_input/New(_raw_text, _font, _colour, _bold, _advanced_html)
raw_text = _raw_text
font = _font
colour = _colour
bold = _bold
+ advanced_html = _advanced_html
/datum/paper_input/proc/make_copy()
return new /datum/paper_input(raw_text, font, colour, bold);
@@ -682,6 +686,7 @@
font = font,
color = colour,
bold = bold,
+ advanced_html = advanced_html,
)
/// A single instance of a saved stamp on paper.
diff --git a/tgui/packages/tgui/interfaces/AdminFax.js b/tgui/packages/tgui/interfaces/AdminFax.js
index 6b6b4f64bec4..8245bc4a9ad3 100644
--- a/tgui/packages/tgui/interfaces/AdminFax.js
+++ b/tgui/packages/tgui/interfaces/AdminFax.js
@@ -223,7 +223,7 @@ export const FaxMainPanel = (props, context) => {
})
}
>
- Send Fax
+ Send
{
});
}}
>
- Save Changes
+ Save
{
style: null;
- // It works on TG for almost 4 months as of November 2022, so it's probably fine.
- // eslint-disable-next-line react/state-in-constructor
state: PaperSheetStamperState = { x: 0, y: 0, rotation: 0, yOffset: 0 };
scrollableRef: RefObject;
@@ -245,7 +245,7 @@ class PaperSheetStamper extends Component {
}
// Creates a full stamp div to render the given stamp to the preview.
-export const Stamp = (props, context) => {
+export const Stamp = (props, context): InfernoElement => {
const { activeStamp, sprite, x, y, rotation, opacity, yOffset = 0 } = props;
const stamp_transform = {
'left': x + 'px',
@@ -430,83 +430,10 @@ export class PreviewView extends Component {
// Array containing cache of HTMLInputElements that are enabled.
enabledInputFieldCache: { [key: string]: HTMLInputElement } = {};
- // State checking variables. Used to determine whether or not to use cache.
- lastReadOnly: boolean = true;
- lastDMInputCount: number = 0;
- lastFieldCount: number = 0;
- lastFieldInputCount: number = 0;
-
- // Cache variables for fully parsed text. Workaround for marked.js not being
- // super fast on the BYOND/IE js engine.
- parsedDMCache: string = '';
- parsedTextBoxCache: string = '';
-
constructor(props, context) {
super(props, context);
- this.configureMarked();
}
- configureMarked = (): void => {
- // This is an extension for marked defining a complete custom tokenizer.
- // This tokenizer should run before the the non-custom ones, and gives us
- // the ability to handle [_____] fields before the em/strong tokenizers
- // mangle them, since underscores are used for italic/bold.
- // This massively improves the order of operations, allowing us to run
- // marked, THEN sanitise the output (much safer) and finally insert fields
- // manually afterwards.
- const inputField = {
- name: 'inputField',
- level: 'inline',
-
- start(src) {
- return src.match(/\[/)?.index;
- },
-
- tokenizer(src: string) {
- const rule = /^\[_+\]/;
- const match = src.match(rule);
- if (match) {
- const token = {
- type: 'inputField',
- raw: match[0],
- };
- return token;
- }
- },
-
- renderer(token) {
- return `${token.raw}`;
- },
- };
-
- // Override function, any links and images should
- // kill any other marked tokens we don't want here
- const walkTokens = (token) => {
- switch (token.type) {
- case 'url':
- case 'autolink':
- case 'reflink':
- case 'link':
- case 'image':
- token.type = 'text';
- // Once asset system is up change to some default image
- // or rewrite for icon images
- token.href = '';
- break;
- }
- };
-
- marked.use({
- extensions: [inputField],
- breaks: true,
- gfm: true,
- smartypants: true,
- walkTokens: walkTokens,
- // Once assets are fixed might need to change this for them
- baseUrl: 'thisshouldbreakhttp',
- });
- };
-
// Extracts the paper field "counter" from a full ID.
getHeaderID = (header: string): string => {
return header.replace('paperfield_', '');
@@ -528,10 +455,8 @@ export class PreviewView extends Component {
onInputHandler = (ev: Event): void => {
const input = ev.target as HTMLInputElement;
- // We don't care about text area input, but this is a good place to
- // clear the text box cache if we've had new input.
+ // Skip text area input.
if (input.nodeName !== 'INPUT') {
- this.parsedTextBoxCache = '';
return;
}
@@ -569,7 +494,6 @@ export class PreviewView extends Component {
createPreviewFromDM = (): { text: string; newFieldCount: number } => {
const { data } = useBackend(this.context);
const {
- raw_field_input,
raw_text_input,
default_pen_font,
default_pen_color,
@@ -582,19 +506,6 @@ export class PreviewView extends Component {
const readOnly = !canEdit(held_item_details);
- // If readonly is the same (input field writiability state hasn't changed)
- // And the input stats are the same (no new text inputs since last time)
- // Then use any cached values.
- if (
- this.lastReadOnly === readOnly &&
- this.lastDMInputCount === raw_text_input?.length &&
- this.lastFieldInputCount === raw_field_input?.length
- ) {
- return { text: this.parsedDMCache, newFieldCount: this.lastFieldCount };
- }
-
- this.lastReadOnly = readOnly;
-
raw_text_input?.forEach((value) => {
let rawText = value.raw_text.trim();
if (!rawText.length) {
@@ -604,6 +515,7 @@ export class PreviewView extends Component {
const fontColor = value.color || default_pen_color;
const fontFace = value.font || default_pen_font;
const fontBold = value.bold || false;
+ const advancedHtml = value.advanced_html || false;
let processingOutput = this.formatAndProcessRawText(
rawText,
@@ -612,7 +524,8 @@ export class PreviewView extends Component {
paper_color,
fontBold,
fieldCount,
- readOnly
+ readOnly,
+ advancedHtml
);
output += processingOutput.text;
@@ -620,11 +533,6 @@ export class PreviewView extends Component {
fieldCount = processingOutput.nextCounter;
});
- this.lastDMInputCount = raw_text_input?.length || 0;
- this.lastFieldInputCount = raw_field_input?.length || 0;
- this.lastFieldCount = fieldCount;
- this.parsedDMCache = output;
-
return { text: output, newFieldCount: fieldCount };
};
@@ -640,11 +548,6 @@ export class PreviewView extends Component {
} = data;
const { textArea } = this.props;
- // Use the cache if one exists.
- if (this.parsedTextBoxCache) {
- return this.parsedTextBoxCache;
- }
-
const readOnly = true;
const fontColor = held_item_details?.color || default_pen_color;
@@ -661,8 +564,6 @@ export class PreviewView extends Component {
readOnly
);
- this.parsedTextBoxCache = processingOutput.text;
-
return processingOutput.text;
};
@@ -729,7 +630,17 @@ export class PreviewView extends Component {
},
};
- return marked.parse(rawText);
+ // marked.use({ tokenizer });
+ marked.use({ extensions: [inputField] });
+
+ return marked.parse(rawText, {
+ breaks: true,
+ smartypants: true,
+ smartLists: true,
+ walkTokens,
+ // Once assets are fixed might need to change this for them
+ baseUrl: 'thisshouldbreakhttp',
+ });
};
// Fully formats, sanitises and parses the provided raw text and wraps it
@@ -741,16 +652,18 @@ export class PreviewView extends Component {
paperColor: string,
bold: boolean,
fieldCounter: number = 0,
- forceReadonlyFields: boolean = false
+ forceReadonlyFields: boolean = false,
+ advanced_html: boolean = false
): FieldCreationReturn => {
// First lets make sure it ends in a new line
+ const { data } = useBackend(this.context);
rawText += rawText[rawText.length] === '\n' ? '\n' : '\n\n';
// Second, parse the text using markup
const parsedText = this.runMarkedDefault(rawText);
// Third, we sanitize the text of html
- const sanitizedText = sanitizeText(parsedText);
+ const sanitizedText = sanitizeText(parsedText, advanced_html);
// Fourth we replace the [__] with fields
const fieldedText = this.createFields(
@@ -915,7 +828,7 @@ export class PreviewView extends Component {
let input = document.createElement('input');
input.setAttribute('type', 'text');
- input.style.fontSize = field.is_signature ? '12px' : `${fontSize}px`;
+ input.style.fontSize = field.is_signature ? '30px' : `${fontSize}px`;
input.style.fontFamily = fieldData.font || font;
input.style.fontStyle = field.is_signature ? 'italic' : 'normal';
input.style.fontWeight = 'bold';
From 256a3ed78a780af5a836b01d19a5c15b6c48f5d1 Mon Sep 17 00:00:00 2001
From: meemofcourse <75212565+meemofcourse@users.noreply.github.com>
Date: Fri, 2 Feb 2024 11:13:22 -0300
Subject: [PATCH 14/14] oh that's why
---
code/modules/paperwork/fax.dm | 4 ++--
code/modules/paperwork/paper.dm | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm
index 42e475024172..a4881fdfee38 100644
--- a/code/modules/paperwork/fax.dm
+++ b/code/modules/paperwork/fax.dm
@@ -59,10 +59,10 @@
/// List with a fake-networks(not a fax actually), for request manager.
var/list/special_networks = list(
list(fax_name = "Nanotrasen Central Command", fax_id = "nanotrasen", color = "green", emag_needed = FALSE),
- list(fax_name = "IRMG Mothership", fax_id = "inteq", color = "gold", emag_needed = FALSE),
+ list(fax_name = "IRMG Mothership", fax_id = "inteq", color = "yellow", emag_needed = FALSE),
list(fax_name = "Solarian Confederation Frontier Affairs", fax_id = "solgov", color = "teal", emag_needed = FALSE),
list(fax_name = "Roumain Council of Huntsmen", fax_id = "roumain", color = "brown", emag_needed = FALSE),
- list(fax_name = "Colonial League Leadership", fax_id = "minutemen", color = "navy", emag_needed = FALSE),
+ list(fax_name = "Colonial League Leadership", fax_id = "minutemen", color = "blue", emag_needed = FALSE),
list(fax_name = "Syndicate Coalition Coordination Center", fax_id = "syndicate", color = "red", emag_needed = FALSE),
list(fax_name = "Frontiersmen Communications Quartermaster", fax_id = "frontiersmen", color = "black", emag_needed = TRUE)
)
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index b47bed614b9a..e30a2bdd9737 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -678,7 +678,7 @@
advanced_html = _advanced_html
/datum/paper_input/proc/make_copy()
- return new /datum/paper_input(raw_text, font, colour, bold);
+ return new /datum/paper_input(raw_text, font, colour, bold, advanced_html);
/datum/paper_input/proc/to_list()
return list(