Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation update #2680

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
667c24b
pawn documentation update
Banalny-Banan Jul 7, 2024
865e2d1
EscapeSettings
Banalny-Banan Jul 7, 2024
dd497f3
EscapeSettings2
Banalny-Banan Jul 7, 2024
e1e59fc
EscapeSettings3
Banalny-Banan Jul 7, 2024
6fe898f
GrenadeSettings
Banalny-Banan Jul 7, 2024
c5bb3d3
GrenadeSettings2
Banalny-Banan Jul 7, 2024
0ff45d7
GrenadeBehaviour and grenade-related EventArgs
Banalny-Banan Jul 7, 2024
b95a0f6
Merge branch 'dev' into documentation-improvements
Misfiy Jul 8, 2024
48e4d0d
Item events
Banalny-Banan Jul 8, 2024
c88b513
cassie events
Banalny-Banan Jul 8, 2024
dbd5d75
Merge remote-tracking branch 'origin/documentation-improvements' into…
Banalny-Banan Jul 8, 2024
130b234
Event{T} (spelling)
Banalny-Banan Jul 8, 2024
510c952
CustomItem
Banalny-Banan Jul 8, 2024
8062845
Grenade events and GrenadeBehaviour
Banalny-Banan Jul 8, 2024
0c0dcae
FakeConnection
Banalny-Banan Jul 9, 2024
3aaed90
EffectType.cs
Banalny-Banan Jul 12, 2024
7ae7187
CustomItem.cs requested changes
Banalny-Banan Jul 12, 2024
e0da413
EffectType.cs
Banalny-Banan Jul 13, 2024
0a6a05f
whether or not → whether
Banalny-Banan Jul 13, 2024
2feb01f
AdminToy and Primitive
Banalny-Banan Jul 13, 2024
f531cca
EffectType.cs r3
Banalny-Banan Jul 13, 2024
d2bc145
Pawn description
Banalny-Banan Jul 13, 2024
31b1ca5
Merge branch 'dev' into documentation-improvements
Banalny-Banan Jul 13, 2024
0ecd084
whether or not → whether 2
Banalny-Banan Jul 14, 2024
3818097
Merge remote-tracking branch 'origin/documentation-improvements' into…
Banalny-Banan Jul 14, 2024
03ab933
whether or not → whether 3
Banalny-Banan Jul 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ public EscapeSettings(
}

/// <summary>
/// Gets or sets a value indicating whether escaping is allowed.
/// Gets or sets a value indicating whether the specific settings are enabled.
/// </summary>
public bool IsAllowed { get; set; }

/// <summary>
/// Gets or sets the role to be given when escaping.
/// Will override the <see cref="CustomRole"/> if set.
/// </summary>
public RoleTypeId Role { get; set; }

Expand All @@ -93,12 +94,12 @@ public EscapeSettings(
public CustomRole CustomRole { get; set; }

/// <summary>
/// Gets or sets the escape position.
/// Gets or sets the position where the specific settings will be triggered.
/// </summary>
public Vector3 Position { get; set; }

/// <summary>
/// Gets or sets the maximum allowable distance for applying the specified settings.
/// Gets or sets the distance threshold from the <see cref="Position"/> to trigger the settings.
/// </summary>
public float DistanceThreshold { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Explosives
/// </remarks>
public abstract class GrenadeBehaviour : ItemBehaviour
{
/// <inheritdoc cref="ItemBehaviour.Settings"/>.
/// <inheritdoc cref="ItemBehaviour.Settings"/>
public GrenadeSettings GrenadeSettings => Settings.Cast<GrenadeSettings>();

/// <inheritdoc cref="EBehaviour{T}.Owner"/>
Expand All @@ -43,13 +43,13 @@ public abstract class GrenadeBehaviour : ItemBehaviour
/// <summary>
/// Throw the custom grenade object.
/// </summary>
/// <param name="position">The <see cref="Vector3"/> position to throw at.</param>
/// <param name="position">The <see cref="Vector3"/> position to throw from.</param>
/// <param name="force">The amount of force to throw with.</param>
/// <param name="weight">The <see cref="float"/> weight of the Grenade.</param>
/// <param name="fuseTime">The <see cref="float"/> fuse time of the grenade.</param>
/// <param name="grenadeType">The <see cref="ItemType"/> of the grenade to spawn.</param>
/// <param name="player">The <see cref="Player"/> to count as the thrower of the grenade.</param>
/// <returns>The spawned <see cref="Pickup"/>.</returns>
/// <returns>The spawned grenade <see cref="Pickup"/>.</returns>
public virtual Pickup Throw(Vector3 position, float force, float weight, float fuseTime = 3f, ItemType grenadeType = ItemType.GrenadeHE, Player player = null)
{
if (!player)
Expand Down Expand Up @@ -129,31 +129,34 @@ protected override void UnsubscribeEvents()
}

/// <summary>
/// Handles tracking thrown requests by custom grenades.
/// Fired before receiving a throwing request with a custom grenade.
/// <seealso cref="ThrowingRequestEventArgs"/>
/// </summary>
/// <param name="ev"><see cref="ThrowingRequestEventArgs"/>.</param>
protected virtual void OnThrowingRequest(ThrowingRequestEventArgs ev)
{
}

/// <summary>
/// Handles tracking thrown custom grenades.
/// Fired after a custom grenade is thrown.
/// </summary>
/// <param name="ev"><see cref="ThrownProjectileEventArgs"/>.</param>
protected virtual void OnThrownProjectile(ThrownProjectileEventArgs ev)
{
}

/// <summary>
/// Handles tracking exploded custom grenades.
/// Fired before a custom grenade explodes.
/// <seealso cref="ExplodingGrenadeEventArgs"/>
/// </summary>
/// <param name="ev"><see cref="ExplodingGrenadeEventArgs"/>.</param>
protected virtual void OnExploding(ExplodingGrenadeEventArgs ev)
{
}

/// <summary>
/// Handles the tracking of custom grenade pickups that are changed into live grenades by a frag grenade explosion.
/// Fired after a pickup grenade was changed into a live grenade by an explosion.
/// <seealso cref="ChangedIntoGrenadeEventArgs"/>
/// </summary>
/// <param name="ev"><see cref="ChangedIntoGrenadeEventArgs"/>.</param>
protected virtual void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public override ItemType ItemType
}

/// <summary>
/// Gets or sets a value indicating whether gets or sets a value that determines if the grenade should explode immediately when contacting any surface.
/// Gets or sets a value indicating whether the grenade should explode on collision.
/// </summary>
public virtual bool ExplodeOnCollision { get; set; }

/// <summary>
/// Gets or sets a value indicating how long the grenade's fuse time should be.
/// Gets or sets a value indicating the length of grenade's fuse in seconds.
/// </summary>
public virtual float FuseTime { get; set; }
}
Expand Down
68 changes: 33 additions & 35 deletions Exiled.CustomModules/API/Features/Pawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Exiled.CustomModules.API.Features
/// <summary>
/// Represents an in-game player by encapsulating a <see cref="ReferenceHub"/>, providing an extended feature set through the <see cref="Pawn"/> class.
/// <para>
/// The <see cref="Pawn"/> class enhances the functionality of the base <see cref="Player"/> class, introducing additional features and capabilities.
/// The <see cref="Pawn"/> class enhances the functionality of the base <see cref="Player"/> class by providing additional features and capabilities related to <see cref="CustomModules"/>.
/// <br>This class is designed to be used seamlessly alongside existing methods that expect a <see cref="Player"/> as a parameter, allowing for compatibility with the existing codebase.</br>
/// <para>The use of nullable context is enabled to prevent users from inadvertently passing or interacting with <see langword="null"/> references.</para>
/// </para>
Expand Down Expand Up @@ -165,16 +165,16 @@ public Pawn(GameObject gameObject)
}

/// <summary>
/// Gets the global role of the pawn.
/// Gets the <see cref="Role"/> or <see cref="CustomRoles.CustomRole"/> of the pawn.
/// <para/>
/// It will return a <see cref="CustomRoles.CustomRole"/> if available, or the <see cref="Role"/> if null.
/// <returns><see cref="CustomRoles.CustomRole"/> if available; otherwise, the standard <see cref="Role"/></returns>
/// </summary>
public object GlobalRole => CustomRole ? CustomRole : Role;

/// <summary>
/// Gets the global items associated with the pawn.
/// Gets the <see cref="Item"/>s and <see cref="CustomItem"/>s associated with the pawn.
/// <para/>
/// It will return a combination of standard <see cref="Item"/>s and <see cref="CustomItem"/>s.
/// <returns>A combination of <see cref="Item"/>s and <see cref="CustomItem"/>s</returns>
/// </summary>
public IEnumerable<object> GlobalItems => Items.Cast<object>().Concat(CustomItems);

Expand Down Expand Up @@ -221,14 +221,14 @@ public object GlobalCurrentItem
}

/// <summary>
/// Gets a value indicating whether the pawn is any custom SCP.
/// Gets a value indicating whether the pawn is a custom SCP.
/// </summary>
public bool IsCustomScp => CustomRole && CustomRole.IsScp;

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="object"/> containing all custom items in the pawn's inventory.
/// Gets a <see cref="IEnumerable{T}"/> of all <see cref="CustomItem"/>s in the pawn's inventory.
/// </summary>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="object"/> which contains all found custom items.</returns>
/// <returns>A <see cref="IEnumerable{T}"/> of all <see cref="CustomItem"/>s in the pawn's inventory.</returns>
public IEnumerable<CustomItem> CustomItems
{
get
Expand All @@ -244,58 +244,58 @@ public IEnumerable<CustomItem> CustomItems
}

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="EffectType"/>.
/// Gets a <see cref="IEnumerable{T}"/> of all <see cref="EffectType"/>s.
/// </summary>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="EffectType"/>.</returns>
/// <returns>A <see cref="IEnumerable{T}"/> of all <see cref="EffectType"/>s.</returns>
public IEnumerable<EffectType> EffectTypes { get; } = EnumExtensions.QueryValues<EffectType>();

/// <summary>
/// Gets a value indicating whether the pawn has the <see cref="CustomItem"/> of the specified type.
/// Gets a value indicating whether the pawn has a <see cref="CustomItem"/> of the specified type.
/// </summary>
/// <typeparam name="T">The type of the <see cref="CustomItem"/>.</typeparam>
/// <returns><see langword="true"/> if a <see cref="CustomItem"/> of the specified type was found; otherwise, <see langword="false"/>.</returns>
public bool HasCustomItem<T>()
where T : CustomItem => CustomItems.Any(item => item.GetType() == typeof(T));

/// <summary>
/// Gets a value indicating whether the pawn has the <see cref="PlayerAbility"/> of the specified type.
/// Gets a value indicating whether the pawn has a <see cref="PlayerAbility"/> of the specified type.
/// </summary>
/// <typeparam name="T">The type of the <see cref="PlayerAbility"/>.</typeparam>
/// <returns><see langword="true"/> if a <see cref="PlayerAbility"/> of the specified type was found; otherwise, <see langword="false"/>.</returns>
public bool HasCustomAbility<T>()
where T : PlayerAbility => CustomAbilities.Any(ability => ability.GetType() == typeof(T));

/// <summary>
/// Tries to get the first <see cref="CustomItem"/> of the specified type from the collection of custom items.
/// Tries to get the first <see cref="CustomItem"/> of the specified type from the pawn's inventory.
/// </summary>
/// <typeparam name="T">The type of the <see cref="CustomItem"/> to retrieve.</typeparam>
/// <param name="customItem">The output parameter that will contain the retrieved <see cref="CustomItem"/>, if found.</param>
/// <typeparam name="T">The type of the <see cref="CustomItem"/> to get.</typeparam>
/// <param name="customItem">The output parameter that will contain the <see cref="CustomItem"/>, if found.</param>
/// <returns><see langword="true"/> if a <see cref="CustomItem"/> of the specified type was found; otherwise, <see langword="false"/>.</returns>
public bool TryGetCustomItem<T>(out T customItem)
where T : CustomItem => customItem = CustomItems.FirstOrDefault(item => item.GetType() == typeof(T))?.Cast<T>();

/// <summary>
/// Tries to get the <see cref="CustomRoles.CustomRole"/> of the specified type from the <see cref="Pawn"/>.
/// </summary>
/// <typeparam name="T">The type of the <see cref="CustomRoles.CustomRole"/> to retrieve.</typeparam>
/// <typeparam name="T">The type of the <see cref="CustomRoles.CustomRole"/>.</typeparam>
/// <param name="customRole">The output parameter that will contain the retrieved <see cref="CustomRoles.CustomRole"/>, if found.</param>
/// <returns><see langword="true"/> if a <see cref="CustomRoles.CustomRole"/> of the specified type was found; otherwise, <see langword="false"/>.</returns>
public bool TryGetCustomRole<T>(out T customRole)
where T : CustomRole => CustomRole.Is(out customRole);

/// <summary>
/// Tries to get the <see cref="CustomAbility{T}"/> of the specified type from the player's abilities.
/// Tries to get the <see cref="CustomAbility{T}"/> of the specified type from the pawn's abilities.
/// </summary>
/// <typeparam name="T">The type of the <see cref="CustomAbility{T}"/> to retrieve.</typeparam>
/// <param name="customAbility">The output parameter that will contain the retrieved <see cref="CustomAbility{T}"/>, if found.</param>
/// <typeparam name="T">The type of the <see cref="CustomAbility{T}"/> to get.</typeparam>
/// <param name="customAbility">The output parameter that will contain the <see cref="CustomAbility{T}"/>, if found.</param>
/// <returns><see langword="true"/> if a <see cref="CustomAbility{T}"/> of the specified type was found; otherwise, <see langword="false"/>.</returns>
public bool TryGetCustomAbility<T>(out T customAbility)
where T : PlayerAbility => CustomAbilities.FirstOrDefault(ability => ability.GetType() == typeof(T)).Is(out customAbility);

/// <summary>
/// Add an <see cref="Item"/> or <see cref="CustomItem"/> of the specified type to the pawn's inventory.
/// </summary>
/// <param name="item">The item to be added.</param>
/// <param name="item">The item to add. Can be an <see cref="Item"/>, <see cref="ItemType"/>, <see cref="CustomItem"/>, as well as <see cref="CustomItem"/>'s <see cref="CustomItem.Name"/>, or <see cref="CustomItem.Id"/>.</param>
/// <returns><see langword="true"/> if the item has been given to the pawn; otherwise, <see langword="false"/>.</returns>
public bool AddItem(object item)
{
Expand Down Expand Up @@ -330,9 +330,10 @@ public bool AddItem(object item)
}

/// <summary>
/// Adds a <see cref="IEnumerable{T}"/> of <see cref="object"/> containing all the custom items to the pawn's inventory.
/// Adds a collection of <see cref="Item"/> and <see cref="CustomItem"/> to the pawn's inventory.
/// </summary>
/// <param name="customItems">The custom items to be added.</param>
/// <param name="customItems">The custom items to add.</param>
/// <seealso cref="AddItem(object)"/>
public void AddItem(IEnumerable<object> customItems)
{
foreach (object customItemType in customItems)
Expand All @@ -345,7 +346,7 @@ public void AddItem(IEnumerable<object> customItems)
/// <summary>
/// Sets the pawn's role.
/// </summary>
/// <param name="role">The role to be set.</param>
/// <param name="role">The role to set. Can be a <see cref="RoleTypeId"/> or a <see cref="uint"/> representing a custom role's <see cref="CustomRole.Id"/>.</param>
/// <param name="preservePlayerPosition">A value indicating whether the <see cref="Pawn"/> should be spawned in the same position.</param>
/// <param name="spawnReason">The <see cref="SpawnReason"/> to be set.</param>
/// <param name="roleSpawnFlags">The <see cref="RoleSpawnFlags"/> to be set.</param>
Expand All @@ -371,10 +372,7 @@ public void SetRole(object role, bool preservePlayerPosition = false, SpawnReaso
}
}

/// <summary>
/// Safely drops an item.
/// </summary>
/// <param name="item">The item to be dropped.</param>
/// <inheritdoc cref="Player.DropItem(Item)"/>
public new void DropItem(Item item)
{
if (TryGetCustomItem(out CustomItem customItem))
Expand All @@ -388,17 +386,17 @@ public void SetRole(object role, bool preservePlayerPosition = false, SpawnReaso
}

/// <summary>
/// Gets the ammo count of a specified custom ammo in a pawn's inventory.
/// Gets the amount of a specified custom ammo in a pawn's ammo box.
/// </summary>
/// <param name="customAmmoType">The custom ammo to be searched for in the pawn's inventory.</param>
/// <returns>The specified custom ammo count.</returns>
/// <returns>The amount of the specified custom ammo in the pawn's inventory.</returns>
public ushort GetAmmo(uint customAmmoType) => (ushort)(customAmmoBox.TryGetValue(customAmmoType, out ushort amount) ? amount : 0);

/// <summary>
/// Adds an amount of custom ammo to the pawn's ammo box.
/// Adds custom ammo to the pawn's ammo box.
/// </summary>
/// <param name="id">The type of the custom ammo.</param>
/// <param name="amount">The amount to be added.</param>
/// <param name="amount">The amount to add.</param>
/// <returns><see langword="true"/> if the specified amount of ammo was given entirely or partially; otherwise, <see langword="false"/>.</returns>
public bool AddAmmo(uint id, ushort amount)
{
Expand Down Expand Up @@ -432,10 +430,10 @@ public bool AddAmmo(uint id, ushort amount)
}

/// <summary>
/// Removes an amount of custom ammo from the pawn's ammo box.
/// Removes custom ammo from the pawn's ammo box.
/// </summary>
/// <param name="id">The type of the custom ammo.</param>
/// <param name="amount">The amount to be removed.</param>
/// <param name="amount">The amount to remove.</param>
/// <returns><see langword="true"/> if the specified amount of ammo was removed entirely or partially; otherwise, <see langword="false"/>.</returns>
public bool RemoveAmmo(uint id, ushort amount)
{
Expand All @@ -459,10 +457,10 @@ public bool RemoveAmmo(uint id, ushort amount)
}

/// <summary>
/// Sets the amount of a specified custom ammo to the pawn's inventory.
/// Sets the amount of a specified custom ammo in the pawn's ammo box.
/// </summary>
/// <param name="id">The type of the custom ammo.</param>
/// <param name="amount">The amount of ammo to be set.</param>
/// <param name="amount">The amount to set.</param>
public void SetAmmo(uint id, ushort amount)
{
if (customAmmoBox.TryAdd(id, amount))
Expand Down
6 changes: 3 additions & 3 deletions Exiled.Events/EventArgs/Map/ChangedIntoGrenadeEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Exiled.Events.EventArgs.Map
using InventorySystem.Items.ThrowableProjectiles;

/// <summary>
/// Contains all information for when the server is turned a pickup into a live grenade.
/// Contains all information after a pickup grenade was changed into a live grenade.
/// </summary>
public class ChangedIntoGrenadeEventArgs : IExiledEvent
{
Expand All @@ -31,12 +31,12 @@ public ChangedIntoGrenadeEventArgs(TimedGrenadePickup pickup, ThrownProjectile p
}

/// <summary>
/// Gets a value indicating the pickup that changed into a grenade.
/// Gets a value indicating the pickup that was changed into a grenade.
/// </summary>
public GrenadePickup Pickup { get; }

/// <summary>
/// Gets a value indicating the projectile that spawned.
/// Gets a value indicating the projectile that was spawned.
/// </summary>
public Projectile Projectile { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Exiled.Events.EventArgs.Map
using InventorySystem.Items.ThrowableProjectiles;

/// <summary>
/// Contains all information for when the server is turning a pickup into a live grenade.
/// Contains all information before a pickup grenade is changed into a live grenade.
Banalny-Banan marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public class ChangingIntoGrenadeEventArgs : IDeniableEvent, IPickupEvent
{
Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Exiled.Events.EventArgs.Player
using InventorySystem.Items.ThrowableProjectiles;

/// <summary>
/// Contains all information before receving a throwing request.
/// Contains all information before receiving a throwing request.
/// </summary>
public class ThrowingRequestEventArgs : IPlayerEvent, IItemEvent
{
Expand Down
Loading