BeepBoop213 Posted January 19, 2021 Share Posted January 19, 2021 I am trying to have my DST mod establish the value of a local variable upon loading the game. Does anyone happen to know where code that runs upon entering the game belongs? My goal is to have the game run my code (check for a variable) every time I enter the game. Any help is greatly appreciated. Thanks! Link to comment Share on other sites More sharing options...
Bigfootmech Posted January 23, 2021 Share Posted January 23, 2021 Hey! I'm new to the forums, and modding DST. Saw this thread while looking for my own answer. So please excuse me if I get it wrong :p I think you might get a clue from various existing mods in their modmain.lua The geometric placement mod by rezecib has AddComponentPostInit("name of a thing", function) and AddClassPostConstruct("components/builder_replica", BuilderReplicaPostConstruct) and AddPrefabPostInit("gridplacer", ReplaceGridplacerAnim) Or maybe you're looking for where the mod has been launched? In which case, maybe you're looking for: In the modmain of Fix For Too Many Items _G = GLOBAL if _G.TheNet and ( ( _G.TheNet:GetIsServer() and _G.TheNet:GetServerIsDedicated() ) or ( _G.TheNet:GetIsClient() and not _G.TheNet:GetIsServerAdmin() ) ) then return end Will give you a lot of the states Or maybe, Place Statues modmain has the answer you're looking for? local function InGame() return ThePlayer and ThePlayer.HUD and not ThePlayer.HUD:HasInputFocus() end Hope any of this helps :) 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