mirror of
https://github.com/FalloutCollaborationProject/FCP-Tools.git
synced 2026-07-27 16:59:37 -07:00
Introduce a new scenario settings tab with configurable starting year support and optional "start enlisted" scenario behavior, including updated scenario defs and opening text tokens. This also folds enlist settings into the main mod settings flow, adds quest and unique-character helpers for companion spawns and join quests, and includes smaller gameplay patches like NCR tent handling, Legion ear butcher drops, and quieter homing projectile logging.
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using HarmonyLib;
|
|
|
|
namespace FCP.Core
|
|
{
|
|
[HarmonyPatch(typeof(Pawn), nameof(Pawn.SpawnSetup))]
|
|
public static class Patch_AnimalCompanionSpawn
|
|
{
|
|
public static void Postfix(Pawn __instance, Map map)
|
|
{
|
|
if (map == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
UniqueCharactersTracker tracker = UniqueCharactersTracker.Instance;
|
|
if (tracker == null || !tracker.TryGetPawnCharacter(__instance, out UniqueCharacter character))
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (CharacterBaseDefinition definition in character.def.definitions)
|
|
{
|
|
if (definition is not CharacterAnimalCompanionDefinition animalDef || animalDef.animalCharacterDef == null)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
Pawn animal = tracker.GetOrGenPawn(animalDef.animalCharacterDef);
|
|
if (animal.Dead || animal.Spawned)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
IntVec3 spawnCell = CellFinder.RandomClosewalkCellNear(__instance.Position, map, 3);
|
|
GenSpawn.Spawn(animal, spawnCell, map);
|
|
animal.SetFaction(__instance.Faction);
|
|
|
|
if (animal.playerSettings != null)
|
|
{
|
|
animal.playerSettings.Master = __instance;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|