Showing 578 changed files with 34,586 additions and 9,038 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
*.user
*.userprefs
*.sln.docstates
DLL_Project/Source-DLLs/*.dll
DLL_Project/*.bat
DLL_Project/bin/*.dll
DLL_Project/CCLModTweaks/bin/*.dll
*.bat

# Build results
[Dd]ebug/
Expand All @@ -16,7 +17,6 @@ DLL_Project/*.bat
x64/
build/
bld/
[Bb]in/
[Oo]bj/

# Roslyn cache directories
Expand Down
52 changes: 46 additions & 6 deletions CommunityCoreLibrary.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@ VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityCoreLibrary", "DLL_Project\CommunityCoreLibrary.csproj", "{A36BEEB2-7379-475B-B537-827E34571962}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCLModTweaks", "DLL_Project\CCLModTweaks\CCLModTweaks.csproj", "{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Developer|Any CPU = Developer|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A36BEEB2-7379-475B-B537-827E34571962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A36BEEB2-7379-475B-B537-827E34571962}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A36BEEB2-7379-475B-B537-827E34571962}.Developer|Any CPU.ActiveCfg = Developer|Any CPU
{A36BEEB2-7379-475B-B537-827E34571962}.Developer|Any CPU.Build.0 = Developer|Any CPU
{A36BEEB2-7379-475B-B537-827E34571962}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A36BEEB2-7379-475B-B537-827E34571962}.Release|Any CPU.Build.0 = Release|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Release|Any CPU.Build.0 = Release|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Developer|Any CPU.ActiveCfg = Debug|Any CPU
{1F8C3C2D-E04E-4475-A20A-FE69CB96FB29}.Developer|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
BaseDirectory = DLL_Project
Expand All @@ -25,12 +36,16 @@ Global
$0.NameConventionPolicy = $2
$2.Rules = $3
$3.NamingRule = $4
$4.Name = Namespaces
$4.AffectedEntity = Namespace
$4.Name = Type Parameters
$4.AffectedEntity = TypeParameter
$4.VisibilityMask = VisibilityMask
$4.NamingStyle = PascalCase
$4.IncludeInstanceMembers = True
$4.IncludeStaticEntities = True
$4.RequiredPrefixes = $31
$31.String = T
$4.RequiredSuffixes = $32
$32.String = Exception
$3.NamingRule = $5
$5.Name = Types
$5.AffectedEntity = Class, Struct, Enum, Delegate
Expand Down Expand Up @@ -155,8 +170,11 @@ Global
$27.DirectoryNamespaceAssociation = None
$27.ResourceNamePolicy = FileFormatDefault
$0.TextStylePolicy = $28
$28.inheritsSet = null
$28.scope = text/x-csharp
$28.inheritsSet = VisualStudio
$28.scope = text/plain
$28.FileWidth = 120
$28.NoTabsAfterNonTabs = True
$28.inheritsScope = text/plain
$0.CSharpFormattingPolicy = $29
$29.AlignEmbeddedStatements = False
$29.SimplePropertyFormatting = ForceNewLine
Expand Down Expand Up @@ -221,14 +239,36 @@ Global
$29.inheritsSet = Mono
$29.inheritsScope = text/x-csharp
$29.scope = text/x-csharp
$29.IndentSwitchSection = True
$29.IndentSwitchCaseSection = False
$29.NewLinesForBracesInProperties = True
$29.NewLinesForBracesInAccessors = True
$29.NewLinesForBracesInAnonymousMethods = True
$29.NewLinesForBracesInControlBlocks = True
$29.NewLinesForBracesInAnonymousTypes = True
$29.NewLinesForBracesInObjectCollectionArrayInitializers = True
$29.NewLinesForBracesInLambdaExpressionBody = True
$29.NewLineForElse = True
$29.NewLineForCatch = True
$29.NewLineForFinally = True
$29.SpacingAfterMethodDeclarationName = False
$29.SpaceWithinMethodDeclarationParenthesis = True
$29.SpaceAfterMethodCallName = False
$29.SpaceWithinMethodCallParentheses = True
$29.SpaceAfterControlFlowStatementKeyword = False
$29.SpaceWithinExpressionParentheses = True
$29.SpaceWithinOtherParentheses = True
$29.SpaceBeforeOpenSquareBracket = False
$29.SpaceWithinSquareBrackets = True
$0.TextStylePolicy = $30
$30.FileWidth = 120
$30.NoTabsAfterNonTabs = True
$30.inheritsSet = VisualStudio
$30.inheritsScope = text/plain
$30.scope = text/plain
description = RimWorld Alpha 12 Community Core Library
version = 0.12.4
description = RimWorld Alpha 14 Community Core Library
version = 0.14.0
outputpath = DLL_Project\bin
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
27 changes: 26 additions & 1 deletion DLL_Project/Alerts/Alert_NeedBatteries.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;

using RimWorld;
using Verse;
Expand Down Expand Up @@ -29,6 +31,29 @@ public override AlertReport Report
{
get
{
if( Find.ListerBuildings.ColonistsHaveBuilding( (thing) =>
{
if(
( thing is Building_Battery )&&
( thing.def.HasComp( typeof( CompPowerBattery ) ) )
)
{ // Building is a battery
return true;
}
if(
( thing.def.HasComp( typeof( CompPowerPlant ) ) )||
( thing.def.HasComp( typeof( CompPowerPlantWind ) ) )||
( thing.def.HasComp( typeof( CompPowerPlantSolar ) ) )||
( thing.def.HasComp( typeof( CompPowerPlantSteam) ) )
)
{ // Building is a power plant
return true;
}
return false;
} ) )
{
return AlertReport.Inactive;
}
// Check for individual power trader which is low
var powerTraders = Find.ListerBuildings.allBuildingsColonist.FindAll( CheckThing );
if( ( powerTraders != null )&&
Expand Down
61 changes: 61 additions & 0 deletions DLL_Project/Alerts/Alert_PasteDispenserNeedsHopper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;

using RimWorld;
using Verse;

namespace CommunityCoreLibrary
{

public class Alert_PasteDispenserNeedsHopper : RimWorld.Alert_PasteDispenserNeedsHopper
{

public override AlertReport Report
{
get
{
var dispensers = Find.ListerBuildings.allBuildingsColonist.Where( b => (
( b.def.thingClass == typeof( Building_NutrientPasteDispenser ) )||
( b.def.thingClass.IsSubclassOf( typeof( Building_NutrientPasteDispenser ) ) )
) ).ToList();

foreach( var dispenser in dispensers )
{
var showAlert = true;
var CompHopperUser = dispenser.TryGetComp<CompHopperUser>();
if( CompHopperUser != null )
{
var hoppers = CompHopperUser.FindHoppers();
if( !hoppers.NullOrEmpty() )
{
showAlert = false;
}
}
if( showAlert )
{
foreach( IntVec3 c in GenAdj.CellsAdjacentCardinal( dispenser ) )
{
Thing thing = (Thing) GridsUtility.GetEdifice( c );
if(
( thing != null )&&
( thing.def == ThingDefOf.Hopper )
)
{
showAlert = false;
break;
}
}
}
if( showAlert )
{
return AlertReport.CulpritIs( dispenser );
}
}
return AlertReport.Inactive;
}
}

}

}
99 changes: 99 additions & 0 deletions DLL_Project/Buildings/Building_AdvancedPasteDispenser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using RimWorld;
using Verse;
using Verse.AI;

namespace CommunityCoreLibrary
{

public class Building_AdvancedPasteDispenser : Building_NutrientPasteDispenser
{

private static CompHopperUser compHopperUser;

public override void SpawnSetup()
{
base.SpawnSetup();
compHopperUser = this.TryGetComp<CompHopperUser>();
}


public override Building AdjacentReachableHopper( Pawn reacher )
{
// Check for generic hoppers
if( compHopperUser != null )
{
var hoppers = compHopperUser.FindHoppers();
if( !hoppers.NullOrEmpty() )
{
foreach( var hopper in hoppers )
{
if(
reacher.CanReach(
( TargetInfo )( ( Thing )hopper.parent ),
PathEndMode.Touch,
reacher.NormalMaxDanger(),
false )
)
{
return (Building) hopper.parent;
}
}
}
}
// Check for vanilla hoppers
return base.AdjacentReachableHopper( reacher );
}

protected override Thing FindFeedInAnyHopper()
{
// Check for generic hoppers
if( compHopperUser != null )
{
var hoppers = compHopperUser.FindHoppers();
if( !hoppers.NullOrEmpty() )
{
foreach( var hopper in hoppers )
{
var resources = hopper.GetAllResources( compHopperUser.Resources );
if( !resources.NullOrEmpty() )
{
foreach( var resource in resources )
{
// This check shouldn't be needed, but we'll do it as a fail-safe
if( Building_NutrientPasteDispenser.IsAcceptableFeedstock( resource.def ) )
{
return resource;
}
}
}
}
}
}
// Check for vanilla hoppers
return base.FindFeedInAnyHopper();
}

public override bool HasEnoughFeedstockInHoppers()
{
int costPerDispense = this.def.building.foodCostPerDispense;
/* Research Project cut from A13
if( ResearchProjectDef.Named( "NutrientResynthesis" ).IsFinished )
{
costPerDispense--;
}
*/
// Check for generic hoppers
if( compHopperUser != null )
{
if( compHopperUser.EnoughResourcesInHoppers( costPerDispense ) )
{
return true;
}
}
// Check for vanilla hoppers
return base.HasEnoughFeedstockInHoppers();
}

}

}
Loading