ParagonOfCourage Posted July 3, 2015 Share Posted July 3, 2015 Sorry english not first language! Until now I have been just tweaking things in the game code for my own personal use. I would like to share a tweak of mine with a code not knowing friend, but it seems simply uploading a folder with modinfo, preview.jpg and the subdirectory folders starting with /scripts/ with the replacement file contained at a path that it would be in steam files. My assumption is that there must be some sort of line in modmain that loads the files. I would like some quidance, because I am somewhat clueless. Perhaps there is a way to simple replace lines or change internal values without overwriting completely - though overwriting would better fit my needs. Perhaps if it is not that simple, I could be referred to a guide? I know how to overwrite prefabs through google, but I want to do that for files in cameras, nis and screens. Thank you! Link to comment https://forums.kleientertainment.com/forums/topic/55845-how-to-overwrite-files-with-modmainlua/ Share on other sites More sharing options...
Kzisor Posted July 3, 2015 Share Posted July 3, 2015 @ParagonOfCourage, do not overwrite files, that is bad modding practice. What you do is you use AddPrefabPostInit and modify the prefab files to do what you want them to do. Link to comment https://forums.kleientertainment.com/forums/topic/55845-how-to-overwrite-files-with-modmainlua/#findComment-651760 Share on other sites More sharing options...
ParagonOfCourage Posted July 3, 2015 Author Share Posted July 3, 2015 @ParagonOfCourage, do not overwrite files, that is bad modding practice. What you do is you use AddPrefabPostInit and modify the prefab files to do what you want them to do. I understand reason why not but time I would need to do other is not worth it to just give friend a tweak. But I am not modding prefab files? I wish to do replace files in folders such as /cameras/, /nis/ and /screens/, not in /prefabs/. Or are they still called "prefabs" for some reason - I don't understand. Only examined modmain of other mods, but did not find ones that change files that I am changing to copy. Have not been using modmain until now so small examples would be best to learn from and appreciated! Link to comment https://forums.kleientertainment.com/forums/topic/55845-how-to-overwrite-files-with-modmainlua/#findComment-651784 Share on other sites More sharing options...
Kzisor Posted July 3, 2015 Share Posted July 3, 2015 @ParagonOfCourage, well it would depend on what exactly you're trying to modify, usually just copy/paste the mod files in your mod/scripts folder will work, however, if you're wanting to give them to your friend simply zip the changed files and tell them where to copy/paste them on their end. Link to comment https://forums.kleientertainment.com/forums/topic/55845-how-to-overwrite-files-with-modmainlua/#findComment-651799 Share on other sites More sharing options...
DarkXero Posted July 4, 2015 Share Posted July 4, 2015 The modapi allows access to these.If you open a file in /cameras/ or /screens/, you can see that a class is being created and returned.So the following applies: To edit /cameras/ (only followcamera.lua):AddClassPostConstruct("cameras/followcamera", function(self) --Now we have access like with AddComponentPostInit("component", fn(self))end)To edit /screens/, the same as before, but with: "screens/chatinputscreen". To edit widgets, you do the same, like the Always on Status mod shows. /nis/ isn't really used. There is no maxwell intro.But in modmain you can do:local nistable = GLOBAL.require("nis/maxwellintro")local old_init = nistable.initnistable.init = function(dat) old_init(dat) --Other stuffendsince what is returned is the table reference. As Kzisor said, you can also, as well copy and paste code, if you want to just change one line of it but can't override it properly. Link to comment https://forums.kleientertainment.com/forums/topic/55845-how-to-overwrite-files-with-modmainlua/#findComment-651842 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