The Vent's in/out-field. Where is it defined?

Started by Sion, March 21, 2020, 10:43:26 AM

Previous topic - Next topic

Sion

I'm trying to make a simple mod that changes the Vent to move the heat in an "L-shape" instead of as currently in an "I-shape".

But I can't find any data about where the "in/out-put" of the vent is located in the files.

I have searched in this file:
...\myRimworldCopyFolder\Data\Core\Defs\ThingDefs_Buildings\Buildings_Temperature.xml
I have also searched the whole file-structure for words that seamed promising, but so far I found nothing.

I assume that those areas are not defined in this .xml-file, but probably in some .cs-file (hopefully) or some .dll-file (hopefully not)?



I = In, V = Vent, O = Out

Currently:
(I)(V)(O)

My vent:
(I) <---- Problem: Can't find this field thingy in the code.
(V)(O)
So many ideas... so little time...
Silence is the worst answer.

Homez

Check out these two methods in the decompiled code:
Building_Vent.TickRare which calls GenTemperature.EqualizeTemperaturesThroughBuilding

When you look at GenTemperature.EqualizeTemperaturesThroughBuilding you'll notice this line
IntVec3 intVec = (i == 0) ? (b.Position + b.Rotation.FacingCell) : (b.Position - b.Rotation.FacingCell);
which is responsible for the forward/backward locations of the vent. I'm a beginner modder myself, but I'm willing to bet the easiest way forward for you would be to create a new vent building that equalizes temperature at a 90 degree angle instead of what the vent currently does. Give that a shot?

LWM

Good looking, Homez - that seems about right.  How's your C#, Sion?
If it's so-so, you'd probably want to

class BuildingLVent : BuildingVent
public override void TickRare() {
  //put a copy of every line of EqualizeTemperaturesThroughBuilding here, but change as you need
  //then you just build, make your vent use your thingClass, and you're good!
}

If you're up for fun exciting things, you could put a Harmony transpiler into EqualizeTemperaturesThroughBuilding and add a call to some "intVec3 AdjustVentDirection(intVec3)" right before the intVec3 intVec is stored.