Ejemplo n.º 1
0
        // Token: 0x0600567B RID: 22139 RVA: 0x001CE8D0 File Offset: 0x001CCAD0
        public static bool CanUseConsideringQueuedJobs(Pawn pawn, ThingWithComps gear, bool showMessage = true)
        {
            CompTurret compReloadable = gear.TryGetCompFast <CompTurret>();

            if (compReloadable == null)
            {
                return(true);
            }
            string text = null;

            if (!Event.current.shift)
            {
                if (!compReloadable.CanBeUsed)
                {
                    text = compReloadable.DisabledReason(compReloadable.MinAmmoNeeded(false), compReloadable.MaxAmmoNeeded(false));
                }
            }
            else if (CompTurretReloadableUtility.TotalChargesFromQueuedJobs(pawn, gear) + 1 > compReloadable.RemainingCharges)
            {
                text = compReloadable.DisabledReason(compReloadable.MaxAmmoAmount(), compReloadable.MaxAmmoAmount());
            }
            if (text != null)
            {
                if (showMessage)
                {
                    Messages.Message(text, pawn, MessageTypeDefOf.RejectInput, false);
                }
                return(false);
            }
            return(true);
        }