Impassable, but allow temperature through

Started by TehJoE, February 19, 2015, 04:29:41 PM

Previous topic - Next topic

TehJoE

Is it possible (through a dll mod or otherwise) to create a building that is impassable but doesn't block temperature from equalizing through it? I have a building type that I don't want Pawns walking through but I don't want it to hermetically seal off rooms either. I've tried doing something like the door does, calculating the average temp of nearby rooms and adjusting the temperature in each to equalize it, but that doesn't work if I put two of these side-by-side. Any ideas?
Do you remember, how many breads have you eaten in your lifetime?

Gaesatae

You may want to take a look at this mod:
https://ludeon.com/forums/index.php?topic=8476.0

I haven't tried it, but it has vents.

TehJoE

I did check out that mod since I use it in my own colonies, but unfortunately their source code isn't available for viewing. The doorway technique almost works, except when my 1x1 building is tiled to an area of 3x3, the center one becomes "outdoors" (probably because its Room ceases to exist) and then it tries to equalize the temperature with the outdoors.

Perhaps a better technique would be to somehow make a Standable/PassThroughOnly building effectively Impassable?
Do you remember, how many breads have you eaten in your lifetime?

tommytom

I wonder if you can make a door, put a stockpile in it as important, have someone haul a chunk to it (stuck open) and then lock the door. Depends on how the AI reacts to a locked open door. lol.

TehJoE

Just in case anyone else is looking for a solution to this problem or something similar, I'm gonna detail how I ended up fixing it:

Looking through the pathing code in dotPeek, I noticed this snippet here that signals whether a cell is walkable or not (i.e. a Pawn is allowed to walk through it when finding a path to another cell):


public bool Walkable(IntVec3 loc)
    {
      if (!GenGrid.InBounds(loc))
        return false;
      return this.pathGrid[CellIndices.CellToIndex(loc)] < 10000;
    }


And the pathGrid array is updated by this:


public void RecalculatePerceivedPathCostAt(IntVec3 c)
    {
      if (!GenGrid.InBounds(c))
        return;
      this.pathGrid[CellIndices.CellToIndex(c)] = PathGrid.CalculatedCostAt(c, true);
    }


Which calls a rather long function (that I've trimmed for brevity) to calculate the path cost of a given cell:


public static int CalculatedCostAt(IntVec3 c, bool perceived)
    {
      (...)
      List<Thing> list1 = Find.ThingGrid.ThingsListAt(c);
      for (int index = 0; index < list1.Count; ++index)
      {
        if (list1[index].def.passability == Traversability.Impassable)
          return 10001;
        num3 += list1[index].def.pathCost;
      }
      (...)
    }


As you can see, an Impassable Thing gets its unpathable property from the fact that this function returns a path cost of 10001, one more than the threshold that Walkable(loc) deems unpathable. So I changed my building's def to:

<passability>Impassable</passability>
<passability>PassThroughOnly</passability>
<pathCost>10001</pathCost>


And now my building lets temperature pass through it as if it weren't there, without hacky door mechanics and room checking, but a Pawn completely surrounded by them is unable to escape. Hope this helps someone.  ;)
Do you remember, how many breads have you eaten in your lifetime?