public static void DropThingGroupsNear(IntVec3 dropCenter, List <List <Thing> > thingsGroups, int openDelay = 110, bool canInstaDropDuringInit = true, bool leaveSlag = false) { foreach (List <Thing> current in thingsGroups) { IntVec3 intVec; if (!RCellFinder.TryFindDropPodSpotNear(dropCenter, out intVec)) { Log.Warning(string.Concat(new object[] { "DropThingsNear failed to find a place to drop ", current.FirstOrDefault <Thing>(), " near ", dropCenter, ". Dropping on random square instead." })); intVec = GenCellFinder.RandomCellWith((IntVec3 sq) => sq.Walkable()); } foreach (Thing current2 in current) { ThingWithComponents thingWithComponents = current2 as ThingWithComponents; if (thingWithComponents != null && thingWithComponents.GetComp <CompForbiddable>() != null) { thingWithComponents.GetComp <CompForbiddable>().forbidden = true; } } if (canInstaDropDuringInit && Find.TickManager.tickCount < 2) { foreach (Thing current3 in current) { GenPlace.TryPlaceThing(current3, intVec, ThingPlaceMode.Near); } } else { MeteorInfo meteorInfo = new MeteorInfo(); foreach (Thing current4 in current) { meteorInfo.containedThings.Add(current4); } meteorInfo.openDelay = openDelay; meteorInfo.leaveSlag = leaveSlag; MeteorUtility.MakeMeteorAt(intVec, meteorInfo); } } }
public static void SetForbidden(this Thing t, bool value) { ThingWithComponents twc = t as ThingWithComponents; if (twc == null) { Log.Error("Tried to SetForbidden on non-ThingWithComponents Thing " + t); return; } CompForbiddable f = twc.GetComp <CompForbiddable>(); if (f == null) { Log.Error("Tried to SetForbidden on non-Forbiddable Thing " + t); return; } f.forbidden = value; }
public static bool IsForbidden(this Thing t) { ThingWithComponents twc = t as ThingWithComponents; if (twc == null) { return(false); } CompForbiddable f = twc.GetComp <CompForbiddable>(); if (f == null) { return(false); } if (f.forbidden) { return(true); } return(false); }