From f500784bc39ea2d6ca22e721e5504dca03a28306 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Tue, 10 Oct 2023 16:45:56 +0100 Subject: [PATCH] Some extra overloads for API methods --- .../API/Lua/Wrappers/Path2dApiWrapper.cs | 19 ++++++++++++++++++- .../API/Lua/Wrappers/TransformApiWrapper.cs | 18 ++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/API/Lua/Wrappers/Path2dApiWrapper.cs b/Assets/Scripts/API/Lua/Wrappers/Path2dApiWrapper.cs index 54bf6d6d80..040a2d5eb0 100644 --- a/Assets/Scripts/API/Lua/Wrappers/Path2dApiWrapper.cs +++ b/Assets/Scripts/API/Lua/Wrappers/Path2dApiWrapper.cs @@ -123,7 +123,24 @@ public void TransformBy(TrTransform transform) public void RotateBy(Quaternion amount) => TransformBy(TrTransform.R(amount)); [LuaDocsDescription("Scales the path")] - [LuaDocsExample("myPath:ScaleBy(Vector2:New(2, 1)")] + [LuaDocsExample("myPath:ScaleBy(2)")] + [LuaDocsParameter("scale", "The scaling factor to apply to the path")] + public void ScaleBy(float scale) + { + ScaleBy(new Vector2(scale, scale)); + } + + [LuaDocsDescription("Scales the path")] + [LuaDocsExample("myPath:ScaleBy(2, 1)")] + [LuaDocsParameter("x", "The x scaling factor to apply to the path")] + [LuaDocsParameter("y", "The y scaling factor to apply to the path")] + public void ScaleBy(float x, float y) + { + ScaleBy(new Vector2(x, y)); + } + + [LuaDocsDescription("Scales the path")] + [LuaDocsExample("myPath:ScaleBy(myVector2")] [LuaDocsParameter("scale", "The scaling factor to apply to the path")] public void ScaleBy(Vector2 scale) { diff --git a/Assets/Scripts/API/Lua/Wrappers/TransformApiWrapper.cs b/Assets/Scripts/API/Lua/Wrappers/TransformApiWrapper.cs index 52a57f60e4..cdc426bfd8 100644 --- a/Assets/Scripts/API/Lua/Wrappers/TransformApiWrapper.cs +++ b/Assets/Scripts/API/Lua/Wrappers/TransformApiWrapper.cs @@ -47,15 +47,29 @@ public TransformApiWrapper(Vector3 translation, float scale = 1) public TrTransform TransformBy(TrTransform transform) => _TrTransform * transform; [LuaDocsDescription("Applies a translation to this transform")] - [LuaDocsExample("newTransform = myTransform:TranslateBy(Vector3(1, 2, 3))")] + [LuaDocsExample("newTransform = myTransform:TranslateBy(Vector3.up * 3)")] [LuaDocsParameter("translation", "The translation to apply")] public TrTransform TranslateBy(Vector3 translation) => _TrTransform * TrTransform.T(translation); + [LuaDocsDescription("Applies a translation to this transform")] + [LuaDocsExample("newTransform = myTransform:TranslateBy(1, 2, 3)")] + [LuaDocsParameter("x", "The x translation to apply")] + [LuaDocsParameter("y", "The y translation to apply")] + [LuaDocsParameter("z", "The z translation to apply")] + public TrTransform TranslateBy(float x, float y, float z) => TranslateBy(new Vector3(x, y, z)); + [LuaDocsDescription("Applies a rotation to this transform")] - [LuaDocsExample("newTransform = myTransform:RotateBy(Rotation.New(0, 45, 0))")] + [LuaDocsExample("newTransform = myTransform:RotateBy(Rotation.left)")] [LuaDocsParameter("rotation", "The rotation to apply")] public TrTransform RotateBy(Quaternion rotation) => _TrTransform * TrTransform.R(rotation); + [LuaDocsDescription("Applies a rotation to this transform")] + [LuaDocsExample("newTransform = myTransform:RotateBy(45, 0, 0)")] + [LuaDocsParameter("x", "The x rotation to apply")] + [LuaDocsParameter("y", "The y rotation to apply")] + [LuaDocsParameter("z", "The z rotation to apply")] + public TrTransform RotateBy(float x, float y, float z) => RotateBy(Quaternion.Euler(x, y, z)); + [LuaDocsDescription("Applies a scale to this transform")] [LuaDocsExample("newTransform = myTransform:ScaleBy(2)")] [LuaDocsParameter("scale", "The scale value to apply")]