// Token: 0x06000346 RID: 838 RVA: 0x000101A0 File Offset: 0x0000E3A0
    public float CalculateExposure(bool countArmor)
    {
        if (this.radiationZones == null || this.radiationZones.Count == 0)
        {
            return(0f);
        }
        Vector3 origin = base.origin;
        float   num    = 0f;

        foreach (global::RadiationZone radiationZone in this.radiationZones)
        {
            num += radiationZone.GetExposureForPos(origin);
        }
        if (countArmor)
        {
            global::HumanBodyTakeDamage humanBodyTakeDamage = base.takeDamage as global::HumanBodyTakeDamage;
            if (humanBodyTakeDamage)
            {
                float armorValue = humanBodyTakeDamage.GetArmorValue(4);
                if (armorValue > 0f)
                {
                    num *= 1f - Mathf.Clamp(armorValue / 200f, 0f, 1f);
                }
            }
        }
        return(num);
    }
    // Token: 0x06003377 RID: 13175 RVA: 0x000C1880 File Offset: 0x000BFA80
    public virtual void UseItem(global::IConsumableItem item)
    {
        global::Inventory  inventory = item.inventory;
        global::Metabolism local     = inventory.GetLocal <global::Metabolism>();

        if (local == null)
        {
            return;
        }
        if (!local.CanConsumeYet())
        {
            return;
        }
        local.MarkConsumptionTime();
        float numCalories = Mathf.Min(local.GetRemainingCaloricSpace(), this.calories);

        if (this.calories > 0f)
        {
            local.AddCalories(numCalories);
        }
        if (this.litresOfWater > 0f)
        {
            local.AddWater(this.litresOfWater);
        }
        if (this.antiRads > 0f)
        {
            local.AddAntiRad(this.antiRads);
        }
        if (this.healthToHeal != 0f)
        {
            global::HumanBodyTakeDamage local2 = inventory.GetLocal <global::HumanBodyTakeDamage>();
            if (local2 != null)
            {
                if (this.healthToHeal > 0f)
                {
                    local2.HealOverTime(this.healthToHeal);
                }
                else
                {
                    global::TakeDamage.HurtSelf(inventory.idMain, Mathf.Abs(this.healthToHeal), null);
                }
            }
        }
        if (this.poisonAmount > 0f)
        {
            local.AddPoison(this.poisonAmount);
        }
        int num = 1;

        if (item.Consume(ref num))
        {
            inventory.RemoveItem(item.slot);
        }
    }
Ejemplo n.º 3
0
    // Token: 0x060038B7 RID: 14519 RVA: 0x000C95C8 File Offset: 0x000C77C8
    public virtual bool CanBandage()
    {
        global::HumanBodyTakeDamage component = base.inventory.gameObject.GetComponent <global::HumanBodyTakeDamage>();

        if (!component.IsBleeding())
        {
            if (component.healthLossFraction > 0f)
            {
                T datablock = this.datablock;
                if (datablock.DoesGiveBlood())
                {
                    goto IL_45;
                }
            }
            return(false);
        }
IL_45:
        return(Time.time - this.lastBandageTime > 1.5f);
    }
Ejemplo n.º 4
0
    // Token: 0x06003268 RID: 12904 RVA: 0x000BF72C File Offset: 0x000BD92C
    public virtual void UseItem(global::IBloodDrawItem draw)
    {
        if (Time.time < draw.lastUseTime + 2f)
        {
            return;
        }
        global::Inventory           inventory = draw.inventory;
        global::HumanBodyTakeDamage local     = inventory.GetLocal <global::HumanBodyTakeDamage>();

        if (local.health <= this.bloodToTake)
        {
            return;
        }
        IDMain idMain = inventory.idMain;

        global::TakeDamage.Hurt(idMain, idMain, this.bloodToTake, null);
        inventory.AddItem(ref global::BloodDrawDatablock.LateLoaded.blood, global::Inventory.Slot.Preference.Define(global::Inventory.Slot.Kind.Default, true, global::Inventory.Slot.KindFlags.Belt), 1);
        draw.lastUseTime = Time.time;
    }