コード例 #1
0
 public void SetHandled(SuicideKind kind)
 {
     if (Handled)
     {
         throw new InvalidOperationException("Suicide was already handled");
     }
     Kind = kind;
 }
コード例 #2
0
ファイル: ChatCommands.cs プロジェクト: zamp/space-station-14
        private void DealDamage(ISuicideAct suicide, IChatManager chat, DamageableComponent damageableComponent, IEntity source, IEntity target)
        {
            SuicideKind kind = suicide.Suicide(target, chat);

            if (kind != SuicideKind.Special)
            {
                damageableComponent.TakeDamage(kind switch
                {
                    SuicideKind.Brute => DamageType.Brute,
                    SuicideKind.Heat => DamageType.Heat,
                    SuicideKind.Cold => DamageType.Cold,
                    SuicideKind.Acid => DamageType.Acid,
                    SuicideKind.Toxic => DamageType.Toxic,
                    SuicideKind.Electric => DamageType.Electric,
                    _ => DamageType.Brute
                },
コード例 #3
0
        private void DealDamage(ISuicideAct suicide, IChatManager chat, IDamageableComponent damageableComponent, IEntity source, IEntity target)
        {
            SuicideKind kind = suicide.Suicide(target, chat);

            if (kind != SuicideKind.Special)
            {
                damageableComponent.ChangeDamage(kind switch
                {
                    SuicideKind.Blunt => DamageType.Blunt,
                    SuicideKind.Piercing => DamageType.Piercing,
                    SuicideKind.Heat => DamageType.Heat,
                    SuicideKind.Disintegration => DamageType.Disintegration,
                    SuicideKind.Cellular => DamageType.Cellular,
                    SuicideKind.DNA => DamageType.DNA,
                    SuicideKind.Asphyxiation => DamageType.Asphyxiation,
                    _ => DamageType.Blunt
                },
コード例 #4
0
        private void ApplyDeath(EntityUid target, SuicideKind kind)
        {
            if (kind == SuicideKind.Special)
            {
                return;
            }

            if (!_prototypeManager.TryIndex <DamageTypePrototype>(kind.ToString(), out var damagePrototype))
            {
                const SuicideKind fallback = SuicideKind.Blunt;
                Logger.Error(
                    $"{nameof(SuicideSystem)} could not find the damage type prototype associated with {kind}. Falling back to {fallback}");
                damagePrototype = _prototypeManager.Index <DamageTypePrototype>(fallback.ToString());
            }
            const int lethalAmountOfDamage = 200; // TODO: Would be nice to get this number from somewhere else

            _damageableSystem.TryChangeDamage(target, new(damagePrototype, lethalAmountOfDamage), true);
        }
コード例 #5
0
        private void DealDamage(ISuicideAct suicide, IChatManager chat, IDamageableComponent damageableComponent, IEntity source, IEntity target)
        {
            SuicideKind kind = suicide.Suicide(target, chat);

            if (kind != SuicideKind.Special)
            {
                damageableComponent.ChangeDamage(kind switch
                {
                    SuicideKind.Blunt => DamageType.Blunt,
                    SuicideKind.Slash => DamageType.Slash,
                    SuicideKind.Piercing => DamageType.Piercing,
                    SuicideKind.Heat => DamageType.Heat,
                    SuicideKind.Shock => DamageType.Shock,
                    SuicideKind.Cold => DamageType.Cold,
                    SuicideKind.Poison => DamageType.Poison,
                    SuicideKind.Radiation => DamageType.Radiation,
                    SuicideKind.Asphyxiation => DamageType.Asphyxiation,
                    SuicideKind.Bloodloss => DamageType.Bloodloss,
                    _ => DamageType.Blunt
                },