Пример #1
0
        public virtual void MakeLeafless(LeaflessCause cause)
        {
            bool changed = !LeaflessNow;
            var  map     = Map; // before applying damage

            if (cause == LeaflessCause.Poison && def.plant.leaflessGraphic == null)
            {
                //Poisoned a plant without a leafless graphic - we have to kill it

                if (IsCrop)
                {
                    if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + def.defName, 240f))
                    {
                        Messages.Message("MessagePlantDiedOfPoison".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(Position, map), MessageTypeDefOf.NegativeEvent);
                    }
                }

                TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999));
            }
            else if (def.plant.dieIfLeafless)
            {
                //Plant dies if ever leafless

                if (IsCrop)
                {
                    if (cause == LeaflessCause.Cold)
                    {
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfCold-" + def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfCold".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(Position, map), MessageTypeDefOf.NegativeEvent);
                        }
                    }
                    else if (cause == LeaflessCause.Poison)
                    {
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfPoison".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(Position, map), MessageTypeDefOf.NegativeEvent);
                        }
                    }
                }

                TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999));
            }
            else
            {
                //Just become visually leafless
                madeLeaflessTick = Find.TickManager.TicksGame;
            }

            if (changed)
            {
                map.mapDrawer.MapMeshDirty(Position, MapMeshFlag.Things);
            }
        }
Пример #2
0
        public virtual void MakeLeafless(LeaflessCause cause)
        {
            bool flag = !this.LeaflessNow;
            Map  map  = base.Map;

            if (cause == LeaflessCause.Poison && base.def.plant.leaflessGraphic == null)
            {
                if (this.IsCrop && MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + base.def.defName, 240f))
                {
                    Messages.Message("MessagePlantDiedOfPoison".Translate(this.Label).CapitalizeFirst(), new TargetInfo(base.Position, map, false), MessageTypeDefOf.NegativeEvent);
                }
                base.TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown));
            }
            else if (base.def.plant.dieIfLeafless)
            {
                if (this.IsCrop)
                {
                    switch (cause)
                    {
                    case LeaflessCause.Cold:
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfCold-" + base.def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfCold".Translate(this.Label).CapitalizeFirst(), new TargetInfo(base.Position, map, false), MessageTypeDefOf.NegativeEvent);
                        }
                        break;

                    case LeaflessCause.Poison:
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + base.def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfPoison".Translate(this.Label).CapitalizeFirst(), new TargetInfo(base.Position, map, false), MessageTypeDefOf.NegativeEvent);
                        }
                        break;
                    }
                }
                base.TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown));
            }
            else
            {
                this.madeLeaflessTick = Find.TickManager.TicksGame;
            }
            if (flag)
            {
                map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Things);
            }
        }
Пример #3
0
        public virtual void MakeLeafless(LeaflessCause cause)
        {
            bool flag = !LeaflessNow;
            Map  map  = base.Map;

            if (cause == LeaflessCause.Poison && def.plant.leaflessGraphic == null)
            {
                if (IsCrop && MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + def.defName, 240f))
                {
                    Messages.Message("MessagePlantDiedOfPoison".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(base.Position, map), MessageTypeDefOf.NegativeEvent);
                }
                TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999f));
            }
            else if (def.plant.dieIfLeafless)
            {
                if (IsCrop)
                {
                    switch (cause)
                    {
                    case LeaflessCause.Cold:
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfCold-" + def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfCold".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(base.Position, map), MessageTypeDefOf.NegativeEvent);
                        }
                        break;

                    case LeaflessCause.Poison:
                        if (MessagesRepeatAvoider.MessageShowAllowed("MessagePlantDiedOfPoison-" + def.defName, 240f))
                        {
                            Messages.Message("MessagePlantDiedOfPoison".Translate(GetCustomLabelNoCount(includeHp: false)).CapitalizeFirst(), new TargetInfo(base.Position, map), MessageTypeDefOf.NegativeEvent);
                        }
                        break;
                    }
                }
                TakeDamage(new DamageInfo(DamageDefOf.Rotting, 99999f));
            }
            else
            {
                madeLeaflessTick = Find.TickManager.TicksGame;
            }
            if (flag)
            {
                map.mapDrawer.MapMeshDirty(base.Position, MapMeshFlag.Things);
            }
        }
Пример #4
0
 public override void MakeLeafless(LeaflessCause cause)
 {
     return;
 }