-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
Wondering if you can help, I am new to modding (up to today) but not coding. Do you have any examples of playing custom audio files that come alongside a plugin/mod? What I'm trying to do is play a beeper on loop when a ship is reversing :P.
I've only managed to hook/patch into the Ship class in Stop(), Forward() and Backward() and test the state of [private Speed m_speed] then log that out to the debug window. Ideally it would be better to determine which way the ship is moving which I imagine requires hooking into regular frame updates... my knowledge is limited after only looking at examples for a few hours.
`
[HarmonyPatch(typeof(Ship), nameof(Ship.Stop))]
class Stop_Patch
{
static void Postfix(ref Speed ___m_speed)
{
Debug.Log($"Stop Beeper");
}
}
[HarmonyPatch(typeof(Ship), nameof(Ship.Forward))]
class Forward_Patch
{
static void Postfix(ref Speed ___m_speed)
{
Debug.Log($"Stop Beeper");
}
}
[HarmonyPatch(typeof(Ship), nameof(Ship.Backward))]
class Backward_Patch
{
static void Postfix(ref Speed ___m_speed)
{
if (___m_speed == Speed.Back)
{
Debug.Log($"Start Beeper");
}
}
}
`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels