// weapon.cs contains everything related to the godzilla weapondatablock AudioProfile(HitSound){ filename = "./Hit.wav"; description = AudioClosest3d; preload = true;};//effectsdatablock ParticleData(godzillaWeaponExplosionPartic le){ dragCoefficient = 2; gravityCoefficient = 1.0; inheritedVelFactor = 0.2; constantAcceleration = 0.0; spinRandomMin = -90; spinRandomMax = 90; lifetimeMS = 500; lifetimeVarianceMS = 300; textureName = "base/data/particles/chunk"; colors[0] = "0.7 0.7 0.9 0.9"; colors[1] = "0.9 0.9 0.9 0.0"; sizes[0] = 0.5; sizes[1] = 0.25;};datablock ParticleEmitterData(godzillaWeaponExplosionEmitte r){ ejectionPeriodMS = 7; periodVarianceMS = 0; ejectionVelocity = 8; velocityVariance = 1.0; ejectionOffset = 0.0; thetaMin = 0; thetaMax = 60; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "godzillaWeaponExplosionPartic le"; uiName = "godzillaWeapon Hit";};datablock ExplosionData(godzillaWeaponExplosion){ //explosionShape = ""; lifeTimeMS = 500; soundProfile = HitSound; particleEmitter = godzillaWeaponExplosionEmitte r; particleDensity = 10; particleRadius = 0.2; faceViewer = true; explosionScale = "1 1 1"; shakeCamera = false; camShakeFreq = "5 5 5"; camShakeAmp = "1.0 1.0 1.0"; camShakeDuration = 0.5; camShakeRadius = 10.0; // Dynamic light lightStartRadius = 3; lightEndRadius = 0; lightStartColor = "00.0 0.2 0.6"; lightEndColor = "0 0 0";};//projectileAddDamageType("godzillaWeapon", '<bitmap:add-ons/Weapon_Godzilla/CI_godzillaWeapon> %1', '%2 <bitmap:add-ons/Weapon_Godzilla/CI_godzillaWeapon> %1',0.75,1);datablock ProjectileData(godzillaWeaponProjectile){ directDamage = 35; directDamageType = $DamageType::godzillaWeapon; radiusDamageType = $DamageType::godzillaWeapon; explosion = ""; //particleEmitter = as; brickExplosionRadius = 1; brickExplosionImpact = true; //destroy a brick if we hit it directly? brickExplosionForce = 30; brickExplosionMaxVolume = 175; //max volume of bricks that we can destroy brickExplosionMaxVolumeFloati ng = 225; //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume) muzzleVelocity = 50; velInheritFactor = 1; armingDelay = 0; lifetime = 100; fadeDelay = 70; bounceElasticity = 0; bounceFriction = 0; isBallistic = false; gravityMod = 0.0; hasLight = false; lightRadius = 3.0; lightColor = "0 0 0.5"; uiName = "godzillaWeapon Slice";};// this is better as a stand alone function, since a few explosions call upon itfunction gCalculateBreakSound( %client, %count, %pos ){ if( %count > 0 && getSimTIme() > %client.gLastSmashTime+250 ) { serverPlay3D( godzillaBreakSound @ getRandom( 1, 2 ), %pos ); //%obj.playSound( godzillaBreakSound @ getRandom( 1, 2 ) ); %client.gLastSmashTime = getSimTime(); }}function godzillaWeaponProjectile::onExplode( %this, %obj, %pos ){ %count = parent::onExplode( %this, %obj, %pos ); %client = %obj.client; // this calculates what sound we should play if any gCalculateBreakSound( %client, %count, %pos ); //echo( %obj.client ); // moved to another function, to organize things // calculateGodzillaSize( %obj.client );}//////////// item ////////////datablock ItemData(godzillaWeaponItem){ category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "./rHand.dts"; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "godzillaWeapon"; iconName = "./icon_godzillaWeapon"; doColorShift = true; colorShiftColor = "0.471 0.471 0.471 1.000"; // Dynamic properties defined by the scripts image = godzillaWeaponImage; canDrop = true;};//////////////////weapon image//////////////////datablock ShapeBaseImageData( godzillaLeftHandImage ){ // Basic Item properties shapeFile = "./lHand.dts";//"base/data/shapes/empty.dts"; emap = true; mountPoint = 1; doColorShift = true; colorShiftColor = "1.0 0.878 0.612 1.0"; offset = "0 0.2 0";};datablock ShapeBaseImageData( godzillaWeaponImage ){ // Basic Item properties shapeFile = "./rHand.dts";//"base/data/shapes/empty.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 0; offset = "0 0.2 0"; // When firing from a point offset from the eye, muzzle correction // will adjust the muzzle vector to point to the eye LOS point. // Since this weapon doesn't actually fire from the muzzle point, // we need to turn this off. correctMuzzleVector = false; eyeOffset = "";//"0.7 1.2 -0.25"; // Add the WeaponImage namespace as a parent, WeaponImage namespace // provides some hooks into the inventory system. className = "WeaponImage"; // Projectile && Ammo. item = godzillaWeaponItem; ammo = " "; projectile = godzillaWeaponProjectile; projectileType = Projectile; //melee particles shoot from eye node for consistancy melee = true; doRetraction = false; //raise your arm up or not armReady = false; //casing = " "; doColorShift = true; colorShiftColor = "1.0 0.878 0.612 1.0"; // Images have a state system which controls how the animations // are run, which sounds are played, script callbacks, etc. This // state system is downloaded to the client so that clients can // predict state changes and animate accordingly. The following // system supports basic ready->fire->reload transitions as // well as a no-ammo->dryfire idle state. // Initial start up state stateName[0] = "Activate"; stateTimeoutValue[0] = 0.5; stateTransitionOnTimeout[0] = "Ready"; //stateSound[0] = godzillaWeaponDrawSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "PreFire"; stateAllowImageChange[1] = true; stateName[2] = "PreFire"; stateScript[2] = "onPreFire"; stateAllowImageChange[2] = false; stateTimeoutValue[2] = 0.1; stateTransitionOnTimeout[2] = "Fire"; stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "Ready"; stateTimeoutValue[3] = 0.2; stateFire[3] = true; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateScript[3] = "onFire"; stateWaitForTimeout[3] = true; stateName[4] = "CheckFire"; stateTransitionOnTriggerUp[4] = "StopFire"; stateTransitionOnTriggerDown[4] = "Fire"; stateName[5] = "StopFire"; stateTransitionOnTimeout[5] = "Ready"; stateTimeoutValue[5] = 0.2; stateAllowImageChange[5] = false; stateWaitForTimeout[5] = true; stateSequence[5] = "StopFire"; stateScript[5] = "onStopFire";};function godzillaWeaponImage::onFire( %this, %obj ){ %obj.playthread( 2, activate2 ); %pos = %obj.getEyeTransform(); %vec = %obj.getEyeVector(); %vec = vectorScale( %vec, 1.6 * getWord( %obj.getScale(), 0 ) ); %pos = vectorAdd( %pos, %vec ); // spawn explosion to destroy bricks when we impact %p = new Projectile() { dataBlock = godzillaWeaponProjectile; initialPosition = %pos; initialVelocity = 0; client = %obj.client; scale = %obj.getScale(); }; missionCleanup.add( %p ); %p.setTransform( %pos ); %p.explode();}function godzillaWeaponImage::onMount( %this, %obj ){ %obj.playThread( 1, armReadyBoth ); %obj.mountImage( godzillaLeftHandImage, 1 ); parent::onMount( %this, %obj );}function godzillaWeaponImage::onUnmount( %this, %obj ){ if( %obj.getMountedImage( 1 ).getName() $= "godzillaLeftHandImage" ) %obj.unMountImage( 1 ); parent::onUnmount( %this, %obj );}function godzillaWeaponImage::onPreFire(%this, %obj, %slot){ return;}function godzillaWeaponImage::onStopFire(%this, %obj, %slot){ return;}