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

Phedg1 #234

Merged
merged 5 commits into from
Dec 25, 2020
Merged

Phedg1 #234

merged 5 commits into from
Dec 25, 2020

Conversation

Phedg1Studios
Copy link
Contributor

Added ability to have items of any tier in any drop list

Added ability to add items of any tier to any drop list.
Added hooks and functionality so the artifact of command interfact can display a custom list.
Added hooks so interactables would not filter drop lists to limit them to specific tiers.
Altered tiers in InteractableCalculator so items in a tier of drop list could be differentiated from items of a tier in any drop list.

Added functions to Reflection for getting nested field and method infos.
Added function to Reflection log all opcodes for a cursor to help with debugging.
Added function to Reflection for getting a generic method info when multiple functions with the same name exist.

Added Unity physics module dependency for a hook that required the Collision type.

Fixed bug in MonsterItemsAPI that occured when the ItemDropAPI drop lists differed from the MonsterItemsAPI drop lists.

Changed drop list operation lists so they are cleared each time they are used,
    as a stop gap measure so my other mods would be able to continue functioning
    normally. I know Rein's methods will make this redundant shortly.
Drop lists should never be empty now and will always contain PickupIndex.none
    instead. This was for increased consistency, as previously these lists could
    sometimes contain none and sometimes be empty, causing bugs.
Added function to determine if a drop list only contained PickupIndex.none, this
    has been substituted in wherever a check was done previously to see if a
    drop list was empty.
All world unique items are now stored in a list in Catalog and are no longer
    added to the subset drop lists in DropList by default.
When using the command artifact, world unique items will now be listed by
    themselves unless they are added to the subset drop list of their tier.
Boss drops now check their availability against the world unique drop list if
    their drop is a world unique item.
Added ability to add items of any tier to any drop list.
Added hooks and functionality so the artifact of command interfact can display a custom list.
Added hooks so interactables would not filter drop lists to limit them to specific tiers.
Altered tiers in InteractableCalculator so items in a tier of drop list could be differentiated from items of a tier in any drop list.

Added functions to Reflection for getting nested field and method infos.
Added function to Reflection log all opcodes for a cursor to help with debugging.
Added function to Reflection for getting a generic method info when multiple functions with the same name exist.

Added Unity physics module dependency for a hook that required the Collision type.

Fixed bug in MonsterItemsAPI that occured when the ItemDropAPI drop lists differed from the MonsterItemsAPI drop lists.
@Phedg1Studios
Copy link
Contributor Author

It's worth noting that in order to add this extra functionality the surface area of this module is MUCH greater.

R2API/ItemDrop/Catalog.cs Outdated Show resolved Hide resolved
R2API/ItemDrop/DropList.cs Show resolved Hide resolved
R2API/ItemDrop/InteractableCalculator.cs Outdated Show resolved Hide resolved
R2API/Utils/Reflection.cs Outdated Show resolved Hide resolved
R2API/Utils/Reflection.cs Outdated Show resolved Hide resolved
R2API/Utils/Reflection.cs Show resolved Hide resolved
R2API/Utils/Reflection.cs Outdated Show resolved Hide resolved
Added proper binding flags to my contributions in Reflection.
Steamlined my contributions in Reflection.
Enumerated the drop types in InteractableCalculator.
Removed some checks against the Run drop lists and increased relaince on InteractableCalculator TiersPresent.
Expanded IsValidList so it returns false when given an empty list.
return null;
}

public static void LogCursorOpcodes(ILCursor cursor) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this and just logging the cursor to string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know you could just log the cursor to a string. If you can do that then I agree that this function is redundant.

cursor.Index = indexOld;
}

public static MethodInfo GetGenericMethod(Type type, string name, Type[] parameters) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed, correct?

@@ -923,5 +925,60 @@ public static class Reflection {
}

#endregion

public static System.Reflection.FieldInfo GetNestedField(Type type, string fieldName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could replace these two with a generic GetNestedMember and take in a generic type parameter that is constrained to a MemberInfo like here:

private static T GetMemberFull<T>(this Type type, string name) where T : MemberInfo {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be good. Would you like to persue that change or should I? I'm not familiar with creating generic type functions.

@tristanmcpherson tristanmcpherson merged commit 4460384 into risk-of-thunder:master Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants