// Token: 0x06000061 RID: 97 RVA: 0x00004548 File Offset: 0x00002748 public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null) { if (!loc.InBounds(map)) { return(false); } if (loc.Filled(map)) { return(false); } List <Thing> list = map.thingGrid.ThingsListAt(loc); for (int i = 0; i < list.Count; i++) { Thing thingy = list[i]; if (thingy.def.IsBlueprint || thingy.def.IsFrame) { return(false); } if (thingy.def.category == ThingCategory.Plant) { return(false); } if (thingy.def.category == ThingCategory.Building && thingy.def.surfaceType != SurfaceType.Item && thingy.def.surfaceType != SurfaceType.Eat) { return(false); } if (thingy.def.category == ThingCategory.Item) { return(false); } } return(true); }
// Token: 0x0600006C RID: 108 RVA: 0x00004C64 File Offset: 0x00002E64 public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null) { if (!loc.InBounds(map)) { return(false); } if (loc.Filled(map)) { return(false); } if (!map.terrainGrid.TerrainAt(loc).IsWater) { return(false); } if (map.terrainGrid.TerrainAt(loc).pathCost > 30) { return(false); } if (map.terrainGrid.TerrainAt(loc).defName.Contains("Ocean") || map.terrainGrid.TerrainAt(loc).defName.Contains("ocean")) { return(false); } var list = map.thingGrid.ThingsListAt(loc); foreach (var thingy in list) { if (thingy.def.IsBlueprint || thingy.def.IsFrame) { return(false); } if (thingy.def.category == ThingCategory.Plant) { return(false); } if (thingy.def.category == ThingCategory.Building) { return(false); } if (thingy.def.category == ThingCategory.Item) { return(false); } } return(true); }
private bool CanMoveTo(IntVec3 pos) { return (pos.InBounds(Map) && ( !pos.Filled(Map) || (pos.GetDoor(Map)?.Open ?? false) || (pos.GetFirstThing <Building_Vent>(Map) is Building_Vent vent && vent.TryGetComp <CompFlickable>().SwitchIsOn) )); }
private bool CellBoolDrawerGetBoolInt(int index) { IntVec3 intVec = CellIndicesUtility.IndexToCell(index, map.Size.x); if (intVec.Filled(map) || intVec.Fogged(map)) { return(false); } return(FertilityAt(intVec) > 0.69f); }
// Token: 0x0600002D RID: 45 RVA: 0x00002FBC File Offset: 0x000011BC public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot, Map map, Thing thingToIgnore = null, Thing thing = null) { if (!loc.InBounds(map)) { return(false); } if (!map.roofGrid.Roofed(loc)) { return(false); } if (loc.Filled(map)) { return(false); } var list = loc.GetThingList(map); if (list.Count <= 0) { return(true); } foreach (var thingy in list) { if (thingy is not Building) { continue; } var def = thingy.def; if (def?.entityDefToBuild != null) { if (thingy.def.entityDefToBuild == checkingDef) { return(false); } } var isDoor = thingy.def.IsDoor; if (isDoor) { return(false); } } return(true); }
private static bool IsGoodShrapnelCell(IntVec3 c, Map map) { if (!c.InBounds(map)) { return(false); } if (c.Impassable(map) || c.Filled(map)) { return(false); } RoofDef roofDef = map.roofGrid.RoofAt(c); return(roofDef == null); }
private static bool IsGoodShrapnelCell(IntVec3 c, Map map) { bool result; if (!c.InBounds(map)) { result = false; } else if (c.Impassable(map) || c.Filled(map)) { result = false; } else { RoofDef roofDef = map.roofGrid.RoofAt(c); result = (roofDef == null); } return(result); }
public static void SpawnShrapnel(ThingDef def, int quantity, IntVec3 center, Map map, float angle) { for (int i = 0; i < quantity; i++) { IntVec3 intVec = IncidentWorker_ShipPartCrash.GenerateShrapnelLocation(center, angle); if (intVec.InBounds(map)) { if (!intVec.Impassable(map) && !intVec.Filled(map)) { RoofDef roofDef = map.roofGrid.RoofAt(intVec); if (roofDef == null) { if ((from thing in intVec.GetThingList(map) where thing.def == def select thing).Count <Thing>() <= 0) { GenSpawn.Spawn(def, intVec, map); } } } } } }
internal bool <> m__0(IntVec3 x) { return((float)x.DistanceToSquared(this.$this.parent.Position) <= this.$this.snowRadius * this.$this.snowRadius && (this.occupiedRect.Contains(x) || !x.Filled(this.$this.parent.Map))); }
protected override void TimeInterval(float deltaTime) { base.TimeInterval(deltaTime); //float alpha = this.Alpha; //Graphic.color.a = alpha; //Graphic.MatSingle.color = Graphic.Color; //Graphic.MatSingle.SetColor(ShaderPropertyIDs.Color, Graphic.Color); if (Destroyed) { return; } if (!Flying && !Skidding) { return; } var vector = NextExactPosition(deltaTime); var intVec = new IntVec3(vector); if (intVec != Position) { if (!intVec.InBounds(Map)) { Destroy(); return; } if (def.mote.collide && intVec.Filled(Map)) { WallHit(); return; } } Position = intVec; exactPosition = vector; if (def.mote.rotateTowardsMoveDirection && velocity != default) { exactRotation = velocity.AngleFlat(); } else { exactRotation += rotationRate * deltaTime; } velocity += def.mote.acceleration * deltaTime; if (def.mote.speedPerTime != 0f) { Speed = Mathf.Max(Speed + (def.mote.speedPerTime * deltaTime), 0f); } if (airTimeLeft > 0f) { airTimeLeft -= deltaTime; if (airTimeLeft < 0f) { airTimeLeft = 0f; } if (airTimeLeft <= 0f && !def.mote.landSound.NullOrUndefined()) { def.mote.landSound.PlayOneShot(new TargetInfo(Position, Map)); } } if (!Skidding) { return; } Speed *= skidSpeedMultiplierPerTick; rotationRate *= skidSpeedMultiplierPerTick; if (Speed < 0.02f) { Speed = 0f; } var rng = Random.Range(0f, 1f); if (rng < 0.3f) { FilthMaker.TryMakeFilth(intVec, Map, ((MotePropertiesFilthy)def.mote).filthTrace); } }
// Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54 protected override Job TryGiveJob(Pawn pawn) { IntVec3 hivec = pawn.mindState.duty.focus.Cell; List <IntVec3> pillarLoc = new List <IntVec3>() { // Cardinals new IntVec3 { x = pawn.mindState.duty.focus.Cell.x + 3, z = pawn.mindState.duty.focus.Cell.z }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x - 3, z = pawn.mindState.duty.focus.Cell.z }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x, z = pawn.mindState.duty.focus.Cell.z + 3 }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x, z = pawn.mindState.duty.focus.Cell.z - 3 }, // Corners new IntVec3 { x = pawn.mindState.duty.focus.Cell.x + 2, z = pawn.mindState.duty.focus.Cell.z + 2 }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x - 2, z = pawn.mindState.duty.focus.Cell.z + 2 }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x + 2, z = pawn.mindState.duty.focus.Cell.z - 2 }, new IntVec3 { x = pawn.mindState.duty.focus.Cell.x - 2, z = pawn.mindState.duty.focus.Cell.z - 2 } }; Region region = pawn.GetRegion(RegionType.Set_Passable); if (region == null) { return(null); } bool flag1 = hivec.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive) != null; bool flag2 = hivec.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Child) != null; bool flag3 = hivec.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Slime) != null; bool flag4 = !flag1 && !flag2 && !flag3; if (flag4) { if (hivec.Filled(pawn.Map) && pawn.CanReach(hivec, PathEndMode.OnCell, Danger.Deadly)) { Building edifice = hivec.GetEdifice(pawn.Map); return(new Job(JobDefOf.Mine, edifice) { ignoreDesignations = true }); } if (!hivec.Filled(pawn.Map) && pawn.CanReach(hivec, PathEndMode.OnCell, Danger.Deadly)) { GenSpawn.Spawn(XenomorphDefOf.RRY_Xenomorph_Hive_Slime, pawn.mindState.duty.focus.Cell, pawn.Map); } } for (int i = 0; i < 40; i++) { IntVec3 randomCell = region.RandomCell; for (int j = 0; j < 4; j++) { IntVec3 c = randomCell + GenAdj.CardinalDirections[j]; if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map)) { Building edifice = c.GetEdifice(pawn.Map); if (edifice != null && (edifice.def.passability == Traversability.Impassable || edifice.def.IsDoor) && edifice.def.size == IntVec2.One && edifice.def != ThingDefOf.CollapsedRocks && edifice.def != XenomorphDefOf.RRY_Xenomorph_Hive_Wall && pawn.CanReserve(edifice, 1, -1, null, false) && XenomorphUtil.DistanceBetween(edifice.Position, pawn.mindState.duty.focus.Cell) <= MiningRange) { if (!pillarLoc.Contains(edifice.Position)) { return(new Job(JobDefOf.Mine, edifice) { ignoreDesignations = true }); } } /* * else if (edifice==null) * { * if (!pillarLoc.Contains(edifice.Position)) * { * return new Job(JobDefOf.Mine, edifice) * { * ignoreDesignations = true * }; * } * } */ } } } return(null); }
// Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54 protected override Job TryGiveJob(Pawn pawn) { if (!pawn.isXenomorph(out Comp_Xenomorph _Xenomorph)) { return(null); } if (pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Queen && pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Drone && pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Predalien) { return(null); } Map map = pawn.Map; IntVec3 pos = pawn.Position; IntVec3 HiveCenter = _Xenomorph.HiveLoc; Region region = pawn.GetRegion(RegionType.Set_Passable); if (region == null) { return(null); } if (HiveCenter == pawn.InteractionCell) { return(null); } bool centerNode = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive) != null; bool centerChild = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Child) != null; bool centerSlime = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Slime) != null; bool centerFilled = HiveCenter.Filled(pawn.Map); if (centerNode) { MiningRange = 6; } else { MiningRange = 3; if (!centerChild) { if (pawn.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen || pawn.def == XenomorphRacesDefOf.RRY_Xenomorph_Drone) { if (!centerNode) { IntVec3 c = HiveCenter; if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map) && pawn.CanReserveAndReach(c, PathEndMode.OnCell, Danger.Deadly)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Node, c) { ignoreDesignations = false }); } } return(null); } } } if (!centerChild) { foreach (var structure in HiveStructure.HiveStruct(HiveCenter).Where(x => x.GetThingList(map).Any(z => !z.def.defName.Contains("RRY_Xenomorph_Hive")) && x.DistanceTo(HiveCenter) <= MiningRange && pawn.CanReserveAndReach(x, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor) && x.GetFirstBuilding(map) == null)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Wall, structure) { ignoreDesignations = false }); } foreach (var structure in HiveStructure.HiveWallGen(HiveCenter, MiningRange).Where(x => x.GetThingList(map).Any(z => !z.def.defName.Contains("RRY_Xenomorph_Hive")) && x.DistanceTo(HiveCenter) <= MiningRange + 2 && pawn.CanReserveAndReach(x, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor) && x.GetFirstBuilding(map) == null)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Wall, structure) { ignoreDesignations = false }); } Predicate <IntVec3> validator2 = delegate(IntVec3 y) { bool roofed = (y.Roofed(pawn.Map)); bool result = !roofed && XenomorphUtil.DistanceBetween(y, HiveCenter) <= MiningRange && pawn.CanReserveAndReach(y, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Ceiling); return(result); }; if (RCellFinder.TryFindRandomCellNearWith(HiveCenter, validator2, pawn.Map, out IntVec3 c2, MiningRange, MiningRange)) { if (c2.InBounds(pawn.Map) && pawn.CanReserveAndReach(c2, PathEndMode.OnCell, Danger.Deadly)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Roof, c2) { ignoreDesignations = false }); } } } return(null); }