public override void PostDeSpawn() { base.PostDeSpawn(); IncidentDef incidentDef = DefDatabase <IncidentDef> .GetNamed("SolarFlare"); MapConditionDef mapConditionDef = DefDatabase <MapConditionDef> .GetNamed("SolarFlare"); if (incidentDef.mapCondition != mapConditionDef) { incidentDef.mapCondition = mapConditionDef; DefDatabase <IncidentDef> .ResolveAllReferences(); Log.Message("RT_SolarFlareShield: restored MapCondition for SolarFlare."); } MapCondition mapCondition = Find.MapConditionManager.GetActiveCondition( DefDatabase <MapConditionDef> .GetNamed("MapCondition_RTSolarFlare")); if (mapCondition != null) { int ticksToExpire = mapCondition.TicksLeft; mapCondition.duration = mapCondition.TicksPassed - 1; Find.MapConditionManager.RegisterCondition(MapConditionMaker.MakeCondition( MapConditionDefOf.SolarFlare, ticksToExpire)); } }
private void FireVisit() { var visitConditionDef = DefDatabase <MapConditionDef> .GetNamed("MTW_AncestralVisit"); MapCondition cond = MapConditionMaker.MakeCondition(visitConditionDef, this.DurationTicks, 0); Find.MapConditionManager.RegisterCondition(cond); }
private void SolarFlareShieldTick(int tickAmount) { if ((Find.TickManager.TicksGame) % tickAmount == 0) { MapCondition mapCondition = Find.MapConditionManager.GetActiveCondition( DefDatabase <MapConditionDef> .GetNamed("MapCondition_RTSolarFlare")); CompPowerTrader compPowerTrader = parent.TryGetComp <CompPowerTrader>(); if (compPowerTrader != null && compPowerTrader.PowerOn) { if (mapCondition != null) { compPowerTrader.PowerOutput = -shieldingPowerDrain; rotatorAngle += rotatorSpeedActive * tickAmount; Room room = parent.GetRoom(); if (room != null && !room.UsesOutdoorTemperature) { room.Temperature += heatingPerTick; } List <Building_CommsConsole> commsConsoles = Find.ListerBuildings.AllBuildingsColonistOfClass <Building_CommsConsole>().ToList(); foreach (Building_CommsConsole commsConsole in commsConsoles) { CompPowerTrader consoleCompPowerTrader = commsConsole.TryGetComp <CompPowerTrader>(); if (consoleCompPowerTrader != null) { consoleCompPowerTrader.PowerOn = false; } } } else { compPowerTrader.PowerOutput = -parent.def .GetCompProperties <CompProperties_Power>().basePowerConsumption; rotatorAngle += rotatorSpeedIdle * tickAmount; } } else if (mapCondition != null) { int ticksToExpire = mapCondition.TicksLeft; mapCondition.duration = mapCondition.TicksPassed - 1; Find.MapConditionManager.RegisterCondition(MapConditionMaker.MakeCondition( MapConditionDefOf.SolarFlare, ticksToExpire)); } } }
public override bool TryExecute(IncidentParms parms) { IntVec3 intVec; Map map = (Map)parms.target; if (!RCellFinder.TryFindRandomPawnEntryCell(out intVec, map)) { return(false); } PawnKindDef feenix = PawnKindDef.Named("Fluffy_Icicat"); IntVec3 invalid = IntVec3.Invalid; if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(intVec, map, 10f, out invalid)) { invalid = IntVec3.Invalid; } IntVec3 loc = CellFinder.RandomClosewalkCellNear(intVec, map, 10); Pawn pawn = PawnGenerator.GeneratePawn(feenix, null); GenSpawn.Spawn(pawn, loc, map); int duration = Rand.RangeInclusive(90000, 150000); map.mapConditionManager.RegisterCondition(MapConditionMaker.MakeCondition(def.mapCondition, duration)); pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + duration; if (invalid.IsValid) { pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(invalid, map, 10); } Find.LetterStack.ReceiveLetter("LetterLabelIcicatPasses".Translate(new object[] { feenix.label }).CapitalizeFirst(), "LetterIcicatPasses".Translate(new object[] { feenix.label }), LetterType.Good, pawn, null); return(true); }
protected override void DoConditionAndLetter(Map map, int duration, Gender gender) { MapCondition_CorruptiveDrone MapCondition_corruptiveDrone = (MapCondition_CorruptiveDrone)MapConditionMaker.MakeCondition(C_MapConditionDefOf.CorruptiveDrone, duration, 0); map.mapConditionManager.RegisterCondition(MapCondition_corruptiveDrone); string text = "LetterIncidentCorruptiveDrone".Translate(); Find.LetterStack.ReceiveLetter("LetterLabelCorruptiveDrone".Translate(), text, LetterType.BadNonUrgent, null); }
private void InitializeTitheCollection() { Tithes.MapCondition_TitheCollectors condition = (Tithes.MapCondition_TitheCollectors)MapConditionMaker.MakeCondition(C_MapConditionDefOf.TitheCollectorArrived, 420000, 0); if (this.PlanetaryGovernor == null) { Log.Error("Initiated Tithe Collection with no Planetary Governor assigned"); } else { this.PlanetaryGovernor.Map.mapConditionManager.RegisterCondition(condition); Find.WindowStack.Add(new Tithes.Window_IoMTitheArrival()); // Find.LetterStack.ReceiveLetter("LetterLabelTithesDue".Translate(), condition.def.description, LetterType.BadUrgent, null); TitheCollectionActive = true; } }