From 0f0b53ba5d5d4b2826ef582fa1fa46ff4ba3ad26 Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 17:00:52 +0200
Subject: [PATCH 1/6] evil hours
we love ways to mess with things..
---
nsv13.dme | 1 +
.../modules/power/gravitygenerator_modular.dm | 73 +++++++++++++++++++
.../tgui/interfaces/GravityGenerator.js | 14 +++-
3 files changed, 86 insertions(+), 2 deletions(-)
create mode 100644 nsv13/code/modules/power/gravitygenerator_modular.dm
diff --git a/nsv13.dme b/nsv13.dme
index 2273da4cc7f..722d44d9382 100644
--- a/nsv13.dme
+++ b/nsv13.dme
@@ -4044,6 +4044,7 @@
#include "nsv13\code\modules\overmap\weapons\weapons.dm"
#include "nsv13\code\modules\paperwork\stamps.dm"
#include "nsv13\code\modules\pixelshifting\pixelshifting.dm"
+#include "nsv13\code\modules\power\gravitygenerator_modular.dm"
#include "nsv13\code\modules\power\lighting.dm"
#include "nsv13\code\modules\power\power.dm"
#include "nsv13\code\modules\power\stormdrive.dm"
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
new file mode 100644
index 00000000000..6c124163359
--- /dev/null
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -0,0 +1,73 @@
+///This is the modular NSV file for gravity generators, to keep the base file more clear of conflicts.
+
+//Modular proc attachment
+/obj/machinery/gravity_generator/main/attackby(obj/item/I, mob/user, params)
+ if(!(obj_flags & EMAGGED))
+ return ..()
+ if(I?.tool_behaviour != TOOL_MULTITOOL)
+ return ..()
+ if(on || charge_count > 0 || charging_state == POWER_UP)
+ to_chat(user, "You should not mess with this device's circuitry while it is active!")
+ return TRUE
+ if(machine_stat & BROKEN)
+ to_chat(user, "Fix [src]'s chassis first.")
+ return TRUE
+ to_chat(user, "You start resetting [src]'s control circuits and safety protocols.")
+ if(!do_after(user, 10 SECONDS, target = src, extra_checks = CALLBACK(src, PROC_REF(can_reset_generator))))
+ return TRUE
+ to_chat(user, "You reset [src]'s control circuits to default.")
+ obj_flags &= (~EMAGGED)
+ change_setting(1)
+ ui_update()
+ if(ishuman(user))
+ add_fibers(user) //..Fixing this thing is ALSO close and personal work.
+ investigate_log("was reset while emagged and will now generate 1G", INVESTIGATE_GRAVITY)
+ return TRUE
+
+///Is this gravity generator in need of a reset right now, and is this a valid state for it to be reset in?
+/obj/machinery/gravity_generator/main/proc/can_reset_generator()
+ if(on || charge_count > 0 || charging_state == POWER_UP || !(obj_flags & EMAGGED) || (machine_stat & BROKEN))
+ return FALSE
+ return TRUE
+
+///Can this gravity generator be emagged right now?
+/obj/machinery/gravity_generator/main/proc/can_emag_generator()
+ if((obj_flags & EMAGGED) || !on)
+ return FALSE
+ return TRUE
+
+/obj/machinery/gravity_generator/main/emag_act(mob/user)
+ if(obj_flags & EMAGGED)
+ return FALSE
+ if(!on)
+ to_chat(user, "[src] must be active to most efficiently override its controls.")
+ return FALSE
+ to_chat(user, "You start messing eith [src]'s internals. This will take a moment to get done just right..")
+ if(!do_after(user, 5 SECONDS, target = src, extra_checks = CALLBACK(src, PROC_REF(can_emag_generator))))
+ return FALSE
+ to_chat(user, "You override [src]'s safeties and crosswire it to double its target gravity.")
+ charge_count = 0
+ set_state(0)
+ radiation_pulse(src, 1800) //You SHOULD wear protection when messing with this thing this badly.
+ obj_flags |= EMAGGED
+ change_setting(2) // :)
+ set_power(POWER_UP)
+ ui_update()
+ if(ishuman(user))
+ add_fibers(user) //Emagging this thing is close and personal work.
+ investigate_log("was emagged and will now generate 2G", INVESTIGATE_GRAVITY)
+ message_admins("The gravity generator was emagged by [user] (real name: [user.real_name])! [ADMIN_VERBOSEJMP(src)]")
+ return TRUE
+
+//Modular proc attachment
+/obj/machinery/gravity_generator/main/ui_data(mob/user)
+ . = ..()
+ .["emagged"] = (obj_flags & EMAGGED) ? TRUE : FALSE //Trinary for safety because bitfield checks do not return just a pure TRUE / FALSE.
+ .["theme"] = (obj_flags & EMAGGED) ? "syndicate " : "ntos"
+
+///Modular proc OVERRIDE
+/obj/machinery/gravity_generator/main/change_setting(value)
+ if(value != setting)
+ setting = value
+ if(on) //No reason to shake if grav is off.
+ shake_everyone()
diff --git a/tgui/packages/tgui/interfaces/GravityGenerator.js b/tgui/packages/tgui/interfaces/GravityGenerator.js
index 796a23e25c5..a2c008f8544 100644
--- a/tgui/packages/tgui/interfaces/GravityGenerator.js
+++ b/tgui/packages/tgui/interfaces/GravityGenerator.js
@@ -7,17 +7,27 @@ export const GravityGenerator = (props, context) => {
const {
charging_state,
operational,
- } = data;
+ emagged,
+ theme,
+ } = data; { /* NSV13 - added theme and emagged as vars*/ }
return (
+ height={600}
+ theme={theme}> {/* NSV13 - theme change on emag*/ }
{!operational && (
No data available
)}
+ {/* NSV13 - gravgen emag info*/ }
+ {!!operational && !!emagged && (
+
+ {'ERR - GR&!%$$ %$&/(!%$) ?)!&$ยง ERROR, #!&%# 2G'}
+
+ )}
+ {/* NSV13 end*/ }
{!!operational && charging_state !== 0 && (
WARNING - Radiation detected
From 0ef429de7c61d8594147c06b4354cb28676f6849 Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 17:14:40 +0200
Subject: [PATCH 2/6] mm
just to be sure..
---
nsv13/code/modules/power/gravitygenerator_modular.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
index 6c124163359..06e605f43a3 100644
--- a/nsv13/code/modules/power/gravitygenerator_modular.dm
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -56,7 +56,7 @@
if(ishuman(user))
add_fibers(user) //Emagging this thing is close and personal work.
investigate_log("was emagged and will now generate 2G", INVESTIGATE_GRAVITY)
- message_admins("The gravity generator was emagged by [user] (real name: [user.real_name])! [ADMIN_VERBOSEJMP(src)]")
+ message_admins("The gravity generator was emagged by [user] (real name: [user?.real_name])! [ADMIN_VERBOSEJMP(src)]")
return TRUE
//Modular proc attachment
From 288731cf8769ad810f1f819fe355ad20f652277d Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 17:20:46 +0200
Subject: [PATCH 3/6] I love forgetting /span
---
nsv13/code/modules/power/gravitygenerator_modular.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
index 06e605f43a3..42f7ee275e6 100644
--- a/nsv13/code/modules/power/gravitygenerator_modular.dm
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -42,7 +42,7 @@
if(!on)
to_chat(user, "[src] must be active to most efficiently override its controls.")
return FALSE
- to_chat(user, "You start messing eith [src]'s internals. This will take a moment to get done just right..")
+ to_chat(user, "You start messing eith [src]'s internals. This will take a moment to get done just right..")
if(!do_after(user, 5 SECONDS, target = src, extra_checks = CALLBACK(src, PROC_REF(can_emag_generator))))
return FALSE
to_chat(user, "You override [src]'s safeties and crosswire it to double its target gravity.")
From 96adaf7a342b52c66589088eefb36db71ee0f58d Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 17:55:30 +0200
Subject: [PATCH 4/6] ?
---
nsv13/code/modules/power/gravitygenerator_modular.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
index 42f7ee275e6..3640ee40596 100644
--- a/nsv13/code/modules/power/gravitygenerator_modular.dm
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -42,7 +42,7 @@
if(!on)
to_chat(user, "[src] must be active to most efficiently override its controls.")
return FALSE
- to_chat(user, "You start messing eith [src]'s internals. This will take a moment to get done just right..")
+ to_chat(user, "You start messing with [src]'s internals. This will take a moment to get done just right..")
if(!do_after(user, 5 SECONDS, target = src, extra_checks = CALLBACK(src, PROC_REF(can_emag_generator))))
return FALSE
to_chat(user, "You override [src]'s safeties and crosswire it to double its target gravity.")
From a3814ae187f5f3b70795b85eed1b4126cf5ccace Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 19:30:15 +0200
Subject: [PATCH 5/6] suggestion
---
nsv13/code/modules/power/gravitygenerator_modular.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
index 3640ee40596..fb9000c9463 100644
--- a/nsv13/code/modules/power/gravitygenerator_modular.dm
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -7,7 +7,7 @@
if(I?.tool_behaviour != TOOL_MULTITOOL)
return ..()
if(on || charge_count > 0 || charging_state == POWER_UP)
- to_chat(user, "You should not mess with this device's circuitry while it is active!")
+ to_chat(user, "You should not mess with [src]'s circuitry while it is active!")
return TRUE
if(machine_stat & BROKEN)
to_chat(user, "Fix [src]'s chassis first.")
From 52bd7bb37ebaca9bdadfa6a533978ba6a8d7448f Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Wed, 1 May 2024 20:26:48 +0200
Subject: [PATCH 6/6] oh well I am not attached
---
nsv13/code/modules/power/gravitygenerator_modular.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nsv13/code/modules/power/gravitygenerator_modular.dm b/nsv13/code/modules/power/gravitygenerator_modular.dm
index fb9000c9463..be6191514f2 100644
--- a/nsv13/code/modules/power/gravitygenerator_modular.dm
+++ b/nsv13/code/modules/power/gravitygenerator_modular.dm
@@ -40,7 +40,7 @@
if(obj_flags & EMAGGED)
return FALSE
if(!on)
- to_chat(user, "[src] must be active to most efficiently override its controls.")
+ to_chat(user, "[src] must be active to override its controls.")
return FALSE
to_chat(user, "You start messing with [src]'s internals. This will take a moment to get done just right..")
if(!do_after(user, 5 SECONDS, target = src, extra_checks = CALLBACK(src, PROC_REF(can_emag_generator))))