Ejemplo n.º 1
0
        public bool AttackHand(AttackHandEventArgs eventArgs)
        {
            if (!eventArgs.User.TryGetComponent(out DamageableComponent damageableComponent))
            {
                Eject();
                return(false);
            }
            if (eventArgs.User.TryGetComponent(out HeatResistanceComponent heatResistanceComponent))
            {
                if (CanBurn(heatResistanceComponent.GetHeatResistance()))
                {
                    Burn();
                    return(true);
                }
            }
            Eject();
            return(true);

            bool CanBurn(int heatResistance)
            {
                return(_lightState == LightState.On && heatResistance < LightBulb.BurningTemperature);
            }

            void Burn()
            {
                damageableComponent.TakeDamage(DamageType.Heat, 20);
            }

            void Eject()
            {
                EjectBulb(eventArgs.User);
                UpdateLight();
            }
        }
Ejemplo n.º 2
0
        public bool AttackHand(AttackHandEventArgs eventArgs)
        {
            var hands = eventArgs.User.GetComponent <IHandsComponent>();

            hands.PutInHand(this, hands.ActiveIndex, fallback: false);
            return(true);
        }
        bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
        {
            if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
            {
                return(false);
            }

            _userInterface.Open(actor.playerSession);
            return(true);
        }
        private void InteractableComponent_OnAttackHand(object sender, AttackHandEventArgs e)
        {
            if (ContainingSlot != null)
            {
                return;
            }
            var hands = e.User.GetComponent <IHandsComponent>();

            hands.PutInHand(this, e.HandIndex, fallback: false);
        }
Ejemplo n.º 5
0
 public bool AttackHand(AttackHandEventArgs eventArgs)
 {
     if (_state == DoorState.Open)
     {
         Close();
     }
     else if (_state == DoorState.Closed)
     {
         Open();
     }
     return(true);
 }
Ejemplo n.º 6
0
 bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
 {
     if (!eventArgs.User.TryGetComponent <IActorComponent>(out var actor))
     {
         return(false);
     }
     if (Status != GravityGeneratorStatus.Off && Status != GravityGeneratorStatus.On)
     {
         return(false);
     }
     OpenUserInterface(actor.playerSession);
     return(true);
 }
Ejemplo n.º 7
0
        public bool AttackHand(AttackHandEventArgs eventArgs)
        {
            if (!eventArgs.User.TryGetComponent(out DamageableComponent damageableComponent))
            {
                Eject();
                return(false);
            }
            if (eventArgs.User.TryGetComponent(out HeatResistanceComponent heatResistanceComponent))
            {
                if (CanBurn(heatResistanceComponent.GetHeatResistance()))
                {
                    Burn();
                    return(true);
                }
            }
            Eject();
            return(true);

            bool CanBurn(int heatResistance)
            {
                return(_lightState && heatResistance < LightBulb.BurningTemperature);
            }

            void Burn()
            {
                damageableComponent.TakeDamage(DamageType.Heat, 20, Owner);
                var audioSystem = _entitySystemManager.GetEntitySystem <AudioSystem>();

                audioSystem.Play("/Audio/effects/lightburn.ogg", Owner);
            }

            void Eject()
            {
                EjectBulb(eventArgs.User);
                UpdateLight();
            }
        }
        /////////
        /////////  Server-specific stuff
        /////////

        public bool AttackHand(AttackHandEventArgs eventArgs)
        {
            //TODO: remove organs?
            return(false);
        }