Author Topic: Removing Iron Sights  (Read 1231 times)

Hey, I have a very quick and simple question.

I plan on using Gravity Cat's DWeapons on a server I am hosting. Is there any possible way for me to remove only the iron sights function from the weapon pack?

If you go into the code and get rid of the parts that use the jet key to switch modes, then yes.

get rid of the parts that use the jet key to switch modes
What you're looking for is the armor::onTrigger function

Here is the code for the Bullup for example..
Quote
//########## Bullpup + Grenade Launcher

//### Sounds

datablock AudioProfile(gc_BullpupFireSound)
{
  filename = "./bullpup.wav";
  description = AudioClose3d;
  preload = true;
};

//### Damage Type + Projectile

AddDamageType("gc_Bullpup",'<bitmap:Add-ons/Weapon_DWeapons/CI_bullpup> %1','%2 <bitmap:Add-ons/Weapon_DWeapons/CI_bullpup> %1',0.2,1);

//### Item

datablock ItemData(gc_BullpupItem)
{
  uiName = "Bullpup";
  iconName = "./icon_bullpup";
  image = gc_BullpupImage;
  category = Weapon;
  className = Weapon;
  shapeFile = "./bullpup.dts";
  mass = 1;
  density = 0.2;
  elasticity = 0;
  friction = 0.6;
  emap = true;
  doColorShift = true;
  colorShiftColor = "1 1 1 1";
  canDrop = true;
  gc_reload = 1;
  gc_maxmag = 25;
  gc_zoom = 74;
  gc_ammotype = ".223";
  gc_secondary = gc_BullpupGLImage;
};

//### Item Image

datablock shapeBaseImageData(gc_BullpupImage)
{
  shapeFile = "./bullpup.dts";
  emap = true;
  correctMuzzleVector = true;
  className = "WeaponImage";
  item = gc_BullpupItem;
  ammo = "";
  projectile = "";
  projectileCount = 1;
  directDamage = 16;
  headshotDamage = 35;
  vehicleDamage = 5;
  directDamageType = $DamageType::gc_Bullpup;
  range = 600;
  spread = 0.002;
  spreadAim = 0.001;
  tracer = 2.5;
  lasersight = true;
  casing = gc_DShellDebris;
  shellExitDir = "1 0.5 0.2";
  shellExitVariance = 10;
  shellVelocity = 6;
  melee = false;
  doReaction = false;
  armReady = true;
  doColorShift = true;
  colorShiftColor = "1 1 1 1";

  stateName[0] = "Activate";
  stateTimeoutValue[0] = 0.4;
  stateTransitionOnTimeout[0] = "AmmoCheck";
  stateSound[0] = weaponSwitchSound;
  stateSequence[0] = "Ready";

  stateName[1] = "Ready";
  stateTransitionOnTriggerDown[1] = "Fire";
  stateAllowImageChange[1] = true;
  stateTransitionOnNoAmmo[1] = "Empty";
  stateSequence[1] = "Ready";

  stateName[2] = "Fire";
  stateTransitionOnTimeout[2] = "AmmoCheck";
  stateTimeoutValue[2] = "0.09";
  stateFire[2] = true;
  stateAllowImageChange[2] = false;
  stateWaitForTimeout[2] = true;
  stateEmitter[2] = gc_DGunFlashEmitter;
  stateEmitterTime[2] = 0.05;
  stateEmitterNode[2] = "muzzlePoint";
  stateSound[2] = gc_BullpupFireSound;
  stateScript[2] = "onFire";
  stateEjectShell[2] = true;
  stateSequence[2] = "Fire";

  stateName[3] = "AmmoCheck";
  stateTransitionOnTimeout[3] = "Ready";
  stateAllowImageChange[3] = true;
  stateScript[3] = "onAmmoCheck";

  stateName[4] = "Reload";
  stateTimeoutValue[4] = 1.5;
  stateTransitionOnTimeout[4] = "Done";
  stateWaitForTimeout[4] = true;
  stateSound[4] = gc_MagOutSound;
  stateAllowImageChange[4] = true;
  stateScript[4] = "onReloadStart";

  stateName[5] = "Done";
  stateTransitionOnTimeout[5] = "CheckChamber";
  stateTimeoutValue[5] = 0.4;
  stateAllowImageChange[5] = true;
  stateScript[5] = "onReload";
  stateSound[5] = gc_MagInSound;

  stateName[6] = "Empty";
  stateTransitionOnTriggerDown[6] = "EmptyFire";
  stateAllowImageChange[6] = true;
  stateTransitionOnAmmo[6] = "Reload";
  stateSequence[6] = "Ready";

  stateName[7] = "EmptyFire";
  stateTransitionOnTriggerUp[7] = "Ready";
  stateTimeoutValue[7] = "0.15";
  stateAllowImageChange[7] = false;
  stateWaitForTimeout[7] = true;
  stateSound[7] = gc_emtpySound;

  stateName[8] = "CheckChamber";
  stateTransitionOnTimeOut[8] = "Ready";
  stateTransitionOnNoAmmo[8] = "roostering";
  stateAllowImageChange[8] = true;

  stateName[9] = "roostering";
  stateTimeoutValue[9] = 0.4;
  stateTransitionOnTimeOut[9] = "Ready";
  stateWaitForTimeout[9] = true;
  stateAllowImageChange[9] = true;
  stateScript[9] = "onrooster";
  stateSound[9] = gc_gunroosterSound;
};

datablock shapeBaseImageData(gc_BullpupImageScoped : gc_BullpupImage)
{
  eyeOffset = "0 0.32 -0.425";

  stateName[0] = "Activate";
  stateTimeoutValue[0] = 0.4;
  stateTransitionOnTimeout[0] = "AmmoCheck";
  stateSound[0] = weaponSwitchSound;
  stateSequence[0] = "Ready";

  stateName[1] = "Ready";
  stateTransitionOnTriggerDown[1] = "Fire";
  stateAllowImageChange[1] = true;
  stateTransitionOnNoAmmo[1] = "Empty";
  stateSequence[1] = "Ready";

  stateName[2] = "Fire";
  stateTransitionOnTimeout[2] = "AmmoCheck";
  stateTimeoutValue[2] = "0.09";
  stateFire[2] = true;
  stateAllowImageChange[2] = false;
  stateWaitForTimeout[2] = true;
  stateEmitter[2] = gc_DGunFlashEmitter;
  stateEmitterTime[2] = 0.05;
  stateEmitterNode[2] = "muzzlePoint";
  stateSound[2] = gc_BullpupFireSound;
  stateScript[2] = "onFire";
  stateEjectShell[2] = true;
  stateSequence[2] = "Fire";

  stateName[3] = "AmmoCheck";
  stateTransitionOnTimeout[3] = "Ready";
  stateAllowImageChange[3] = true;
  stateScript[3] = "onAmmoCheck";

  stateName[4] = "Reload";
  stateTimeoutValue[4] = 1.5;
  stateTransitionOnTimeout[4] = "Done";
  stateWaitForTimeout[4] = true;
  stateSound[4] = gc_MagOutSound;
  stateAllowImageChange[4] = true;
  stateScript[4] = "onReloadStart";

  stateName[5] = "Done";
  stateTransitionOnTimeout[5] = "CheckChamber";
  stateTimeoutValue[5] = 0.4;
  stateAllowImageChange[5] = true;
  stateScript[5] = "onReload";
  stateSound[5] = gc_MagInSound;

  stateName[6] = "Empty";
  stateTransitionOnTriggerDown[6] = "EmptyFire";
  stateAllowImageChange[6] = true;
  stateTransitionOnAmmo[6] = "Reload";
  stateSequence[6] = "Ready";

  stateName[7] = "EmptyFire";
  stateTransitionOnTriggerUp[7] = "Ready";
  stateTimeoutValue[7] = "0.15";
  stateAllowImageChange[7] = false;
  stateWaitForTimeout[7] = true;
  stateSound[7] = gc_emtpySound;

  stateName[8] = "CheckChamber";
  stateTransitionOnTimeOut[8] = "Ready";
  stateTransitionOnNoAmmo[8] = "roostering";
  stateAllowImageChange[8] = true;

  stateName[9] = "roostering";
  stateTimeoutValue[9] = 0.4;
  stateTransitionOnTimeOut[9] = "Ready";
  stateWaitForTimeout[9] = true;
  stateAllowImageChange[9] = true;
  stateScript[9] = "onrooster";
  stateSound[9] = gc_gunroosterSound;
};

function gc_BullpupImage::onAmmoCheck(%this,%obj,%slot) { gc_AmmoSystemOnAmmoCheck(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImage::onReloadStart(%this,%obj,%slot) { %obj.playThread(2,shiftRight); }
function gc_BullpupImage::onReload(%this,%obj,%slot) { %obj.playThread(2,plant); gc_AmmoSystemOnReload(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImage::onrooster(%this,%obj,%slot) { %obj.playThread(2,shiftLeft); %obj.setImageAmmo(0,1); }
function gc_BullpupImage::onFire(%this,%obj,%slot) { %obj.toolMag[%obj.currTool] -= 1; if(%obj.toolMag[%obj.currTool] < 1) { %obj.toolMag[%obj.currTool] = 0; %obj.setImageAmmo(0,0); } gc_weaponFireRaycast(%this,%obj); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImage::onMount(%this,%obj,%slot) { gc_laserSight(%obj); parent::onMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImage::onUnMount(%this,%obj,%slot) { parent::onUnMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,-1); %obj.client.setControlCameraFov(%obj.client.defaultZoom); }

function gc_BullpupImageScoped::onAmmoCheck(%this,%obj,%slot) { gc_AmmoSystemOnAmmoCheck(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImageScoped::onReloadStart(%this,%obj,%slot) { %obj.playThread(2,shiftRight); }
function gc_BullpupImageScoped::onReload(%this,%obj,%slot) { %obj.playThread(2,plant); gc_AmmoSystemOnReload(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImageScoped::onrooster(%this,%obj,%slot) { %obj.playThread(2,shiftLeft); %obj.setImageAmmo(0,1); }
function gc_BullpupImageScoped::onFire(%this,%obj,%slot) { %obj.toolMag[%obj.currTool] -= 1; if(%obj.toolMag[%obj.currTool] < 1) { %obj.toolMag[%obj.currTool] = 0; %obj.setImageAmmo(0,0); } gc_weaponFireRaycast(%this,%obj); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImageScoped::onMount(%this,%obj,%slot) { gc_laserSight(%obj); parent::onMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupImageScoped::onUnMount(%this,%obj,%slot) { parent::onUnMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,-1); %obj.client.setControlCameraFov(%obj.client.defaultZoom); }

//########## The actual Grenade Launcher

//### Item

datablock ItemData(gc_BullpupGLItem)
{
  uiName = "";
  iconName = "./icon_bullpup";
  image = gc_BullpupGLImage;
  category = Weapon;
  className = Weapon;
  shapeFile = "./bullpup.dts";
  mass = 1;
  density = 0.2;
  elasticity = 0;
  friction = 0.6;
  emap = true;
  doColorShift = true;
  colorShiftColor = "1 1 1 1";
  canDrop = true;
  gc_reload = 1;
  gc_maxmag = 1;
  gc_nochamber = 1;
  gc_zoom = 74;
  gc_ammotype = "40mm";
  gc_secondary = gc_BullpupImage;
  gc_isSecondary = true;
};

//### Item Image

datablock shapeBaseImageData(gc_BullpupGLImage)
{
  shapeFile = "./bullpup.dts";
  emap = true;
  correctMuzzleVector = true;
  className = "WeaponImage";
  item = gc_BullpupGLItem;
  ammo = "";
  projectile = gc_D40mmProjectile;
  projectileType = Projectile;
  casing = gc_D40mmShellDebris;
  shellExitDir = "0 0 0";
  shellExitVariance = 1;
  shellVelocity = 1;
  melee = false;
  doReaction = false;
  armReady = true;
  doColorShift = true;
  colorShiftColor = "1 1 1 1";

  stateName[0] = "Activate";
  stateTimeoutValue[0] = 0.4;
  stateTransitionOnTimeout[0] = "AmmoCheck";
  stateSound[0] = weaponSwitchSound;
  stateSequence[0] = "LadderReady";

  stateName[1] = "Ready";
  stateTransitionOnTriggerDown[1] = "Fire";
  stateAllowImageChange[1] = true;
  stateTransitionOnNoAmmo[1] = "Empty";
  stateSequence[1] = "LadderReady";

  stateName[2] = "Fire";
  stateTransitionOnTriggerUp[2] = "AmmoCheck";
  stateTimeoutValue[2] = "0.1";
  stateFire[2] = true;
  stateAllowImageChange[2] = false;
  stateWaitForTimeout[2] = true;
  stateEmitter[2] = gc_DGunFlashEmitter;
  stateEmitterTime[2] = 0.05;
  stateEmitterNode[2] = "muzzlePoint";
  stateSound[2] = gc_DGrenadeLauncherFireSound;
  stateScript[2] = "onFire";
  stateSequence[2] = "Fire2";

  stateName[3] = "AmmoCheck";
  stateTransitionOnTimeout[3] = "Ready";
  stateAllowImageChange[3] = true;
  stateScript[3] = "onAmmoCheck";

  stateName[4] = "Reload";
  stateTimeoutValue[4] = 2;
  stateTransitionOnTimeout[4] = "Done";
  stateWaitForTimeout[4] = true;
  stateSound[4] = gc_launcherOutSound;
  stateAllowImageChange[4] = true;
  stateScript[4] = "onReloadStart";
  stateEjectShell[4] = true;

  stateName[5] = "Done";
  stateTransitionOnTimeout[5] = "Ready";
  stateTimeoutValue[5] = 0.4;
  stateAllowImageChange[5] = true;
  stateScript[5] = "onReload";
  stateSound[5] = gc_launcherInSound;

  stateName[6] = "Empty";
  stateTransitionOnTriggerDown[6] = "EmptyFire";
  stateAllowImageChange[6] = true;
  stateTransitionOnAmmo[6] = "Reload";
  stateSequence[6] = "Ready";

  stateName[7] = "EmptyFire";
  stateTransitionOnTriggerUp[7] = "Ready";
  stateTimeoutValue[7] = "0.15";
  stateAllowImageChange[7] = false;
  stateWaitForTimeout[7] = true;
  stateSound[7] = gc_emtpySound;
};

datablock shapeBaseImageData(gc_BullpupGLImageScoped : gc_BullpupGLImage)
{
  eyeOffset = "0 0.32 -0.52";

  stateName[0] = "Activate";
  stateTimeoutValue[0] = 0.4;
  stateTransitionOnTimeout[0] = "AmmoCheck";
  stateSound[0] = weaponSwitchSound;
  stateSequence[0] = "LadderReady";

  stateName[1] = "Ready";
  stateTransitionOnTriggerDown[1] = "Fire";
  stateAllowImageChange[1] = true;
  stateTransitionOnNoAmmo[1] = "Empty";
  stateSequence[1] = "LadderReady";

  stateName[2] = "Fire";
  stateTransitionOnTriggerUp[2] = "AmmoCheck";
  stateTimeoutValue[2] = "0.1";
  stateFire[2] = true;
  stateAllowImageChange[2] = false;
  stateWaitForTimeout[2] = true;
  stateEmitter[2] = gc_DGunFlashEmitter;
  stateEmitterTime[2] = 0.05;
  stateEmitterNode[2] = "muzzlePoint";
  stateSound[2] = gc_DGrenadeLauncherFireSound;
  stateScript[2] = "onFire";
  stateSequence[2] = "Fire2";

  stateName[3] = "AmmoCheck";
  stateTransitionOnTimeout[3] = "Ready";
  stateAllowImageChange[3] = true;
  stateScript[3] = "onAmmoCheck";

  stateName[4] = "Reload";
  stateTimeoutValue[4] = 2;
  stateTransitionOnTimeout[4] = "Done";
  stateWaitForTimeout[4] = true;
  stateSound[4] = gc_launcherOutSound;
  stateAllowImageChange[4] = true;
  stateScript[4] = "onReloadStart";
  stateEjectShell[4] = true;

  stateName[5] = "Done";
  stateTransitionOnTimeout[5] = "Ready";
  stateTimeoutValue[5] = 0.4;
  stateAllowImageChange[5] = true;
  stateScript[5] = "onReload";
  stateSound[5] = gc_launcherInSound;

  stateName[6] = "Empty";
  stateTransitionOnTriggerDown[6] = "EmptyFire";
  stateAllowImageChange[6] = true;
  stateTransitionOnAmmo[6] = "Reload";
  stateSequence[6] = "Ready";

  stateName[7] = "EmptyFire";
  stateTransitionOnTriggerUp[7] = "Ready";
  stateTimeoutValue[7] = "0.15";
  stateAllowImageChange[7] = false;
  stateWaitForTimeout[7] = true;
  stateSound[7] = gc_emtpySound;
};

function gc_BullpupGLImage::onAmmoCheck(%this,%obj,%slot) { gc_AmmoSystemOnAmmoCheck(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImage::onReloadStart(%this,%obj,%slot) { %obj.playThread(2,shiftRight); }
function gc_BullpupGLImage::onReload(%this,%obj,%slot) { %obj.playThread(2,plant); gc_AmmoSystemOnReload(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImage::onFire(%this,%obj,%slot)
{
  %obj.toolMag[%obj.currTool @ "Sec"] -= 1;
  if(%obj.toolMag[%obj.currTool @ "Sec"] < 1)
  {
    %obj.toolMag[%obj.currTool @ "Sec"] = 0;
    %obj.setImageAmmo(%slot,0);
  }
  %spread = 0.002;
  if(%obj.isCrouched() == 1) %spread -= 0.0002;
  %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %p = new Projectile()
  {
    dataBlock = %this.projectile;
    initialVelocity = MatrixMulVector(MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z),VectorScale(%obj.getMuzzleVector(0),%this.projectile.muzzleVelocity));
    initialPosition = %obj.getMuzzlePoint(0);
    sourceObject = %obj;
    sourceSlot = 0;
    client = %obj.client;
  };
  MissionCleanup.add(%p);
  gc_displayAmmo(%this,%obj,%slot,0);
}
function gc_BullpupGLImage::onMount(%this,%obj,%slot) { parent::onMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImage::onUnMount(%this,%obj,%slot) { parent::onUnMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,-1); %obj.client.setControlCameraFov(%obj.client.defaultZoom); }

function gc_BullpupGLImageScoped::onAmmoCheck(%this,%obj,%slot) { gc_AmmoSystemOnAmmoCheck(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImageScoped::onReloadStart(%this,%obj,%slot) { %obj.playThread(2,shiftRight); }
function gc_BullpupGLImageScoped::onReload(%this,%obj,%slot) { %obj.playThread(2,plant); gc_AmmoSystemOnReload(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImageScoped::onFire(%this,%obj,%slot)
{
  %obj.toolMag[%obj.currTool @ "Sec"] -= 1;
  if(%obj.toolMag[%obj.currTool @ "Sec"] < 1)
  {
    %obj.toolMag[%obj.currTool @ "Sec"] = 0;
    %obj.setImageAmmo(%slot,0);
  }
  %spread = 0.0005;
  if(%obj.isCrouched() == 1) %spread -= 0.0002;
  %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %p = new Projectile()
  {
    dataBlock = %this.projectile;
    initialVelocity = MatrixMulVector(MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z),VectorScale(%obj.getMuzzleVector(0),%this.projectile.muzzleVelocity));
    initialPosition = %obj.getMuzzlePoint(0);
    sourceObject = %obj;
    sourceSlot = 0;
    client = %obj.client;
  };
  MissionCleanup.add(%p);
  gc_displayAmmo(%this,%obj,%slot,0);
}
function gc_BullpupGLImageScoped::onMount(%this,%obj,%slot) { parent::onMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,0); }
function gc_BullpupGLImageScoped::onUnMount(%this,%obj,%slot) { parent::onUnMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,-1); %obj.client.setControlCameraFov(%obj.client.defaultZoom); }

What do I remove?

There's nothing in their for switching to iron sights, either that's not the whole file, or ironsight functionality is handled by something in another file

Post the whole add-on


basic.cs
At the very beginning of the armor::onTrigger function, towards the very end of the file
Easiest way would be to just delete the function.
But would be better to add parent::onTrigger(%this,%player,%slot,%val); return; right above if(isObject(%player)) { to you can easily change it back

basic.cs
At the very beginning of the armor::onTrigger function, towards the very end of the file
Easiest way would be to just delete the function.
But would be better to add parent::onTrigger(%this,%player,%slot,%val); return; right above if(isObject(%player)) { to you can easily change it back

I'm a little confused, sorry. Which line am I looking for again?

Quote
//########## Basic.cs

function gc_laserSight(%obj) { return; }

//### Sounds

datablock AudioProfile(gc_ExplosionSound)
{
  filename = "./explosion.wav";
  description = AudioDefault3d;
  preload = true;
};

datablock AudioProfile(gunShot1SupSound)
{
  filename = "./gunsd.wav";
  description = AudioClosest3d;
  preload = true;
};

datablock AudioProfile(gc_bulletImpact1Sound : gunShot1SupSound) { filename = "./bulletimpact1.wav"; };
datablock AudioProfile(gc_bulletImpact2Sound : gunShot1SupSound) { filename = "./bulletimpact2.wav"; };
datablock AudioProfile(gc_bulletImpact3Sound : gunShot1SupSound) { filename = "./bulletimpact3.wav"; };
datablock AudioProfile(gc_magInSound : gunShot1SupSound) { filename = "./magin.wav"; };
datablock AudioProfile(gc_magOutSound : gunShot1SupSound) { filename = "./magout.wav"; };
datablock AudioProfile(gc_launcherInSound : gunShot1SupSound) { filename = "./launcherin.wav"; };
datablock AudioProfile(gc_launcherOutSound : gunShot1SupSound) { filename = "./launcherout.wav"; };
datablock AudioProfile(gc_gunroosterSound : gunShot1SupSound) { filename = "./gunrooster.wav"; };
datablock AudioProfile(gc_pistolroosterSound : gunShot1SupSound) { filename = "./pistolrooster.wav"; };
datablock AudioProfile(gc_emtpySound : gunShot1SupSound) { filename = "./empty.wav"; };

//### Effects

datablock DebrisData(gc_DShellDebris)
{
  shapeFile = "./shell.dts";
  lifetime = 2;
  minSpinSpeed = -400;
  maxSpinSpeed = 200;
  elasticity = 0.5;
  friction = 0.2;
  numBounces = 3;
  staticOnMaxBounce = true;
  snapOnMaxBounce = false;
  fade = true;
  gravModifier = 2;
};

datablock DebrisData(gc_DRedShellDebris)
{
  shapeFile = "./shellred.dts";
  lifetime = 2;
  minSpinSpeed = -400;
  maxSpinSpeed = 200;
  elasticity = 0.5;
  friction = 0.2;
  numBounces = 3;
  staticOnMaxBounce = true;
  snapOnMaxBounce = false;
  fade = true;
  gravModifier = 2;
};

datablock DebrisData(gc_D40mmShellDebris)
{
  shapeFile = "./40mmshell.dts";
  lifetime = 2;
  minSpinSpeed = -400;
  maxSpinSpeed = 200;
  elasticity = 0.5;
  friction = 0.2;
  numBounces = 3;
  staticOnMaxBounce = true;
  snapOnMaxBounce = false;
  fade = true;
  gravModifier = 2;
};

datablock ParticleData(gc_grenadeTrailParticle)
{
  dragCoefficient = 8;
  gravityCoefficient = 0;
  inheritedVelFactor = 0;
  constantAcceleration = 0;
  lifetimeMS = 500;
  lifetimeVarianceMS = 0;
  textureName = "base/data/particles/cloud";
  colors[0] = "1 1 1 0.2";
  colors[1] = "1 1 1 0";
  sizes[0] = 0.3;
  sizes[1] = 0.1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(gc_grenadeTrailEmitter)
{
  uiName = "";
  ejectionPeriodMS = 8;
  periodVarianceMS = 0;
  ejectionVelocity = 0;
  velocityVariance = 0;
  ejectionOffset = 0;
  thetaMin = 89;
  thetaMax = 90;
  phiReferenceVel = 0;
  phiVariance = 360;
  overrideAdvance = false;
  particles = "gc_grenadeTrailParticle";
};

datablock ParticleData(gc_DGunFlashParticle)
{
  dragCoefficient = 0;
  gravityCoefficient = 0;
  inheritedVelFactor = 1;
  constantAcceleration = 0;
  lifetimeMS = 30;
  lifetimeVarianceMS = 0;
  textureName = "base/data/particles/star1";
  spinSpeed = 0;
  spinRandomMin = -5000;
  spinRandomMax = 5000;
  colors[0] = "1 1 0 1";
  colors[1] = "1 0.8 0.2 1";
  colors[2] = "1 0 0 0";
  sizes[0] = 0.1;
  sizes[1] = 1;
  sizes[2] = 0.5;
  times[0] = 0;
  times[1] = 0.2;
  times[2] = 1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(gc_DGunFlashEmitter)
{
  ejectionPeriodMS = 5;
  periodVarianceMS = 0;
  ejectionVelocity = 25;
  velocityVariance = 0;
  ejectionOffset = 0;
  thetaMin = 0;
  thetaMax = 10;
  phiReferenceVel = 0;
  phiVariance = 360;
  overrideAdvance = false;
  particles = "gc_DGunFlashParticle";
  uiName = "";
};

datablock ParticleData(gc_DGunFlashBigParticle : gc_DGunFlashParticle)
{
  lifetimeMS = 50;
  sizes[0] = 0.2;
  sizes[1] = 2;
  sizes[2] = 1;
  times[0] = 0;
  times[1] = 0.2;
  times[2] = 1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(gc_DGunFlashBigEmitter : gc_DGunFlashEmitter)
{
  ejectionVelocity = 30;
  velocityVariance = 5;
  thetaMax = 15;
  particles = "gc_DGunFlashBigParticle";
  uiName = "";
};

datablock ParticleData(gc_gunFlashSupParticle)
{
  dragCoefficient = 0;
  gravityCoefficient = 0;
  inheritedVelFactor = 1;
  constantAcceleration = 0;
  lifetimeMS = 30;
  lifetimeVarianceMS = 0;
  textureName = "base/data/particles/cloud";
  spinSpeed = 50;
  spinRandomMin = -500;
  spinRandomMax = 500;
  colors[0] = "1 1 1 1";
  colors[1] = "0.8 0.8 0.8 0.5";
  colors[2] = "0.6 0.6 0.6 0";
  sizes[0] = 0.1;
  sizes[1] = 0.2;
  sizes[2] = 0;
  times[9] = 0;
  times[1] = 0.3;
  times[2] = 1;
};

datablock ParticleEmitterData(gc_gunFlashSupEmitter)
{
  uiName = "";
  ejectionPeriodMS = 3;
  periodVarianceMS = 0;
  ejectionVelocity = 50;
  velocityVariance = 0;
  ejectionOffset = 0;
  thetaMin = 0;
  thetaMax = 10;
  phiReferenceVel = 0;
  phiVariance = 360;
  overrideAdvance = false;
  particles = "gc_gunFlashSupParticle";
};

datablock ParticleData(gc_DBulletImpactExplosionPart icle)
{
  dragCoefficient = 0;
  gravityCoefficient = 0;
  inheritedVelFactor = 0;
  constantAcceleration = 0;
  lifetimeMS = 100;
  lifetimeVarianceMS = 0;
  textureName = "base/data/particles/star1";
  colors[0] = "1 1 0 1";
  colors[1] = "1 0 0 1";
  sizes[0] = 1;
  sizes[1] = 1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(gc_DBulletImpactExplosionEmit ter)
{
  uiName = "";
  ejectionPeriodMS = 15;
  periodVarianceMS = 0;
  ejectionVelocity = 1;
  velocityVariance = 0;
  thetaMin = 0;
  thetaMax = 10;
  phiReferenceVel = 0;
  phiVariance = 360;
  overrideAdvance = true;
  particles = "gc_DBulletImpactExplosionPart icle";
};

datablock ParticleData(gc_DBulletImpactSmokeParticle)
{
  dragCoefficient = 4;
  gravityCoefficient = 0;
  inheritedVelFactor = 0;
  constantAcceleration = 0;
  lifetimeMS = 1000;
  lifetimeVarianceMS = 500;
  textureName = "base/data/particles/cloud";
  colors[0] = "0.8 0.8 0.8 0.2";
  colors[1] = "0.8 0.8 0.8 0";
  sizes[0] = 1;
  sizes[1] = 2;
  useInvAlpha = true;
  windCoefficient = 1;
};

datablock ParticleEmitterData(gc_DBulletImpactSmokeEmitter)
{
  uiName = "";
  ejectionPeriodMS = 10;
  periodVarianceMS = 0;
  ejectionVelocity = 8;
  velocityVariance = 6;
  thetaMin = 0;
  thetaMax = 45;
  phiReferenceVel = 0;
  phiVariance = 360;
  overrideAdvance = true;
  particles = "gc_DBulletImpactSmokeParticle";
};

datablock ExplosionData(gc_DBulletImpactExplosion)
{
  lifeTimeMS = 50;
  emitter[0] = gc_DBulletImpactExplosionEmit ter;
  emitter[1] = gc_DBulletImpactSmokeEmitter;
  faceViewer = true;
  explosionScale = "1 1 1";
  shakeCamera = true;
  camShakeFreq = "5 5 5";
  camShakeAmp = "1 1 1";
  camShakeDuration = 0.5;
  camShakeRadius = 1;
};

datablock ProjectileData(gc_DBulletImpactProjectile)
{
  uiName = "";
  projectileShapeName = "";
  directDamage = 0;
  explosion = gc_DBulletImpactExplosion;
  explodeOnDeath = true;
  lifetime = 100;
  fadeDelay = 100;
};

datablock ExplosionData(gc_weaponRecoilExplosion)
{
  lifeTimeMS = 1;
  explosionScale = "1 1 1";
  shakeCamera = true;
  camShakeFreq = "1 1 1";
  camShakeAmp = "0.25 0.25 0.25";
  camShakeDuration = 1;
  camShakeRadius = 0.5;
};

datablock ProjectileData(gc_weaponRecoil)
{
  uiName = "";
  explosion = gc_weaponRecoilExplosion;
  lifetime = 1;
  fadeDelay = 1;
  explodeOnDeath = true;
};

datablock StaticShapeData(gc_BulletTrailStatic) { shapeFile = "./bullettrail.dts"; };

function gc_BulletTrailStatic::onAdd(%this,%obj)
{
  %obj.playThread(0,root);
  %obj.schedule(100,delete);
}

//### Functions

// Many thanks to the internet! I don't know exactly what is going on here,
// but it works :)

function VectorRotateAxis(%vector,%axis,%angle)
{
  %x = getWord(%vector,0);
  %y = getWord(%vector,1);
  %z = getWord(%vector,2);
  %u = getWord(%axis,0);
  %v = getWord(%axis,1);
  %w = getWord(%axis,2);
  %ux = %u * %x;
  %uy = %u * %y;
  %uz = %u * %z;
  %vx = %v * %x;
  %vy = %v * %y;
  %vz = %v * %z;
  %wx = %w * %x;
  %wy = %w * %y;
  %wz = %w * %z;
  %sa = mSin(%angle);
  %ca = mCos(%angle);
  %nx = %u*(%ux+%vy+%wz)+(%x*(%v*%v+%w*%w)-%u*(%vy+%wz))*%ca+(-%wy+%vz)*%sa;
  %ny = %v*(%ux+%vy+%wz)+(%y*(%u*%u+%w*%w)-%v*(%ux+%wz))*%ca+(%wx-%uz)*%sa;
  %nz = %w*(%ux+%vy+%wz)+(%z*(%u*%u+%v*%v)-%w*(%ux+%vy))*%ca+(-%vx+%uy)*%sa;
  return(%nx SPC %ny SPC %nz);
}

function gc_DBulletImpactProjectile::onExplode(%this,%obj)
{
  %rnd = getRandom(1,3);
  if(%rnd == 1) serverPlay3D(gc_BulletImpact1Sound,%obj.getTransform());
  if(%rnd == 2) serverPlay3D(gc_BulletImpact2Sound,%obj.getTransform());
  if(%rnd == 3) serverPlay3D(gc_BulletImpact3Sound,%obj.getTransform());
  parent::onExplode(%this,%obj);
}

function gc_weaponFireRaycast(%this,%obj)
{
  %muzzlepoint = %obj.getMuzzlePoint(0);
  %muzzlevec = %obj.getMuzzleVector(0);
  %shellcount = %this.projectileCount;
  %range = %this.range;
  %tracer = %this.tracer;
  if(%this.item.image @ "Scoped" $= %this.getName()) %spread = %this.spreadAim;
  else
    %spread = %this.spread;
  if(%this.ignorespread != 1) {
  if(%obj.isCrouched() == 1) %spread -= 0.0002;
  if(%this.fullsway) if(!isObject(%obj.getObjectMount()) && vectorLen(%obj.getVelocity()) >= 1) %spread += 0.001;
  else {
    if(vectorLen(%obj.getVelocity()) >= 5 && !isObject(%obj.getObjectMount())) %spread += 0.001; }
  if(%obj.lastShotTime > getSimTime())
  {
    if(%spread < 0.003) %spread += (0.0001 * %obj.lastShotTimeMultiplier);
    %obj.lastShotTimeMultiplier++;
  }
  else
    %obj.lastShotTimeMultiplier = 1;
  %obj.lastShotTime = getSimTime() + 400; }
  %obj.spawnExplosion(gc_weaponRecoil,"1 1 1");
  for(%shell=0;%shell<%shellcount;%shell++) {
  %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
  if(%spread > 0) %velocity = VectorNormalize(MatrixMulVector(MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z),VectorScale(%muzzlevec,100)));
  else
    %velocity = VectorNormalize(%muzzlevec);
  if(%range <= 500)
  {
    %raycast = containerRayCast(%muzzlepoint,VectorAdd(%muzzlepoint,VectorScale(%velocity,%range)),$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::fxBrickObjectType | $TypeMasks::StaticObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::ForceFieldObjectType,%obj);
    %col = firstWord(%raycast);
    if(%col == 0)
      %raypos = VectorAdd(%muzzlepoint,VectorScale(%velocity,%range));
    else
      %raypos = posFromRaycast(%raycast);
  }
  else
  {
    %raycast = containerRayCast(%muzzlepoint,VectorAdd(%muzzlepoint,VectorScale(%velocity,%range/2)),$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::fxBrickObjectType | $TypeMasks::StaticObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::ForceFieldObjectType,%obj);
    if(!isObject(firstWord(%raycast)))
    {
      %midpos = posFromRaycast(%raycast);
      %raycast = containerRayCast(%midpos,VectorAdd(%midpos,VectorScale(%velocity,%range/2)),$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::fxBrickObjectType | $TypeMasks::StaticObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::ForceFieldObjectType,%obj);
    }
    %col = firstWord(%raycast);
    if(%col == 0)
      %raypos = VectorAdd(%muzzlepoint,VectorScale(%velocity,%range));
    else
      %raypos = posFromRaycast(%raycast);
  }
  if(isObject(%col))
  {
    gc_RaycastDamageSystem(%this,%obj,%col,%raypos);
    %p = new Projectile()
    {
      dataBlock = gc_DBulletImpactProjectile;
      initialPosition = %raypos;
      initialVelocity = %velocity;
      sourceObject = %obj;
      sourceSlot = 0;
      client = %obj.client;
    };
    MissionCleanup.add(%p);
  }
  if(%tracer > 0) {
  %p = new StaticShape() { dataBlock = gc_BulletTrailStatic; };
  MissionCleanup.add(%p);
  %x = getWord(%velocity,0)/2;
  %y = (getWord(%velocity,1) + 1)/2;
  %z = getWord(%velocity,2)/2;
  %p.setTransform(%muzzlepoint SPC VectorNormalize(%x SPC %y SPC %z) SPC mDegToRad(180));
  %p.setScale(%tracer SPC vectorDist(%muzzlepoint,%raypos) SPC %tracer); }
  }
//  messageClient(%obj.client,eval("$mvpitch = -0.05;"));
//  messageClient(%obj.client,eval("$mvyaw = (getRandom()-0.5)*0.05;"));
}

package gc_ScopesPackage
{
  function GameConnection::onClientLeaveGame(%client)
  {
    if(isObject(%client.player.gc_lasereffect)) %client.player.gc_lasereffect.delete();
    parent::onClientLeaveGame(%client);
  }
  function serverCmdFixFov(%client,%fov)
  {
    if(isObject(%client))
    {
      %client.defaultZoom = mClampF(%fov,75,120);
      %client.noZoomCheck = true;
      if(%client.zoomnote $= "")
      {
        messageClient(%client,'',"Fixed default FOV to " @ %client.defaultZoom @ ".");
        %client.zoomnote = true;
      }
    }
  }
  function GameConnection::spawnPlayer(%client)
  {
    parent::spawnPlayer(%client);
    if(%client.noZoomCheck != true)
    {
      %client.defaultZoom = %client.getControlCameraFov();
      messageClient(%client,'',"\c3Type \c0/fixfov [your fov]\c3 to set the field of view to which weapons reset.");
    }
  }
  function GameConnection::onDeath(%this,%killerPlayer,%killer,%damageType,%damageLoc) { %player.client.setControlCameraFov(%player.client.defaultZoom); parent::onDeath(%this,%killerPlayer,%killer,%damageType,%damageLoc); }
  function Armor::onTrigger(%this,%player,%slot,%val)
  {
    if(isObject(%player)) {
    if(%player.getMountedImage(0).gc_MeleeSecondary == 1 && %slot $= 4 && %val) {
    if(%player.getImageState(0) $= "Ready") %player.setImageAmmo(0,0); } }
      if(isObject(%player.getMountedImage(0)))
      {
        %image = %player.getMountedImage(0);
        if(isObject(%player.getObjectMount()))
        {
          %vehicle = %player.getObjectMount();
          for(%i=0;%i<8;%i++)
          {
            if(%vehicle.getMountedObject(%i) == %player) { %vehicleSlot = %i; break; }
          }
        }
        if(%image.item.gc_zoom $= "") { parent::onTrigger(%this,%player,%slot,%val); return; }
        if((%image.item.image $= %image.getName()) && %slot $= 4 && %val)
        {
          %player.mountImage(%image.item.image @ "Scoped",0);
          %player.client.setControlCameraFov(%image.item.gc_zoom);
          if(%vehicle !$= "") Schedule(100,0,gc_remount,%vehicle,%player,%vehicleSlot);
        }
        if(((%image.item.image @ "Scoped") $= %image.getName()) && %slot $= 4 && %val)
        {
          %player.mountImage(%image.item.image,0);
          %player.client.setControlCameraFov(%player.client.defaultZoom);
//          messageClient(%player.client,toggleZoom());
          if(%vehicle !$= "") Schedule(100,0,gc_remount,%vehicle,%player,%vehicleSlot);
        }
        parent::onTrigger(%this,%player,%slot,%val);
      }
      else
        parent::onTrigger(%this,%player,%slot,%val);
  }
};
activatePackage(gc_ScopesPackage);

I'm a little confused, sorry. Which line am I looking for again?
This chunk at the bottom:
Code: [Select]
  function Armor::onTrigger(%this,%player,%slot,%val)
  {
    if(isObject(%player)) {
    if(%player.getMountedImage(0).gc_MeleeSecondary == 1 && %slot $= 4 && %val) {
    if(%player.getImageState(0) $= "Ready") %player.setImageAmmo(0,0); } }
      if(isObject(%player.getMountedImage(0)))
      {
        %image = %player.getMountedImage(0);
        if(isObject(%player.getObjectMount()))
        {
          %vehicle = %player.getObjectMount();
          for(%i=0;%i<8;%i++)
          {
            if(%vehicle.getMountedObject(%i) == %player) { %vehicleSlot = %i; break; }
          }
        }
        if(%image.item.gc_zoom $= "") { parent::onTrigger(%this,%player,%slot,%val); return; }
        if((%image.item.image $= %image.getName()) && %slot $= 4 && %val)
        {
          %player.mountImage(%image.item.image @ "Scoped",0);
          %player.client.setControlCameraFov(%image.item.gc_zoom);
          if(%vehicle !$= "") Schedule(100,0,gc_remount,%vehicle,%player,%vehicleSlot);
        }
        if(((%image.item.image @ "Scoped") $= %image.getName()) && %slot $= 4 && %val)
        {
          %player.mountImage(%image.item.image,0);
          %player.client.setControlCameraFov(%player.client.defaultZoom);
//          messageClient(%player.client,toggleZoom());
          if(%vehicle !$= "") Schedule(100,0,gc_remount,%vehicle,%player,%vehicleSlot);
        }
        parent::onTrigger(%this,%player,%slot,%val);
      }
      else
        parent::onTrigger(%this,%player,%slot,%val);
  }

I removed that part, it removed the iron sights.
But now I am encountering another issue. The FOV is messed up whenever I swap weapons.
Is there any part of the .cs or any other file that I can delete to fix this?

look for any lines that have %obj.client.setControlCameraFOV in any of the gun's "onMount" functions, and delete those lines.
edit:
NVM, all the lines of that function are all cramed together for some reason (saves space i guess, makes stuff hard to read tho), just delete:
Code: [Select]
%obj.client.setControlCameraFov(%obj.client.defaultZoom);
from this part of all the guns:
Code: [Select]
function gc_BullpupImageScoped::onUnMount(%this,%obj,%slot) { parent::onUnMount(%this,%obj,%slot); gc_displayAmmo(%this,%obj,%slot,-1); %obj.client.setControlCameraFov(%obj.client.defaultZoom); }
« Last Edit: February 09, 2015, 12:55:03 AM by zombekillz »

NVM, all the lines of that function are all cramed together for some reason (saves space i guess, makes stuff hard to read tho)
There's terrible formatting throughout the whole add-on

I've always hated his way of formating add-ons.