private IEnumerator <float> _stun() { if (Player.CustomRole != null && PluginClass.Config.BlockedIDs.Any(x => x == Player.CustomRole.GetRoleID())) { yield break; } if (PluginClass.Config.BlockedIDs.Any(x => x == (int)Player.RoleType)) { yield break; } Player.SendBroadcast(5, PluginClass.GetTranslation("stun")); Synapse.Api.Ragdoll rag = null; if (PluginClass.Config.SpawnRagdoll) { rag = Map.Get.CreateRagdoll(Player.RoleType, Player.Position, Quaternion.identity, Vector3.zero, new PlayerStats.HitInfo(), false, Player); } if (PluginClass.Config.DropInventory) { Player.Inventory.DropAll(); } var pos = Player.Position; Player.GodMode = true; Player.Position = Vector3.up; Stuned = true; yield return(Timing.WaitForSeconds(UnityEngine.Random.Range(PluginClass.Config.MinStunTime, PluginClass.Config.MaxStunTime))); if (rag != null) { rag.Destroy(); } Player.GodMode = false; Player.Position = pos; Stuned = false; }
private static bool Prefix(RagdollManager __instance, Vector3 pos, Quaternion rot, Vector3 velocity, int classId, global::PlayerStats.HitInfo ragdollInfo, bool allowRecall, string ownerID, string ownerNick, int playerId) { Role role = __instance.hub.characterClassManager.Classes.SafeGet(classId); if (role.model_ragdoll == null) { return(false); } var gameObject = Object.Instantiate(role.model_ragdoll, pos + role.ragdoll_offset.position, Quaternion.Euler(rot.eulerAngles + role.ragdoll_offset.rotation)); NetworkServer.Spawn(gameObject); Ragdoll component = gameObject.GetComponent <Ragdoll>(); component.Networkowner = new Ragdoll.Info(ownerID, ownerNick, ragdollInfo, role, playerId); component.NetworkallowRecall = allowRecall; component.NetworkPlayerVelo = velocity; var synapseragdoll = new Synapse.Api.Ragdoll(component); Map.Get.Ragdolls.Add(synapseragdoll); return(false); }