コード例 #1
0
 public void OnSpawning(SpawningEventArgs ev)
 {
     Timing.CallDelayed(Subclass.Instance.CommonUtilsEnabled ? 2f : 0.1f, () =>
     {
         if (!Subclass.Instance.RealisticSizesEnabled)
         {
             ev.Player.Scale = new Vector3(1, 1, 1);
         }
         try
         {
             TrackingAndMethods.RemoveZombie(ev.Player);
             TrackingAndMethods.QueuedCassieMessages.Clear();
             if (TrackingAndMethods.NextSpawnWave.Contains(ev.Player) && TrackingAndMethods.NextSpawnWaveGetsRole.ContainsKey(ev.Player.Role))
             {
                 TrackingAndMethods.AddClass(ev.Player, TrackingAndMethods.NextSpawnWaveGetsRole[ev.Player.Role]);
             }
             else
             {
                 if (!TrackingAndMethods.PlayersWithSubclasses.ContainsKey(ev.Player))
                 {
                     if (Subclass.Instance.Scp035Enabled)
                     {
                         EPlayer scp035 = (EPlayer)Loader.Plugins.First(pl => pl.Name == "scp035").Assembly.GetType("scp035.API.Scp035Data").GetMethod("GetScp035", BindingFlags.Public | BindingFlags.Static).Invoke(null, null);
                         TrackingAndMethods.RemoveAndAddRoles(ev.Player, false, scp035?.Id == ev.Player.Id);
                     }
                     else
                     {
                         TrackingAndMethods.RemoveAndAddRoles(ev.Player, false, false);
                     }
                 }
             }
             foreach (string message in TrackingAndMethods.QueuedCassieMessages)
             {
                 Cassie.Message(message, true, false);
                 Log.Debug($"Sending message via cassie: {message}", Subclass.Instance.Config.Debug);
             }
             Timing.RunCoroutine(TrackingAndMethods.CheckRoundEnd());
         }
         catch (Exception e)
         {
             Log.Error(e);
         }
     });
 }