Ejemplo n.º 1
0
    public void MergeFrom(pb::CodedInputStream input)
    {
        uint tag;

        while ((tag = input.ReadTag()) != 0)
        {
            switch (tag)
            {
            default:
                _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                break;

            case 8: {
                Error = input.ReadInt32();
                break;
            }

            case 16: {
                Uid = input.ReadInt32();
                break;
            }

            case 24: {
                role_ = (global::Role)input.ReadEnum();
                break;
            }
            }
        }
    }
Ejemplo 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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Spawns a ragdoll on the map based on the different arguments.
        /// </summary>
        /// <remarks>
        /// Tip: You can do, for example, '<paramref name="velocity"/>: "Vector3.up * 3"' to skip parameters.
        /// </remarks>
        /// <example>
        /// <code>
        /// // Code to spawn a fake ragdoll
        /// if (ev.Player == MyPlugin.TheInmortalPlayer)
        /// {
        ///     var fakeRagdoll = Map.SpawnRagdoll(ev.Player.Role, ev.Player.Position, victimNick: ev.Player.DisplayNickname, playerId: ev.Player.Id);
        /// }
        /// </code>
        /// </example>
        /// <param name="roleType">The <see cref="RoleType"/> to use as ragdoll.</param>
        /// <param name="victimNick">The name from the victim, who the corpse belongs to.</param>
        /// <param name="hitInfo">The <see cref="PlayerStats.HitInfo"/> that displays who killed this ragdoll, and using which tool.</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>
        /// <param name="playerId">Used for recall. The <see cref="Player.Id"/> to be recalled.</param>
        /// <param name="mirrorOwnerId">Can be ignored. The <see cref="Dissonance.Integrations.MirrorIgnorance.MirrorIgnorancePlayer"/>'s PlayerId field, likely used in the client.</param>
        /// <returns>The Ragdoll component (requires Assembly-CSharp to be referenced).</returns>
        public static global::Ragdoll SpawnRagdoll(
            RoleType roleType,
            string victimNick,
            global::PlayerStats.HitInfo hitInfo,
            Vector3 position,
            Quaternion rotation  = default,
            Vector3 velocity     = default,
            bool allowRecall     = false,
            int playerId         = -1,
            string mirrorOwnerId = null)
        {
            global::Role role = CharacterClassManager._staticClasses.SafeGet(roleType);

            // Check if there's no ragdoll for this class, or if the class is invalid
            if (role.model_ragdoll == null)
            {
                return(null);
            }
            var @default = DefaultRagdollOwner;

            var ragdollInfo = new Ragdoll.Info()
            {
                ownerHLAPI_id = mirrorOwnerId != null ? mirrorOwnerId : @default.ownerHLAPI_id,
                PlayerId      = playerId,
                DeathCause    = hitInfo != default ? hitInfo : @default.DeathCause,
                ClassColor    = role.classColor,
                FullName      = role.fullName,
                Nick          = victimNick,
            };

            return(SpawnRagdoll(role, ragdollInfo, position, rotation, velocity, allowRecall));
        }
Ejemplo n.º 4
0
    public void MergeFrom(pb::CodedInputStream input)
    {
        uint tag;

        while ((tag = input.ReadTag()) != 0)
        {
            switch (tag)
            {
            default:
                _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                break;

            case 8: {
                Gate = input.ReadInt32();
                break;
            }

            case 18: {
                if (role_ == null)
                {
                    Role = new global::Role();
                }
                input.ReadMessage(Role);
                break;
            }
            }
        }
    }
Ejemplo n.º 5
0
 public void MergeFrom(ChangeRoleC2S other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Role != 0)
     {
         Role = other.Role;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Ejemplo n.º 6
0
    public void MergeFrom(pb::CodedInputStream input)
    {
        uint tag;

        while ((tag = input.ReadTag()) != 0)
        {
            switch (tag)
            {
            default:
                _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                break;

            case 8: {
                PlayerId = input.ReadInt32();
                break;
            }

            case 18: {
                UserName = input.ReadString();
                break;
            }

            case 24: {
                role_ = (global::Role)input.ReadEnum();
                break;
            }

            case 32: {
                IsReady = input.ReadBool();
                break;
            }

            case 40: {
                Runes = input.ReadInt32();
                break;
            }

            case 48: {
                Faction = input.ReadInt32();
                break;
            }
            }
        }
    }
Ejemplo n.º 7
0
 public void MergeFrom(ChangeRoleS2C other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Error != 0)
     {
         Error = other.Error;
     }
     if (other.Uid != 0)
     {
         Uid = other.Uid;
     }
     if (other.Role != 0)
     {
         Role = other.Role;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Ejemplo n.º 8
0
 public void MergeFrom(RoleEnterNTF other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Gate != 0)
     {
         Gate = other.Gate;
     }
     if (other.role_ != null)
     {
         if (role_ == null)
         {
             Role = new global::Role();
         }
         Role.MergeFrom(other.Role);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Ejemplo n.º 9
0
 public void MergeFrom(RoleEnterResp other) {
   if (other == null) {
     return;
   }
   if (other.Success != false) {
     Success = other.Success;
   }
   if (other.MapID != 0) {
     MapID = other.MapID;
   }
   if (other.role_ != null) {
     if (role_ == null) {
       Role = new global::Role();
     }
     Role.MergeFrom(other.Role);
   }
   if (other.WorldID != 0) {
     WorldID = other.WorldID;
   }
   _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }