Jump to content

AddClassPostConstruct on a Screen

Recommended Posts

Hi all,

I'm trying to do as below

local _G = GLOBAL
local require = _G.require

print("============= loaded mod")

AddClassPostConstruct("screens/multiplayermainscreen", function(MultiplayerMainScreen)
	print("====================== multiplayermainscreen")
	local oldOnModsButton = MultiplayerMainScreen.OnModsButton
	MultiplayerMainScreen.OnModsButton = function(MultiplayerMainScreen)
		print("====================== Clicked on mods button")

However, I can only see "=========== loaded mod" printed and not the others. I'm sure I've got it right in adding new functionality or replacing the function. But I don't understand how this does not work. Is this the old way of doing things?

Link to comment
Share on other sites

I too found out about screens/redux/ a few hours ago after scourging through the workshop for a mod that does this.

So to those who are still unclear, your code should look like this,

AddClassPostConstruct("screens/redux/multiplayermainscreen", Your_Function)


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

  • Create New...