Open DigTron opened 8 years ago
We have a similar thing established in the Economy mod. https://github.com/jpcsupplies/Economy_mod
Every time a player connects, we record the DateTime of that player. The core logic for this I actually took from Admin.
Displaying the details may have to wait, since Keen broke the UI element for displaying a scrollable dialog.
Cleaning up of old ships isn't the only path forward. You may want to consider just revoking ownership, and allowing other players access (and turning the power off).
Though, I'll need to be balanced with checking the NPC's also.
First I want to take a moment to thank you guys for this awesome mod, I wouldn't even know where to begin making something like this and cant imagine running a server without it!
jpcsupplies mentioned wanting to determine the age of objects for clean-ups... #126. Another way of looking at ageing abandoned junk is determining when the owner was last present.
Log can be very light on information.
Player (steamid to ensure consistency and uniqeness) faction(name/id/whatever) ..... to help check a grid against a faction last login time last seen time
Stored as xml for easy access/loading on server start. Can record player's connection(or successful loading into) and disconnection to the server. If the server doesn't see them leave (server resets/crashes with players connected) -when the server loads up, compares last seen and last login times -if they are the same then record the current time as last seen time (for safety if this is to be used for clean ups)
Then listships or a clean-up command can reference this to determine if the grids owner hasn't been on in two weeks, or if the grids faction...
I have the start of a clean-up command already etched out that ill show in a different issue. Includes a check for sub-type id/name with partial match. Calling your awesome getattachedgrids method (love it) once for each... "cluster" of grids.
At the moment its just (the player log) a thought, need to look into how to go about it.
Sandbox.Engine.Multiplayer.MyMultiplayerJoinResult.JoinDone();
at a glance looks promising for connections.
Disclaimer... I have only been looking at c# the past few months so if it looks like I doing something stupid don't be afraid to tell me so :D