-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fast_world_contents
- Loading branch information
Showing
31 changed files
with
373 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/proc/RunTest() | ||
ASSERT(arctan(0) == 0) | ||
ASSERT(arctan(1) == 45) | ||
ASSERT(arctan(sqrt(3)) == 60) | ||
ASSERT(round(arctan(3, 4)) == round(53.1301)) //that float precision tho | ||
ASSERT(arctan(-1, 1) == 135) | ||
ASSERT(arctan(0, -5) == -90) |
39 changes: 39 additions & 0 deletions
39
Content.Tests/DMProject/Tests/Text/StringInterpolation9.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/datum/thing | ||
var/name = "thing" | ||
|
||
/datum/Thing | ||
var/name = "Thing" | ||
|
||
/datum/proper_thing | ||
var/name = "\proper thing" | ||
|
||
/datum/plural_things | ||
var/name = "things" | ||
var/gender = PLURAL | ||
|
||
/proc/RunTest() | ||
// Lowercase \a on datums | ||
ASSERT("\a [new /datum/thing]" == "a thing") | ||
ASSERT("\a [new /datum/Thing]" == "Thing") | ||
ASSERT("\a [new /datum/proper_thing]" == "thing") | ||
ASSERT("\a [new /datum/plural_things]" == "some things") | ||
|
||
// Uppercase \A on datums | ||
ASSERT("\A [new /datum/thing]" == "A thing") | ||
ASSERT("\A [new /datum/Thing]" == "Thing") | ||
ASSERT("\A [new /datum/proper_thing]" == "thing") | ||
ASSERT("\A [new /datum/plural_things]" == "Some things") | ||
|
||
// Lowercase \a on strings | ||
ASSERT("\a ["thing"]" == "a thing") | ||
ASSERT("\a ["Thing"]" == "Thing") | ||
ASSERT("\a ["\proper thing"]" == "thing") | ||
|
||
// Uppercase \A on strings | ||
ASSERT("\A ["thing"]" == "A thing") | ||
ASSERT("\A ["Thing"]" == "Thing") | ||
ASSERT("\A ["\proper thing"]" == "thing") | ||
|
||
// Invalid \a | ||
ASSERT("\a [123]" == "") | ||
ASSERT("\A [123]" == "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/proc/RunTest() | ||
ASSERT(findlasttext("abcdefg", "f", 0, -1) == 0) | ||
ASSERT(findlasttext("abcdefg", "f", 0, -2) == 6) | ||
ASSERT(findlasttext("abcdefg", "f", 6) == 6) | ||
ASSERT(findlasttext("abcdefg", "f", 5) == 0) | ||
ASSERT(findlasttext("abcdefg", "bc", 2) == 2) | ||
ASSERT(findlasttext("abcdefg", "ab", 10) == 1) | ||
ASSERT(findlasttext("abcdefg", "f", 5) == 0) | ||
ASSERT(findlasttext("Banana", "na", -3) == 3) | ||
ASSERT(findlasttext("Banana", "na", -5) == 0) | ||
ASSERT(findlasttext("Banana", "na", 0) == 5) | ||
ASSERT(findlasttext("Banana", "na", 3) == 3) | ||
ASSERT(findlasttext("Banana", "na", 2) == 0) | ||
ASSERT(findlasttext("Banana", "na", 5) == 5) | ||
ASSERT(findlasttext("Banana", "na", 50) == 5) | ||
ASSERT(findlasttext("Banana", "na", -50) == 0) | ||
ASSERT(findlasttext("abcdefg", "f", 6, -50) == 6) | ||
ASSERT(findlasttext("abcdefg", "f", 6, 50) == 0) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using OpenDreamClient.Input; | ||
using OpenDreamClient.Interface.Prompts; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Shared.Console; | ||
|
||
namespace OpenDreamClient.Interface.DebugWindows; | ||
|
||
/// <summary> | ||
/// A debug window that displays all the current macro sets and allows you to execute them | ||
/// </summary> | ||
public sealed class MacrosWindow : OSWindow { | ||
[Dependency] private readonly IDreamInterfaceManager _interfaceManager = default!; | ||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; | ||
private readonly DreamCommandSystem _commandSystem; | ||
|
||
public MacrosWindow() { | ||
IoCManager.InjectDependencies(this); | ||
_commandSystem = _entitySystemManager.GetEntitySystem<DreamCommandSystem>(); | ||
|
||
Title = "Macros"; | ||
SizeToContent = WindowSizeToContent.WidthAndHeight; | ||
|
||
var tabs = new TabContainer(); | ||
|
||
foreach (var macroSet in _interfaceManager.MacroSets.Values) { | ||
var isCurrent = (macroSet == _interfaceManager.DefaultWindow?.Macro); | ||
var tabName = macroSet.Id; | ||
if (isCurrent) | ||
tabName += " (Current)"; | ||
|
||
var macroTable = CreateMacroTable(macroSet); | ||
TabContainer.SetTabTitle(macroTable, tabName); | ||
tabs.AddChild(macroTable); | ||
|
||
if (isCurrent) | ||
tabs.CurrentTab = tabs.ChildCount - 1; | ||
} | ||
|
||
AddChild(tabs); | ||
} | ||
|
||
private GridContainer CreateMacroTable(InterfaceMacroSet macroSet) { | ||
var macroTable = new GridContainer { | ||
Columns = 3, | ||
Margin = new(5) | ||
}; | ||
|
||
foreach (var macro in macroSet.Macros.Values) { | ||
var idText = macro.Id; | ||
if (macro.ElementDescriptor.Name != idText) | ||
idText += $" ({macro.ElementDescriptor.Name})"; | ||
|
||
var idLabel = new Label { Text = idText }; | ||
var commandLabel = new Label { Text = macro.Command }; | ||
var executeButton = new Button { Text = "Execute" }; | ||
|
||
executeButton.OnPressed += _ => { | ||
if (macro.Command.Contains("[[*]]")) { | ||
var prompt = new TextPrompt("Key", "What key?", string.Empty, true, (_, value) => { | ||
if (value == null) | ||
return; // Cancelled | ||
|
||
_commandSystem.RunCommand(macro.Command.Replace("[[*]]", (string)value)); | ||
}); | ||
|
||
prompt.Owner = ClydeWindow; | ||
prompt.Show(); | ||
} else { | ||
_commandSystem.RunCommand(macro.Command); | ||
} | ||
}; | ||
|
||
macroTable.AddChild(idLabel); | ||
macroTable.AddChild(commandLabel); | ||
macroTable.AddChild(executeButton); | ||
} | ||
|
||
return macroTable; | ||
} | ||
} | ||
|
||
public sealed class ShowMacrosCommand : IConsoleCommand { | ||
// ReSharper disable once StringLiteralTypo | ||
public string Command => "showmacros"; | ||
public string Description => "Display the current macro sets"; | ||
public string Help => ""; | ||
|
||
public void Execute(IConsoleShell shell, string argStr, string[] args) { | ||
if (args.Length != 0) { | ||
shell.WriteError("This command does not take any arguments!"); | ||
return; | ||
} | ||
|
||
new MacrosWindow().Show(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.