diff --git a/EXILED/Exiled.API/Features/Items/Firearm.cs b/EXILED/Exiled.API/Features/Items/Firearm.cs index 554ccc3c6d..e98be9f956 100644 --- a/EXILED/Exiled.API/Features/Items/Firearm.cs +++ b/EXILED/Exiled.API/Features/Items/Firearm.cs @@ -391,16 +391,6 @@ public void RemoveAttachment(IEnumerable attachmentSlots) /// public void ClearAttachments() => Base.ApplyAttachmentsCode(BaseCode, true); - /// - /// Creates the that based on this . - /// - /// The location to spawn the item. - /// The rotation of the item. - /// Whether the should be initially spawned. - /// The created . - public override Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true) - => base.CreatePickup(position, rotation, spawn); // TODO: Deleted this overide - /// /// Gets a of the specified . /// diff --git a/EXILED/Exiled.API/Features/Items/Item.cs b/EXILED/Exiled.API/Features/Items/Item.cs index 7cff7ab1e4..8b88942a12 100644 --- a/EXILED/Exiled.API/Features/Items/Item.cs +++ b/EXILED/Exiled.API/Features/Items/Item.cs @@ -361,11 +361,11 @@ public static Item Create(ItemType type, Player owner = null) /// The rotation of the item. /// Whether the should be initially spawned. /// The created . - public virtual Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true) + public virtual Pickup CreatePickup(Vector3 position, Quaternion? rotation = null, bool spawn = true) { PickupSyncInfo info = new(Type, Weight, Serial); - ItemPickupBase ipb = InventoryExtensions.ServerCreatePickup(Base, info, position, rotation); + ItemPickupBase ipb = InventoryExtensions.ServerCreatePickup(Base, info, position, rotation ?? Quaternion.identity); Base.OnRemoved(ipb); diff --git a/EXILED/Exiled.API/Features/Items/Scp244.cs b/EXILED/Exiled.API/Features/Items/Scp244.cs index 1ed62113c8..0cfea6c3ae 100644 --- a/EXILED/Exiled.API/Features/Items/Scp244.cs +++ b/EXILED/Exiled.API/Features/Items/Scp244.cs @@ -82,11 +82,11 @@ public bool Primed /// The rotation of the item. /// Whether the should be initially spawned. /// The created . - public override Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true) + public override Pickup CreatePickup(Vector3 position, Quaternion? rotation = null, bool spawn = true) { PickupSyncInfo info = new(Type, Weight, Serial); - Scp244DeployablePickup ipb = (Scp244DeployablePickup)InventoryExtensions.ServerCreatePickup(Base, info, position, rotation); + Scp244DeployablePickup ipb = (Scp244DeployablePickup)InventoryExtensions.ServerCreatePickup(Base, info, position, rotation ?? Quaternion.identity); Base.OnRemoved(ipb); diff --git a/EXILED/Exiled.API/Features/Items/Scp330.cs b/EXILED/Exiled.API/Features/Items/Scp330.cs index f31bfcf25a..38c9ded765 100644 --- a/EXILED/Exiled.API/Features/Items/Scp330.cs +++ b/EXILED/Exiled.API/Features/Items/Scp330.cs @@ -240,11 +240,11 @@ public IEnumerable DropCandy(CandyKindID type, bool dropAll = fals /// The rotation to give the item. /// Whether the should be initially spawned. /// The created . - public override Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true) + public override Pickup CreatePickup(Vector3 position, Quaternion? rotation = null, bool spawn = true) { PickupSyncInfo info = new(Type, Weight, Serial); - InventorySystem.Items.Usables.Scp330.Scp330Pickup ipb = (InventorySystem.Items.Usables.Scp330.Scp330Pickup)InventoryExtensions.ServerCreatePickup(Base, info, position, rotation); + InventorySystem.Items.Usables.Scp330.Scp330Pickup ipb = (InventorySystem.Items.Usables.Scp330.Scp330Pickup)InventoryExtensions.ServerCreatePickup(Base, info, position, rotation ?? Quaternion.identity); Base.OnRemoved(ipb); diff --git a/EXILED/Exiled.API/Features/Items/Usable.cs b/EXILED/Exiled.API/Features/Items/Usable.cs index fe07f3c24d..6ba68e2cb0 100644 --- a/EXILED/Exiled.API/Features/Items/Usable.cs +++ b/EXILED/Exiled.API/Features/Items/Usable.cs @@ -109,11 +109,11 @@ public float RemainingCooldown /// The rotation of the item. /// Whether the should be initially spawned. /// The created . - public override Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true) + public override Pickup CreatePickup(Vector3 position, Quaternion? rotation = null, bool spawn = true) { PickupSyncInfo info = new(Type, Weight, Serial); - ItemPickupBase ipb = InventoryExtensions.ServerCreatePickup(Base, info, position, rotation); + ItemPickupBase ipb = InventoryExtensions.ServerCreatePickup(Base, info, position, rotation ?? Quaternion.identity); Pickup pickup = Pickup.Get(ipb); diff --git a/EXILED/Exiled.API/Features/Pickups/Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Pickup.cs index 2deb4f4845..047958be7a 100644 --- a/EXILED/Exiled.API/Features/Pickups/Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Pickup.cs @@ -237,7 +237,7 @@ public PickupSyncInfo Info /// /// Gets or sets the previous owner of this item. /// - /// + /// public Player PreviousOwner { get => Player.Get(Base.PreviousOwner.Hub); @@ -260,7 +260,7 @@ public bool InUse /// /// Gets or sets the pickup position. /// - /// + /// public Vector3 Position { get => Base.Position; @@ -279,7 +279,7 @@ public RelativePosition RelativePosition /// /// Gets or sets the pickup rotation. /// - /// + /// public Quaternion Rotation { get => Base.Rotation; @@ -532,8 +532,8 @@ public static Pickup Create(ItemType type) /// The rotation to spawn the . /// An optional previous owner of the item. /// The . See documentation of for more information on casting. - /// - public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion rotation, Player previousOwner = null) => Create(type).Spawn(position, rotation, previousOwner); + /// + public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null) => Create(type).Spawn(position, rotation, previousOwner); /// /// Creates and spawns a . @@ -544,8 +544,8 @@ public static Pickup Create(ItemType type) /// An optional previous owner of the item. /// The specified type. /// The . See documentation of for more information on casting. - /// - public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion rotation, Player previousOwner = null) + /// + public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null) where T : Pickup => CreateAndSpawn(type, position, rotation, previousOwner) as T; /// @@ -588,11 +588,11 @@ public void Spawn() /// The rotation to spawn the . /// An optional previous owner of the item. /// The spawned . - /// - public Pickup Spawn(Vector3 position, Quaternion rotation, Player previousOwner = null) + /// + public Pickup Spawn(Vector3 position, Quaternion? rotation = null, Player previousOwner = null) { Position = position; - Rotation = rotation; + Rotation = rotation ?? Quaternion.identity; PreviousOwner = previousOwner; Spawn(); diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs index fa78c214ea..17a0691b97 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs @@ -123,7 +123,7 @@ public static Projectile Create(ProjectileType projectiletype) /// Whether the should be in active state after spawn. /// An optional previous owner of the item. /// The . See documentation of for more information on casting. - public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion rotation, bool shouldBeActive = true, Player previousOwner = null) => Create(type).Spawn(position, rotation, shouldBeActive, previousOwner); + public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) => Create(type).Spawn(position, rotation, shouldBeActive, previousOwner); /// /// Creates and spawns a . @@ -135,7 +135,7 @@ public static Projectile Create(ProjectileType projectiletype) /// An optional previous owner of the item. /// The specified type. /// The . See documentation of for more information on casting. - public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion rotation, bool shouldBeActive = true, Player previousOwner = null) + public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) where T : Projectile => CreateAndSpawn(type, position, rotation, shouldBeActive, previousOwner) as T; /// @@ -151,10 +151,10 @@ public static Projectile CreateAndSpawn(ProjectileType type, Vector3 position /// Whether the should be in active state after spawn. /// An optional previous owner of the item. /// The spawned . - public Projectile Spawn(Vector3 position, Quaternion rotation, bool shouldBeActive = true, Player previousOwner = null) + public Projectile Spawn(Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null) { Position = position; - Rotation = rotation; + Rotation = rotation ?? Quaternion.identity; PreviousOwner = previousOwner; Spawn(); diff --git a/EXILED/Exiled.API/Features/PrefabHelper.cs b/EXILED/Exiled.API/Features/PrefabHelper.cs index c80d2ab206..82180ac9a6 100644 --- a/EXILED/Exiled.API/Features/PrefabHelper.cs +++ b/EXILED/Exiled.API/Features/PrefabHelper.cs @@ -89,12 +89,12 @@ public static T GetPrefab(PrefabType prefabType) /// The position where the will spawn. /// The rotation of the . /// Returns the instantied. - public static GameObject Spawn(PrefabType prefabType, Vector3 position = default, Quaternion rotation = default) + public static GameObject Spawn(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null) { if (!TryGetPrefab(prefabType, out GameObject gameObject)) return null; - GameObject newGameObject = UnityEngine.Object.Instantiate(gameObject, position, rotation); + GameObject newGameObject = UnityEngine.Object.Instantiate(gameObject, position, rotation ?? Quaternion.identity); NetworkServer.Spawn(newGameObject); return newGameObject; } @@ -107,7 +107,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default /// The rotation of the . /// The type. /// Returns the of the . - public static T Spawn(PrefabType prefabType, Vector3 position = default, Quaternion rotation = default) + public static T Spawn(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null) where T : Component { GameObject gameObject = Spawn(prefabType, position, rotation); diff --git a/EXILED/Exiled.API/Features/Ragdoll.cs b/EXILED/Exiled.API/Features/Ragdoll.cs index bb0a83f6d8..8cde5d8cb2 100644 --- a/EXILED/Exiled.API/Features/Ragdoll.cs +++ b/EXILED/Exiled.API/Features/Ragdoll.cs @@ -358,8 +358,8 @@ public static Ragdoll CreateAndSpawn(RagdollData networkInfo) /// The rotation of the ragdoll. /// The optional owner of the ragdoll. /// The ragdoll. - public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, DamageHandlerBase damageHandler, Vector3 position, Quaternion rotation, Player owner = null) - => CreateAndSpawn(new(owner?.ReferenceHub ?? Server.Host.ReferenceHub, damageHandler, roleType, position, rotation, name, NetworkTime.time)); + public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, DamageHandlerBase damageHandler, Vector3 position, Quaternion? rotation = null, Player owner = null) + => CreateAndSpawn(new(owner?.ReferenceHub ?? Server.Host.ReferenceHub, damageHandler, roleType, position, rotation ?? Quaternion.identity, name, NetworkTime.time)); /// /// Creates and spawns a new ragdoll. @@ -371,7 +371,7 @@ public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, DamageHan /// The rotation of the ragdoll. /// The optional owner of the ragdoll. /// The ragdoll. - public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, string deathReason, Vector3 position, Quaternion rotation, Player owner = null) + public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, string deathReason, Vector3 position, Quaternion? rotation = null, Player owner = null) => CreateAndSpawn(roleType, name, new CustomReasonDamageHandler(deathReason), position, rotation, owner); ///