Looking for plugin which would do automated seld authorization for fresh placed turrets and fill them up with ammo. I would like to be bale to set amount of ammo in config file. And of course auto turn turret on.
Turret auto authorization (Rust)
You only get authorized using this plugin but need manually load ammo and turn turret on.
I wrote a plugin that does this. It's not ready to put online yet. But here is some code from it.
bool started = false;
void OnServerInitialized()
{
started = true;
}
private void OnEntitySpawned(BaseNetworkable entity)
{
if (started && entity is AutoTurret)
{
AutoTurret turret = entity as AutoTurret;
//turret.bulletSpeed = 200f;
//turret.sightRange = 30f;
//turret.aimCone = 1f;
StorageContainer sc = entity as StorageContainer;
ItemContainer ic = sc.inventory;
Item primer = ItemManager.CreateByItemID(turret.ammoType.itemid, 69);
if (primer != null)
primer.MoveToContainer(ic, 0, true);
NextFrame(() =>
{
turret.authorizedPlayers.Add(new ProtoBuf.PlayerNameID
{
userid = turret.OwnerID,
username = "SmartDeploy",
ShouldPool = true
});
//turret.SetPeacekeepermode(true);
turret.SetOnline();
});
}
} Thanks. I will look to i / test when get to my pc. Will send you some feedback.