Skip to content

Commit

Permalink
Custom assets (#2)
Browse files Browse the repository at this point in the history
* - Changed dynamic empty to occur when 2/3 full instead of 2000 so that custom cemetery assest play nice.
- Changed method to find buildings to apply new AI from name = "Cemetery" to class = "DeathCare Facility".
- Removed commented code.

* Changed version to 1.1
  • Loading branch information
seanke authored Jul 30, 2018
1 parent 01c9fec commit 6b63ead
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
2 changes: 1 addition & 1 deletion BetterCemeteryAI/BuildingExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void OnBuildingCreated(ushort id)
try
{
var b = Singleton<BuildingManager>.instance.m_buildings.m_buffer[id];
if (!b.Info.name.Equals("Cemetery")) return;
if (!b.Info.m_class.name.Equals("DeathCare Facility")) return;

AIHelper.ChangeBuildingAI(b, typeof(NewCemetaryAI));
}
Expand Down
2 changes: 1 addition & 1 deletion BetterCemeteryAI/NewCemetaryAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected override void ProduceGoods(ushort buildingID, ref Building buildingDat
Singleton<TransferManager>.instance.AddIncomingOffer(TransferManager.TransferReason.Dead, offer3);
}

if(buildingData.m_customBuffer1 > 2000)
if(buildingData.m_customBuffer1 > (m_corpseCapacity * 2/3))
{
TransferManager.TransferOffer offer = default(TransferManager.TransferOffer);
offer.Priority = 0;
Expand Down
2 changes: 1 addition & 1 deletion BetterCemeteryAI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.*")]
// [assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
27 changes: 1 addition & 26 deletions BetterCemeteryAI/ThreadingExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,6 @@ public class ThreadingExtension : ThreadingExtensionBase
public override void OnAfterSimulationTick()
{
ReloadIfRequired();
//LogNumberOfStored();
}

private void LogNumberOfStored()
{
if (threadingManager.simulationTick % 512 == 0 && !threadingManager.simulationPaused)
{
int count = 0;

Building[] buffer = Singleton<BuildingManager>.instance.m_buildings.m_buffer;
for (ushort i = 0; i < buffer.Length; i++)
{

if (buffer[i].Info == null) continue;

if (buffer[i].Info.name.Equals("Cemetery"))
{
var b = Singleton<BuildingManager>.instance.m_buildings.m_buffer[i];

count += b.m_customBuffer1;
}

}
LogHelper.Information(count.ToString());
}
}

private void ReloadIfRequired()
Expand All @@ -53,7 +28,7 @@ private void ReloadIfRequired()

if (buffer[i].Info == null) continue;

if (buffer[i].Info.name.Equals("Cemetery"))
if (buffer[i].Info.m_class.name.Equals("DeathCare Facility"))
{
var b = Singleton<BuildingManager>.instance.m_buildings.m_buffer[i];
AIHelper.ChangeBuildingAI(b, typeof(NewCemetaryAI));
Expand Down

0 comments on commit 6b63ead

Please sign in to comment.