Code Monkey home page Code Monkey logo

talkstate's Introduction

TalkState

Sends active talking state to Memory. Supposed to be used in junction with the Positional Audio Mod for GTFO.

⚠️ Linux and MacOS support is unknown! ⚠️

Installation Guide

Configure OpenPA

  1. Make sure you have my Positional Audio Mod for GTFO installed in r2modman.
  2. Run the game modded once, then close it.
  3. Open r2modman, and go to the Config Editor.
  4. Click on BepInEx\config\net.devante.gtfo.positionalaudio.cfg, then Edit Config.
  5. Change Enabled to true.

Configure Mumble

  1. Download the latest .dll on the Releases page.
  2. Open Mumble and open Settings.
  3. Click on the Plugins tab.
  4. Click Install plugin...
  5. Select the downloaded .dll.
  6. Click Yes.
  7. Scroll down, and make sure TalkState is enabled.
  8. Click Apply, then OK.
  9. Connect to a Server, and launch your game.

As long as the plugin is loaded, it will be sending your voice state to memory. Twice each time you speak; once for talking, once for not talking.


Integrating with a different mod

If you would like to use this to send talking data to your own mod, you certainly can.

It uses a Memory Linked File @ %temp%\gtfo_posaudio_mumlink to store a string of the current state. My mod uses the following code to pull the data from the MLF to the BepInEx Plugin in C#.

static void ReadMemoryMappedFile()
{
    var character = Player.PlayerManager.GetLocalPlayerAgent();
    const string memoryMappedFileName = "posaudio_mumlink";
    const int dataSize = 1024;
    Console.WriteLine($"Initiated RMMF!");

    while (true)
    {
        using (var mmf = MemoryMappedFile.OpenExisting(memoryMappedFileName))
        {
            using (var accessor = mmf.CreateViewAccessor(0, dataSize))
            {
                byte[] dataBytes = new byte[dataSize];
                accessor.ReadArray(0, dataBytes, 0, dataSize);

                string receivedData = Encoding.UTF8.GetString(dataBytes).TrimEnd('\0');
                // Console.WriteLine($"Received Data: {receivedData}");

                if (receivedData == "Talking")
                {
					character.ForcePlayerNoiseChange(Agents.Agent.NoiseType.Walk);
                }
            }
        }
		// Console.WriteLine($"Sleeping...");
        Thread.Sleep(6); // Sleep for 6 milliseconds.
		// Adjust update frequency if CPU performance is bad.
    }
}

I would 100% change the way this updates. GTFO is stinky and requires you to update the values faster than the game in order for it to work, so you shouldn't have to take such an aggressive approach like I did.


Known Issues


talkstate's People

Contributors

wwydf avatar sandlotie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.