Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions EXILED/Exiled.API/Features/Items/Firearm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,6 @@ public void RemoveAttachment(IEnumerable<AttachmentSlot> attachmentSlots)
/// </summary>
public void ClearAttachments() => Base.ApplyAttachmentsCode(BaseCode, true);

/// <summary>
/// Creates the <see cref="Pickup"/> that based on this <see cref="Item"/>.
/// </summary>
/// <param name="position">The location to spawn the item.</param>
/// <param name="rotation">The rotation of the item.</param>
/// <param name="spawn">Whether the <see cref="Pickup"/> should be initially spawned.</param>
/// <returns>The created <see cref="Pickup"/>.</returns>
public override Pickup CreatePickup(Vector3 position, Quaternion rotation = default, bool spawn = true)
=> base.CreatePickup(position, rotation, spawn); // TODO: Deleted this overide

/// <summary>
/// Gets a <see cref="Attachment"/> of the specified <see cref="AttachmentIdentifier"/>.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ public static Item Create<T>(ItemType type, Player owner = null)
/// <param name="rotation">The rotation of the item.</param>
/// <param name="spawn">Whether the <see cref="Pickup"/> should be initially spawned.</param>
/// <returns>The created <see cref="Pickup"/>.</returns>
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);

Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Items/Scp244.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public bool Primed
/// <param name="rotation">The rotation of the item.</param>
/// <param name="spawn">Whether the <see cref="Pickup"/> should be initially spawned.</param>
/// <returns>The created <see cref="Pickup"/>.</returns>
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);

Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Items/Scp330.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ public IEnumerable<Scp330Pickup> DropCandy(CandyKindID type, bool dropAll = fals
/// <param name="rotation">The <see cref="Quaternion"/> rotation to give the item.</param>
/// <param name="spawn">Whether the <see cref="Scp330Pickup"/> should be initially spawned.</param>
/// <returns>The created <see cref="Pickup"/>.</returns>
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);

Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Items/Usable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ public float RemainingCooldown
/// <param name="rotation">The rotation of the item.</param>
/// <param name="spawn">Whether the <see cref="Pickup"/> should be initially spawned.</param>
/// <returns>The created <see cref="Pickup"/>.</returns>
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);

Expand Down
20 changes: 10 additions & 10 deletions EXILED/Exiled.API/Features/Pickups/Pickup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public PickupSyncInfo Info
/// <summary>
/// Gets or sets the previous owner of this item.
/// </summary>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion, Player)"/>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion?, Player)"/>
public Player PreviousOwner
{
get => Player.Get(Base.PreviousOwner.Hub);
Expand All @@ -260,7 +260,7 @@ public bool InUse
/// <summary>
/// Gets or sets the pickup position.
/// </summary>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion, Player)"/>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion?, Player)"/>
public Vector3 Position
{
get => Base.Position;
Expand All @@ -279,7 +279,7 @@ public RelativePosition RelativePosition
/// <summary>
/// Gets or sets the pickup rotation.
/// </summary>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion, Player)"/>
/// <seealso cref="CreateAndSpawn(ItemType, Vector3, Quaternion?, Player)"/>
public Quaternion Rotation
{
get => Base.Rotation;
Expand Down Expand Up @@ -532,8 +532,8 @@ public static Pickup Create<T>(ItemType type)
/// <param name="rotation">The rotation to spawn the <see cref="Pickup"/>.</param>
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <returns>The <see cref="Pickup"/>. See documentation of <see cref="Create(ItemType)"/> for more information on casting.</returns>
/// <seealso cref="Projectile.CreateAndSpawn(Enums.ProjectileType, Vector3, Quaternion, bool, Player)"/>
public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion rotation, Player previousOwner = null) => Create(type).Spawn(position, rotation, previousOwner);
/// <seealso cref="Projectile.CreateAndSpawn(Enums.ProjectileType, Vector3, Quaternion?, bool, Player)"/>
public static Pickup CreateAndSpawn(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null) => Create(type).Spawn(position, rotation, previousOwner);

/// <summary>
/// Creates and spawns a <see cref="Pickup"/>.
Expand All @@ -544,8 +544,8 @@ public static Pickup Create<T>(ItemType type)
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <typeparam name="T">The specified <see cref="Pickup"/> type.</typeparam>
/// <returns>The <see cref="Pickup"/>. See documentation of <see cref="Create(ItemType)"/> for more information on casting.</returns>
/// <seealso cref="Projectile.CreateAndSpawn(Enums.ProjectileType, Vector3, Quaternion, bool, Player)"/>
public static Pickup CreateAndSpawn<T>(ItemType type, Vector3 position, Quaternion rotation, Player previousOwner = null)
/// <seealso cref="Projectile.CreateAndSpawn(Enums.ProjectileType, Vector3, Quaternion?, bool, Player)"/>
public static Pickup CreateAndSpawn<T>(ItemType type, Vector3 position, Quaternion? rotation = null, Player previousOwner = null)
where T : Pickup => CreateAndSpawn(type, position, rotation, previousOwner) as T;

/// <summary>
Expand Down Expand Up @@ -588,11 +588,11 @@ public void Spawn()
/// <param name="rotation">The rotation to spawn the <see cref="Pickup"/>.</param>
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <returns>The spawned <see cref="Pickup"/>.</returns>
/// <seealso cref="Projectile.Spawn(Vector3, Quaternion, bool, Player)"/>
public Pickup Spawn(Vector3 position, Quaternion rotation, Player previousOwner = null)
/// <seealso cref="Projectile.Spawn(Vector3, Quaternion?, bool, Player)"/>
public Pickup Spawn(Vector3 position, Quaternion? rotation = null, Player previousOwner = null)
{
Position = position;
Rotation = rotation;
Rotation = rotation ?? Quaternion.identity;
PreviousOwner = previousOwner;
Spawn();

Expand Down
8 changes: 4 additions & 4 deletions EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static Projectile Create<T>(ProjectileType projectiletype)
/// <param name="shouldBeActive">Whether the <see cref="Projectile"/> should be in active state after spawn.</param>
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <returns>The <see cref="Projectile"/>. See documentation of <see cref="Create"/> for more information on casting.</returns>
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);

/// <summary>
/// Creates and spawns a <see cref="Projectile"/>.
Expand All @@ -135,7 +135,7 @@ public static Projectile Create<T>(ProjectileType projectiletype)
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <typeparam name="T">The specified <see cref="Projectile"/> type.</typeparam>
/// <returns>The <see cref="Projectile"/>. See documentation of <see cref="Create"/> for more information on casting.</returns>
public static Projectile CreateAndSpawn<T>(ProjectileType type, Vector3 position, Quaternion rotation, bool shouldBeActive = true, Player previousOwner = null)
public static Projectile CreateAndSpawn<T>(ProjectileType type, Vector3 position, Quaternion? rotation = null, bool shouldBeActive = true, Player previousOwner = null)
where T : Projectile => CreateAndSpawn(type, position, rotation, shouldBeActive, previousOwner) as T;

/// <summary>
Expand All @@ -151,10 +151,10 @@ public static Projectile CreateAndSpawn<T>(ProjectileType type, Vector3 position
/// <param name="shouldBeActive">Whether the <see cref="Projectile"/> should be in active state after spawn.</param>
/// <param name="previousOwner">An optional previous owner of the item.</param>
/// <returns>The spawned <see cref="Projectile"/>.</returns>
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();

Expand Down
6 changes: 3 additions & 3 deletions EXILED/Exiled.API/Features/PrefabHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public static T GetPrefab<T>(PrefabType prefabType)
/// <param name="position">The <see cref="Vector3"/> position where the <see cref="GameObject"/> will spawn.</param>
/// <param name="rotation">The <see cref="Quaternion"/> rotation of the <see cref="GameObject"/>.</param>
/// <returns>Returns the <see cref="GameObject"/> instantied.</returns>
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;
}
Expand All @@ -107,7 +107,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default
/// <param name="rotation">The <see cref="Quaternion"/> rotation of the <see cref="GameObject"/>.</param>
/// <typeparam name="T">The <see cref="Component"/> type.</typeparam>
/// <returns>Returns the <see cref="Component"/> of the <see cref="GameObject"/>.</returns>
public static T Spawn<T>(PrefabType prefabType, Vector3 position = default, Quaternion rotation = default)
public static T Spawn<T>(PrefabType prefabType, Vector3 position = default, Quaternion? rotation = null)
where T : Component
{
GameObject gameObject = Spawn(prefabType, position, rotation);
Expand Down
6 changes: 3 additions & 3 deletions EXILED/Exiled.API/Features/Ragdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ public static Ragdoll CreateAndSpawn(RagdollData networkInfo)
/// <param name="rotation">The rotation of the ragdoll.</param>
/// <param name="owner">The optional owner of the ragdoll.</param>
/// <returns>The ragdoll.</returns>
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));

/// <summary>
/// Creates and spawns a new ragdoll.
Expand All @@ -371,7 +371,7 @@ public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, DamageHan
/// <param name="rotation">The rotation of the ragdoll.</param>
/// <param name="owner">The optional owner of the ragdoll.</param>
/// <returns>The ragdoll.</returns>
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);

/// <summary>
Expand Down