From 8e333e1dc6edd108e4c3f78717a1fd7e1906b8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artem=20Ko=C5=A1ilinskis?= <46756889+ITeMbI4@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:51:53 +0200 Subject: [PATCH] Actual fix for (#2716) --- Exiled.API/Features/Toys/AdminToy.cs | 8 ++++---- Exiled.API/Features/Toys/Primitive.cs | 23 ++++++++++++----------- Exiled.API/Structs/PrimitiveSettings.cs | 6 +++--- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index 08ec644cf0..eb0fca40d8 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -70,8 +70,8 @@ public Footprint Footprint /// public new Vector3 Position { - get => AdminToyBase.Position; - set => AdminToyBase.Position = value; + get => AdminToyBase.transform.position; + set => AdminToyBase.transform.position = value; } /// @@ -79,8 +79,8 @@ public Footprint Footprint /// public Vector3 Scale { - get => AdminToyBase.Scale; - set => AdminToyBase.Scale = value; + get => AdminToyBase.transform.localScale; + set => AdminToyBase.transform.localScale = value; } /// diff --git a/Exiled.API/Features/Toys/Primitive.cs b/Exiled.API/Features/Toys/Primitive.cs index 149dbc990d..895916782d 100644 --- a/Exiled.API/Features/Toys/Primitive.cs +++ b/Exiled.API/Features/Toys/Primitive.cs @@ -102,8 +102,8 @@ public PrimitiveFlags Flags /// Whether or not the primitive is static. /// Whether or not the primitive should be spawned. /// The newly created . - public static Primitive Create(PrimitiveType primitiveType, PrimitiveFlags flags = default, Color? color = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool isStatic = false, bool spawn = true) - => Create(new(primitiveType, color, position, flags, rotation, scale, isStatic, spawn)); + public static Primitive Create(PrimitiveType primitiveType, PrimitiveFlags flags = PrimitiveFlags.Visible | PrimitiveFlags.Collidable, Color? color = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool isStatic = false, bool spawn = true) + => Create(new(primitiveType, flags, color, position, rotation, scale, isStatic, spawn)); /// /// Creates a new . @@ -112,15 +112,16 @@ public static Primitive Create(PrimitiveType primitiveType, PrimitiveFlags flags /// The new . public static Primitive Create(PrimitiveSettings primitiveSettings) { - Primitive primitive = new(Object.Instantiate(PrefabObject.GetComponent())); - - primitive.Base.NetworkPrimitiveType = primitiveSettings.PrimitiveType; - primitive.AdminToyBase.transform.position = primitiveSettings.Position; - primitive.AdminToyBase.transform.rotation = primitiveSettings.Rotation; - primitive.AdminToyBase.transform.localScale = primitiveSettings.Scale; - primitive.Flags = primitiveSettings.Flags; - primitive.Color = primitiveSettings.Color; - primitive.IsStatic = primitiveSettings.IsStatic; + Primitive primitive = new(Object.Instantiate(PrefabObject.GetComponent())) + { + Type = primitiveSettings.PrimitiveType, + Flags = primitiveSettings.Flags, + Color = primitiveSettings.Color, + Position = primitiveSettings.Position, + Rotation = primitiveSettings.Rotation, + Scale = primitiveSettings.Scale, + IsStatic = primitiveSettings.IsStatic, + }; if (primitiveSettings.ShouldSpawn) primitive.Spawn(); diff --git a/Exiled.API/Structs/PrimitiveSettings.cs b/Exiled.API/Structs/PrimitiveSettings.cs index ef11c63575..c6684fd7dc 100644 --- a/Exiled.API/Structs/PrimitiveSettings.cs +++ b/Exiled.API/Structs/PrimitiveSettings.cs @@ -27,12 +27,12 @@ public struct PrimitiveSettings /// The scale of the primitive. /// Whether or not the primitive should be spawned. /// Whether or not the primitive should be static. - public PrimitiveSettings(PrimitiveType primitiveType, Color? color, Vector3? position, PrimitiveFlags flags = PrimitiveFlags.Visible | PrimitiveFlags.Collidable, Quaternion? rotation = null, Vector3? scale = null, bool isStatic = false, bool spawn = true) + public PrimitiveSettings(PrimitiveType primitiveType, PrimitiveFlags flags = PrimitiveFlags.Visible | PrimitiveFlags.Collidable, Color? color = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, bool isStatic = false, bool spawn = true) { - PrimitiveType = primitiveType; + PrimitiveType = primitiveType; + Flags = flags; Color = color ?? Color.gray; Position = position ?? Vector3.one; - Flags = flags; Rotation = rotation ?? Quaternion.identity; Scale = scale ?? Vector3.one; IsStatic = isStatic;