From 5fa823b95c878309fce6a0a979ef464cac1b0636 Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 15 Nov 2024 21:43:56 -0600 Subject: [PATCH 1/5] Unit test that `world.opendream_topic_port` is a number --- Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm diff --git a/Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm b/Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm new file mode 100644 index 0000000000..a815651f3f --- /dev/null +++ b/Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm @@ -0,0 +1,3 @@ + +/proc/RunTest() + ASSERT(isnum(world.opendream_topic_port)) From 58ed891bddefc00c96c8a5cd3201feb9f94fdb0c Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 15 Nov 2024 21:48:08 -0600 Subject: [PATCH 2/5] test `world.system_type` --- Content.Tests/DMProject/Tests/Builtins/world_system_type.dm | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Content.Tests/DMProject/Tests/Builtins/world_system_type.dm diff --git a/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm b/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm new file mode 100644 index 0000000000..c9650f58cd --- /dev/null +++ b/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm @@ -0,0 +1,3 @@ + +/proc/RunTest() + ASSERT(isnum(world.system_type)) From edf6f53757843c5736d8b05bacc0a420f994bd9f Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 15 Nov 2024 21:53:02 -0600 Subject: [PATCH 3/5] Rename world_topic_port.dm to world_opendream_topic_port.dm --- .../{world_topic_port.dm => world_opendream_topic_port.dm} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Content.Tests/DMProject/Tests/Builtins/{world_topic_port.dm => world_opendream_topic_port.dm} (100%) diff --git a/Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm b/Content.Tests/DMProject/Tests/Builtins/world_opendream_topic_port.dm similarity index 100% rename from Content.Tests/DMProject/Tests/Builtins/world_topic_port.dm rename to Content.Tests/DMProject/Tests/Builtins/world_opendream_topic_port.dm From ccba5e46a6bcee895526b01a8aa2ed243d6f2c94 Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 15 Nov 2024 22:19:54 -0600 Subject: [PATCH 4/5] Update Content.Tests/DMProject/Tests/Builtins/world_system_type.dm --- Content.Tests/DMProject/Tests/Builtins/world_system_type.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm b/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm index c9650f58cd..ea9ce6b505 100644 --- a/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm +++ b/Content.Tests/DMProject/Tests/Builtins/world_system_type.dm @@ -1,3 +1,3 @@ /proc/RunTest() - ASSERT(isnum(world.system_type)) + ASSERT(istext(world.system_type) && length(world.system_type)) From 4cb8cee8ead09e6e8b52d73f4700b55c8e6b8a07 Mon Sep 17 00:00:00 2001 From: ike709 Date: Fri, 15 Nov 2024 22:33:50 -0600 Subject: [PATCH 5/5] fix system_type not being a string --- DMCompiler/DMStandard/Defines.dm | 4 ++-- OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DMCompiler/DMStandard/Defines.dm b/DMCompiler/DMStandard/Defines.dm index fcd13bf77d..148660d34c 100644 --- a/DMCompiler/DMStandard/Defines.dm +++ b/DMCompiler/DMStandard/Defines.dm @@ -60,8 +60,8 @@ #define SYNC_STEPS 3 //world.system_type -#define UNIX 0 -#define MS_WINDOWS 1 +#define UNIX "UNIX" +#define MS_WINDOWS "MS_WINDOWS" //Icon blending functions #define ICON_ADD 0 diff --git a/OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs b/OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs index 2582437476..0dd50ac411 100644 --- a/OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs +++ b/OpenDreamRuntime/Objects/Types/DreamObjectWorld.cs @@ -214,9 +214,9 @@ protected override bool TryGetVar(string varName, out DreamValue value) { case "system_type": //system_type value should match the defines in Defines.dm if (Environment.OSVersion.Platform is PlatformID.Unix or PlatformID.MacOSX or PlatformID.Other) - value = new DreamValue(0); + value = new DreamValue("UNIX"); else - value = new DreamValue(1); //Windows + value = new DreamValue("MS_WINDOWS"); //Windows return true;