Esempio n. 1
0
    override protected void LabourResult(int iterations)
    {
        if (iterations < 1)
        {
            return;
        }
        workflow -= iterations;
        bool materialsProblem = true;

        if (dig)
        {
            float production;
            while (iterations > 0)
            {
                iterations--;
                production = workObject.Dig(VOLUME_PER_ACTION, true, workplace.faceIndex);
                if (production == 0f)
                {
                    StopWork(true);
                    return;
                }
            }
        }
        else
        {
            while (iterations > 0)
            {
                iterations--;
                materialsProblem = colony.storage.TryGetResources(ResourceType.GetResourceTypeById(workplace.materialID), VOLUME_PER_ACTION);
                if (!materialsProblem)
                {
                    if (workObject.PourIn(VOLUME_PER_ACTION, workplace.faceIndex))
                    {
                        StopWork(true);
                    }
                    return;
                }
                else
                {
                    break;
                }
            }
        }
        if (dig)
        {
            actionLabel = Localization.GetActionLabel(LocalizationActionLabels.DigInProgress) + " (" + ((int)((1 - workObject.GetVolumePercent()) * 100f)).ToString() + "%)";
        }
        else
        {
            if (!materialsProblem)
            {
                actionLabel = Localization.GetActionLabel(LocalizationActionLabels.PouringInProgress) + " (" + ((int)(workObject.GetVolumePercent() * 100f)).ToString() + "%)";
            }
            else
            {
                actionLabel = Localization.GetAnnouncementString(GameAnnouncements.NotEnoughResources);
            }
        }
    }
Esempio n. 2
0
    void LabourResult()
    {
        int   x          = (int)workflow;
        float production = x;

        if (dig)
        {
            production = workObject.Dig(x, true, workplace.faceIndex);
            if (production == 0f)
            {
                StopWork(true);
                return;
            }
        }
        else
        {
            production = workObject.PourIn(x, workplace.faceIndex);
            if (production != 0)
            {
                production = workObject.PourIn((int)production, workplace.faceIndex);
                if (production == 0)
                {
                    StopWork(true); return;
                }
            }
        }
        workflow -= production;
        if (dig)
        {
            actionLabel = Localization.GetActionLabel(LocalizationActionLabels.DigInProgress) + " (" + ((int)((1 - workObject.GetVolumePercent()) * 100f)).ToString() + "%)";
        }
        else
        {
            actionLabel = Localization.GetActionLabel(LocalizationActionLabels.PouringInProgress) + " (" + ((int)(workObject.GetVolumePercent() * 100f)).ToString() + "%)";
        }
    }