C#:
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("PrefabsRemoval", "WuttyJ", "1.0.0")]
class PrefabsRemoval : RustPlugin
{
private List<string> prefabPaths = new List<string>
{
"assets/bundled/prefabs/static/door.hinged.security.blue.prefab",
"assets/bundled/prefabs/static/door.hinged.security.green.prefab",
"assets/bundled/prefabs/static/door.hinged.security.red.prefab"
// You can adjust this list to your needs
};
private void OnServerInitialized()
{
RemovePrefabsFromMap();
}
private void RemovePrefabsFromMap()
{
foreach (var prefabPath in prefabPaths)
{
var entities = UnityEngine.Object.FindObjectsOfType<BaseEntity>();
int count = 0;
foreach (var entity in entities)
{
if (entity != null && entity.PrefabName == prefabPath)
{
entity.Kill();
count++;
}
}
Puts($"Removed {count} instances of prefab: {prefabPath}");
}
}
}
}