forked from RimWorldMod/Tech-Advancing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapComponentInjector.cs
More file actions
29 lines (24 loc) · 812 Bytes
/
MapComponentInjector.cs
File metadata and controls
29 lines (24 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using UnityEngine;
using Verse;
using System.Linq;
using Object = UnityEngine.Object;
using RimWorld;
namespace TechAdvancing
{
class MapComponentInjector : MonoBehaviour
{
private static Type TA_Storage = typeof(MapCompSaveHandler);
public void FixedUpdate()
{
if (Current.ProgramState != ProgramState.Playing)
return;
foreach (var map in Find.Maps.Where(m => m.GetComponent<MapCompSaveHandler>() == null))
{
map.components.Add(new MapCompSaveHandler(map)); //for saving data associated with a map
LogOutput.WriteLogMessage(Errorlevel.Information, "Added a MapComponent to store some information.");
}
Destroy(this);
}
}
}