Extract VATS settings

This commit is contained in:
Canon
2026-02-07 04:39:08 +08:00
parent e33e8cd0b5
commit 37307c6eff
15 changed files with 85 additions and 67 deletions
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<FCP_Settings_Category>Fallout Collaboration Project</FCP_Settings_Category>
<FCP_Settings_Category>FCP Tools</FCP_Settings_Category>
<FCP_MessagePermitLostOnPromotion>Due to {0_possessive} promotion to {1}, {0_labelShort} has lost {0_possessive} {2} permit</FCP_MessagePermitLostOnPromotion>
<!-- Storyteller Joiner -->
<FCP_LetterLabel_SpecialWandererJoins>Special Wanderer: {PAWN_nameDef}</FCP_LetterLabel_SpecialWandererJoins>
+1
View File
@@ -1,2 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VATS/@EntryIndexedValue">VATS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8a85b61a_002D1024_002D4f87_002Db9ef_002D1fdae19930a1/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Parameters"&gt;&lt;ElementKinds&gt;&lt;Kind Name="PARAMETER" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="__" Suffix="" Style="aaBb" /&gt;&lt;ExtraRule Prefix="___" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String></wpf:ResourceDictionary>
@@ -1,4 +1,6 @@
namespace FCP.Core;
using FCP.Core.VATS;
namespace FCP.Core;
public class VATS_GameComponent(Game game) : GameComponent
{
@@ -11,7 +13,7 @@ public class VATS_GameComponent(Game game) : GameComponent
public static void SetSlowMo(Thing slowMoCauser)
{
if (!FCPCoreMod.Settings.EnableSlowDownTime)
if (!VATSMod.Settings.EnableSlowDownTime)
{
return;
}
@@ -35,6 +35,7 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=titles/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=trading/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=utilities/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vats_005Csettings/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FCP/@EntryIndexedValue">FCP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
+1 -52
View File
@@ -1,17 +1,14 @@
using System.Runtime.InteropServices;
using HarmonyLib;
using UnityEngine;
namespace FCP.Core;
public class FCPCoreMod : Mod
{
public static FCPCoreMod mod;
public static FCP_Settings Settings;
public static Harmony harmony;
public AssetBundle bundleInt;
public const string LatePatchesCategory = "FCP.Core.LatePatches";
public FCPCoreMod(ModContentPack content) : base(content)
{
harmony = new Harmony("FCP.Core.Patches"); // PatchesUwU ~ Steve
@@ -21,55 +18,7 @@ public class FCPCoreMod : Mod
harmony.PatchCategory(LatePatchesCategory);
});
mod = this;
Settings = GetSettings<FCP_Settings>();
FCPLog.Warning("Beta version: bugs likely, if not guaranteed! " +
"Report bugs on steam workshop page or on discord: 3HEXN3Qbn4");
}
public override void DoSettingsWindowContents(Rect inRect)
{
base.DoSettingsWindowContents(inRect);
Settings.DoWindowContents(inRect);
}
public override string SettingsCategory()
{
return "FCP_Settings_Category".Translate();
}
public AssetBundle MainBundle
{
get
{
if(bundleInt != null) return bundleInt;
string text = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
text = "StandaloneOSX";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
text = "StandaloneWindows64";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
text = "StandaloneLinux64";
}
string bundlePath = Path.Combine(Content.RootDir, $@"FCP-UnityAssets\Materials\{text}\fcpshaders");
//FCPLog.Message("Bundle Path: " + bundlePath);
AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath);
if (bundle == null)
{
FCPLog.Error("Failed to load bundle at path: " + bundlePath);
}
bundleInt = bundle;
return bundleInt;
}
}
}
@@ -31,7 +31,7 @@ namespace FCP.Core
ThingDef projectileDef = attackVerb.GetProjectile();
Projectile projectile = (Projectile)GenSpawn.Spawn(projectileDef, resultingLine.Source, TargetThingA.Map);
if (FCPCoreMod.Settings.EnableZoom)
if (VATSMod.Settings.EnableZoom)
{
Thing zoomer = GenSpawn.Spawn(FCPDefOf.FCP_VATS_Zoomer, resultingLine.Source, TargetThingA.Map);
((Graphic_Zoomer)zoomer.Graphic).Parent = projectile;
@@ -1,4 +1,5 @@
using UnityEngine;
using FCP.Core.VATS;
using UnityEngine;
namespace FCP.Core.Unity;
@@ -14,7 +15,7 @@ public static class Materials
_lookupMaterials ??= new Dictionary<string, Material>();
if (!_lookupMaterials.ContainsKey(materialName))
{
_lookupMaterials[materialName] = FCPCoreMod.mod.MainBundle.LoadAsset<Material>(materialName);
_lookupMaterials[materialName] = VATSMod.Instance.MainBundle.LoadAsset<Material>(materialName);
}
Material mat = _lookupMaterials[materialName];
+3 -2
View File
@@ -1,4 +1,5 @@
using UnityEngine;
using FCP.Core.VATS;
using UnityEngine;
namespace FCP.Core.Unity;
@@ -14,7 +15,7 @@ public static class Shaders
_lookupShaders ??= new Dictionary<string, Shader>();
if (!_lookupShaders.ContainsKey(shaderName))
{
_lookupShaders[shaderName] = FCPCoreMod.mod.MainBundle.LoadAsset<Shader>(shaderName);
_lookupShaders[shaderName] = VATSMod.Instance.MainBundle.LoadAsset<Shader>(shaderName);
}
Shader shader = _lookupShaders[shaderName];
@@ -11,7 +11,7 @@ public class Dialog_VATS(Verb_AbilityVATS verb, LocalTargetInfo target, IWindowD
public Verb Selected;
public Dictionary<string, float> MultiplierLookup => FCPCoreMod.Settings.MultiplierLookup;
public Dictionary<string, float> MultiplierLookup => VATSMod.Settings.MultiplierLookup;
public override Vector2 InitialSize => new(845f, 740f);
protected virtual Vector2 ButtonSize => new(200f, 40f);
@@ -0,0 +1,63 @@
using System.Runtime.InteropServices;
using UnityEngine;
namespace FCP.Core.VATS;
[UsedImplicitly]
public class VATSMod : Mod
{
public static VATSMod Instance { get; private set; }
public static VATSModSettings Settings { get; private set; }
public VATSMod(ModContentPack content) : base(content)
{
Instance = this;
Settings = GetSettings<VATSModSettings>();
}
public override void DoSettingsWindowContents(Rect inRect)
{
base.DoSettingsWindowContents(inRect);
Settings.DoWindowContents(inRect);
}
public override string SettingsCategory()
{
return "FCP_VATS_Settings_Category".Translate();
}
public AssetBundle MainBundle
{
get
{
if (field != null) return field;
string text = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
text = "StandaloneOSX";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
text = "StandaloneWindows64";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
text = "StandaloneLinux64";
}
string bundlePath = Path.Combine(Content.RootDir, $@"FCP-UnityAssets\Materials\{text}\fcpshaders");
AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath);
if (bundle == null)
{
FCPLog.Error("Failed to load bundle at path: " + bundlePath);
}
field = bundle;
return field;
}
}
}
@@ -1,8 +1,8 @@
using UnityEngine;
using UnityEngine;
namespace FCP.Core;
namespace FCP.Core.VATS;
public class FCP_Settings : ModSettings
public class VATSModSettings : ModSettings
{
public float FlatHitChanceBoost = 0.2f;
public int CooldownTicks = 600;
@@ -31,7 +31,7 @@ public class FCP_Settings : ModSettings
PopulateMissingMultipliers();
}
public void PopulateMissingMultipliers()
private void PopulateMissingMultipliers()
{
if (MultiplierLookup.Count() >= DefDatabase<BodyPartDef>.AllDefs.Count())
{
@@ -19,7 +19,7 @@ public class Thing_Zoomer : ThingWithComps
return;
}
if (startTicks + FCPCoreMod.Settings.ZoomTimeout < Find.TickManager.TicksGame)
if (startTicks + VATSMod.Settings.ZoomTimeout < Find.TickManager.TicksGame)
{
Destroy();
}
@@ -17,7 +17,7 @@ public class Verb_AbilityVATS : Verb_AbilityShoot
get => ability;
set
{
AccessTools.Field(typeof(Ability), "cooldownDuration").SetValue(value, FCPCoreMod.Settings.CooldownTicks);
AccessTools.Field(typeof(Ability), "cooldownDuration").SetValue(value, VATSMod.Settings.CooldownTicks);
ability = value;
}
}