public static void _WriteInfo_Ragdoll(NetworkWriter writer, Ragdoll.Info value)
 {
     writer.Write(value.ownerHLAPI_id);
     writer.Write(value.steamClientName);
     GeneratedNetworkCode._WriteHitInfo_PlayerStats(writer, value.deathCause);
     writer.WritePackedUInt32((uint)value.charclass);
 }
Пример #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);
        }
Пример #3
0
 public void SetOwner(Ragdoll.Info s)
 {
     this.Networkowner = s;
 }