public override void TransformValue(StatRequest req, ref float val)
 {
     if (req.HasThing && StatPart_WorkTableOutdoors.Applies(req.Thing))
     {
         val *= 0.8f;
     }
 }
Example #2
0
        public override void PostPlace(Map map, BuildableDef def, IntVec3 loc, Rot4 rot)
        {
            ThingDef thingDef = def as ThingDef;

            if (thingDef == null)
            {
                return;
            }
            bool flag  = StatPart_WorkTableOutdoors.Applies(thingDef, map, loc);
            bool flag2 = StatPart_WorkTableTemperature.Applies(thingDef, map, loc);

            if (!(flag | flag2))
            {
                return;
            }
            string str  = "WillGetWorkSpeedPenalty".Translate(def.label).CapitalizeFirst() + ": ";
            string text = "";

            if (flag)
            {
                text += "Outdoors".Translate();
            }
            if (flag2)
            {
                if (!text.NullOrEmpty())
                {
                    text += ", ";
                }
                text += "BadTemperature".Translate();
            }
            Messages.Message(str + text.CapitalizeFirst() + ".", new TargetInfo(loc, map), MessageTypeDefOf.CautionInput, historical: false);
        }
Example #3
0
        public override void PostPlace(Map map, BuildableDef def, IntVec3 loc, Rot4 rot)
        {
            ThingDef thingDef = def as ThingDef;

            if (thingDef != null)
            {
                bool flag  = StatPart_WorkTableOutdoors.Applies(thingDef, map, loc);
                bool flag2 = StatPart_WorkTableTemperature.Applies(thingDef, map, loc);
                if (flag || flag2)
                {
                    string text = "WillGetWorkSpeedPenalty".Translate(new object[]
                    {
                        def.label
                    }).CapitalizeFirst() + ": ";
                    string text2 = "";
                    if (flag)
                    {
                        text2 += "Outdoors".Translate();
                    }
                    if (flag2)
                    {
                        if (!text2.NullOrEmpty())
                        {
                            text2 += ", ";
                        }
                        text2 += "BadTemperature".Translate();
                    }
                    text += text2.CapitalizeFirst();
                    text += ".";
                    Messages.Message(text, new TargetInfo(loc, map, false), MessageTypeDefOf.CautionInput, false);
                }
            }
        }
        public override string CompInspectStringExtra()
        {
            bool flag  = StatPart_WorkTableOutdoors.Applies(this.parent.def, this.parent.Map, this.parent.Position);
            bool flag2 = StatPart_WorkTableTemperature.Applies(this.parent);
            bool flag3 = StatPart_WorkTableUnpowered.Applies(this.parent);

            if (flag || flag2 || flag3)
            {
                string str  = "WorkSpeedPenalty".Translate() + ": ";
                string text = string.Empty;
                if (flag)
                {
                    text += "Outdoors".Translate().ToLower();
                }
                if (flag2)
                {
                    if (!text.NullOrEmpty())
                    {
                        text += ", ";
                    }
                    text += "BadTemperature".Translate().ToLower();
                }
                if (flag3)
                {
                    if (!text.NullOrEmpty())
                    {
                        text += ", ";
                    }
                    text += "NoPower".Translate().ToLower();
                }
                return(str + text.CapitalizeFirst());
            }
            return(null);
        }
        public override void PostPlace(Map map, BuildableDef def, IntVec3 loc, Rot4 rot)
        {
            ThingDef thingDef = def as ThingDef;

            if (thingDef != null)
            {
                bool flag  = StatPart_WorkTableOutdoors.Applies(thingDef, map, loc);
                bool flag2 = StatPart_WorkTableTemperature.Applies(thingDef, map, loc);
                if (!flag && !flag2)
                {
                    return;
                }
                string str = "WillGetWorkSpeedPenalty".Translate(def.label).CapitalizeFirst() + ": ";
                if (flag)
                {
                    str += "Outdoors".Translate().CapitalizeFirst();
                }
                if (flag2)
                {
                    if (flag)
                    {
                        str += ", ";
                    }
                    str += "BadTemperature".Translate().CapitalizeFirst();
                }
                str += ".";
                Messages.Message(str, MessageTypeDefOf.CautionInput);
            }
        }
 public override string ExplanationPart(StatRequest req)
 {
     if (req.HasThing && StatPart_WorkTableOutdoors.Applies(req.Thing))
     {
         return("Outdoors".Translate() + ": x" + 0.8f.ToStringPercent());
     }
     return(null);
 }
        public override string ExplanationPart(StatRequest req)
        {
            string result;

            if (req.HasThing && StatPart_WorkTableOutdoors.Applies(req.Thing))
            {
                result = "Outdoors".Translate() + ": x" + 0.9f.ToStringPercent();
            }
            else
            {
                result = null;
            }
            return(result);
        }
Example #8
0
        public override string CompInspectStringExtra()
        {
            bool flag  = StatPart_WorkTableOutdoors.Applies(base.parent.def, base.parent.Map, base.parent.Position);
            bool flag2 = StatPart_WorkTableTemperature.Applies(base.parent);
            bool flag3 = StatPart_WorkTableUnpowered.Applies(base.parent);

            if (!flag && !flag2 && !flag3)
            {
                return(null);
            }
            string text  = "WorkSpeedPenalty".Translate() + ": ";
            bool   flag4 = false;

            if (flag)
            {
                text += "Outdoors".Translate().ToLower();
                flag4 = true;
            }
            if (flag2)
            {
                if (flag4)
                {
                    text += ", ";
                }
                text += "BadTemperature".Translate().ToLower();
                flag4 = true;
            }
            if (flag3)
            {
                if (flag4)
                {
                    text += ", ";
                }
                text += "NoPower".Translate().ToLower();
            }
            return(text);
        }
 public static bool Applies(Thing t)
 {
     return(StatPart_WorkTableOutdoors.Applies(t.def, t.Map, t.Position));
 }
        public override string CompInspectStringExtra()
        {
            if (parent.def.statBases == null)
            {
                return(null);
            }
            bool flag  = false;
            bool flag2 = false;
            bool flag3 = false;

            foreach (StatDef item in DefDatabase <StatDef> .AllDefsListForReading)
            {
                if (item != null && item.parts != null && !item.Worker.IsDisabledFor(parent))
                {
                    foreach (StatPart part in item.parts)
                    {
                        if (part is StatPart_WorkTableOutdoors || part is StatPart_Outdoors)
                        {
                            flag = true;
                        }
                        else if (part is StatPart_WorkTableTemperature)
                        {
                            flag2 = true;
                        }
                        else if (part is StatPart_WorkTableUnpowered)
                        {
                            flag3 = true;
                        }
                    }
                }
            }
            bool flag4 = flag && StatPart_WorkTableOutdoors.Applies(parent.def, parent.Map, parent.Position);
            bool flag5 = flag2 && StatPart_WorkTableTemperature.Applies(parent);
            bool flag6 = flag3 && StatPart_WorkTableUnpowered.Applies(parent);

            if (flag4 | flag5 | flag6)
            {
                string str  = "WorkSpeedPenalty".Translate() + ": ";
                string text = "";
                if (flag4)
                {
                    text += "Outdoors".Translate().ToLower();
                }
                if (flag5)
                {
                    if (!text.NullOrEmpty())
                    {
                        text += ", ";
                    }
                    text += "BadTemperature".Translate().ToLower();
                }
                if (flag6)
                {
                    if (!text.NullOrEmpty())
                    {
                        text += ", ";
                    }
                    text += "NoPower".Translate().ToLower();
                }
                return(str + text.CapitalizeFirst());
            }
            return(null);
        }