mirror of
https://github.com/Ragora/T2-BoL.git
synced 2026-07-14 04:34:38 +00:00
Initial commit.
This commit is contained in:
commit
9a05e8d86c
652 changed files with 154587 additions and 0 deletions
61
scripts/packs/ELFbarrelPack.cs
Normal file
61
scripts/packs/ELFbarrelPack.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// ELF barrel pack
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(ELFBarrelPackImage)
|
||||
{
|
||||
mass = 10; // z0dd - ZOD, 7/17/02. Lower mass due to higher gravity. Was 15.
|
||||
|
||||
shapeFile = "pack_barrel_elf.dts";
|
||||
item = ELFBarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "ELFBarrelLarge";
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeOut[2] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
};
|
||||
|
||||
datablock ItemData(ELFBarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_elf.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "ELFBarrelPackImage";
|
||||
pickUpName = "an ELF barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function ELFBarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function ELFBarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function ELFBarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
63
scripts/packs/aabarrelPack.cs
Normal file
63
scripts/packs/aabarrelPack.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(AABarrelPackImage)
|
||||
{
|
||||
mass = 10; // z0dd - ZOD, 7/17/02. Lower mass due to higher gravity. Was 15.
|
||||
|
||||
shapeFile = "pack_barrel_aa.dts";
|
||||
item = AABarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "AABarrelLarge";
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeOut[2] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
};
|
||||
|
||||
datablock ItemData(AABarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_aa.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "AABarrelPackImage";
|
||||
pickUpName = "an anti-aircraft barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
//AABarrelPackImage.turretBarrel = "AABarrelLarge";
|
||||
|
||||
function AABarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function AABarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function AABarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
129
scripts/packs/buildingconstructor.cs
Normal file
129
scripts/packs/buildingconstructor.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Spine, Code by Mostlikely, Prettied by JackTL
|
||||
//---------------------------------------------------------
|
||||
|
||||
$TeamDeployableMax[constructorDeployable] = 1;
|
||||
|
||||
datablock ShapeBaseImageData(constructorDeployableImage) {
|
||||
mass = 1;
|
||||
emap = true;
|
||||
shapeFile = "ammo_plasma.dts";
|
||||
item = constructorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.2 -0.55";
|
||||
deployed = DeployedSpine;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = false;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(constructorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "constructorDeployableImage";
|
||||
pickUpName = "a light support beam pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function constructorDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function constructorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function constructorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function constructorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
//Object
|
||||
%className = "StaticShape";
|
||||
|
||||
%grounded = 0;
|
||||
if (%item.surface.getClassName() $= TerrainBlock)
|
||||
%grounded = 1;
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (%item.surfaceinher == 0) {
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
}
|
||||
|
||||
%item.surfaceNrm3 = vectorCross(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%scale = getWords($packSetting["spine",%plyr.packSet],0,2);
|
||||
%dataBlock = %item.deployed;
|
||||
|
||||
if (%plyr.packSet == 5) {
|
||||
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale,$AllObjMask);
|
||||
if (%space != getWord(%scale,1))
|
||||
%type = true;
|
||||
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
|
||||
}
|
||||
else if (%plyr.packSet == 6 || %plyr.packSet == 7) {
|
||||
%mCenter = "0 0 -0.5";
|
||||
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale,%mCenter);
|
||||
%scale = getWords(%pad,0,2);
|
||||
%item.surfacePt = getWords(%pad,3,5);
|
||||
%rot = getWords(%pad,6,9);
|
||||
if (%plyr.packSet == 7) {
|
||||
%scale = vectorMultiply(%scale,1.845 SPC 2 SPC 1.744); // Update dfunctions.cs if changed!
|
||||
%scaleIsSet = 1;
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm3,0.5));
|
||||
%rot = rotAdd(%rot,"1 0 0" SPC $Pi);
|
||||
%dataBlock = "DeployedWoodSpine";
|
||||
}
|
||||
}
|
||||
|
||||
if (!%scaleIsSet)
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
|
||||
//Test pack -- make sure our structure is loaded
|
||||
exec("data/Game/Structures/SMLCabin.cs");
|
||||
build_SMLCabin(%plyr.client,%item.surfacePt,%plyr.client.team);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
%plyr.setInventory("constructorDeployable",0,1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
function constructorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasSpine = true; // set for spinecheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function constructorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasSpine = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
314
scripts/packs/c4.cs
Normal file
314
scripts/packs/c4.cs
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// C4
|
||||
// Used only in Search & Destroy gameMode
|
||||
// When deployed (must be deploying on an objective) a timer is started
|
||||
// When the timer runs out, objective goes boom and offence wins
|
||||
// But the bomb can be defused by defence.
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// shapebase datablocks
|
||||
datablock ShapeBaseImageData(C4Image)
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
item = C4Charge;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ItemData(C4Charge)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
image = C4Image;
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
pickUpName = "a C4";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(C4Deployed) : StaticShapeDamageProfile
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
explosion = SatchelMainExplosion;
|
||||
underwaterExplosion = UnderwaterSatchelMainExplosion;
|
||||
armDelay = 2500;
|
||||
maxDamage = 0.6;
|
||||
|
||||
disabledLevel = 0.5;
|
||||
destroyedLevel = 0.6;
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
renderWhenDestroyed = false;
|
||||
|
||||
kickBackStrength = 4000;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function C4::onUse(%this, %obj)
|
||||
{
|
||||
%item = new Item() {
|
||||
dataBlock = SatchelChargeTossed;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
};
|
||||
MissionCleanup.add(%item);
|
||||
// take pack out of inventory and unmount image
|
||||
%obj.decInventory(SatchelCharge, 1);
|
||||
%obj.throwObject(%item);
|
||||
%item.sourceObject = %obj;
|
||||
|
||||
// z0dd - ZOD, 5/16/02. Schedule a check to see if the satchel is at rest but not stuck to anything
|
||||
%item.checkCount = 0;
|
||||
%item.velocCheck = %item.getDataBlock().schedule(1000, "checkVelocity", %item);
|
||||
}
|
||||
|
||||
function initArmSatchelCharge(%satchel)
|
||||
{
|
||||
// "deet deet deet" sound
|
||||
%satchel.playAudio(1, SatchelChargeActivateSound);
|
||||
// also need to play "antenna extending" animation
|
||||
%satchel.playThread(0, "deploy");
|
||||
%satchel.playThread(1, "activate");
|
||||
|
||||
// delay the actual arming until after sound is done playing
|
||||
schedule( 2200, 0, "armSatchelCharge", %satchel );
|
||||
}
|
||||
|
||||
function armSatchelCharge(%satchel)
|
||||
{
|
||||
%satchel.armed = true;
|
||||
commandToClient( %satchel.sourceObject.client, 'setSatchelArmed' );
|
||||
}
|
||||
|
||||
function detonateSatchelCharge(%player)
|
||||
{
|
||||
%satchelCharge = %player.thrownChargeId;
|
||||
// can't detonate the satchel charge if it isn't armed
|
||||
if(!%satchelCharge.armed)
|
||||
return;
|
||||
|
||||
//error("Detonating satchel charge #" @ %satchelCharge @ " for player #" @ %player);
|
||||
|
||||
if(%satchelCharge.getDamageState() !$= Destroyed)
|
||||
{
|
||||
%satchelCharge.setDamageState(Destroyed);
|
||||
%satchelCharge.blowup();
|
||||
}
|
||||
|
||||
// Clear the player's HUD:
|
||||
%player.client.clearBackpackIcon();
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
|
||||
{
|
||||
// lava types
|
||||
if(%type >=4 && %type <= 6)
|
||||
{
|
||||
if(%obj.getDamageState() !$= "Destroyed")
|
||||
{
|
||||
%obj.armed = true;
|
||||
detonateSatchelCharge(%obj.sourceObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// quickSand
|
||||
if(%type == 7)
|
||||
if(isObject(%obj.sourceObject))
|
||||
%obj.sourceObject.thrownChargeId = 0;
|
||||
|
||||
Parent::onEnterLiquid(%data, %obj, %coverage, %type);
|
||||
}
|
||||
|
||||
function SatchelChargeImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
%obj.thrownChargeId = 0;
|
||||
}
|
||||
|
||||
function SatchelChargeImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onDestroyed(%this, %object, %lastState)
|
||||
{
|
||||
if(%object.kaboom)
|
||||
return;
|
||||
else
|
||||
{
|
||||
%object.kaboom = true;
|
||||
|
||||
// the "thwart" flag is set if the charge is destroyed with weapons rather
|
||||
// than detonated. A less damaging explosion, but visually the same scale.
|
||||
if(%object.thwart)
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge destroyed.");
|
||||
%dmgRadius = 15; // z0dd - ZOD, 9/27/02. Was 10
|
||||
%dmgMod = 0.35; // z0dd - ZOD, 9/27/02. Was 0.3
|
||||
%expImpulse = 2000; // z0dd - ZOD, 9/27/02. Was 1000
|
||||
%dmgType = $DamageType::Explosion;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge detonated!");
|
||||
%dmgRadius = 25; // z0dd - ZOD, 9/27/02. Was 20
|
||||
%dmgMod = 1.15; // z0dd - ZOD, 9/27/02. Was 1.0
|
||||
%expImpulse = 5000; // z0dd - ZOD, 9/27/02. Was 2500
|
||||
%dmgType = $DamageType::SatchelCharge;
|
||||
}
|
||||
|
||||
%object.blowingUp = true;
|
||||
RadiusExplosion(%object, %object.getPosition(), %dmgRadius, %dmgMod, %expImpulse, %object.sourceObject, %dmgType);
|
||||
|
||||
%object.schedule(1000, "delete");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// z0dd - ZOD, 4/25/02. Satchel bug fix. Prior to fix, clients couldn't pick up
|
||||
// packs when satchel was destroyed from dmg
|
||||
if(isObject(%object.sourceObject))
|
||||
%object.sourceObject.thrownChargeId = 0;
|
||||
// --------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onCollision(%data,%obj,%col)
|
||||
{
|
||||
// Do nothing...
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
if (!%object.blowingUp)
|
||||
{
|
||||
%targetObject.damaged += %amount;
|
||||
|
||||
if(%targetObject.damaged >= %targetObject.getDataBlock().maxDamage &&
|
||||
%targetObject.getDamageState() !$= Destroyed)
|
||||
{
|
||||
%targetObject.thwart = true;
|
||||
%targetObject.setDamageState(Destroyed);
|
||||
%targetObject.blowup();
|
||||
|
||||
// clear the player's HUD:
|
||||
%targetObject.sourceObject.client.clearBackPackIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelCharge::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
//**************************************************************
|
||||
// STICKY SATCHEL FUNCTIONS: z0dd - ZOD, 5/16/02
|
||||
//**************************************************************
|
||||
|
||||
function SatchelChargeTossed::onEnterLiquid(%data, %obj, %coverage, %type)
|
||||
{
|
||||
// If it lands in lava or quicksand, delete it
|
||||
if(%type >=4 && %type <= 7)
|
||||
{
|
||||
cancel(%obj.velocCheck);
|
||||
if(isObject(%obj.sourceObject))
|
||||
%obj.sourceObject.thrownChargeId = 0;
|
||||
|
||||
%obj.sourceObject.client.clearBackPackIcon();
|
||||
%obj.schedule(100, "delete");
|
||||
}
|
||||
else
|
||||
cancel(%obj.velocCheck);
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onLeaveLiquid(%data, %obj, %type)
|
||||
{
|
||||
// On the off chance it passes through to air, reschedule the velocity check
|
||||
%obj.checkCount = 0;
|
||||
%obj.velocCheck = %obj.getDataBlock().schedule(1000, "checkVelocity", %obj);
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onCollision(%data, %obj, %col)
|
||||
{
|
||||
// Lets keep thing from floating mid air, the check velocity should handle it afterwards
|
||||
if(%col.getType() & ($TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TurretObjectType))
|
||||
{
|
||||
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
||||
%vec = vectorScale(%vec, 15);
|
||||
%pos = %col.getWorldBoxCenter();
|
||||
%obj.applyImpulse(%pos, %vec);
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::checkVelocity(%data, %item)
|
||||
{
|
||||
%item.checkCount++;
|
||||
if(VectorLen(%item.getVelocity()) < 0.1)
|
||||
{
|
||||
// Satchel has come to rest but not activated, probably on a
|
||||
// staticshape (station, gen, etc) lets force activation
|
||||
cancel(%item.velocCheck);
|
||||
activateSatchel(posFromTransform(%item.getTransform()), rotFromTransform(%item.getTransform()), %item.sourceObject);
|
||||
%item.schedule(100, "delete");
|
||||
}
|
||||
else if(%item.checkCount >= 6)
|
||||
{
|
||||
// satchel's still moving but it's been checked several times,
|
||||
// probably thrown off face of earth, delete it
|
||||
cancel(%item.velocCheck);
|
||||
if(isObject(%item.sourceObject))
|
||||
%item.sourceObject.thrownChargeId = 0;
|
||||
|
||||
%item.sourceObject.client.clearBackPackIcon();
|
||||
%item.schedule(100, "delete");
|
||||
}
|
||||
else
|
||||
{
|
||||
// check back in a little while
|
||||
%item.velocCheck = %data.schedule(1000, "checkVelocity", %item);
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onStickyCollision(%data, %obj)
|
||||
{
|
||||
// We have sticky! Lets setup for the actual charge
|
||||
cancel(%obj.velocCheck);
|
||||
%pos = %obj.getLastStickyPos();
|
||||
%norm = %obj.getLastStickyNormal();
|
||||
%intAngle = getTerrainAngle(%norm);
|
||||
%rotAxis = vectorNormalize(vectorCross(%norm, "0 0 1"));
|
||||
if (getWord(%norm, 2) == 1 || getWord(%norm, 2) == -1)
|
||||
%rotAxis = vectorNormalize(vectorCross(%norm, "0 1 0"));
|
||||
|
||||
%rot = %rotAxis @ " " @ %intAngle;
|
||||
activateSatchel(%pos, %rot, %obj.sourceObject);
|
||||
%obj.schedule(50, "delete");
|
||||
}
|
||||
|
||||
function activateSatchel(%pos, %rot, %source)
|
||||
{
|
||||
// Create the charge and schedule arming
|
||||
%satchel = new StaticShape() {
|
||||
dataBlock = SatchelChargeThrown;
|
||||
sourceObject = %source;
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
};
|
||||
MissionCleanup.add(%satchel);
|
||||
%source.thrownChargeId = %satchel;
|
||||
%satchel.armed = false;
|
||||
%satchel.damaged = 0.0;
|
||||
%satchel.thwart = false;
|
||||
|
||||
// arm itself 2.5 seconds after creation
|
||||
schedule(%satchel.getDatablock().armDelay, %satchel, "initArmSatchelCharge", %satchel);
|
||||
messageClient(%source.client, 'MsgSatchelChargePlaced', "\c2Satchel charge deployed.");
|
||||
}
|
||||
166
scripts/packs/cloakingpack.cs
Normal file
166
scripts/packs/cloakingpack.cs
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
// ------------------------------------------------------------------
|
||||
// CLOAKING PACK
|
||||
//
|
||||
// When activated, this pack cloaks the user from all visual detection
|
||||
// by other players and cameras. This is a local effect only (someone standing
|
||||
// next to the cloaked player will still be visible). Motion sensors will
|
||||
// still detect a (moving) cloaked player.
|
||||
//
|
||||
// When not activated, the pack creates a localized passive sensor dampening
|
||||
// field. The user will not be visible to any non-motion-detecting sensor.
|
||||
//
|
||||
//Only light armors may equip with this item.
|
||||
|
||||
datablock EffectProfile(CloakingPackActivateEffect)
|
||||
{
|
||||
effectname = "packs/cloak_on";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock AudioProfile(CloakingPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/cloak_on.wav";
|
||||
description = CloseLooping3d;
|
||||
preload = true;
|
||||
effect = CloakingPackActivateEffect;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(CloakingPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_cloaking.dts";
|
||||
item = CloakingPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateSequence[1] = "fire";
|
||||
stateSound[1] = CloakingPackActivateSound;
|
||||
stateEnergyDrain[1] = 11.75; // z0dd - ZOD, 4/25/02. Improve cloak pack. Was 12
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(CloakingPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_cloaking.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "CloakingPackImage";
|
||||
pickUpName = "a cloaking pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function CloakingPackImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
// player is sensor-invisible while wearing pack (except to motion sensors)
|
||||
%obj.setPassiveJammed(true);
|
||||
}
|
||||
|
||||
function CloakingPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setPassiveJammed(false);
|
||||
%obj.setCloaked(false);
|
||||
%obj.setImageTrigger(%node, false);
|
||||
}
|
||||
|
||||
// make player completely invisible to all players/sensors (except motion)
|
||||
function CloakingPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
if(%obj.reCloak !$= "")
|
||||
{
|
||||
Cancel(%obj.reCloak);
|
||||
%obj.reCloak = "";
|
||||
}
|
||||
|
||||
if(%obj.client.armor $= "Light")
|
||||
{
|
||||
// can the player currently cloak (function returns "true" or reason for failure)?
|
||||
if(%obj.canCloak() $= "true")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgCloakingPackOn', '\c2Cloaking pack on.');
|
||||
%obj.setCloaked(true);
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setCloakIconOn' );
|
||||
}
|
||||
else
|
||||
{
|
||||
// notify player that they cannot cloak
|
||||
messageClient(%obj.client, 'MsgCloakingPackFailed', '\c2Jamming field prevents cloaking.');
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// hopefully avoid some loopholes
|
||||
messageClient(%obj.client, 'MsgCloakingPackInvalid', '\c2Cloaking available for light armors only.');
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
}
|
||||
}
|
||||
|
||||
function CloakingPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
if(%obj.reCloak !$= "")
|
||||
{
|
||||
Cancel(%obj.reCloak);
|
||||
%obj.reCloak = "";
|
||||
}
|
||||
|
||||
// if pack is not on then dont bother...
|
||||
if(%obj.getImageState($BackpackSlot) $= "activate")
|
||||
messageClient(%obj.client, 'MsgCloakingPackOff', '\c2Cloaking pack off.');
|
||||
|
||||
%obj.setCloaked(false);
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setCloakIconOff' );
|
||||
}
|
||||
|
||||
function CloakingPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function ShapeBaseData::onForceUncloak(%this, %obj, %reason)
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
|
||||
function Armor::onForceUncloak(%this, %obj, %reason)
|
||||
{
|
||||
%pack = %obj.getMountedImage($BackpackSlot);
|
||||
if((%pack <= 0) || (%pack.item !$= "CloakingPack"))
|
||||
return;
|
||||
|
||||
if(%obj.getImageState($BackpackSlot) $= "activate")
|
||||
{
|
||||
// cancel recloak thread
|
||||
if(%obj.reCloak !$= "")
|
||||
{
|
||||
Cancel(%obj.reCloak);
|
||||
%obj.reCloak = "";
|
||||
}
|
||||
|
||||
messageClient(%obj.client, 'MsgCloakingPackOff', '\c2Cloaking pack off. Jammed.');
|
||||
%obj.setCloaked(false);
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
}
|
||||
617
scripts/packs/miningTool.cs
Normal file
617
scripts/packs/miningTool.cs
Normal file
|
|
@ -0,0 +1,617 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Mining Tool
|
||||
// can be used by any armor type
|
||||
// when activated, gives user a "mining tool" that can be used to
|
||||
// mine rocks that contain various minerals that can be sold or
|
||||
// used by miner to build weapons, armor, and other objects.
|
||||
//
|
||||
// Note: Although this could've been intergrated into the repair gun
|
||||
// somehow (technically still repairs), it's been built as a seperate
|
||||
// pack for "balancing".
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
|
||||
datablock RepairProjectileData(MiningBeam)
|
||||
{
|
||||
sound = RepairPackFireSound;
|
||||
|
||||
beamRange = 10;
|
||||
beamWidth = 0.33;
|
||||
numSegments = 20;
|
||||
texRepeat = 0.20;
|
||||
blurFreq = 10.0;
|
||||
blurLifetime = 1.0;
|
||||
cutoffAngle = 25.0;
|
||||
|
||||
textures[0] = "special/ELFBeam";
|
||||
textures[1] = "special/BlueImpact";
|
||||
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// shapebase datablocks
|
||||
|
||||
datablock ShapeBaseImageData(MiningToolImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
item = MiningTool;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
emap = true;
|
||||
|
||||
gun = MiningToolGunImage;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateSequence[1] = "fire";
|
||||
stateSound[1] = RepairPackActivateSound;
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(MiningTool)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "MiningToolImage";
|
||||
pickUpName = "a mining tool";
|
||||
|
||||
lightOnlyStatic = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0 0 1 0";
|
||||
lightTime = 1200;
|
||||
lightRadius = 2.5; //It's just a mining tool folks..
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Mining Gun
|
||||
|
||||
datablock ShapeBaseImageData(MiningToolGunImage)
|
||||
{
|
||||
shapeFile = "weapon_repair.dts";
|
||||
offset = "0 0 0";
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
cutOffEnergy = 3.1;
|
||||
emap = true;
|
||||
|
||||
repairFactorPlayer = 0.002; // <--- attention DaveG!
|
||||
repairFactorObject = 0.004; // <--- attention DaveG!
|
||||
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnTimeout[0] = "ActivateReady";
|
||||
stateTimeoutValue[0] = 0.25;
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateScript[1] = "onActivateReady";
|
||||
stateSpinThread[1] = Stop;
|
||||
stateTransitionOnAmmo[1] = "Ready";
|
||||
stateTransitionOnNoAmmo[1] = "ActivateReady";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateSpinThread[2] = Stop;
|
||||
stateTransitionOnNoAmmo[2] = "Deactivate";
|
||||
stateTransitionOnTriggerDown[2] = "Validate";
|
||||
|
||||
stateName[3] = "Validate";
|
||||
stateTransitionOnTimeout[3] = "Validate";
|
||||
stateTimeoutValue[3] = 0.2;
|
||||
stateEnergyDrain[3] = 3;
|
||||
stateSpinThread[3] = SpinUp;
|
||||
stateScript[3] = "onValidate";
|
||||
stateIgnoreLoadedForReady[3] = true;
|
||||
stateTransitionOnLoaded[3] = "Mine";
|
||||
stateTransitionOnNoAmmo[3] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[3] = "Deactivate";
|
||||
|
||||
stateName[4] = "Mine";
|
||||
stateSound[4] = RepairPackFireSound;
|
||||
stateScript[4] = "onMine";
|
||||
stateSpinThread[4] = FullSpeed;
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "activate";
|
||||
stateFire[4] = true;
|
||||
stateEnergyDrain[4] = 9;
|
||||
stateTimeoutValue[4] = 0.2;
|
||||
stateTransitionOnTimeOut[4] = "Mine";
|
||||
stateTransitionOnNoAmmo[4] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[4] = "Deactivate";
|
||||
stateTransitionOnNotLoaded[4] = "Validate";
|
||||
|
||||
stateName[5] = "Deactivate";
|
||||
stateScript[5] = "onDeactivate";
|
||||
stateSpinThread[5] = SpinDown;
|
||||
stateSequence[5] = "activate";
|
||||
stateDirection[5] = false;
|
||||
stateTimeoutValue[5] = 0.2;
|
||||
stateTransitionOnTimeout[5] = "ActivateReady";
|
||||
};
|
||||
|
||||
function MiningToolImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
// dismount the mining gun if the player had it mounted
|
||||
// need the extra "if" statement to avoid a console error message
|
||||
if(%obj.getMountedImage($WeaponSlot))
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "MiningToolGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
// if the player was repairing something when the pack was thrown, stop repairing it
|
||||
if(%obj.repairing != 0)
|
||||
stopMining(%obj);
|
||||
}
|
||||
|
||||
function MiningToolImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
// don't activate the pack if player is piloting a vehicle
|
||||
if(%obj.isPilot())
|
||||
{
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isObject(%obj.getMountedImage($WeaponSlot)) || %obj.getMountedImage($WeaponSlot).getName() !$= "MiningToolGunImage")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Mining Tool activated.');
|
||||
|
||||
// make sure player's arm thread is "look"
|
||||
%obj.setArmThread(look);
|
||||
|
||||
// mount the repair gun
|
||||
%obj.mountImage(MiningToolGunImage, $WeaponSlot);
|
||||
// clientCmdsetRepairReticle found in hud.cs
|
||||
commandToClient(%obj.client, 'setRepairReticle');
|
||||
}
|
||||
}
|
||||
|
||||
function MiningToolImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
//called when the player hits the "pack" key again (toggle)
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
// if mining gun was mounted, unmount it
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "MiningToolGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
}
|
||||
|
||||
function MiningToolGunImage::onMount(%this,%obj,%slot)
|
||||
{
|
||||
%obj.setImageAmmo(%slot,true);
|
||||
if ( !isDemo() )
|
||||
commandToClient( %obj.client, 'setRepairPackIconOn' );
|
||||
}
|
||||
|
||||
function MiningToolGunImage::onUnmount(%this,%obj,%slot)
|
||||
{
|
||||
// called when player switches to another weapon
|
||||
|
||||
// stop mining whatever player was mining
|
||||
if(%obj.repairing)
|
||||
stopMining(%obj);
|
||||
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
// "turn off" the mining tool -- player needs to hit the "pack" key to
|
||||
// activate the mining gun again
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
if ( !isDemo() )
|
||||
commandToClient( %obj.client, 'setRepairPackIconOff' );
|
||||
}
|
||||
|
||||
function MiningToolGunImage::onActivateReady(%this,%obj,%slot)
|
||||
{
|
||||
%obj.errMsgSent = false;
|
||||
%obj.selfRepairing = false;
|
||||
%obj.repairing = 0;
|
||||
%obj.setImageLoaded(%slot, false);
|
||||
}
|
||||
|
||||
function MiningToolGunImage::onValidate(%this,%obj,%slot)
|
||||
{
|
||||
// this = miningtoolimage datablock
|
||||
// obj = player wielding the repair gun
|
||||
// slot = weapon slot
|
||||
|
||||
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
|
||||
{
|
||||
stopMining(%obj);
|
||||
return;
|
||||
}
|
||||
%repGun = %obj.getMountedImage(%slot);
|
||||
// muzVec is the vector coming from the mining gun's "muzzle"
|
||||
%muzVec = %obj.getMuzzleVector(%slot);
|
||||
// muzNVec = normalized muzVec
|
||||
%muzNVec = VectorNormalize(%muzVec);
|
||||
%repairRange = DefaultRepairBeam.beamRange;
|
||||
// scale muzNVec to the range the mining beam can reach
|
||||
%muzScaled = VectorScale(%muzNVec, %repairRange);
|
||||
// muzPoint = the actual point of the gun's "muzzle"
|
||||
%muzPoint = %obj.getMuzzlePoint(%slot);
|
||||
// rangeEnd = muzzle point + length of beam
|
||||
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
|
||||
// search for just about anything that can be damaged as well as interiors
|
||||
%searchMasks = $TypeMasks::StaticShapeObjectType;
|
||||
// search for objects within the beam's range that fit the masks above
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
// screen out interiors
|
||||
if(%scanTarg && !(%scanTarg.getType() & $TypeMasks::InteriorObjectType))
|
||||
{
|
||||
// a target in range was found
|
||||
%repTgt = firstWord(%scanTarg);
|
||||
// is the prospective target damaged?
|
||||
if(%repTgt.notRepairable)
|
||||
{
|
||||
// this is an object that cant be mined at all
|
||||
// -- mission specific flag set on the object
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackIrrepairable', '\c2Target cannot be mined.', %repTgt);
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
// if player was repairing something, stop the repairs -- we're done
|
||||
if(%obj.repairing)
|
||||
stopMining(%obj);
|
||||
}
|
||||
else if(%repTgt.getDamageLevel())
|
||||
{
|
||||
// yes, it's damaged
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
if(isObject(%obj.repairing))
|
||||
stopMining(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
}
|
||||
// setting imageLoaded to true sends us to repair state (function onRepair)
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is a target in range, but it's not damaged
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
// if the target isn't damaged, send a message to that effect only once
|
||||
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2Target is not damaged.', %repTgt);
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
// if player was repairing something, stop the repairs -- we're done
|
||||
if(%obj.repairing)
|
||||
stopMining(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
//AI hack - too many things influence the aiming, so I'm going to force the repair object for bots only
|
||||
else if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject))
|
||||
{
|
||||
%repTgt = %obj.client.repairObject;
|
||||
%repPoint = %repTgt.getAIRepairPoint();
|
||||
if (%repPoint $= "0 0 0")
|
||||
%repPoint = %repTgt.getWorldBoxCenter();
|
||||
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
|
||||
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
|
||||
|
||||
//if the dot product is very close (ie. we're aiming in the right direction)
|
||||
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
|
||||
{
|
||||
//do an LOS to make sure nothing is in the way...
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
|
||||
if (firstWord(%scanTarg) == %repTgt)
|
||||
{
|
||||
// yes, it's damaged
|
||||
|
||||
if(isObject(%obj.repairing))
|
||||
stopMining(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
// setting imageLoaded to true sends us to repair state (function onRepair)
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%obj.getDamageLevel())
|
||||
{
|
||||
// there is no target in range, but the player is damaged
|
||||
// check to see if we were repairing something before -- if so, stop repairing old target
|
||||
if(%obj.repairing != 0)
|
||||
if(%obj.repairing != %obj)
|
||||
stopMining(%obj);
|
||||
if(isObject(%obj.repairing))
|
||||
stopMining(%obj);
|
||||
|
||||
%obj.repairing = %obj;
|
||||
// quick, to onRepair!
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is no target in range, and the player isn't damaged
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
// send an error message only once
|
||||
messageClient(%obj.client, 'MsgRepairPackNoTarget', '\c2No target to mine.');
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
stopMining(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
function MiningToolGunImage::onMine(%this,%obj,%slot)
|
||||
{
|
||||
// this = repairgunimage datablock
|
||||
// obj = player wielding the repair gun
|
||||
// slot = weapon slot
|
||||
|
||||
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
|
||||
{
|
||||
stopMining(%obj);
|
||||
return;
|
||||
}
|
||||
// reset the flag that indicates an error message has been sent
|
||||
%obj.errMsgSent = false;
|
||||
%target = %obj.repairing;
|
||||
if(!%target)
|
||||
{
|
||||
// no target -- whoops! never mind
|
||||
stopMining(%obj);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// make sure we still have a target -- more vector fun!!!
|
||||
%muzVec = %obj.getMuzzleVector(%slot);
|
||||
%muzNVec = VectorNormalize(%muzVec);
|
||||
%repairRange = DefaultRepairBeam.beamRange;
|
||||
%muzScaled = VectorScale(%muzNVec, %repairRange);
|
||||
%muzPoint = %obj.getMuzzlePoint(%slot);
|
||||
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
|
||||
|
||||
%searchMasks = $TypeMasks::StaticShapeObjectType;
|
||||
|
||||
//AI hack to help "fudge" the repairing stuff...
|
||||
if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject) && %obj.client.repairObject == %obj.repairing)
|
||||
{
|
||||
%repTgt = %obj.client.repairObject;
|
||||
%repPoint = %repTgt.getAIRepairPoint();
|
||||
if (%repPoint $= "0 0 0")
|
||||
%repPoint = %repTgt.getWorldBoxCenter();
|
||||
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
|
||||
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
|
||||
|
||||
//if the dot product is very close (ie. we're aiming in the right direction)
|
||||
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
|
||||
}
|
||||
else
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
|
||||
if (%scanTarg)
|
||||
{
|
||||
%pos = getWords(%scanTarg, 1, 3);
|
||||
%obstructMask = $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType;
|
||||
%obstruction = ContainerRayCast(%muzPoint, %pos, %obstructMask, %obj);
|
||||
if (%obstruction)
|
||||
%scanTarg = "0";
|
||||
}
|
||||
|
||||
if(%scanTarg)
|
||||
{
|
||||
// there's still a target out there
|
||||
%repTgt = firstWord(%scanTarg);
|
||||
|
||||
if (%repTgt.mineral $= "")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgMineFail',"\c2Rock is empty as of now. Check back later.");
|
||||
%obj.errMsgSent = true;
|
||||
stopMining(%obj);
|
||||
return;
|
||||
}
|
||||
|
||||
// is the target damaged?
|
||||
if(%repTgt.getDamageLevel())
|
||||
{
|
||||
%obj.client.collected = %obj.client.collected + %obj.getRepairRate() + MiningToolGunImage.repairFactorPlayer;
|
||||
%obj.client.units[%obj.repairing.mineral] = %obj.client.units[%obj.repairing.mineral] + %obj.client.collected;
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
// the target is not the same as the one we were just repairing
|
||||
// stop repairing old target, start repairing new target
|
||||
stopRepairing(%obj);
|
||||
if(isObject(%obj.repairing))
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
// extract the name of what player is repairing based on what it is
|
||||
// if it's a player, it's the player's name (duh)
|
||||
// if it's an object, look for a nametag
|
||||
// if object has no nametag, just say what it is (e.g. generatorLarge)
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Mining rock.. (%3)', %tgtName, %repTgt, %repTgt.mineral);
|
||||
startMining(%obj, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's the same target as last time
|
||||
// changed to fix "2 players can't repair same object" bug
|
||||
if(%obj.repairProjectile == 0)
|
||||
{
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Mining Rock.. (%3)', %tgtName, %repTgt, %repTgt.mineral);
|
||||
startMining(%obj, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%rateOfRepair = %this.repairFactorObject;
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
{
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
%rateOfRepair = %this.repairFactorPlayer;
|
||||
}
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
// it isn't the same object we were repairing previously
|
||||
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2%1 is not damaged.', %tgtName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// same target, but not damaged -- we must be done
|
||||
messageClient(%obj.client, 'MsgRepairPackDone', '\c2Rock ran out of minerals.');
|
||||
stopMining(%obj); //Push this through to make sure client gets minerals..
|
||||
Game.objectRepaired(%repTgt, %tgtName);
|
||||
}
|
||||
%obj.errMsgSent = true;
|
||||
stopMining(%obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// whoops, we lost our target
|
||||
messageClient(%obj.client, 'MsgRepairPackLostTarget', '\c2No target to mine.');
|
||||
stopMining(%obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function MiningToolGunImage::onDeactivate(%this,%obj,%slot)
|
||||
{
|
||||
stopMining(%obj);
|
||||
}
|
||||
|
||||
function stopMining(%player)
|
||||
{
|
||||
// %player = the player who was using the repair pack
|
||||
|
||||
if(%player.selfRepairing)
|
||||
{
|
||||
// there is no projectile for self-repairing
|
||||
%player.setRepairRate(%player.getRepairRate() - %player.repairingRate);
|
||||
%player.selfRepairing = false;
|
||||
}
|
||||
else if(%player.repairing > 0)
|
||||
{
|
||||
// player was repairing something else
|
||||
//if(%player.repairing.beingRepaired > 0)
|
||||
//{
|
||||
// don't decrement this stuff if it's already at 0 -- though it shouldn't be
|
||||
//%player.repairing.beingRepaired--;
|
||||
%player.repairing.setRepairRate(%player.repairing.getRepairRate() - %player.repairingRate);
|
||||
//}
|
||||
if(%player.repairProjectile > 0)
|
||||
{
|
||||
// is there a repair projectile? delete it
|
||||
%player.repairProjectile.delete();
|
||||
%player.repairProjectile = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!%player.errMsgSent && isObject(%player.repairing) && %player.repairing.mineral !$= "") //Ok, player stopped mining. Give the player his/her WTF they mined.
|
||||
{
|
||||
%client = %player.client;
|
||||
%mineral = %player.repairing.mineral;
|
||||
%collected = %player.client.collected;
|
||||
%total = %client.units[%mineral];
|
||||
%obj = %player.repairing;
|
||||
|
||||
messageClient(%player.client,'msgMiningCollect','\c2Collected %1 units of %2. You now have %3 units of %2.',%collected,%mineral,%total);
|
||||
}
|
||||
|
||||
%player.client.collected = 0;
|
||||
%player.repairing = 0;
|
||||
%player.repairingRate = 0;
|
||||
%player.setImageTrigger($WeaponSlot, false);
|
||||
%player.setImageLoaded($WeaponSlot, false);
|
||||
}
|
||||
|
||||
function startMining(%player, %self)
|
||||
{
|
||||
// %player = the player who was using the repair pack
|
||||
// %self = boolean -- is player repairing him/herself?
|
||||
|
||||
if(%self)
|
||||
{
|
||||
// one repair, hold the projectile
|
||||
%player.setRepairRate(%player.getRepairRate() + MiningToolGunImage.repairFactorPlayer);
|
||||
%player.selfRepairing = true;
|
||||
%player.repairingRate = MiningToolGunImage.repairFactorPlayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if(%player.repairing.beingRepaired $= "")
|
||||
// %player.repairing.beingRepaired = 1;
|
||||
//else
|
||||
// %player.repairing.beingRepaired++;
|
||||
|
||||
//AI hack...
|
||||
if (%player.client.isAIControlled() && %player.client.repairObject == %player.repairing)
|
||||
{
|
||||
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
|
||||
%initialDirection = VectorSub(%initialPosition, %player.repairing.getWorldBoxCenter());
|
||||
}
|
||||
else
|
||||
{
|
||||
%initialDirection = %player.getMuzzleVector($WeaponSlot);
|
||||
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
|
||||
}
|
||||
if(%player.repairing.getClassName() $= Player)
|
||||
%repRate = RepairGunImage.repairFactorPlayer;
|
||||
else
|
||||
%repRate = RepairGunImage.repairFactorObject;
|
||||
%player.repairing.setRepairRate(%player.repairing.getRepairRate() + %repRate);
|
||||
|
||||
%player.repairingRate = %repRate;
|
||||
%player.repairProjectile = new RepairProjectile() {
|
||||
dataBlock = MiningBeam;
|
||||
initialDirection = %initialDirection;
|
||||
initialPosition = %initialPosition;
|
||||
sourceObject = %player;
|
||||
sourceSlot = $WeaponSlot;
|
||||
targetObject = %player.repairing;
|
||||
};
|
||||
// ----------------------------------------------------
|
||||
// z0dd - ZOD, 5/27/02. Fix lingering projectile bug
|
||||
if(isObject(%player.lastProjectile))
|
||||
%player.lastProjectile.delete();
|
||||
|
||||
%player.HP = %player.repairing.getDamageLevel(); //Is used when player stops 'mining'
|
||||
|
||||
%player.lastProjectile = %player.repairProjectile;
|
||||
// End z0dd - ZOD
|
||||
// ----------------------------------------------------
|
||||
MissionCleanup.add(%player.repairProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
function MiningTool::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
65
scripts/packs/missilebarrelPack.cs
Normal file
65
scripts/packs/missilebarrelPack.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MissileBarrelPackImage)
|
||||
{
|
||||
mass = 10; // z0dd - ZOD, 7/17/02. Lower mass due to higher gravity. Was 15.
|
||||
|
||||
className = TurretPack;
|
||||
|
||||
shapeFile = "pack_barrel_missile.dts";
|
||||
item = MissileBarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "MissileBarrelLarge";
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeOut[2] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
};
|
||||
|
||||
datablock ItemData(MissileBarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_missile.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "MissileBarrelPackImage";
|
||||
pickUpName = "a missile barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
//MissileBarrelPackImage.turretBarrel = "MissileBarrelLarge";
|
||||
|
||||
function MissileBarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function MissileBarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function MissileBarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
63
scripts/packs/mortarBarrelPack.cs
Normal file
63
scripts/packs/mortarBarrelPack.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MortarBarrelPackImage)
|
||||
{
|
||||
mass = 10; // z0dd - ZOD, 7/17/02. Lower mass due to higher gravity. Was 15.
|
||||
|
||||
className = TurretPack;
|
||||
|
||||
shapeFile = "pack_barrel_mortar.dts";
|
||||
item = MortarBarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "MortarBarrelLarge";
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeOut[2] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
};
|
||||
|
||||
datablock ItemData(MortarBarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_mortar.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "MortarBarrelPackImage";
|
||||
pickUpName = "a mortar barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function MortarBarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function MortarBarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function MortarBarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
61
scripts/packs/plasmabarrelPack.cs
Normal file
61
scripts/packs/plasmabarrelPack.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Plasma barrel pack
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(PlasmaBarrelPackImage)
|
||||
{
|
||||
mass = 10; // z0dd - ZOD, 7/17/02. Lower mass due to higher gravity. Was 15.
|
||||
|
||||
shapeFile = "pack_barrel_fusion.dts";
|
||||
item = PlasmaBarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "PlasmaBarrelLarge";
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeOut[2] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
};
|
||||
|
||||
datablock ItemData(PlasmaBarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_fusion.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "PlasmaBarrelPackImage";
|
||||
pickUpName = "a plasma barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function PlasmaBarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function PlasmaBarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function PlasmaBarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
643
scripts/packs/repairpack.cs
Normal file
643
scripts/packs/repairpack.cs
Normal file
|
|
@ -0,0 +1,643 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Repair Pack
|
||||
// can be used by any armor type
|
||||
// when activated, gives user a "repair gun" that can be used to
|
||||
// repair a damaged object or player. If there is no target in
|
||||
// range for the repair gun, the user is repaired.
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Sounds & feedback effects
|
||||
|
||||
datablock EffectProfile(RepairPackActivateEffect)
|
||||
{
|
||||
effectname = "packs/packs.repairPackOn";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock EffectProfile(RepairPackFireEffect)
|
||||
{
|
||||
effectname = "packs/repair_use";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 5.0;
|
||||
};
|
||||
|
||||
datablock AudioProfile(RepairPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/packs.repairPackOn.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
effect = RepairPackActivateEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(RepairPackFireSound)
|
||||
{
|
||||
filename = "fx/packs/repair_use.wav";
|
||||
description = CloseLooping3d;
|
||||
preload = true;
|
||||
effect = RepairPackFireEffect;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
|
||||
datablock RepairProjectileData(DefaultRepairBeam)
|
||||
{
|
||||
sound = RepairPackFireSound;
|
||||
|
||||
beamRange = 10;
|
||||
beamWidth = 0.15;
|
||||
numSegments = 20;
|
||||
texRepeat = 0.20;
|
||||
blurFreq = 10.0;
|
||||
blurLifetime = 1.0;
|
||||
cutoffAngle = 25.0;
|
||||
|
||||
textures[0] = "special/redbump2";
|
||||
textures[1] = "special/redflare";
|
||||
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// shapebase datablocks
|
||||
|
||||
datablock ShapeBaseImageData(RepairPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
item = RepairPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
emap = true;
|
||||
|
||||
gun = RepairGunImage;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateSequence[1] = "fire";
|
||||
stateSound[1] = RepairPackActivateSound;
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(RepairPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "RepairPackImage";
|
||||
pickUpName = "a repair pack";
|
||||
|
||||
lightOnlyStatic = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "1 0 0 1";
|
||||
lightTime = 1200;
|
||||
lightRadius = 4;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Repair Gun
|
||||
|
||||
datablock ShapeBaseImageData(RepairGunImage)
|
||||
{
|
||||
shapeFile = "weapon_repair.dts";
|
||||
offset = "0 0 0";
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
cutOffEnergy = 3.1;
|
||||
emap = true;
|
||||
|
||||
repairFactorPlayer = 0.002; // <--- attention DaveG!
|
||||
repairFactorObject = 0.005; // <--- attention DaveG! // z0dd - ZOD, 7/20/02. was 0.004
|
||||
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnTimeout[0] = "ActivateReady";
|
||||
stateTimeoutValue[0] = 0.25;
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateScript[1] = "onActivateReady";
|
||||
stateSpinThread[1] = Stop;
|
||||
stateTransitionOnAmmo[1] = "Ready";
|
||||
stateTransitionOnNoAmmo[1] = "ActivateReady";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateSpinThread[2] = Stop;
|
||||
stateTransitionOnNoAmmo[2] = "Deactivate";
|
||||
stateTransitionOnTriggerDown[2] = "Validate";
|
||||
|
||||
stateName[3] = "Validate";
|
||||
stateTransitionOnTimeout[3] = "Validate";
|
||||
stateTimeoutValue[3] = 0.2;
|
||||
stateEnergyDrain[3] = 3;
|
||||
stateSpinThread[3] = SpinUp;
|
||||
stateScript[3] = "onValidate";
|
||||
stateIgnoreLoadedForReady[3] = true;
|
||||
stateTransitionOnLoaded[3] = "Repair";
|
||||
stateTransitionOnNoAmmo[3] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[3] = "Deactivate";
|
||||
|
||||
stateName[4] = "Repair";
|
||||
stateSound[4] = RepairPackFireSound;
|
||||
stateScript[4] = "onRepair";
|
||||
stateSpinThread[4] = FullSpeed;
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "activate";
|
||||
stateFire[4] = true;
|
||||
stateEnergyDrain[4] = 9;
|
||||
stateTimeoutValue[4] = 0.2;
|
||||
stateTransitionOnTimeOut[4] = "Repair";
|
||||
stateTransitionOnNoAmmo[4] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[4] = "Deactivate";
|
||||
stateTransitionOnNotLoaded[4] = "Validate";
|
||||
|
||||
stateName[5] = "Deactivate";
|
||||
stateScript[5] = "onDeactivate";
|
||||
stateSpinThread[5] = SpinDown;
|
||||
stateSequence[5] = "activate";
|
||||
stateDirection[5] = false;
|
||||
stateTimeoutValue[5] = 0.2;
|
||||
stateTransitionOnTimeout[5] = "ActivateReady";
|
||||
};
|
||||
|
||||
function RepairPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
// dismount the repair gun if the player had it mounted
|
||||
// need the extra "if" statement to avoid a console error message
|
||||
if(%obj.getMountedImage($WeaponSlot))
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
// if the player was repairing something when the pack was thrown, stop repairing it
|
||||
if(%obj.repairing != 0)
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
|
||||
function RepairPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
// don't activate the pack if player is piloting a vehicle
|
||||
if(%obj.isPilot())
|
||||
{
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isObject(%obj.getMountedImage($WeaponSlot)) || %obj.getMountedImage($WeaponSlot).getName() !$= "RepairGunImage")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Repair pack activated.');
|
||||
|
||||
// make sure player's arm thread is "look"
|
||||
%obj.setArmThread(look);
|
||||
|
||||
// mount the repair gun
|
||||
%obj.mountImage(RepairGunImage, $WeaponSlot);
|
||||
// clientCmdsetRepairReticle found in hud.cs
|
||||
commandToClient(%obj.client, 'setRepairReticle');
|
||||
}
|
||||
}
|
||||
|
||||
function RepairPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
//called when the player hits the "pack" key again (toggle)
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
// if repair gun was mounted, unmount it
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
}
|
||||
|
||||
function RepairGunImage::onMount(%this,%obj,%slot)
|
||||
{
|
||||
%obj.setImageAmmo(%slot,true);
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setRepairPackIconOn' );
|
||||
}
|
||||
|
||||
function RepairGunImage::onUnmount(%this,%obj,%slot)
|
||||
{
|
||||
// called when player switches to another weapon
|
||||
|
||||
// stop repairing whatever player was repairing
|
||||
if(%obj.repairing)
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
// "turn off" the repair pack -- player needs to hit the "pack" key to
|
||||
// activate the repair gun again
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setRepairPackIconOff' );
|
||||
}
|
||||
|
||||
function RepairGunImage::onActivateReady(%this,%obj,%slot)
|
||||
{
|
||||
%obj.errMsgSent = false;
|
||||
%obj.selfRepairing = false;
|
||||
%obj.repairing = 0;
|
||||
%obj.setImageLoaded(%slot, false);
|
||||
}
|
||||
|
||||
function RepairGunImage::onValidate(%this,%obj,%slot)
|
||||
{
|
||||
// this = repairgunimage datablock
|
||||
// obj = player wielding the repair gun
|
||||
// slot = weapon slot
|
||||
|
||||
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
|
||||
{
|
||||
stopRepairing(%obj);
|
||||
return;
|
||||
}
|
||||
%repGun = %obj.getMountedImage(%slot);
|
||||
// muzVec is the vector coming from the repair gun's "muzzle"
|
||||
%muzVec = %obj.getMuzzleVector(%slot);
|
||||
// muzNVec = normalized muzVec
|
||||
%muzNVec = VectorNormalize(%muzVec);
|
||||
%repairRange = DefaultRepairBeam.beamRange;
|
||||
// scale muzNVec to the range the repair beam can reach
|
||||
%muzScaled = VectorScale(%muzNVec, %repairRange);
|
||||
// muzPoint = the actual point of the gun's "muzzle"
|
||||
%muzPoint = %obj.getMuzzlePoint(%slot);
|
||||
// rangeEnd = muzzle point + length of beam
|
||||
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
|
||||
// search for just about anything that can be damaged as well as interiors
|
||||
%searchMasks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType | $TypeMasks::InteriorObjectType;
|
||||
// search for objects within the beam's range that fit the masks above
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
// screen out interiors
|
||||
if(%scanTarg && !(%scanTarg.getType() & $TypeMasks::InteriorObjectType))
|
||||
{
|
||||
// a target in range was found
|
||||
%repTgt = firstWord(%scanTarg);
|
||||
// is the prospective target damaged?
|
||||
if(%repTgt.notRepairable)
|
||||
{
|
||||
// this is an object that cant be repaired at all
|
||||
// -- mission specific flag set on the object
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackIrrepairable', '\c2Target is not repairable.', %repTgt);
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
// if player was repairing something, stop the repairs -- we're done
|
||||
if(%obj.repairing)
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
else if(%repTgt.getDamageLevel())
|
||||
{
|
||||
// yes, it's damaged
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
if(isObject(%obj.repairing))
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
}
|
||||
// setting imageLoaded to true sends us to repair state (function onRepair)
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is a target in range, but it's not damaged
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
// if the target isn't damaged, send a message to that effect only once
|
||||
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2Target is not damaged.', %repTgt);
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
// if player was repairing something, stop the repairs -- we're done
|
||||
if(%obj.repairing)
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
//AI hack - too many things influence the aiming, so I'm going to force the repair object for bots only
|
||||
else if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject))
|
||||
{
|
||||
%repTgt = %obj.client.repairObject;
|
||||
%repPoint = %repTgt.getAIRepairPoint();
|
||||
if (%repPoint $= "0 0 0")
|
||||
%repPoint = %repTgt.getWorldBoxCenter();
|
||||
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
|
||||
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
|
||||
|
||||
//if the dot product is very close (ie. we're aiming in the right direction)
|
||||
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
|
||||
{
|
||||
//do an LOS to make sure nothing is in the way...
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
|
||||
if (firstWord(%scanTarg) == %repTgt)
|
||||
{
|
||||
// yes, it's damaged
|
||||
|
||||
if(isObject(%obj.repairing))
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
// setting imageLoaded to true sends us to repair state (function onRepair)
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%obj.getDamageLevel())
|
||||
{
|
||||
// there is no target in range, but the player is damaged
|
||||
// check to see if we were repairing something before -- if so, stop repairing old target
|
||||
if(%obj.repairing != 0)
|
||||
if(%obj.repairing != %obj)
|
||||
stopRepairing(%obj);
|
||||
if(isObject(%obj.repairing))
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.repairing = %obj;
|
||||
// quick, to onRepair!
|
||||
%obj.setImageLoaded(%slot, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is no target in range, and the player isn't damaged
|
||||
if(!%obj.errMsgSent)
|
||||
{
|
||||
// send an error message only once
|
||||
messageClient(%obj.client, 'MsgRepairPackNoTarget', '\c2No target to repair.');
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairGunImage::onRepair(%this,%obj,%slot)
|
||||
{
|
||||
// this = repairgunimage datablock
|
||||
// obj = player wielding the repair gun
|
||||
// slot = weapon slot
|
||||
|
||||
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
|
||||
{
|
||||
stopRepairing(%obj);
|
||||
return;
|
||||
}
|
||||
// reset the flag that indicates an error message has been sent
|
||||
%obj.errMsgSent = false;
|
||||
%target = %obj.repairing;
|
||||
if(!%target)
|
||||
{
|
||||
// no target -- whoops! never mind
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
%target.repairedBy = %obj.client; //keep track of who last repaired this item
|
||||
if(%obj.repairing == %obj)
|
||||
{
|
||||
// player is self-repairing
|
||||
if(%obj.getDamageLevel())
|
||||
{
|
||||
if(!%obj.selfRepairing)
|
||||
{
|
||||
// no need for a projectile, just send a message and up the repair rate
|
||||
messageClient(%obj.client, 'MsgRepairPackPlayerSelfRepair', '\c2Repairing self.');
|
||||
%obj.selfRepairing = true;
|
||||
startRepairing(%obj, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackSelfDone', '\c2Repairs completed on self.');
|
||||
stopRepairing(%obj);
|
||||
%obj.errMsgSent = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure we still have a target -- more vector fun!!!
|
||||
%muzVec = %obj.getMuzzleVector(%slot);
|
||||
%muzNVec = VectorNormalize(%muzVec);
|
||||
%repairRange = DefaultRepairBeam.beamRange;
|
||||
%muzScaled = VectorScale(%muzNVec, %repairRange);
|
||||
%muzPoint = %obj.getMuzzlePoint(%slot);
|
||||
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
|
||||
|
||||
%searchMasks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType;
|
||||
|
||||
//AI hack to help "fudge" the repairing stuff...
|
||||
if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject) && %obj.client.repairObject == %obj.repairing)
|
||||
{
|
||||
%repTgt = %obj.client.repairObject;
|
||||
%repPoint = %repTgt.getAIRepairPoint();
|
||||
if (%repPoint $= "0 0 0")
|
||||
%repPoint = %repTgt.getWorldBoxCenter();
|
||||
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
|
||||
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
|
||||
|
||||
//if the dot product is very close (ie. we're aiming in the right direction)
|
||||
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
|
||||
}
|
||||
else
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
|
||||
if (%scanTarg)
|
||||
{
|
||||
%pos = getWords(%scanTarg, 1, 3);
|
||||
%obstructMask = $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType;
|
||||
%obstruction = ContainerRayCast(%muzPoint, %pos, %obstructMask, %obj);
|
||||
if (%obstruction)
|
||||
%scanTarg = "0";
|
||||
}
|
||||
|
||||
if(%scanTarg)
|
||||
{
|
||||
// there's still a target out there
|
||||
%repTgt = firstWord(%scanTarg);
|
||||
// is the target damaged?
|
||||
if(%repTgt.getDamageLevel())
|
||||
{
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
// the target is not the same as the one we were just repairing
|
||||
// stop repairing old target, start repairing new target
|
||||
stopRepairing(%obj);
|
||||
if(isObject(%obj.repairing))
|
||||
stopRepairing(%obj);
|
||||
|
||||
%obj.repairing = %repTgt;
|
||||
// extract the name of what player is repairing based on what it is
|
||||
// if it's a player, it's the player's name (duh)
|
||||
// if it's an object, look for a nametag
|
||||
// if object has no nametag, just say what it is (e.g. generatorLarge)
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Repairing %1.', %tgtName, %repTgt);
|
||||
startRepairing(%obj, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's the same target as last time
|
||||
// changed to fix "2 players can't repair same object" bug
|
||||
if(%obj.repairProjectile == 0)
|
||||
{
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Repairing %1.', %tgtName, %repTgt);
|
||||
startRepairing(%obj, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%rateOfRepair = %this.repairFactorObject;
|
||||
if(%repTgt.getClassName() $= Player)
|
||||
{
|
||||
%tgtName = getTaggedString(%repTgt.client.name);
|
||||
%rateOfRepair = %this.repairFactorPlayer;
|
||||
}
|
||||
else if(%repTgt.getGameName() !$= "")
|
||||
%tgtName = %repTgt.getGameName();
|
||||
else
|
||||
%tgtName = %repTgt.getDatablock().getName();
|
||||
if(%repTgt != %obj.repairing)
|
||||
{
|
||||
// it isn't the same object we were repairing previously
|
||||
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2%1 is not damaged.', %tgtName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// same target, but not damaged -- we must be done
|
||||
messageClient(%obj.client, 'MsgRepairPackDone', '\c2Repairs completed.');
|
||||
Game.objectRepaired(%repTgt, %tgtName);
|
||||
}
|
||||
%obj.errMsgSent = true;
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// whoops, we lost our target
|
||||
messageClient(%obj.client, 'MsgRepairPackLostTarget', '\c2Repair target no longer in range.');
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RepairGunImage::onDeactivate(%this,%obj,%slot)
|
||||
{
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
|
||||
function stopRepairing(%player)
|
||||
{
|
||||
// %player = the player who was using the repair pack
|
||||
|
||||
if(%player.selfRepairing)
|
||||
{
|
||||
// there is no projectile for self-repairing
|
||||
%player.setRepairRate(%player.getRepairRate() - %player.repairingRate);
|
||||
%player.selfRepairing = false;
|
||||
}
|
||||
else if(%player.repairing > 0)
|
||||
{
|
||||
// player was repairing something else
|
||||
//if(%player.repairing.beingRepaired > 0)
|
||||
//{
|
||||
// don't decrement this stuff if it's already at 0 -- though it shouldn't be
|
||||
//%player.repairing.beingRepaired--;
|
||||
%player.repairing.setRepairRate(%player.repairing.getRepairRate() - %player.repairingRate);
|
||||
//}
|
||||
if(%player.repairProjectile > 0)
|
||||
{
|
||||
// is there a repair projectile? delete it
|
||||
%player.repairProjectile.delete();
|
||||
%player.repairProjectile = 0;
|
||||
}
|
||||
}
|
||||
%player.repairing = 0;
|
||||
%player.repairingRate = 0;
|
||||
%player.setImageTrigger($WeaponSlot, false);
|
||||
%player.setImageLoaded($WeaponSlot, false);
|
||||
}
|
||||
|
||||
function startRepairing(%player, %self)
|
||||
{
|
||||
// %player = the player who was using the repair pack
|
||||
// %self = boolean -- is player repairing him/herself?
|
||||
|
||||
if(%self)
|
||||
{
|
||||
// one repair, hold the projectile
|
||||
%player.setRepairRate(%player.getRepairRate() + RepairGunImage.repairFactorPlayer);
|
||||
%player.selfRepairing = true;
|
||||
%player.repairingRate = RepairGunImage.repairFactorPlayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if(%player.repairing.beingRepaired $= "")
|
||||
// %player.repairing.beingRepaired = 1;
|
||||
//else
|
||||
// %player.repairing.beingRepaired++;
|
||||
|
||||
//AI hack...
|
||||
if (%player.client.isAIControlled() && %player.client.repairObject == %player.repairing)
|
||||
{
|
||||
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
|
||||
%initialDirection = VectorSub(%initialPosition, %player.repairing.getWorldBoxCenter());
|
||||
}
|
||||
else
|
||||
{
|
||||
%initialDirection = %player.getMuzzleVector($WeaponSlot);
|
||||
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
|
||||
}
|
||||
if(%player.repairing.getClassName() $= Player)
|
||||
%repRate = RepairGunImage.repairFactorPlayer;
|
||||
else
|
||||
%repRate = RepairGunImage.repairFactorObject;
|
||||
%player.repairing.setRepairRate(%player.repairing.getRepairRate() + %repRate);
|
||||
|
||||
%player.repairingRate = %repRate;
|
||||
%player.repairProjectile = new RepairProjectile() {
|
||||
dataBlock = DefaultRepairBeam;
|
||||
initialDirection = %initialDirection;
|
||||
initialPosition = %initialPosition;
|
||||
sourceObject = %player;
|
||||
sourceSlot = $WeaponSlot;
|
||||
targetObject = %player.repairing;
|
||||
};
|
||||
// ----------------------------------------------------
|
||||
// z0dd - ZOD, 5/27/02. Fix lingering projectile bug
|
||||
if(isObject(%player.lastProjectile))
|
||||
%player.lastProjectile.delete();
|
||||
|
||||
%player.lastProjectile = %player.repairProjectile;
|
||||
// End z0dd - ZOD
|
||||
// ----------------------------------------------------
|
||||
MissionCleanup.add(%player.repairProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
843
scripts/packs/satchelCharge.cs
Normal file
843
scripts/packs/satchelCharge.cs
Normal file
|
|
@ -0,0 +1,843 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Satchel Charge pack
|
||||
// can be used by any armor type
|
||||
// when activated, throws the pack -- when activated again (before
|
||||
// picking up another pack), detonates with a BIG explosion.
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Sounds
|
||||
|
||||
datablock EffectProfile(SatchelChargeActivateEffect)
|
||||
{
|
||||
effectname = "packs/satchel_pack_activate";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock EffectProfile(SatchelChargeExplosionEffect)
|
||||
{
|
||||
effectname = "packs/satchel_pack_detonate";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 5.0;
|
||||
};
|
||||
|
||||
datablock EffectProfile(SatchelChargePreExplosionEffect)
|
||||
{
|
||||
effectname = "explosions/explosion.xpl03";
|
||||
minDistance = 10.0;
|
||||
maxDistance = 30.0;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SatchelChargeActivateSound)
|
||||
{
|
||||
filename = "fx/packs/satchel_pack_activate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
effect = SatchelChargeActivateEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SatchelChargeExplosionSound)
|
||||
{
|
||||
filename = "fx/packs/satchel_pack_detonate.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
effect = SatchelChargeExplosionEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SatchelChargePreExplosionSound)
|
||||
{
|
||||
filename = "fx/explosions/explosion.xpl03.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
effect = SatchelChargePreExplosionEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(UnderwaterSatchelChargeExplosionSound)
|
||||
{
|
||||
filename = "fx/weapons/mortar_explode_UW.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
effect = SatchelChargeExplosionEffect;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Satchel Debris
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ParticleData( SDebrisSmokeParticle )
|
||||
{
|
||||
dragCoeffiecient = 1.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.2;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
lifetimeVarianceMS = 100;
|
||||
|
||||
textureName = "particleTest";
|
||||
|
||||
useInvAlpha = true;
|
||||
|
||||
spinRandomMin = -60.0;
|
||||
spinRandomMax = 60.0;
|
||||
|
||||
colors[0] = "0.4 0.4 0.4 1.0";
|
||||
colors[1] = "0.3 0.3 0.3 0.5";
|
||||
colors[2] = "0.0 0.0 0.0 0.0";
|
||||
sizes[0] = 0.0;
|
||||
sizes[1] = 2.0;
|
||||
sizes[2] = 3.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData( SDebrisSmokeEmitter )
|
||||
{
|
||||
ejectionPeriodMS = 7;
|
||||
periodVarianceMS = 1;
|
||||
|
||||
ejectionVelocity = 1.0; // A little oomph at the back end
|
||||
velocityVariance = 0.2;
|
||||
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 40.0;
|
||||
|
||||
particles = "SDebrisSmokeParticle";
|
||||
};
|
||||
|
||||
|
||||
datablock DebrisData( SatchelDebris )
|
||||
{
|
||||
emitters[0] = SDebrisSmokeEmitter;
|
||||
|
||||
explodeOnMaxBounce = true;
|
||||
|
||||
elasticity = 0.4;
|
||||
friction = 0.2;
|
||||
|
||||
lifetime = 0.3;
|
||||
lifetimeVariance = 0.02;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Bubbles
|
||||
//----------------------------------------------------------------------------
|
||||
datablock ParticleData(SatchelBubbleParticle)
|
||||
{
|
||||
dragCoefficient = 0.0;
|
||||
gravityCoefficient = -0.25;
|
||||
inheritedVelFactor = 0.0;
|
||||
constantAcceleration = 0.0;
|
||||
lifetimeMS = 1500;
|
||||
lifetimeVarianceMS = 600;
|
||||
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] = 2.0;
|
||||
sizes[1] = 2.0;
|
||||
sizes[2] = 2.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.8;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(SatchelBubbleEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
ejectionVelocity = 1.0;
|
||||
ejectionOffset = 7.0;
|
||||
velocityVariance = 0.5;
|
||||
thetaMin = 0;
|
||||
thetaMax = 80;
|
||||
phiReferenceVel = 0;
|
||||
phiVariance = 360;
|
||||
overrideAdvances = false;
|
||||
particles = "MortarExplosionBubbleParticle";
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Satchel Explosion Particle effects
|
||||
//--------------------------------------
|
||||
datablock ParticleData(SatchelExplosionSmoke)
|
||||
{
|
||||
dragCoeffiecient = 0.4;
|
||||
gravityCoefficient = -0.0; // rises slowly
|
||||
inheritedVelFactor = 0.025;
|
||||
|
||||
lifetimeMS = 2000;
|
||||
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 0.5";
|
||||
colors[2] = "0.0 0.0 0.0 0.0";
|
||||
sizes[0] = 7.0;
|
||||
sizes[1] = 17.0;
|
||||
sizes[2] = 2.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.4;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(SatchelExplosionSmokeEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 14.25;
|
||||
velocityVariance = 2.25;
|
||||
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 180.0;
|
||||
|
||||
lifetimeMS = 200;
|
||||
|
||||
particles = "SatchelExplosionSmoke";
|
||||
};
|
||||
|
||||
datablock ParticleData(UnderwaterSatchelExplosionSmoke)
|
||||
{
|
||||
dragCoeffiecient = 105.0;
|
||||
gravityCoefficient = -0.0;
|
||||
inheritedVelFactor = 0.025;
|
||||
|
||||
constantAcceleration = -1.0;
|
||||
|
||||
lifetimeMS = 1500;
|
||||
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] = 7.0;
|
||||
sizes[1] = 17.0;
|
||||
sizes[2] = 2.0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.2;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(UnderwaterSatchelExplosionSmokeEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 14.25;
|
||||
velocityVariance = 2.25;
|
||||
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 180.0;
|
||||
|
||||
lifetimeMS = 200;
|
||||
|
||||
particles = "UnderwaterSatchelExplosionSmoke";
|
||||
};
|
||||
|
||||
|
||||
datablock ParticleData(SatchelSparks)
|
||||
{
|
||||
dragCoefficient = 1;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.2;
|
||||
constantAcceleration = 0.0;
|
||||
lifetimeMS = 500;
|
||||
lifetimeVarianceMS = 150;
|
||||
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.5;
|
||||
sizes[2] = 0.75;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(SatchelSparksEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 1;
|
||||
periodVarianceMS = 0;
|
||||
ejectionVelocity = 40;
|
||||
velocityVariance = 20.0;
|
||||
ejectionOffset = 0.0;
|
||||
thetaMin = 0;
|
||||
thetaMax = 180;
|
||||
phiReferenceVel = 0;
|
||||
phiVariance = 360;
|
||||
overrideAdvances = false;
|
||||
orientParticles = true;
|
||||
lifetimeMS = 200;
|
||||
particles = "SatchelSparks";
|
||||
};
|
||||
|
||||
datablock ParticleData(UnderwaterSatchelSparks)
|
||||
{
|
||||
dragCoefficient = 1;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.2;
|
||||
constantAcceleration = 0.0;
|
||||
lifetimeMS = 500;
|
||||
lifetimeVarianceMS = 350;
|
||||
textureName = "special/underwaterSpark";
|
||||
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.5;
|
||||
sizes[2] = 0.75;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(UnderwaterSatchelSparksEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 2;
|
||||
periodVarianceMS = 0;
|
||||
ejectionVelocity = 30;
|
||||
velocityVariance = 5.0;
|
||||
ejectionOffset = 0.0;
|
||||
thetaMin = 0;
|
||||
thetaMax = 70;
|
||||
phiReferenceVel = 0;
|
||||
phiVariance = 360;
|
||||
overrideAdvances = false;
|
||||
orientParticles = true;
|
||||
lifetimeMS = 100;
|
||||
particles = "UnderwaterSatchelSparks";
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Explosion
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
datablock ExplosionData(SatchelSubExplosion)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "0.5 0.5 0.5";
|
||||
|
||||
debris = SatchelDebris;
|
||||
debrisThetaMin = 10;
|
||||
debrisThetaMax = 80;
|
||||
debrisNum = 8;
|
||||
debrisVelocity = 60.0;
|
||||
debrisVelocityVariance = 15.0;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
delayMS = 0;
|
||||
|
||||
emitter[0] = SatchelExplosionSmokeEmitter;
|
||||
emitter[1] = SatchelSparksEmitter;
|
||||
|
||||
offset = 0.0;
|
||||
|
||||
playSpeed = 1.5;
|
||||
|
||||
sizes[0] = "1.5 1.5 1.5";
|
||||
sizes[1] = "3.0 3.0 3.0";
|
||||
times[0] = 0.0;
|
||||
times[1] = 1.0;
|
||||
};
|
||||
|
||||
datablock ExplosionData(SatchelSubExplosion2)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "0.7 0.7 0.7";
|
||||
|
||||
debris = SatchelDebris;
|
||||
debrisThetaMin = 10;
|
||||
debrisThetaMax = 170;
|
||||
debrisNum = 8;
|
||||
debrisVelocity = 60.0;
|
||||
debrisVelocityVariance = 15.0;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
delayMS = 50;
|
||||
|
||||
emitter[0] = SatchelExplosionSmokeEmitter;
|
||||
emitter[1] = SatchelSparksEmitter;
|
||||
|
||||
offset = 9.0;
|
||||
|
||||
playSpeed = 1.5;
|
||||
|
||||
sizes[0] = "1.5 1.5 1.5";
|
||||
sizes[1] = "1.5 1.5 1.5";
|
||||
times[0] = 0.0;
|
||||
times[1] = 1.0;
|
||||
};
|
||||
|
||||
datablock ExplosionData(SatchelSubExplosion3)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "1.0 1.0 1.0";
|
||||
|
||||
debris = SatchelDebris;
|
||||
debrisThetaMin = 10;
|
||||
debrisThetaMax = 170;
|
||||
debrisNum = 8;
|
||||
debrisVelocity = 60.0;
|
||||
debrisVelocityVariance = 15.0;
|
||||
|
||||
lifetimeMS = 2000;
|
||||
delayMS = 100;
|
||||
|
||||
emitter[0] = SatchelExplosionSmokeEmitter;
|
||||
emitter[1] = SatchelSparksEmitter;
|
||||
|
||||
offset = 9.0;
|
||||
|
||||
playSpeed = 2.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;
|
||||
};
|
||||
|
||||
datablock ExplosionData(SatchelMainExplosion)
|
||||
{
|
||||
soundProfile = SatchelChargePreExplosionSound;
|
||||
|
||||
subExplosion[0] = SatchelSubExplosion;
|
||||
subExplosion[1] = SatchelSubExplosion2;
|
||||
subExplosion[2] = SatchelSubExplosion3;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Underwater Explosion
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
datablock ExplosionData(UnderwaterSatchelSubExplosion)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "0.5 0.5 0.5";
|
||||
|
||||
|
||||
lifetimeMS = 1000;
|
||||
delayMS = 0;
|
||||
|
||||
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
|
||||
emitter[1] = UnderwaterSatchelSparksEmitter;
|
||||
emitter[2] = SatchelBubbleEmitter;
|
||||
|
||||
offset = 0.0;
|
||||
|
||||
playSpeed = 0.75;
|
||||
|
||||
sizes[0] = "1.5 1.5 1.5";
|
||||
sizes[1] = "2.5 2.5 2.5";
|
||||
sizes[2] = "2.0 2.0 2.0";
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ExplosionData(UnderwaterSatchelSubExplosion2)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "0.7 0.7 0.7";
|
||||
|
||||
|
||||
lifetimeMS = 1000;
|
||||
delayMS = 50;
|
||||
|
||||
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
|
||||
emitter[1] = UnderwaterSatchelSparksEmitter;
|
||||
emitter[2] = SatchelBubbleEmitter;
|
||||
|
||||
offset = 9.0;
|
||||
|
||||
playSpeed = 0.75;
|
||||
|
||||
sizes[0] = "1.5 1.5 1.5";
|
||||
sizes[1] = "1.0 1.0 1.0";
|
||||
sizes[2] = "0.75 0.75 0.75";
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ExplosionData(UnderwaterSatchelSubExplosion3)
|
||||
{
|
||||
explosionShape = "disc_explosion.dts";
|
||||
faceViewer = true;
|
||||
explosionScale = "1.0 1.0 1.0";
|
||||
|
||||
|
||||
lifetimeMS = 2000;
|
||||
delayMS = 100;
|
||||
|
||||
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
|
||||
emitter[1] = UnderwaterSatchelSparksEmitter;
|
||||
emitter[2] = SatchelBubbleEmitter;
|
||||
|
||||
offset = 9.0;
|
||||
|
||||
playSpeed = 1.25;
|
||||
|
||||
sizes[0] = "1.0 1.0 1.0";
|
||||
sizes[1] = "1.0 1.0 1.0";
|
||||
sizes[2] = "0.5 0.5 0.5";
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ExplosionData(UnderwaterSatchelMainExplosion)
|
||||
{
|
||||
soundProfile = UnderwaterSatchelChargeExplosionSound;
|
||||
|
||||
subExplosion[0] = UnderwaterSatchelSubExplosion;
|
||||
subExplosion[1] = UnderwaterSatchelSubExplosion2;
|
||||
subExplosion[2] = UnderwaterSatchelSubExplosion3;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// shapebase datablocks
|
||||
datablock ShapeBaseImageData(SatchelChargeImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
item = SatchelCharge;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ItemData(SatchelCharge)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
image = SatchelChargeImage;
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
pickUpName = "a satchel charge pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock ItemData(SatchelChargeTossed)
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
mass = 1.2;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
rotate = false;
|
||||
pickupRadius = 0;
|
||||
noTimeout = true;
|
||||
sticky = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(SatchelChargeThrown) : StaticShapeDamageProfile
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
explosion = SatchelMainExplosion;
|
||||
underwaterExplosion = UnderwaterSatchelMainExplosion;
|
||||
armDelay = 2500;
|
||||
maxDamage = 0.6;
|
||||
|
||||
disabledLevel = 0.5;
|
||||
destroyedLevel = 0.6;
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
renderWhenDestroyed = false;
|
||||
|
||||
kickBackStrength = 4000;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function SatchelCharge::onUse(%this, %obj)
|
||||
{
|
||||
%item = new Item() {
|
||||
dataBlock = SatchelChargeTossed;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
};
|
||||
MissionCleanup.add(%item);
|
||||
// take pack out of inventory and unmount image
|
||||
%obj.decInventory(SatchelCharge, 1);
|
||||
%obj.throwObject(%item);
|
||||
%item.sourceObject = %obj;
|
||||
|
||||
// z0dd - ZOD, 5/16/02. Schedule a check to see if the satchel is at rest but not stuck to anything
|
||||
%item.checkCount = 0;
|
||||
%item.velocCheck = %item.getDataBlock().schedule(1000, "checkVelocity", %item);
|
||||
}
|
||||
|
||||
function initArmSatchelCharge(%satchel)
|
||||
{
|
||||
// "deet deet deet" sound
|
||||
%satchel.playAudio(1, SatchelChargeActivateSound);
|
||||
// also need to play "antenna extending" animation
|
||||
%satchel.playThread(0, "deploy");
|
||||
%satchel.playThread(1, "activate");
|
||||
|
||||
// delay the actual arming until after sound is done playing
|
||||
schedule( 2200, 0, "armSatchelCharge", %satchel );
|
||||
}
|
||||
|
||||
function armSatchelCharge(%satchel)
|
||||
{
|
||||
%satchel.armed = true;
|
||||
commandToClient( %satchel.sourceObject.client, 'setSatchelArmed' );
|
||||
}
|
||||
|
||||
function detonateSatchelCharge(%player)
|
||||
{
|
||||
%satchelCharge = %player.thrownChargeId;
|
||||
// can't detonate the satchel charge if it isn't armed
|
||||
if(!%satchelCharge.armed)
|
||||
return;
|
||||
|
||||
//error("Detonating satchel charge #" @ %satchelCharge @ " for player #" @ %player);
|
||||
|
||||
if(%satchelCharge.getDamageState() !$= Destroyed)
|
||||
{
|
||||
%satchelCharge.setDamageState(Destroyed);
|
||||
%satchelCharge.blowup();
|
||||
}
|
||||
|
||||
// Clear the player's HUD:
|
||||
%player.client.clearBackpackIcon();
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
|
||||
{
|
||||
// lava types
|
||||
if(%type >=4 && %type <= 6)
|
||||
{
|
||||
if(%obj.getDamageState() !$= "Destroyed")
|
||||
{
|
||||
%obj.armed = true;
|
||||
detonateSatchelCharge(%obj.sourceObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// quickSand
|
||||
if(%type == 7)
|
||||
if(isObject(%obj.sourceObject))
|
||||
%obj.sourceObject.thrownChargeId = 0;
|
||||
|
||||
Parent::onEnterLiquid(%data, %obj, %coverage, %type);
|
||||
}
|
||||
|
||||
function SatchelChargeImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
%obj.thrownChargeId = 0;
|
||||
}
|
||||
|
||||
function SatchelChargeImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onDestroyed(%this, %object, %lastState)
|
||||
{
|
||||
if(%object.kaboom)
|
||||
return;
|
||||
else
|
||||
{
|
||||
%object.kaboom = true;
|
||||
|
||||
// the "thwart" flag is set if the charge is destroyed with weapons rather
|
||||
// than detonated. A less damaging explosion, but visually the same scale.
|
||||
if(%object.thwart)
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge destroyed.");
|
||||
%dmgRadius = 15; // z0dd - ZOD, 9/27/02. Was 10
|
||||
%dmgMod = 0.35; // z0dd - ZOD, 9/27/02. Was 0.3
|
||||
%expImpulse = 2000; // z0dd - ZOD, 9/27/02. Was 1000
|
||||
%dmgType = $DamageType::Explosion;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge detonated!");
|
||||
%dmgRadius = 25; // z0dd - ZOD, 9/27/02. Was 20
|
||||
%dmgMod = 1.15; // z0dd - ZOD, 9/27/02. Was 1.0
|
||||
%expImpulse = 5000; // z0dd - ZOD, 9/27/02. Was 2500
|
||||
%dmgType = $DamageType::SatchelCharge;
|
||||
}
|
||||
|
||||
%object.blowingUp = true;
|
||||
RadiusExplosion(%object, %object.getPosition(), %dmgRadius, %dmgMod, %expImpulse, %object.sourceObject, %dmgType);
|
||||
|
||||
%object.schedule(1000, "delete");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// z0dd - ZOD, 4/25/02. Satchel bug fix. Prior to fix, clients couldn't pick up
|
||||
// packs when satchel was destroyed from dmg
|
||||
if(isObject(%object.sourceObject))
|
||||
%object.sourceObject.thrownChargeId = 0;
|
||||
// --------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onCollision(%data,%obj,%col)
|
||||
{
|
||||
// Do nothing...
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
if (!%object.blowingUp)
|
||||
{
|
||||
%targetObject.damaged += %amount;
|
||||
|
||||
if(%targetObject.damaged >= %targetObject.getDataBlock().maxDamage &&
|
||||
%targetObject.getDamageState() !$= Destroyed)
|
||||
{
|
||||
%targetObject.thwart = true;
|
||||
%targetObject.setDamageState(Destroyed);
|
||||
%targetObject.blowup();
|
||||
|
||||
// clear the player's HUD:
|
||||
%targetObject.sourceObject.client.clearBackPackIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelCharge::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
//**************************************************************
|
||||
// STICKY SATCHEL FUNCTIONS: z0dd - ZOD, 5/16/02
|
||||
//**************************************************************
|
||||
|
||||
function SatchelChargeTossed::onEnterLiquid(%data, %obj, %coverage, %type)
|
||||
{
|
||||
// If it lands in lava or quicksand, delete it
|
||||
if(%type >=4 && %type <= 7)
|
||||
{
|
||||
cancel(%obj.velocCheck);
|
||||
if(isObject(%obj.sourceObject))
|
||||
%obj.sourceObject.thrownChargeId = 0;
|
||||
|
||||
%obj.sourceObject.client.clearBackPackIcon();
|
||||
%obj.schedule(100, "delete");
|
||||
}
|
||||
else
|
||||
cancel(%obj.velocCheck);
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onLeaveLiquid(%data, %obj, %type)
|
||||
{
|
||||
// On the off chance it passes through to air, reschedule the velocity check
|
||||
%obj.checkCount = 0;
|
||||
%obj.velocCheck = %obj.getDataBlock().schedule(1000, "checkVelocity", %obj);
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onCollision(%data, %obj, %col)
|
||||
{
|
||||
// Lets keep thing from floating mid air, the check velocity should handle it afterwards
|
||||
if(%col.getType() & ($TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TurretObjectType))
|
||||
{
|
||||
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
||||
%vec = vectorScale(%vec, 15);
|
||||
%pos = %col.getWorldBoxCenter();
|
||||
%obj.applyImpulse(%pos, %vec);
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::checkVelocity(%data, %item)
|
||||
{
|
||||
%item.checkCount++;
|
||||
if(VectorLen(%item.getVelocity()) < 0.1)
|
||||
{
|
||||
// Satchel has come to rest but not activated, probably on a
|
||||
// staticshape (station, gen, etc) lets force activation
|
||||
cancel(%item.velocCheck);
|
||||
activateSatchel(posFromTransform(%item.getTransform()), rotFromTransform(%item.getTransform()), %item.sourceObject);
|
||||
%item.schedule(100, "delete");
|
||||
}
|
||||
else if(%item.checkCount >= 6)
|
||||
{
|
||||
// satchel's still moving but it's been checked several times,
|
||||
// probably thrown off face of earth, delete it
|
||||
cancel(%item.velocCheck);
|
||||
if(isObject(%item.sourceObject))
|
||||
%item.sourceObject.thrownChargeId = 0;
|
||||
|
||||
%item.sourceObject.client.clearBackPackIcon();
|
||||
%item.schedule(100, "delete");
|
||||
}
|
||||
else
|
||||
{
|
||||
// check back in a little while
|
||||
%item.velocCheck = %data.schedule(1000, "checkVelocity", %item);
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelChargeTossed::onStickyCollision(%data, %obj)
|
||||
{
|
||||
// We have sticky! Lets setup for the actual charge
|
||||
cancel(%obj.velocCheck);
|
||||
%pos = %obj.getLastStickyPos();
|
||||
%norm = %obj.getLastStickyNormal();
|
||||
%intAngle = getTerrainAngle(%norm);
|
||||
%rotAxis = vectorNormalize(vectorCross(%norm, "0 0 1"));
|
||||
if (getWord(%norm, 2) == 1 || getWord(%norm, 2) == -1)
|
||||
%rotAxis = vectorNormalize(vectorCross(%norm, "0 1 0"));
|
||||
|
||||
%rot = %rotAxis @ " " @ %intAngle;
|
||||
activateSatchel(%pos, %rot, %obj.sourceObject);
|
||||
%obj.schedule(50, "delete");
|
||||
}
|
||||
|
||||
function activateSatchel(%pos, %rot, %source)
|
||||
{
|
||||
// Create the charge and schedule arming
|
||||
%satchel = new StaticShape() {
|
||||
dataBlock = SatchelChargeThrown;
|
||||
sourceObject = %source;
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
};
|
||||
MissionCleanup.add(%satchel);
|
||||
%source.thrownChargeId = %satchel;
|
||||
%satchel.armed = false;
|
||||
%satchel.damaged = 0.0;
|
||||
%satchel.thwart = false;
|
||||
|
||||
// arm itself 2.5 seconds after creation
|
||||
schedule(%satchel.getDatablock().armDelay, %satchel, "initArmSatchelCharge", %satchel);
|
||||
messageClient(%source.client, 'MsgSatchelChargePlaced', "\c2Satchel charge deployed.");
|
||||
}
|
||||
146
scripts/packs/sensorjammerpack.cs
Normal file
146
scripts/packs/sensorjammerpack.cs
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
// ------------------------------------------------------------------
|
||||
// SENSOR JAMMER PACK
|
||||
//
|
||||
// When activated, the sensor jammer pack emits a sensor-jamming field of
|
||||
// 20m radius. Any players within this field are completely invisible to
|
||||
// all sensors, turrets and cameras.
|
||||
//
|
||||
// When not activated, the pack has no effect.
|
||||
//
|
||||
datablock EffectProfile(SensorJammerPackActivateEffect)
|
||||
{
|
||||
effectname = "packs/cloak_on";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SensorJammerActivateSound)
|
||||
{
|
||||
filename = "fx/packs/sensorjammerpack_on.wav";
|
||||
description = ClosestLooping3d;
|
||||
preload = true;
|
||||
effect = SensorJammerPackActivateEffect;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(SensorJammerPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_sensorjammer.dts";
|
||||
item = SensorJammerPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateSequence[1] = "fire";
|
||||
stateSound[1] = SensorJammerActivateSound;
|
||||
stateEnergyDrain[1] = 10.5;
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(SensorJammerPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_sensorjammer.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "SensorJammerPackImage";
|
||||
pickUpName = "a sensor jammer pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock SensorData(JammerSensorObjectPassive)
|
||||
{
|
||||
// same detection info as 'PlayerObject' sensorData
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = true;
|
||||
detectRadius = 2000;
|
||||
detectionPings = false;
|
||||
detectsFOVOnly = true;
|
||||
detectFOVPercent = 1.3;
|
||||
useObjectFOV = true;
|
||||
|
||||
jams = true;
|
||||
jamsOnlyGroup = true;
|
||||
jamsUsingLOS = true;
|
||||
jamRadius = 0;
|
||||
};
|
||||
|
||||
datablock SensorData(JammerSensorObjectActive)
|
||||
{
|
||||
// same detection info as 'PlayerObject' sensorData
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = true;
|
||||
detectRadius = 2000;
|
||||
detectionPings = false;
|
||||
detectsFOVOnly = true;
|
||||
detectFOVPercent = 1.3;
|
||||
useObjectFOV = true;
|
||||
|
||||
jams = true;
|
||||
jamsOnlyGroup = true;
|
||||
jamsUsingLOS = true;
|
||||
jamRadius = 30;
|
||||
};
|
||||
|
||||
function SensorJammerPackImage::onMount(%data, %obj, %slot)
|
||||
{
|
||||
setTargetSensorData(%obj.client.target, JammerSensorObjectPassive);
|
||||
}
|
||||
|
||||
function SensorJammerPackImage::onUnmount(%data, %obj, %slot)
|
||||
{
|
||||
setTargetSensorData(%obj.client.target, PlayerSensor);
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
}
|
||||
|
||||
function SensorJammerPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgSensorJammerPackOn', '\c2Sensor jammer pack on.');
|
||||
setTargetSensorData(%obj.client.target, JammerSensorObjectActive);
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setSenJamIconOn' );
|
||||
|
||||
%obj.setJammerFX( true );
|
||||
}
|
||||
|
||||
function SensorJammerPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgSensorJammerPackOff', '\c2Sensor jammer pack off.');
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// z0dd - ZOD, 4/25/02. This function is actually getting called AFTER
|
||||
// ::onUnmount. We must check to see what the players current sensor data
|
||||
// is, then if it is NOT PlayerSensor, set to passive jam, bug fix.
|
||||
if(getTargetSensorData(%obj.client.target).getName() !$= "PlayerSensor")
|
||||
setTargetSensorData(%obj.client.target, JammerSensorObjectPassive);
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// z0dd - ZOD, 9/29/02. Removed T2 demo code from here
|
||||
commandToClient( %obj.client, 'setSenJamIconOff' );
|
||||
|
||||
%obj.setJammerFX( false );
|
||||
}
|
||||
|
||||
function SensorJammerPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue