public void OnModelChange(Player player, PlayerModelController controller) { if (!NetworkUtils.IsServer()) { return; } Channel.Send(nameof(Network_ChangeModel), ECall.Others, player.User.Identity, controller.Name); }
public void SendUpdate(Identity target, Player toUpdate, PlayerModelController updateModel) { if (!NetworkUtils.IsServer()) { return; } Channel.Send(nameof(Network_ChangeModel), target, toUpdate.User.Identity, updateModel.Name); }
public static void RegisterPlayerModel(Plugin plugin, PlayerModelController modelController) { if (plugin == null) { throw new ArgumentNullException(nameof(plugin)); } RegisterPlayerModelInternal(plugin, modelController); }
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); }
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); }