Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FinishingRecallEventArgs"/> class.
 /// </summary>
 /// <param name="target"><inheritdoc cref="Target"/></param>
 /// <param name="scp049"><inheritdoc cref="Scp049"/></param>
 /// <param name="ragdoll"><inheritdoc cref="Ragdoll"/></param>
 /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
 public FinishingRecallEventArgs(Player target, Player scp049, global::Ragdoll ragdoll, bool isAllowed = true)
 {
     Target    = target;
     Scp049    = scp049;
     Ragdoll   = Ragdoll.Get(ragdoll);
     IsAllowed = isAllowed;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Optimized method to Spawn a ragdoll on the map.
        /// Will only allocate the newly created GameObject, requires extra work and pre-loaded base game roles.
        /// </summary>
        /// <remarks>
        /// <list type="number">
        /// <item>
        /// <para>
        /// EXILED already has an internal, default Ragdoll.Info: the use of this
        /// method to try to optimize a plugin is absolutely optional.
        /// </para>
        /// We recommend using: Map.SpawnRagdoll(RoleType roleType, string victimNick, Vector3 position)
        /// </item>
        /// <item>
        /// This method should only ever be used if you're dealing with massive
        /// server-sided lag.
        /// </item>
        /// <item>
        /// Ragdoll.Info's "ownerID" isn't the SteamID, but the
        /// <see cref="Dissonance.Integrations.MirrorIgnorance.MirrorIgnorancePlayer"/>'s PlayerId field.
        /// </item>
        /// </list>
        /// </remarks>
        /// <param name="role">Main game's <see cref="Role"/> thad defines the role to spawn a ragdoll.</param>
        /// <param name="ragdollInfo"><see cref="Ragdoll.Info"/> object containing the ragdoll's info.</param>
        /// <param name="position">Where the ragdoll will be spawned.</param>
        /// <param name="rotation">The rotation for the ragdoll.</param>
        /// <param name="velocity">The initial velocity the ragdoll will have, as if it was exploded.</param>
        /// <param name="allowRecall">Sets this ragdoll as respawnable by SCP-049.</param>
        /// <returns>The <see cref="Ragdoll"/> component created.</returns>
        public static global::Ragdoll SpawnRagdoll(
            global::Role role,
            Ragdoll.Info ragdollInfo,
            Vector3 position,
            Quaternion rotation = default,
            Vector3 velocity    = default,
            bool allowRecall    = false)
        {
            if (role.model_ragdoll == null)
            {
                return(null);
            }

            GameObject gameObject = Object.Instantiate(role.model_ragdoll, position + role.ragdoll_offset.position, Quaternion.Euler(rotation.eulerAngles + role.ragdoll_offset.rotation));

            // Modify the Ragdoll's component
            global::Ragdoll ragdollObject = gameObject.GetComponent <global::Ragdoll>();

            ragdollObject.Networkowner       = ragdollInfo != null ? ragdollInfo : DefaultRagdollOwner;
            ragdollObject.NetworkallowRecall = allowRecall;
            ragdollObject.NetworkPlayerVelo  = velocity;

            Mirror.NetworkServer.Spawn(gameObject);

            return(ragdollObject);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Ragdoll"/> class.
        /// </summary>
        /// <param name="roleType">The <see cref="RoleType"/> to use as ragdoll.</param>
        /// <param name="ragdollInfo"><see cref="global::Ragdoll.Info"/> object containing the ragdoll's info.</param>
        /// <param name="position">Where the ragdoll will be spawned.</param>
        /// <param name="rotation">The rotation for the ragdoll.</param>
        /// <param name="velocity">The initial velocity the ragdoll will have, as if it was exploded.</param>
        /// <param name="allowRecall">Sets this ragdoll as respawnable by SCP-049.</param>
        public Ragdoll(RoleType roleType, global::Ragdoll.Info ragdollInfo, Vector3 position, Quaternion rotation = default, Vector3 velocity = default, bool allowRecall = false)
        {
            Role       role       = CharacterClassManager._staticClasses.SafeGet(roleType);
            GameObject gameObject = Object.Instantiate(role.model_ragdoll, position + role.ragdoll_offset.position, Quaternion.Euler(rotation.eulerAngles + role.ragdoll_offset.rotation));

            ragdoll = gameObject.GetComponent <global::Ragdoll>();
            ragdoll.Networkowner       = ragdollInfo != null ? ragdollInfo : DefaultRagdollOwner;
            ragdoll.NetworkPlayerVelo  = velocity;
            ragdoll.NetworkallowRecall = allowRecall;
        }
    // Token: 0x060003C2 RID: 962 RVA: 0x00011ED4 File Offset: 0x000100D4
    private void ClientLocalDeath()
    {
        global::Ragdoll ragdoll = this.DeathRagdoll();

        if (base.localControlled)
        {
            if (!global::actor.forceThirdPerson)
            {
                global::CameraMount componentInChildren = base.GetComponentInChildren <global::CameraMount>();
                if (componentInChildren && componentInChildren.open)
                {
                    global::RagdollTransferInfoProvider ragdollTransferInfoProvider = base.controller as global::RagdollTransferInfoProvider;
                    Transform transform;
                    bool      flag;
                    if (ragdollTransferInfoProvider != null)
                    {
                        try
                        {
                            flag = ragdollTransferInfoProvider.RagdollTransferInfo.FindHead(ragdoll.transform, out transform);
                        }
                        catch (Exception ex)
                        {
                            Debug.LogException(ex, this);
                            transform = null;
                            flag      = false;
                        }
                    }
                    else
                    {
                        transform = null;
                        flag      = false;
                    }
                    if (flag)
                    {
                        Vector3 vector = transform.InverseTransformPoint(componentInChildren.transform.position);
                        vector.y += 0.08f;
                        Vector3 vector2 = transform.TransformPoint(vector);
                        ragdoll.origin += vector2 - transform.position;
                        global::CameraMount cameraMount = global::CameraMount.CreateTemporaryCameraMount(componentInChildren, transform);
                        cameraMount.camera.nearClipPlane = 0.02f;
                    }
                    global::ArmorModelRenderer local = ragdoll.GetLocal <global::ArmorModelRenderer>();
                    if (local)
                    {
                        local.enabled = false;
                    }
                }
                else
                {
                    Debug.Log("No camera?");
                }
            }
            Object.Destroy(base.GetComponent <global::LocalDamageDisplay>());
        }
    }
    // Token: 0x060003C0 RID: 960 RVA: 0x00011D44 File Offset: 0x0000FF44
    private global::Ragdoll DeathRagdoll()
    {
        global::Ragdoll         result    = this.CreateRagdoll();
        global::PlayerProxyTest component = base.GetComponent <global::PlayerProxyTest>();

        if (component.body)
        {
            component.body.SetActive(false);
        }
        return(result);
    }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Ragdoll"/> class.
        /// </summary>
        /// <param name="ragdollInfo">The ragdoll's <see cref="RagdollInfo"/>.</param>
        /// <param name="canBeSpawned">A value that represents whether the ragdoll can be spawned.</param>
        public Ragdoll(RagdollInfo ragdollInfo, bool canBeSpawned = false)
        {
            GameObject model_ragdoll = CharacterClassManager._staticClasses.SafeGet(ragdollInfo.RoleType).model_ragdoll;

            if (model_ragdoll is null || !Object.Instantiate(model_ragdoll).TryGetComponent(out RagDoll ragdoll))
            {
                return;
            }
            ragdoll.NetworkInfo = ragdollInfo;
            this.ragdoll        = ragdoll;
            Map.RagdollsValue.Add(this);
            if (canBeSpawned)
            {
                Spawn();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Ragdoll"/> class.
        /// </summary>
        /// <param name="player">The ragdoll's <see cref="Player">owner</see>.</param>
        /// <param name="handler">The player's <see cref="DamageHandlerBase"/>.</param>
        /// <param name="canBeSpawned">A value that represents whether the ragdoll can be spawned.</param>
        public Ragdoll(Player player, DamageHandlerBase handler, bool canBeSpawned = false)
        {
            GameObject model_ragdoll = player.ReferenceHub.characterClassManager.CurRole.model_ragdoll;

            if (model_ragdoll is null || !Object.Instantiate(model_ragdoll).TryGetComponent(out RagDoll ragdoll))
            {
                return;
            }
            ragdoll.NetworkInfo = new RagdollInfo(player.ReferenceHub, handler, model_ragdoll.transform.localPosition, model_ragdoll.transform.localRotation);
            this.ragdoll        = ragdoll;
            Map.RagdollsValue.Add(this);
            if (canBeSpawned)
            {
                Spawn();
            }
        }
    // Token: 0x060003BF RID: 959 RVA: 0x00011C90 File Offset: 0x0000FE90
    private global::Ragdoll CreateRagdoll()
    {
        global::CharacterRagdollTrait trait = base.GetTrait <global::CharacterRagdollTrait>();

        if (trait)
        {
            GameObject      gameObject = Object.Instantiate(trait.ragdollPrefab, base.transform.position, base.transform.rotation) as GameObject;
            global::Ragdoll component  = gameObject.GetComponent <global::Ragdoll>();
            component.sourceMain  = base.idMain;
            this._ragdollInstance = gameObject;
            Object.Destroy(gameObject, 80f);
            this.deathShot.LinkRagdoll(base.transform, gameObject);
            global::ArmorModelRenderer local  = base.GetLocal <global::ArmorModelRenderer>();
            global::ArmorModelRenderer local2 = component.GetLocal <global::ArmorModelRenderer>();
            if (local && local2)
            {
                local2.BindArmorModels(local.GetArmorModelMemberMapCopy());
            }
            return(component);
        }
        return(null);
    }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ragdoll"/> class.
 /// </summary>
 /// <param name="ragdoll">The encapsulated <see cref="global::Ragdoll"/>.</param>
 internal Ragdoll(global::Ragdoll ragdoll) => this.ragdoll = ragdoll;
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ragdoll"/> class.
 /// </summary>
 /// <param name="ragdoll">The encapsulated <see cref="RagDoll"/>.</param>
 internal Ragdoll(RagDoll ragdoll) => this.ragdoll = ragdoll;
Exemplo n.º 11
0
 internal Ragdoll(global::Ragdoll rag) => ragdoll = rag;