public static ProjectileModule AddProjectileModuleFrom(this Gun gun, Gun other, bool cloned = true, bool clonedProjectiles = true) { ProjectileModule module = other.DefaultModule; if (!cloned) { return(gun.AddProjectileModule(module)); } ProjectileModule clone = ProjectileModule.CreateClone(module, false); clone.projectiles = new List <Projectile>(module.projectiles.Capacity); for (int i = 0; i < module.projectiles.Count; i++) { clone.projectiles.Add(!clonedProjectiles ? module.projectiles[i] : module.projectiles[i].ClonedPrefab()); } return(gun.AddProjectileModule(clone)); }