private bool IsValidTarget(Thing t) // Projectile flyoverhead check instead of verb { Pawn pawn = t as Pawn; if (pawn != null) { //if (this.GunCompEq.PrimaryVerb.verbProps.projectileDef.projectile.flyOverhead) if (Projectile.projectile.flyOverhead) { RoofDef roofDef = base.Map.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } } if (this.mannableComp == null) { return(!GenAI.MachinesLike(base.Faction, pawn)); } if (pawn.RaceProps.Animal && pawn.Faction == Faction.OfPlayer) { return(false); } } return(true); }
private bool IsValidTarget(Thing t) { if (gun == null) { return(false); } Pawn pawn = t as Pawn; if (pawn != null) { if (this.GunCompEq.PrimaryVerb.ProjectileFliesOverhead()) { RoofDef roofDef = base.Map.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } } if (this.mannableComp == null) { return(!GenAI.MachinesLike(base.Faction, pawn)); } if (pawn.RaceProps.Animal && pawn.Faction == Faction.OfPlayer) { return(false); } } return(true); }
private static bool IsValidTarget(Building_TurretGun __instance, Thing t) { Building_Turret building_Turret = __instance; Pawn pawn = t as Pawn; if (pawn != null) { if (__instance.AttackVerb.ProjectileFliesOverhead()) { RoofDef roofDef = building_Turret.Map.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } } if (mannableComp == null) { return(!GenAI.MachinesLike(building_Turret.Faction, pawn)); } if (pawn.RaceProps.Animal && pawn.Faction == Faction.OfPlayer) { return(false); } } return(true); }
private bool IsValidTarget(Thing t) { Pawn p = t as Pawn; if (p != null) { if (this.GunCompEq.PrimaryVerb.verbProps.projectileDef.projectile.flyOverhead) { RoofDef roofDef = Find.VisibleMap.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } } if (this.mannableComp == null) { return(!GenAI.MachinesLike(this.Faction, p)); } if (p.RaceProps.Animal && p.Faction == Faction.OfPlayer) { return(false); } } return(true); }
private bool IsValidTarget(Thing t) { Pawn pawn = t as Pawn; if (pawn != null) { if (this.AttackVerb.ProjectileFliesOverhead()) { RoofDef roofDef = Operator.Map.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { // Log.Message(t + " ProjectileFliesOverhead isThickRoof IsValidTarget: false"); return(false); } } if (this.Operator != null) { // Log.Message(t + " !MachinesLike IsValidTarget: " + !GenAI.MachinesLike(Operator.Faction, pawn)); return(!GenAI.MachinesLike(Operator.Faction, pawn)); } if (pawn.RaceProps.Animal && pawn.Faction == Faction.OfPlayer) { // Log.Message(t + " OfPlayer Animal IsValidTarget: false"); return(false); } } if (!Operator.CanSee(t)) { // Log.Messageage(t + "CanSee IsValidTarget: false"); } // Log.Message(t + " IsValidTarget: true"); return(true); }
/// <summary> /// Returns whether p can open the door without bashing. /// </summary> public virtual bool PawnCanOpen(Pawn p) { var lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } //This is to avoid situations where a wild man is stuck inside the colony forever right after having a mental break if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } //Door has no faction? if (Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(Faction, p)); }
public virtual bool PawnCanOpen(Pawn p) { if (Map != null && Map.Parent.doorsAlwaysOpenForPlayerPawns && p.Faction == Faction.OfPlayer) { return(true); } var lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } if (p.RaceProps.FenceBlocked && !def.building.roamerCanOpen && (!p.roping.IsRopedByPawn || !PawnCanOpen(p.roping.RopedByPawn))) { return(false); } if (Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(Faction, p)); }
// RimWorld.Building_Door public virtual bool PawnCanOpen(Pawn p) { Lord lord = p.GetLord(); return(Def.doorType == DoorType.FreePassage || (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) || (p.IsWildMan() && !p.mindState.wildManEverReachedOutside) || base.Faction == null || (p.guest != null && p.guest.Released) || GenAI.MachinesLike(base.Faction, p)); }
public override bool PawnCanOpen(Pawn p) { if ( // Only allow prisoners to pass if all neighbouring rooms are prison cells (p.IsPrisonerOfColony) && (this.Position.GetRegion().NonPortalNeighbors.All(region => region.Room.isPrisonCell)) ) { return(true); } return(GenAI.MachinesLike(this.Faction, p)); }
// RimWorld.Building_Door public virtual bool PawnCanOpen(Pawn p) { Lord lord = p.GetLord(); var result = !forbiddenComp.Forbidden || Def.doorType == DoorType.FreePassage || (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) || (p.IsWildMan() && !p.mindState.WildManEverReachedOutside) || base.Faction == null || (p.guest != null && p.guest.Released) || GenAI.MachinesLike(base.Faction, p); if (!result && p.AnimalOrWildMan()) { Console.WriteLine(p.def.ToString() + " cannot open " + this.def.ToString()); } return(result); }
private bool IsValidTarget(Thing t) { Pawn pawn = t as Pawn; if (pawn != null) { if (this.gun.PrimaryVerb.verbProps.projectileDef.projectile.flyOverhead) { RoofDef roofDef = Find.RoofGrid.RoofDefAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } } return(!GenAI.MachinesLike(base.Faction, pawn)); } return(true); }
private bool IsValidTarget(Thing t) { if (!(t is Pawn pawn)) { return(true); } if (!this.def.projectile.flyOverhead) { return(!GenAI.MachinesLike(base.Faction, pawn)); } var roofDef = this.Map.roofGrid.RoofAt(t.Position); if (roofDef != null && roofDef.isThickRoof) { return(false); } return(!GenAI.MachinesLike(base.Faction, pawn)); }
public virtual bool PawnCanOpen(Pawn p) { Lord lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } if (p.IsWildMan() && !p.mindState.wildManEverReachedOutside) { return(true); } if (base.Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(base.Faction, p)); }
public virtual bool PawnCanOpen(Pawn p) { Lord lord = p.GetLord(); if (lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) { return(true); } if (WildManUtility.WildManShouldReachOutsideNow(p)) { return(true); } if (base.Faction == null) { return(true); } if (p.guest != null && p.guest.Released) { return(true); } return(GenAI.MachinesLike(base.Faction, p)); }
internal static bool PawnCanOpen(this Building_Door d, Pawn p) { Lord lord = p.GetLord(); return((lord != null && lord.LordJob != null && lord.LordJob.CanOpenAnyDoor(p)) || d.Faction == null || GenAI.MachinesLike(d.Faction, p) || p.health.hediffSet.HasHediff(HediffDefOfPsychology.Thief)); }