Ejemplo n.º 1
0
    public void ManualDrillWorkDone(Pawn driller, Building building)
    {
        var performFactor =
            ManualDrillUtility.GetPerformFactor(building, out var noWind, out var newroofFactor,
                                                out var newwindFactor);

        if (!noWind)
        {
            var statValue = driller.GetStatValue(StatDefOf.MiningSpeed) / 2f * performFactor;
            portionProgress += statValue;
            portionYieldPct += statValue * driller.GetStatValue(StatDefOf.MiningYield) /
                               WorkPerPortionCurrentDifficulty;
        }

        lastUsedTick = Find.TickManager.TicksGame;
        if (portionProgress > WorkPerPortionCurrentDifficulty)
        {
            TryManualProducePortion(portionYieldPct, building);
            portionProgress = 0f;
            portionYieldPct = 0f;
        }

        windOk     = !noWind;
        roofFactor = newroofFactor;
        windFactor = newwindFactor;
    }
Ejemplo n.º 2
0
    public override void CompTick()
    {
        base.CompTick();
        if (!drill.IsHashIntervalTick(240))
        {
            return;
        }

        ManualDrillUtility.GetPerformFactor(drill, out var noWind, out var newroofFactor, out var newwindFactor);
        windOk     = !noWind;
        roofFactor = newroofFactor;
        windFactor = newwindFactor;
    }
Ejemplo n.º 3
0
    public void ManualProspectWorkDone(Pawn driller, Building building)
    {
        var performFactor =
            ManualDrillUtility.GetPerformFactor(building, out var noWind, out var newroofFactor,
                                                out var newwindFactor);

        if (!noWind)
        {
            var statValue = driller.GetStatValue(StatDefOf.MiningSpeed) / 2f * performFactor;
            prospectProgress += statValue;
            prospectYieldPct += statValue * driller.GetStatValue(StatDefOf.MiningYield) /
                                WorkPerPortionCurrentDifficulty;
        }

        lastUsedTick = Find.TickManager.TicksGame;
        if (prospectProgress > WorkPerPortionCurrentDifficulty)
        {
            if (SetMaxCount(building, 9, out var foundDef, out var maxVal))
            {
                if (foundDef != null)
                {
                    TryManualProducePortion(prospectYieldPct, building);
                    string labelone = "Prospecting.AProspector".Translate();
                    string labeltwo = "Prospecting.Unknown".Translate();
                    if (driller.LabelShort != null)
                    {
                        labelone = driller.LabelShort;
                    }

                    if (foundDef.label != null)
                    {
                        labeltwo = foundDef.label;
                    }

                    Messages.Message(
                        "Prospecting.DrillProspect".Translate(labelone) +
                        "Prospecting.ResourceFound".Translate(labeltwo), building, MessageTypeDefOf.PositiveEvent);
                }

                maxCount = maxVal;
            }

            prospectProgress = 0f;
            prospectYieldPct = 0f;
            prospected       = true;
        }

        windOk     = !noWind;
        roofFactor = newroofFactor;
        windFactor = newwindFactor;
    }