Пример #1
0
        public override void Spawn()
        {
            base.Spawn();

            var animKnife = new AnimEntity();

            animKnife.SetModel("content/models/knife_mesh.vmdl");
            animKnife.Parent   = this;
            animKnife.Position = Position;

            Knife = animKnife;
        }
Пример #2
0
    void BecomeRagdollOnClient()
    {
        var ent = new AnimEntity();

        ent.WorldPos            = WorldPos;
        ent.WorldRot            = WorldRot;
        ent.MoveType            = MoveType.Physics;
        ent.UsePhysicsCollision = true;
        ent.EnableAllCollisions = true;
        ent.CollisionGroup      = CollisionGroup.Debris;
        ent.SetModel(GetModelName());
        ent.CopyBonesFrom(this);
        ent.SetRagdollVelocityFrom(this, 0.1f, 1, 1);
        ent.EnableHitboxes        = true;
        ent.EnableAllCollisions   = true;
        ent.SurroundingBoundsMode = SurroundingBoundsType.Physics;

        foreach (var child in Children)
        {
            if (child is ModelEntity e)
            {
                var model = e.GetModelName();
                if (model != null && !model.Contains("clothes"))
                {
                    continue;
                }

                var clothing = new ModelEntity();
                clothing.SetModel(model);
                clothing.SetParent(ent, true);
            }
        }

        Corpse = ent;

        RagdollLimit.Watch(ent);
    }