diff --git a/.github/workflows/conflict-labeler.yml b/.github/workflows/pr-labeler.yml similarity index 76% rename from .github/workflows/conflict-labeler.yml rename to .github/workflows/pr-labeler.yml index 060eb0985c..c0e5835bf4 100644 --- a/.github/workflows/conflict-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -16,3 +16,8 @@ jobs: dirtyLabel: "Merge Conflict" repoToken: "${{ secrets.GITHUB_TOKEN }}" commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request." + - name: Apply Size Label + uses: pascalgn/size-label-action@v0.5.0 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + diff --git a/.github/workflows/test-tgs.yml b/.github/workflows/test-tgs.yml index ba2195c21b..23bfd5f31a 100644 --- a/.github/workflows/test-tgs.yml +++ b/.github/workflows/test-tgs.yml @@ -14,7 +14,7 @@ env: OD_DOTNET_VERSION: 8 TGS_DOTNET_VERSION: 8 TGS_REFERENCE: dev - TGS_TEST_GITHUB_TOKEN: ${{ secrets.TGS_TEST_GITHUB_TOKEN }} + TGS_TEST_GITHUB_TOKEN: ${{ github.token }} jobs: build: diff --git a/Content.Tests/DMProject/Tests/Builtins/isnull.dm b/Content.Tests/DMProject/Tests/Builtins/isnull.dm new file mode 100644 index 0000000000..e46fed819a --- /dev/null +++ b/Content.Tests/DMProject/Tests/Builtins/isnull.dm @@ -0,0 +1,6 @@ +/proc/RunTest() + ASSERT(isnull(null)) + var/obj/O = new() + ASSERT(!isnull(O)) + del(O) + ASSERT(isnull(O)) \ No newline at end of file diff --git a/Content.Tests/DMProject/Tests/Procs/doublebracketlistarg.dm b/Content.Tests/DMProject/Tests/Procs/doublebracketlistarg.dm new file mode 100644 index 0000000000..cbf2865daa --- /dev/null +++ b/Content.Tests/DMProject/Tests/Procs/doublebracketlistarg.dm @@ -0,0 +1,10 @@ +/proc/have_fun(ways_to_have_fun[] = list("dancing", "jumping around", "sightseeing")) + return ways_to_have_fun[2] + +/proc/emptylistproc(emptylist[] = null) + return emptylist + +/proc/RunTest() + ASSERT(have_fun() == "jumping around") + ASSERT(have_fun(list("eating cake", "spinning")) == "spinning") + ASSERT(isnull(emptylistproc())) diff --git a/Content.Tests/DMProject/Tests/Text/num2text.dm b/Content.Tests/DMProject/Tests/Text/num2text.dm index 5bf7648627..1d5b311f39 100644 --- a/Content.Tests/DMProject/Tests/Text/num2text.dm +++ b/Content.Tests/DMProject/Tests/Text/num2text.dm @@ -19,4 +19,5 @@ // Zero/Negative MinDigits ASSERT(num2text(1, 0, 10) == "1") - ASSERT(num2text(1, -1, 10) == "1") \ No newline at end of file + ASSERT(num2text(1, -1, 10) == "1") + ASSERT(num2text(0, 0, 16) == "0") \ No newline at end of file diff --git a/DMCompiler/Compiler/DM/DMAST.cs b/DMCompiler/Compiler/DM/DMAST.cs index 971cd63230..faf4914cf9 100644 --- a/DMCompiler/Compiler/DM/DMAST.cs +++ b/DMCompiler/Compiler/DM/DMAST.cs @@ -1324,10 +1324,17 @@ public override void Visit(DMASTVisitor visitor) { } public bool AllValuesConstant() { - return Values.All(value => value is { - Key: DMASTExpressionConstant, - Value: DMASTExpressionConstant - }); + return Values.All( + value => (value is { + Key: DMASTExpressionConstant, + Value: DMASTExpressionConstant + }) + || + (value is { + Key: DMASTExpressionConstant, + Value: DMASTList valueList + } && valueList.AllValuesConstant()) + ); } } diff --git a/DMCompiler/Compiler/DM/DMParser.cs b/DMCompiler/Compiler/DM/DMParser.cs index ce7c4a96aa..fca532a14a 100644 --- a/DMCompiler/Compiler/DM/DMParser.cs +++ b/DMCompiler/Compiler/DM/DMParser.cs @@ -1654,6 +1654,11 @@ public List DefinitionParameters(out bool wasIndetermi DMASTExpression? value = PathArray(ref path.Path); DMASTExpression? possibleValues = null; + if (Check(TokenType.DM_DoubleSquareBracketEquals)) { + Whitespace(); + value = Expression(); + } + if (Check(TokenType.DM_Equals)) { Whitespace(); value = Expression(); diff --git a/OpenDreamClient/Interface/DreamInterfaceManager.cs b/OpenDreamClient/Interface/DreamInterfaceManager.cs index c66cd43445..17098ab18e 100644 --- a/OpenDreamClient/Interface/DreamInterfaceManager.cs +++ b/OpenDreamClient/Interface/DreamInterfaceManager.cs @@ -324,6 +324,9 @@ public void FrameUpdate(FrameEventArgs frameEventArgs) { } else if (Menus.TryGetValue(windowId, out var menu)) { if (menu.MenuElements.TryGetValue(elementId, out var menuElement)) return menuElement; + } else if(MacroSets.TryGetValue(windowId, out var macroSet)) { + if (macroSet.Macros.TryGetValue(elementId, out var macroElement)) + return macroElement; } if (window != null) { @@ -436,7 +439,7 @@ public void RunCommand(string fullCommand) { return; if (args.Length == 1) { // No args given; Let the verb system handle the possible prompting - verbSystem.ExecuteVerb(ClientObjectReference.Client, verbId); + verbSystem.ExecuteVerb(verbSrc, verbId); } else { // Attempt to parse the given arguments if (args.Length != verbInfo.Arguments.Length + 1) { _sawmill.Error( @@ -464,7 +467,7 @@ public void RunCommand(string fullCommand) { } } - verbSystem.ExecuteVerb(ClientObjectReference.Client, verbId, arguments); + verbSystem.ExecuteVerb(verbSrc, verbId, arguments); } break; diff --git a/OpenDreamRuntime/DreamValue.cs b/OpenDreamRuntime/DreamValue.cs index 43ca2e9b03..23a18b9729 100644 --- a/OpenDreamRuntime/DreamValue.cs +++ b/OpenDreamRuntime/DreamValue.cs @@ -108,7 +108,7 @@ public DreamValue(IconAppearance appearance) { public bool IsNull { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => Type == DreamValueType.DreamObject && _refValue == null; + get => Type == DreamValueType.DreamObject && (_refValue == null || Unsafe.As(_refValue).Deleted); } private DreamValue(DreamValueType type, object refValue) { diff --git a/OpenDreamRuntime/Objects/DreamIcon.cs b/OpenDreamRuntime/Objects/DreamIcon.cs index e491281f42..609ea3fd11 100644 --- a/OpenDreamRuntime/Objects/DreamIcon.cs +++ b/OpenDreamRuntime/Objects/DreamIcon.cs @@ -83,6 +83,9 @@ public IconResource GenerateDMI() { if (_cachedDMI != null) return _cachedDMI; + if(Width == 0 && Height == 0) + Width = Height = 32; //TODO should be world.icon_size + int frameCount = FrameCount; int frameWidth = Width, frameHeight = Height; diff --git a/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs b/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs index 08e096cf73..d43b5fae09 100644 --- a/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs +++ b/OpenDreamRuntime/Procs/DMOpcodeHandlers.cs @@ -1735,7 +1735,7 @@ public static ProcStatus GetStep(DMProcState state) { return ProcStatus.Continue; } - var dir = d.MustGetValueAsInteger(); + var dir = d.IsNull ? 0 : d.MustGetValueAsInteger(); state.Push(new(DreamProcNativeHelpers.GetStep(state.Proc.AtomManager, state.Proc.DreamMapManager, loc, (AtomDirection)dir))); return ProcStatus.Continue; @@ -1930,8 +1930,7 @@ public static ProcStatus PickWeighted(DMProcState state) { DreamValue value = state.Pop(); if (!state.Pop().TryGetValueAsFloat(out var weight)) { - // Breaking change, no clue what weight BYOND is giving to non-nums - throw new Exception($"pick() weight '{weight}' is not a number"); + weight = 100; } totalWeight += weight; diff --git a/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs b/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs index cd6e7b1686..65b8caba9a 100644 --- a/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs +++ b/OpenDreamRuntime/Procs/Native/DreamProcNativeRoot.cs @@ -1566,7 +1566,7 @@ public static DreamValue NativeProc_num2text(NativeProc.Bundle bundle, DreamObje } if(bundle.Arguments.Length == 3) { - var digits = Math.Max(bundle.GetArgument(1, "A").MustGetValueAsInteger(), 0); + var digits = Math.Max(bundle.GetArgument(1, "A").MustGetValueAsInteger(), 1); var radix = bundle.GetArgument(2, "B").MustGetValueAsInteger(); var intNum = (int)floatNum; diff --git a/OpenDreamShared/Dream/VerbSystem.cs b/OpenDreamShared/Dream/VerbSystem.cs index 9063791c3b..300feb84be 100644 --- a/OpenDreamShared/Dream/VerbSystem.cs +++ b/OpenDreamShared/Dream/VerbSystem.cs @@ -51,7 +51,7 @@ public string GetCategoryOrDefault(string defaultCategory) => // TODO: Hidden verbs probably shouldn't be sent to the client in the first place? public bool IsHidden(bool ignoreHiddenAttr, sbyte seeInvisibility) => - (!ignoreHiddenAttr && HiddenAttribute) || Name.StartsWith('.') || seeInvisibility < Invisibility; + (!ignoreHiddenAttr && (HiddenAttribute || Name.StartsWith('.'))) || seeInvisibility < Invisibility; public override string ToString() => GetCommandName(); } diff --git a/README.md b/README.md index 03a40d1626..d9485eacd2 100644 --- a/README.md +++ b/README.md @@ -8,27 +8,29 @@ All parts of OpenDream should work fine on Windows and Linux, though the latter For more information or if you'd like to contribute, join our [Discord server](https://discord.gg/qreryhZxxs). -A detailed description of differences with BYOND can be found [here](https://github.com/wixoaGit/OpenDream/wiki/Differences-Between-OpenDream-and-BYOND). **Note that OpenDream cannot connect to BYOND servers, and BYOND's client cannot connect to OpenDream servers.** There is no cross-project compatibility other than being able to migrate from BYOND to OpenDream with minimal effort. +A detailed description of differences with BYOND can be found [here](https://github.com/OpenDreamProject/OpenDream/wiki/Differences-Between-OpenDream-and-BYOND). **Note that OpenDream cannot connect to BYOND servers, and BYOND's client cannot connect to OpenDream servers.** There is no cross-project compatibility other than being able to migrate from BYOND to OpenDream with minimal effort. -## Building +## Running -The first step to building OpenDream is initializing the submodule for the game engine, [Robust Toolbox](https://github.com/space-wizards/RobustToolbox). +Binaries are available for download under our [Releases](https://github.com/OpenDreamProject/OpenDream/releases/tag/latest). If you would rather build from source, see [Building](#building). -To do this, simply run `git submodule update --init --recursive` in git bash and let it finish. +There's 3 main parts: Compiler, Server, and Client: -**OpenDream requires .NET 8.** You can check your version by running `dotnet --version`. It should be at least `8.0.0`. +**Compiler:** Run `DMCompiler.exe`, and pass any number of .dm or .dme files to compile as arguments. Optional arguments can be found [here](https://github.com/OpenDreamProject/OpenDream/wiki/Compiler-Options). -To build, one can use a C# compiler (such as MSBuild) to compile the various projects described in the solution. +**Server:** Run `Robust.Server.exe` (`OpenDreamServer.exe` if built from source) and pass the compiled JSON file you got as a result of running the compiler above as an argument like this: `Robust.Server.exe C:/path/to/compiler/output.json` -There's 3 main parts: Compiler, Server, and Client +**Client:** This is only applicable if you built from source, otherwise connect from the [SS14 launcher](https://spacestation14.io/about/nightlies/). Run `OpenDreamClient.exe`. You will be prompted to choose a server address, port, and username. The defaults should work for a locally hosted server. -## Running +## Building + +The first step to building OpenDream is initializing the submodule for the game engine, [Robust Toolbox](https://github.com/space-wizards/RobustToolbox). -**Compiler:** Run `DMCompiler.exe`, and pass any number of .dm or .dme files to compile as arguments. Optional arguments can be found [here](https://github.com/wixoaGit/OpenDream/wiki/Compiler-Options). +To do this, simply run `git submodule update --init --recursive` in git bash and let it finish. -**Server:** Run `OpenDreamServer.exe` and pass the compiled JSON file you got as a result of running the compiler above as an argument like this: `OpenDreamServer.exe C:/path/to/compiler/output.json` +**OpenDream requires .NET 8.** You can check your version by running `dotnet --version`. It should be at least `8.0.0`. -**Client:** Run `OpenDreamClient.exe`. You will be prompted to choose a server address, port, and username. The defaults should work for a locally hosted server. +To build, one can use a C# compiler (such as MSBuild) to compile the various projects described in the solution. ## Screenshots The following screenshots are taken from a version of Paradise Station with a recompiled 64-bit rustg DLL. This branch of Paradise is available [here](https://github.com/ike709/Paradise/tree/rustg_64).