private void Initialize() { Instance = this; _init = true; Logging.Instance.WriteLine("Client LinkMod initialized."); MyAPIGateway.Utilities.MessageEntered += MessageEntered; Communication.RegisterHandlers(); }
private void Initialize() { Instance = this; _init = true; Logging.Instance.WriteLine("LinkMod initialized."); MyAPIGateway.Utilities.MessageEntered += MessageEntered; Communication.RegisterHandlers(); foreach (MyDefinitionBase def in MyDefinitionManagerBase.Static.GetAllDefinitions <MyDefinitionBase>()) { var c = def as MyComponentDefinition; if (c == null) { continue; } c.DropProbability = 0; } if (MyAPIGateway.Multiplayer.IsServer) { Settings.LoadSettings(); for (var i = 0; i < Settings.Instance.BattleIPs.Count; i++) { Servers.Add(i, new ServerItem(i, Settings.Instance.BattleIPs[i])); } _lobbyTimer = new Timer(Settings.Instance.JoinTime * 60 * 1000); _lobbyTimer.AutoReset = false; _lobbyTimer.Elapsed += LobbyTimer_Elapsed; _matchTimer = new Timer(Settings.Instance.BattleTime * 60 * 1000); _matchTimer.AutoReset = false; _matchTimer.Elapsed += MatchTimer_Elapsed; if (Settings.Instance.Hub) { _cleanupTimer = new Timer(10 * 60 * 1000); _cleanupTimer.Elapsed += CleanupTimer_Elapsed; _cleanupTimer.Start(); MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, HubDamage); } else { MyAPIGateway.Session.DamageSystem.RegisterBeforeDamageHandler(0, BattleDamage); } } }