Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stateName[0] = "Activate";
- stateTimeoutValue[0] = 0.15;
- stateTransitionOnTimeout[0] = "AmmoCheck";
- stateSound[0] = weaponSwitchSound;
- stateName[1] = "Ready";
- stateTransitionOnTriggerDown[1] = "Fire";
- stateTransitionOnNoAmmo[1] = "Empty";
- stateAllowImageChange[1] = true;
- stateSequence[1] = "root";
- stateName[2] = "Fire";
- stateTimeoutValue[2] = 0.30;
- stateTransitionOnTimeout[2] = "Smoke";
- stateTransitionOnTriggerDown[2] = "Fire1";
- stateFire[2] = true;
- stateAllowImageChange[2] = false;
- stateSequence[2] = "Fire";
- stateScript[2] = "onFire";
- stateWaitForTimeout[2] = true;
- stateEmitter[2] = warSmallBulletFireEmitter;
- stateEmitterTime[2] = 0.05;
- stateEmitterNode[2] = "muzzleNode";
- stateEjectShell[2] = true;
- stateName[3] = "Smoke";
- stateEmitter[3] = warSmallBulletSmokeEmitter;
- stateEmitterTime[3] = 0.05;
- stateEmitterNode[3] = "muzzleNode";
- stateTimeoutValue[3] = 0.01;
- stateTransitionOnTimeout[3] = "AmmoCheck";
- stateWaitForTimeout[3] = true;
- stateSound[3] = "";
- stateName[4] = "Cycle";
- stateTimeoutValue[4] = 0.1;
- stateTransitionOnTimeout[4] = "AmmoCheck";
- stateSound[4] = "";
- stateName[5] = "AmmoCheck";
- stateTransitionOnTimeout[5] = "Ready";
- stateAllowImageChange[5] = true;
- stateScript[5] = "onAmmoCheck";
- stateName[6] = "Reload";
- stateTransitionOnTimeout[6] = "ReloadReady";
- stateTimeoutValue[6] = 4.85;
- stateAllowImageChange[6] = true;
- stateScript[6] = "onReloadStart";
- stateSound[6] = warSound;
- stateName[7] = "ReloadReady";
- stateTransitionOnTimeout[7] = "Ready";
- stateTimeoutValue[7] = 0.1;
- stateAllowImageChange[7] = true;
- stateScript[7] = "onReload";
- stateName[8] = "Empty";
- stateTransitionOnTriggerDown[8] = "EmptyFire";
- stateAllowImageChange[8] = true;
- stateScript[8] = "onEmpty";
- stateTransitionOnAmmo[8] = "Reload";
- //stateSequence[8] = "noammo";
- stateName[9] = "EmptyFire";
- stateTransitionOnTriggerUp[9] = "Empty";
- stateTimeoutValue[9] = 0.13;
- stateAllowImageChange[9] = false;
- stateWaitForTimeout[9] = true;
- stateSound[9] = warReloadTap1Sound;
- stateSequence[9] = "noammo_fire";
- stateName[10] = "Fire1";
- stateTimeoutValue[10] = 0.40;
- stateTransitionOnTimeout[10] = "Smoke";
- stateTransitionOnTriggerDown[10] = "Fire2";
- stateFire[10] = true;
- stateAllowImageChange[10] = false;
- stateSequence[10] = "Fire";
- stateScript[10] = "onFire2";
- stateWaitForTimeout[10] = true;
- stateEmitter[10] = warBigBulletFireEmitter;
- stateEmitterTime[10] = 0.05;
- stateEmitterNode[10] = "muzzleNode";
- stateEjectShell[10] = true;
- stateName[11] = "Fire2";
- stateTimeoutValue[11] = 0.20;
- stateTransitionOnTimeout[11] = "Smoke";
- stateTransitionOnTriggerDown[2] = "Fire3";
- stateFire[11] = true;
- stateAllowImageChange[11] = false;
- stateSequence[11] = "Fire";
- stateScript[11] = "onFire3";
- stateWaitForTimeout[11] = true;
- stateEmitter[11] = warHugeBulletFireEmitter;
- stateEmitterTime[11] = 0.05;
- stateEmitterNode[11] = "muzzleNode";
- stateEjectShell[11] = true;
- stateName[11] = "Fire3";
- stateTimeoutValue[11] = 0.1;
- stateTransitionOnTimeout[11] = "Smoke";
- stateTransitionOnTriggerDown[2] = "Fire4";
- stateFire[11] = true;
- stateAllowImageChange[11] = false;
- stateSequence[11] = "Fire";
- stateScript[11] = "onFire4";
- stateWaitForTimeout[11] = true;
- stateEmitter[11] = warHugeBulletFireEmitter;
- stateEmitterTime[11] = 0.05;
- stateEmitterNode[11] = "muzzleNode";
- stateEjectShell[11] = true;
- stateName[11] = "Fire4";
- stateTimeoutValue[11] = 0.20;
- stateTransitionOnTriggerDown[11] = "Fire1";
- stateFire[11] = true;
- stateAllowImageChange[11] = false;
- stateSequence[11] = "Fire";
- stateScript[11] = "onFire5";
- stateWaitForTimeout[11] = true;
- stateEmitter[11] = warHugeBulletFireEmitter;
- stateEmitterTime[11] = 0.05;
- stateEmitterNode[11] = "muzzleNode";
- stateEjectShell[11] = true;
- };
- ////// ammo display functions
- function heavyMachineGunImage::onMount( %this, %obj, %slot )
- {parent::onMount(%this,%obj,%slot); hl2DisplayAmmo(%this,%obj,%slot,0);}
- function heavyMachineGunImage::onUnMount( %this, %obj, %slot )
- {parent::onUnMount(%this,%obj,%slot); hl2DisplayAmmo(%this,%obj,%slot,-1);}
- function heavyMachineGunImage::onAmmoCheck( %this, %obj, %slot )
- {hl2AmmoCheck(%this,%obj,%slot); hl2DisplayAmmo(%this,%obj,%slot);}
- /////// reload functions
- function heavyMachineGunImage::onReloadStart( %this, %obj, %slot )
- {
- %obj.playThread(2,plant);
- serverPlay3d( warReload2Sound, %obj.getHackPosition());
- %obj.schedule(450, "playThread", "2", "shiftright");
- %obj.schedule(650, "playThread", "2", "shiftdown");
- %obj.schedule(1750, "playThread", "2", "plant");
- %obj.schedule(2250, "playThread", "2", "plant");
- %obj.schedule(3350, "playThread", "2", "shiftLeft");
- %obj.schedule(4650, "playThread", "2", "plant");
- schedule(650, 0, serverPlay3D, warReloadTap2Sound, %obj.getHackPosition());
- schedule(750, 0, serverPlay3D, warReloadTap1Sound, %obj.getHackPosition());
- schedule(1750, 0, serverPlay3D, warReload3Sound, %obj.getHackPosition());
- schedule(2250, 0, serverPlay3D, warReload1Sound, %obj.getHackPosition());
- schedule(3350, 0, serverPlay3D, warReloadTap3Sound, %obj.getHackPosition());
- schedule(4650, 0, serverPlay3D, warReload5Sound, %obj.getHackPosition());
- hl2DisplayAmmo(%this,%obj,%slot);
- }
- function heavyMachineGunImage::onReload( %this, %obj, %slot )
- {
- hl2AmmoOnReload(%this,%obj,%slot);
- hl2DisplayAmmo(%this,%obj,%slot);
- }
- function heavyMachineGunImage::onEmpty(%this,%obj,%slot)
- {
- if( $hl2Weapons::Ammo && %obj.toolAmmo[%this.item.ammotype] < 1 )
- {
- return;
- }
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- serverCmdLight(%obj.client);
- }
- }
- function heavyMachineGunImage::onFire( %this, %obj, %slot )
- {
- if(%obj.getDamagePercent() > 1.0)
- {
- return;
- }
- %obj.toolMag[%obj.currTool] -= 1;
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- %obj.toolMag[%obj.currTool] = 0;
- %obj.setImageAmmo(0,0);
- }
- hl2DisplayAmmo(%this,%obj,%slot);
- %projectile = %this.projectile;
- %spread = 0.0025;
- %shellcount = 1;
- %fvec = %obj.getForwardVector();
- %fX = getWord(%fvec,0);
- %fY = getWord(%fvec,1);
- %evec = %obj.getEyeVector();
- %eX = getWord(%evec,0);
- %eY = getWord(%evec,1);
- %eZ = getWord(%evec,2);
- %eXY = mSqrt(%eX*%eX+%eY*%eY);
- %aimVec = %fX*%eXY SPC %fY*%eXY SPC %eZ;
- %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%aimVec,"-1")));
- %obj.spawnExplosion(warRecoilProjectile,"0.5 0.5 0.5");
- for(%shell=0; %shell<%shellcount; %shell++)
- {
- %vector = %obj.getMuzzleVector(%slot);
- %objectVelocity = %obj.getVelocity();
- %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
- %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
- %velocity = VectorAdd(%vector1,%vector2);
- %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
- %velocity = MatrixMulVector(%mat, %velocity);
- %p = new (%this.projectileType)()
- {
- dataBlock = %projectile;
- initialVelocity = %velocity;
- initialPosition = %obj.getMuzzlePoint(%slot);
- sourceObject = %obj;
- sourceSlot = %slot;
- client = %obj.client;
- scale = "1.5 1.5 1.5";
- };
- MissionCleanup.add(%p);
- }
- %obj.playThread(2, shiftRight);
- %obj.playThread(3, shiftLeft);
- serverPlay3d( heavyMachineGunFireSound, %obj.getHackPosition());
- }
- function heavyMachineGunImage::onFire2( %this, %obj, %slot )
- {
- if(%obj.getDamagePercent() > 1.0)
- {
- return;
- }
- %obj.toolMag[%obj.currTool] -= 1;
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- %obj.toolMag[%obj.currTool] = 0;
- %obj.setImageAmmo(0,0);
- }
- hl2DisplayAmmo(%this,%obj,%slot);
- %projectile = %this.projectile;
- %spread = 0.0033;
- %shellcount = 1;
- %fvec = %obj.getForwardVector();
- %fX = getWord(%fvec,0);
- %fY = getWord(%fvec,1);
- %evec = %obj.getEyeVector();
- %eX = getWord(%evec,0);
- %eY = getWord(%evec,1);
- %eZ = getWord(%evec,2);
- %eXY = mSqrt(%eX*%eX+%eY*%eY);
- %aimVec = %fX*%eXY SPC %fY*%eXY SPC %eZ;
- %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%aimVec,"-0.5")));
- %obj.spawnExplosion(warRecoilProjectile,"0.25 0.25 0.25");
- for(%shell=0; %shell<%shellcount; %shell++)
- {
- %vector = %obj.getMuzzleVector(%slot);
- %objectVelocity = %obj.getVelocity();
- %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
- %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
- %velocity = VectorAdd(%vector1,%vector2);
- %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
- %velocity = MatrixMulVector(%mat, %velocity);
- %p = new (%this.projectileType)()
- {
- dataBlock = %projectile;
- initialVelocity = %velocity;
- initialPosition = %obj.getMuzzlePoint(%slot);
- sourceObject = %obj;
- sourceSlot = %slot;
- client = %obj.client;
- scale = "1.5 1.5 1.5";
- };
- MissionCleanup.add(%p);
- }
- %obj.playThread(2, shiftRight);
- %obj.playThread(3, shiftLeft);
- serverPlay3d( heavyMachineGunFireSound, %obj.getHackPosition());
- }
- function heavyMachineGunImage::onFire3( %this, %obj, %slot )
- {
- if(%obj.getDamagePercent() > 1.0)
- {
- return;
- }
- %obj.toolMag[%obj.currTool] -= 1;
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- %obj.toolMag[%obj.currTool] = 0;
- %obj.setImageAmmo(0,0);
- }
- hl2DisplayAmmo(%this,%obj,%slot);
- %projectile = %this.projectile;
- %spread = 0.0045;
- %shellcount = 1;
- %fvec = %obj.getForwardVector();
- %fX = getWord(%fvec,0);
- %fY = getWord(%fvec,1);
- %evec = %obj.getEyeVector();
- %eX = getWord(%evec,0);
- %eY = getWord(%evec,1);
- %eZ = getWord(%evec,2);
- %eXY = mSqrt(%eX*%eX+%eY*%eY);
- %aimVec = %fX*%eXY SPC %fY*%eXY SPC %eZ;
- %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%aimVec,"-0.5")));
- %obj.spawnExplosion(warRecoilProjectile,"0.75 0.75 0.75");
- for(%shell=0; %shell<%shellcount; %shell++)
- {
- %vector = %obj.getMuzzleVector(%slot);
- %objectVelocity = %obj.getVelocity();
- %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
- %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
- %velocity = VectorAdd(%vector1,%vector2);
- %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
- %velocity = MatrixMulVector(%mat, %velocity);
- %p = new (%this.projectileType)()
- {
- dataBlock = %projectile;
- initialVelocity = %velocity;
- initialPosition = %obj.getMuzzlePoint(%slot);
- sourceObject = %obj;
- sourceSlot = %slot;
- client = %obj.client;
- scale = "1.5 1.5 1.5";
- };
- MissionCleanup.add(%p);
- }
- %obj.playThread(2, shiftRight);
- %obj.playThread(3, shiftLeft);
- serverPlay3d( heavyMachineGunFireSound, %obj.getHackPosition());
- }
- function heavyMachineGunImage::onFire4( %this, %obj, %slot )
- {
- if(%obj.getDamagePercent() > 1.0)
- {
- return;
- }
- %obj.toolMag[%obj.currTool] -= 1;
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- %obj.toolMag[%obj.currTool] = 0;
- %obj.setImageAmmo(0,0);
- }
- hl2DisplayAmmo(%this,%obj,%slot);
- %projectile = %this.projectile;
- %spread = 0.0045;
- %shellcount = 1;
- %fvec = %obj.getForwardVector();
- %fX = getWord(%fvec,0);
- %fY = getWord(%fvec,1);
- %evec = %obj.getEyeVector();
- %eX = getWord(%evec,0);
- %eY = getWord(%evec,1);
- %eZ = getWord(%evec,2);
- %eXY = mSqrt(%eX*%eX+%eY*%eY);
- %aimVec = %fX*%eXY SPC %fY*%eXY SPC %eZ;
- %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%aimVec,"-0.5")));
- %obj.spawnExplosion(warRecoilProjectile,"0.75 0.75 0.75");
- for(%shell=0; %shell<%shellcount; %shell++)
- {
- %vector = %obj.getMuzzleVector(%slot);
- %objectVelocity = %obj.getVelocity();
- %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
- %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
- %velocity = VectorAdd(%vector1,%vector2);
- %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
- %velocity = MatrixMulVector(%mat, %velocity);
- %p = new (%this.projectileType)()
- {
- dataBlock = %projectile;
- initialVelocity = %velocity;
- initialPosition = %obj.getMuzzlePoint(%slot);
- sourceObject = %obj;
- sourceSlot = %slot;
- client = %obj.client;
- scale = "1.5 1.5 1.5";
- };
- MissionCleanup.add(%p);
- }
- %obj.playThread(2, shiftRight);
- %obj.playThread(3, shiftLeft);
- serverPlay3d( heavyMachineGunFireSound, %obj.getHackPosition());
- }
- function heavyMachineGunImage::onFire5( %this, %obj, %slot )
- {
- if(%obj.getDamagePercent() > 1.0)
- {
- return;
- }
- %obj.toolMag[%obj.currTool] -= 1;
- if(%obj.toolMag[%obj.currTool] < 1)
- {
- %obj.toolMag[%obj.currTool] = 0;
- %obj.setImageAmmo(0,0);
- }
- hl2DisplayAmmo(%this,%obj,%slot);
- %projectile = %this.projectile;
- %spread = 0.0045;
- %shellcount = 1;
- %fvec = %obj.getForwardVector();
- %fX = getWord(%fvec,0);
- %fY = getWord(%fvec,1);
- %evec = %obj.getEyeVector();
- %eX = getWord(%evec,0);
- %eY = getWord(%evec,1);
- %eZ = getWord(%evec,2);
- %eXY = mSqrt(%eX*%eX+%eY*%eY);
- %aimVec = %fX*%eXY SPC %fY*%eXY SPC %eZ;
- %obj.setVelocity(VectorAdd(%obj.getVelocity(),VectorScale(%aimVec,"-0.5")));
- %obj.spawnExplosion(warRecoilProjectile,"0.75 0.75 0.75");
- for(%shell=0; %shell<%shellcount; %shell++)
- {
- %vector = %obj.getMuzzleVector(%slot);
- %objectVelocity = %obj.getVelocity();
- %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
- %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
- %velocity = VectorAdd(%vector1,%vector2);
- %x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
- %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
- %velocity = MatrixMulVector(%mat, %velocity);
- %p = new (%this.projectileType)()
- {
- dataBlock = %projectile;
- initialVelocity = %velocity;
- initialPosition = %obj.getMuzzlePoint(%slot);
- sourceObject = %obj;
- sourceSlot = %slot;
- client = %obj.client;
- scale = "1.5 1.5 1.5";
- };
- MissionCleanup.add(%p);
- }
- %obj.playThread(2, shiftRight);
- %obj.playThread(3, shiftLeft);
- serverPlay3d( heavyMachineGunFireSound, %obj.getHackPosition());
- }
- function heavyMachineGunProjectile::damage( %this, %obj, %col, %fade, %pos, %normal )
- {
- %damage = %this.directDamage;
- %headshot = matchBodyArea( getHitbox( %obj, %col, %pos ), $headTest );
- if ( %headshot )
- {
- %damage *= %this.headshotMultiplier;
- }
- %col.damage( %obj, %pos, %damage, %this.directDamageType );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement