NwPluginAPI icon indicating copy to clipboard operation
NwPluginAPI copied to clipboard

There are so many changes that I don't know what to put in the title.

Open SrLicht opened this issue 2 years ago • 2 comments

Player

  • Added IEnumerable<Player> GetPlayers(RoleTypeId roleType): Gets a filtered collection of players based on their role type.
  • Added IEnumerable<Player> GetPlayers(Team team): Gets a filtered collection of players based on their team.
  • Added Player Get(Collider collider) and TryGet(Collider collider, out Player player): Methods to get or try getting the player associated with a collider.
  • Added Player Get(Footprint footprint) and TryGet(Footprint footprint, out Player player): Methods to get or try getting the player associated with a footprint.
  • Added Footprint Footprint: Property to get the player's footprint.
  • Modified DropAmmo(ItemType item, ushort amount, bool checkMinimals = false): Un-commented the method to allow the player to drop ammo.
  • Modified SetRole(RoleTypeId newRole, RoleChangeReason reason = RoleChangeReason.RemoteAdmin): Added an optional parameter to specify the role spawn flags for the role change.

Facility doors

  • Added a method to try getting a FacilityDoor from a DoorVariant.
  • TryGet(DoorVariant baseDoor, out FacilityDoor facilityDoor): Tries to get the FacilityDoor associated with the provided DoorVariant. If found, the facilityDoor parameter will be set; otherwise, it will be null.

ItemExtensions

  • Created an ItemExtensions class with various extension methods for ItemType and Firearm.
  • Added methods to check if an ItemType is of a specific category: IsAmmo, IsFirearm, IsMedical, IsUtility, IsArmor, IsKeycard, IsThrowable.
  • Implemented a method to get a Firearm's ItemBase using InventoryItemLoader.
  • Added a method to get a random attachments code for a given ItemType.
  • Introduced a method to apply attachments to a Firearm.
  • Provided a method to apply a set of random attachments directly to a Firearm.
  • Implemented a method to attempt applying a player's attachments preferences to a Firearm.
  • Implemented a method to gets the maximum ammunition a Firearm can have.
    • You can also use it by giving an ItemType
  • Implemented a method to refill the magazine of a weapon
  • Implemented a method to remove ammunition from the magazine of a gun.

Note: This was originally just going to add the Footprint to Player but then I started doing the Get methods and by the time I realized I had already made 1 new extension class and modified 3 classes.

SrLicht avatar Jul 26 '23 22:07 SrLicht

Github is not putting the commit I uploaded https://github.com/SrLicht/NwPluginAPI/commit/fe1ba46fd150fd2fa593a12a6d36b3a4c13c66a7

SrLicht avatar Jul 26 '23 22:07 SrLicht

there are still a bunch of indented preprocessor directives

moddedmcplayer avatar Jul 29 '23 15:07 moddedmcplayer