public static int ApparentPathCost(ThingDef def, IntVec3 c, Map map) { Building b = c.GetFirst <Building_MassStorageUnit>(map); if (b is Building_MassStorageUnit) { return((b.def == def) ? b.def.pathCost : 0); } return(def.pathCost); }
public static void Prefix(Thing __instance, out Building_MassStorageUnit __state) { __state = null; IntVec3 pos = __instance.Position; if (__instance.def.category == ThingCategory.Item && pos.IsValid && __instance.Map != null) { __state = pos.GetFirst <Building_MassStorageUnit>(__instance.Map); } }
public static T Get <T>(Map map, IntVec3 pos) where T : class { return(pos.IsValid ? pos.GetFirst <T>(map) : null); }