Type `HeldEntity' does not contain a definition for `primaryMagazine'Solved
Since game update this error now appears
  60 TurretConfig - Failed to compile: TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?​
There isn't a file showing up in the oxide/config folder, i've reloaded it through console command, and even restarted my server and nothing is showing up
If the configuration file isn't created, the plugin is not loaded. Check your oxide/logs for errors.
the plugin is not compiling , get this error

TurretConfig - Failed to compile: TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?

5e13a8d5b2bc5.jpg Wulf
If the configuration file isn't created, the plugin is not loaded. Check your oxide/logs for errors.

I searched through the errors and this popped up, do you by chance know how to fix it?

Error while compiling: TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?
I think I may have found a potential fix for this. The primaryMagazine attribute is meant to reference an entity of type 'BaseProjectile', but it looks like AttachedWeapon for AutoTurrets returns an entity of type 'HeldEntity' instead, which may have been changed during the last update. Fortunately there is another method, 'GetAttachedWeapon()', which returns the desired 'BaseProjectile' entity. Simply updating the references should fix this issue.

In layman's terms, find the instances of "AttachedWeapon" in TurretConfig.cs, and change them to "GetAttachedWeapon()". There should be 2 cases where this occurs, both within the "CheckAutoTurretAmmo" method, at lines 467 and 474.

The resulting method should look like this:
        private void CheckAutoTurretAmmo(AutoTurret turret)
        {
            if (!_infiniteAmmo) return;
            if (!permission.UserHasPermission(turret.OwnerID.ToString(), "turretconfig.infiniteammo")) return;

            var items = new List<Item>();
            var projectile = turret.GetAttachedWeapon().primaryMagazine.ammoType.GetComponent<ItemModProjectile>();
            turret.inventory.FindAmmo(items, projectile.ammoType);

            var total = items.Sum(x => x.amount);

            if (total < 1)
            {
                turret.inventory.AddItem(turret.GetAttachedWeapon().primaryMagazine.ammoType, 1);
            }
        }​
Thanks
Works with this Change
stgerbe
Thanks
Works with this Change

Yes it works for me too, just wishing for a fix for infinite ammo ,

Please leave issues not marked as Solved if no official version has beenr released, thanks!
Error while compiling: TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?
Will this issue be resolved in the official file? Couldn't change a couple of lines in a month?
Error while compiling: TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?
i am getting the same error. how about wolf get on the moder instead of us that found the fix and have the moder fix the mod???
lordzile
i am getting the same error. how about wolf get on the moder instead of us that found the fix and have the moder fix the mod???

I think you will have to be patient, I am still waiting for a 2+ years "fix" for proximity alert, The only reply i get is that as this is a community forum for free plugins there are "no guarantees" .

I am also hoping for a "infinite" ammo fix for this plugin too.

(17:51:20) | Unable to load TurretConfig. TurretConfig.cs(477,64): error CS1061: Type `HeldEntity' does not contain a definition for `primaryMagazine' and no extension method `primaryMagazine' of type `HeldEntity' could be found. Are you missing an assembly reference?

(17:51:20) | No previous version to rollback plugin: TurretConfig

Locked automatically