Skip to content

Commit

Permalink
Merge pull request #8 from ScottTRichmond/master
Browse files Browse the repository at this point in the history
Updated to A17
  • Loading branch information
Morgloz authored Jul 7, 2017
2 parents 5399fcd + 693e6b8 commit f95ba1b
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 48 deletions.
3 changes: 2 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<author>Morgloz</author>
<url>https://ludeon.com/forums/index.php?topic=21770.0</url>

<targetVersion>0.16.1393</targetVersion>
<targetVersion>0.17.1557</targetVersion>

<description>
This mods adds small/medium/industrial versions of the vanilla temperature buildings.
Expand All @@ -15,5 +15,6 @@ Credits
-justarandomgeek, the author of "Signals, you can't stop them!"
-mrofa, who helped me in the pipe's graphic code
-Latta, the previous owner of the mod
-richmost, who updated it for a17
</description>
</ModMetaData>
22 changes: 11 additions & 11 deletions RedistHeat/Building/Building_AirNets/Building_DuctComp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ protected bool WorkingState

public override string LabelNoCount => base.LabelNoCount + " (" + compAir.currentLayer.ToString().ToLower() + ")";

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
compAir = GetComp< CompAirTrader >();

Common.WipeExistingPipe( Position );
Expand All @@ -60,7 +60,7 @@ public override void SpawnSetup(Map map)
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.LookValue( ref isLocked, "isLocked", false );
Scribe_Values.Look( ref isLocked, "isLocked", false );
}

public override void Tick()
Expand Down Expand Up @@ -195,13 +195,13 @@ protected virtual void Equalize()
}
if (force >= room.CellCount)
{
room.Temperature = avgTemp;
room.Group.Temperature = avgTemp;
}
else
{
float diff = room.CellCount - force;
float result = ((diff * room.Temperature) + (avgTemp * force)) / room.CellCount;
room.Temperature = result;
room.Group.Temperature = result;
}
#if DEBUG
Log.Message("RedistHeat: Intake room result temp: " + result);
Expand All @@ -223,7 +223,7 @@ protected virtual void Equalize()
}
if (force >= count)
{
room.Temperature = temp;
room.Group.Temperature = temp;
}
else
{
Expand All @@ -235,7 +235,7 @@ protected virtual void Equalize()
#if DEBUG
Log.Message("RedistHeat: Outlet result temp: " + result + " with diff: " + diff + " force: " + force + " temp: " + temp + " count: " + count);
#endif
room.Temperature = result;
room.Group.Temperature = result;
}
}
/*float pointTemp;
Expand Down Expand Up @@ -318,31 +318,31 @@ private void FindAdjacentRooms()
var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x,c.y,c.z+1)).ToList().Find(s => s.def.defName == "Door" );
if(door != null)
{
adjacentRooms.Add(RoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z + 2), Map));
adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z + 2), Map));
}
}
if(c.x < x - 1 && !fieldGrid[c.x + 1, c.z])
{
var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x + 1, c.y, c.z)).ToList().Find(s => s.def.defName == "Door");
if (door != null)
{
adjacentRooms.Add(RoomQuery.RoomAt(new IntVec3(c.x + 2, c.y, c.z), Map));
adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x + 2, c.y, c.z), Map));
}
}
if (c.z > 0 && !fieldGrid[c.x, c.z - 1])
{
var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x, c.y, c.z - 1)).ToList().Find(s => s.def.defName == "Door");
if (door != null)
{
adjacentRooms.Add(RoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z - 2), Map));
adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z - 2), Map));
}
}
if (c.z > 0 && !fieldGrid[c.x - 1, c.z])
{
var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x - 1, c.y, c.z)).ToList().Find(s => s.def.defName == "Door");
if (door != null)
{
adjacentRooms.Add(RoomQuery.RoomAt(new IntVec3(c.x - 2, c.y, c.z), Map));
adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x - 2, c.y, c.z), Map));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions RedistHeat/Building/Building_AirNets/Building_DuctPipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public override Graphic Graphic
}
}

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
GetGraphic();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected bool WorkingState
}
}

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
compAir = GetComp<CompAirTrader>();

Common.WipeExistingPipe(Position);
Expand Down Expand Up @@ -89,7 +89,7 @@ protected virtual bool Validate()
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.LookValue(ref Net, "net", true);
Scribe_Values.Look(ref Net, "net", true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public Building_MultipurposeCooler()
Net = true;
}

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
//pipe = (Building_DuctPipe) GenSpawn.Spawn(ThingDef.Named("RedistHeat_DuctPipeLower"), Position, map);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ protected void Equalize()
return;
}

room.Temperature += coldAir;
room.Group.Temperature += coldAir;


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Tick()
flag = !Mathf.Approximately( num4, 0f );
if (flag)
{
intVec.GetRoom(this.Map).Temperature += num4;
intVec.GetRoom(this.Map).Group.Temperature += num4;
GenTemperature.PushHeat( intVec2, this.Map, - num3*1.25f );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class Building_ExhaustPort : Building_DuctSwitchable

private Building_IndustrialCooler neighCooler;

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
VecNorth = Position + IntVec3.North.RotatedBy( Rotation );
VecSouth = Position + IntVec3.South.RotatedBy( Rotation );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override void Tick()
var flag = !Mathf.Approximately( num2, 0f );
if (flag)
{
Position.GetRoom(this.Map).Temperature += num2;
Position.GetRoom(this.Map).Group.Temperature += num2;
compPowerTrader.PowerOutput = -compPowerTrader.Props.basePowerConsumption;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class Building_IndustrialCooler : Building_DuctSwitchable

private float Energy => compTempControl.Props.energyPerSecond;

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
vecSouth = Position + IntVec3.South.RotatedBy( Rotation );
vecSouthEast = vecSouth + IntVec3.East.RotatedBy( Rotation );
}
Expand Down Expand Up @@ -103,7 +103,7 @@ private void ControlTemperature()
}
else
{
roomSouth.Temperature += coldAir;
roomSouth.Group.Temperature += coldAir;
}

var hotAir = (float) (-energyLimit*1.25/activeExhausts.Count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private void ControlTemperature()
}
else
{
room.Temperature += hotAir;
room.Group.Temperature += hotAir;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ private bool WorkingState
}
}

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
vecNorth = Position + IntVec3.North.RotatedBy( Rotation );

glower = GenSpawn.Spawn( ThingDef.Named( "RedistHeat_HeaterGlower" ), vecNorth, map);
Expand Down Expand Up @@ -120,7 +120,7 @@ private void ControlTemperature()
var hotIsHot = !Mathf.Approximately( hotAir, 0f );
if (hotIsHot)
{
roomNorth.Temperature += hotAir;
roomNorth.Group.Temperature += hotAir;
WorkingState = true;
}
else
Expand Down
10 changes: 5 additions & 5 deletions RedistHeat/Building/Building_Vents/Building_Vent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ private bool WorkingState
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.LookValue( ref isLocked, "isLocked", false );
Scribe_Values.Look( ref isLocked, "isLocked", false );
}

public override void SpawnSetup(Map map)
public override void SpawnSetup(Map map, bool respawningAfterLoad)
{
base.SpawnSetup(map);
base.SpawnSetup(map, respawningAfterLoad);
vecNorth = Position + IntVec3.North.RotatedBy( Rotation );
vecSouth = Position + IntVec3.South.RotatedBy( Rotation );
}
Expand Down Expand Up @@ -113,11 +113,11 @@ protected virtual void Equalize( Room room, float targetTemp, float rate )
var tempRated = tempDiff*rate;
if (targetTemp < room.Temperature)
{
room.Temperature = Mathf.Max( targetTemp, room.Temperature - tempRated );
room.Group.Temperature = Mathf.Max( targetTemp, room.Temperature - tempRated );
}
else if (targetTemp > room.Temperature)
{
room.Temperature = Mathf.Min( targetTemp, room.Temperature + tempRated );
room.Group.Temperature = Mathf.Min( targetTemp, room.Temperature + tempRated );
}
}

Expand Down
6 changes: 3 additions & 3 deletions RedistHeat/ThingComps/CompAir.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public virtual bool IsLayerOf( NetLayer ly )
return currentLayer == ly;
}

public override void PostSpawnSetup()
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup();
base.PostSpawnSetup(respawningAfterLoad);
//ResourceBank.UILower = ContentFinder<Texture2D>.Get("UI/Commands/Lower", true);
//ResourceBank.UIUpper = ContentFinder<Texture2D>.Get("UI/Commands/Upper", true);
AirNetManager.NotifyCompSpawn( this );
Expand All @@ -34,7 +34,7 @@ public override void PostDestroy( DestroyMode mode, Map previousMap)
public override void PostExposeData()
{
base.PostExposeData();
Scribe_Values.LookValue( ref currentLayer, "currentLayer", NetLayer.Lower );
Scribe_Values.Look( ref currentLayer, "currentLayer", NetLayer.Lower );
}

public void CompPrintForAirGrid( SectionLayer layer )
Expand Down
10 changes: 5 additions & 5 deletions RedistHeat/ThingComps/CompAirTrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public CompAirTraderProperties Props
}
}

public override void PostSpawnSetup()
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup();
base.PostSpawnSetup(respawningAfterLoad);
if (netTemp == 0f)
{
netTemp = this.parent.Map.mapTemperature.OutdoorTemp;
Expand All @@ -36,11 +36,11 @@ public void EqualizeWithRoom( Room room, float targetTemp, float rate )

if (targetTemp < room.Temperature)
{
room.Temperature = Mathf.Max(targetTemp, room.Temperature - tempRated );
room.Group.Temperature = Mathf.Max(targetTemp, room.Temperature - tempRated );
}
else if (targetTemp > room.Temperature)
{
room.Temperature = Mathf.Min(targetTemp, room.Temperature + tempRated );
room.Group.Temperature = Mathf.Min(targetTemp, room.Temperature + tempRated );
}
}

Expand Down Expand Up @@ -73,7 +73,7 @@ public override void PostExposeData()
{
base.PostExposeData();

Scribe_Values.LookValue( ref netTemp, "netTemp", 999 );
Scribe_Values.Look( ref netTemp, "netTemp", 999 );
}
}
}
4 changes: 2 additions & 2 deletions RedistHeat/ThingComps/CompAirTransmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace RedistHeat
{
public class CompAirTransmitter : CompAir
{
public override void PostSpawnSetup()
public override void PostSpawnSetup(bool respawningAfterLoad)
{
var compAirProps = props as CompAirTransmitterProperties;
if (compAirProps == null)
Expand All @@ -18,7 +18,7 @@ public override void PostSpawnSetup()
currentLayer = compAirProps.layer;
}

base.PostSpawnSetup();
base.PostSpawnSetup(respawningAfterLoad);
}

public override IEnumerable<Gizmo> CompGetGizmosExtra()
Expand Down
4 changes: 2 additions & 2 deletions RedistHeat/ThingComps/CompMyGlower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public void UpdateLit(bool lit)
}
}

public override void PostSpawnSetup()
public override void PostSpawnSetup(bool respawningAfterLoad)
{
this.UpdateLit(false);
}

public override void PostExposeData()
{
Scribe_Values.LookValue<bool>(ref this.glowOnInt, "glowOn", false, false);
Scribe_Values.Look<bool>(ref this.glowOnInt, "glowOn", false, false);
}

public override void PostDeSpawn(Map map)
Expand Down

0 comments on commit f95ba1b

Please sign in to comment.