Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using System.Collections.Generic;
namespace Harmony.DroneManagerPatches
{
[HarmonyPatch(typeof(DroneManager), "RemoveAllDronesFromMap")]
public class RemoveAllVehiclesFromMapPatch
{
public static bool Prefix(DroneManager __instance)
{
GameManager instance = GameManager.Instance;
PersistentPlayerList persistentPlayerList = instance.GetPersistentPlayerList();
World world = instance.World;
foreach (KeyValuePair<PlatformUserIdentifierAbs, PersistentPlayerData> player in persistentPlayerList.Players)
{
EntityPlayer entity = world.GetEntity(player.Value.EntityId) as EntityPlayer;
if (entity != null)
{
OwnedEntityData[] ownedEntities = entity.GetOwnedEntities();
//Log.Out("DroneManagerPatches-RemoveAllVehiclesFromMap ownedEntities.Length: " + ownedEntities.Length);
for (int i = 0; i < ownedEntities.Length; ++i)
{
//Log.Out("DroneManagerPatches-RemoveAllVehiclesFromMap ___dronesActive.Count: " + ___dronesActive.Count);
EntityDrone entityDrone = __instance.dronesActive.Find(v => v.entityId == ownedEntities[i].Id);
if (entityDrone != null && entity.HasOwnedEntity(entityDrone.entityId))
{
//Log.Out("DroneManagerPatches-RemoveAllVehiclesFromMap entityDrone.entityId: " + entityDrone.entityId);
GameManager.Instance.World.RemoveEntityFromMap(entityDrone, EnumRemoveEntityReason.Unloaded);
}
}
}
}
return false;
}
}
}