forked from fluffy-mods/RW_Outfitter
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6605256
commit dda37e1
Showing
7 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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 |
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
Binary file not shown.