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

[Artifact Code API] Custom artifact codes for Bulwark's Ambry #299

Merged
merged 6 commits into from
Aug 5, 2021
Merged

Conversation

Nebby1999
Copy link
Contributor

@Nebby1999 Nebby1999 commented Aug 4, 2021

Allows the creation of new Artifact codes to be used in the artifact portal found in sky meadow.
Works by storing an array of DialedActions and appending them to the Portal Dialer Controller instance of SkyMeadow on Awake.
There are 3 public classes

  • ArtifactCodeAPI: Handles the overall storing and creation of new artifact codes
  • ArtifactCodeScriptableObject: Allows the ease of creation of codes by simply inputting the Artifact Compound's values into a list. Works both for Code use and Editor use.
  • CompoundValues: Contains the values of Vanilla Risk of Rain 2 Artifact Compounds (Empty, Square, Circle, Triangle and Diamond.)

Detailed information:

Hooks

The API works by mainly hooking into 2 methods inside the PortalDialerController class.

  • awake: Reads through the list of ArtifactCodes (Composed by an ArtifactDef and a Sha256HashAsset) and checks if the artifact Def is in the ArtifactCatalog. If true, it adds a new DialedAction that calls the OpenArtifactPortalServer(artifactDef), which allows for the Portal to open. Creating these dialed actions must be done in the awake function, since the UnityEvent found inside DialedAction needs a direct reference to the PortalDialerController instance in SkyMeadow.
  • PerformActionServer: While not completely necesary for the API to function, PerformActionServerprints out the necessary values for a modder to use in their Sha256Asset, assuming they desire to create their artifact code this way.

Methods

The main method to use for adding new codes is the Add() Method, having a total of 5 Overloads for a myriad of different methods of implementing codes.

  • Implement a code by giving an ArtifactDef and a Sha256Hash asset as arguments.
  • Implement a code by giving an ArtifactDef and an ArtifactCodeScriptableObject asset as Arguments.
  • Implement a code by giving an ArtifactDef and 4 ulongs, each ulong matches the ulongs a Sha256Hash requires.
  • Implement a code by giving an ArtifactDef and an array of int. This array must be filled with the compound's values.
  • Implement a code by giving an ArtifactDef and a list of ints. This list must be filled with the compound's values.

@CLAassistant
Copy link

CLAassistant commented Aug 4, 2021

CLA assistant check
All committers have signed the CLA.

@harbingerofme
Copy link
Collaborator

Can you update the changelog in the readme with a link to this PR

R2API/ArtifactCodeAPI.cs Outdated Show resolved Hide resolved
R2API/ArtifactCodeAPI.cs Outdated Show resolved Hide resolved
R2API/ArtifactCodeScriptableObject.cs Outdated Show resolved Hide resolved
@Nebby1999
Copy link
Contributor Author

Nebby1999 commented Aug 4, 2021

I've pushed a new version that contains the feedback from Harb and the feedback from other core devs.

Details can be found in the push

README.md Outdated Show resolved Hide resolved
ArtifactCodeAPI:
* Uses a single Logger.LogInfo() to log the code inputted.
* Improvement in the foreach loop in the awake hook, now uses a tupple correctly.
* ArtifactCodeAPI now checks wether a code has already been added, should avoid code conflcts.
* Moved wrapper
* Replaced methods that asked for a List<int> and int[] with an IEnumerable<int>.

ArtifactCodeScriptableObject:
* Renamed to ArtifactCode
* Moved to a new folder that holds scriptable object.
* Now in the namespace R2API.ScriptableObjects

README.MD
* Added the pullrequest in the changelog
@KomradeSpectre
Copy link
Contributor

For clarity sake on the readme, you may want to change where you said PreformActionServer to PerformActionServer since that is what the event/hook that you subscribe to is called. Simple typo.

@harbingerofme
Copy link
Collaborator

For clarity sake on the readme, you may want to change where you said PreformActionServer to PerformActionServer since that is what the event/hook that you subscribe to is called. Simple typo.

I might have typod that trying to remove typos.

@tristanmcpherson tristanmcpherson merged commit e4304e6 into risk-of-thunder:master Aug 5, 2021
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.

5 participants