Fix network intercept

This commit is contained in:
Brant Martin
2018-07-18 22:34:44 -04:00
parent b12199c65b
commit ec065ec329
2 changed files with 10 additions and 9 deletions

View File

@@ -105,9 +105,9 @@ namespace Torch.Server.Managers
var sb = new StringBuilder();
foreach (var mod in world.Checkpoint.Mods)
sb.AppendLine(mod.PublishedFileId.ToString());
DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
//TODO
//DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
Log.Debug("Loaded mod list from world");
@@ -134,8 +134,7 @@ namespace Torch.Server.Managers
return;
}
//TODO
//DedicatedConfig.Mods = checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
DedicatedConfig.Mods = checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
Log.Debug("Loaded mod list from world");
@@ -167,10 +166,9 @@ namespace Torch.Server.Managers
checkpoint.SessionName = DedicatedConfig.WorldName;
checkpoint.Settings = DedicatedConfig.SessionSettings;
checkpoint.Mods.Clear();
//TODO: FIXIT
//foreach (var modId in DedicatedConfig.Model.SessionSettings..Mods)
// checkpoint.Mods.Add(new MyObjectBuilder_Checkpoint.ModItem(modId));
foreach (var modId in DedicatedConfig.Mods)
checkpoint.Mods.Add(new MyObjectBuilder_Checkpoint.ModItem(modId));
MyObjectBuilderSerializer.SerializeXML(sandboxPath, false, checkpoint);

View File

@@ -29,6 +29,8 @@ namespace Torch.Managers
private static Func<MyReplicationLayerBase, MyTypeTable> _typeTableGetter;
[ReflectedGetter(Name = "m_methodInfoLookup")]
private static Func<MyEventTable, Dictionary<MethodInfo, CallSite>> _methodInfoLookupGetter;
[ReflectedMethod(Type = typeof(MyReplicationLayer), Name = "GetObjectByNetworkId")]
private static Func<MyReplicationLayer, NetworkId, IMyNetObject> _getObjectByNetworkId;
public NetworkManager(ITorchBase torchInstance) : base(torchInstance)
{
@@ -150,7 +152,8 @@ namespace Torch.Managers
}
else // Instance event
{
var sendAs = ((MyReplicationLayer)MyMultiplayer.ReplicationLayer).GetObjectByNetworkId(networkId);
//var sendAs = ((MyReplicationLayer)MyMultiplayer.ReplicationLayer).GetObjectByNetworkId(networkId);
var sendAs = _getObjectByNetworkId((MyReplicationLayer)MyMultiplayer.ReplicationLayer, networkId);
if (sendAs == null)
{
return;