Initial commit.

This commit is contained in:
Ragora 2013-02-01 15:45:22 -05:00
commit f5a6cfce9b
262 changed files with 128936 additions and 0 deletions

143
Scripts/Weapons/DZShot.cs Normal file
View file

@ -0,0 +1,143 @@
datablock ParticleData(DemonFBSmokeParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
lifetimeMS = 2500;
lifetimeVarianceMS = 500;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.5 0.5 0.5 0.5";
colors[1] = "0.4 0.4 0.4 0.2";
colors[2] = "0.3 0.3 0.3 0.0";
sizes[0] = 0.5;
sizes[1] = 1.75;
sizes[2] = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(DemonFBSmokeEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 0.75; // A little oomph at the back end
velocityVariance = 0.2;
thetaMin = 0.0;
thetaMax = 180.0;
particles = "DemonFBSmokeParticle";
};
datablock GrenadeProjectileData(DemonFireball)
{
projectileShapeName = "plasmabolt.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 0.4;
damageRadius = 5.0; // z0dd - ZOD, 8/13/02. Was 20.0
radiusDamageType = $DamageType::zombie;
kickBackStrength = 1500;
explosion = "PlasmaBoltExplosion";
underwaterExplosion = "PlasmaBoltExplosion";
velInheritFactor = 0;
splash = PlasmaSplash;
depthTolerance = 100.0;
baseEmitter = DemonFBSmokeEmitter;
bubbleEmitter = DemonFBSmokeEmitter;
grenadeElasticity = 0;
grenadeFriction = 0.4;
armingDelayMS = -1; // z0dd - ZOD, 4/14/02. Was 2000
gravityMod = 0.4; // z0dd - ZOD, 5/18/02. Make mortar projectile heavier, less floaty
muzzleVelocity = 50.0; // z0dd - ZOD, 8/13/02. More velocity to compensate for higher gravity. Was 63.7
drag = 0;
sound = PlasmaProjectileSound;
hasLight = true;
lightRadius = 10;
lightColor = "1 0.75 0.25";
hasLightUnderwaterColor = true;
underWaterLightColor = "1 0.75 0.25";
};
datablock ShapeBaseImageData(DZShotImage)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
item = DZShot;
projectile = DemonFireball;
projectileType = GrenadeProjectile;
usesEnergy = true;
fireEnergy = 40;
minEnergy = 40;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateRecoil[3] = NoRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = PlasmaProjectileSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateTimeoutValue[6] = 0.1;
stateTransitionOnTimeout[6] = "Ready";
};
datablock ItemData(DZShot)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_energy.dts";
image = DZShotImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Demon Zombie Fireball Ability";
};

View file

@ -0,0 +1,372 @@
// Scales
$EditorTool[1, 1] = "1 0 0 +X axis scale";
$EditorTool[1, 2] = "-1 0 0 -X axis scale";
$EditorTool[1, 3] = "0 1 0 +Y axis scale";
$EditorTool[1, 4] = "0 -1 0 -Y axis scale";
$EditorTool[1, 5] = "0 0 1 +Z axis scale";
$EditorTool[1, 6] = "0 0 -1 -Z axis scale";
// Moves
$EditorTool[2, 1] = "1 0 0 +X axis move";
$EditorTool[2, 2] = "-1 0 0 -X axis move";
$EditorTool[2, 3] = "0 1 0 +Y axis move";
$EditorTool[2, 4] = "0 -1 0 -Y axis move";
$EditorTool[2, 5] = "0 0 1 +Z axis move";
$EditorTool[2, 6] = "0 0 -1 -Z axis move";
// Rotates
$EditorTool[3, 1] = "1 0 0 +X axis rotate";
$EditorTool[3, 2] = "-1 0 0 -X axis rotate";
$EditorTool[3, 3] = "0 1 0 +Y axis rotate";
$EditorTool[3, 4] = "0 -1 0 -Y axis rotate";
$EditorTool[3, 5] = "0 0 1 +Z axis rotate";
$EditorTool[3, 6] = "0 0 -1 -Z axis rotate";
// Modifier Scales
$EditorTool[4, 1] = "0.1";
$EditorTool[4, 2] = "0.01";
$EditorTool[4, 3] = "0.001";
$EditorTool[4, 4] = "0.25";
$EditorTool[4, 5] = "0.5";
$EditorTool[4, 6] = "0.75";
$EditorTool[4, 7] = "1";
$EditorTool[4, 8] = "5";
function ETMessage(%client)
{
if(!isObject(%client))
return;
%mod = (%client.player.scaler $= "" ? 0.25 : %client.player.scaler);
if(%client.player.ETMode == 1)
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Editor Tool<<<<spop>\n<spush><font:Arial:14>Mode set to "@getwords($EditorTool[%client.player.ETMode, %client.player.ETSubMode], 3, 6)@" (Modifier: "@%mod@").<spop>", 5, 2);
else if(%client.player.ETMode == 2)
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Editor Tool<<<<spop>\n<spush><font:Arial:14>Mode set to "@getwords($EditorTool[%client.player.ETMode, %client.player.ETSubMode], 3, 6)@" (Modifier: "@%mod@").<spop>", 5, 2);
else if(%client.player.ETMode == 3)
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Editor Tool<<<<spop>\n<spush><font:Arial:14>Mode set to "@getwords($EditorTool[%client.player.ETMode, %client.player.ETSubMode], 3, 6)@" (Modifier: "@%mod@").<spop>", 5, 2);
else if(%client.player.ETMode == 4)
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Editor Tool<<<<spop>\n<spush><font:Arial:14>Modifier scaler: "@$EditorTool[%client.player.ETMode, %client.player.ETSubMode]@".\nShoot to set modifier scaler.<spop>", 5, 3);
else
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Editor Tool<<<<spop>\n<spush><font:Arial:14>Unknown mode.<spop>", 5, 2);
}
datablock ItemData(EditingTool)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_energy.dts";
image = EditingToolImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "an editing tool";
computeCRC = true;
};
datablock ShapeBaseImageData(EditingToolImage)
{
className = WeaponImage;
shapeFile = "weapon_energy.dts";
item = EditingTool;
usesEnergy = true;
minEnergy = 0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateSound[0] = BasicSwitchSound;
stateTimeoutValue[0] = 0.1;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.2;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = EditorToolFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.1;
stateAllowImageChange[4] = false;
stateName[5] = "CheckWet";
stateTransitionOnWet[5] = "Fire";
stateTransitionOnNotWet[5] = "Fire";
stateName[6] = "NoAmmo";
stateTransitionOnAmmo[6] = "Reload";
stateTransitionOnTriggerDown[6] = "DryFire";
stateSequence[6] = "NoAmmo";
stateName[7] = "DryFire";
stateTimeoutValue[7] = 0.1;
stateTransitionOnTimeout[7] = "Ready";
};
function EditingToolImage::onFire(%data,%obj,%slot)
{
%mode = %obj.ETMode;
if(%mode == 4)
{
%obj.scaler = $EditorTool[%obj.ETMode, %obj.ETSubMode];
messageClient(%obj.client, "", "\c2ET: Modifier scaler set to "@%obj.scaler@".");
return;
}
%pos = %obj.getMuzzlePoint($WeaponSlot);
%vec = %obj.getMuzzleVector($WeaponSlot);
%targetpos = VectorAdd(%pos, VectorScale(%vec, 200));
%piece = containerRaycast(%pos, %targetpos, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType, %obj);
%piece = getWord(%piece, 0);
if(!isObject(%piece))
return;
// Order reversed to eliminate console spam.
if(!isObject(Deployables) || !Deployables.isMember(%piece))
{
messageClient(%obj.client, "", "\c2ET: That piece is a part of the map and cannot be modified.");
return;
}
if(%piece.getOwner() != %obj.client && !%obj.client.isAdmin)
{
messageClient(%obj.client, "", "\c2ET: You do not own that!");
return;
}
if(%mode == 1)
EditorScale(%obj, %piece);
else if(%mode == 2)
EditorMove(%obj, %piece);
else if(%mode == 3)
EditorRotate(%obj, %piece);
else
messageClient(%obj.client, "", "\c2ET: An error has occured: Invalid Mode. You should not see this error.");
}
function EditingToolImage::onMount(%this, %obj, %slot)
{
parent::onMount(%this, %obj, %slot);
if(%obj.ETmode $= "")
%obj.ETmode = 1;
if(%obj.ETSubMode $= "")
%obj.ETSubMode = 1;
ETMessage(%obj.client);
%obj.usingEditorTool = 1;
}
function EditingToolImage::onUnmount(%this, %obj, %slot)
{
parent::onUnmount(%this, %obj, %slot);
%obj.usingEditorTool = 0;
}
function EditorMove(%player, %piece)
{
if(%player.scaler $= "")
%player.scaler = 0.25; // default to this.
if(%piece.isDoor)
{
if(!%piece.canMove)
{
messageClient(%player.client, "", "\c2ET: You can only move stationary doors.");
return;
}
if(%piece.state !$= "closed")
{
messageClient(%player.client, "", "\c2ET: You can only move fully closed doors.");
return;
}
}
%next = VectorScale(realvec(%piece, getWords($EditorTool[2, %player.ETSubMode], 0, 2)), %player.scaler);
%newPos = VectorAdd(%piece.getPosition(), %next);
%oldRot = rotFromTransform(%piece.getTransform());
%piece.setTransform(%newPos SPC %oldRot);
checkAfterRot(%piece);
}
function EditorScale(%player, %piece)
{
if(%player.scaler $= "")
%player.scaler = 0.25; // default to this.
if(%piece.isDoor)
{
if(!%piece.canMove)
{
messageClient(%player.client, "", "\c2ET: You can only scale stationary doors.");
return;
}
if(%piece.state !$= "closed")
{
messageClient(%player.client, "", "\c2ET: You can only scale fully closed doors.");
return;
}
}
%axis = VectorScale(getWords($EditorTool[2, %player.ETSubMode], 0, 2), %player.scaler);
if(%piece.getDatablock().className $= "spine" || %piece.getDatablock().className $= "mspine" || %piece.getDatablock().className $= "spine2" || %piece.getDatablock().className $= "floor" || %piece.getDatablock().className $= "wall" || %piece.getDatablock().className $= "wwall" || %piece.getDatablock().className $= "floor" || %piece.getDatablock().className $= "door")
{
%axis = VectorScale(%axis, "0.125 0.166666 1");
%scale = VectorAdd(%piece.getScale(), %axis);
%check = EditorCheckScale(%scale);
if(%check == 1)
{
messageClient(%player.client, "", "\c2ET: Cannot shrink any further. Piece is too small.");
return;
}
else if(%check == 2)
{
messageClient(%player.client, "", "\c2ET: Cannot expand any further. Piece is too big.");
return;
}
else if(%check != 0 && %check != 1 && %check != 2)
{
messageClient(%player.client, "", "\c2ET: Scale failed. You should not see this error.");
return;
}
%piece.setScale(%scale);
return;
}
if(%piece.getDatablock().getName() $= "DeployedLTarget")
{
%scale = VectorAdd(%piece.lMain.getScale(), %axis);
%check = EditorCheckScale(%scale);
if(%check == 1)
{
messageClient(%player.client, "", "\c2ET: Cannot shrink any further. Piece is too small.");
return;
}
else if(%check == 2)
{
messageClient(%player.client, "", "\c2ET: Cannot expand any further. Piece is too big.");
return;
}
else if(%check != 0 && %check != 1 && %check != 2)
{
messageClient(%player.client, "", "\c2ET: Scale failed. You should not see this error.");
return;
}
%piece.lMain.setScale(%scale);
adjustLMain(%piece);
return;
}
if(%piece.getDatablock().getName() $= "DeployedLogoProjector")
{
%scale = VectorAdd(%piece.getScale(), %axis);
%check = EditorCheckScale(%scale);
if(%check == 1)
{
messageClient(%player.client, "", "\c2ET: Cannot shrink any further. Piece is too small.");
return;
}
else if(%check == 2)
{
messageClient(%player.client, "", "\c2ET: Cannot expand any further. Piece is too big.");
return;
}
else if(%check != 0 && %check != 1 && %check != 2)
{
messageClient(%player.client, "", "\c2ET: Scale failed. You should not see this error.");
return;
}
%piece.setScale(%scale);
if(isObject(%piece.holo))
{
%piece.holo.setScale(%scale);
adjustHolo(%piece);
}
return;
}
%scale = VectorAdd(%piece.getScale(), %axis);
%check = EditorCheckScale(%scale);
if(%check == 1)
{
messageClient(%player.client, "", "\c2ET: Cannot shrink any further. Piece is too small.");
return;
}
else if(%check == 2)
{
messageClient(%player.client, "", "\c2ET: Cannot expand any further. Piece is too big.");
return;
}
else if(%check != 0 && %check != 1 && %check != 2)
{
messageClient(%player.client, "", "\c2ET: Scale failed. You should not see this error.");
return;
}
%piece.setScale(%scale);
}
function EditorRotate(%player, %piece)
{
if(%player.scaler $= "")
%player.scaler = 0.25; // default to this.
if(%piece.isDoor)
{
if(!%piece.canMove)
{
messageClient(%player.client, "", "\c2ET: You can only scale stationary doors.");
return;
}
if(%piece.state !$= "closed")
{
messageClient(%player.client, "", "\c2ET: You can only scale fully closed doors.");
return;
}
}
%test = %piece.getEdge("0 0 0");
%rottoadd = getWords($EditorTool[3, %player.ETSubMode], 0, 2) SPC %player.scaler;
%oldrot = rotFromTransform(%piece.getTransform());
%oldpos = posFromTransform(%piece.getTransform());
%newrot = rotAdd(%oldrot, %rottoadd);
%piece.setTransform(%oldpos SPC %newrot);
%piece.setEdge(%test, "0 0 0");
checkAfterRot(%piece);
}
function EditorCheckScale(%scale)
{
if(getwordcount(%scale) < 3)
return -1;
%x = getword(%scale, 0);
%y = getword(%scale, 1);
%z = getword(%scale, 2);
if(%x < 0.001 || %y < 0.001 || %z < 0.001)
return 1;
if(%x > 300 || %y > 300 || %z > 300)
return 2;
return 0;
}

View file

@ -0,0 +1,314 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Napalm Mortar
// Made by: Blnukem
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Sound Data
//------------------------------------------------------------------------------
datablock EffectProfile(MortarFireEffect)
{
effectname = "weapons/mortar_fire";
minDistance = 2.5;
maxDistance = 5.5;
};
datablock AudioProfile(MortarFireSound)
{
filename = "fx/weapons/mortar_fire.wav";
description = AudioDefault3d;
preload = true;
effect = MortarFireEffect;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Explosion Data
//------------------------------------------------------------------------------
datablock ParticleData(NapalmMortarInitExpFlameParticle)
{
dragCoefficient = 0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = -1.1;
lifetimeMS = 2000;
lifetimeVarianceMS = 0;
textureName = "special/Explosion/exp_0016";
colors[0] = "1 0.18 0.03 0.6";
colors[1] = "1 0.18 0.03 0.0";
sizes[0] = 7;
sizes[1] = 8;
};
datablock ParticleEmitterData(NapalmMortarInitExpFlameEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 2.0;
ejectionVelocity = 20.0;
velocityVariance = 10.0;
thetaMin = 0.0;
thetaMax = 90.0;
lifetimeMS = 250;
particles = "NapalmMortarInitExpFlameParticle";
};
datablock ParticleData(NapalmMortarExpGroundBurnParticle)
{
dragCoefficient = 2;
gravityCoefficient = -0.4;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 3000;
lifetimeVarianceMS = 0;
textureName = "special/cloudflash3.png";
colors[0] = "1 0.18 0.03 0.6";
colors[1] = "1 0.18 0.03 0.0";
sizes[0] = 6;
sizes[1] = 6.75;
};
datablock ParticleEmitterData(NapalmMortarExpGroundBurnEmitter)
{
ejectionPeriodMS = 4;
periodVarianceMS = 0;
ejectionOffset = 0.0;
ejectionVelocity = 10.0;
velocityVariance = 10.0;
thetaMin = 87.0;
thetaMax = 88.0;
lifetimeMS = 10000;
particles = "NapalmMortarExpGroundBurnParticle";
};
datablock ParticleData(NapalmMortarExpGroundBurnSmokeParticle)
{
dragCoefficient = 2;
gravityCoefficient = -0.4;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 3000;
lifetimeVarianceMS = 0;
useInvAlpha = true;
spinRandomMin = -100.0;
spinRandomMax = 100.0;
textureName = "particleTest";
colors[0] = "0.3 0.3 0.3 0.6";
colors[1] = "0.3 0.3 0.3 0.0";
sizes[0] = 3;
sizes[1] = 8;
};
datablock ParticleEmitterData(NapalmMortarExpGroundBurnSmokeEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionOffset = 7.0;
ejectionVelocity = 10.0;
velocityVariance = 10.0;
thetaMin = 0.0;
thetaMax = 60.0;
lifetimeMS = 10000;
particles = "NapalmMortarExpGroundBurnSmokeParticle";
};
datablock ExplosionData(NapalmMortarExplosion)
{
soundProfile = MortarExplosionSound;
emitter[0] = NapalmMortarInitExpFlameEmitter;
emitter[1] = NapalmMortarExpGroundBurnEmitter;
emitter[2] = NapalmMortarExpGroundBurnSmokeEmitter;
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 10000;
playSpeed = 0.7;
sizes[0] = "7.0 7.0 7.0";
sizes[1] = "7.0 7.0 7.0";
times[0] = 0.0;
times[1] = 1.0;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Particle Data
//------------------------------------------------------------------------------
datablock ParticleData(NapalamMortarParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.1;
inheritedVelFactor = 0.1;
lifetimeMS = 500;
lifetimeVarianceMS = 50;
textureName = "particleTest";
spinRandomMin = -10.0;
spinRandomMax = 10.0;
colors[0] = "1 0.18 0.03 0.4";
colors[1] = "1 0.18 0.03 0.3";
colors[2] = "1 0.18 0.03 0.0";
sizes[0] = 1.0;
sizes[1] = 0.5;
sizes[2] = 0.08;
times[0] = 0.0;
times[1] = 0.6;
times[2] = 1.0;
};
datablock ParticleEmitterData(NapalamMortarEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionOffset = 0.2;
ejectionVelocity = 10.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 10.0;
particles = "NapalamMortarParticle";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Projectile
//------------------------------------------------------------------------------
datablock GrenadeProjectileData(NapalmMortarShot)
{
projectileShapeName = "mortar_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 5.0;
damageRadius = 20.0;
radiusDamageType = $DamageType::Plasma;
kickBackStrength = 2500;
explosion = NapalmMortarExplosion;
velInheritFactor = 0.5;
splash = MortarSplash;
depthTolerance = 10.0;
baseEmitter = NapalamMortarEmitter;
grenadeElasticity = 0.15;
grenadeFriction = 0.4;
armingDelayMS = 2000;
muzzleVelocity = 63.7;
drag = 0.1;
sound = MortarProjectileSound;
hasLight = true;
lightRadius = 10;
lightColor = "0.94 0.03 0.12";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Napalm Ammo
//------------------------------------------------------------------------------
datablock ItemData(NapalmAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_plasma.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a container of napalm";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Weapon Data
//------------------------------------------------------------------------------
datablock ItemData(NapalmMortar)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_mortar.dts";
image = NapalmMortarImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a napalm mortar";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(NapalmMortarImage)
{
className = WeaponImage;
shapeFile = "weapon_mortar.dts";
item = NapalmMortar;
ammo = NapalmAmmo;
offset = "0 0 0";
emap = true;
minRankPoints = 6000;
projectile = NapalmMortarShot;
projectileType = GrenadeProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = MortarSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateSequence[3] = "Recoil";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.8;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateSound[3] = MortarFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 5.0;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = MortarReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MortarDryFireSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};

237
Scripts/Weapons/Krieg.cs Normal file
View file

@ -0,0 +1,237 @@
//--------------------------------------
// Chaingun
//--------------------------------------
datablock AudioProfile(KriegFireSound)
{
filename = "fx/vehicles/tank_chaingun.wav";
description = AudioDefault3d;
preload = true;
effect = AssaultChaingunFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(KriegBullet)
{
doDynamicClientHits = true;
directDamage = 0.4;
directDamageType = $DamageType::Rifle;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
specialCollisionStreamline = true;
HeadMultiplier = 1.5;
LegsMultiplier = 0.35;
kickBackStrength = 15.0;
sound = ChaingunProjectile;
dryVelocity = 3000.0;
wetVelocity = 2000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 1000;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 20.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.09;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(KriegAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "Some Rifle Ammo";
computeCRC = true;
};
datablock ItemData(RifleClip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "specialized 7.62mm cartidges";
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(KriegRifleImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
mass = 10;
item = KriegRifle;
ammo = KriegAmmo;
clip = RifleClip;
projectile = KriegBullet;
projectileType = TracerProjectile;
emap = true;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
decayingSpread = 1;
projectileSpread = 0.5 / 1000.0;
maxSpread = 3 / 1000.0;
usesClips = 1;
spreadIncreaseRate = 2 / 1000;
// Doesn't apply firing impulse.
clipTimeout = 1750;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.01;
stateFire[3] = true;
stateEmitter[3] = "GunFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 1;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = KriegFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.4;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ChaingunDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "WetFire";
stateSound[7] = PlasmaFireWetSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "Ready";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "Fire";
};
datablock ItemData(KriegRifle)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_sniper.dts";
image = KriegRifleImage;
mass = 1.0;
elasticity = 0.0;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Rifle";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(ScopeImage)
{
className = WeaponImage;
ammo = KriegAmmo;
shapeFile = "weapon_targeting.dts";
offset = "0.0 -0.2 0.1";
emap = true;
};
datablock ShapeBaseImageData(ClipImage1)
{
shapeFile = "grenade.dts";
ammo = KriegAmmo;
offset = "0.0 .2 -0.2";
emap = true;
};
function KriegRifleImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(ScopeImage, 5);
%obj.mountImage(ClipImage1, 6);
if (%obj.inv[KriegAmmo] == 0)
%this.CheckForClip(%obj, %slot);
%obj.hasKrieg = true;
}
function KriegRifleImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(5);
%obj.unmountImage(6);
%obj.clipReloading = false;
}
function KriegRifleImage::MountClipEffects(%data, %obj, %slot)
{
%obj.mountImage(ClipImage1, 6);
}
function KriegRifleImage::UnmountClipEffects(%data, %obj, %slot)
{
%obj.unmountImage(6);
}

View file

@ -0,0 +1,245 @@
//--------------------------------------
// Light SMG
//--------------------------------------
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(LSMGBullet)
{
doDynamicClientHits = true;
directDamage = 0.07;
directDamageType = $DamageType::MP5;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
specialCollisionStreamline = true;
HeadMultiplier = 1.25;
LegsMultiplier = 0.75;
kickBackStrength = 15.0;
sound = ChaingunProjectile;
dryVelocity = 1750.0;
wetVelocity = 1500.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 12.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.05;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(LSMGAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some MP12 ammo";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(LSMGImage)
{
className = WeaponImage;
shapeFile = "weapon_energy_vehicle.dts";
item = LSMG;
ammo = LSMGAmmo;
clip = LSMGClip;
projectile = LSMGBullet;
projectileType = TracerProjectile;
emap = true;
offset = "0 0.5 0"; // L/R - F/B - T/B
rotation = "0 1 0 180";
mass = 11;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
decayingSpread = 1;
usesClips = 1;
projectileSpread = 1 / 1000.0;
maxSpread = 3 / 1000;
spreadIncreaseRate = 1.5 / 1000;
clipTimeout = 1500;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
//
stateTimeoutValue[3] = 0.01;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateTimeoutValue[4] = 0.05;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 0.1;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSpinThread[6] = SpinDown;
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ItemData(LSMG)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_energy_vehicle.dts";
image = LSMGImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a MP12 SMG";
computeCRC = true;
emap = true;
};
datablock ItemData(LSMGClip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some 6mm clips";
computeCRC = true;
};
datablock ShapeBaseImageData(LSMGmain)
{
ammo = LSMGAmmo;
shapeFile = "weapon_targeting.dts";
offset = "0.0 0.0 0.0";
emap = true;
};
datablock ShapeBaseImageData(LSMGClipImage)
{
shapeFile = "grenade.dts";
ammo = LSMGAmmo;
offset = "0.0 0.64 -0.2";
emap = true;
};
function LSMGImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(LSMGClipImage, 5);
%obj.mountImage(LSMGmain, 6);
%obj.clipReloading = false;
if (%obj.inv[LSMGAmmo] == 0)
%this.CheckForClip(%obj, %slot);
}
function LSMGImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(5);
%obj.unmountImage(6);
%obj.clipReloading = false;
}
function LSMGImage::MountClipEffects(%data, %obj, %slot)
{
%obj.mountImage(LSMGClipImage, 5);
}
function LSMGImage::UnmountClipEffects(%data, %obj, %slot)
{
%obj.unmountImage(5);
}

View file

@ -0,0 +1,218 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// M79 Grenade Launcher - Made by Blnukem
// NOTICE: I realized shortly after making this gun that the M4 is a rifle...
// And I was too lazy to change the datablock names...
//------------------------------------------------------------------------------
// Projectile Data
//------------------------------------------------------------------------------
datablock GrenadeProjectileData(M4_RPGrenade)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 1.8;
damageRadius = 10.0;
radiusDamageType = $DamageType::RPG;
kickBackStrength = 3500;
explosion = "GrenadeExplosion";
underwaterExplosion = "GrenadeExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
baseEmitter = GrenadeSmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.0;
grenadeFriction = 0.0;
armingDelayMS = -1;
gravityMod = 1.3;
muzzleVelocity = 100.0;
drag = 0.2;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 4;
lightColor = "0.05 0.2 0.05";
hasLightUnderwaterColor = true;
underWaterLightColor = "0.05 0.075 0.2";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Ammo
//------------------------------------------------------------------------------
datablock ItemData(M4Ammo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_grenade.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some M79 RPG ammo";
computeCRC = true;
emap = true;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Weapon Data
//------------------------------------------------------------------------------
datablock ItemData(M4)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_grenade_launcher.dts";
image = M4Image;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a M79 RPG Launcher";
computeCRC = true;
};
datablock ShapeBaseImageData(M4Image)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
item = M4;
ammo = M4Ammo;
offset = "0 0 0";
emap = true;
minRankPoints = 1250;
projectile = M4_RPGrenade;
projectileType = GrenadeProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.4;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = GrenadeFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = GenericSwitchSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = GrenadeDryFireSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock ShapeBaseImageData(M4Revolver) : M4Image
{
offset = "0.0 0.5 -0.1";
rotation = "1 0 0 90";
shapeFile = "ammo_disc.dts";
};
function M4Image::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(M4Revolver, 1);
if (%obj.inv[M4Ammo] == 0)
%obj.M4checkclip = schedule(10, 0, "M4Checkforclip", %obj);
}
function M4Image::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(1);
if (%obj.clipReloading != false)
{
Cancel(%obj.RifleClippAdd);
%obj.clipReloading = false;
}
}
function M4Image::onFire(%data,%obj,%slot)
{
%obj.decInventory(%data.ammo,1);
%vector = %obj.getMuzzleVector(%slot);
%mp = %obj.getMuzzlePoint(%slot);
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vector);
%p = new (%data.projectileType)()
{
dataBlock = %data.projectile;
initialDirection = %newvector;
initialPosition = %mp;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
%obj.applyKick(-75);
if (%obj.inv[M4Ammo] == 0)
%obj.M4checkclip = schedule(10, 0, "M4Checkforclip", %obj);
}
function M4Checkforclip(%obj)
{
if (%obj.inv[RifleClip] > 0)
{
%obj.clipReloading = true;
%obj.unmountImage(1);
%obj.RifleClipAdd = schedule(2500, 0, "M4ReloadClip", %obj);
}
}
function M4ReloadClip(%obj)
{
%obj.clipReloading = false;
%obj.decInventory(RifleClip, 1);
%obj.mountImage(M4Revolver, 1);
%obj.setInventory(M4Ammo, 4);
}

356
Scripts/Weapons/MG42.cs Normal file
View file

@ -0,0 +1,356 @@
//--------------------------------------
// Mobile Mg42
//--------------------------------------
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock DecalData(MG42Decal1)
{
sizeX = 0.15;
sizeY = 0.15;
textureName = "special/bullethole1";
};
datablock DecalData(MG42Decal2) : ChaingunDecal1
{
textureName = "special/bullethole2";
};
datablock DecalData(MG42Decal3) : ChaingunDecal1
{
textureName = "special/bullethole3";
};
datablock DecalData(MG42Decal4) : ChaingunDecal1
{
textureName = "special/bullethole4";
};
datablock DecalData(MG42Decal5) : ChaingunDecal1
{
textureName = "special/bullethole5";
};
datablock DecalData(MG42Decal6) : ChaingunDecal1
{
textureName = "special/bullethole6";
};
datablock TracerProjectileData(MG42Bullet)
{
doDynamicClientHits = true;
directDamage = 0.13;
directDamageType = $DamageType::MG42;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
specialCollisionStreamline = true;
HeadMultiplier = 1.5;
LegsMultiplier = 0.5;
kickBackStrength = 50.0;
sound = ChaingunProjectile;
dryVelocity = 3000.0;
wetVelocity = 1000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 40.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 10.0/255.0 @ " " @ 30.0/255.0 @ " " @ 240.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.2;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = MG42Decal1;
decalData[1] = MG42Decal2;
decalData[2] = MG42Decal3;
decalData[3] = MG42Decal4;
decalData[4] = MG42Decal5;
decalData[5] = MG42Decal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(MG42Clip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some 7.62mm ammo boxes";
computeCRC = true;
};
datablock ItemData(MG42Ammo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 3;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some SAW ammo";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(MG42Image)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = MG42;
ammo = MG42Ammo;
projectile = MG42Bullet;
projectileType = TracerProjectile;
emap = true;
mass = 26;
offset = "0.08 0.22 0.15"; // L/R - F/B - T/B
casing = ShellDebris;
shellExitDir = "0.5 0 1";
shellExitOffset = "0.0 0.75 0.0";
shellExitVariance = 5.0;
shellVelocity = 4.5;
projectileSpread = 12.5 / 1000.0;
maxSpread = 4.5 / 1000.0;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = "";
//
stateTimeoutValue[3] = 0.1;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
stateEmitter[4] = "GunFireEffectEmitter";
stateEmitterNode[4] = "muzzlepoint1";
stateEmitterTime[4] = 1;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateTimeoutValue[4] = 0.05;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSound[5] = "MortarReloadSound";
stateSpinThread[5] = SpinDown;
stateEmitter[5] = "GunFireEffectEmitter";
stateEmitterNode[5] = "muzzlepoint1";
stateEmitterTime[5] = 1;
//
stateTimeoutValue[5] = 0.1;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = "MortarReloadSound";
stateSpinThread[6] = SpinDown;
stateEmitter[6] = "GunFireEffectEmitter";
stateEmitterNode[6] = "muzzlepoint1";
stateEmitterTime[6] = 10;
//
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ItemData(MG42)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "turret_tank_barrelchain.dts";
image = MG42Image;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a SAW";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(SAWImage1)
{
className = WeaponImage;
ammo = MG42Ammo;
shapeFile = "weapon_missile.dts";
rotation = "0 0 1 180";
offset = "0.01 0.04 0.0"; // L/R - F/B - T/B
};
datablock ShapeBaseImageData(SAWButtImage)
{
className = WeaponImage;
ammo = MG42Ammo;
shapeFile = "ammo_mortar.dts";
rotation = "0 0 1 90";
offset = "-0.06 -0.23 0.25"; // L/R - F/B - T/B
};
datablock ShapeBaseImageData(SAWImageclip)
{
className = WeaponImage;
ammo = MG42Ammo;
shapeFile = "ammo_chaingun.dts";
offset = "0.08 0.4 -0.13"; // L/R - F/B - T/B
item = MG42;
};
function MG42Image::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(SawImageclip, 4);
%obj.mountImage(SawButtImage, 5);
%obj.mountImage(SawImage1, 6);
if (%obj.inv[MG42Ammo] == 0)
%obj.MG42checkclip = schedule(10, 0, "MG42Checkforclip", %obj);
}
function MG42Image::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(4);
%obj.unmountImage(5);
%obj.unmountImage(6);
if (%obj.clipReloading != false)
{
Cancel(%obj.MG42ClipAdd);
%obj.clipReloading = false;
}
}
// Eolk - note. Don't call parent. This is NOT streamlined.
function MG42Image::onFire(%data,%obj,%slot)
{
%obj.decInventory(%data.ammo,1);
if(%obj.spread $= "" || %obj.spread > %data.projectileSpread)
%obj.spread = %data.projectileSpread;
else
%obj.spread = %obj.spread - (0.6 / 1000);
if(%obj.lowSpreadLoop $= "")
%obj.lowSpreadLoop = schedule(250, 0, "MG42restoreSpread", %data, %obj);
if(%obj.spread < %data.maxspread)
%obj.spread = %data.maxspread;
%vector = %obj.getMuzzleVector(%slot);
%mp = %obj.getMuzzlePoint(%slot);
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vector);
%p = new (%data.projectileType)()
{
dataBlock = %data.projectile;
initialDirection = %newvector;
initialPosition = %mp;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
%obj.applyKick(-75);
if (%obj.inv[MG42Ammo] == 0)
%obj.MG42checkclip = schedule(10, 0, "MG42Checkforclip", %obj);
}
function MG42Checkforclip(%obj)
{
if (%obj.inv[MG42clip] > 0)
{
%obj.clipReloading = true;
%obj.unmountImage(4);
%obj.MG42ClipAdd = schedule(4000, 0, "MG42ReloadClip", %obj);
}
}
function MG42ReloadClip(%obj)
{
%obj.clipReloading = false;
%obj.decInventory(MG42Clip, 1);
%obj.mountImage(SawImageclip, 4);
%obj.setInventory(MG42Ammo, 200);
}
function MG42restoreSpread(%data, %obj){
%obj.spread = %obj.spread + (1 / 1000);
if(%obj.spread >= (15 / 1000)){
%obj.spread = (15 / 1000);
%obj.lowSpreadLoop = "";
return;
}
%obj.lowSpreadLoop = schedule(150, 0, "MG42restoreSpread", %data, %obj);
}

View file

@ -0,0 +1,726 @@
// Merge Tool v006
// Coded by Electricutioner
// Last modified: 6:22 PM 5/21/2006
// Idea by the T2 Construction Community
//Variables:
$ElecMod::MergeTool::Tolerance = 0.05; //how many meters of tolerance do we give the pieces that we merge.
$ElecMod::MergeTool::HighTolerance = 0.25; //used for "high tolerance" mode on stubborn pieces
$ElecMod::MergeTool::Timeout = 2; //how many seconds until a selection times out when using the tool
//split portion
$ElecMod::MergeTool::MinimumPieceVolume = 0.125; //50 cm cube is smallest, consider revising this to 16
//Functions:
//this function rotates and rescales pieces to create the stretch effect
function MTIsometric(%client, %piece)
{
if (!isObject(%piece))
return;
if (!%client.isAdmin)
{
if (%client.guid != %piece.ownerguid)
{
messageClient(%client, 'MsgClient', "\c2IT: That piece isn't yours.");
return;
}
}
if (!%piece.isForcefield())
{
%piece.setCloaked(true);
%piece.schedule(290, "setCloaked", false);
}
%center = %piece.getEdge("0 0 0");
%currentSize = %piece.getRealSize();
//this used to be one operation, but it ceased to work properly (?)
%piece.setTransform(remoteRotate(%piece,"0 1 0 1.570796", %piece,"0 0 0"));
%piece.setRealSize(getWord(%currentSize, 2) SPC getWord(%currentSize, 1) SPC getWord(%currentSize, 0));
%piece.setEdge(%center, "0 0 0");
%currentSize = %piece.getRealSize();
%piece.setTransform(remoteRotate(%piece,"0 0 1 1.570796", %piece,"0 0 0"));
%piece.setRealSize(getWord(%currentSize, 1) SPC getWord(%currentSize, 0) SPC getWord(%currentSize, 2));
%piece.setEdge(%center, "0 0 0");
}
// Function by Eolk
function MTZAxisReverse(%client, %piece)
{
if (!isObject(%piece))
return;
if (!%client.isAdmin)
{
if (%client.guid != %piece.ownerguid)
{
messageClient(%client, 'MsgClient', "\c2IT: That piece isn't yours.");
return;
}
}
if (!%piece.isForcefield())
{
%piece.setCloaked(true);
%piece.schedule(290, "setCloaked", false);
}
%center = %piece.getEdge("0 0 0");
%piece.setTransform(remoteRotate(%piece,"1 0 0 3.141593", %piece,"0 0 0"));
%piece.setEdge(%center, "0 0 0");
}
//This is the basic initiator function. If the piece called are compatable, nothing further needs to be called.
function MTMerge(%client, %piece1, %piece2, %hiTol)
{
if (!MTCheckCompatability(%client, %piece1, %piece2, %hiTol))
{
%piece1.setCloaked(false);
%piece2.setCloaked(false);
MTClearClientSelection();
return;
}
if (!%piece1.isForcefield())
%piece1.setCloaked(true);
if (!%piece2.isForcefield())
%piece2.setCloaked(true);
schedule(100, 0, "MTScaleShiftMerge", %piece1, %piece2);
if (isEventPending(%client.mergeschedule))
{
cancel(%client.mergeschedule);
MTClearClientSelection();
}
}
//This function checks if 4 corners of the objects are compatable. If an error is encountered it returns a 0 and
//terminates the merge. Otherwise, it returns a 1, and continues the merge process.
function MTCheckCompatability(%client, %piece1, %piece2, %hiTol)
{
//do the pieces exist?
if (!isObject(%piece1) || !isObject(%piece2))
{
messageClient(%client, 'MsgClient', "\c2MT: A piece appears to be missing.");
return;
}
//check if the owners are the same
if (%piece1.owner != %client || %piece2.owner != %client)
{
//with an exemption of admins
if (!%client.isAdmin)
{
//fix for when players leave the server and come back
if (%piece1.ownerGUID != %client.guid || %piece2.ownerGUID != %client.guid)
{
messageClient(%client, 'MsgClient', "\c2MT: One or more of those pieces do not belong to you.");
return;
}
}
}
//now we need to determine if at least 4 of the pieces axies match
//get all the 8 points of both pieces
%pos1[0] = %piece1.getEdge("1 1 -1");
%pos1[1] = %piece1.getEdge("-1 1 -1");
%pos1[2] = %piece1.getEdge("1 -1 -1");
%pos1[3] = %piece1.getEdge("-1 -1 -1");
%pos1[4] = %piece1.getEdge("1 1 1");
%pos1[5] = %piece1.getEdge("-1 1 1");
%pos1[6] = %piece1.getEdge("1 -1 1");
%pos1[7] = %piece1.getEdge("-1 -1 1");
%pos2[0] = %piece2.getEdge("1 1 -1");
%pos2[1] = %piece2.getEdge("-1 1 -1");
%pos2[2] = %piece2.getEdge("1 -1 -1");
%pos2[3] = %piece2.getEdge("-1 -1 -1");
%pos2[4] = %piece2.getEdge("1 1 1");
%pos2[5] = %piece2.getEdge("-1 1 1");
%pos2[6] = %piece2.getEdge("1 -1 1");
%pos2[7] = %piece2.getEdge("-1 -1 1");
//then we compare them to see which ones match
%k = 0;
for (%i = 0; %i < 8; %i++)
{
for (%j = 0; %j < 8; %j++)
{
if (!%hiTol && $ElecMod::MergeTool::Tolerance >= vectorDist(%pos1[%i], %pos2[%j]))
{
%k++;
}
else if (%hiTol && $ElecMod::MergeTool::HighTolerance >= vectorDist(%pos1[%i], %pos2[%j]))
{
%k++;
}
}
}
//if less then 4 match, they can't be compatable (if more then 4 match... something odd is going on)
if (%k < 4)
{
if (%k == 0)
messageClient(%client, 'MsgClient', "\c2MT: None of the corners are shared on those objects. Cannot merge.");
else
messageClient(%client, 'MsgClient', "\c2MT: Only " @ %k @ " corners of the required 4 are shared. Cannot merge.");
return;
}
else if (%k > 4)
{
messageClient(%client, 'MsgClient', "\c2MT: Warning: Detected match of over 4 corners (" @ %k @ "). Merging may fail to produce desired results.");
}
//if the check survived that, we continue...
return 1;
}
//this function, after the pieces are confirmed, checks to see which of the 6 sides is in contact, refers to another
//function to find the alter side, determines distance between them to find a new "real" scale, and determines the
//new world box center for the object. Piece 1 is resized and moved, piece 2 is deconstructed.
function MTScaleShiftMerge(%piece1, %piece2)
{
//find which axis is touching for a "this is the side we scale" discovery
//table:
//0: X
//1: -X
//2: Y
//3: -Y
//4: Z
//5: -Z
%p1S[0] = %piece1.getEdge("1 0 0");
%p1S[1] = %piece1.getEdge("-1 0 0");
%p1S[2] = %piece1.getEdge("0 1 0");
%p1S[3] = %piece1.getEdge("0 -1 0");
%p1S[4] = %piece1.getEdge("0 0 1");
%p1S[5] = %piece1.getEdge("0 0 -1");
%p2S[0] = %piece2.getEdge("1 0 0");
%p2S[1] = %piece2.getEdge("-1 0 0");
%p2S[2] = %piece2.getEdge("0 1 0");
%p2S[3] = %piece2.getEdge("0 -1 0");
%p2S[4] = %piece2.getEdge("0 0 1");
%p2S[5] = %piece2.getEdge("0 0 -1");
for (%i = 0; %i < 6; %i++)
{
for (%j = 0; %j < 8; %j++)
{
if ($ElecMod::MergeTool::Tolerance >= vectorDist(%p1S[%i], %p2S[%j]))
{
%side1 = %i;
%side2 = %j;
}
}
}
//echo("Sides:" SPC %i SPC %j);
//at this point %side1/2 will contain one of the numbers in the table above
//we get the non-shared side at this point
%ops1 = MTFindOpSide(%side1);
%ops2 = MTFindOpSide(%side2);
//this variable contains the new axis length that we are scaling on...
%newaxis = VectorDist(%p1S[%ops1], %p2S[%ops2]);
%currsize = %piece1.getRealSize();
if (%side1 == 0 || %side1 == 1)
%axis = "x";
if (%side1 == 2 || %side1 == 3)
%axis = "y";
if (%side1 == 4 || %side1 == 5)
%axis = "z";
//echo("Axis:" SPC %axis);
if (%axis $= "x")
{
%piece1.setRealSize(%newaxis SPC getWords(%currsize, 1, 2));
if (isObject(%piece1.pzone))
%piece1.pzone.setScale(%newaxis SPC getWords(%currsize, 1, 2));
}
if (%axis $= "y")
{
%piece1.setRealSize(getWord(%currsize, 0) SPC %newaxis SPC getWord(%currsize, 2));
if (isObject(%piece1.pzone))
%piece1.pzone.setScale(getWord(%currsize, 0) SPC %newaxis SPC getWord(%currsize, 2));
}
if (%axis $= "z")
{
%piece1.setRealSize(getWords(%currsize, 0, 1) SPC %newaxis);
if (isObject(%piece1.pzone))
%piece1.pzone.setScale(getWords(%currsize, 0, 1) SPC %newaxis);
}
if (%axis !$= "x" && %axis !$= "y" && %axis !$= "z")
{
error("MT: A scaling error has occured.");
return;
}
%newpos = VectorScale(VectorAdd(%p1S[%ops1], %p2S[%ops2]), 0.5);
%piece1.SetWorldBoxCenter(%newpos);
if (isObject(%piece1.pzone))
%piece1.pzone.setPosition(%piece1.getPosition());
if (!%piece1.isForcefield())
%piece1.setCloaked(false);
if (!%piece2.isForcefield())
%piece2.setCloaked(false);
//%piece2.delete(); //deleting is bad
//%piece2.getDataBlock().disassemble(0, %piece2.owner, %piece2); //disassemble is cleaner
//fixed disassemble to use object specific disassemble functions
//disassemble(0, %piece2.owner, %piece2);
%piece2.getDatablock().disassemble(0, %piece2);
}
//this function does something very simple, it finds whether a number is even or odd, and then adds or subracts
//and returns the initial input with that modification. I can't imagine where else this could be useful.
function MTFindOpSide(%side)
{
%evencheck = %side / 2;
if (%evencheck == mFloor(%evencheck))
%even = 1;
else
%even = 0;
if (%even)
return (%side + 1);
else
return (%side - 1);
}
//simply clears a client variable... woohoo...
function MTClearClientSelection(%client)
{
%client.mergePiece1 = "";
return;
}
//"weapon" datablocks and such
datablock ItemData(MergeTool)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_sniper.dts";
image = MergeToolImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a MIST, by Electricutioner.";
computeCRC = true;
};
datablock ShapeBaseImageData(MergeToolImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = MergeTool;
usesEnergy = true;
minEnergy = 0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateSound[0] = GenericSwitchSound;
stateTimeoutValue[0] = 0.1;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.2; //reload timeout here
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = "MergeToolFireSound";
stateName[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.1;
stateAllowImageChange[4] = false;
stateName[5] = "CheckWet";
stateTransitionOnWet[5] = "Fire";
stateTransitionOnNotWet[5] = "Fire";
stateName[6] = "NoAmmo";
stateTransitionOnAmmo[6] = "Reload";
stateTransitionOnTriggerDown[6] = "DryFire";
stateSequence[6] = "NoAmmo";
stateName[7] = "DryFire";
stateSound[7] = SniperRifleDryFireSound;
stateTimeoutValue[7] = 0.1;
stateTransitionOnTimeout[7] = "Ready";
};
function MergeToolImage::onFire(%data,%obj,%slot)
{
serverPlay3D(SniperRifleFireSound, %obj.getTransform());
%client = %obj.client;
%pos = getWords(%obj.getEyeTransform(), 0, 2);
%vec = %obj.getEyeVector();
%targetpos = VectorAdd(%pos, VectorScale(%vec, 2000));
%piece = containerRaycast(%pos, %targetpos, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType, %obj);
%cast = %piece;
%piece = getWord(%piece, 0);
if (!isObject(%piece))
return;
if (!Deployables.isMember(%piece))
{
messageClient(%client, 'MsgClient', "\c2MIST: That piece is part of the map and cannot be manipulated.");
return;
}
if (!%client.isAdmin)
{
if (%piece.ownerGUID != %client.guid)
{
messageClient(%client, 'MsgClient', "\c2MIST: That piece isn't yours.");
return;
}
}
if (%client.MTMode == 0)
{
if (!isObject(%client.mergePiece1))
{
%client.mergePiece1 = %piece;
if (!%piece.isForcefield())
{
%piece.setCloaked(true);
%piece.schedule(290, "setCloaked", false);
}
%client.mergeschedule = schedule($ElecMod::MergeTool::Timeout * 1000, 0, "MTClearClientSelection", %client);
}
else
{
if (%piece != %client.mergePiece1)
{
if (%client.MTSubMode == 1)
{
MTMerge(%client, %client.mergePiece1, %piece, 1);
%client.MTSubMode = 0;
MTShowStatus(%client);
}
else
{
MTMerge(%client, %client.mergePiece1, %piece, 0);
}
MTClearClientSelection(%client);
}
else
{
messageClient(%client, 'MsgClient', "\c2MT: You cannot merge a piece with itself.");
return;
}
}
}
if (%client.MTMode == 1)
{
if (%client.MTSubMode == 1)
MTZAxisReverse(%client, %piece);
else
MTIsometric(%client, %piece);
}
if (%client.MTMode == 2)
{
if (%client.MTSubMode > 4 || %client.MTSubMode == 1)
{
%client.MTSplitMode = 1; //crosshair split
}
else
{
%client.MTSplitMode = 0; //half split
}
if (%client.MTSubMode == 0)
%axis = "a";
if (%client.MTSubMode == 1)
%axis = "a";
if (%client.MTSubMode == 2)
%axis = "x";
if (%client.MTSubMode == 3)
%axis = "y";
if (%client.MTSubMode == 4)
%axis = "z";
if (%client.MTSubMode == 5)
%axis = "x";
if (%client.MTSubMode == 6)
%axis = "y";
if (%client.MTSubMode == 7)
%axis = "z";
MTSplit(%client, %cast, %axis);
}
}
function MergeToolImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(MergeToolImage, 0);
MTShowStatus(%obj.client);
}
function MTShowStatus(%client)
{
if (%client.MTMode $= "")
%client.MTMode = 0;
if (%client.MTSubMode $= "")
%client.MTSubMode = 0;
switch (%client.MTMode)
{
case 0:
switch (%client.MTSubMode)
{
case 0:
%status = "<font:Arial:14>Mode: Merge. Fire the tool at two pieces. If possible, they will merge. Tolerance: " @ $ElecMod::MergeTool::Tolerance @ " meters.";
case 1:
%status = "<font:Arial:14>Mode: Merge. Fire the tool at two pieces. If possible, they will merge. Tolerance: " @ $ElecMod::MergeTool::HighTolerance @ " meters.";
}
case 1:
switch (%client.MTSubMode)
{
case 0:
%status = "<spop><font:Arial:14>Mode: Isometric. Fire at a piece. It will be rotated isometrically.";
case 1:
%status = "<spop><font:Arial:14>Mode: Isometric Z-axis Reversal. Fire at a piece. It's Z Axis will be reversed.";
}
case 2:
switch (%client.MTSubMode)
{
case 0:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it in half. Axis: Automatic.";
case 1:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it on crosshair. Axis: Automatic.";
case 2:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it in half. Axis: X.";
case 3:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it in half. Axis: Y.";
case 4:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it in half. Axis: Z.";
case 5:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it on crosshair. Axis: X.";
case 6:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it on crosshair. Axis: Y.";
case 7:
%status = "<font:Arial:14>Mode: Split. Fire at a piece to split it on crosshair. Axis: Z.";
}
}
CommandToClient(%client, 'BottomPrint', "<font:Sui Generis:14>>>>M/I/S Tool<<<\n<font:Arial:14>" @ %status @ "\nCoded by Electricutioner.", 3, 3 );
}
//Split code begins here.
//The goal of this is to be a semi-inverse of the merge...
//The tool will be set to split mode, and aimed at an object. The object axies are checked, and if there is one that is
//disproportionally larger then the rest, it will be split on that axis. If two or more axies are similar, it does
//a check to determine the face where the raycast hits (reducing split possibilities by one axis) and either
//spliting on the remaining axis or using position points to find out in which quadrant of the face, the raycast hit.
//Once the axis is determined, the split axis has the difference halved, a "dominant" piece rescaled and repositioned
//in steps similar to the merge, and a new (nearly-identical) piece is created in the resulting void.
//startup function, the calling client, and the raycasted piece. Note: %piece contains all raycast operations.
function MTSplit(%client, %piece, %axis)
{
if(!MTSplitValidate(%client, %piece, %axis)) //validates the client selected piece as valid
return;
if (!%piece.isForcefield())
getWord(%piece, 0).setCloaked(true);
MTSplitScaleShift(%client, %piece, %axis); //split it up
}
//makes sure that the object can be split
function MTSplitValidate(%client, %piece, %axis)
{
if (!isObject(getWord(%piece, 0)))
{
messageClient(%client, 'MsgClient', "\c2ST: The piece to split is missing. You should not see this error.");
return;
}
//restricting to cubics and forcefields.
if (!isCubic(%piece) && !%piece.isForceField())
{
messageClient(%client, 'MsgClient', "\c2ST: That object is not cubic and it cannot be split.");
return;
}
%size = %piece.getRealSize();
%volume = 2 * getWord(%size, 0) * 2 * getWord(%size, 1) * 2 * getWord(%size, 2);
if (%client.MTSplitMode == 0) //half split
{
if ((%volume / 2) < ($ElecMod::MergeTool::MinimumPieceVolume))
{
messageClient(%client, 'MsgClient', "\c2ST: That piece is too small to split.");
return;
}
}
else
{
%hitPos = getWord(%piece, 1) SPC getWord(%piece, 2) SPC getWord(%piece, 3);
%edge = PointToEdge(getWord(%piece, 0), %hitPos);
//auto-axis determiner
if (%axis $= "a")
%axis = CalculateSplitAxis(PointToEdge(%piece, %hitPos));
switch$ (%axis)
{
case "x":
%ratio = getWord(%edge, 0);
%ratio = (%ratio + 1) / 2;
case "y":
%ratio = getWord(%edge, 1);
%ratio = (%ratio + 1) / 2;
case "z":
%ratio = getWord(%edge, 2);
%ratio = (%ratio + 1) / 2;
}
%masterSize = %volume * %ratio;
%slaveSize = %volume * (1 - %ratio);
//echo(%ratio SPC %axis SPC %masterSize SPC %slaveSize);
if (%masterSize < $ElecMod::MergeTool::MinimumPieceVolume || %slaveSize < $ElecMod::MergeTool::MinimumPieceVolume)
{
messageClient(%client, 'MsgClient', "\c2ST: A resultant piece from that split is too small. Aborting.");
return;
}
}
return 1; //we survived, thus we continue
}
//does the actual splitting
function MTSplitScaleShift(%client, %cast, %axis)
{
%piece = getWord(%cast, 0);
%copy = MTCarbonCopy(%piece); //Merge Tool Support functions
if (!%piece.isForcefield())
{
%piece.setCloaked(true);
%copy.setCloaked(true);
}
%hitPos = getWord(%cast, 1) SPC getWord(%cast, 2) SPC getWord(%cast, 3);
%size = %piece.getRealSize();
//auto axis determiner
if (%axis $= "a")
{
%axis = CalculateSplitAxis(PointToEdge(%piece, %hitPos));
//echo(%hitPos);
}
if (%client.MTSplitMode == 0) //split in half
{
%center = %piece.getWorldBoxCenter();
%sizeFactorMaster = 2;
%sizeFactorSlave = 2;
switch$ (%axis)
{
case "x":
%piece.setRealSize((getWord(%size, 0) / %sizeFactorMaster) SPC getWords(%size, 1, 2));
%copy.setRealSize((getWord(%size, 0) / %sizeFactorSlave) SPC getWords(%size, 1, 2));
%piece.setEdge(%center, "1 0 0");
%copy.setEdge(%center, "-1 0 0");
case "y":
%piece.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) / %sizeFactorMaster SPC getWord(%size, 2));
%copy.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) / %sizeFactorSlave SPC getWord(%size, 2));
%piece.setEdge(%center, "0 1 0");
%copy.setEdge(%center, "0 -1 0");
case "z":
%piece.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) / %sizeFactorMaster);
%copy.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) / %sizeFactorSlave);
%piece.setEdge(%center, "0 0 1");
%copy.setEdge(%center, "0 0 -1");
}
}
else
{
%edge = PointToEdge(%piece, %hitPos); //PointToEdge is in the Merge Tool support functions
switch$ (%axis)
{
case "x":
%ratio = getWord(%edge, 0);
%ratio = (%ratio + 1) / 2;
%center = %piece.getEdge("-1 0 0");
%piece.setRealSize(getWord(%size, 0) * %ratio SPC getWords(%size, 1, 2));
%copy.setRealSize(getWord(%size, 0) * (1 - %ratio) SPC getWords(%size, 1, 2));
%piece.setEdge(%center, "-1 0 0");
%copy.setEdge(%piece.getEdge("1 0 0"), "-1 0 0");
case "y":
%ratio = getWord(%edge, 1);
%ratio = (%ratio + 1) / 2;
%center = %piece.getEdge("0 -1 0");
%piece.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) * %ratio SPC getWord(%size, 2));
%copy.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) * (1 - %ratio) SPC getWord(%size, 2));
%piece.setEdge(%center, "0 -1 0");
%copy.setEdge(%piece.getEdge("0 1 0"), "0 -1 0");
case "z":
%ratio = getWord(%edge, 2);
%ratio = (%ratio + 1) / 2;
%center = %piece.getEdge("0 0 -1");
%piece.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) * %ratio);
%copy.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) * (1 - %ratio));
%piece.setEdge(%center, "0 0 -1");
%copy.setEdge(%piece.getEdge("0 0 1"), "0 0 -1");
}
}
if (isObject(%piece.pzone))
{
%piece.pzone.setScale(%piece.getScale());
%piece.pzone.setPosition(%piece.getPosition());
}
if (isObject(%copy.pzone))
{
%copy.pzone.setScale(%copy.getScale());
%copy.pzone.setPosition(%copy.getPosition());
}
if (!%piece.isForcefield())
{
%piece.schedule(290, "setCloaked", false);
%copy.schedule(290, "setCloaked", false);
}
}
function CalculateSplitAxis(%edge)
{
//echo("Calculating split axis from edge: " @ %edge);
%edge = mAbs(getWord(%edge, 0)) SPC mAbs(getWord(%edge, 1)) SPC mAbs(getWord(%edge, 2));
if (getWord(%edge, 0) < getWord(%edge, 1) && getWord(%edge, 0) < getWord(%edge, 2))
return "x";
if (getWord(%edge, 1) < getWord(%edge, 0) && getWord(%edge, 1) < getWord(%edge, 2))
return "y";
if (getWord(%edge, 2) < getWord(%edge, 0) && getWord(%edge, 2) < getWord(%edge, 1))
return "z";
}
exec("scripts/do_not_delete/MergeToolSupport.cs");

559
Scripts/Weapons/PBC.cs Normal file
View file

@ -0,0 +1,559 @@
//--------------------------------------------------------------------------
// Plasma Beam Cannon
//--------------------------------------------------------------------------
datablock ShockwaveData(PBCShockwave)
{
width = 1.0;
numSegments = 32;
numVertSegments = 6;
velocity = 20;
acceleration = 0.0;
lifetimeMS = 1000;
height = 4.0;
verticalCurve = 0.5;
is2D = false;
texture[0] = "special/shockwave4";
texture[1] = "special/gradient";
texWrap = 6.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.1 1.0 0.1 0.50";
colors[1] = "0.8 0.8 1.0 1.0";
colors[2] = "0.8 0.8 1.0 1.0";
mapToTerrain = true;
orientToNormal = false;
renderBottom = false;
};
datablock ParticleData(PBCParticle) {
dragCoefficient = 0.5;
WindCoefficient = 0;
gravityCoefficient = 0.0;
inheritedVelFactor = 1;
constantAcceleration = 0;
lifetimeMS = 3000;
lifetimeVarianceMS = 0;
textureName = "special/lightning1frame2";
useInvAlpha = 0;
spinRandomMin = -800;
spinRandomMax = 800;
spinspeed = 50;
colors[0] = "0.1 1.0 0.1 1.0";
colors[1] = "0.6 0.9 0.6 1.0";
colors[2] = "0.8 0.8 1.0 1.0";
colors[3] = "0.8 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 1;
sizes[2] = 1.5;
sizes[3] = 1.5;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 0.3;
times[3] = 1.0;
};
datablock ParticleEmitterData(PBCExpEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 2.5;
velocityVariance = 2.5;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 200;
particles = "PBCParticle";
};
datablock ParticleEmitterData(PBCExpEmitter2)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 10.0;
velocityVariance = 10.0;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 200;
particles = "PBCParticle";
};
datablock ExplosionData(PBCsubExplosion)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
emitter[0] = PBCExpEmitter2;
delayMS = 100;
offset = 2.0;
playSpeed = 1.25;
sizes[0] = "0.3 0.3 0.3";
sizes[1] = "0.3 0.3 0.3";
times[0] = 0.0;
times[1] = 1.0;
};
datablock ExplosionData(PBCexplosion)
{
soundProfile = sniperExpSound;
shockwave = PBCShockwave;
shockwaveOnTerrain = true;
explosionShape = "disc_explosion.dts";
faceViewer = true;
playSpeed = 1.5;
sizes[0] = "1.0 1.0 1.0";
sizes[1] = "1.0 1.0 1.0";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = PBCExpEmitter;
subExplosion[0] = PBCsubExplosion;
shakeCamera = true;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "20.0 20.0 20.0";
camShakeDuration = 0.5;
camShakeRadius = 10.0;
};
//----------------------
// Firing Effects
//----------------------
datablock ParticleData(PBCChargeSmoke)
{
dragCoeffiecient = 0;
WindCoefficient = 0;
gravityCoefficient = 0; // rises slowly
inheritedVelFactor = 0.025;
constantAcceleration = -12;
lifetimeMS = 1000;
lifetimeVarianceMS = 0;
useInvAlpha = 0;
spinRandomMin = -800;
spinRandomMax = 800;
spinspeed = 50;
textureName = "special/lightning1frame2";
colors[0] = "0.5 1.0 0.5 1.0";
colors[1] = "0.5 1.0 0.5 1.0";
sizes[0] = 0.1;
sizes[1] = 0.1;
times[0] = 0.0;
times[1] = 1.0;
};
datablock ParticleEmitterData(PBCChargeEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 0.5;
ejectionVelocity = 0.05;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 10;
particles = "PBCChargeSmoke";
};
//--------------------------------------
// Projectile
//--------------------------------------
datablock TargetProjectileData(PBCTlProj)
{
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
velInheritFactor = 1.0;
maxRifleRange = 1000;
beamColor = "0.1 1.0 0.1";
startBeamWidth = 0.3; //0.02
pulseBeamWidth = 0.7; //0.025
beamFlareAngle = 3.0;
minFlareSize = 0.0;
maxFlareSize = 400.0;
pulseSpeed = 6.0;
pulseLength = 0.150;
textureName[0] = "special/nonlingradient";
textureName[1] = "special/flare";
textureName[2] = "special/pulse";
textureName[3] = "special/expFlare";
beacon = true;
};
datablock TracerProjectileData(PBCMainProj)
{
doDynamicClientHits = true;
directDamage = 1.0;
explosion = "PBCexplosion";
splash = ChaingunSplash;
directDamageType = $DamageType::PBC;
kickBackStrength = 0.0;
sound = ShrikeBlasterProjectileSound;
dryVelocity = 5000.0;
wetVelocity = 0.0;
velInheritFactor = 1.0;
fizzleTimeMS = 200;
lifetimeMS = 200;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = true;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 45.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = "0.1 1.0 0.1 1.0";
tracerTex[0] = "special/shrikeBolt";
tracerTex[1] = "special/shrikeBoltCross";
tracerWidth = 4.4;
crossSize = 0.99;
crossViewAng = 0.990;
renderCross = true;
};
datablock DebrisData( PBCCellDebris )
{
shapeName = "ammo_plasma.dts";
lifetime = 5.0;
minSpinSpeed = 0.0;
maxSpinSpeed = 1.0;
elasticity = 0.5;
friction = 0.2;
numBounces = 3;
fade = true;
staticOnMaxBounce = true;
snapOnMaxBounce = true;
};
//--------------------------------------
// Rifle and item...
//--------------------------------------
datablock ItemData(PBC)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_sniper.dts";
image = PBCImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Plasma Beam Cannon";
computeCRC = true;
};
datablock ItemData(PBCAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_plasma.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "A Plasma Beam Cannon power cell";
computeCRC = true;
};
datablock ShapeBaseImageData(PBCImage)
{
className = WeaponImage;
shapeFile = "weapon_mortar.dts";
item = PBC;
projectile = PBCMainProj;
projectileType = TracerProjectile;
ammo = PBCAmmo;
armThread = looksn;
usesEnergy = false;
casing = PBCCellDebris;
shellExitDir = "0.0 0.0 -1.0"; // L/R - F/B - T/B
shellExitOffset = "0.0 0.0 -0.4";
shellExitVariance = 0.0;
shellVelocity = 1.0;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
stateTimeoutValue[0] = 1.0;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateScript[1] = "onReady";
stateSpinThread[1] = Stop;
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
stateScript[3] = "onSpinup";
stateTimeoutValue[3] = 2;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSpinThread[4] = FullSpeed;
stateEmitter[4] = "PBCShootEmitter";
stateEmitterNode[4] = "muzzlepoint1";
stateEmitterTime[4] = 0.1;
stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateTimeoutValue[4] = 1.0;
stateTransitionOnTimeout[4] = "Spindown";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSpinThread[5] = SpinDown;
stateScript[5] = "onSpindown";
stateTimeoutValue[5] = 1.5;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSpinThread[6] = SpinDown;
stateScript[6] = "onSpindown";
stateTimeoutValue[5] = 1.5;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ShapeBaseImageData(PBCTLImage)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
offset = "0 0 0";
projectile = PBCTlProj;
projectileType = TargetProjectile;
deleteLastProjectile = false;
offset = "0.1 0.75 0.0"; // L/R - F/B - T/B
usesEnergy = true;
minEnergy = 0;
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = TargetingLaserSwitchSound;
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Fire";
stateName[3] = "Fire";
stateEnergyDrain[3] = 0;
stateFire[3] = true;
stateScript[3] = "onFire";
};
datablock ShapeBaseImageData(PBCPowerCellImage)
{
className = WeaponImage;
ammo = PBCAmmo;
shapeFile = "ammo_plasma.dts";
rotation = "-1 0 0 90";
offset = "0.08 0.9 -0.3"; // L/R - F/B - T/B
};
datablock ShapeBaseImageData(PBCDummy1)
{
className = WeaponImage;
ammo = PBCAmmo;
shapeFile = "pack_upgrade_satchel.dts";
rotation = "1 0 0 90";
offset = "0.08 0.45 0.0"; // L/R - F/B - T/B
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateSequence[1] = "fire";
stateTransitionOnTriggerUp[1] = "Idle";
};
datablock ShapeBaseImageData(PBCDummy2)
{
className = WeaponImage;
ammo = PBCAmmo;
shapeFile = "pack_upgrade_shield.dts";
rotation = "0 0 1 90";
offset = "0.05 0.55 0"; // L/R - F/B - T/B
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateSequence[1] = "fire";
stateTransitionOnTriggerUp[1] = "Idle";
};
datablock ShapeBaseImageData(PBCDummy3)
{
className = WeaponImage;
ammo = PBCAmmo;
shapeFile = "pack_upgrade_shield.dts";
rotation = "0 0 -1 90";
offset = "0.12 0.55 0"; // L/R - F/B - T/B
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateSequence[1] = "fire";
stateTransitionOnTriggerUp[1] = "Idle";
};
function PBCImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(PBCDummy1, 3);
%obj.mountImage(PBCDummy2, 4);
%obj.mountImage(PBCDummy3, 5);
}
function PBCImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(3);
%obj.unmountImage(4);
%obj.unmountImage(5);
%obj.unmountImage(6);
}
function PBCImage::onSpinup(%data,%obj,%slot){
%obj.mountImage(PBCTLImage, 7);
PBCCharge(%obj, 0);
%obj.setImageTrigger(3, true);
%obj.setImageTrigger(4, true);
%obj.setImageTrigger(5, true);
}
function PBCImage::onSpindown(%data,%obj,%slot){
%obj.unmountImage(7);
%obj.setImageTrigger(3, false);
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(5, false);
}
function PBCImage::onReady(%data,%obj,%slot)
{
%obj.mountImage(PBCPowerCellImage, 6);
}
function PBCImage::onFire(%data,%obj,%slot){
serverPlay3d("SniperFireSound",%obj.getmuzzlepoint(0));
%p = Parent::onFire(%data, %obj, %slot);
%obj.unmountImage(6);
}
function PBCTLImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%p.setTarget(%obj.team);
%obj.PBCLP = %p;
%p.schedule(10000, "delete");
}
function PBCTLImage::onUnmount(%this,%obj,%slot)
{
%obj.PBCLP.delete();
Parent::onUnmount(%this, %obj, %slot);
}
function PBCCharge(%obj,%count){
if(!isobject(%obj))
return;
if(%count <= 9){
%charge = new ParticleEmissionDummy()
{
position = %obj.getMuzzlePoint(0);
dataBlock = "defaultEmissionDummy";
emitter = "PBCChargeEmitter";
};
MissionCleanup.add(%charge);
%charge.schedule(100, "delete");
%count++;
%obj.PBCCharging = schedule(100, %obj, "PBCCharge", %obj, %count);
}
}

View file

@ -0,0 +1,260 @@
//--------------------------------------------------------------------------
// Sniper rifle
//
//
//--------------------------------------------------------------------------
datablock AudioProfile(LaserRifleFireSound)
{
filename = "fx/weapons/cg_hard1.wav";
description = AudioClose3d;
preload = true;
effect = SniperRifleFireEffect;
};
//--------------------------------------------------------------------------
// Splash
//--------------------------------------------------------------------------
datablock ParticleData( LaserSplashParticle )
{
dragCoeffiecient = 0.4;
gravityCoefficient = -0.03; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 600;
lifetimeVarianceMS = 300;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 1.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( LaserSplashEmitter )
{
ejectionPeriodMS = 25;
ejectionOffset = 0.2;
periodVarianceMS = 0;
ejectionVelocity = 2.25;
velocityVariance = 0.50;
thetaMin = 0.0;
thetaMax = 30.0;
lifetimeMS = 250;
particles = "LaserSplashParticle";
};
datablock SplashData( LaserSplash )
{
numSegments = 5;
ejectionFreq = 0.0001;
ejectionAngle = 45;
ringLifetime = 0.5;
lifetimeMS = 400;
velocity = 5.0;
startRadius = 0.0;
acceleration = -3.0;
texWrap = 5.0;
texture = "special/water2";
emitter[0] = SniperSplashEmitter;
colors[0] = "0.7 0.8 1.0 0.0";
colors[1] = "0.7 0.8 1.0 1.0";
colors[2] = "0.7 0.8 1.0 0.0";
colors[3] = "0.7 0.8 1.0 0.0";
times[0] = 0.0;
times[1] = 0.4;
times[2] = 0.8;
times[3] = 1.0;
};
//--------------------------------------------------------------------------
// Explosion
//--------------------------------------
datablock AudioProfile(sniperExpSound)
{
filename = "fx/weapons/sniper_impact.WAV";
description = AudioClosest3d;
preload = true;
};
datablock ParticleData(LaserExplosionParticle1)
{
dragCoefficient = 0.65;
gravityCoefficient = 0.3;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 150;
textureName = "particleTest";
colors[0] = "0.56 0.36 0.26 1.0";
colors[1] = "0.56 0.36 0.26 0.0";
sizes[0] = 0.0625;
sizes[1] = 0.2;
};
datablock ParticleEmitterData(LaserExplosionEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 0.75;
velocityVariance = 0.25;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 60;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "LaserExplosionParticle1";
};
datablock ExplosionData(LaserExplosion)
{
explosionShape = "energy_explosion.dts";
soundProfile = sniperExpSound;
particleEmitter = LaserExplosionEmitter;
particleDensity = 150;
particleRadius = 0.25;
faceViewer = false;
};
//--------------------------------------
// Projectile
//--------------------------------------
datablock SniperProjectileData(PulseLaserShot)
{
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
velInheritFactor = 1.0;
sound = LaserProjectileSound;
explosion = "LaserExplosion";
splash = LaserSplash;
directDamageType = $DamageType::PulseLaser;
maxRifleRange = 1000;
rifleHeadMultiplier = 1.3;
beamColor = "1 0.1 0.1";
fadeTime = 1.0;
startBeamWidth = 0.145;
endBeamWidth = 0.25;
pulseBeamWidth = 0.5;
beamFlareAngle = 3.0;
minFlareSize = 0.0;
maxFlareSize = 400.0;
pulseSpeed = 6.0;
pulseLength = 0.150;
lightRadius = 1.0;
lightColor = "0.3 0.0 0.0";
textureName[0] = "special/flare";
textureName[1] = "special/nonlingradient";
textureName[2] = "special/laserrip01";
textureName[3] = "special/laserrip02";
textureName[4] = "special/laserrip03";
textureName[5] = "special/laserrip04";
textureName[6] = "special/laserrip05";
textureName[7] = "special/laserrip06";
textureName[8] = "special/laserrip07";
textureName[9] = "special/laserrip08";
textureName[10] = "special/laserrip09";
textureName[11] = "special/sniper00";
};
//--------------------------------------
// Rifle and item...
//--------------------------------------
datablock ItemData(LaserRifle)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_sniper.dts";
image = SniperRifleImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a pulse laser rifle";
computeCRC = true;
};
datablock ShapeBaseImageData(LaserRifleImage)
{
className = WeaponImage;
shapeFile = "weapon_targeting.dts";
item = LaserRifle;
projectile = PulseLaserShot;
projectileType = SniperProjectile;
armThread = looksn;
usesEnergy = true;
minEnergy = 6;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateSound[0] = GenericSwitchSound;
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.5;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = LaserRifleFireSound;
stateName[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateName[5] = "CheckWet";
stateTransitionOnWet[5] = "DryFire";
stateTransitionOnNotWet[5] = "Fire";
stateName[6] = "NoAmmo";
stateTransitionOnAmmo[6] = "Reload";
stateTransitionOnTriggerDown[6] = "DryFire";
stateSequence[6] = "NoAmmo";
stateName[7] = "DryFire";
stateSound[7] = SniperRifleDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "Ready";
};

View file

@ -0,0 +1,576 @@
//--------------------------------------
// RPChaingun
//--------------------------------------
datablock ParticleData(GunFireEffectSmoke)
{
dragCoeffiecient = 0.4;
gravityCoefficient = -0.04; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 5000;
lifetimeVarianceMS = 500;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -40.0;
spinRandomMax = 40.0;
colors[0] = "0.4 0.4 0.4 0.18";
colors[1] = "0.5 0.5 0.5 0.14";
colors[2] = "0.5 0.5 0.5 0.07";
colors[3] = "0.6 0.6 0.6 0.0";
sizes[0] = 0.5;
sizes[1] = 0.75;
sizes[2] = 1.0;
sizes[3] = 1.25;
times[0] = 0.0;
times[1] = 0.333;
times[2] = 0.666;
times[3] = 1.0;
};
datablock ParticleEmitterData(GunFireEffectEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionOffset = 0.0;
ejectionVelocity = 3;
velocityVariance = 2;
thetaMin = 0.0;
thetaMax = 10.0;
lifetimeMS = 10;
particles = "GunFireEffectSmoke";
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(RPChaingunBullet)
{
doDynamicClientHits = true;
directDamage = 0.24;
directDamageType = $DamageType::MG;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
specialCollisionStreamline = true;
HeadMultiplier = 1.8;
LegsMultiplier = 0.75;
kickBackStrength = 100.0;
sound = ChaingunProjectile;
dryVelocity = 2000.0;
wetVelocity = 1750.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 10.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.09;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(RPChaingunAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some M32 ammo";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(RPChaingunImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = RPChaingun;
ammo = RPChaingunAmmo;
clip = MGClip;
projectile = RPChaingunBullet;
projectileType = TracerProjectile;
emap = true;
mass = 14;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
decayingSpread = 1;
usesClips = 1;
muzzleFlash = OutdoorTurretMuzzleFlash;
projectileSpread = 5 / 1000.0;
maxSpread = 0.5 / 1000.0;
spreadIncreaseRate = 1.5 / 1000;
clipTimeout = 2250;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "CheckWet";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
//
stateTimeoutValue[3] = 0.001;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateFire[4] = true;
stateAllowImageChange[4] = false;
stateSound[4] = ChaingunFireSound;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateEmitter[4] = "GunFireEffectEmitter";
stateEmitterNode[4] = "muzzlepoint1";
stateEmitterTime[4] = 0.5;
stateRecoil[4] = LightRecoil;
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 0.1;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSpinThread[6] = SpinDown;
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
stateName[8] = "WetFire";
stateSound[8] = ChaingunDryFireSound;
stateTimeoutValue[8] = 1.0;
stateTransitionOnTimeout[8] = "Ready";
stateName[9] = "CheckWet";
stateTransitionOnWet[9] = "WetFire";
stateTransitionOnNotWet[9] = "Spinup";
};
datablock ItemData(RPChaingun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_chaingun.dts";
image = RPChaingunImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "A M32 Fully Automatic Rifle";
computeCRC = true;
emap = true;
};
datablock ItemData(MGClip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "5.56mm clips";
computeCRC = true;
};
datablock ShapeBaseImageData(MGClipImage)
{
shapeFile = "grenade.dts";
ammo = RPChaingunAmmo;
offset = "0.0 0.2 -0.2";
emap = true;
};
function RPChaingunImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(MGClipImage, 6);
%obj.clipReloading = false;
if (%obj.inv[RPChaingunAmmo] == 0)
%this.CheckForClip(%obj, %slot);
}
function RPChaingunImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(6);
%obj.clipReloading = false;
}
function RPChaingunImage::MountClipEffects(%data, %obj, %slot)
{
%obj.mountImage(MGClipImage, 6);
}
function RPChaingunImage::UnmountClipEffects(%data, %obj, %slot)
{
%obj.unmountImage(6);
}
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(HRPChaingunImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = HRPChaingun;
ammo = RPChaingunAmmo;
clip = MGClip;
projectile = RPChaingunBullet;
projectileType = TracerProjectile;
emap = true;
mass = 20;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
decayingSpread = 1;
usesClips = 1;
muzzleFlash = OutdoorTurretMuzzleFlash;
projectileSpread = 1 / 1000.0; // z0dd - ZOD, 8/6/02. Was: 8.0 / 1000.0
maxSpread = 5 / 1000.0;
spreadIncreaseRate = 1.5 / 1000;
clipTimeout = 2250;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "CheckWet";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
//
stateTimeoutValue[3] = 0.001;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateFire[4] = true;
stateAllowImageChange[4] = false;
stateSound[4] = ChaingunFireSound;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateEmitter[4] = "GunFireEffectEmitter";
stateEmitterNode[4] = "muzzlepoint1";
stateEmitterTime[4] = 0.5;
stateRecoil[4] = LightRecoil;
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 0.1;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSpinThread[6] = SpinDown;
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
stateName[8] = "WetFire";
stateSound[8] = ChaingunDryFireSound;
stateTimeoutValue[8] = 1.0;
stateTransitionOnTimeout[8] = "Ready";
stateName[9] = "CheckWet";
stateTransitionOnWet[9] = "WetFire";
stateTransitionOnNotWet[9] = "Spinup";
};
datablock ItemData(HRPChaingun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_chaingun.dts";
image = HRPChaingunImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a M32 With a RPG Launcher";
computeCRC = true;
emap = true;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock GrenadeProjectileData(RPGshot)
{
projectileShapeName = "grenade.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 1.4;
damageRadius = 10.0;
radiusDamageType = $DamageType::RPG;
kickBackStrength = 3500;
explosion = "GrenadeExplosion";
underwaterExplosion = "GrenadeExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
baseEmitter = GrenadeSmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.0;
grenadeFriction = 0.0;
armingDelayMS = -1;
gravityMod = 1.3;
muzzleVelocity = 50.0;
drag = 0.2;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 4;
lightColor = "0.05 0.2 0.05";
hasLightUnderwaterColor = true;
underWaterLightColor = "0.05 0.075 0.2";
};
datablock ItemData(RPGAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "grenade.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some M32 RPG ammo";
computeCRC = true;
};
datablock ShapeBaseImageData(RPGLauncherImage)
{
className = WeaponImage;
shapeFile = "weapon_energy_vehicle.dts";
item = HRPChaingun;
ammo = RPGAmmo;
offset = "0.0 0.7 0.02"; // L/R - F/B - T/B
emap = true;
projectile = RPGshot;
projectileType = GrenadeProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 1.0;
stateSequence[0] = "Activate";
stateSound[0] = GrenadeSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = GrenadeFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4.0;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = GrenadeReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = GrenadeDryFireSound;
stateTimeoutValue[6] = 4.0;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock ItemData(RPGItem)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_energy_vehicle.dts";
image = RPGLauncherImage;
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "RPG Launcher";
computeCRC = true;
emap = true;
};
function HRPChaingunImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(RPGLauncherImage, 5);
%obj.mountImage(MGClipImage, 6);
%obj.clipReloading = false;
if (%obj.inv[RPChaingunAmmo] == 0)
%this.CheckForClip(%obj, %slot);
}
function HRPChaingunImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(5);
%obj.unmountImage(6);
%obj.clipReloading = false;
}
function HRPChaingunImage::MountClipEffects(%data, %obj, %slot)
{
%obj.mountImage(MGClipImage, 6);
}
function HRPChaingunImage::UnmountClipEffects(%data, %obj, %slot)
{
%obj.unmountImage(6);
}

263
Scripts/Weapons/RailGun.cs Normal file
View file

@ -0,0 +1,263 @@
//--------------------------------------
// ACCM Gauss Cannon - Made by: Blnukem
//--------------------------------------
//--------------------------------------
// RailGun Sounds
//--------------------------------------
datablock EffectProfile(RailGunFireEffect)
{
filename = "fx/misc/launcher.wav";
minDistance = 2.5;
maxDistance = 10.0;
};
datablock EffectProfile(RailGunLoadEffect)
{
filename = "fx/misc/cannonstart.wav";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(RailGunFireSound)
{
filename = "fx/misc/launcher.wav";
description = AudioDefault3d;
preload = true;
effect = RailGunFireEffect;
};
datablock AudioProfile(RailGunLoadSound)
{
filename = "fx/misc/cannonstart.wav";
description = AudioDefault3d;
preload = true;
effect = RailGunLoadEffect;
};
//--------------------------------------
// RailGun Projectile
//--------------------------------------
datablock TracerProjectileData(RailGunProjectile)
{
doDynamicClientHits = true;
directDamage = 10.0 * 10;
directDamageType = $DamageType::Laser;
explosion = MissileExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 5.0;
damageradius = 8;
radiusDamageType = $DamageType::Laser;
kickBackStrength = 1000;
sound = ChaingunProjectile;
dryVelocity = 1500.0;
wetVelocity = 500.0;
velInheritFactor = 1.0;
fizzleTimeMS = 2000;
lifetimeMS = 2000;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 1000;
tracerLength = 40.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.5;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = RailGunDecal;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
//--------------------------------------
// RailGun Ammo
//--------------------------------------
datablock ItemData(RailGunAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_missile.dts";
mass = 3;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a pair of 250mm Gauss shells";
computeCRC = true;
};
//--------------------------------------
// RailGun Data
//--------------------------------------
datablock ShapeBaseImageData(RailGunImage)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
rotation = "0 1 0 180";
offset = "0.1 0.0 0.18";
item = RailGun;
ammo = RailGunAmmo;
projectile = RailGunProjectile;
projectileType = TracerProjectile;
emap = true;
minRankPoints = 4800;
//--------------------------------------
stateName[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateAllowImageChange[0] = false;
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = RailGunLoadSound;
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateFire[4] = true;
stateScript[4] = "onFire";
stateSound[4] = RailGunFireSound;
stateRecoil[4] = LightRecoil;
stateEmitter[4] = "GunFireEffectEmitter";
stateEmitterNode[4] = "muzzlepoint1";
stateEmitterTime[4] = 0.8;
stateTimeoutValue[4] = 1.0;
stateTransitionOnTimeout[4] = "Reload";
stateAllowImageChange[4] = false;
//--------------------------------------
stateName[5] = "Reload";
stateTransitionOnNoAmmo[5] = "NoAmmo";
stateTransitionOnTimeout[5] = "Ready";
stateTimeoutValue[5] = 1.0;
stateAllowImageChange[5] = false;
stateSound[5] = MissileReloadSound;
//--------------------------------------
stateName[6] = "Spindown";
stateScript[6] = "onSpindown";
stateSound[6] = MissileReloadSound;
stateSpinThread[6] = SpinDown;
stateTimeoutValue[6] = 3.0;
stateWaitForTimeout[6] = true;
stateTransitionOnTimeout[6] = "Ready";
stateTransitionOnTriggerDown[6] = "Spinup";
stateEmitter[6] = "GunFireEffectEmitter";
stateEmitterNode[6] = "muzzlepoint1";
stateEmitterTime[6] = 0.5;
//--------------------------------------
stateName[7] = "EmptySpindown";
stateSound[7] = MissileDryFireSound;
stateSpinThread[7] = SpinDown;
stateScript[7] = "onSpindown";
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
stateEmitter[7] = "GunFireEffectEmitter";
stateEmitterNode[7] = "muzzlepoint1";
stateEmitterTime[7] = 0.5;
//--------------------------------------
stateName[8] = "DryFire";
stateSound[8] = MortarDryFireSound;
stateTimeoutValue[8] = 0.5;
stateTransitionOnTimeout[8] = "NoAmmo";
};
//--------------------------------------
// RailGun Attachments
//--------------------------------------
datablock ShapeBaseImageData(RailGunPrimaryImage) : RailGunImage
{
offset = "0.01 0.04 0.0";
rotation = "0 0 1 180";
shapeFile = "weapon_missile.dts";
};
datablock ShapeBaseImageData(RailGunSecondaryImage) : RailGunImage
{
offset = "-0.06 -0.23 0.25";
rotation = "0 0 1 90";
shapeFile = "ammo_mortar.dts";
};
datablock ShapeBaseImageData(RailGunTertiaryImage) : RailGunImage
{
offset = "0.08 0.45 0.05";
rotation = "0 1 0 0";
shapeFile = "weapon_ELF.dts";
};
//--------------------------------------
// RailGun Item Data
//--------------------------------------
datablock ItemData(RailGun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_missile.dts";
image = RailGunImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Heavy Gauss Cannon";
emap = true;
};
//--------------------------------------
// RailGun Functions
//--------------------------------------
function RailGunImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(RailGunPrimaryImage, 4);
%obj.mountImage(RailGunSecondaryImage, 5);
%obj.mountImage(RailGunTertiaryImage, 6);
}
function RailGunImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(4);
%obj.unmountImage(5);
%obj.unmountImage(6);
}

View file

@ -0,0 +1,385 @@
//--------------------------------------
// AA rocket launcher
//--------------------------------------
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock SeekerProjectileData(AAMissile)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 1.0;
damageRadius = 10.0;
radiusDamageType = $DamageType::Missile;
kickBackStrength = 2000;
explosion = "MissileExplosion";
splash = MissileSplash;
velInheritFactor = 1.0; // to compensate for slow starting velocity, this value
// is cranked up to full so the missile doesn't start
// out behind the player when the player is moving
// very quickly - bramage
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
bubbleEmitTime = 1.0;
exhaustEmitter = MissileLauncherExhaustEmitter;
exhaustTimeMs = 300;
exhaustNodeName = "muzzlePoint1";
lifetimeMS = 15000; // z0dd - ZOD, 4/14/02. Was 6000
muzzleVelocity = 10.0;
maxVelocity = 225.0; // z0dd - ZOD, 4/14/02. Was 80.0
turningSpeed = 45.0;
acceleration = 150.0;
proximityRadius = 3;
terrainAvoidanceSpeed = 50;
terrainScanAhead = 50;
terrainHeightFail = 5;
terrainAvoidanceRadius = 1;
flareDistance = 200;
flareAngle = 30;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.2 0.05 0";
useFlechette = true;
flechetteDelayMs = 550;
casingDeb = FlechetteDebris;
explodeOnWaterImpact = false;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(AALauncherAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_missile.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some AA rockets";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(AALauncher)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_missile.dts";
image = AALauncherImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "an AA rocket Launcher";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(AALauncherImage)
{
className = WeaponImage;
shapeFile = "weapon_missile.dts";
item = AALauncher;
ammo = AALauncherAmmo;
offset = "0 0 0";
armThread = lookms;
emap = true;
mass = 30;
projectile = AAMissile;
projectileType = SeekerProjectile;
isSeeker = true;
seekRadius = 400;
maxSeekAngle = 20;
seekTime = 0.5;
minSeekHeat = 0.6; // the heat that must be present on a target to lock it. // z0dd - ZOD, 8/22/02. Was 0.7
// only target objects outside this range
minTargetingDistance = 40;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = MissileSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.4;
stateFire[3] = true;
stateRecoil[3] = mediumRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = MissileFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4.0;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "ActivateReady";
stateName[7] = "CheckTarget";
stateTransitionOnNoTarget[7] = "DryFire";
stateTransitionOnTarget[7] = "Fire";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "CheckTarget";
stateName[9] = "WetFire";
stateTransitionOnNoAmmo[9] = "NoAmmo";
stateTransitionOnTimeout[9] = "Reload";
stateTimeoutValue[9] = 0.4;
stateScript[9] = "onWetFire";
stateAllowImageChange[9] = false;
};
function AALauncherImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
if (%obj.getControllingClient())
%target = %obj.getLockedTarget();
else
%target = %obj.getTargetObject();
%homein = missileCheckAirTarget(%target);
if(%target && %homein)
%p.setObjectTarget(%target);
else if(%obj.isLocked())
%p.setPositionTarget(%obj.getLockedPosition());
else
%p.setNoTarget();
}
//--------------------------------------
// AT4 Missile launcher
//--------------------------------------
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock SeekerProjectileData(LShoulderMissile)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 0.8;
damageRadius = 8.0;
radiusDamageType = $DamageType::AT4;
kickBackStrength = 3500;
explosion = "MissileExplosion";
splash = MissileSplash;
velInheritFactor = 1.0; // to compensate for slow starting velocity, this value
// is cranked up to full so the missile doesn't start
// out behind the player when the player is moving
// very quickly - bramage
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
bubbleEmitTime = 1.0;
exhaustEmitter = MissileLauncherExhaustEmitter;
exhaustTimeMs = 300;
exhaustNodeName = "muzzlePoint1";
lifetimeMS = 3500; // z0dd - ZOD, 4/14/02. Was 6000
muzzleVelocity = 200.0;
maxVelocity = 350.0; // z0dd - ZOD, 4/14/02. Was 80.0
turningSpeed = 54.0;
acceleration = 50.0;
proximityRadius = 3;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 3.0;
lightColor = "0.2 0.05 0";
useFlechette = true;
flechetteDelayMs = 10;
casingDeb = FlechetteDebris;
explodeOnWaterImpact = true;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(LMissileLauncherAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_missile.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "an AT6 missile";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(LMissileLauncher)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_grenade_launcher.dts";
image = LMissileLauncherImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "an AT6";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(LMissileLauncherImage)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
item = LMissileLauncher;
ammo = LMissileLauncherAmmo;
offset = "0 -1 0";
armThread = lookms;
emap = true;
projectile = LShoulderMissile;
projectileType = seekerprojectile;
projectileSpread = 1.0 / 2000.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 2.0;
stateSequence[0] = "Activate";
stateSound[0] = MissileSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.4;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = MissileFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "ActivateReady";
stateName[7] = "CheckTarget";
stateTransitionOnNoTarget[7] = "Fire";
stateTransitionOnTarget[7] = "Fire";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "DryFire";
stateTransitionOnNotWet[8] = "CheckTarget";
stateName[9] = "WetFire";
stateTransitionOnNoAmmo[9] = "NoAmmo";
stateTransitionOnTimeout[9] = "Reload";
stateTimeoutValue[9] = 0.4;
stateScript[9] = "onWetFire";
stateAllowImageChange[9] = false;
};
function LMissileLauncherImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%p.AT4lockon = schedule(875, 0, "AT4LockOnToTarget", %p);
}
function AT4LockOnToTarget(%p)
{
if(!isObject(%p))
return;
InitContainerRadiusSearch(%p.getPosition(), 100, $TypeMasks::VehicleObjectType);
%searchResult = containersearchnext();
if(%searchResult)
{
%SearchObj = FirstWord(%SearchResult);
%p.setObjectTarget(%searchObj);
}
}

488
Scripts/Weapons/Shotgun.cs Normal file
View file

@ -0,0 +1,488 @@
//--------------------------------------
// Shotgun
//--------------------------------------
datablock EffectProfile(ShotGunFireEffect)
{
filename = "powered/turret_mortar_fire";
minDistance = 2.5;
maxDistance = 10.0;
};
datablock AudioProfile(ShotGunFireSound)
{
filename = "fx/powered/turret_mortar_fire.wav";
description = AudioDefault3d;
preload = true;
effect = ShotGunFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(ShotgunPellet)
{
doDynamicClientHits = true;
directDamage = 0.075;
directDamageType = $DamageType::Shotgun;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
specialCollisionStreamline = true;
HeadMultiplier = 2.0;
LegsMultiplier = 0.75;
longRangeMultiplier = 0.75;
kickBackStrength = 0.0;
sound = ChaingunProjectile;
dryVelocity = 1500.0;
wetVelocity = 1000.0;
velInheritFactor = 0.0;
fizzleTimeMS = 1000;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 5.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.09;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(ShotgunAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some Shotgun rounds";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(ShotgunImage)
{
className = WeaponImage;
shapeFile = "weapon_plasma.dts";
item = Shotgun;
ammo = ShotgunAmmo;
projectile = ShotgunPellet;
projectileType = TracerProjectile;
emap = true;
mass = 20;
casing = ShellDebris;
shellExitDir = "0.5 0.0 1.0"; // L/R - F/B - T/B
shellExitOffset = "0.15 -0.51 -0.1"; // L/R - F/B - T/B
shellExitVariance = 10.0;
shellVelocity = 4.0;
projectileSpread = 11.0 / 1000.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.0001;
stateFire[3] = true;
stateEjectShell[3] = true;
stateEmitter[3] = "GunFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 1;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = ShotGunFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ChaingunDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "WetFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "Ready";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "Fire";
};
datablock ItemData(Shotgun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_plasma.dts";
image = ShotgunImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Shotgun";
computeCRC = true;
emap = true;
};
datablock ItemData(ShotgunClip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "Shotgun Magazines";
computeCRC = true;
};
function ShotgunImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
if (%obj.inv[ShotgunAmmo] == 0)
%obj.SGcheckclip = schedule(10, 0, "SGCheckforclip", %obj);
}
// Eolk - add this function to prevent people from switching to another weapon and shooting while reloading a clip.
function ShotgunImage::onUnmount(%this, %obj, %slot)
{
if (%obj.clipReloading != false)
{
Cancel(%obj.SGClipAdd);
%obj.clipReloading = false;
}
}
function ShotgunImage::onFire(%data,%obj,%slot)
{
%obj.applyKick(-250);
%obj.decInventory(%data.ammo,1);
%vector = %obj.getMuzzleVector(%slot);
%mp = %obj.getMuzzlePoint(%slot);
for (%i=0; %i < 12; %i++)
{
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vector);
%p = new (%data.projectileType)()
{
dataBlock = %data.projectile;
initialDirection = %newvector;
initialPosition = %mp;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
}
if (%obj.inv[ShotgunAmmo] == 0)
%obj.SGcheckclip = schedule(10, 0, "SGCheckforclip", %obj);
}
function SGCheckforclip(%obj)
{
if (%obj.inv[Shotgunclip] > 0)
{
%obj.unmountImage(0);
%obj.decInventory(ShotgunClip, 1);
%obj.SGClipAdd = schedule(2500, 0, "SGReloadClip", %obj);
}
}
function SGReloadClip(%obj)
{
%obj.setInventory(ShotgunAmmo, 8);
%obj.mountImage(ShotgunImage, 0);
}
//--------------------------------------
// RotaryShotgun
//--------------------------------------
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(RShotgunAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some Rotary Shotgun rounds";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(RShotgunImage)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
item = RShotgun;
ammo = RShotgunAmmo;
projectile = ShotgunPellet;
projectileType = TracerProjectile;
emap = true;
mass = 20;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
projectileSpread = 9.0 / 1000.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.0001;
stateFire[3] = true;
stateEjectShell[3] = true;
stateEmitter[3] = "GunFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 1;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = ShotGunFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.25;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ChaingunDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "WetFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "Ready";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "Fire";
};
datablock ItemData(RShotgun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_grenade_launcher.dts";
image = RShotgunImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a RotaryShotgun";
computeCRC = true;
emap = true;
};
datablock ItemData(RShotgunClip)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "Rotary Shotgun Magazines";
computeCRC = true;
};
datablock ShapeBaseImageData(RSGImage1)
{
className = WeaponImage;
ammo = RShotgunAmmo;
shapeFile = "weapon_grenade_launcher.dts";
rotation = "0 1 0 120";
};
datablock ShapeBaseImageData(RSGImage2)
{
className = WeaponImage;
ammo = RShotgunAmmo;
shapeFile = "weapon_grenade_launcher.dts";
rotation = "0 1 0 -120";
};
datablock ShapeBaseImageData(RSGImageclip)
{
className = WeaponImage;
ammo = RShotgunAmmo;
shapeFile = "ammo_chaingun.dts";
rotation = "0 1 0 180";
offset = "0.0 0.45 -0.1"; // L/R - F/B - T/B
item = RShotgun;
};
function RShotgunImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(RSGImageclip, 4);
%obj.mountImage(RSGImage1, 5);
%obj.mountImage(RSGImage2, 6);
%obj.clipReloading = false;
if (%obj.inv[RShotgunAmmo] == 0)
%obj.RSGcheckclip = schedule(10, 0, "RSGCheckforclip", %obj);
}
function RShotgunImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(4);
%obj.unmountImage(5);
%obj.unmountImage(6);
if (%obj.clipReloading != false)
{
Cancel(%obj.RSGClipAdd);
%obj.clipReloading = false;
}
}
function RShotgunImage::onFire(%data,%obj,%slot)
{
%obj.applyKick(-250);
%obj.decInventory(%data.ammo,1);
%vector = %obj.getMuzzleVector(%slot);
%mp = %obj.getMuzzlePoint(%slot);
for (%i=0; %i < 8; %i++)
{
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vector);
%p = new (%data.projectileType)()
{
dataBlock = %data.projectile;
initialDirection = %newvector;
initialPosition = %mp;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
}
if (%obj.inv[RShotgunAmmo] == 0)
%obj.RSGcheckclip = schedule(10, 0, "RSGCheckforclip", %obj);
}
function RSGCheckforclip(%obj)
{
if (%obj.inv[RShotgunclip] > 0)
{
%obj.unmountImage(4);
%obj.clipReloading = true;
%obj.RSGClipAdd = schedule(3000, 0, "RSGReloadClip", %obj);
}
}
function RSGReloadClip(%obj)
{
%obj.clipReloading = false;
%obj.decInventory(RShotgunClip, 1);
%obj.mountImage(RSGImageclip, 4);
%obj.setInventory(RShotgunAmmo, 25);
}

View file

@ -0,0 +1,301 @@
//--------------------------------------------------------------------------
// Smoke Grenade
//--------------------------------------------------------------------------
datablock ParticleData(SmokeGrenadeSmoke)
{
dragCoeffiecient = 0.1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
constantAcceleration = -0.0;
lifetimeMS = 3000;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -100.0;
spinRandomMax = 100.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.3 0.3 0.3 1.0";
colors[1] = "0.3 0.3 0.3 0.5";
colors[2] = "0.3 0.3 0.3 0.0";
sizes[0] = 0.75;
sizes[1] = 6.0;
sizes[2] = 10.0;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(SmokeGrenadeSmokeEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 2.5;
velocityVariance = 2.5;
ejectionOffset = 3.5;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "SmokeGrenadeSmoke";
};
datablock ExplosionData(smokegrenadeExplosion)
{
emitter[0] = SmokeGrenadeSmokeEmitter;
shakeCamera = false;
};
//--------------------------------------------------------------------------
// Projectile - Smoke Grenade
//--------------------------------------
datablock GrenadeProjectileData(SmokeGrenadeProj)
{
projectileShapeName = "grenade.dts";
directDamage = 0.0;
directDamageType = $DamageType::RPG;
hasDamageRadius = false;
explosion = "smokegrenadeExplosion";
underwaterExplosion = "smokegrenadeExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
emitterDelay = 3000;
baseEmitter = SmokeGrenadeSmokeEmitter;
bubbleEmitter = SmokeGrenadeSmokeEmitter;
grenadeElasticity = 0.3;
grenadeFriction = 1.0;
armingDelayMS = 21000;
gravityMod = 1.0;
muzzleVelocity = 25.0;
drag = 0.0;
sound = MissileProjectileSound;
hasLight = false;
hasLightUnderwaterColor = false;
};
datablock ItemData(SmokeGrenadeThrown)
{
className = Weapon;
shapeFile = "grenade.dts";
mass = 0.4;
elasticity = 0.3;
friction = 1;
pickupRadius = 2;
maxDamage = 0.5;
explosion = smokegrenadeExplosion;
underwaterExplosion = smokegrenadeExplosion;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Grenade;
kickBackStrength = 0;
baseEmitter = SmokeGrenadeSmokeEmitter;
computeCRC = true;
};
datablock ItemData(SmokeGrenade)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "grenade.dts";
mass = 1;
elasticity = 0.5;
friction = 1;
pickupRadius = 2;
thrownItem = SmokeGrenadeThrown;
pickUpName = "some smoke grenades";
isGrenade = true;
computeCRC = true;
};
function SmokeGrenade::onUse(%this, %obj)
{
if(Game.handInvOnUse(%data, %obj))
{
%obj.decInventory(%this, 1);
%p = new GrenadeProjectile() {
dataBlock = SmokeGrenadeProj;
initialDirection = %obj.getEyeVector();
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
MissionCleanup.add(%p);
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%p.schedule(20000, "delete");
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
function SmokeGrenade::onCollision( %data, %obj, %col )
{
// Do nothing...
}
//--------------------------------------------------------------------------
// Beacon Smoke Grenade
//--------------------------------------------------------------------------
datablock ParticleData(BeaconSmokeGrenadeSmoke)
{
dragCoeffiecient = 0.1;
gravityCoefficient = -0.6;
inheritedVelFactor = 0.4;
constantAcceleration = -0.0;
lifetimeMS = 5000;
lifetimeVarianceMS = 250;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -150.0;
spinRandomMax = 150.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.5 0.5 0.5 1.0";
colors[1] = "0.6 0.2 0.2 0.75";
colors[2] = "0.4 0.1 0.1 0.0";
sizes[0] = 1.0;
sizes[1] = 3.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(BeaconSmokeGrenadeSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 0.5;
thetaMin = 0.0;
thetaMax = 180.0;
particles = "BeaconSmokeGrenadeSmoke";
};
//--------------------------------------------------------------------------
// Projectile - Smoke Grenade
//--------------------------------------
datablock GrenadeProjectileData(BeaconSmokeGrenadeProj)
{
projectileShapeName = "grenade.dts";
directDamage = 0.0;
directDamageType = $DamageType::RPG;
hasDamageRadius = false;
explosion = "smokegrenadeExplosion";
underwaterExplosion = "smokegrenadeExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
emitterDelay = 3000;
baseEmitter = BeaconSmokeGrenadeSmokeEmitter;
bubbleEmitter = BeaconSmokeGrenadeSmokeEmitter;
grenadeElasticity = 0.3;
grenadeFriction = 1.0;
armingDelayMS = 61000;
gravityMod = 1.0;
muzzleVelocity = 25.0;
drag = 0.0;
sound = MissileProjectileSound;
hasLight = false;
hasLightUnderwaterColor = false;
};
datablock ItemData(BeaconSmokeGrenadeThrown)
{
className = Weapon;
shapeFile = "grenade.dts";
mass = 0.4;
elasticity = 0.3;
friction = 1;
pickupRadius = 2;
maxDamage = 0.5;
explosion = smokegrenadeExplosion;
underwaterExplosion = smokegrenadeExplosion;
indirectDamage = 0.0;
damageRadius = 0.0;
radiusDamageType = $DamageType::Grenade;
kickBackStrength = 0;
computeCRC = true;
};
datablock ItemData(BeaconSmokeGrenade)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "grenade.dts";
mass = 1;
elasticity = 0.5;
friction = 1;
pickupRadius = 2;
thrownItem = BeaconSmokeGrenadeThrown;
pickUpName = "some beacon grenades";
isGrenade = true;
computeCRC = true;
};
function BeaconSmokeGrenade::onUse(%this, %obj)
{
if(Game.handInvOnUse(%data, %obj))
{
%obj.decInventory(%this, 1);
%p = new GrenadeProjectile() {
dataBlock = BeaconSmokeGrenadeProj;
initialDirection = %obj.getEyeVector();
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
MissionCleanup.add(%p);
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%p.schedule(60000, "delete");
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
function BeaconSmokeGrenade::onCollision( %data, %obj, %col )
{
// Do nothing...
}

View file

@ -0,0 +1,483 @@
////////////////////////////////////
// AVAILABLE TEXTURES
$TextureToolLabel[1] = "Pads";
$TextureTool[1, 1] = "DeployedSpine (LSB) Light Support Beam";
$TextureTool[1, 2] = "DeployedMSpine (MSB) Medium Support Beam";
$TextureTool[1, 3] = "DeployedWWall Walk Way";
$TextureTool[1, 4] = "DeployedWall (Bwall) Shady Light Support Beam";
$TextureTool[1, 5] = "DeployedSpine2 Dark Pad";
$TextureTool[1, 6] = "DeployedDecoration16 Blue Pad";
$TextureToolLabel[2] = "Crates";
$TextureTool[2, 1] = "DeployedCrate0 (crate1) Back Pack";
$TextureTool[2, 2] = "DeployedCrate1 (crate2) small containment";
$TextureTool[2, 3] = "DeployedCrate2 (crate3) large containment";
$TextureTool[2, 4] = "DeployedCrate3 (crate4) compressor";
$TextureTool[2, 5] = "DeployedCrate4 (crate5) tubes";
$TextureTool[2, 6] = "DeployedCrate5 (crate6) quantum battery";
$TextureTool[2, 7] = "DeployedCrate6 (crate7) proton accelerator";
$TextureTool[2, 8] = "DeployedCrate7 (crate8) cargo crate";
$TextureTool[2, 9] = "DeployedCrate8 (crate9) magnetic cooler";
$TextureTool[2, 10] = "DeployedCrate9 (crate10) recycle unit";
$TextureTool[2, 11] = "DeployedCrate10 (crate11) fuel cannister";
$TextureTool[2, 12] = "DeployedCrate12 (crate12) plasma router";
$TextureToolLabel[3] = "Decorations";
$TextureTool[3, 1] = "DeployedDecoration6 (deco1) Statue Base";
$TextureToolLabel[4] = "Forcefields"; // Don't remove the "Dummy"s.
$TextureTool[4, 1] = "Dummy White, No Pass";
$TextureTool[4, 2] = "Dummy Red, No Pass";
$TextureTool[4, 3] = "Dummy Green, No Pass";
$TextureTool[4, 4] = "Dummy Blue, No Pass";
$TextureTool[4, 5] = "Dummy Cyan, No Pass";
$TextureTool[4, 6] = "Dummy Magenta, No Pass";
$TextureTool[4, 7] = "Dummy Yellow, No Pass";
$TextureTool[4, 8] = "Dummy White, Team Pass";
$TextureTool[4, 9] = "Dummy Red, Team Pass";
$TextureTool[4, 10] = "Dummy Green, Team Pass";
$TextureTool[4, 11] = "Dummy Blue, Team Pass";
$TextureTool[4, 12] = "Dummy Cyan, Team Pass";
$TextureTool[4, 13] = "Dummy Magenta, Team Pass";
$TextureTool[4, 14] = "Dummy Yellow, Team Pass";
$TextureTool[4, 15] = "Dummy White, All Pass";
$TextureTool[4, 16] = "Dummy Red, All Pass";
$TextureTool[4, 17] = "Dummy Green, All Pass";
$TextureTool[4, 18] = "Dummy Blue, All Pass";
$TextureTool[4, 19] = "Dummy Cyan, All Pass";
$TextureTool[4, 20] = "Dummy Magenta, All Pass";
$TextureTool[4, 21] = "Dummy Yellow, All Pass";
$TextureTool[4, 22] = "Dummy Lightning, Solid";
$TextureTool[4, 23] = "Dummy Scan Line, Solid";
$TextureTool[4, 24] = "Dummy Grid, Solid";
$TextureTool[4, 25] = "Dummy Fire Wall, Solid";
$TextureTool[4, 26] = "Dummy Energy Field, Solid";
$TextureTool[4, 27] = "Dummy Flashing, Solid";
$TextureTool[4, 28] = "Dummy Dirty Window, Solid";
$TextureTool[4, 29] = "Dummy Scan Line, Team Pass";
$TextureTool[4, 30] = "Dummy Grid, Team Pass";
$TextureTool[4, 31] = "Dummy Energy Field, Team Pass";
$TextureTool[4, 32] = "Dummy Flashing, Team Pass";
$TextureTool[4, 33] = "Dummy Scan Line, All Pass";
$TextureTool[4, 34] = "Dummy Grid, All Pass";
$TextureTool[4, 35] = "Dummy Energy Field, All Pass";
$TextureTool[4, 36] = "Dummy Flashing, All Pass";
$TextureTool[4, 37] = "Dummy Fire Wall, All Pass";
$TextureTool[4, 38] = "Dummy Lava, All Pass";
$TextureTool[4, 39] = "Dummy Water, All Pass";
$TextureTool[4, 40] = "Dummy Flashing Crossairs, Special";
$TextureTool[4, 41] = "Dummy Glass Tile, Special";
$TextureTool[4, 42] = "Dummy Vehicle Icons, Special";
$TextureTool[4, 43] = "Dummy Space 1, Special";
$TextureTool[4, 44] = "Dummy Clouds 1, Special";
$TextureTool[4, 45] = "Dummy Fuzzy Scanlines, Special";
$TextureTool[4, 46] = "Dummy Space 2, Special";
$TextureTool[4, 47] = "Dummy Signs, Special";
$TextureTool[4, 48] = "Dummy Clouds 2, Special";
$TextureTool[4, 49] = "Dummy Computer Screen, Special";
$TextureTool[4, 50] = "Dummy Console, Special";
$TextureTool[4, 51] = "Dummy Standard Force Field, Special";
$TextureToolLabel[5] = "Turn Pad into Door";
$TextureTool[5, 1] = "Regular Pad (not door)";
$TextureTool[5, 2] = "Normal Door";
$TextureTool[5, 3] = "Toggle Door";
$TextureTool[5, 4] = "Power Change Toggle Door (Open When Powered)";
$TextureTool[5, 5] = "Power Change Toggle Door (Closed When Powered)";
$TextureTool[5, 6] = "Collision Door (All Access)";
$TextureTool[5, 7] = "Collision Door (Permission Access)";
$TextureTool[5, 8] = "Collision Door (Owner-only Access)";
$TextureTool[5, 9] = "Collision Door (Admin-only Access)";
////////////////////////////////////
// WEAPON
datablock ItemData(TextureTool)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_targeting.dts";
image = TextureToolImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a texturing tool";
computeCRC = true;
};
datablock ShapeBaseImageData(TextureToolImage)
{
className = WeaponImage;
shapeFile = "weapon_targeting.dts";
item = TextureTool;
usesEnergy = true;
minEnergy = 0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateSound[0] = BasicSwitchSound;
stateTimeoutValue[0] = 0.1;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.2;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = MergeToolFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.1;
stateAllowImageChange[4] = false;
stateName[5] = "CheckWet";
stateTransitionOnWet[5] = "Fire";
stateTransitionOnNotWet[5] = "Fire";
stateName[6] = "NoAmmo";
stateTransitionOnAmmo[6] = "Reload";
stateTransitionOnTriggerDown[6] = "DryFire";
stateSequence[6] = "NoAmmo";
stateName[7] = "DryFire";
stateTimeoutValue[7] = 0.1;
stateTransitionOnTimeout[7] = "Ready";
};
////////////////////////////////////
// SUPPORTING FUNCTIONS
function TextureToolImage::onFire(%data,%obj,%slot)
{
%pos = %obj.getMuzzlePoint($WeaponSlot);
%vec = %obj.getMuzzleVector($WeaponSlot);
%targetpos = VectorAdd(%pos, VectorScale(%vec, 200));
%piece = containerRaycast(%pos, %targetpos, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType, %obj);
%piece = getWord(%piece, 0);
if(!isObject(%piece))
return;
// Order reversed to eliminate console spam.
if(!isObject(Deployables) || !Deployables.isMember(%piece))
{
messageClient(%obj.client, "", "\c2TT: That piece is a part of the map and cannot be modified.");
return;
}
if(%piece.getOwner() != %obj.client && !%obj.client.isAdmin)
{
messageClient(%obj.client, "", "\c2TT: You do not own that!");
return;
}
if(%obj.TTMode == 4)
RetextureForcefield(%obj, %piece, %obj.TTSubMode - 1);
else if(%obj.TTMode == 5)
RetextureDoor(%obj, %piece, %obj.TTSubMode);
else
RetexturePad(%obj, %piece, getWord($TextureTool[%obj.TTMode, %obj.TTSubMode], 0));
}
function TextureToolImage::onMount(%data, %obj, %slot)
{
parent::onMount(%data, %obj, %slot);
if(%obj.TTMode $= "")
%obj.TTMode = 1;
if(%obj.TTSubMode $= "")
%obj.TTSubMode = 1;
TTMessage(%obj.client);
%obj.usingTextureTool = 1;
}
function TextureToolImage::onUnmount(%data, %obj, %slot)
{
parent::onUnmount(%data, %obj, %slot);
%obj.usingTextureTool = 0;
}
function TTMessage(%client)
{
if(!isObject(%client))
return;
if(%client.player.TTMode == 5)
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Texture Tool<<<<spop>\n<spush><font:Arial:14>Texture tool mode set to "@$TextureToolLabel[%client.player.TTMode]@"\nCurrent door swap set to "@$TextureTool[%client.player.TTMode, %client.player.TTSubMode]@".<spop>", 5, 3);
else
Bottomprint(%client, "<spush><font:Sui Generis:14>>>>Texture Tool<<<<spop>\n<spush><font:Arial:14>Texture category set to "@$TextureToolLabel[%client.player.TTMode]@"\nCurrent texture set to "@getWords($TextureTool[%client.player.TTMode, %client.player.TTSubMode], 1, 10)@".<spop>", 5, 3);
}
function RetextureForcefield(%player, %piece, %ff)
{
if(%piece.getDatablock().className !$= "forcefield")
{
messageClient(%player.client, "", "\c2TT: Wrong type of object.");
return;
}
%new = new ForceFieldBare() {
datablock = "DeployedForceField"@%ff;
scale = %piece.getScale();
};
%new.setTransform(%piece.getTransform());
// Each time a forcefield is added, the game automatically adds a new physical zone.
// We want to make our own, so we'll delete theirs.
if(isObject(%new.pzone))
%new.pzone.delete();
// Set up all of the statistics and junk -----------------------
// Can't forget this...
if(%piece.noSlow)
%new.noSlow = true;
%new.grounded = %piece.grounded;
%new.needsFit = %piece.needsFit;
%new.team = %piece.team;
%new.setOwner(%piece.getOwner().player);
%new.powerFreq = %piece.powerFreq;
if (%new.getTarget() != -1)
setTargetSensorGroup(%new.getTarget(), %piece.team);
addToDeployGroup(%new);
AIDeployObject(%new.getOwner(), %new);
// Don't increment the team count.
checkPowerObject(%new);
// Now we delete the old piece.
if(isObject(%piece.pzone))
%piece.pzone.delete();
%piece.delete();
}
function RetexturePad(%player, %piece, %datablock)
{
%classname = %piece.getDatablock().className;
if((%classname $= "decoration" && (%piece.getDataBlock().getname() $= "DeployedDecoration6" || %piece.getDataBlock().getname() $= "DeployedDecoration16")) || %classname $= "crate" || %classname $= "floor" || %classname $= "spine" || %classname $= "mspine" || %classname $= "wall" || %classname $= "wwall" || %classname $= "Wspine" || %classname $= "Sspine" || %classname $= "floor" || %classname $= "door")
{
// %datablock = getword($EditorTool[5, %player.ETSubMode], 0);
if(%piece.isdoor || %piece.getDatablock().getName() $= "Deployeddoor")
{
if(%piece.canMove == false)
{
messageClient(%player.client, "", "\c2You can only retexture moveable doors.");
return;
}
if(%piece.state !$= "closed" && %piece.state !$= "")
{
messageClient(%player.client, "", "\c2You can only retexture fully closed doors.");
return;
}
}
%new = new StaticShape() {
datablock = %datablock;
};
%new.setRealSize(%piece.getRealSize());
%new.setTransform(%piece.getTransform());
// Eolk - no dsurface.
%new.grounded = %piece.grounded;
%new.needsFit = %piece.needsFit;
%new.team = %piece.team;
%new.setOwner(%piece.getOwner().player);
%new.powerFreq = %piece.powerFreq;
%new.originalPos = %piece.originalPos;
if (%new.getTarget() != -1)
setTargetSensorGroup(%new.getTarget(), %piece.team);
addToDeployGroup(%new);
AIDeployObject(%piece.getOwner(), %new);
// TODO: Make incrementing/decrementing possible for teamdeploycounts.
%new.deploy();
checkPowerObject(%new);
if(%piece.isDoor || %piece.getDatablock().getName() $= "DeployedDoor")
{
%new.closedScale = %piece.getScale();
%new.openedScale = getword(%piece.getScale(), 0) SPC getword(%piece.getScale(), 1) SPC 0.1;
%new.isDoor = 1;
%new.state = %piece.state;
%new.canMove = %piece.canMove;
%new.moving = %piece.moving;
%new.toggleType = %piece.toggleType;
%new.powerControl = %piece.powerControl;
%new.toggleType = %piece.toggleType;
%new.collisionType = %piece.collisionType;
%new.accessLevel = %piece.accessLevel;
%new.timeout = %piece.timeout;
}
%piece.delete();
}
else
messageClient(%player.client, "", "\c2TT: Wrong type of object.");
}
function RetextureDoor(%player, %piece, %mode)
{
%classname = %piece.getDatablock().className;
if((%classname $= "decoration" && %piece.getDataBlock().getname() $= "DeployedDecoration6") || %classname $= "crate" || %classname $= "floor" || %classname $= "spine" || %classname $= "mspine" || %classname $= "wall" || %classname $= "wwall" || %classname $= "Wspine" || %classname $= "Sspine" || %classname $= "floor" || %classname $= "door")
{
if(%piece.isDoor || %piece.getDatablock.className $= "door")
{
if(!%piece.canMove)
{
messageClient(%player.client, "", "\c2TT: You can only texture moveable doors.");
return;
}
if(%piece.state !$= "closed" && %piece.state !$= "")
{
messageClient(%player.client, "", "\c2TT: You can only texture fully closed doors.");
return;
}
}
%timeout = (%piece.timeout $= "" ? 1 : %piece.timeout);
if(%mode == 1)
{
%piece.isDoor = 0;
if(%piece.getDatablock().getName() $= "DeployedDoor")
%piece.setDatablock(DeployedSpine); // Risky...?
%piece.state = "";
%piece.canMove = "";
%piece.moving = "";
%piece.toggleType = "";
%piece.collisionType = "";
%piece.accessLevel = "";
%piece.closedScale = "";
%piece.openedScale = "";
%piece.powerControl = "";
}
else if(%mode == 2)
{
%piece.isDoor = 1;
%piece.collisionType = 0;
%piece.toggleType = 0;
%piece.powerControl = 0;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
else if(%mode == 3)
{
%piece.isDoor = 1;
%piece.collisionType = 0;
%piece.toggleType = 1;
%piece.powerControl = 0;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
else if(%mode == 4)
{
%piece.isDoor = 1;
%piece.collisionType = 0;
%piece.toggleType = 1;
%piece.powerControl = 1;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
checkPowerObject(%piece);
}
else if(%mode == 5)
{
%piece.isDoor = 1;
%piece.collisionType = 0;
%piece.toggleType = 1;
%piece.powerControl = 2;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
checkPowerObject(%piece);
}
else if(%mode == 6)
{
%piece.isDoor = 1;
%piece.collisionType = 1;
%piece.toggleType = 0;
%piece.powerControl = 0;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
else if(%mode == 7)
{
%piece.isDoor = 1;
%piece.collisionType = 2;
%piece.toggleType = 0;
%piece.powerControl = 0;
%piece.accessLevel = 1;
messageClient(%player.client, "", "\c2Use \c3/setAccess [level] \c2- to set the access level needed for this door, use \c3/setPAccess [name] [level] \c2- to set someone's access level over your pieces.");
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
else if(%mode == 8)
{
%piece.isDoor = 1;
%piece.collisionType = 3;
%piece.toggleType = 0;
%piece.powerControl = 0;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
else if(%mode == 9)
{
%piece.isDoor = 1;
%piece.collisionType = 4;
%piece.toggleType = 0;
%piece.powerControl = 0;
%piece.timeout = %timeout;
%piece.canMove = true;
%piece.state = "closed";
}
}
else
messageClient(%player.client, "", "\c2TT: Wrong type of object.");
}

View file

@ -0,0 +1,160 @@
datablock ParticleData(ZAcidBallParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.5;
inheritedVelFactor = 0.5;
lifetimeMS = 2000;
lifetimeVarianceMS = 200;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/bubbles";
colors[0] = "0.0 1.0 0.5 0.3";
colors[1] = "0.0 1.0 0.4 0.2";
colors[2] = "0.0 1.0 0.3 0.1";
sizes[0] = 0.6;
sizes[1] = 0.3;
sizes[2] = 0.1;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(ZAcidBallExplosionEmitter)
{
lifetimeMS = 200;
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 0.5;
thetaMin = 0.0;
thetaMax = 90.0;
orientParticles = false;
orientOnVelocity = false;
particles = "ZAcidBallParticle";
};
datablock ExplosionData(ZAcidBallExplosion)
{
emitter[0] = ZAcidBallExplosionEmitter;
soundProfile = ZlordAcidBoomSound;
};
datablock TracerProjectileData(LZombieAcidBall)
{
doDynamicClientHits = true;
projectileShapeName = "";
directDamage = 0.0;
directDamageType = $DamageType::ZAcid;
hasDamageRadius = true;
indirectDamage = 0.24;
damageRadius = 4.0;
kickBackStrength = 0.0;
radiusDamageType = $DamageType::ZAcid;
sound = BlasterProjectileSound;
explosion = ZAcidBallExplosion;
dryVelocity = 100.0;
wetVelocity = 100.0;
velInheritFactor = 1.0;
fizzleTimeMS = 4000;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = true;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = -1;
activateDelayMS = 100;
tracerLength = 5;
tracerAlpha = false;
tracerMinPixels = 3;
tracerColor = "0 1 0 1";
tracerTex[0] = "special/landSpikeBolt";
tracerTex[1] = "special/landSpikeBoltCross";
tracerWidth = 0.5;
crossSize = 0.79;
crossViewAng = 0.990;
renderCross = true;
emap = true;
};
datablock ShapeBaseImageData(LordAcidGunImage)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
item = LordAcidGun;
projectile = LZombieAcidBall;
projectileType = TracerProjectile;
usesEnergy = true;
fireEnergy = 55;
minEnergy = 55;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = ZlordAcidBoomSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateRecoil[3] = NoRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = PlasmaProjectileSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateTimeoutValue[6] = 0.1;
stateTransitionOnTimeout[6] = "Ready";
};
datablock ItemData(LordAcidGun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_energy.dts";
image = LordAcidGunImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a zombie lord acid ability";
};

File diff suppressed because it is too large Load diff

250
Scripts/Weapons/bazooka.cs Normal file
View file

@ -0,0 +1,250 @@
//--------------------------------------
// bazooka
//--------------------------------------
datablock ParticleData(BazookaFireEffectSmoke)
{
dragCoeffiecient = 0.4;
gravityCoefficient = -0.25; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 500;
lifetimeVarianceMS = 50;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -40.0;
spinRandomMax = 40.0;
textureName = "special/Smoke/bigSmoke";
colors[0] = "1.0 0.5 0.0 0.3";
colors[1] = "0.6 0.6 0.0 0.2";
colors[2] = "0.4 0.4 0.4 0.1";
colors[3] = "0.3 0.3 0.3 0.0";
sizes[0] = 1.0;
sizes[1] = 1.5;
sizes[2] = 2.0;
sizes[3] = 2.5;
times[0] = 0.0;
times[1] = 0.333;
times[2] = 0.666;
times[3] = 1.0;
};
datablock ParticleEmitterData(BazookaFireEffectEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionOffset = 3.0;
ejectionVelocity = 12.0;
velocityVariance = 0.0;
thetaMin = 178.0;
thetaMax = 180.0;
lifetimeMS = 20;
particles = "BazookaFireEffectSmoke";
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock GrenadeProjectileData(Bazookashot)
{
projectileShapeName = "weapon_missile_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 1.5;
damageRadius = 8.5;
radiusDamageType = $DamageType::Bazooka;
kickBackStrength = 1000;
explosion = "MissileExplosion";
underwaterExplosion = "MissileExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
baseEmitter = MissileFireEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.0;
grenadeFriction = 0.0;
armingDelayMS = -1;
gravityMod = 0.37;
muzzleVelocity = 150.0;
drag = 0.1;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 4;
lightColor = "0.05 0.2 0.05";
hasLightUnderwaterColor = true;
underWaterLightColor = "0.05 0.075 0.2";
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(BazookaAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_missile.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some missiles";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(Bazooka)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_missile.dts";
image = BazookaImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a Bazooka MK III";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(BazookaImage)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
item = Bazooka;
ammo = BazookaAmmo;
offset = "0 -0.5 0";
armThread = lookms;
emap = true;
mass = 30;
projectile = Bazookashot;
projectileType = GrenadeProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = MissileSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateEmitter[3] = "BazookaFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 1;
stateRecoil[3] = HeavyRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = MissileFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4.0;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "CheckWet";
stateTransitionOnWet[7] = "WetFire";
stateTransitionOnNotWet[7] = "Fire";
stateName[8] = "WetFire";
stateSound[8] = MissileDryFireSound;
stateTimeoutValue[8] = 1.0;
stateTransitionOnTimeout[8] = "Ready";
};
datablock ShapeBaseImageData(BazookaMiddleImage)
{
armThread = lookms;
className = WeaponImage;
shapeFile = "weapon_Mortar.dts";
offset = "-0.1 -1.25 0.1"; // L/R - F/B - T/B
rotation = "0 0 0 0"; // L/R - F/B - T/B
emap = true;
};
datablock ShapeBaseImageData(BazookaBackImage)
{
armThread = lookms;
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
offset = "0 -0.75 0"; // L/R - F/B - T/B
rotation = "0 0 1 180"; // L/R - F/B - T/B
emap = true;
ammo = BazookaAmmo;
};
function BazookaImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%velocity = vectorlen(%obj.getVelocity());
if (%velocity < 1)
%obj.applyKick(-750);
else if (%velocity > 1 && %Velocity < (%obj.maxForwardSpeed - 1))
%obj.applyKick(-1750);
else
%obj.applyKick(-3250);
}
function BazookaImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(BazookaMiddleImage, 5);
%obj.mountImage(BazookaBackImage, 6);
}
function BazookaImage::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(5);
%obj.unmountImage(6);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,320 @@
//--------------------------------------
// flamethrower
//--------------------------------------
//color tent for EVERYTHING its red really red
//1 r
//0.18 g
//0.03 b
//--------------------------------------
// Trail
//--------------------------------------
datablock ParticleData(flameParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.1;
inheritedVelFactor = 0.1;
lifetimeMS = 500;
lifetimeVarianceMS = 50;
textureName = "particleTest";
spinRandomMin = -10.0;
spinRandomMax = 10.0;
colors[0] = "1 0.18 0.03 0.4";
colors[1] = "1 0.18 0.03 0.3";
colors[2] = "1 0.18 0.03 0.0";
sizes[0] = 2.0;
sizes[1] = 1.0;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.6;
times[2] = 1.0;
};
datablock ParticleEmitterData(flameEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionOffset = 0.2;
ejectionVelocity = 10.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 10.0;
particles = "flameParticle";
};
//--------------------------------------------------------------------------
// Explosion
//--------------------------------------
datablock ParticleData(flameExplosionParticle)
{
dragCoefficient = 2;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 0;
textureName = "particleTest";
colors[0] = "1 0.18 0.03 0.6";
colors[1] = "1 0.18 0.03 0.0";
sizes[0] = 2;
sizes[1] = 2.5;
};
datablock ParticleEmitterData(flameExplosionEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 2.0;
ejectionVelocity = 4.0;
velocityVariance = 0.0;
thetaMin = 60.0;
thetaMax = 90.0;
lifetimeMS = 250;
particles = "flameExplosionParticle";
};
datablock ExplosionData(flameBoltExplosion)
{
particleEmitter = flameExplosionEmitter;
particleDensity = 150;
particleRadius = 1.25;
faceViewer = true;
};
//--------------------------------------------------------------------------
// Idle Flame
//--------------------------------------
datablock ParticleData(FlamerIdleFlame)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.3; // rises slowly
inheritedVelFactor = 0.5;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 0;
textureName = "particleTest";
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "1 0.18 0.03 0.3";
colors[1] = "1 0.18 0.03 0.2";
colors[2] = "1 0.18 0.03 0.0";
sizes[0] = 0.2;
sizes[1] = 0.4;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(FlamerIdleFlameEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 1;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 45.0;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "FlamerIdleFlame";
};
//--------------------------------------------------------------------------
// Projectiles
//--------------------------------------
datablock LinearFlareProjectileData(FlameboltMain)
{
projectileShapeName = "turret_muzzlepoint.dts";
scale = "1.0 1.0 1.0";
faceViewer = true;
directDamage = 0.05;
hasDamageRadius = true;
indirectDamage = 0.1;
damageRadius = 4.0;
kickBackStrength = 0.0;
radiusDamageType = $DamageType::Plasma;
explosion = "flameBoltExplosion";
splash = PlasmaSplash;
baseEmitter = FlameEmitter;
dryVelocity = 50.0; // z0dd - ZOD, 7/20/02. Faster plasma projectile. was 55
wetVelocity = -1;
velInheritFactor = 0.3;
fizzleTimeMS = 250;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = true;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = -1;
//activateDelayMS = 100;
activateDelayMS = -1;
size[0] = 0.2;
size[1] = 0.5;
size[2] = 0.1;
numFlares = 35;
flareColor = "1 0.18 0.03";
flareModTexture = "flaremod";
flareBaseTexture = "flarebase";
sound = PlasmaProjectileSound;
fireSound = PlasmaFireSound;
wetFireSound = PlasmaFireWetSound;
hasLight = true;
lightRadius = 10.0;
lightColor = "0.94 0.03 0.12";
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(flamerAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_plasma.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some flame thrower fuel";
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(flamer)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_plasma.dts";
image = flamerImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a flame thrower";
};
datablock ShapeBaseImageData(flamerImage)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
mass = 10;
item = flamer;
ammo = flamerAmmo;
offset = "0 0 0"; // L/R - F/B - T/B
rotation = "0 1 0 180"; // L/R - F/B - T/B
projectileSpread = 7.0 / 1000.0;
projectile = flameBoltmain;
projectileType = LinearFlareProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateEmitter[2] = "FlamerIdleFlameEmitter";
stateEmitterNode[2] = "muzzlepoint1";
stateEmitterTime[2] = 10000;
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.05;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.05;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.05;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = MergeFireSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MortarDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "WetFire";
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "Ready";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "Fire";
};
function flamerImage::onMount(%this,%obj,%slot)
{
Parent::onMount(%this,%obj,%slot);
CommandToClient(%obj.client, 'BottomPrint', "You must have a flamer ammo pack to get flamer ammo.", 3, 2 );
}
function burnloop(%obj){
if(!isobject(%obj))
return;
if(%obj.firecount >= %obj.maxfirecount){
%obj.firecount = "";
%obj.maxfirecount = 0;
%obj.onfire = 0;
}
else {
%obj.damage(0, %obj.getposition(), 0.02, $DamageType::Burn);
%fire = new ParticleEmissionDummy(){
position = vectoradd(%obj.getPosition(),"0 0 0.5");
dataBlock = "defaultEmissionDummy";
emitter = "FlameEmitter";
};
MissionCleanup.add(%fire);
%fire.schedule(100, "delete");
%obj.firecount++;
schedule(100, %obj, "burnloop", %obj);
}
}

View file

@ -0,0 +1,221 @@
// grenade (thrown by hand) script
// ------------------------------------------------------------------------
datablock AudioProfile(FlareGrenadeBurnSound)
{
filename = "fx/weapons/grenade_flare_burn.wav";
description = CloseLooping3d;
preload = true;
};
datablock AudioProfile(FlareGrenadeExplosionSound)
{
filename = "fx/weapons/grenade_flare_burn.wav";
description = CloseLooping3d;
preload = true;
};
//--------------------------------------------------------------------------
// Particle effects
//--------------------------------------
datablock ParticleData(FlareParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.15;
inheritedVelFactor = 0.5;
lifetimeMS = 1800;
lifetimeVarianceMS = 200;
textureName = "special/flareSpark";
colors[0] = "1.0 1.0 1.0 1.0";
colors[1] = "1.0 1.0 1.0 1.0";
colors[2] = "1.0 1.0 1.0 0.0";
sizes[0] = 0.6;
sizes[1] = 0.3;
sizes[2] = 0.1;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(FlareEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 90.0;
orientParticles = true;
orientOnVelocity = false;
particles = "FlareParticle";
};
//--------------------------------------------------------------------------
// Explosion - Flare Grenade
//--------------------------------------
datablock ExplosionData(FlareGrenadeExplosion)
{
explosionShape = "energy_explosion.dts";
soundProfile = FlareGrenadeExplosionSound;
faceViewer = true;
explosionScale = "0.1 0.1 0.1";
};
//--------------------------------------------------------------------------
// Projectile - Flare Grenade
//--------------------------------------
datablock FlareProjectileData(FlareGrenadeProj)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
kickBackStrength = 1500;
useLensFlare = false;
sound = FlareGrenadeBurnSound;
explosion = FlareGrenadeExplosion;
velInheritFactor = 0.5;
texture[0] = "special/flare3";
texture[1] = "special/LensFlare/flare00";
size = 4.0;
baseEmitter = FlareEmitter;
grenadeElasticity = 0.35;
grenadeFriction = 0.2;
armingDelayMS = 6000;
muzzleVelocity = 15.0;
drag = 0.1;
gravityMod = 0.15;
};
datablock ItemData(FlareGrenadeThrown)
{
shapeFile = "grenade.dts";
mass = 0.7;
elasticity = 0.2;
friction = 1;
pickupRadius = 2;
maxDamage = 0.4;
sticky = false;
gravityMod = 0.15;
maxVelocity = 10;
computeCRC = true;
};
datablock ItemData(FlareGrenade)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "grenade.dts";
mass = 0.7;
elasticity = 0.2;
friction = 1;
pickupRadius = 2;
thrownItem = FlareGrenadeThrown;
pickUpName = "some flare grenades";
isGrenade = true;
computeCRC = true;
};
//------------------------------------------------------------------------------
// Functions:
//------------------------------------------------------------------------------
function FlareGrenadeThrown::onCollision( %data, %obj, %col )
{
// Do nothing...
}
//------------------------------------------------------------------------------
// VehicleFlare
//------------------------------------------------------------------------------
datablock ParticleData(VFlareParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.15;
inheritedVelFactor = 0.0;
lifetimeMS = 2500;
lifetimeVarianceMS = 250;
textureName = "particleTest";
colors[0] = "0.7 0.7 0.7 0.75";
colors[1] = "0.7 0.7 0.7 0.4";
colors[2] = "0.7 0.7 0.7 0.0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 1.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(VFlareEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 7.50;
velocityVariance = 0.0;
thetaMin = 40.0;
thetaMax = 42.0;
phiReferenceVel = 360;
phiVariance = 55;
orientParticles = true;
orientOnVelocity = true;
particles = "VFlareParticle";
};
datablock FlareProjectileData(VFlareGrenadeProj)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = false;
kickBackStrength = 0;
useLensFlare = false;
sound = FlareGrenadeBurnSound;
explosion = FlareGrenadeExplosion;
velInheritFactor = 0.75;
texture[0] = "special/flare3";
texture[1] = "special/LensFlare/flare00";
size = 1.0;
baseEmitter = VFlareEmitter;
grenadeElasticity = 0.35;
grenadeFriction = 0.2;
armingDelayMS = 6000;
muzzleVelocity = 25.0;
drag = 0.1;
gravityMod = 0.55;
};

View file

@ -0,0 +1,69 @@
// grenade (thrown by hand) script
// ------------------------------------------------------------------------
datablock EffectProfile(FlashGrenadeExplosionEffect)
{
effectname = "explosions/grenade_flash_explode";
minDistance = 10;
maxDistance = 30;
};
datablock AudioProfile(FlashGrenadeExplosionSound)
{
filename = "fx/explosions/grenade_flash_explode.wav";
description = AudioExplosion3d;
preload = true;
effect = FlashGrenadeExplosionEffect;
};
datablock ExplosionData(FlashGrenadeExplosion)
{
explosionShape = "disc_explosion.dts";
soundProfile = FlashGrenadeExplosionSound;
faceViewer = true;
};
datablock ItemData(FlashGrenadeThrown)
{
shapeFile = "grenade.dts";
mass = 0.7;
elasticity = 0.2;
friction = 1;
pickupRadius = 2;
maxDamage = 0.4;
explosion = FlashGrenadeExplosion;
indirectDamage = 0.2;
damageRadius = 12.0;
radiusDamageType = $DamageType::Grenade;
kickBackStrength = 1000;
computeCRC = true;
maxWhiteout = 1.7;
};
datablock ItemData(FlashGrenade)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "grenade.dts";
mass = 0.7;
elasticity = 0.2;
friction = 1;
pickupRadius = 2;
thrownItem = FlashGrenadeThrown;
pickUpName = "some flash grenades";
isGrenade = true;
computeCRC = true;
};
//--------------------------------------------------------------------------
// Functions:
//--------------------------------------------------------------------------
function FlashGrenadeThrown::onCollision( %data, %obj, %col )
{
// Do nothing...
}

421
Scripts/Weapons/grenade.cs Normal file
View file

@ -0,0 +1,421 @@
// ------------------------------------------------------------------------
// grenade (thrown by hand) script
// ------------------------------------------------------------------------
datablock EffectProfile(GrenadeThrowEffect)
{
effectname = "weapons/grenade_throw";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock EffectProfile(GrenadeSwitchEffect)
{
effectname = "weapons/generic_switch";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock AudioProfile(GrenadeThrowSound)
{
filename = "fx/weapons/throw_grenade.wav";
description = AudioClose3D;
preload = true;
effect = GrenadeThrowEffect;
};
datablock AudioProfile(GrenadeSwitchSound)
{
filename = "fx/weapons/generic_switch.wav";
description = AudioClosest3D;
preload = true;
effect = GrenadeSwitchEffect;
};
//**************************************************************************
// Hand Grenade underwater fx
//**************************************************************************
//--------------------------------------------------------------------------
// Underwater Hand Grenade Particle effects
//--------------------------------------------------------------------------
datablock ParticleData(HandGrenadeExplosionBubbleParticle)
{
dragCoefficient = 0.0;
gravityCoefficient = -0.25;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 2000;
lifetimeVarianceMS = 750;
useInvAlpha = false;
textureName = "special/bubbles";
spinRandomMin = -100.0;
spinRandomMax = 100.0;
colors[0] = "0.7 0.8 1.0 0.0";
colors[1] = "0.7 0.8 1.0 0.4";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.75;
sizes[1] = 0.75;
sizes[2] = 0.75;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(HandGrenadeExplosionBubbleEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
ejectionOffset = 2.0;
velocityVariance = 0.5;
thetaMin = 0;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "HandGrenadeExplosionBubbleParticle";
};
datablock ParticleData(UnderwaterHandGrenadeExplosionSmoke)
{
dragCoeffiecient = 105.0;
gravityCoefficient = -0.0; // rises slowly
inheritedVelFactor = 0.025;
constantAcceleration = -1.0;
lifetimeMS = 1250;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.4 0.4 1.0 1.0";
colors[1] = "0.4 0.4 1.0 0.5";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 1.0;
sizes[1] = 3.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(UnderwaterHandGrenadeExplosionSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 5.25;
velocityVariance = 0.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 250;
particles = "UnderwaterHandGrenadeExplosionSmoke";
};
datablock ParticleData(UnderwaterHandGrenadeSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 350;
textureName = "special/droplet";
colors[0] = "0.6 0.6 1.0 1.0";
colors[1] = "0.6 0.6 1.0 1.0";
colors[2] = "0.6 0.6 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.25;
sizes[2] = 0.25;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(UnderwaterHandGrenadeSparkEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 6.75;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "UnderwaterHandGrenadeSparks";
};
datablock ExplosionData(UnderwaterHandGrenadeSubExplosion1)
{
offset = 1.0;
emitter[0] = UnderwaterHandGrenadeExplosionSmokeEmitter;
emitter[1] = UnderwaterHandGrenadeSparkEmitter;
};
datablock ExplosionData(UnderwaterHandGrenadeSubExplosion2)
{
offset = 1.0;
emitter[0] = UnderwaterHandGrenadeExplosionSmokeEmitter;
emitter[1] = UnderwaterHandGrenadeSparkEmitter;
};
datablock ExplosionData(UnderwaterHandGrenadeExplosion)
{
soundProfile = GrenadeExplosionSound;
emitter[0] = UnderwaterHandGrenadeExplosionSmokeEmitter;
emitter[1] = UnderwaterHandGrenadeSparkEmitter;
emitter[2] = HandGrenadeExplosionBubbleEmitter;
subExplosion[0] = UnderwaterHandGrenadeSubExplosion1;
subExplosion[1] = UnderwaterHandGrenadeSubExplosion2;
shakeCamera = true;
camShakeFreq = "12.0 13.0 11.0";
camShakeAmp = "35.0 35.0 35.0";
camShakeDuration = 1.0;
camShakeRadius = 15.0;
};
//**************************************************************************
// Hand Grenade effects
//**************************************************************************
//--------------------------------------------------------------------------
// Grenade Particle effects
//--------------------------------------------------------------------------
datablock ParticleData(HandGrenadeExplosionSmoke)
{
dragCoeffiecient = 105.0;
gravityCoefficient = -0.0; // rises slowly
inheritedVelFactor = 0.025;
constantAcceleration = -0.80;
lifetimeMS = 1250;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "1.0 0.7 0.0 1.0";
colors[1] = "0.2 0.2 0.2 1.0";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 1.0;
sizes[1] = 3.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(HandGrenadeExplosionSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 10.25;
velocityVariance = 0.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 250;
particles = "HandGrenadeExplosionSmoke";
};
datablock ParticleData(HandGrenadeSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 350;
textureName = "special/bigSpark";
colors[0] = "0.56 0.36 0.26 1.0";
colors[1] = "0.56 0.36 0.26 1.0";
colors[2] = "1.0 0.36 0.26 0.0";
sizes[0] = 0.5;
sizes[1] = 0.25;
sizes[2] = 0.25;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(HandGrenadeSparkEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 18;
velocityVariance = 6.75;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "HandGrenadeSparks";
};
//----------------------------------------------------
// Explosion
//----------------------------------------------------
datablock ExplosionData(HandGrenadeSubExplosion1)
{
offset = 2.0;
emitter[0] = HandGrenadeExplosionSmokeEmitter;
emitter[1] = HandGrenadeSparkEmitter;
};
datablock ExplosionData(HandGrenadeSubExplosion2)
{
offset = 2.0;
emitter[0] = HandGrenadeExplosionSmokeEmitter;
emitter[1] = HandGrenadeSparkEmitter;
};
datablock ExplosionData(HandGrenadeExplosion)
{
soundProfile = GrenadeExplosionSound;
emitter[0] = HandGrenadeExplosionSmokeEmitter;
emitter[1] = HandGrenadeSparkEmitter;
subExplosion[0] = HandGrenadeSubExplosion1;
subExplosion[1] = HandGrenadeSubExplosion2;
shakeCamera = true;
camShakeFreq = "12.0 13.0 11.0";
camShakeAmp = "35.0 35.0 35.0";
camShakeDuration = 1.0;
camShakeRadius = 15.0;
};
datablock TracerProjectileData(GrenadeShrapnel)
{
doDynamicClientHits = true;
directDamage = 0.4;
directDamageType = $DamageType::Grenade;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
HeadMultiplier = 1.25;
LegsMultiplier = 0.75;
kickBackStrength = 100.0;
sound = ChaingunProjectile;
dryVelocity = 200.0;
wetVelocity = 100.0;
velInheritFactor = 0.0;
fizzleTimeMS = 500;
lifetimeMS = 500;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 1.0;
tracerAlpha = false;
tracerMinPixels = 1;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.0;
crossSize = 0.0;
crossViewAng = 0.0;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
datablock ItemData(GrenadeThrown)
{
className = Weapon;
shapeFile = "grenade.dts";
mass = 0.6;
elasticity = 0.3;
friction = 1;
pickupRadius = 2;
maxDamage = 0.5;
explosion = HandGrenadeExplosion;
underwaterExplosion = UnderwaterHandGrenadeExplosion;
indirectDamage = 1.4;
damageRadius = 10.0;
radiusDamageType = $DamageType::Grenade;
kickBackStrength = 3500;
computeCRC = true;
hasShrapnel = 1;
shrapnelNumber = 36;
minshrapnelSpread = 160;
maxshrapnelSpread = 180;
shrapnelProjectileType = TracerProjectile;
shrapnelProjectile = GrenadeShrapnel;
};
datablock ItemData(Grenade)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "grenade.dts";
mass = 1;
elasticity = 0.5;
friction = 1;
pickupRadius = 2;
thrownItem = GrenadeThrown;
pickUpName = "some grenades";
isGrenade = true;
computeCRC = true;
};

339
Scripts/Weapons/mine.cs Normal file
View file

@ -0,0 +1,339 @@
// ----------------------------------------------
// mine script
// ----------------------------------------------
$TeamDeployableMax[MineDeployed] = 25; // z0dd - ZOD, 6/10/02. Was 20.
// ----------------------------------------------
// force-feedback datablocks
// ----------------------------------------------
datablock EffectProfile(MineExplosionEffect)
{
effectname = "explosions/mine_detonate";
minDistance = 10;
maxDistance = 50;
};
// ----------------------------------------------
// audio datablocks
// ----------------------------------------------
datablock AudioProfile(MineDeploySound)
{
filename = "fx/weapons/mine_deploy.wav";
description = AudioClose3D;
preload = true;
};
datablock AudioProfile(MineExplosionSound)
{
filename = "fx/weapons/mine_detonate.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = MineExplosionEffect;
};
datablock AudioProfile(UnderwaterMineExplosionSound)
{
filename = "fx/weapons/mine_detonate_UW.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = MineExplosionEffect;
};
//--------------------------------------------------------------------------
// Mine Particle effects
//--------------------------------------------------------------------------
datablock ParticleData(MineExplosionBubbleParticle)
{
dragCoefficient = 0.0;
gravityCoefficient = -0.25;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 2000;
lifetimeVarianceMS = 750;
useInvAlpha = false;
textureName = "special/bubbles";
spinRandomMin = -100.0;
spinRandomMax = 100.0;
colors[0] = "0.7 0.8 1.0 0.0";
colors[1] = "0.7 0.8 1.0 0.4";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 1.0;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 1.0;
};
datablock ParticleEmitterData(MineExplosionBubbleEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
ejectionOffset = 2.0;
velocityVariance = 0.5;
thetaMin = 0;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "MineExplosionBubbleParticle";
};
datablock ParticleData( UnderwaterMineCrescentParticle )
{
dragCoefficient = 2;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 000;
textureName = "special/crescent3";
colors[0] = "0.5 0.5 1.0 1.0";
colors[1] = "0.5 0.5 1.0 1.0";
colors[2] = "0.5 0.5 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 1.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( UnderwaterMineCrescentEmitter )
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 5.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 200;
particles = "UnderwaterMineCrescentParticle";
};
datablock ParticleData(UnderwaterMineExplosionSmoke)
{
dragCoeffiecient = 105.0;
gravityCoefficient = -0.0;
inheritedVelFactor = 0.025;
constantAcceleration = -1.0;
lifetimeMS = 1200;
lifetimeVarianceMS = 00;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.7 0.7 1.0 1.0";
colors[1] = "0.3 0.3 1.0 1.0";
colors[2] = "0.0 0.0 1.0 0.0";
sizes[0] = 1.0;
sizes[1] = 3.0;
sizes[2] = 1.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(UnderwaterMineExplosionSmokeEmitter)
{
ejectionPeriodMS = 8;
periodVarianceMS = 0;
ejectionVelocity = 4.25;
velocityVariance = 1.25;
thetaMin = 0.0;
thetaMax = 80.0;
lifetimeMS = 250;
particles = "UnderwaterMineExplosionSmoke";
};
datablock ExplosionData(UnderwaterMineExplosion)
{
explosionShape = "disc_explosion.dts";
playSpeed = 1.0;
sizes[0] = "0.4 0.4 0.4";
sizes[1] = "0.4 0.4 0.4";
soundProfile = UnderwaterMineExplosionSound;
faceViewer = true;
emitter[0] = UnderwaterMineExplosionSmokeEmitter;
emitter[1] = UnderwaterMineCrescentEmitter;
emitter[2] = MineExplosionBubbleEmitter;
shakeCamera = true;
camShakeFreq = "8.0 7.0 9.0";
camShakeAmp = "50.0 50.0 50.0";
camShakeDuration = 1.0;
camShakeRadius = 10.0;
};
//--------------------------------------------------------------------------
// Mine Particle effects
//--------------------------------------------------------------------------
datablock ParticleData( MineCrescentParticle )
{
dragCoefficient = 2;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 000;
textureName = "special/crescent3";
colors[0] = "1.0 0.8 0.2 1.0";
colors[1] = "1.0 0.4 0.2 1.0";
colors[2] = "1.0 0.0 0.0 0.0";
sizes[0] = 0.5;
sizes[1] = 1.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( MineCrescentEmitter )
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 5.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 200;
particles = "MineCrescentParticle";
};
datablock ParticleData(MineExplosionSmoke)
{
dragCoeffiecient = 105.0;
gravityCoefficient = -0.0;
inheritedVelFactor = 0.025;
lifetimeMS = 1200;
lifetimeVarianceMS = 00;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "1.0 0.7 0.0 1.0";
colors[1] = "0.2 0.2 0.2 1.0";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 1.0;
sizes[1] = 3.0;
sizes[2] = 1.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(MineExplosionSmokeEmitter)
{
ejectionPeriodMS = 8;
periodVarianceMS = 0;
ejectionVelocity = 4.25;
velocityVariance = 1.25;
thetaMin = 0.0;
thetaMax = 80.0;
lifetimeMS = 250;
particles = "MineExplosionSmoke";
};
datablock ExplosionData(MineExplosion)
{
explosionShape = "effect_plasma_explosion.dts";
playSpeed = 1.0;
sizes[0] = "0.5 0.5 0.5";
sizes[1] = "0.5 0.5 0.5";
soundProfile = MineExplosionSound;
faceViewer = true;
emitter[0] = MineExplosionSmokeEmitter;
emitter[1] = MineCrescentEmitter;
shakeCamera = true;
camShakeFreq = "8.0 7.0 9.0";
camShakeAmp = "50.0 50.0 50.0";
camShakeDuration = 1.0;
camShakeRadius = 10.0;
};
// ----------------------------------------------
// Item datablocks
// ----------------------------------------------
datablock ItemData(MineDeployed)
{
className = Weapon;
shapeFile = "mine.dts";
mass = 1.0;
elasticity = 0.0;
friction = 0.8;
pickupRadius = 3;
maxDamage = 0.01;
explosion = MineExplosion;
underwaterExplosion = UnderwaterMineExplosion;
indirectDamage = 1.3;
damageRadius = 6.0;
radiusDamageType = $DamageType::Mine;
kickBackStrength = 4000;
aiAvoidThis = false;
dynamicType = $TypeMasks::DamagableItemObjectType;
spacing = 8.0;
proximity = 3;
armTime = 5000;
maxDepCount = 5;
computeCRC = true;
};
datablock ItemData(Mine)
{
className = HandInventory;
catagory = "Handheld";
shapeFile = "ammo_mine.dts";
mass = 1.0;
elasticity = 0.2;
friction = 0.7;
pickupRadius = 2;
thrownItem = MineDeployed;
pickUpName = "some mines";
computeCRC = true;
};

View file

@ -0,0 +1,632 @@
//--------------------------------------
// Missile launcher
//--------------------------------------
//--------------------------------------------------------------------------
// Force-Feedback Effects
//--------------------------------------
datablock EffectProfile(MissileSwitchEffect)
{
effectname = "weapons/missile_launcher_activate";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock EffectProfile(MissileFireEffect)
{
effectname = "weapons/missile_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(MissileDryFireEffect)
{
effectname = "weapons/missile_launcher_dryfire";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock EffectProfile(MissileExplosionEffect)
{
effectname = "explosions/explosion.xpl23";
minDistance = 10;
maxDistance = 30;
};
//--------------------------------------------------------------------------
// Sounds
//--------------------------------------
datablock AudioProfile(MissileSwitchSound)
{
filename = "fx/weapons/missile_launcher_activate.wav";
description = AudioClosest3d;
preload = true;
effect = MissileSwitchEffect;
};
datablock AudioProfile(MissileFireSound)
{
filename = "fx/weapons/missile_fire.WAV";
description = AudioDefault3d;
preload = true;
effect = MissileFireEffect;
};
datablock AudioProfile(MissileProjectileSound)
{
filename = "fx/weapons/missile_projectile.wav";
description = ProjectileLooping3d;
preload = true;
};
datablock AudioProfile(MissileReloadSound)
{
filename = "fx/weapons/weapon.missilereload.wav";
description = AudioClosest3d;
preload = true;
};
datablock AudioProfile(MissileLockSound)
{
filename = "fx/weapons/missile_launcher_searching.WAV";
description = AudioClosest3d;
preload = true;
};
datablock AudioProfile(MissileExplosionSound)
{
filename = "fx/explosions/explosion.xpl23.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = MissileExplosionEffect;
};
datablock AudioProfile(MissileDryFireSound)
{
filename = "fx/weapons/missile_launcher_dryfire.wav";
description = AudioClose3d;
preload = true;
effect = MissileDryFireEffect;
};
//----------------------------------------------------------------------------
// Splash Debris
//----------------------------------------------------------------------------
datablock ParticleData( MDebrisSmokeParticle )
{
dragCoeffiecient = 1.0;
gravityCoefficient = 0.10;
inheritedVelFactor = 0.1;
lifetimeMS = 1000;
lifetimeVarianceMS = 100;
textureName = "particleTest";
// useInvAlpha = true;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.0;
sizes[1] = 0.8;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( MDebrisSmokeEmitter )
{
ejectionPeriodMS = 10;
periodVarianceMS = 1;
ejectionVelocity = 1.0; // A little oomph at the back end
velocityVariance = 0.2;
thetaMin = 0.0;
thetaMax = 40.0;
particles = "MDebrisSmokeParticle";
};
datablock DebrisData( MissileSplashDebris )
{
emitters[0] = MDebrisSmokeEmitter;
explodeOnMaxBounce = true;
elasticity = 0.4;
friction = 0.2;
lifetime = 0.3;
lifetimeVariance = 0.1;
numBounces = 1;
};
//----------------------------------------------------------------------------
// Missile smoke spike (for debris)
//----------------------------------------------------------------------------
datablock ParticleData( MissileSmokeSpike )
{
dragCoeffiecient = 1.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
lifetimeMS = 1500;
lifetimeVarianceMS = 250;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.6 0.6 0.6 1.0";
colors[1] = "0.4 0.4 0.4 0.5";
colors[2] = "0.4 0.4 0.4 0.0";
sizes[0] = 0.0;
sizes[1] = 1.0;
sizes[2] = 1.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( MissileSmokeSpikeEmitter )
{
ejectionPeriodMS = 5;
periodVarianceMS = 1;
ejectionVelocity = 1.0; // A little oomph at the back end
velocityVariance = 0.2;
thetaMin = 0.0;
thetaMax = 40.0;
particles = "MissileSmokeSpike";
};
//----------------------------------------------------------------------------
// Explosion smoke particles
//----------------------------------------------------------------------------
datablock ParticleData(MissileExplosionSmoke)
{
dragCoeffiecient = 0.3;
gravityCoefficient = -0.2;
inheritedVelFactor = 0.025;
lifetimeMS = 2250;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -100.0;
spinRandomMax = 100.0;
// textureName = "special/Smoke/bigSmoke";
colors[0] = "0.6 0.6 0.6 0.9";
colors[1] = "0.5 0.5 0.5 0.4";
colors[2] = "0.4 0.4 0.4 0.0";
sizes[0] = 1.0;
sizes[1] = 2.5;
sizes[2] = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(MissileExplosionSmokeEMitter)
{
ejectionOffset = 1.5;
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 2.5;
velocityVariance = 0.5;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 500;
particles = "MissileExplosionSmoke";
};
datablock DebrisData( MissileSpikeDebris )
{
emitters[0] = MissileSmokeSpikeEmitter;
explodeOnMaxBounce = true;
elasticity = 0.4;
friction = 0.2;
lifetime = 3.0;
lifetimeVariance = 0.5;
};
//---------------------------------------------------------------------------
// Explosions
//---------------------------------------------------------------------------
datablock ExplosionData(MissileExplosion)
{
explosionShape = "effect_plasma_explosion.dts";
playSpeed = 0.8;
soundProfile = MissileExplosionSound;
faceViewer = true;
sizes[0] = "1.5 1.5 1.5";
sizes[1] = "1.5 1.5 1.5";
sizes[2] = "1.5 1.5 1.5";
emitter[0] = MissileExplosionSmokeEmitter;
debris = MissileSpikeDebris;
debrisThetaMin = 1;
debrisThetaMax = 179;
debrisNum = 9;
debrisNumVariance = 3;
debrisVelocity = 15.0;
debrisVelocityVariance = 2.0;
shakeCamera = true;
camShakeFreq = "6.0 7.0 7.0";
camShakeAmp = "70.0 70.0 70.0";
camShakeDuration = 1.0;
camShakeRadius = 13.0;
};
datablock ExplosionData(MissileSplashExplosion)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "1.0 1.0 1.0";
debris = MissileSplashDebris;
debrisThetaMin = 10;
debrisThetaMax = 80;
debrisNum = 10;
debrisVelocity = 10.0;
debrisVelocityVariance = 4.0;
sizes[0] = "0.35 0.35 0.35";
sizes[1] = "0.15 0.15 0.15";
sizes[2] = "0.15 0.15 0.15";
sizes[3] = "0.15 0.15 0.15";
times[0] = 0.0;
times[1] = 0.333;
times[2] = 0.666;
times[3] = 1.0;
};
//--------------------------------------------------------------------------
// Splash
//--------------------------------------------------------------------------
datablock ParticleData(MissileMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 400;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(MissileMistEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionVelocity = 6.0;
velocityVariance = 4.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 250;
particles = "MissileMist";
};
datablock ParticleData( MissileSplashParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
textureName = "special/droplet";
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( MissileSplashEmitter )
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 6;
velocityVariance = 3.0;
ejectionOffset = 0.0;
thetaMin = 60;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "MissileSplashParticle";
};
datablock SplashData(MissileSplash)
{
numSegments = 15;
ejectionFreq = 0.0001;
ejectionAngle = 45;
ringLifetime = 0.5;
lifetimeMS = 400;
velocity = 5.0;
startRadius = 0.0;
acceleration = -3.0;
texWrap = 5.0;
explosion = MissileSplashExplosion;
texture = "special/water2";
emitter[0] = MissileSplashEmitter;
emitter[1] = MissileMistEmitter;
colors[0] = "0.7 0.8 1.0 0.0";
colors[1] = "0.7 0.8 1.0 1.0";
colors[2] = "0.7 0.8 1.0 0.0";
colors[3] = "0.7 0.8 1.0 0.0";
times[0] = 0.0;
times[1] = 0.4;
times[2] = 0.8;
times[3] = 1.0;
};
//--------------------------------------------------------------------------
// Particle effects
//--------------------------------------
datablock ParticleData(MissileSmokeParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.02;
inheritedVelFactor = 0.0;
lifetimeMS = 4000;
lifetimeVarianceMS = 500;
textureName = "special/Smoke/bigSmoke";
useInvAlpha = true;
spinRandomMin = -90.0;
spinRandomMax = 90.0;
colors[0] = "0.6 0.6 0.6 1.0";
colors[1] = "0.5 0.5 0.5 0.6";
colors[2] = "0.4 0.4 0.4 0.0";
sizes[0] = 1;
sizes[1] = 1.75;
sizes[2] = 3;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 1.0;
};
datablock ParticleEmitterData(MissileSmokeEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 0.5;
velocityVariance = 0.5;
thetaMin = 0.0;
thetaMax = 50.0;
particles = "MissileSmokeParticle";
};
datablock ParticleData(MissileFireParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 1.0;
lifetimeMS = 300;
lifetimeVarianceMS = 000;
textureName = "particleTest";
spinRandomMin = -135;
spinRandomMax = 135;
colors[0] = "1 0.18 0.03 0.4";
colors[1] = "1 0.18 0.03 0.3";
colors[2] = "1 0.18 0.03 0.0";
sizes[0] = 0;
sizes[1] = 1;
sizes[2] = 1.5;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 1.0;
};
datablock ParticleEmitterData(MissileFireEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 15.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 0.0;
particles = "MissileFireParticle";
};
datablock ParticleData(MissilePuffParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
useInvAlpha = true;
lifetimeMS = 4000;
lifetimeVarianceMS = 300;
textureName = "particleTest";
spinRandomMin = -135;
spinRandomMax = 135;
colors[0] = "0.6 0.6 0.6 0.15";
colors[1] = "0.4 0.4 0.4 0.0";
sizes[0] = 0.0;
sizes[1] = 0.5;
times[0] = 0.0;
times[1] = 1.0;
};
datablock ParticleEmitterData(MissilePuffEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 0.5;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = "MissilePuffParticle";
};
datablock ParticleData(MissileLauncherExhaustParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.01;
inheritedVelFactor = 1.0;
lifetimeMS = 500;
lifetimeVarianceMS = 300;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -135;
spinRandomMax = 135;
colors[0] = "1.0 1.0 1.0 0.5";
colors[1] = "0.7 0.7 0.7 0.0";
sizes[0] = 0.25;
sizes[1] = 1.0;
times[0] = 0.0;
times[1] = 1.0;
};
datablock ParticleEmitterData(MissileLauncherExhaustEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 20.0;
particles = "MissileLauncherExhaustParticle";
};
//--------------------------------------------------------------------------
// Debris
//--------------------------------------
datablock DebrisData( FlechetteDebris )
{
shapeName = "weapon_missile_fleschette.dts";
lifetime = 5.0;
minSpinSpeed = -320.0;
maxSpinSpeed = 320.0;
elasticity = 0.2;
friction = 0.3;
numBounces = 3;
gravModifier = 0.40;
staticOnMaxBounce = true;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(MissileLauncherAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_missile.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some missiles";
computeCRC = true;
};

196
Scripts/Weapons/pistol.cs Normal file
View file

@ -0,0 +1,196 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// M4 Grenade Launcher - Made by Blnukem
//------------------------------------------------------------------------------
// Ammo Data
//------------------------------------------------------------------------------
datablock GrenadeProjectileData(M4_RPGrenade)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 0.40;
damageRadius = 15.0;
radiusDamageType = $DamageType::Grenade;
kickBackStrength = 1500;
bubbleEmitTime = 1.0;
sound = GrenadeProjectileSound;
explosion = "GrenadeExplosion";
underwaterExplosion = "UnderwaterGrenadeExplosion";
velInheritFactor = 0.5;
splash = GrenadeSplash;
baseEmitter = GrenadeSmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.35;
grenadeFriction = 0.2;
armingDelayMS = 1000;
muzzleVelocity = 47.00;
drag = 0.1;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(M4Ammo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_grenade.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some grenade launcher ammo";
computeCRC = true;
emap = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ItemData(M4)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_grenade_launcher.dts";
image = M4Image;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a grenade launcher";
computeCRC = true;
};
datablock ShapeBaseImageData(M4Image)
{
className = WeaponImage;
shapeFile = "weapon_grenade_launcher.dts";
item = M4;
ammo = M4Ammo;
offset = "0 0 0";
emap = true;
projectile = M4_RPGrenade;
projectileType = GrenadeProjectile;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = GrenadeSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.4;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = GrenadeFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateSound[4] = GrenadeReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = GrenadeDryFireSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
function M4Image::onMount(%this,%obj,%slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.mountImage(M4Revolver, 1);
if (%obj.inv[M4Ammo] == 0)
%obj.M4checkclip = schedule(10, 0, "M4Checkforclip", %obj);
}
function M4Image::onUnmount(%this,%obj,%slot)
{
Parent::onUnmount(%this, %obj, %slot);
%obj.unmountImage(1);
if (%obj.clipReloading != false)
{
Cancel(%obj.M4ClipAdd);
%obj.clipReloading = false;
}
}
function M4Image::onFire(%data,%obj,%slot)
{
%obj.decInventory(%data.ammo,1);
%vector = %obj.getMuzzleVector(%slot);
%mp = %obj.getMuzzlePoint(%slot);
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vector);
%p = new (%data.projectileType)()
{
dataBlock = %data.projectile;
initialDirection = %newvector;
initialPosition = %mp;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
%obj.applyKick(-75);
if (%obj.inv[M4Ammo] == 0)
%obj.M4checkclip = schedule(10, 0, "M4Checkforclip", %obj);
}
function M4Checkforclip(%obj)
{
if (%obj.inv[M4clip] > 0)
{
%obj.clipReloading = true;
%obj.unmountImage(1);
%obj.M4ClipAdd = schedule(2500, 0, "M4ReloadClip", %obj);
}
}
function M4ReloadClip(%obj)
{
%obj.clipReloading = false;
%obj.decInventory(MG42Clip, 1);
%obj.mountImage(M4Revolver, 1);
%obj.setInventory(M4Ammo, 5);
}

View file

@ -0,0 +1,235 @@
//--------------------------------------
// RPChaingun
//--------------------------------------
datablock AudioProfile(SniperFireSound)
{
filename = "fx/vehicles/tank_mortar_fire.wav";
description = AudioDefault3d;
preload = true;
effect = AssaultChaingunFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(snipergunBullet)
{
doDynamicClientHits = true;
directDamage = 0.6; // z0dd - ZOD, 9-27-02. Was 0.0825
directDamageType = $DamageType::Sniper;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
sniperrifleHeadMultiplier = 10.0;
closeRangeMultiplier = 0.5;
kickBackStrength = 50.0;
sound = ChaingunProjectile;
//dryVelocity = 425.0;
dryVelocity = 5000.0; // z0dd - ZOD, 8-12-02. Was 425.0
wetVelocity = 4500.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 30.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.10;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
//--------------------------------------------------------------------------
// Ammo
//--------------------------------------
datablock ItemData(snipergunAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "ammo_chaingun.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "some sniperrifle ammo";
computeCRC = true;
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock ShapeBaseImageData(snipergunImage)
{
className = WeaponImage;
shapeFile = "weapon_sniper.dts";
item = snipergun;
ammo = snipergunAmmo;
projectile = snipergunBullet;
projectileType = TracerProjectile;
emap = true;
armThread = looksn;
mass = 10;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
maxSpread = 10.0 / 1000.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = BasicSwitchSound;
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "CheckWet";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.0001;
stateFire[3] = true;
stateEmitter[3] = "GunFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 1;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = SniperFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 2.0;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ChaingunDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "WetFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "Ready";
stateName[8] = "CheckWet";
stateTransitionOnWet[8] = "WetFire";
stateTransitionOnNotWet[8] = "Fire";
};
datablock ItemData(snipergun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_chaingun.dts";
image = snipergunImage;
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a snipergun";
computeCRC = true;
emap = true;
};
function snipergunBullet::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
{
// extra damage for head shot or less for close range shots
if(!(%targetObject.getType() & ($TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType)) &&
(%targetObject.getDataBlock().getClassName() $= "PlayerData"))
{
%damLoc = firstWord(%targetObject.getDamageLocation(%position));
%dist = vectorDist(%position, %projectile.sourceObject.getPosition());
if(%damLoc $= "head")
{
%targetObject.getOwnerClient().headShot = 1;
%modifier *= %data.sniperrifleHeadMultiplier;
}
else if(%damLoc $= "legs")
{
%modifier *= 0.2;
}
else if (%dist <= 125)
{
%modifier *= %data.closeRangeMultiplier;
}
else
{
%modifier = 1;
%targetObject.getOwnerClient().headShot = 0;
}
}
%targetObject.damage(%projectile.sourceObject, %position, %modifier * %data.directDamage, %data.directDamageType);
}
function snipergunImage::onFire(%data, %obj, %slot){
%data.lightStart = getSimTime();
%spd = vectorLen(%obj.getVelocity());
%spread = %data.maxSpread * (%spd / %obj.getDatablock().maxForwardSpeed);
if(%spread > %data.maxspread)
%spread = %data.maxspread;
%vec = %obj.getMuzzleVector(%slot);
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%vector = MatrixMulVector(%mat, %vec);
%initialPos = %obj.getMuzzlePoint(%slot);
%p = new (%data.projectileType)() {
dataBlock = %data.projectile;
initialDirection = %vector;
initialPosition = %initialPos;
sourceObject = %obj;
sourceSlot = %slot;
};
%obj.lastProjectile = %p;
%obj.deleteLastProjectile = %data.deleteLastProjectile;
MissionCleanup.add(%p);
if(%obj.client)
%obj.client.projectile = %p;
%obj.decInventory(%data.ammo,1);
}

View file

@ -0,0 +1,292 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Super Chaingun - Modified by Blnukem.
// Modifications: Re-added pulses.
//------------------------------------------------------------------------------
// Projectile Data
//------------------------------------------------------------------------------
datablock TracerProjectileData(SuperChaingunBullet)
{
doDynamicClientHits = true;
directDamage = 0.5 * 10;
directDamageType = $DamageType::SuperChaingun;
explosion = ChaingunExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.2 * 5;
damageRadius = 10.0;
radiusDamageType = $DamageType::SuperChaingun;
kickBackStrength = 1750;
sound = ChaingunProjectile;
dryVelocity = 800.0;
wetVelocity = 100.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 15.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.08;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
datablock TracerProjectileData(SCG_Bullet_exp)
{
doDynamicClientHits = true;
directDamage = 0.5 * 10;
directDamageType = $DamageType::SuperChaingun;
explosion = PlasmaBoltExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.2 * 5;
damageRadius = 10.0;
radiusDamageType = $DamageType::SuperChaingun;
kickBackStrength = 150;
sound = ChaingunProjectile;
dryVelocity = 0.0;
wetVelocity = 0.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 10;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 1;
tracerLength = 0.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.35;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Weapon Data
//------------------------------------------------------------------------------
datablock ShapeBaseImageData(SuperChaingunImage)
{
className = WeaponImage;
shapeFile = "weapon_chaingun.dts";
item = SuperChaingun;
projectile = SuperChaingunBullet;
projectileType = TracerProjectile;
emap = true;
casing = ShellDebris;
shellExitDir = "0.3 0.5 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 4.0;
usesEnergy = true;
fireEnergy = 0.0;
minEnergy = 5.0;
projectileSpread = 2.0 / 1000.0;
//--------------------------------------
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = ChaingunSwitchSound;
stateAllowImageChange[0] = false;
//
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
//--------------------------------------
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
//
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
//--------------------------------------
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
//--------------------------------------
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinUpSound;
//
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
//--------------------------------------
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
//stateRecoil[4] = LightRecoil;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
//
stateTimeoutValue[4] = 0.05;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
//--------------------------------------
stateName[5] = "Spindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
//
stateTimeoutValue[5] = 1.0;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
//--------------------------------------
stateName[6] = "EmptySpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
//
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
//--------------------------------------
stateName[7] = "DryFire";
stateSound[7] = ChaingunDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ItemData(SuperChaingun)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_chaingun.dts";
image = SuperChaingunImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a super chaingun";
computeCRC = true;
emap = true;
};
function SuperChaingunImage::onFire(%data,%obj,%slot) {
if (%obj.superChaingunMode == 1) {
%pos = %obj.getMuzzlePoint(%slot);
%vec = %obj.getMuzzleVector(%slot);
%res = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%vec,2000)), $TypeMasks::PlayerObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType,%obj);
if (%res)
%hitLoc = getWords(%res,1,3);
else
%hitLoc = vectorAdd(%pos,vectorScale(%vec,2000));
%p = discharge(%pos,%vec);
%p.setEnergyPercentage(1);
createLifeLight(%hitLoc,1,1000);
addToShock(%p);
%p.schedule(1000,"delete");
zap(0,25,%hitLoc);
}
else if (%obj.superChaingunMode > 1)
{
if (!(%obj.lasteffectpulse+2000 < getSimTime()))
return;
%obj.lasteffectpulse = GetSimTime();
%pos = %obj.getMuzzlePoint(%slot);
%vec = %obj.getMuzzleVector(%slot);
%res = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%vec,2000)), $TypeMasks::PlayerObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType| $TypeMasks::ForceFieldObjectType ,%obj);
if (%res)
Aidpulse(getWords(%res,1,3),%obj.client,%obj.superChaingunMode-2);
}
else
%p = Parent::onFire(%data, %obj, %slot);
}
function SuperChaingunImage::onMount(%this,%obj,%slot) {
%obj.usingSuperChaingun = true;
if (!%obj.superChaingunMode)
%obj.superChaingunMode = 0;
if (!%obj.superChaingunMode2)
%obj.superChaingunMode2 = 0;
displaySCGStatus(%obj);
WeaponImage::onMount(%this,%obj,%slot);
}
function SuperChaingunImage::onUnmount(%data, %obj, %slot) {
%obj.usingSuperChaingun = false;
WeaponImage::onUnmount(%data, %obj, %slot);
}
function displaySCGStatus(%obj) {
if (%obj.superChaingunMode == 1)
bottomPrint(%obj.client,"SCG Ion Progression " @ ($Ion::StopIon ? "disabled" : "enabled"),2,1);
else if (%obj.superChaingunMode == 2)
bottomPrint(%obj.client,"SCG Repair Pulse",2,1);
else if (%obj.superChaingunMode == 3)
bottomPrint(%obj.client,"SCG Cloak Pulse",2,1);
else if (%obj.superChaingunMode == 4)
bottomPrint(%obj.client,"SCG Disasemble Pulse",2,1);
else if (%obj.superChaingunMode == 5)
bottomPrint(%obj.client,"SCG Electro Static Pulse",2,1);
else if (%obj.superChaingunMode == 6)
bottomPrint(%obj.client,"SCG Morphing Pulse",2,1);
else
bottomPrint(%obj.client,"SCG Normal",2,1);
}

View file

@ -0,0 +1,121 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Targeting laser - Modified by Blnukem.
// Modifications: Saves datablock space.
// The file is also much cleaner and easier to read, better for more editing.
//------------------------------------------------------------------------------
// Sounds
//------------------------------------------------------------------------------
datablock EffectProfile(TargetingLaserPaintEffect)
{
effectname = "weapons/targetinglaser_paint";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock AudioProfile(TargetingLaserPaintSound)
{
filename = "fx/weapons/targetinglaser_paint.wav";
description = CloseLooping3d;
preload = true;
effect = TargetingLaserPaintEffect;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Projectile
//------------------------------------------------------------------------------
datablock TargetProjectileData(BasicTargeter)
{
directDamage = 0.0;
hasDamageRadius = false;
indirectDamage = 0.0;
damageRadius = 0.0;
velInheritFactor = 1.0;
maxRifleRange = 1000;
beamColor = "1.0 0.0 0.0";
startBeamWidth = 0.02;
pulseBeamWidth = 0.025;
beamFlareAngle = 3.0;
minFlareSize = 0.0;
maxFlareSize = 400.0;
pulseSpeed = 6.0;
pulseLength = 0.150;
textureName[0] = "special/nonlingradient";
textureName[1] = "special/flare";
textureName[2] = "special/pulse";
textureName[3] = "special/expFlare";
beacon = false;
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Weapon Data
//------------------------------------------------------------------------------
datablock ItemData(TargetingLaser)
{
className = Weapon;
catagory = "Spawn Items";
shapeFile = "weapon_targeting.dts";
image = TargetingLaserImage;
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
pickUpName = "a laser targeter";
computeCRC = true;
};
datablock ShapeBaseImageData(TargetingLaserImage)
{
className = WeaponImage;
shapeFile = "weapon_targeting.dts";
item = TargetingLaser;
offset = "0 0 0";
projectile = BasicTargeter;
projectileType = TargetProjectile;
deleteLastProjectile = true;
usesEnergy = true;
minEnergy = 3;
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateSound[0] = GenericSwitchSound;
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateTransitionOnAmmo[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateEnergyDrain[3] = 3;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateTransitionOnTriggerUp[3] = "Deconstruction";
stateTransitionOnNoAmmo[3] = "Deconstruction";
stateSound[3] = TargetingLaserPaintSound;
stateName[4] = "NoAmmo";
stateTransitionOnAmmo[4] = "Ready";
stateName[5] = "Deconstruction";
stateScript[5] = "deconstruct";
stateTransitionOnTimeout[5] = "Ready";
};