KomradeSpectre / AetheriumMod

A mod for Risk of Rain 2.
10 stars 9 forks source link

Engineer's Toolbelt API for Custom Drones #48

Closed cheeeeeeeeeen closed 3 years ago

cheeeeeeeeeen commented 3 years ago

Implement an API so that custom drones can be also revived by the item.

New Features

Custom Drones Support

Custom Drones can now be fully supported through the API. Just Add the CharacterMaster name and it will be registered in the DronesList data structure.

Improvements

Duplication Implementation

The duplication implementation now catches all null reference exceptions that may occur. It now also supports drone checking based on DronesList. The prefab fetching is also improved by getting the the SummonMasterBehavior component and fetch the master prefab from there instead of string manipulation.

Revival Implementation

It is also improved by catching all null reference exceptions. It also now supports drones based on DronesList. The hooking is changed from BaseAI to CharacterMaster as this was more appropriate, where as the CharacterMaster still exists in this context when needed, hence keeping ownership information automatically towards the revived drone.

Revival Flagging through Engineers Toolbelt

Revived drones through this item's effect will be flagged by a component, useful for those mods with behavioral changes to how the drones work. Compatibility implementations will be possible through this.

Existing Issues not worked on

Before improvements were coded in, there was already an issue with the item. The drones duped are not being positioned to correct nodes. I assume that the check does not include "taken" nodes and thus finds the nearest node that was taken (which is the original drone's position). This was not worked on yet, but I have a solution in mind. Use Inspiring Drone's teleport logic (without the effects) to quickly reposition and find the available node that is not taken.