-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from DestinyPlayer/indev
Indev
- Loading branch information
Showing
20 changed files
with
245 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+15.9 KB
...epacks/.vs/CategoricGenepacks/FileContentIndex/564016f9-e89e-4962-84dd-b8398df7c3e9.vsidx
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file removed
BIN
-11 KB
...epacks/.vs/CategoricGenepacks/FileContentIndex/791fc19a-248d-4b66-a7db-61040a88f437.vsidx
Binary file not shown.
Binary file removed
BIN
-10.9 KB
...epacks/.vs/CategoricGenepacks/FileContentIndex/8ebf169b-7626-4dd1-9a8d-e81d60344227.vsidx
Binary file not shown.
Binary file added
BIN
+13.9 KB
...epacks/.vs/CategoricGenepacks/FileContentIndex/b9562813-bf1c-4a58-98ec-dafbbdece7fe.vsidx
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Source/CategoricGenepacks/GF_CompProperties_ConvertThingToResource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using PipeSystem; | ||
using RimWorld; | ||
using System.Collections.Generic; | ||
using Verse; | ||
|
||
namespace CategoricGenepacks | ||
{ | ||
public class GF_CompProperties_ConvertThingToResource : PipeSystem.CompProperties_Resource | ||
{ | ||
public int ratio = 1; | ||
|
||
public ThingCategoryDef catThing; | ||
|
||
public GF_CompProperties_ConvertThingToResource() | ||
{ | ||
compClass = typeof(GF_ConvertThingToResource); | ||
} | ||
|
||
public override IEnumerable<string> ConfigErrors(ThingDef parentDef) | ||
{ | ||
foreach (string item in base.ConfigErrors(parentDef)) | ||
{ | ||
yield return item; | ||
} | ||
|
||
if (parentDef.thingClass != typeof(Building_Storage)) | ||
{ | ||
yield return "Can't use GF_CompProperties_ConvertThingToResource with a thing that don't have Building_Storage as thingClass."; | ||
} | ||
|
||
if (parentDef.comps.FindAll((CompProperties c) => c is CompProperties_ConvertThingToResource).Count > 1) | ||
{ | ||
yield return "Can't use multiple GF_CompProperties_ConvertThingToResource on the same thing."; | ||
} | ||
|
||
if (catThing == null) | ||
{ | ||
yield return "Can't use GF_CompProperties_ConvertThingToResource with a null thing."; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using PipeSystem; | ||
using RimWorld; | ||
using System.Collections.Generic; | ||
using Verse; | ||
|
||
namespace CategoricGenepacks | ||
{ | ||
public class GF_ConvertThingToResource : PipeSystem.CompResource | ||
{ | ||
private CompBreakdownable compBreakdownable; | ||
|
||
private CompPowerTrader compPowerTrader; | ||
|
||
private CompFlickable compFlickable; | ||
|
||
public new GF_CompProperties_ConvertThingToResource Props => (GF_CompProperties_ConvertThingToResource)props; | ||
|
||
public bool CanInputNow => (compBreakdownable == null || !compBreakdownable.BrokenDown) && (compPowerTrader == null || compPowerTrader.PowerOn) && (compFlickable == null || compFlickable.SwitchIsOn); | ||
|
||
public Thing HeldThing | ||
{ | ||
|
||
get | ||
{ | ||
List<Thing> list = parent.Map.thingGrid.ThingsListAt(parent.Position); | ||
List<ThingDef> catList = Props.catThing.childThingDefs; | ||
|
||
Log.Message("Grabbing category: " + catList.ToString()); | ||
|
||
for (int i = 0; i < catList.Count; i++) | ||
{ | ||
Log.Message(" Grabbing corpse: " + catList[i].ToString()); | ||
for (int j = 0; j < list.Count; j++) | ||
{ | ||
Log.Message(" Testing for corpses: " + list[j].ToString()); | ||
if (list[j].def == catList[i]) | ||
{ | ||
Log.Message(" Success! Depositing " + list[j].ToString() + " into the extractor."); | ||
return list[j]; | ||
} | ||
} | ||
} | ||
Log.Message("Nothing's been found mate"); | ||
return null; | ||
} | ||
} | ||
|
||
public int MaxCanInput => (int)PipeNet.AvailableCapacity; | ||
|
||
public override void PostSpawnSetup(bool respawningAfterLoad) | ||
{ | ||
base.PostSpawnSetup(respawningAfterLoad); | ||
compBreakdownable = parent.GetComp<CompBreakdownable>(); | ||
compPowerTrader = parent.GetComp<CompPowerTrader>(); | ||
compFlickable = parent.GetComp<CompFlickable>(); | ||
} | ||
|
||
public override void CompTick() | ||
{ | ||
base.CompTick(); | ||
if (parent.IsHashIntervalTick(250)) | ||
{ | ||
CompTickRare(); | ||
} | ||
} | ||
|
||
public override void CompTickRare() | ||
{ | ||
base.CompTickRare(); | ||
Thing heldThing = HeldThing; | ||
Log.Message("Blah blah testing if this bloody thing even loaded"); | ||
if (CanInputNow && heldThing != null) | ||
{ | ||
int num = heldThing.stackCount / Props.ratio; | ||
PipeNet.DistributeAmongStorage(num); | ||
heldThing.DeSpawn(); | ||
} | ||
} | ||
} | ||
public class PipeNet { | ||
public List<GF_ConvertThingToResource> convertersC = new List<GF_ConvertThingToResource>(); | ||
} | ||
} |
Binary file modified
BIN
+4.6 KB
(120%)
Source/CategoricGenepacks/obj/Debug/CategoricGenepacks.csproj.AssemblyReference.cache
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
Source/CategoricGenepacks/obj/Debug/CategoricGenepacks.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
23835f5d8f5a4b7ea9fb81dea1a0c03642aec250 | ||
d6b5851f9cd2ac645735b2c95fe4879bec2012f9 |
Binary file not shown.
Binary file modified
BIN
+349 Bytes
(110%)
Source/CategoricGenepacks/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.