public override MyObjectBuilder_SessionComponent GetObjectBuilder() { var ob = new MyObjectBuilder_SessionComponentResearch(); ob.Researches = new List <MyObjectBuilder_SessionComponentResearch.ResearchData>(); foreach (var research in m_unlockedResearch) { if (research.Value.Count == 0) { continue; } var definitions = new List <SerializableDefinitionId>(); foreach (var definition in research.Value) { definitions.Add(definition); } ob.Researches.Add(new MyObjectBuilder_SessionComponentResearch.ResearchData() { IdentityId = research.Key, Definitions = definitions }); } return(ob); }
private static void CleanupClientWorld(MyObjectBuilder_World worldData, ulong playerId, long senderIdentity) { /* * The entire client join code can be cleaned up massively to reduce server load. However, that needs to be in another plugin or keen * * * This is being ran directly after the original cleanup. Original removes: * 1. Station store items * 2. Player relations (keeps only theirs) * 3. Player Faction relations (keeps only theres) * */ //I know ALEs stuff removes this, but lets just add it in essentials too foreach (var Identity in worldData.Checkpoint.Identities) { //Clear all put sender identity last death position if (Identity.IdentityId != senderIdentity) { Identity.LastDeathPosition = null; } } //I dont trust keen to do it worldData.Checkpoint.Gps.Dictionary.TryGetValue(senderIdentity, out MyObjectBuilder_Gps value); worldData.Checkpoint.Gps.Dictionary.Clear(); if (value != null) { worldData.Checkpoint.Gps.Dictionary.Add(senderIdentity, value); } foreach (var SessionComponent in worldData.Checkpoint.SessionComponents) { if (SessionComponent is MyObjectBuilder_SessionComponentResearch) { MyObjectBuilder_SessionComponentResearch Component = (MyObjectBuilder_SessionComponentResearch)SessionComponent; // Remove everyone elses research shit (quick and dirty) for (int i = Component.Researches.Count - 1; i >= 0; i--) { if (Component.Researches[i].IdentityId == senderIdentity) { continue; } Component.Researches.RemoveAt(i); } } } foreach (var Player in worldData.Checkpoint.AllPlayersData.Dictionary) { if (Player.Value.IdentityId == senderIdentity) { continue; } //Clear toolbar junk for other players. Seriously keen what the F**K Player.Value.Toolbar = null; } }