NwPluginAPI
NwPluginAPI copied to clipboard
There are so many changes that I don't know what to put in the title.
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)andTryGet(Collider collider, out Player player): Methods to get or try getting the player associated with a collider. - Added
Player Get(Footprint footprint)andTryGet(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
FacilityDoorfrom aDoorVariant. -
TryGet(DoorVariant baseDoor, out FacilityDoor facilityDoor): Tries to get theFacilityDoorassociated with the providedDoorVariant. If found, thefacilityDoorparameter will be set; otherwise, it will benull.
ItemExtensions
- Created an
ItemExtensionsclass with various extension methods forItemTypeandFirearm. - Added methods to check if an
ItemTypeis of a specific category:IsAmmo,IsFirearm,IsMedical,IsUtility,IsArmor,IsKeycard,IsThrowable. - Implemented a method to get a
Firearm'sItemBaseusingInventoryItemLoader. - 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.
Github is not putting the commit I uploaded https://github.com/SrLicht/NwPluginAPI/commit/fe1ba46fd150fd2fa593a12a6d36b3a4c13c66a7
there are still a bunch of indented preprocessor directives