Skip to content

Commit

Permalink
addedd mp injector
Browse files Browse the repository at this point in the history
  • Loading branch information
Killface1980 committed Sep 15, 2016
1 parent 6605256 commit dda37e1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 3 deletions.
Binary file modified Assemblies/Outfitter.dll
Binary file not shown.
Binary file modified Source/.vs/Outfitter/v14/.suo
Binary file not shown.
3 changes: 1 addition & 2 deletions Source/Outfitter/ApparelStatCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using RimWorld;
using UnityEngine;
using Verse;
using static UnityEngine.GUILayout;

namespace Outfitter
{
Expand Down Expand Up @@ -687,7 +686,7 @@ public static void DrawStatRow(ref Vector2 cur, float width, StatPriority stat,
GUI.color = Color.white;
break;
}
float weight = HorizontalSlider(stat.Weight, -1.5f, 1.5f);
float weight = GUI.HorizontalSlider(sliderRect, stat.Weight, -1.5f, 1.5f);
if (Mathf.Abs(weight - stat.Weight) > 1e-4)
{
stat.Weight = weight;
Expand Down
38 changes: 38 additions & 0 deletions Source/Outfitter/MapComponentInjector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

using System;
using UnityEngine;
using Verse;
using Object = UnityEngine.Object;

namespace Outfitter // Replace with yours.
{
// This code is mostly borrowed from Pawn State Icons mod by Dan Sadler, which has open source and no license I could find, so...
[StaticConstructorOnStartup]
public class MapComponentInjector : MonoBehaviour
{
private static Type outfitter = typeof(MapComponent_Outfitter);


#region No editing required


public void FixedUpdate()
{
if (Current.ProgramState != ProgramState.MapPlaying)
{
return;
}


if (Find.Map.components.FindAll(c => c.GetType() == outfitter).Count == 0)
{
Find.Map.components.Add((MapComponent)Activator.CreateInstance(outfitter));

Log.Message("Outfitter :: Added Stats to the map.");
}
Destroy(this);
}

}
}
#endregion
5 changes: 4 additions & 1 deletion Source/Outfitter/OF_SpecialInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Outfitter;
using UnityEngine;
using Verse;
// Toggle in Hospitality Properties
#if NoCCL
Expand Down Expand Up @@ -68,6 +68,9 @@ public override bool Inject()
def.inspectorTabsResolved.Add(ITabManager.GetSharedInstance(typeof(ITab_Pawn_Outfitter)));
}

GameObject initializer = new GameObject("OutfitterMapComponentInjector");
initializer.AddComponent<MapComponentInjector>();
UnityEngine.Object.DontDestroyOnLoad(initializer);

return true;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Outfitter/Outfitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<ItemGroup>
<Compile Include="ApparelStatCache.cs" />
<Compile Include="DetourAttribute.cs" />
<Compile Include="MapComponentInjector.cs" />
<Compile Include="NoCCL\Detours.cs" />
<Compile Include="NoCCL\SpecialInjector.cs" />
<Compile Include="OF_SpecialInjector.cs" />
Expand Down
Binary file modified Source/Outfitter/obj/NoCCL/Outfitter.dll
Binary file not shown.

0 comments on commit dda37e1

Please sign in to comment.