Пример #1
0
        public static bool Prefix(RagdollManager __instance, Vector3 pos, Quaternion rot, int classId, PlayerStats.HitInfo ragdollInfo, bool allowRecall, string ownerID, string ownerNick, int playerId)
        {
            if (Configs.ragdoll_cleanup < 0)
            {
                return(true);
            }

            Log.Debug($"[RagdollCleanupPatch] {Enum.Parse(typeof(RoleType), classId.ToString())}{pos} Time:{Time.time} Cleanuptimes:{Configs.ragdoll_cleanup}");

            Role role = __instance.ccm.Classes.SafeGet(classId);

            if (role.model_ragdoll != null)
            {
                GameObject gameObject = UnityEngine.Object.Instantiate(role.model_ragdoll, pos + role.ragdoll_offset.position, Quaternion.Euler(rot.eulerAngles + role.ragdoll_offset.rotation));
                NetworkServer.Spawn(gameObject);
                gameObject.GetComponent <Ragdoll>().Networkowner       = new Ragdoll.Info(ownerID, ownerNick, ragdollInfo, role, playerId);
                gameObject.GetComponent <Ragdoll>().NetworkallowRecall = allowRecall;
                ragdolls.Add(gameObject, Time.time);
            }
            if (ragdollInfo.GetDamageType().isScp || ragdollInfo.GetDamageType() == DamageTypes.Pocket)
            {
                __instance.RegisterScpFrag();
            }
            else if (ragdollInfo.GetDamageType() == DamageTypes.Grenade)
            {
                RoundSummary.kills_by_frag++;
            }

            return(false);
        }