-
Notifications
You must be signed in to change notification settings - Fork 16
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 #11 from NoImageAvailable/fluffy-pr-merge
Fluffy pr merge
- Loading branch information
Showing
14 changed files
with
341 additions
and
205 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
This file was deleted.
Oops, something went wrong.
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
53 changes: 53 additions & 0 deletions
53
Source/CombatRealism/Combat_Realism/Loadouts/ITabInjector.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,53 @@ | ||
using CommunityCoreLibrary; | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace Combat_Realism | ||
{ | ||
public class ITabInjector : SpecialInjector | ||
{ | ||
#region Methods | ||
|
||
public override bool Inject() | ||
{ | ||
// get reference to lists of itabs | ||
var itabs = ThingDefOf.Human.inspectorTabs; | ||
var itabsResolved = ThingDefOf.Human.inspectorTabsResolved; | ||
|
||
#if DEBUG | ||
Log.Message( "Inspector tab types on humans:" ); | ||
foreach ( var tab in itabs ) | ||
{ | ||
Log.Message( "\t" + tab.Name ); | ||
} | ||
Log.Message( "Resolved tab instances on humans:" ); | ||
foreach ( var tab in itabsResolved ) | ||
{ | ||
Log.Message( "\t" + tab.labelKey.Translate() ); | ||
} | ||
#endif | ||
|
||
// replace ITab in the unresolved list | ||
var index = itabs.IndexOf( typeof( ITab_Pawn_Gear ) ); | ||
if ( index != -1 ) | ||
{ | ||
itabs.Remove( typeof( ITab_Pawn_Gear ) ); | ||
itabs.Insert( index, typeof( ITab_Inventory ) ); | ||
} | ||
|
||
// replace resolved ITab, if needed. | ||
var oldGearTab = ITabManager.GetSharedInstance( typeof( ITab_Pawn_Gear ) ); | ||
var newGearTab = ITabManager.GetSharedInstance( typeof( ITab_Inventory ) ); | ||
if ( !itabsResolved.NullOrEmpty() && itabsResolved.Contains( oldGearTab ) ) | ||
{ | ||
int resolvedIndex = itabsResolved.IndexOf( oldGearTab ); | ||
itabsResolved.Insert( resolvedIndex, newGearTab ); | ||
itabsResolved.Remove( oldGearTab ); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
#endregion Methods | ||
} | ||
} |
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
File renamed without changes.
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
File renamed without changes.
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
Oops, something went wrong.