![]() ![]() Static bool Prefix(ref bool _result) //pass the _result by ref to alter it. Static class Building_Trap_KnowsOfTrap_Patch annotation boiler plate to tell Harmony what to patch. Consider the following destructive prefix, which gives everyone perfect knowledge of trap locations: Harmony disconnects its own return type from the return type of the original method. How do I return a value from a void or prefix? Can you subclass? Can you use a ThingComp? A MapComponent? There may be viable alternatives without the added dependency. Before you do that, consider the alternatives. Harmony is a fantastic tool, that you'll soon want to use for everything. If the original method has a return type, you can alter its _result by passing it by ref. If you must use a transpiler, you might find useful notes here. Transpilers are difficult to debug and therefor hard to create/maintain/update. Refer to MSDN and Harmony documentation for more info. They use low-level IL-code, from System.Reflection and. ![]() These alter the inner working of the method. Use these for greatest compatibility.Ī transpiler is a set of CodeInstructions. This type of prefix may also prevent other prefixes from running.Ī postfix is a method that runs after the original method. This will cause compatibility issues if you're not very careful. If a bool returns false, the original method is skipped. It can have a return type of void or bool. It offers three ways of doing this: prefixes, postfixes, and transpilers.Ī prefix is a method that runs before the original method. Harmony can alter the workings of any method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |