forked from risk-of-thunder/R2API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemDropAPI Instructions For Use.txt
51 lines (26 loc) · 3.69 KB
/
ItemDropAPI Instructions For Use.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
INSTRUCTIONS FOR USE
By default every pickup that is unlocked will be added to the appropriate drop lists automatically, with a few exceptions which are detailed below. This means that most mods that add new pickups do not need to do anything.
Pickups that can be given to the player have two separate categories in this API, regular (not special) and special. A pickup can be apart of both of these categories. Regular pickups are pickups that can be found in chests and shops, as well as all pickups dropped by bosses. Special pickups are items that are not part of the regular drop pool, such as the Captain's Defensive Microbots, both pearls, all scrap, all elite equipment that is registered to an EliteDef, the fuel array and as a special exception, the Halcyon Seed.
REGULAR
By default, all pickups that are unlocked as well as being an item without the tag ItemTag.WorldUnique or a piece of equipment where EquipmentDef.canDrop is true are added to the regular drop lists.
SPECIAL
By default, all pickups that are unlocked as well as being an item with the tag ItemTag.Scrap or ItemTag.WorldUnique or a piece of equipment registered to a EliteDef in the EliteCatalog are added to the special drop lists.
If your pickup has special spawn conditions it is recommended to give it the tag ItemTag.WorldUnique or set EquipmentDef.canDrop to false, then added it to the special drop lists as appropriate.
There are three functions to apply changes to whether a pickup can drop:
R2API.ItemDropAPI.AddPickup(PickupIndex pickupIndex, bool special = false)
This will add the pickup to the appropriate drop lists if it is not already present in the drop lists. If special == false the pickup will be added to the regular drop lists. If special == true the pickup will be added to the special drop lists.
R2API.ItemDropAPI.RemovePickup(PickupIndex pickupIndex, bool special = false)
This will remove the pickup from the appropriate drop lists if it is present in the drop lists. If special == false the pickup will be removed from the regular drop lists. If special == true the pickup will be removed from the special drop lists.
R2API.ItemDropAPI.RevertPickup(PickupIndex pickupIndex, bool special = false)
This will restore vanilla drop list presence for this pickup. If special == false the pickup will be reverted in the regular drop lists. If special == true the pickup will be reverted in the special drop lists.
For all other changes to the drop lists, either listen for the event R2API.ItemDropAPI.PlayerDropList.ListsGenerated and apply changes to the R2API.ItemDropAPI.PlayerDropList.AvailableXXXX lists or use reflection to modify the RoR2.Run.availableXXXX lists.
!PLEASE NOTE!
Changes to pickup drop lists must be applied before the start of every run, they are wiped after they are used to generate the drop lists for each run. This is so that mods which can have their configurations altered without restarting the application can rely on a consistent set of drop lists uneffected by previous configurations. Only the last change to whether a pickup can drop is applied when a run starts.
On.RoR2.Run.BuildDropTable is the recommended place to call the three drop list changing functions.
EXAMPLES
R2API.ItemDropAPI.AddPickup(PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("CaptainDefenseMatrix")));
This will allow the Defensive Microbots to be found in chests.
R2API.ItemDropAPI.AddPickup(PickupCatalog.FindPickupIndex(EquipmentCatalog.FindEquipmentIndex("AffixBlue")), true);
This will prevent Silence Between Two Strikes from dropping from overloading elites.
R2API.ItemDropAPI.AddPickup(PickupCatalog.FindPickupIndex(EquipmentCatalog.FindEquipmentIndex("AffixBlue")));
This will add Silence Between Two Strikes to equipment barrels.