public override bool OnHitAsProjectile(CellFace?cellFace, ComponentBody componentBody, WorldItem worldItem)
 {
     ArrowBlock.ArrowType arrowType = ArrowBlock.GetArrowType(Terrain.ExtractData(worldItem.Value));
     if (worldItem.Velocity.Length() > 10f)
     {
         float num = 0.1f;
         if (arrowType == ArrowBlock.ArrowType.FireArrow)
         {
             num = 0.5f;
         }
         if (arrowType == ArrowBlock.ArrowType.WoodenArrow)
         {
             num = 0.2f;
         }
         if (arrowType == ArrowBlock.ArrowType.DiamondArrow)
         {
             num = 0f;
         }
         if (arrowType == ArrowBlock.ArrowType.IronBolt)
         {
             num = 0.05f;
         }
         if (arrowType == ArrowBlock.ArrowType.DiamondBolt)
         {
             num = 0f;
         }
         if (m_random.Float(0f, 1f) < num)
         {
             return(true);
         }
     }
     return(false);
 }
 public override void OnFiredAsProjectile(Projectile projectile)
 {
     if (ArrowBlock.GetArrowType(Terrain.ExtractData(projectile.Value)) == ArrowBlock.ArrowType.FireArrow)
     {
         m_subsystemProjectiles.AddTrail(projectile, Vector3.Zero, new SmokeTrailParticleSystem(20, 0.5f, float.MaxValue, Color.White));
         projectile.ProjectileStoppedAction = ProjectileStoppedAction.Disappear;
         projectile.IsIncendiary            = true;
     }
 }
Ejemplo n.º 3
0
        public override int GetProcessInventoryItemCapacity(IInventory inventory, int slotIndex, int value)
        {
            int num = Terrain.ExtractContents(value);

            ArrowBlock.ArrowType arrowType = ArrowBlock.GetArrowType(Terrain.ExtractData(value));
            if (num == 192 && m_supportedArrowTypes.Contains(arrowType))
            {
                if (!BowBlock.GetArrowType(Terrain.ExtractData(inventory.GetSlotValue(slotIndex))).HasValue)
                {
                    return(1);
                }
                return(0);
            }
            return(0);
        }
Ejemplo n.º 4
0
 public override void ProcessInventoryItem(IInventory inventory, int slotIndex, int value, int count, int processCount, out int processedValue, out int processedCount)
 {
     if (processCount == 1)
     {
         ArrowBlock.ArrowType arrowType = ArrowBlock.GetArrowType(Terrain.ExtractData(value));
         int data = Terrain.ExtractData(inventory.GetSlotValue(slotIndex));
         processedValue = 0;
         processedCount = 0;
         inventory.RemoveSlotItems(slotIndex, 1);
         inventory.AddSlotItems(slotIndex, Terrain.MakeBlockValue(191, 0, BowBlock.SetArrowType(data, arrowType)), 1);
     }
     else
     {
         processedValue = value;
         processedCount = count;
     }
 }