jubjub727 Posted January 10, 2015 Share Posted January 10, 2015 So I was wondering how you get player tables with names and UIDs and such, I've read through a lot of code but I can't quite get my head around it. Also how would I get chat? I think I have an idea however I am new to this and would like some ideas. Before you ask yes I do program in Lua and I have read through all the threads I could find, I read through source code and stuff as well. On another note how does the current testing of dedicated servers work, I am wanting to set one up and work up a player base mucking around with worldgen stuff. Is there a way to apply to get access to a server or the files for one? I have high end servers so I can run whatever OS it doesn't bother me. Link to comment Share on other sites More sharing options...
rezecib Posted January 10, 2015 Share Posted January 10, 2015 player tables with names and UIDs I think you're thinking of TheNet:GetClientTable(). You can look at playerstatusscreen to see how it gets used-- userid is the field that it sounds like you want (e.g. TheNet:GetClientTable()[1].userid). The userid field also exists on the player entities-- e.g. c_find('wilson').userid. Dedicated servers... Klei runs them and tests them mostly, and they gave a few to a couple of modders to do some more unusual stuff with. But they've said that they will be releasing them officially in a couple of weeks, to run on Windows and Linux (currently they're running on Ubuntu virtual machines in cloud hosting services, I think). Link to comment Share on other sites More sharing options...
jubjub727 Posted January 10, 2015 Author Share Posted January 10, 2015 I think you're thinking of TheNet:GetClientTable(). You can look at playerstatusscreen to see how it gets used-- userid is the field that it sounds like you want (e.g. TheNet:GetClientTable()[1].userid). The userid field also exists on the player entities-- e.g. c_find('wilson').userid. Dedicated servers... Klei runs them and tests them mostly, and they gave a few to a couple of modders to do some more unusual stuff with. But they've said that they will be releasing them officially in a couple of weeks, to run on Windows and Linux (currently they're running on Ubuntu virtual machines in cloud hosting services, I think). Ahh, yes that's exactly what I wanted, thank you. Any idea how to get chat though? Link to comment Share on other sites More sharing options...
rezecib Posted January 10, 2015 Share Posted January 10, 2015 Any idea how to get chat though? It depends on what you mean exactly. TheNet:Say(message, whisper) is what sends it out. This goes through the C++ code until it reaches Networking_Say in networking.lua. They're then stored in the chatqueue. I guess the most likely thing would be that you want to intercept messages on the server to react to them somehow. In that case, you want to override Networking_Say on the server, something like this:local OldNetworking_Say = GLOBAL.Networking_SayGLOBAL.Networking_Say = function(guid, userid, name, message, colour, whisper) OldNetworking_Say(guid, userid, name, message, colour, whisper) -- Do stuffend Link to comment Share on other sites More sharing options...
jubjub727 Posted January 13, 2015 Author Share Posted January 13, 2015 It depends on what you mean exactly. TheNet:Say(message, whisper) is what sends it out. This goes through the C++ code until it reaches Networking_Say in networking.lua. They're then stored in the chatqueue. I guess the most likely thing would be that you want to intercept messages on the server to react to them somehow. In that case, you want to override Networking_Say on the server, something like this:local OldNetworking_Say = GLOBAL.Networking_SayGLOBAL.Networking_Say = function(guid, userid, name, message, colour, whisper) OldNetworking_Say(guid, userid, name, message, colour, whisper) -- Do stuffendAhh thanks, I was thinking that's how I'd do it, nice to have it clarified. 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