Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_NetPackageQuestEntitySpawn.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

32 lines
1.4 KiB
C#

namespace Harmony.NetPackageQuestEntitySpawnPatches
{
[HarmonyPatch(typeof(NetPackageQuestEntitySpawn))]
[HarmonyPatch("ProcessPackage")]
public class ProcessPackagePatch
{
public static bool Prefix(NetPackageQuestEntitySpawn __instance, World _world, GameManager _callbacks)
{
if (_world == null)
return false;
if (__instance.entityType == -1)
{
EntityPlayer entity = GameManager.Instance.World.GetEntity(__instance.entityIDQuestHolder) as EntityPlayer;
RebirthVariables.gameStage = entity.gameStage;
if (RebirthUtilities.ScenarioSkip())
{
//Log.Out("NetPackageQuestEntitySpawnPatches-ProcessPackage START: " + entity.biomeStandingOn.m_sBiomeName + $" ({entity.position})");
string biomeName = RebirthUtilities.GetBiomeName(entity);
RebirthUtilities.SetHiveSpawnGroup(biomeName);
}
__instance.entityType = EntityGroups.GetRandomFromGroup(GameStageDefinition.GetGameStage(__instance.gamestageGroup).GetStage(entity.PartyGameStage).GetSpawnGroup(0).groupName, ref NetPackageQuestEntitySpawn.lastClassId);
}
QuestActionSpawnEnemy.SpawnQuestEntity(__instance.entityType, __instance.entityIDQuestHolder);
return false;
}
}
}