mirror of
https://github.com/FalloutCollaborationProject/FCP-Tools.git
synced 2026-07-27 16:59:37 -07:00
Config refactor; pawn null-check; csproj changes
Add updated FCP_StimPacks.dll under Source and update the distributed assembly. Clean up ModConfig code: normalize namespace/bracing style, move Config fields into the Configs class, and implement ExposeData method body. Add a null-check in PawnPatches to return early if __instance.story is null to prevent potential NREs. Update Stims.csproj to target C# 7.3, disable implicit usings and global usings generation for compatibility.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,32 +1,33 @@
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace StimPacks.ModConfig;
|
||||
|
||||
public class ConfigUI : Mod
|
||||
namespace StimPacks.ModConfig
|
||||
{
|
||||
public static Configs Config;
|
||||
public ConfigUI(ModContentPack content) : base(content)
|
||||
{
|
||||
Config = GetSettings<Configs>();
|
||||
}
|
||||
public class ConfigUI : Mod
|
||||
{
|
||||
public static Configs Config;
|
||||
public ConfigUI(ModContentPack content) : base(content)
|
||||
{
|
||||
Config = GetSettings<Configs>();
|
||||
}
|
||||
|
||||
public override string SettingsCategory()
|
||||
{
|
||||
return "Stims";
|
||||
}
|
||||
|
||||
public override void DoSettingsWindowContents(Rect inRect)
|
||||
{
|
||||
Listing_Standard listing = new Listing_Standard();
|
||||
listing.Begin(inRect);
|
||||
public override string SettingsCategory()
|
||||
{
|
||||
return "Stims";
|
||||
}
|
||||
|
||||
listing.CheckboxLabeled("AutoStim".Translate(), ref Config.AutoStim, "AutoStimDesc".Translate());
|
||||
|
||||
listing.CheckboxLabeled("TeetotalerAutoStim".Translate(), ref Config.TeetotalerAutoStim, "TeetotalerAutoStimDesc".Translate());
|
||||
|
||||
listing.End();
|
||||
|
||||
base.DoSettingsWindowContents(inRect);
|
||||
}
|
||||
public override void DoSettingsWindowContents(Rect inRect)
|
||||
{
|
||||
Listing_Standard listing = new Listing_Standard();
|
||||
listing.Begin(inRect);
|
||||
|
||||
listing.CheckboxLabeled("AutoStim".Translate(), ref Config.AutoStim, "AutoStimDesc".Translate());
|
||||
|
||||
listing.CheckboxLabeled("TeetotalerAutoStim".Translate(), ref Config.TeetotalerAutoStim, "TeetotalerAutoStimDesc".Translate());
|
||||
|
||||
listing.End();
|
||||
|
||||
base.DoSettingsWindowContents(inRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
using Verse;
|
||||
|
||||
namespace StimPacks.ModConfig;
|
||||
|
||||
public class Configs : ModSettings
|
||||
namespace StimPacks.ModConfig
|
||||
{
|
||||
public bool AutoStim = true;
|
||||
public bool TeetotalerAutoStim = false;
|
||||
public override void ExposeData()
|
||||
public class Configs : ModSettings
|
||||
{
|
||||
Scribe_Values.Look(ref AutoStim, "MaxLevel", true);
|
||||
Scribe_Values.Look(ref TeetotalerAutoStim, "TeetotalerAutoStim", false);
|
||||
base.ExposeData();
|
||||
public bool AutoStim = true;
|
||||
public bool TeetotalerAutoStim = false;
|
||||
public override void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref AutoStim, "MaxLevel", true);
|
||||
Scribe_Values.Look(ref TeetotalerAutoStim, "TeetotalerAutoStim", false);
|
||||
base.ExposeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace StimPacks.Patches
|
||||
{
|
||||
if(!ConfigUI.Config.AutoStim)
|
||||
return;
|
||||
if(__instance.story == null)
|
||||
return;
|
||||
if(!ConfigUI.Config.TeetotalerAutoStim && __instance.story.traits.DegreeOfTrait(TraitDefOf.DrugDesire) < 0)
|
||||
return;
|
||||
if (totalDamageDealt > 0)
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<RootNamespace>StimPacks</RootNamespace>
|
||||
<AssemblyName>FCP_StimPacks</AssemblyName>
|
||||
<AssemblyTitle>Fallout Stimpacks Module</AssemblyTitle>
|
||||
<LangVersion>14</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<GenerateGlobalUsings>false</GenerateGlobalUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user