Jump to content

Can't Disable Global


Recommended Posts

Back when mod support for DST was added, Klei's Peter made a whisper-only mod.  At some point it broke, but currently I want to mute global for a TTT-style gamemode I want to make.  This is the only code Peter had in his mod, in modmain.lua:

 

function WhisperInit( self )
    self.whisper = true
    self.chat_type:SetString(GLOBAL.STRINGS.UI.CHATINPUTSCREEN.WHISPER)
    
    GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[GLOBAL.CONTROL_TOGGLE_SAY] = GLOBAL.STRINGS.UI.CONTROLSSCREEN.CONTROLS[GLOBAL.CONTROL_TOGGLE_WHISPER]
end

AddGlobalClassPostConstruct( "screens/chatinputscreen", "ChatInputScreen", WhisperInit)

Any ideas on how to make it work now?  Even manually modifing chatinputscreen.lua to always have self.whisper be true seems to have no effect.

Edited by Mario384
Link to comment
Share on other sites

@Mario384

The entire whisper subsystem is reliant on the client to filter- every client receives the chat messages everywhere all the time but it hides it from the user.

 

Take a look at hooking the Networking_Say function.

Peter changed how the input text box handles sending, whereas if you hook that function there you're going a little lower level and modifying the underlying function that sends off the prints to the client's UI.

Link to comment
Share on other sites

Alright, that certainly is a step in the right direction.  Now, the issue is implanting the modified version of Networking_Say into the game.  Networking is just a collection of functions, so I'm not exactly sure how to target it.  I've tried using AddGamePostInit to add a different version of Networking_Say from modmain, but it doesn't seem to work.

EDIT: I've also just tried replacing networking.lua using the mod and commented out the entirety of Networking_Say, but it still works.  Am I missing something here?

Edited by Mario384
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...