Exemple #1
0
        protected override List <Lifetime> CreateLifetimes(ModifierInfo modifierInfo)
        {
            RagdollInfo ri = (RagdollInfo)modifierInfo;

            lifetime = new UnpredictableDurationLifetime();
            return(new List <Lifetime>(new[] { lifetime }));
        }
Exemple #2
0
        private void CalculateDurations(RagdollInfo ri)
        {
            RagdollModifierConfig rmc = ri.RagdollModifierConfig;

            timeUntilFall         = rmc.timeToGrab - ri.ProjectileAge;
            timeUntilGround       = timeUntilFall + rmc.timeToFall;
            timeUntilReturnToIdle = timeUntilGround + rmc.timeToLie;
            duration = timeUntilReturnToIdle + rmc.lieToIdleDuration;
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpawningRagdollEventArgs"/> class.
 /// </summary>
 /// <param name="ragdollInfo"><inheritdoc cref="Info"/></param>
 /// <param name="damageHandlerBase"><inheritdoc cref="DamageHandlerBase"/></param>
 /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param>
 public SpawningRagdollEventArgs(
     RagdollInfo ragdollInfo,
     DamageHandlerBase damageHandlerBase,
     bool isAllowed = true)
 {
     Info = ragdollInfo;
     DamageHandlerBase = damageHandlerBase;
     Owner             = Player.Get(ragdollInfo.OwnerHub);
     IsAllowed         = isAllowed;
 }
        public void OnSpawningRagdoll(SpawningRagdollEventArgs ev)
        {
            if (!API.IsSerpent(ev.Owner))
            {
                return;
            }

            ev.IsAllowed = false;

            RagdollInfo info = new RagdollInfo(Server.Host.ReferenceHub, ev.DamageHandlerBase, ev.Role, ev.Position, ev.Rotation, ev.Nickname, ev.CreationTime);

            new Exiled.API.Features.Ragdoll(info, true);
        }
Exemple #5
0
 private void OnDying(DyingEventArgs ev)
 {
     if (Check(ev.Killer) && !Check(ev.Target))
     {
         IncreasePower(ev.Killer);
     }
     else if (Check(ev.Target))
     {
         Log.Warn($"Adding {ev.Target.Nickname} to stop doll list.");
         Plugin.Singleton.StopRagdollList.Add(ev.Target);
         RagdollInfo info = new RagdollInfo(ev.Target.ReferenceHub, ev.Handler.Base, Role, ev.Target.Position,
                                            Quaternion.Euler(ev.Target.Rotation), ev.Target.Nickname, NetworkTime.time);
         Ragdoll.Spawn(info);
     }
 }
Exemple #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();
            }
        }
Exemple #7
0
        public RagdollModifier(ModifierInfo info, Entity casterEntity, Entity targetEntity,
                               Camera camera, SkillId skillId, Environment environment,
                               CollectionOfInteractions modifierInteractionCollection,
                               WallHitConfig wallHitConfig, float damageScale,
                               ProjectileComponent projectile) : base(info, casterEntity, targetEntity, environment, modifierInteractionCollection)
        {
            this.casterEntity = casterEntity;
            this.targetEntity = targetEntity;
            this.camera       = camera;
            this.skillId      = skillId;
            this.environment  = environment;
            this.whc          = wallHitConfig;
            this.damageScale  = damageScale;
            this.projectile   = projectile;
            this.info         = (RagdollInfo)info;

            easingFunc = EasingFunctions.GetEasingFunction(EasingFunctions.Functions.EaseOutQuad);
            CalculateDurations(this.info);
            switch (this.info.RagdollModifierConfig.ShowAnimationProfile())
            {
            case BlastModifierConfig.AnimationProfile.Far:
                animProfile = new FarAnimProfile();
                break;

            case BlastModifierConfig.AnimationProfile.High:
                animProfile = new HighAnimProfile();
                break;

            case BlastModifierConfig.AnimationProfile.Medium:
                animProfile = new MediumAnimProfile();
                break;
            }
            targetCharacter = targetEntity.GetComponent <SkillComponent>().Character;
            StatsComponent casterStatsComponent = casterEntity.GetComponent <StatsComponent>();

            characterStats = casterStatsComponent.CharacterStats;
            //DLog.Log("RagdollModifier: state: " + state);
        }