Fuffles Posted November 10, 2018 Share Posted November 10, 2018 Im a bit unsure how to do this, but I want to override a specific screen (scripts/screens/redux/skinpresetspopup) yet Im unsure how to do so. Prefab overriding was simple, by simply adding the prefab into the Prefabs table, but Im pretty sure Screens don't have that, any help would be aprecieted Link to comment Share on other sites More sharing options...
JohnWatson Posted November 11, 2018 Share Posted November 11, 2018 are you trying to completely replace the screen or just add/replace some functionality? completely overriding the entire thing isn't really recommended since that introduces incompatibility with future updates and other mods anyway, you could do something similar to the examples below: Spoiler Using AddClassPostConstruct: AddClassPostConstruct('screens/redux/skinpresetspopup', function (self, ...) local ExampleA_Old = self.ExampleA or function() end self.ExampleA = function (self, ...) ExampleA_Old(self, ...) self.example = 'a' end local ExampleB_Old = self.ExampleB or function() end self.ExampleB = function (self, x, y, ...) self.example = 'b' return ExampleB_Old(self, 1, 2, ...) end local ExampleC_Old = self.ExampleC or function() end self.ExampleC = function (self, ...) local x = ExampleC_Old(self, ...) x.example = 'c' return x end end) Spoiler Using GLOBAL.require local SkinPresetsPopup = GLOBAL.require('screens/redux/skinpresetspopup') local ExampleA_Old = self.ExampleA or function() end SkinPresetsPopup.ExampleA = function (self, ...) ExampleA_Old(self, ...) self.example = 'a' end local ExampleB_Old = SkinPresetsPopup.ExampleB or function() end SkinPresetsPopup.ExampleB = function (self, x, y, ...) self.example = 'b' return ExampleB_Old(self, 1, 2, ...) end local ExampleC_Old = SkinPresetsPopup.ExampleC or function() end SkinPresetsPopup.ExampleC = function (self, ...) local x = ExampleC_Old(self, ...) x.example = 'c' return x end Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now