Beispiel #1
0
 public void OnModelChange(Player player, PlayerModelController controller)
 {
     if (!NetworkUtils.IsServer())
     {
         return;
     }
     Channel.Send(nameof(Network_ChangeModel), ECall.Others, player.User.Identity, controller.Name);
 }
Beispiel #2
0
 public void SendUpdate(Identity target, Player toUpdate, PlayerModelController updateModel)
 {
     if (!NetworkUtils.IsServer())
     {
         return;
     }
     Channel.Send(nameof(Network_ChangeModel), target, toUpdate.User.Identity, updateModel.Name);
 }
Beispiel #3
0
 public static void RegisterPlayerModel(Plugin plugin, PlayerModelController modelController)
 {
     if (plugin == null)
     {
         throw new ArgumentNullException(nameof(plugin));
     }
     RegisterPlayerModelInternal(plugin, modelController);
 }
Beispiel #4
0
        private void Network_ChangeModel(Identity sender, Identity target, string modelController)
        {
            var clients    = Connection.Clients.ToList();
            var owner      = target.Owner;
            var player     = owner.Player;
            var controller = PlayerModelController.GetPlayerModelController(modelController);

            controller.ApplyLocal(player);
        }
Beispiel #5
0
        internal static void RegisterPlayerModelInternal(Plugin plugin, PlayerModelController modelController)
        {
            if (GetPlayerModelController(modelController.GetType()) != null)
            {
                LogUtils.LogError($"RegisterPlayerModel: The class \"{modelController.GetType().FullName}\" is already a registered controller!");
            }
            if (GetPlayerModelController(modelController.Name) != null)
            {
                LogUtils.LogError($"RegisterPlayerModel: A model with the name \"{modelController.Name}\" already exists!");
                modelController.Name = modelController.Name + "_";
                RegisterPlayerModelInternal(plugin, modelController);
                return;
            }

            modelController._plugin = plugin;
            RegisteredModels.Add(modelController);
        }