Skip to content

Commit

Permalink
Merge pull request #116 from RimWorldCCLTeam/development
Browse files Browse the repository at this point in the history
Alpha 14 Update
  • Loading branch information
ForsakenShell authored Jul 15, 2016
2 parents 6ad7ad0 + 3958af0 commit 4e278d1
Show file tree
Hide file tree
Showing 207 changed files with 4,452 additions and 4,547 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*.user
*.userprefs
*.sln.docstates
DLL_Project/Source-DLLs/*.dll
DLL_Project/bin/*.dll
DLL_Project/*.bat

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

# Roslyn cache directories
Expand Down
5 changes: 3 additions & 2 deletions CommunityCoreLibrary.sln
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ Global
$30.inheritsSet = VisualStudio
$30.inheritsScope = text/plain
$30.scope = text/plain
description = RimWorld Alpha 12 Community Core Library
version = 0.12.7
description = RimWorld Alpha 14 Community Core Library
version = 0.14.0
outputpath = DLL_Project\bin
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
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

0 comments on commit 4e278d1

Please sign in to comment.