mirror of
https://github.com/Ragora/TribesReplay.git
synced 2026-07-14 21:34:31 +00:00
v21570: Initial Tribes 2 release.
This commit is contained in:
commit
adad8c0787
477 changed files with 239361 additions and 0 deletions
61
base/scripts/packs/ELFbarrelPack.cs
Normal file
61
base/scripts/packs/ELFbarrelPack.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// ELF barrel pack
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(ELFBarrelPackImage)
|
||||
{
|
||||
mass = 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
base/scripts/packs/aabarrelPack.cs
Normal file
63
base/scripts/packs/aabarrelPack.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(AABarrelPackImage)
|
||||
{
|
||||
mass = 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
|
||||
}
|
||||
311
base/scripts/packs/ammopack.cs
Normal file
311
base/scripts/packs/ammopack.cs
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
// ------------------------------------------------------------------
|
||||
// AMMO PACK
|
||||
// can be used by any armor type
|
||||
// uses no energy, does not have to be activated
|
||||
// increases the max amount of non-energy ammo carried
|
||||
|
||||
// put vars here for ammo max counts with ammo pack
|
||||
|
||||
$AmmoItem[0] = PlasmaAmmo;
|
||||
$AmmoItem[1] = ChaingunAmmo;
|
||||
$AmmoItem[2] = DiscAmmo;
|
||||
$AmmoItem[3] = GrenadeLauncherAmmo;
|
||||
$AmmoItem[4] = MortarAmmo;
|
||||
$AmmoItem[5] = MissileLauncherAmmo;
|
||||
$AmmoItem[6] = RepairKit;
|
||||
|
||||
$numAmmoItems = 7;
|
||||
|
||||
$grenAmmoType[0] = Grenade;
|
||||
$grenAmmoType[1] = ConcussionGrenade;
|
||||
$grenAmmoType[2] = FlashGrenade;
|
||||
$grenAmmoType[3] = FlareGrenade;
|
||||
|
||||
$numGrenTypes = 4;
|
||||
|
||||
datablock ShapeBaseImageData(AmmoPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
item = AmmoPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
};
|
||||
|
||||
datablock ItemData(AmmoPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "AmmoPackImage";
|
||||
pickUpName = "an ammo pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
|
||||
// lightType = "PulsingLight";
|
||||
// lightColor = "0.2 0.4 0.0 1.0";
|
||||
// lightTime = "1200";
|
||||
// lightRadius = "1.0";
|
||||
|
||||
max[PlasmaAmmo] = 30;
|
||||
max[ChaingunAmmo] = 150;
|
||||
max[DiscAmmo] = 15;
|
||||
max[GrenadeLauncherAmmo] = 15;
|
||||
max[MortarAmmo] = 10;
|
||||
max[MissileLauncherAmmo] = 4;
|
||||
max[Grenade] = 10;
|
||||
max[ConcussionGrenade] = 10;
|
||||
max[FlashGrenade] = 10;
|
||||
max[FlareGrenade] = 10;
|
||||
max[Mine] = 5;
|
||||
max[RepairKit] = 1;
|
||||
};
|
||||
|
||||
function AmmoPack::onPickup(%this,%pack,%player,%amount)
|
||||
{
|
||||
// %this = AmmoPack datablock
|
||||
// %pack = AmmoPack object number
|
||||
// %player = player
|
||||
// %amount = 1
|
||||
|
||||
for (%idx = 0; %idx < $numAmmoItems; %idx++)
|
||||
{
|
||||
%ammo = $AmmoItem[%idx];
|
||||
if (%pack.inv[%ammo] > 0)
|
||||
{
|
||||
%amount = %pack.getInventory(%ammo);
|
||||
%player.incInventory(%ammo,%amount);
|
||||
%pack.setInventory(%ammo,0);
|
||||
}
|
||||
else if(%pack.inv[%ammo] == -1)
|
||||
{
|
||||
// this particular type of ammo has already been exhausted for this pack;
|
||||
// don't give the player any
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume it's full if no inventory has been assigned
|
||||
%player.incInventory(%ammo,%this.max[%ammo]);
|
||||
}
|
||||
}
|
||||
// now check what type grenades (if any) player is carrying
|
||||
%gFound = false;
|
||||
for (%i = 0; %i < $numGrenTypes; %i++)
|
||||
{
|
||||
%gType = $grenAmmoType[%i];
|
||||
if(%player.inv[%gType] > 0)
|
||||
{
|
||||
%gFound = true;
|
||||
%playerGrenType = %gType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if player doesn't have any grenades at all, give 'em whatever the ammo pack has
|
||||
if(!%gFound)
|
||||
{
|
||||
%given = false;
|
||||
for(%j = 0; %j < $numGrenTypes; %j++)
|
||||
{
|
||||
%packGren = $grenAmmoType[%j];
|
||||
if(%pack.inv[%packGren] > 0)
|
||||
{
|
||||
// pack has some of these grenades
|
||||
%player.incInventory(%packGren, %pack.getInventory(%packGren));
|
||||
%pack.setInventory(%packGren, 0);
|
||||
%given = true;
|
||||
break;
|
||||
}
|
||||
else if(%pack.inv[%packGren] == -1)
|
||||
{
|
||||
// the pack doesn't have any of this type of grenades
|
||||
}
|
||||
else
|
||||
{
|
||||
// pack has full complement of this grenade type
|
||||
%player.incInventory(%packGren, %this.max[%packGren]);
|
||||
%given = true;
|
||||
}
|
||||
if(%given)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// player had some amount of grenades before picking up pack
|
||||
if(%pack.inv[%playerGrenType] > 0)
|
||||
{
|
||||
// pack has 1 or more of this type of grenade
|
||||
%player.incInventory(%playerGrenType, %pack.getInventory(%playerGrenType));
|
||||
%pack.setInventory(%playerGrenType, 0);
|
||||
}
|
||||
else if(%pack.inv[%playerGrenType] == -1)
|
||||
{
|
||||
// sorry Chester, the pack is out of these grenades.
|
||||
}
|
||||
else
|
||||
{
|
||||
// pack is uninitialized for this grenade type -- meaning it has full count
|
||||
%player.incInventory(%playerGrenType, %this.max[%playerGrenType]);
|
||||
}
|
||||
}
|
||||
// now see if player had mines selected and if they're allowed in this mission type
|
||||
%mineFav = %player.client.favorites[getField(%player.client.mineIndex, 0)];
|
||||
if ( ( $InvBanList[$CurrentMissionType, "Mine"] !$= "1" )
|
||||
&& !( ( %mineFav $= "EMPTY" ) || ( %mineFav $= "INVALID" ) ) )
|
||||
{
|
||||
// player has selected mines, and they are legal in this mission type
|
||||
if(%pack.inv[Mine] > 0)
|
||||
{
|
||||
// and the pack has some mines in it! bonus!
|
||||
%player.incInventory(Mine, %pack.getInventory(Mine));
|
||||
%pack.setInventory(Mine, 0);
|
||||
}
|
||||
else if(%pack.inv[Mine] == -1)
|
||||
{
|
||||
// no mines left in the pack. do nothing.
|
||||
}
|
||||
else
|
||||
{
|
||||
// assume it's full of mines if no inventory has been assigned
|
||||
%player.incInventory(Mine,%this.max[Mine]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AmmoPack::onThrow(%this,%pack,%player)
|
||||
{
|
||||
// %this = AmmoPack datablock
|
||||
// %pack = AmmoPack object number
|
||||
// %player = player
|
||||
|
||||
%player.throwAmmoPack = 1;
|
||||
dropAmmoPack(%pack, %player);
|
||||
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
|
||||
serverPlay3D(ItemThrowSound, %player.getTransform());
|
||||
%pack.schedulePop();
|
||||
}
|
||||
|
||||
function AmmoPack::onInventory(%this,%player,%value)
|
||||
{
|
||||
// %this = AmmoPack
|
||||
// %player = player
|
||||
// %value = 1 if gaining a pack, 0 if losing a pack
|
||||
|
||||
// the below test is necessary because this function is called everytime the ammo
|
||||
// pack gains or loses an item
|
||||
if(%player.getClassName() $= "Player")
|
||||
{
|
||||
if(!%value)
|
||||
if(%player.throwAmmoPack == 1)
|
||||
{
|
||||
%player.throwAmmoPack = 0;
|
||||
// ammo stuff already handled by AmmoPack::onThrow
|
||||
}
|
||||
else
|
||||
{
|
||||
// ammo pack was sold at inventory station -- no need to worry about
|
||||
// setting the ammo in the pack object (it doesn't exist any more)
|
||||
dropAmmoPack(-1, %player);
|
||||
}
|
||||
}
|
||||
Pack::onInventory(%this,%player,%value);
|
||||
}
|
||||
|
||||
function dropAmmoPack(%packObj, %player)
|
||||
{
|
||||
// %packObj = Ammo Pack object number if pack is being thrown, -1 if sold at inv station
|
||||
// %player = player object
|
||||
|
||||
for(%i = 0; %i < $numAmmoItems; %i++)
|
||||
{
|
||||
%ammo = $AmmoItem[%i];
|
||||
// %pAmmo == how much of this ammo type the player has
|
||||
%pAmmo = %player.getInventory(%ammo);
|
||||
// %pMax == how much of this ammo type the player's datablock says can be carried
|
||||
%pMax = %player.getDatablock().max[%ammo];
|
||||
if(%pAmmo > %pMax)
|
||||
{
|
||||
// if player has more of this ammo type than datablock's max...
|
||||
if(%packObj > 0)
|
||||
{
|
||||
// put ammo that player can't carry anymore in pack
|
||||
%packObj.setInventory(%ammo, %pAmmo - %pMax);
|
||||
}
|
||||
// set player to max for this ammo type
|
||||
%player.setInventory(%ammo, %pMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%packObj > 0)
|
||||
{
|
||||
// the pack gets -1 of this ammo type -- else it'll assume it's full
|
||||
// can't use setInventory() because it won't allow values less than 1
|
||||
%packObj.inv[%ammo] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// and, of course, a pass for the grenades. Whee.
|
||||
%gotGren = false;
|
||||
// check to see what kind of grenades the player has.
|
||||
for(%j = 0; %j < $numGrenTypes; %j++)
|
||||
{
|
||||
%gType = $grenAmmoType[%j];
|
||||
if(%player.inv[%gType] > 0)
|
||||
{
|
||||
%gotGren = true;
|
||||
%playerGren = %gType;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ammo pack only carries type of grenades that player who bought it (or picked
|
||||
// it up) had at the time -- all else are zeroed out (value of -1)
|
||||
if(%packObj > 0)
|
||||
%packObj.inv[%gType] = -1;
|
||||
}
|
||||
}
|
||||
if(%gotGren)
|
||||
{
|
||||
%pAmmo = %player.getInventory(%playerGren);
|
||||
%pMax = %player.getDatablock().max[%playerGren];
|
||||
if(%pAmmo > %pMax)
|
||||
{
|
||||
if(%packObj > 0)
|
||||
%packObj.setInventory(%playerGren, %pAmmo - %pMax);
|
||||
%player.setInventory(%playerGren, %pMax);
|
||||
}
|
||||
else
|
||||
if(%packObj > 0)
|
||||
%packObj.inv[%playerGren] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// player doesn't have any grenades at all. nothing needs to be done here.
|
||||
}
|
||||
// crap. forgot the mines.
|
||||
if(%player.getInventory(Mine) > %player.getDatablock().max[Mine])
|
||||
{
|
||||
// if player has more mines than datablock's max...
|
||||
if(%packObj > 0)
|
||||
{
|
||||
// put mines that player can't carry anymore in pack
|
||||
%packObj.setInventory(Mine, %player.getInventory(Mine) - %player.getDatablock().max[Mine]);
|
||||
}
|
||||
// set player to max mines
|
||||
%player.setInventory(Mine, %player.getDatablock().max[Mine]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%packObj > 0)
|
||||
{
|
||||
// the pack gets -1 for mines -- else it'll assume it's full
|
||||
// can't use setInventory() because it won't allow values less than 1
|
||||
%packObj.inv[Mine] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
155
base/scripts/packs/cloakingpack.cs
Normal file
155
base/scripts/packs/cloakingpack.cs
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
// ------------------------------------------------------------------
|
||||
// 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 AudioProfile(CloakingPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/cloak_on.wav";
|
||||
description = CloseLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
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] = 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
51
base/scripts/packs/energypack.cs
Normal file
51
base/scripts/packs/energypack.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
// ------------------------------------------------------------------
|
||||
// ENERGY PACK
|
||||
// can be used by any armor type
|
||||
// does not have to be activated
|
||||
// increases the user's energy recharge rate
|
||||
|
||||
datablock ShapeBaseImageData(EnergyPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_energy.dts";
|
||||
item = EnergyPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
rechargeRateBoost = 0.15;
|
||||
|
||||
stateName[0] = "default";
|
||||
stateSequence[0] = "activation";
|
||||
};
|
||||
|
||||
datablock ItemData(EnergyPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_energy.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "EnergyPackImage";
|
||||
pickUpName = "an energy pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function EnergyPackImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() + %data.rechargeRateBoost);
|
||||
%obj.hasEnergyPack = true; // set for sniper check
|
||||
}
|
||||
|
||||
function EnergyPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() - %data.rechargeRateBoost);
|
||||
%obj.hasEnergyPack = "";
|
||||
}
|
||||
|
||||
function EnergyPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
65
base/scripts/packs/missilebarrelPack.cs
Normal file
65
base/scripts/packs/missilebarrelPack.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MissileBarrelPackImage)
|
||||
{
|
||||
mass = 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
base/scripts/packs/mortarBarrelPack.cs
Normal file
63
base/scripts/packs/mortarBarrelPack.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MortarBarrelPackImage)
|
||||
{
|
||||
mass = 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
base/scripts/packs/plasmabarrelPack.cs
Normal file
61
base/scripts/packs/plasmabarrelPack.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Plasma barrel pack
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(PlasmaBarrelPackImage)
|
||||
{
|
||||
mass = 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
|
||||
}
|
||||
591
base/scripts/packs/repairpack.cs
Normal file
591
base/scripts/packs/repairpack.cs
Normal file
|
|
@ -0,0 +1,591 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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
|
||||
|
||||
datablock AudioProfile(RepairPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/packs.repairPackOn.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(RepairPackFireSound)
|
||||
{
|
||||
filename = "fx/packs/repair_use.wav";
|
||||
description = CloseLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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";
|
||||
|
||||
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.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] = "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(%obj.getMountedImage($WeaponSlot).getName() !$= "RepairGunImage")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Repair pack activated.');
|
||||
|
||||
// unmount any weapon the player may have been holding
|
||||
if(%obj.getMountedImage($WeaponSlot))
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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.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)
|
||||
{
|
||||
// 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;
|
||||
};
|
||||
MissionCleanup.add(%player.repairProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
450
base/scripts/packs/satchelCharge.cs
Normal file
450
base/scripts/packs/satchelCharge.cs
Normal file
|
|
@ -0,0 +1,450 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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 AudioProfile(SatchelChargeActivateSound)
|
||||
{
|
||||
filename = "fx/packs/satchel_pack_activate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SatchelChargeExplosionSound)
|
||||
{
|
||||
filename = "fx/packs/satchel_pack_detonate.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// 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;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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(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";
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// 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)
|
||||
{
|
||||
subExplosion[0] = SatchelSubExplosion;
|
||||
subExplosion[1] = SatchelSubExplosion2;
|
||||
subExplosion[2] = SatchelSubExplosion3;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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(SatchelChargeThrown)
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
explosion = SatchelMainExplosion;
|
||||
mass = 1.2;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
rotate = false;
|
||||
pickupRadius = 0;
|
||||
noTimeout = true;
|
||||
armDelay = 3000;
|
||||
maxDamage = 0.6;
|
||||
|
||||
kickBackStrength = 4000;
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function SatchelCharge::onUse(%this, %obj)
|
||||
{
|
||||
%item = new Item() {
|
||||
dataBlock = SatchelChargeThrown;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
};
|
||||
MissionCleanup.add(%item);
|
||||
// take pack out of inventory and unmount image
|
||||
%obj.decInventory(SatchelCharge, 1);
|
||||
%obj.throwObject(%item);
|
||||
//error("throwing satchel charge #" @ %item);
|
||||
%obj.thrownChargeId = %item;
|
||||
%item.sourceObject = %obj;
|
||||
%item.armed = false;
|
||||
%item.damaged = 0.0;
|
||||
%item.thwart = false;
|
||||
// arm itself 3 seconds after being thrown
|
||||
schedule(%item.getDatablock().armDelay, %item, "armSatchelCharge", %item);
|
||||
messageClient(%obj.client, 'MsgSatchelChargePlaced', "\c2Satchel charge deployed.");
|
||||
}
|
||||
|
||||
function armSatchelCharge(%satchel)
|
||||
{
|
||||
//error("satchel charge #" @ %satchel @ " armed!");
|
||||
%satchel.armed = true;
|
||||
// "deet deet deet" sound
|
||||
%satchel.playAudio(1, SatchelChargeActivateSound);
|
||||
// also need to play "antenna extending" animation
|
||||
%satchel.playThread(0, "deploy");
|
||||
%satchel.playThread(1, "activate");
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if(isObject(%player))
|
||||
%player.thrownChargeId = 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
%dmgRadius = 10;
|
||||
%dmgMod = 0.3;
|
||||
%expImpulse = 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel Charge Detonated!");
|
||||
%dmgRadius = 20;
|
||||
%dmgMod = 1.0;
|
||||
%expImpulse = 2500;
|
||||
}
|
||||
|
||||
RadiusExplosion(%object, %object.getPosition(), %dmgRadius, %dmgMod, %expImpulse, %object.sourceObject, $DamageType::SatchelCharge);
|
||||
|
||||
%object.schedule(500, "delete");
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onCollision(%data,%obj,%col)
|
||||
{
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
||||
{
|
||||
%targetObject.damaged += %amount;
|
||||
|
||||
if(%targetObject.damaged >= %targetObject.getDataBlock().maxDamage &&
|
||||
%satchelCharge.getDamageState() !$= Destroyed)
|
||||
{
|
||||
%targetObject.thwart = true;
|
||||
%targetObject.setDamageState(Destroyed);
|
||||
}
|
||||
}
|
||||
|
||||
function SatchelCharge::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
101
base/scripts/packs/sensorjammerpack.cs
Normal file
101
base/scripts/packs/sensorjammerpack.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// ------------------------------------------------------------------
|
||||
// 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 AudioProfile(SensorJammerActivateSound)
|
||||
{
|
||||
filename = "fx/packs/sensorjammerpack_on.wav";
|
||||
description = ClosestLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
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(JammerSensorObject)
|
||||
{
|
||||
// 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::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, JammerSensorObject);
|
||||
}
|
||||
|
||||
function SensorJammerPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgSensorJammerPackOff', '\c2Sensor jammer pack off.');
|
||||
setTargetSensorData(%obj.client.target, PlayerSensor);
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
}
|
||||
|
||||
function SensorJammerPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
82
base/scripts/packs/shieldpack.cs
Normal file
82
base/scripts/packs/shieldpack.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
// ------------------------------------------------------------------
|
||||
// SHIELD PACK
|
||||
// can be used by any armor type
|
||||
// while activated, absorbs damage at cost of energy
|
||||
|
||||
datablock AudioProfile(ShieldPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/shield_on.wav";
|
||||
description = ClosestLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(ShieldPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_shield.dts";
|
||||
item = ShieldPack;
|
||||
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] = ShieldPackActivateSound;
|
||||
stateEnergyDrain[1] = 9;
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(ShieldPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_shield.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "ShieldPackImage";
|
||||
pickUpName = "a shield pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
function ShieldPackImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
}
|
||||
|
||||
function ShieldPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setImageTrigger(%node, false);
|
||||
%obj.isShielded = "";
|
||||
}
|
||||
|
||||
function ShieldPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgShieldPackOn', '\c2Shield pack on.');
|
||||
%obj.isShielded = true;
|
||||
}
|
||||
|
||||
function ShieldPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
messageClient(%obj.client, 'MsgShieldPackOff', '\c2Shield pack off.');
|
||||
%obj.setImageTrigger(%slot,false);
|
||||
%obj.isShielded = "";
|
||||
}
|
||||
|
||||
function ShieldPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue