-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModInit.cs
114 lines (98 loc) · 4.8 KB
/
ModInit.cs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using System.Reflection;
using BattleTech;
using IRBTModUtils.Logging;
using TisButAScratch.Framework;
namespace TisButAScratch
{
public static class ModInit
{
public static DeferringLogger modLog;
public static string modDir;
public static Settings modSettings;
public const string HarmonyPackage = "us.tbone.TisButAScratch";
public static void Init(string directory, string settingsJSON)
{
modDir = directory;
Exception settingsException = null;
try
{
using (StreamReader reader = new StreamReader($"{modDir}/settings.json"))
{
string jsData = reader.ReadToEnd();
ModInit.modSettings = JsonConvert.DeserializeObject<Settings>(jsData);
}
}
catch (Exception ex)
{
settingsException =ex;
ModInit.modSettings = new Settings();
}
modLog = new DeferringLogger(modDir, "TBAS", false, modSettings.enableTrace);
//HarmonyInstance.DEBUG = true;
if (settingsException != null)
{
ModInit.modLog?.Error?.Write($"EXCEPTION while reading settings file! Error was: {settingsException}");
}
ModInit.modLog?.Info?.Write($"Initializing TisButAScratch - Version {typeof(Settings).Assembly.GetName().Version}");
PilotInjuryManager.ManagerInstance.Initialize();
PilotInjuryHolder.HolderInstance.Initialize();
//var harmony = HarmonyInstance.Create(HarmonyPackage);
//harmony.PatchAll(Assembly.GetExecutingAssembly());
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), HarmonyPackage);
}
}
public class Settings
{
public bool enableLogging = false;
public bool enableTrace = false;
public bool debugPatchEnabled = false;
public bool enableConsciousness = true;
public bool enableLethalTorsoHead = false;
public bool debilIncapacitates = false;
public bool BleedingOutLethal = false;
public string BleedingOutSuffix = "_bleedout";
public bool enableInternalDmgInjuries = false;
public string internalDmgStatName = "InjureOnStructDmg";
public int internalDmgInjuryLimit = -1;
public float internalDmgLvlReq = 0f;
public int missionKillSeverityThreshold = 20;
public bool reInjureWeightAppliesCurrentContract = false;
public int reInjureLocWeight = 0;
public string injureVehiclePilotOnDestroy = "MAX"; // will check for "MAX", "HIGH", "SINGLE", "OFF". HIGH = MaxInjuries-1 (pilot f'd up, but not dead.)
public List<string> crewOrCockpitCustomID = new List<string>();
public List<string> lifeSupportCustomID = new List<string>();
public bool disableTBASTroopers = false;
public string disableTBASTag = "TBAS_Disabled";
public string OverheatInjuryStat = "InjureOnOverheat";
public string isTorsoMountStatName = "isTorsoMount";
public bool lifeSupportSupportsLifeTM = false;
public bool timeHealsAllWounds = false;
public int debilSeverityThreshold = -1;
public int severityCost = 360;
public int debilitatedCost = 1080;
public float medtechDebilMultiplier = 0.75f;
public string pilotPainShunt = "pilot_PainShunt";
public Dictionary<string, PilotingReq> pilotingReqs = new Dictionary<string, PilotingReq>(); // change format. key is now component tag we are settings requirements for
public float injuryHealTimeMultiplier = 0f;
public List<ChassisLocations> internalDmgInjuryLocs = new List<ChassisLocations>();
public List<Injury> InjuryEffectsList = new List<Injury>();
public List<Injury> InternalDmgInjuries = new List<Injury>();
public string DisableBleedingStat = "DisablesBleeding";
public string NullifiesInjuryEffectsStat = "NullifiesInjuryEffects";
public float additiveBleedingFactor = 0f; // if negative, subtract, if decimal multiply.
public float minBloodBank = 1;
public float baseBloodBankAdd = 0;
public float factorBloodBankMult = 1.5f;
public bool UseGutsForBloodBank = true; // if false, uses Health
public bool UseBleedingEffects = true;
public List<BleedingEffect> BleedingEffects = new List<BleedingEffect>();
public bool UseSimBleedingEffects = true;
public List<SimBleedingEffect> SimBleedingEffects = new List<SimBleedingEffect>();
public bool CanIntentionallyHotBunk = false;
public List<OvercrowdedEffect> OvercrowdingEffects = new List<OvercrowdedEffect>();
}
}