Skip to content

Commit

Permalink
Merge pull request #24 from RimWorldCCLTeam/development
Browse files Browse the repository at this point in the history
v0.12.2 Update
  • Loading branch information
ForsakenShell committed Sep 12, 2015
2 parents 2586cd5 + 6f46fb0 commit 5630c0f
Show file tree
Hide file tree
Showing 33 changed files with 160 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,6 +7,7 @@
*.userprefs
*.sln.docstates
DLL_Project/Source-DLLs/*.dll
DLL_Project/*.bat

# Build results
[Dd]ebug/
Expand Down
7 changes: 5 additions & 2 deletions DLL_Project/Commands/ChangeColor.cs
Expand Up @@ -35,10 +35,13 @@ public override SoundDef CurActivateSound
}
}

public ChangeColor( CompColoredLight light )
public ChangeColor(
CompColoredLight light,
Texture2D designatorIcon
)
{
parentLight = light;
icon = Icon.NextButton;
icon = designatorIcon;
defaultLabel = "CommandChangeColorLabel".Translate();
}

Expand Down
9 changes: 7 additions & 2 deletions DLL_Project/Commands/DefOrThingCompInRoom.cs
Expand Up @@ -54,10 +54,15 @@ public override SoundDef CurActivateSound
}
}

public DefOrThingCompInRoom ( Thing parent, Type RequiredType, string label )
public DefOrThingCompInRoom (
Thing parent,
Type RequiredType,
string label,
Texture2D designatorIcon
)
{
parentThing = parent;
icon = Icon.NextButton;
icon = designatorIcon;

parentType = RequiredType;

Expand Down
9 changes: 7 additions & 2 deletions DLL_Project/Commands/TouchingByDef.cs
Expand Up @@ -48,10 +48,15 @@ public override SoundDef CurActivateSound
}
}

public TouchingByDef( Thing parent, Action_OnThings LeftClick = null, Action_OnThings RightClick = null )
public TouchingByDef(
Thing parent,
Texture2D designatorIcon,
Action_OnThings LeftClick = null,
Action_OnThings RightClick = null
)
{
parentThing = parent;
icon = Icon.NextButton;
icon = designatorIcon;

ClickLeft = LeftClick;
ClickRight = RightClick;
Expand Down
9 changes: 7 additions & 2 deletions DLL_Project/Commands/TouchingByLinker.cs
Expand Up @@ -47,10 +47,15 @@ public override SoundDef CurActivateSound
}
}

public TouchingByLinker( Thing parent, Action_OnThings LeftClick = null, Action_OnThings RightClick = null )
public TouchingByLinker(
Thing parent,
Texture2D designatorIcon,
Action_OnThings LeftClick = null,
Action_OnThings RightClick = null
)
{
parentThing = parent;
icon = Icon.NextButton;
icon = designatorIcon;

ClickLeft = LeftClick;
ClickRight = RightClick;
Expand Down
11 changes: 9 additions & 2 deletions DLL_Project/Commands/TouchingByThingComp.cs
Expand Up @@ -50,10 +50,17 @@ public override SoundDef CurActivateSound
}
}

public TouchingByThingComp( Thing parent, Type RequiredType, string label, Action_OnThings LeftClick = null, Action_OnThings RightClick = null )
public TouchingByThingComp(
Thing parent,
Type RequiredType,
string label,
Texture2D designatorIcon,
Action_OnThings LeftClick = null,
Action_OnThings RightClick = null
)
{
parentThing = parent;
icon = Icon.NextButton;
icon = designatorIcon;

parentType = RequiredType;

Expand Down
6 changes: 4 additions & 2 deletions DLL_Project/CommunityCoreLibrary.csproj
Expand Up @@ -122,8 +122,10 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup />
<PropertyGroup>
<PostBuildEvent>call "$(ProjectDir)PostBuild.bat" $(ConfigurationName) "$(TargetPath)" $(SolutionDir)</PostBuildEvent>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<None Include="PostBuild.bat" />
</ItemGroup>
</Project>
34 changes: 31 additions & 3 deletions DLL_Project/Defs/ModHelperDef.cs
Expand Up @@ -113,6 +113,13 @@ public bool IsValid
errors += "\n\tUnable to resolve designationCategoryDef \"" + data.designationCategoryDef + "\"";
isValid = false;
}
if ( ( data.designatorNextTo != null )&&
( data.designatorNextTo.BaseType != typeof( Designator ) )
)
{
errors += "\n\tUnable to resolve designatorNextTo \"" + data.designatorNextTo + "\"";
isValid = false;
}
}
}

Expand Down Expand Up @@ -287,9 +294,30 @@ public void InjectDesignators()
{
// Create the new designator
var designatorObject = (Designator) Activator.CreateInstance( data.designatorClass );

// Inject the designator
designationCategory.resolvedDesignators.Add(designatorObject);

if( data.designatorNextTo == null )
{
// Inject the designator at the end
designationCategory.resolvedDesignators.Add( designatorObject );
}
else
{
// Prefers to be beside a specific designator
var designatorIndex = designationCategory.resolvedDesignators.FindIndex( d => (
( d.GetType() == data.designatorNextTo )
) );
if( designatorIndex < 0 )
{
// Other designator doesn't exist (yet?)
// Inject the designator at the end
designationCategory.resolvedDesignators.Add( designatorObject );
}
else
{
// Inject beside desired designator
designationCategory.resolvedDesignators.Insert( designatorIndex + 1, designatorObject );
}
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions DLL_Project/PostBuild.bat
@@ -0,0 +1,36 @@
REM DO NOT RECOMMIT THIS FILE!
REM This is a local file copy after build. Get it once and your .gitnore
REM should handle it after that. Make all your local copies at the end.

REM Set this to your local RimWorld install path and CCL Assemblies directory
Set InstalledCCLAssemblies="/badkarma/"

if NOT EXIST %InstalledCCLAssemblies% (
echo Missing or invalid copy target:
echo %InstalledCCLAssemblies%
EXIT -1
)

echo Build Config: %1
echo Build Target: %2
echo Solution Path: %3
echo CCL Install Path: %InstalledCCLAssemblies%

echo Copy to RimWorld
copy %2 %InstalledCCLAssemblies%

if %1 == Debug (
echo Copy to Modders Resource
copy %2 "%3_Mod\Modders Resource\Community Core Library\Assemblies"
) else (
echo Copy to User Release
copy %2 "%3_Mod\User Release\Community Core Library\Assemblies"
)

REM Add any other local copies here
rem goto Finished

rem echo Copy to ModPile
rem copy %2 "C:\Utils\dev\Projects\ModPile\ModPile_ProjectDLL\Source-DLLs"

:Finished
7 changes: 3 additions & 4 deletions DLL_Project/StaticClasses/Icons.cs
Expand Up @@ -8,10 +8,9 @@ public static class Icon
{

public static readonly Texture2D GrowZone = ContentFinder<Texture2D>.Get( "UI/Designators/ZoneCreate_Growing" );
public static readonly Texture2D NextButton = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/NextButton" );
public static readonly Texture2D RoomButton = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/RoomButton" );
public static readonly Texture2D LinkedButton = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/LinkedButton" );
public static readonly Texture2D GroupButton = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/GroupButton" );
public static readonly Texture2D ShareSowTag = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/ShareSowTag" );
public static readonly Texture2D ShareLightColor = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/ShareLightColor" );
public static readonly Texture2D SelectLightColor = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/SelectLightColor" );

public static readonly Texture2D HelpMenuArrowUp = ContentFinder<Texture2D>.Get( "UI/HelpMenu/ArrowDown" );
public static readonly Texture2D HelpMenuArrowDown = ContentFinder<Texture2D>.Get( "UI/HelpMenu/ArrowUp" );
Expand Down
2 changes: 2 additions & 0 deletions DLL_Project/Structures/DesignatorData.cs
Expand Up @@ -12,5 +12,7 @@ public struct DesignatorData

public string designationCategoryDef;

public Type designatorNextTo;

}
}
19 changes: 16 additions & 3 deletions DLL_Project/ThingComps/CompColoredLight.cs
Expand Up @@ -42,7 +42,10 @@ CompGlower CompGlower
ChangeColor GizmoChangeColor {
get{
if( _GizmoChangeColor == null )
_GizmoChangeColor = new ChangeColor( this );
_GizmoChangeColor = new ChangeColor(
this,
Icon.SelectLightColor
);
return _GizmoChangeColor;
}
}
Expand All @@ -51,7 +54,12 @@ CompGlower CompGlower
TouchingByLinker GizmoTouchingByLinker {
get {
if( _GizmoTouchingByLinker == null )
_GizmoTouchingByLinker = new TouchingByLinker( parent, GroupColorChange, GroupColorChange );
_GizmoTouchingByLinker = new TouchingByLinker(
parent,
Icon.ShareLightColor,
GroupColorChange,
GroupColorChange
);
return _GizmoTouchingByLinker;
}
}
Expand All @@ -61,7 +69,12 @@ CompGlower CompGlower
get {
if( _GizmoDefOrThingCompInRoom == null )
{
_GizmoDefOrThingCompInRoom = new DefOrThingCompInRoom( parent, GetType(), "CommandChangeRoommateColorLabel".Translate() );
_GizmoDefOrThingCompInRoom = new DefOrThingCompInRoom(
parent,
GetType(),
"CommandChangeRoommateColorLabel".Translate(),
Icon.ShareLightColor
);
_GizmoDefOrThingCompInRoom.LabelByDef = Translator.Translate( "CommandChangeRoommateColorLClick", parent.def.label );
_GizmoDefOrThingCompInRoom.ClickByDef = GroupColorChange;
_GizmoDefOrThingCompInRoom.LabelByThingComp = "CommandChangeRoommateColorRClick".Translate();
Expand Down
31 changes: 27 additions & 4 deletions DLL_Project/ThingComps/CompNeighbourlyGrower.cs
Expand Up @@ -32,6 +32,7 @@ TouchingByThingComp GizmoTouchingByThingComp
parent,
GetType(),
"CommandChangeTouchingPlantLabel".Translate(),
Icon.ShareSowTag,
GroupPlantChange,
GroupPlantChange
);
Expand All @@ -50,6 +51,7 @@ TouchingByLinker GizmoTouchingByLinker
_GizmoTouchingByLinker =
new TouchingByLinker(
parent,
Icon.ShareSowTag,
GroupPlantChange,
GroupPlantChange
);
Expand All @@ -69,7 +71,8 @@ DefOrThingCompInRoom GizmoDefOrThingCompInRoom
new DefOrThingCompInRoom(
parent,
GetType(),
"CommandChangeRoommatePlantLabel".Translate()
"CommandChangeRoommatePlantLabel".Translate(),
Icon.ShareSowTag
);
_GizmoDefOrThingCompInRoom.LabelByDef = "CommandChangeRoommatePlantLClick".Translate( parent.def.label );
_GizmoDefOrThingCompInRoom.ClickByDef = GroupPlantChange;
Expand Down Expand Up @@ -127,20 +130,40 @@ void GroupPlantChange( List< Thing > things )
return;
}
#endif

// Get plant to grow
var plantDef = thisGrower.GetPlantDefToGrow();
if(
( plantDef == null )||
( plantDef.plant == null )||
( plantDef.plant.sowTags.NullOrEmpty() )
)
{
// "Plant" doesn't contain the required information
Log.Error( "Community Core Library :: CompNeighbourlyGrower :: " + parent.def.defName + " unable to resolve to plant def to grow! - " + plantDef.defName );
return;
}

// Now set their plant
foreach( Thing g in things )
{
// Should be a Building_PlantGrower
var grower = g as Building_PlantGrower;
#if DEBUG
if( grower == null )
if(
( grower == null )||
( grower.def.building == null )||
( string.IsNullOrEmpty( grower.def.building.sowTag ) )
)
{
Log.Error( "Community Core Library :: CompNeighbourlyGrower :: " + g.def.defName + " unable to resolve to Building_PlantGrower!" );
return;
}
#endif
grower.SetPlantDefToGrow( thisGrower.GetPlantDefToGrow() );
// Only set if the sow tags match
if( plantDef.plant.sowTags.Contains( grower.def.building.sowTag ) )
{
grower.SetPlantDefToGrow( plantDef );
}
}
}

Expand Down
Expand Up @@ -7,7 +7,7 @@

<url>https://ludeon.com/forums/index.php?topic=14172.0</url>

<targetVersion>RimWorld Alpha 12</targetVersion>
<targetVersion>RimWorld Alpha 12d</targetVersion>

<description>Provides a common core set of library functions for modders as well as making required core changes.\n\nThis must be loaded immediately after "Core" unless another mod explicitly tells you to load it between "Core" this mod.</description>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -26,6 +26,9 @@
<designationCategoryDef>DesignationCategoryDef<designationCategoryDef>
[required] Designation Category to inject designator into
<designatorNextTo>Designator</designatorNextTo>
[optional] Class name of Designator to inject beside (immediately after)
</li>
</Designators>
Expand Down
2 changes: 1 addition & 1 deletion _Mod/User Release/Community Core Library/About/About.xml
Expand Up @@ -7,7 +7,7 @@

<url>https://ludeon.com/forums/index.php?topic=14172.0</url>

<targetVersion>RimWorld Alpha 12</targetVersion>
<targetVersion>RimWorld Alpha 12d</targetVersion>

<description>Provides a common core set of library functions for modders as well as making required core changes.\n\nThis must be loaded immediately after "Core" unless another mod explicitly tells you to load it between "Core" this mod.</description>

Expand Down
Binary file not shown.
Expand Up @@ -31,5 +31,4 @@

<RefrigeratedStorage>냉장 보관</RefrigeratedStorage>


</LanguageData>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5630c0f

Please sign in to comment.