BluesyBuesy Posted July 6, 2016 Share Posted July 6, 2016 (edited) Thanks to @CarlZalph and @DarkXero I'm able to save custom data for clients into the client session save folder: I've run into a hitch though. It turns out that the game will create a unique session folder when the player migrates to a caves server. I need to, as a client on any random server, somehow grab the data from the connected shard's session folder. worldmigrator pushes some events, but I think they're all server-side. I believe I can hook into worldmigrator with something like: for i,v in ipairs(ShardPortals) do v.components.worldmigrator.linkedWorld end I'm not sure if it'd work as a client though, and how I'd get the session identifier from this I'm not sure. Currently I'm using this to grab the session identifier for the current world: TheNet:GetSessionIdentifier() This server stuff is pretty daunting. If anyone has a better clue than me, I'd sure appreciate some help. Edited July 6, 2016 by BluesyBuesy Link to comment Share on other sites More sharing options...
CarlZalph Posted July 6, 2016 Share Posted July 6, 2016 13 minutes ago, BluesyBuesy said: This server stuff is pretty daunting. If anyone has a better clue than me, I'd sure appreciate some help. It's sort of hot glued at the moment with some duct tape: function IsMigrating() --Right now the only way to really tell if we are migrating is if we are neither in FE or in gameplay, which results in no screen... -- e.g. if there is no active screen, or just a connecting to game popup --THIS SHOULD BE IMPROVED YARK YARK YARK --V2C: Who dat? ----------^ local screen = TheFrontEnd:GetActiveScreen() return screen == nil or (screen.name == "ConnectingToGamePopup" and TheFrontEnd:GetScreenStackSize() <= 1) end Right now the client is basically in a full disconnect state and LUA is pretty much shut down with a hot variable that connects the client to the shard/caves server with this GUI in the C-side. In the C-side there's a function that gets bound for handling this reconnection: function MigrateToServer(serverIp, serverPort, serverPassword, serverNetId) Which you can't hook into directly on the LUA-side since the function pointer is basically fixed on the C-side. I don't see any real clean or nice way to do this. Many kludges that parallel madness come to mind, but nothing I would use in production code. Link to comment Share on other sites More sharing options...
BluesyBuesy Posted July 6, 2016 Author Share Posted July 6, 2016 31 minutes ago, CarlZalph said: It's sort of hot glued at the moment with some duct tape: function IsMigrating() --Right now the only way to really tell if we are migrating is if we are neither in FE or in gameplay, which results in no screen... -- e.g. if there is no active screen, or just a connecting to game popup --THIS SHOULD BE IMPROVED YARK YARK YARK --V2C: Who dat? ----------^ local screen = TheFrontEnd:GetActiveScreen() return screen == nil or (screen.name == "ConnectingToGamePopup" and TheFrontEnd:GetScreenStackSize() <= 1) end Right now the client is basically in a full disconnect state and LUA is pretty much shut down with a hot variable that connects the client to the shard/caves server with this GUI in the C-side. In the C-side there's a function that gets bound for handling this reconnection: function MigrateToServer(serverIp, serverPort, serverPassword, serverNetId) Which you can't hook into directly on the LUA-side since the function pointer is basically fixed on the C-side. I don't see any real clean or nice way to do this. Many kludges that parallel madness come to mind, but nothing I would use in production code. Well, I'm already doing a bit of voodoo to figure out what structure a client has built, so I'm not totally opposed to mad kludges. If not, I'll just have to publish and pray to the Klei gods that they'll swoop in and save the day. 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