mirror of
https://github.com/Ragora/T2-ACCM.git
synced 2026-07-09 08:14:34 +00:00
Initial commit.
This commit is contained in:
commit
f5a6cfce9b
262 changed files with 128936 additions and 0 deletions
83
Scripts/Packs/ArtilleryLoadoutPack.cs
Normal file
83
Scripts/Packs/ArtilleryLoadoutPack.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Loadout Pack
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(artilleryWeaponPackImage)
|
||||
{
|
||||
mass = 15;
|
||||
|
||||
shapeFile = "turret_tank_barrelmortar.dts";
|
||||
item = artilleryWeaponPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.3 -0.75";
|
||||
rotation = "-1 0 0 90";
|
||||
|
||||
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(artilleryWeaponPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "turret_tank_barrelmortar.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "artilleryWeaponPackImage";
|
||||
pickUpName = "an artillery loadout pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
function artilleryWeaponPackImage::onMount(%data, %obj, %node){
|
||||
%obj.hasArtWepPack = true;
|
||||
}
|
||||
|
||||
function artilleryWeaponPackImage::onUnMount(%data, %obj, %node){
|
||||
%obj.hasArtWepPack = false;
|
||||
}
|
||||
|
||||
function artilleryWeaponPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
%pos = %obj.getWorldBoxCenter();
|
||||
%vec = %obj.getEyeVector();
|
||||
%vec = vectorAdd(VectorScale(%vec,5),%pos);
|
||||
%searchResult = containerRayCast(%pos, %vec, $TypeMasks::VehicleObjectType, %obj);
|
||||
if(%searchResult){
|
||||
%searchObj = getWord(%searchResult, 0);
|
||||
if(%searchObj.getDataBlock().getName() $= "Artillery"){
|
||||
if (%obj.packset==0){
|
||||
%searchobj.turretObject.setInventory(MortarAmmo, 12);
|
||||
%searchobj.selweapontype = 1;
|
||||
%obj.unmountImage($backpackslot);
|
||||
%obj.decInventory(artilleryWeaponPack, 1);
|
||||
}
|
||||
else if (%obj.packset==1){
|
||||
%searchobj.turretObject.setInventory(MortarAmmo, 6);
|
||||
%searchobj.selweapontype = 2;
|
||||
%obj.unmountImage($backpackslot);
|
||||
%obj.decInventory(artilleryWeaponPack, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function artilleryWeaponPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function artilleryWeaponPack::onPickup(%this, %obj, %shape, %amount){}
|
||||
882
Scripts/Packs/CommandSatelite.cs
Normal file
882
Scripts/Packs/CommandSatelite.cs
Normal file
|
|
@ -0,0 +1,882 @@
|
|||
//Dont reorder these or change the first word in them (S11 S17)... do so at your own risk.
|
||||
$commsatPurchase[1] = "S11 90 S11 Aerial Recon";
|
||||
$commsatPurchase[2] = "S17 60 S17 Combat Drone";
|
||||
|
||||
//DO NOT CHANGE THESE, i did a bad job in scripting in a universal manner :), you can add more though shouldnt be too hard.
|
||||
$commsatOrder[1] = "Move";
|
||||
$commsatOrder[2] = "Attack";
|
||||
$commsatOrder[3] = "Guard";
|
||||
$commsatOrder[4] = "Rearm";
|
||||
|
||||
// ------------------------------------------
|
||||
// SpySatellite.cs
|
||||
// ------------------------------------------
|
||||
|
||||
datablock TurretData(DeployedSpySatellite) : TurretDamageProfile
|
||||
{
|
||||
className = DeployedTurret; // VehicleTurret;
|
||||
shapeFile = "turret_indoor_deployc.dts";
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = TurretDebrisSmall;
|
||||
preload = true;
|
||||
|
||||
canControl = false;
|
||||
canObserve = true;
|
||||
firstPersonOnly = true;
|
||||
observeParameters = "0.5 4.5 4.5";
|
||||
// deployedObject = true;
|
||||
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDCameraIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_camera_grey";
|
||||
targetNameTag = 'command';
|
||||
targetTypeTag = 'Satellite';
|
||||
|
||||
mass = 0.7;
|
||||
repairRate = 0;
|
||||
maxDamage = 1.0;
|
||||
disabledLevel = 1.0;
|
||||
destroyedLevel = 1.0;
|
||||
explosion = CameraGrenadeExplosion;
|
||||
renderWhenDestroyed = false;
|
||||
|
||||
thetaMin = 60;
|
||||
thetaMax = 180;
|
||||
thetaNull = 180;
|
||||
// primaryAxis = zaxis; //revzaxis;
|
||||
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 1;
|
||||
maxEnergy = 1000;
|
||||
rechargeRate = 1.0;
|
||||
|
||||
sensorData = CameraSensorObject;
|
||||
sensorRadius = CameraSensorObject.detectRadius;
|
||||
|
||||
heatSignature = 0.0;
|
||||
barrel = HeliTurretParam;
|
||||
numWeapons = 5;
|
||||
};
|
||||
|
||||
datablock TurretImageData(SpySatelliteBarrel)
|
||||
{
|
||||
shapeFile = "turret_muzzlepoint.dts";
|
||||
item = SpySatelliteBarrel;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 150;
|
||||
deactivateDelayMS = 300;
|
||||
thinkTimeMS = 150;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 960;
|
||||
attackRadius = 1;
|
||||
|
||||
// State transitions
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnTimeout[0] = "ActivateReady";
|
||||
stateTimeoutValue[0] = 0.5;
|
||||
stateSequence[0] = "Activate";
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateTransitionOnLoaded[1] = "Ready";
|
||||
stateTransitionOnNoAmmo[1] = "NoAmmo";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateTransitionOnTriggerDown[2] = "Fire";
|
||||
|
||||
stateName[3] = "Fire";
|
||||
stateTransitionOnTimeout[3] = "Reload";
|
||||
stateTimeoutValue[3] = 0.5;
|
||||
stateFire[3] = true;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateScript[3] = "onFire";
|
||||
|
||||
stateName[4] = "Reload";
|
||||
stateTransitionOnTimeout[4] = "Ready";
|
||||
stateTimeoutValue[4] = 0.5;
|
||||
stateAllowImageChange[4] = false;
|
||||
};
|
||||
|
||||
function SpySatelliteBarrel::onFire(%data,%obj,%slot)
|
||||
{
|
||||
%range = 1000; //Max range It can move.
|
||||
%rot = rotFromTransform(%obj.getTransform());
|
||||
%muzzlePos = %obj.getMuzzlePoint(%slot);
|
||||
%muzzleVec = %obj.getMuzzleVector(%slot);
|
||||
%endPos = VectorAdd(%muzzlePos, VectorScale(%muzzleVec, %range));
|
||||
%damageMasks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType |
|
||||
$TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType |
|
||||
$TypeMasks::InteriorObjectType;
|
||||
|
||||
%terrain = ContainerRayCast(%muzzlePos, %endPos, $TypeMasks::TerrainObjectType, %obj);
|
||||
%message = "";
|
||||
if (%terrain)
|
||||
{
|
||||
%xy = getWords(%terrain, 1, 2);
|
||||
%z = getWord(%terrain, 3);
|
||||
%pos = %xy SPC %z + 200;
|
||||
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType |
|
||||
$TypeMasks::StaticShapeObjectType |
|
||||
$TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType |
|
||||
$TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType);
|
||||
InitContainerRadiusSearch( %pos, 2, %mask );
|
||||
%test = containerSearchNext();
|
||||
if (%test)
|
||||
%message = "Can\'t reposition the satellite. Trajectory Blocked";
|
||||
else
|
||||
{
|
||||
%obj.setTransform(%pos SPC %rot);
|
||||
}
|
||||
}
|
||||
else
|
||||
%message = "Trajectory not understood. Reenter.";
|
||||
if (%message !$= "")
|
||||
messageClient(%obj.client, 'msgBlocked', %message);
|
||||
}
|
||||
|
||||
|
||||
datablock ShapeBaseImageData(SpySatelliteDeployableImage)
|
||||
{
|
||||
shapeFile = "pack_deploy_sensor_pulse.dts";
|
||||
item = SpySatelliteDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedSpySatellite;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
deploySound = SpySatelliteDeploySound;
|
||||
|
||||
maxDepSlope = 40;
|
||||
emap = true;
|
||||
heatSignature = 0;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 15.0; //meters from body
|
||||
};
|
||||
|
||||
datablock ItemData(SpySatelliteDeployable)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_sensor_pulse.dts";
|
||||
mass = 2.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "SpySatelliteDeployableImage";
|
||||
pickUpName = "a command satellite pack";
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(DronePadDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = DronePadDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = StationInventory;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(DronePadDeployable)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "DronePadDeployableImage";
|
||||
joint = "4.5 4.5 4.5";
|
||||
pickUpName = "a Drone Pad pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(Dronepad) : StaticShapeDamageProfile
|
||||
{
|
||||
className = Station;
|
||||
shapeFile = "station_teleport.dts";
|
||||
maxDamage = 3.5;
|
||||
destroyedLevel = 3.5;
|
||||
disabledLevel = 3.2;
|
||||
explosion = DeployablesExplosion;
|
||||
expDmgRadius = 10.0;
|
||||
expDamage = 0.4;
|
||||
expImpulse = 1000.0;
|
||||
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 110;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.20;
|
||||
renderWhenDestroyed = false;
|
||||
doesRepair = true;
|
||||
|
||||
deployedObject = true;
|
||||
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDStationIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
|
||||
targetNameTag = 'Command Satellite';
|
||||
targetTypeTag = 'Drone Pad';
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needspower = true;
|
||||
};
|
||||
|
||||
datablock HoverVehicleData(commsatControlStation) : MPBDamageProfile
|
||||
{
|
||||
spawnOffset = "0 0 0";
|
||||
canControl = false;
|
||||
floatingGravMag = 0;
|
||||
|
||||
catagory = "Vehicles";
|
||||
shapeFile = "vehicle_grav_scout.dts";
|
||||
computeCRC = true;
|
||||
|
||||
debrisShapeName = "vehicle_grav_scout_debris.dts";
|
||||
debris = ShapeDebris;
|
||||
renderWhenDestroyed = false;
|
||||
|
||||
drag = 0.0;
|
||||
density = 0.9;
|
||||
|
||||
mountPose[0] = sitting;
|
||||
isProtectedMountPoint[0] = true;
|
||||
cameraMaxDist = 5.0;
|
||||
cameraOffset = 0.7;
|
||||
cameraLag = 0.5;
|
||||
numMountPoints = 1;
|
||||
explosion = VehicleExplosion;
|
||||
explosionDamage = 0.5;
|
||||
explosionRadius = 5.0;
|
||||
|
||||
// Damage Levels
|
||||
maxDamage = 4;
|
||||
destroyedLevel = 4;
|
||||
|
||||
cantAbandon = 1;
|
||||
cantTeamSwitch = 1;
|
||||
|
||||
isShielded = false;
|
||||
rechargeRate = 0.7;
|
||||
energyPerDamagePoint = 75;
|
||||
maxEnergy = 150;
|
||||
minJetEnergy = 15;
|
||||
jetEnergyDrain = 0.1;
|
||||
|
||||
// Rigid Body
|
||||
mass = 300;
|
||||
bodyFriction = 0.1;
|
||||
bodyRestitution = 0.5;
|
||||
softImpactSpeed = 0.5; // Play SoftImpact Sound
|
||||
hardImpactSpeed = 1; // Play HardImpact Sound
|
||||
|
||||
// Ground Impact Damage (uses DamageType::Ground)
|
||||
minImpactSpeed = 55;
|
||||
speedDamageScale = 0.007;
|
||||
|
||||
// Object Impact Damage (uses DamageType::Impact)
|
||||
collDamageThresholdVel = 1;
|
||||
collDamageMultiplier = 0.02;
|
||||
|
||||
dragForce = 25 / 45.0;
|
||||
vertFactor = 0.0;
|
||||
floatingThrustFactor = 0.35;
|
||||
|
||||
mainThrustForce = 10;
|
||||
reverseThrustForce = 10;
|
||||
strafeThrustForce = 0;
|
||||
turboFactor = 1;
|
||||
|
||||
brakingForce = 25;
|
||||
brakingActivationSpeed = 4;
|
||||
|
||||
stabLenMin = 2.25;
|
||||
stabLenMax = 3.25;
|
||||
stabSpringConstant = 30;
|
||||
stabDampingConstant = 12;
|
||||
|
||||
gyroDrag = 16;
|
||||
normalForce = 30;
|
||||
restorativeForce = 25;
|
||||
steeringForce = 100;
|
||||
rollForce = 15;
|
||||
pitchForce = 7;
|
||||
|
||||
dustEmitter = VehicleLiftoffDustEmitter;
|
||||
triggerDustHeight = 0;
|
||||
dustHeight = 1;
|
||||
dustTrailEmitter = TireEmitter;
|
||||
dustTrailOffset = "0.0 -1.0 0.5";
|
||||
triggerTrailHeight = 3.6;
|
||||
dustTrailFreqMod = 15.0;
|
||||
|
||||
jetSound = ScoutSqueelSound;
|
||||
engineSound = ScoutEngineSound;
|
||||
floatSound = ScoutThrustSound;
|
||||
softImpactSound = GravSoftImpactSound;
|
||||
hardImpactSound = HardImpactSound;
|
||||
|
||||
//
|
||||
softSplashSoundVelocity = 10.0;
|
||||
mediumSplashSoundVelocity = 20.0;
|
||||
hardSplashSoundVelocity = 30.0;
|
||||
exitSplashSoundVelocity = 10.0;
|
||||
|
||||
exitingWater = VehicleExitWaterSoftSound;
|
||||
impactWaterEasy = VehicleImpactWaterSoftSound;
|
||||
impactWaterMedium = VehicleImpactWaterSoftSound;
|
||||
impactWaterHard = VehicleImpactWaterMediumSound;
|
||||
waterWakeSound = VehicleWakeSoftSplashSound;
|
||||
|
||||
minMountDist = 4;
|
||||
|
||||
damageEmitter[0] = SmallLightDamageSmoke;
|
||||
damageEmitter[1] = SmallHeavyDamageSmoke;
|
||||
damageEmitter[2] = DamageBubbles;
|
||||
damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
|
||||
damageLevelTolerance[0] = 0.3;
|
||||
damageLevelTolerance[1] = 0.8;
|
||||
numDmgEmitterAreas = 1;
|
||||
|
||||
splashEmitter[0] = VehicleFoamDropletsEmitter;
|
||||
splashEmitter[1] = VehicleFoamEmitter;
|
||||
|
||||
shieldImpact = VehicleShieldImpact;
|
||||
|
||||
forwardJetEmitter = WildcatJetEmitter;
|
||||
|
||||
cmdCategory = Tactical;
|
||||
cmdIcon = CMDHoverScoutIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_landscout_grey";
|
||||
targetNameTag = 'Command Satellite';
|
||||
targetTypeTag = 'Control Station';
|
||||
sensorData = PlayerSensor;
|
||||
|
||||
checkRadius = 1.7785;
|
||||
observeParameters = "1 10 10";
|
||||
|
||||
runningLight[0] = WildcatLight1;
|
||||
runningLight[1] = WildcatLight2;
|
||||
runningLight[2] = WildcatLight3;
|
||||
|
||||
shieldEffectScale = "0.9375 1.125 0.6";
|
||||
};
|
||||
|
||||
function DeployedSpySatellite::onTrigger(%data, %obj, %trigger, %state)
|
||||
{
|
||||
switch (%trigger) {
|
||||
case 0: //leftclick
|
||||
if(%state){
|
||||
if(%obj.minedown == 1)
|
||||
commsatCyclePurchase(%obj);
|
||||
else if(%obj.grenadedown == 1)
|
||||
commsatPurchase(%obj);
|
||||
else if(%obj.rightdown == 1)
|
||||
commsatAddToGroup(%obj,%obj.selectedWeapon);
|
||||
else{
|
||||
if(%obj.selectedWeapon >= 1 && %obj.selectedWeapon <= 3)
|
||||
commsatSelectGroup(%obj,%obj.selectedWeapon);
|
||||
else if(%obj.selectedWeapon == 4)
|
||||
commsatReleaseSelected(%obj);
|
||||
else
|
||||
commsatSelectObj(%obj);
|
||||
}
|
||||
}
|
||||
case 3: //rightclick
|
||||
if(%state){
|
||||
%obj.rightdown = 1;
|
||||
if(%obj.minedown == 1)
|
||||
commsatCycleOrders(%obj);
|
||||
else if(%obj.grenadedown == 1)
|
||||
commsatIssueOrders(%obj);
|
||||
}
|
||||
else
|
||||
%obj.rightdown = 0;
|
||||
case 4: //grenade
|
||||
if(%state)
|
||||
%obj.grenadedown = 1;
|
||||
else
|
||||
%obj.grenadedown = 0;
|
||||
case 5: //mine
|
||||
if(%state)
|
||||
%obj.minedown = 1;
|
||||
else
|
||||
%obj.minedown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function commsatCyclePurchase(%obj){
|
||||
%num = %obj.purchasenum + 1;
|
||||
if($commsatPurchase[%num] $= "")
|
||||
%num = 1;
|
||||
%obj.purchasenum = %num;
|
||||
bottomPrint(%obj.getcontrollingclient(), getWords($commsatPurchase[%num],3,4) SPC "selected for purchase.", 5, 2 );
|
||||
}
|
||||
|
||||
function commsatPurchase(%obj){
|
||||
%team = %obj.team;
|
||||
if(!isObject($commsatVPad[%obj.team]))
|
||||
return;
|
||||
if(getWord($commsatPurchase[%obj.purchasenum],1) <= $teamcredits[%team]){
|
||||
$teamcredits[%team] -= getWord($commsatPurchase[%obj.purchasenum],1);
|
||||
$teamUsedCredits[%team] += getWord($commsatPurchase[%obj.purchasenum],1);
|
||||
%pos = vectorAdd($commsatVpad[%team].getPosition(),"0 0 4");
|
||||
%rotation = "1 0 0 0";
|
||||
%drone = getWord($commsatPurchase[%obj.purchasenum],0);
|
||||
if(%drone $= "S11"){
|
||||
%veh = new FlyingVehicle(){
|
||||
dataBlock = S11;
|
||||
position = %pos;
|
||||
rotation = %rotation;
|
||||
team = %team;
|
||||
};
|
||||
} else if(%drone $= "S17"){
|
||||
%veh = new HoverVehicle(){
|
||||
dataBlock = S17;
|
||||
position = %pos;
|
||||
rotation = %rotation;
|
||||
team = %team;
|
||||
};
|
||||
}
|
||||
MissionCleanUp.add(%veh);
|
||||
setTargetSensorGroup(%veh.getTarget(), %team);
|
||||
bottomPrint(%obj.getcontrollingclient(), "Drone purchased.", 5, 2 );
|
||||
}
|
||||
else
|
||||
bottomPrint(%obj.getcontrollingclient(), "Not enough credits to purchase" SPC getWords(2,4), 5, 2 );
|
||||
}
|
||||
|
||||
function commsatAddToGroup(%obj,%num){
|
||||
%x = 0;
|
||||
%y = 0;
|
||||
while(getWord(%obj.selected,%y) !$= ""){
|
||||
%trg = getWord(%obj.selected,%y);
|
||||
if(isobject(%trg)){
|
||||
%obj.group[%num,%x] = %trg;
|
||||
%x++;
|
||||
}
|
||||
%y++;
|
||||
}
|
||||
bottomPrint(%obj.getcontrollingclient(), "Group created.", 5, 2 );
|
||||
}
|
||||
|
||||
function commsatSelectGroup(%obj,%num){
|
||||
%x = 0;
|
||||
while(%obj.group[%num,%x] !$= ""){
|
||||
if(!(%obj.group[%num,%x].selected == 1)){
|
||||
if(%obj.selected $= "")
|
||||
%obj.selected = %obj.group[%num,%x];
|
||||
else
|
||||
%obj.selected = %obj.selected SPC %obj.group[%num,%x];
|
||||
%obj.group[%num,%x].selected = 1;
|
||||
%x++;
|
||||
}
|
||||
}
|
||||
bottomPrint(%obj.getcontrollingclient(), "Group selected.", 5, 2 );
|
||||
}
|
||||
|
||||
function commsatReleaseSelected(%obj){
|
||||
%y = 0;
|
||||
while(getWord(%obj.selected,%y) !$= ""){
|
||||
%trg = getWord(%obj.selected,%y);
|
||||
if(isobject(%trg))
|
||||
%trg.selected = 0;
|
||||
%y++;
|
||||
}
|
||||
%obj.selected = "";
|
||||
bottomPrint(%obj.getcontrollingclient(), "All units deselected.", 5, 2 );
|
||||
}
|
||||
|
||||
function commsatSelectObj(%obj){
|
||||
%eye = %obj.getMuzzleVector(2);
|
||||
%pos = %obj.getMuzzlePoint(2);
|
||||
%search = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%eye,2000)), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TerrainObjectType, %obj);
|
||||
if(%search){
|
||||
%srcobj = firstWord(%search);
|
||||
%srcpos = posFromRaycast(%search);
|
||||
InitContainerRadiusSearch(%srcpos,10,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
|
||||
while ((%TObject = containerSearchNext()) != 0){
|
||||
if(%TObject.team == %obj.team && !(%Tobject.selected == 1)){
|
||||
if(%obj.selected $= ""){
|
||||
%obj.selected = %Tobject;
|
||||
%Tobject.selected = 1;
|
||||
bottomPrint(%obj.getcontrollingclient(), "Unit Selected.", 5, 2 );
|
||||
return;
|
||||
} else {
|
||||
%obj.selected = %obj.selected SPC %Tobject;
|
||||
%Tobject.selected = 1;
|
||||
bottomPrint(%obj.getcontrollingclient(), "Unit Selected.", 5, 2 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function commsatCycleOrders(%obj){
|
||||
%num = %obj.ordernum + 1;
|
||||
if($commsatOrder[%num] $= "")
|
||||
%num = 1;
|
||||
%obj.ordernum = %num;
|
||||
bottomPrint(%obj.getcontrollingclient(), "Current orders set to" SPC $commsatOrder[%num], 5, 2 );
|
||||
}
|
||||
|
||||
function commsatIssueOrders(%obj){
|
||||
%eye = %obj.getMuzzleVector(0);
|
||||
%pos = %obj.getMuzzlePoint(0);
|
||||
%search = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%eye,2000)), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TerrainObjectType, %obj);
|
||||
%tpos = posFromRaycast(%search);
|
||||
if(%obj.ordernum == 2){
|
||||
if(%search){
|
||||
%srcobj = firstWord(%search);
|
||||
%srcpos = posFromRaycast(%search);
|
||||
InitContainerRadiusSearch(%srcpos,10,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
|
||||
while ((%TObject = containerSearchNext()) != 0){
|
||||
if(%TObject.team != %obj.team){
|
||||
%target = %Tobject;
|
||||
%valid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(%valid != 1){
|
||||
%team = %obj.team;
|
||||
%beacon = new BeaconObject(){
|
||||
datablock = SubBeacon;
|
||||
beaconType = "enemy";
|
||||
position = %tpos;
|
||||
};
|
||||
%beacon.team = %team;
|
||||
%beacon.owner = %obj;
|
||||
%beacon.setTarget(%team);
|
||||
MissionCleanup.add(%beacon);
|
||||
%beacon.schedule(60000,"delete");
|
||||
} else {
|
||||
%target.CommandAttachBeacon();
|
||||
%beacon = %target.enemybeacon;
|
||||
}
|
||||
}
|
||||
|
||||
%y = 0;
|
||||
while(getWord(%obj.selected,%y) !$= ""){
|
||||
%trg = getWord(%obj.selected,%y);
|
||||
if(isobject(%trg)){
|
||||
%datablock = %trg.getDatablock().getName();
|
||||
if(%datablock $= "S11"){
|
||||
%trg.tasks = $S11[$commsatOrder[%obj.ordernum]];
|
||||
if(%obj.ordernum == 1)
|
||||
%trg.specvar[MOVE] = %tpos;
|
||||
else if(%obj.ordernum == 2){
|
||||
%trg.specvar[MOE] = %beacon;
|
||||
%trg.specvar[FIRE] = %beacon;
|
||||
%trg.specvar[MOVE] = %trg.getPosition();
|
||||
}
|
||||
else if(%obj.ordernum == 3)
|
||||
%trg.specvar[RECON] = %tpos;
|
||||
else if(%obj.ordernum == 4){
|
||||
%trg.specvar[MOVE] = $commsatVpad[%obj.team].getPosition();
|
||||
%trg.specvar[MOVE,2] = %trg.getPosition();
|
||||
}
|
||||
S11Think(%trg);
|
||||
}
|
||||
else if(%datablock $= "S17"){
|
||||
%trg.task = $commsatOrder[%obj.ordernum];
|
||||
if(%obj.ordernum == 1)
|
||||
%trg.specvar[MOVE] = %tpos;
|
||||
if(%obj.ordernum == 2)
|
||||
%trg.specvar[ATTACK] = %beacon;
|
||||
if(%obj.ordernum == 3)
|
||||
%trg.specvar[GUARD] = %tpos;
|
||||
if(%obj.ordernum == 4)
|
||||
%trg.specvar[REARM] = $commsatVpad[%obj.team];
|
||||
S17Think(%trg);
|
||||
}
|
||||
}
|
||||
%y++;
|
||||
}
|
||||
}
|
||||
|
||||
function commsatHudUpdate(%obj){
|
||||
if(!isObject(%obj))
|
||||
return;
|
||||
%client = %obj.getControllingClient();
|
||||
if(%client){
|
||||
%message = "CREDITS:"@$teamcredits[%obj.team];
|
||||
%message = %message SPC "SELECTED: Purchase/"@getWords($commsatPurchase[%obj.purchasenum],3,4);
|
||||
%message = %message SPC "Order/"@$commsatOrder[%obj.ordernum];
|
||||
bottomPrint(%client, %message, 2, 2 );
|
||||
}
|
||||
schedule(1000, 0, "commsatHudUpdate",%obj);
|
||||
}
|
||||
|
||||
function SimObject::CommandAttachBeacon(%obj){
|
||||
if(isObject(%obj.enemyBeacon))
|
||||
%obj.enemyBeacon.delete();
|
||||
if (%obj.team == 1)
|
||||
%team = 2;
|
||||
else
|
||||
%team = 1;
|
||||
|
||||
%beacon = new BeaconObject(){
|
||||
datablock = SubBeacon;
|
||||
beaconType = "enemy";
|
||||
position = %obj.getWorldBoxCenter();
|
||||
};
|
||||
%beacon.team = %team;
|
||||
%beacon.owner = %obj;
|
||||
%beacon.setTarget(%team);
|
||||
%obj.mountObject(%beacon, 9);
|
||||
%obj.enemyBeacon = %beacon;
|
||||
MissionCleanup.add(%beacon);
|
||||
%beacon.schedule(60000,"delete");
|
||||
|
||||
%wa=new Waypoint() {
|
||||
position = %obj.getWorldBoxCenter();
|
||||
rotation = "1 0 0 0";
|
||||
dataBlock = "WayPointMarker";
|
||||
team = %team;
|
||||
name = "Attack this target.";
|
||||
};
|
||||
MissionCleanup.add(%wa);
|
||||
%wa.schedule(5000,"delete");
|
||||
}
|
||||
|
||||
function SpySatelliteDeployable::onPickup(%this, %obj, %shape, %amount){}
|
||||
|
||||
function SpySatelliteDeployableImage::testObjectTooClose(%item){
|
||||
%xy = getWords(%item.surfacePt, 0, 1);
|
||||
%z = getWord(%item.surfacePt, 2);
|
||||
%z += 200;
|
||||
%item.surfacePt = %xy SPC %z;
|
||||
%item.surfaceNrm = "0 0 -1";
|
||||
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType |
|
||||
$TypeMasks::StaticShapeObjectType |
|
||||
$TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType |
|
||||
$TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType);
|
||||
InitContainerRadiusSearch( %item.surfacePt, $MinDeployDistance, %mask );
|
||||
%test = containerSearchNext();
|
||||
return %test;
|
||||
}
|
||||
|
||||
function SpySatelliteDeployableImage::onDeploy(%item, %plyr, %slot){
|
||||
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
|
||||
%deplObj.setCloaked(true);
|
||||
%deplObj.setPassiveJammed(true);
|
||||
%deplObj.selectedWeapon = 1;
|
||||
%deplobj.mountImage(GST1Param, 0);
|
||||
%deplobj.mountImage(SpySatelliteBarrel, 2);
|
||||
%deplobj.purchaseNum = 1;
|
||||
%deplobj.orderNum = 1;
|
||||
$commsat[%deplobj.team] = %deplobj;
|
||||
commsatHudUpdate(%deplobj);
|
||||
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,"0 0 -200");
|
||||
|
||||
%pos = %item.surfacePt;
|
||||
%Drone = new HoverVehicle()
|
||||
{
|
||||
dataBlock = commsatControlStation;
|
||||
position = %pos;
|
||||
rotation = %plyr.getRotation();
|
||||
team = %plyr.team;
|
||||
};
|
||||
MissionCleanUp.add(%Drone);
|
||||
|
||||
setTargetSensorGroup(%Drone.getTarget(), %team);
|
||||
$commsatCPad[%deplobj.team] = %Drone;
|
||||
|
||||
|
||||
|
||||
%pos = vectorAdd(%item.surfacePt,vectorScale(%plyr.getForwardvector(),1.25));
|
||||
%deplObj = new (StaticShape)() {
|
||||
dataBlock = DeployedCrate12;
|
||||
scale = "0.6 0.3 1";
|
||||
};
|
||||
%deplObj.setTransform(%pos SPC %plyr.getRotation());
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
addToDeployGroup(%deplObj);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
if($teamcredits[1] $= ""){
|
||||
for(%i = 1;%i <= game.numteams; %i++){
|
||||
$teamcredits[%i] = 160;
|
||||
$teamUsedCredits[%i] = 0;
|
||||
$teamRepCredits[%i] = 0;
|
||||
}
|
||||
commsatcreditloop();
|
||||
}
|
||||
}
|
||||
|
||||
function DeployedSpySatellite::onDestroyed(%this, %obj, %prevState){
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team, SpySatelliteDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, delete);
|
||||
$commsatCPad[%obj.team].schedule(500, delete);
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function commsatControlStation::onAdd(%this, %obj){
|
||||
Parent::onAdd(%this, %obj);
|
||||
%obj.selectedWeapon = 1;
|
||||
%obj.schedule(5000, "playThread", $AmbientThread, "ambient");
|
||||
}
|
||||
|
||||
function commsatControlStation::playerMounted(%data, %obj, %player, %node) {
|
||||
%Player.setTransform("0 0 0 0 0 1 0");
|
||||
%player.vehicleTurret = %turret;
|
||||
|
||||
%Player.CanControl = true;
|
||||
%Player.schedule(650, "CanControl = false");
|
||||
|
||||
// If it is not a bot, then set them up controlling the turret
|
||||
%Client = %Player.client;
|
||||
if (%Client.isAIControlled() == false) {
|
||||
%player.setcontrolObject($commsat[%obj.team]);
|
||||
%client.setcontrolObject($commsat[%obj.team]);
|
||||
%client.setObjectActiveImage($commsat[%obj.team], 0);
|
||||
$commsat[%obj.team].selectedWeapon = 1;
|
||||
commandToClient(%client,'SetWeaponryVehicleKeys', true);
|
||||
commandToClient(%client, 'setHudMode', 'Pilot', "bomber", %node);
|
||||
%player.incommsat = 1;
|
||||
}
|
||||
%player.isBomber = true;
|
||||
%Player.lastWeapon = %Player.getMountedImage($WeaponSlot);
|
||||
%Player.unmountImage($WeaponSlot);
|
||||
|
||||
if (%Client.HavocClient == true)
|
||||
commandToClient(%obj.client,'SetPassengerVehicleKeys', true);
|
||||
}
|
||||
|
||||
function commsatControlStation::playerDismounted(%data, %Seat, %Player) {
|
||||
%Seat.fireWeapon = false;
|
||||
%Seat.setImageTrigger(0, false);
|
||||
|
||||
%Player.MCSturret = "";
|
||||
%Player.CanControl = "";
|
||||
%player.incommsat = 0;
|
||||
if (%Player.lastVehicle == %Seat)
|
||||
%Player.lastVehicle = "";
|
||||
|
||||
%Seat.lastPilot = "";
|
||||
}
|
||||
|
||||
function commsatControlStation::deleteAllMounted(%data, %obj){
|
||||
$commsat[%obj.team].damage(0, $commsat[%obj.team].getPosition(), 1000, $DamageType::Default);
|
||||
}
|
||||
|
||||
function commsatControlStation::playerDismounted(%data, %obj, %player){
|
||||
setTargetSensorGroup(%obj.getTarget(), %obj.team);
|
||||
if( %player.client.observeCount > 0 )
|
||||
resetObserveFollow( %player.client, true );
|
||||
}
|
||||
|
||||
function DeployedSpySatelliteMOVE( %this,%data ){
|
||||
%this.setImageTrigger(2, true);
|
||||
schedule(100, 0, "DeployedSpySatelliteNOMOVE", %this);
|
||||
}
|
||||
|
||||
function DeployedSpySatelliteNOMOVE(%obj){
|
||||
%obj.setImageTrigger(2,false);
|
||||
}
|
||||
|
||||
function DronePadDeployable::onPickup(%this, %obj, %shape, %amount){}
|
||||
|
||||
function DronePadDeployableImage::onDeploy(%item, %plyr, %slot){
|
||||
%pos = %item.surfacePt;
|
||||
%deplObj = new (StaticShape)() {
|
||||
dataBlock = Dronepad;
|
||||
scale = "2.5 2.5 1";
|
||||
};
|
||||
%deplObj.setTransform(%pos SPC %plyr.getRotation());
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
addToDeployGroup(%deplObj);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
$commsatVPad[%deplobj.team] = %deplobj;
|
||||
}
|
||||
|
||||
function DronePadDeployableImage::testNoTerrainFound(%item){}
|
||||
|
||||
function DronePadDeployableImage::onMount(%data, %obj, %node) {}
|
||||
|
||||
function DronePad::onDestroyed(%this, %obj, %prevState){
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
remDSurface(%obj);
|
||||
$TeamDeployedCount[%obj.team, DronePadDeployable]--;
|
||||
%obj.schedule(500, delete);
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function commsatcreditloop(){
|
||||
%count = ClientGroup.getCount();
|
||||
%amount = %count * 30 + 50;
|
||||
if(%amount < 160)
|
||||
%amount = 160;
|
||||
for(%i = 1;%i <= game.numteams; %i++){
|
||||
%currentmax = $teamRepCredits[%i] + $teamcredits[%i] + $teamUsedCredits[%i];
|
||||
if(%currentmax > %amount){
|
||||
%dif = %amount - %currentmax;
|
||||
if(%dif <= $teamRepCredits[%i])
|
||||
$teamRepCredits[%i] -= %dif;
|
||||
else{
|
||||
$teamcredits[%i] -= (%dif - $teamRepCredits[%i]);
|
||||
$teamRepCredits[%i] = 0;
|
||||
}
|
||||
}
|
||||
else if(%currentmax < %amount)
|
||||
$teamRepCredits[%i] += %amount - %currentmax;
|
||||
if($teamRepCredits[%i] > 0){
|
||||
%RepAmt = (5 + %count);
|
||||
if(%RepAmt > $teamRepCredits[%i])
|
||||
%RepAmt = $teamRepCredits[%i];
|
||||
$teamcredits[%i] += %RepAmt;
|
||||
$teamRepCredits -= %RepAmt;
|
||||
}
|
||||
}
|
||||
schedule(20000, 0, "commsatcreditloop");
|
||||
}
|
||||
163
Scripts/Packs/DeployableWaypoint.cs
Normal file
163
Scripts/Packs/DeployableWaypoint.cs
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Deployable Waypoint - Made by Dark Dragon DX
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedWaypoint) : StaticShapeDamageProfile {
|
||||
className = "Waypoint";
|
||||
shapeFile = "camera.dts";
|
||||
|
||||
maxDamage = 5.0;
|
||||
destroyedLevel = 5.0;
|
||||
disabledLevel = 2.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 5.0;
|
||||
expDamage = 0.5;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Waypoint Pack';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(WaypointDeployableImage) {
|
||||
mass = 1;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = Waypointdeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = Deployedwaypoint;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(WaypointDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
joint = "1 1 1";
|
||||
rotate = true;
|
||||
image = "WaypointDeployableImage";
|
||||
pickUpName = "a waypoint pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function WaypointDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function WaypointDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function WaypointDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function WaypointDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%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"));
|
||||
}
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%scale = getWords($packSetting["mspine",%plyr.packSet],0,2);
|
||||
|
||||
%mod = 0.5;
|
||||
%rndcolor = getrandom(0,5);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = DeployedWaypoint;
|
||||
team = %plyr.team;
|
||||
scale = "1 1 1";
|
||||
};
|
||||
%deplObj.wp = new (WayPoint)(){
|
||||
dataBlock = WayPointMarker;
|
||||
name = %plyr.client.namebase@"'s Waypoint";
|
||||
team = %plyr.team;
|
||||
scale = "0.1 0.1 0.1";
|
||||
};
|
||||
MissionCleanup.add(%deplObj.wp);
|
||||
|
||||
%mod = 0;
|
||||
%h1=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%mod));
|
||||
%deplObj.wp.setTransform(%h1 SPC %rot);
|
||||
%deplObj.setTransform(%h1 SPC %rot);
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
addToDeployGroup(%deplObj);
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
%deplObj.deploy();
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
%deplObj.deploy();
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
return %deplObj;
|
||||
|
||||
}
|
||||
|
||||
function deployedWaypoint::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, waypointdeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
%obj.wp.schedule(500,"delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function deployedwaypoint::disassemble(%data, %plyr, %obj){
|
||||
disassemble(%data,%plyr,%obj);
|
||||
%obj.wp.schedule(500, "delete");
|
||||
}
|
||||
1823
Scripts/Packs/Effectpacks.cs
Normal file
1823
Scripts/Packs/Effectpacks.cs
Normal file
File diff suppressed because it is too large
Load diff
144
Scripts/Packs/FlamerAmmopack.cs
Normal file
144
Scripts/Packs/FlamerAmmopack.cs
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
// ------------------------------------------------------------------
|
||||
// Flamer Ammo Pack
|
||||
|
||||
datablock ShapeBaseImageData(FlamerAmmoPackImage)
|
||||
{
|
||||
shapeFile = "ammo_plasma.dts";
|
||||
item = FlamerAmmoPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 -0.4";
|
||||
mass = 32;
|
||||
};
|
||||
|
||||
datablock ItemData(FlamerAmmoPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "ammo_plasma.dts";
|
||||
offset = "0 -0.2 -0.55";
|
||||
mass = 18.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "FlamerAmmoPackImage";
|
||||
pickUpName = "an flamer ammo pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
|
||||
// lightType = "PulsingLight";
|
||||
// lightColor = "0.2 0.4 0.0 1.0";
|
||||
// lightTime = "1200";
|
||||
// lightRadius = "1.0";
|
||||
|
||||
max[ChaingunAmmo] = 0;
|
||||
max[MortarAmmo] = 0;
|
||||
max[MissileLauncherAmmo] = 0;
|
||||
max[mgclip] = 0;
|
||||
max[SniperGunAmmo] = 0;
|
||||
max[BazookaAmmo] = 0;
|
||||
max[MG42Clip] = 0;
|
||||
max[Pistolclip] = 0;
|
||||
max[FlamerAmmo] = 150;
|
||||
max[AALauncherAmmo] = 0;
|
||||
max[RifleClip] = 0;
|
||||
max[ShotgunClip] = 0;
|
||||
max[RShotgunClip] = 0;
|
||||
max[LMissileLauncherAmmo] = 0;
|
||||
max[RPGAmmo] = 0;
|
||||
max[PBCAmmo] = 0;
|
||||
};
|
||||
|
||||
function FlamerAmmoPack::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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function FlamerAmmoPack::onThrow(%this,%pack,%player)
|
||||
{
|
||||
// %this = AmmoPack datablock
|
||||
// %pack = AmmoPack object number
|
||||
// %player = player
|
||||
|
||||
%player.throwflamerAmmoPack = 1;
|
||||
dropFlamerAmmoPack(%pack, %player);
|
||||
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
|
||||
serverPlay3D(ItemThrowSound, %player.getTransform());
|
||||
%pack.schedulePop();
|
||||
}
|
||||
|
||||
function FlamerAmmoPack::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.throwflamerAmmoPack == 1)
|
||||
{
|
||||
%player.throwflamerAmmoPack = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dropflamerAmmoPack(-1, %player);
|
||||
}
|
||||
}
|
||||
Pack::onInventory(%this,%player,%value);
|
||||
}
|
||||
|
||||
function dropFlamerAmmoPack(%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 = %player.getInventory(%ammo);
|
||||
%pMax = %player.getDatablock().max[%ammo];
|
||||
if(%pAmmo > %pMax)
|
||||
{
|
||||
if(%packObj > 0)
|
||||
{
|
||||
%packObj.setInventory(%ammo, %pAmmo - %pMax);
|
||||
}
|
||||
%player.setInventory(%ammo, %pMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%packObj > 0)
|
||||
{
|
||||
%packObj.inv[%ammo] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Scripts/Packs/JetBooster.cs
Normal file
53
Scripts/Packs/JetBooster.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//------------------------------------------
|
||||
// Jet Booster Pack
|
||||
// Made by: Blnukem.
|
||||
//------------------------------------------
|
||||
//------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(BoosterPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_energy.dts";
|
||||
item = BoosterPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
rechargeRateBoost = 1.5;
|
||||
|
||||
minRankPoints = 2550;
|
||||
|
||||
stateName[0] = "default";
|
||||
stateSequence[0] = "activation";
|
||||
};
|
||||
|
||||
datablock ItemData(BoosterPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_energy.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "BoosterPackImage";
|
||||
pickUpName = "a jet booster pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function BoosterPackImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setrechargeRate(%obj.getrechargeRate() + %data.rechargeRateBoost); // Allows the charging boost
|
||||
%obj.hasBoosterPack = true;
|
||||
}
|
||||
|
||||
function BoosterPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
%obj.setrechargeRate(%obj.getrechargeRate() - %data.rechargeRateBoost); // Takes away the charging boost when the pack is gone
|
||||
%obj.hasBoosterPack = "";
|
||||
}
|
||||
|
||||
function BoosterPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// Prevents Console Errors
|
||||
}
|
||||
482
Scripts/Packs/Medpack.cs
Normal file
482
Scripts/Packs/Medpack.cs
Normal file
|
|
@ -0,0 +1,482 @@
|
|||
datablock AudioProfile(MedPackCureSound)
|
||||
{
|
||||
filename = "fx/packs/shield_hit.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(MedPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
item = MedPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
emap = true;
|
||||
|
||||
gun = MedPackGunImage;
|
||||
|
||||
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(MedPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "MedPackImage";
|
||||
pickUpName = "a Med pack";
|
||||
|
||||
lightOnlyStatic = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "1 0 0 1";
|
||||
lightTime = 1200;
|
||||
lightRadius = 4;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(MedpackImg1)
|
||||
{
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.05 0";
|
||||
emap = true;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateSequence[1] = "fire";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(MedpackImg2)
|
||||
{
|
||||
shapeFile = "repair_kit.dts";
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.2 -0.18";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(MedpackImg2b)
|
||||
{
|
||||
shapeFile = "repair_kit.dts";
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.2 0.15";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Repair Gun
|
||||
|
||||
datablock ShockLanceProjectileData(ReviveProj)
|
||||
{
|
||||
directDamage = 0;
|
||||
radiusDamageType = $DamageType::ShockLance;
|
||||
kickBackStrength = 0; // z0dd - ZOD, 3/30/02. More lance kick. was 2500
|
||||
velInheritFactor = 0;
|
||||
sound = "";
|
||||
|
||||
zapDuration = 1.0;
|
||||
impulse = 1800;
|
||||
boltLength = 16.0;
|
||||
extension = 16.0;
|
||||
lightningFreq = 25.0;
|
||||
lightningDensity = 3.0;
|
||||
lightningAmp = 0.25;
|
||||
lightningWidth = 0.05;
|
||||
|
||||
shockwave = ShocklanceHit;
|
||||
|
||||
boltSpeed[0] = 2.0;
|
||||
boltSpeed[1] = -0.5;
|
||||
|
||||
texWrap[0] = 1.5;
|
||||
texWrap[1] = 1.5;
|
||||
|
||||
startWidth[0] = 0.3;
|
||||
endWidth[0] = 0.6;
|
||||
startWidth[1] = 0.3;
|
||||
endWidth[1] = 0.6;
|
||||
|
||||
texture[0] = "special/shockLightning01";
|
||||
texture[1] = "special/shockLightning02";
|
||||
texture[2] = "special/shockLightning03";
|
||||
texture[3] = "special/ELFBeam";
|
||||
|
||||
emitter[0] = ShockParticleEmitter;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(MedPackGunImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_repair.dts";
|
||||
offset = "0 0.15 0";
|
||||
rotation = "1 0 0 90";
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
cutOffEnergy = 3.1;
|
||||
emap = true;
|
||||
|
||||
repairFactorPlayer = 0.005;
|
||||
|
||||
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] = "Repair";
|
||||
|
||||
stateName[4] = "Repair";
|
||||
stateSound[4] = RepairPackFireSound;
|
||||
stateScript[4] = "onRepair";
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "fire";
|
||||
stateFire[4] = true;
|
||||
stateEnergyDrain[4] = 32;
|
||||
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";
|
||||
};
|
||||
|
||||
//---------------------------
|
||||
//PACK STUFF
|
||||
//---------------------------
|
||||
|
||||
function MedPackImage::onMount(%data, %obj, %node){
|
||||
%obj.mountImage(MedpackImg1, 4);
|
||||
%obj.mountImage(MedpackImg2, 7);
|
||||
}
|
||||
|
||||
function MedPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
if(%obj.getMountedImage($WeaponSlot))
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "MedPackGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
%obj.unmountImage(4);
|
||||
%obj.unmountImage(7);
|
||||
}
|
||||
|
||||
function MedPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger(4, true);
|
||||
%obj.mountImage(MedpackImg2b, 7);
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
|
||||
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
|
||||
|
||||
if(%obj.isPilot())
|
||||
{
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() !$= "MedPackGunImage")
|
||||
{
|
||||
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Repair pack activated.');
|
||||
|
||||
%obj.setArmThread(look);
|
||||
|
||||
%obj.mountImage(MedPackGunImage, $WeaponSlot);
|
||||
commandToClient(%obj.client, 'setRepairReticle');
|
||||
}
|
||||
}
|
||||
|
||||
function MedPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger(4, false);
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "MedpackGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
%obj.mountImage(MedpackImg2, 7);
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
//GUN STUFF
|
||||
//---------------------------
|
||||
|
||||
function MedPackGunImage::onMount(%this,%obj,%slot)
|
||||
{
|
||||
%obj.setImageAmmo(%slot,true);
|
||||
if ( !isDemo() )
|
||||
commandToClient( %obj.client, 'setRepairPackIconOn' );
|
||||
%obj.usingMedGun = 1;
|
||||
Bottomprint(%obj.client, "Med Gun: Fire to repair whithin a radius, jet to revive someone.\nIf on mode 2 (use mine key to toggle), you will cure an infected person.", 5, 2);
|
||||
}
|
||||
|
||||
function MedPackGunImage::onUnmount(%this,%obj,%slot)
|
||||
{
|
||||
if(%obj.isreping == 1)
|
||||
MedstopRepair(%obj);
|
||||
|
||||
%obj.setImageTrigger(%slot, false);
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
if ( !isDemo() )
|
||||
commandToClient( %obj.client, 'setRepairPackIconOff' );
|
||||
%obj.usingMedGun = 0;
|
||||
}
|
||||
|
||||
function MedPackGunImage::onRepair(%this,%obj,%slot){
|
||||
%obj.isreping = 1;
|
||||
%pos = %obj.getWorldBoxCenter();
|
||||
%obj.reptargets = "";
|
||||
InitContainerRadiusSearch(%pos, 10, $TypeMasks::PlayerObjectType);
|
||||
while ((%targetObject = containerSearchNext()) != 0){
|
||||
if(%targetObject.getDamageLevel() > 0.0 && %targetObject.getState() !$= "dead")
|
||||
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
|
||||
}
|
||||
if(%obj.reptargets $= ""){
|
||||
messageclient(%obj.client, 'MsgClient', '\c2No targets to repair.');
|
||||
}
|
||||
Medrepair(%obj, %obj.reptargets);
|
||||
}
|
||||
|
||||
function MedPackGunImage::onDeactivate(%this,%obj,%slot)
|
||||
{
|
||||
MedstopRepair(%obj);
|
||||
}
|
||||
|
||||
function Medrepair(%obj, %targets){
|
||||
if(%obj.isreping == 0)
|
||||
return;
|
||||
if(%targets !$= ""){
|
||||
%numtrgs = getNumberOfWords(%targets);
|
||||
for(%i = 0; %i < %numtrgs; %i++){
|
||||
%target = getWord(%targets, %i);
|
||||
if(vectorDist(%obj.getWorldBoxCenter(), %target.getWorldBoxCenter()) <= 10 && %target.getDamageLevel() > 0.0){
|
||||
if(%target.reping != 1){
|
||||
%target.reping = 1;
|
||||
%target.setRepairRate(%target.getRepairRate() + MedPackGunImage.repairFactorPlayer);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(%target.reping == 1){
|
||||
%target.reping = 0;
|
||||
%target.setRepairRate(%target.getRepairRate() - MedPackGunImage.repairFactorPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%pos = %obj.getWorldBoxCenter();
|
||||
%obj.reptargets = "";
|
||||
InitContainerRadiusSearch(%pos, 10, $TypeMasks::PlayerObjectType);
|
||||
while ((%targetObject = containerSearchNext()) != 0){
|
||||
if(%targetObject.getDamageLevel() > 0.0 && %targetObject.getState() !$= "dead")
|
||||
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
|
||||
}
|
||||
if(%obj.isreping == 1)
|
||||
%obj.reploop = schedule(500, 0, "Medrepair", %obj, %obj.reptargets);
|
||||
}
|
||||
|
||||
function MedstopRepair(%obj){
|
||||
%obj.isreping = 0;
|
||||
if(%obj.reptargets !$= ""){
|
||||
%numtrgs = getNumberOfWords(%obj.reptargets);
|
||||
for(%i = 0; %i < %numtrgs; %i++){
|
||||
%target = getWord(%obj.reptargets, %i);
|
||||
if(%target.reping == 1){
|
||||
%target.reping = 0;
|
||||
%target.setRepairRate(%target.getRepairRate() - MedPackGunImage.repairFactorPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
//REVIVE
|
||||
//---------------------------
|
||||
|
||||
function checkcure(%player)
|
||||
{
|
||||
%pos = %player.getMuzzlePoint($WeaponSlot);
|
||||
%vec = %player.getMuzzleVector($WeaponSlot);
|
||||
%targetpos = vectoradd(%pos,vectorscale(%vec,5));
|
||||
%obj = containerraycast(%pos, %targetpos, $TypeMasks::PlayerObjectType, %player);
|
||||
%obj = getword(%obj, 0);
|
||||
|
||||
if(!isObject(%obj))
|
||||
%obj = %player;
|
||||
|
||||
if(!isObject(%obj.client))
|
||||
{
|
||||
messageClient(%player.client, "", "\c2Either you're trying to cure a zombie or that is the wrong type of object.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(%obj.client.team != %player.client.team)
|
||||
{
|
||||
messageClient(%player.client, "", "\c2You cannot cure the other team!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!%obj.infected)
|
||||
{
|
||||
if(%obj != %player)
|
||||
messageClient(%player.client, "", "\c2That person isn't infected.");
|
||||
else
|
||||
messageClient(%player.client, "", "\c2You aren't infected.");
|
||||
return;
|
||||
}
|
||||
|
||||
%obj.infected = 0;
|
||||
cancel(%obj.infectedDamage);
|
||||
%obj.infectedDamage = "";
|
||||
%obj.beats = 0;
|
||||
%obj.canZkill = 0;
|
||||
%obj.hit = 0; // Ravenger bite count.
|
||||
cancel(%obj.zombieAttackImpulse);
|
||||
serverPlay3d(MedPackCureSound, %obj.getTransform());
|
||||
if(%obj != %player)
|
||||
{
|
||||
messageClient(%obj.client, "", "\c2"@%player.client.nameBase@" has cured you.");
|
||||
messageClient(%player.client, "", "\c2You just cured "@%obj.client.nameBase@"!");
|
||||
}
|
||||
else
|
||||
messageClient(%obj.client, "", "\c2You have cured yourself.");
|
||||
|
||||
if(getRandom() > 0.9)
|
||||
{
|
||||
%quarter = %obj.getDatablock().maxDamage / 4;
|
||||
%obj.setDamageLevel(%obj.getDamageLevel() + %quarter);
|
||||
%obj.setDamageFlash(0.5);
|
||||
playPain(%obj);
|
||||
|
||||
// Eolk - this is just a safety.
|
||||
if(%obj.getDamageLevel() >= %obj.getDatablock().maxDamage)
|
||||
Game.onClientKilled(%obj.client, %player.client, $DamageType::MedPackVaccine);
|
||||
|
||||
messageClient(%obj.client, "", "\c2You have been overdosed on the antidote vaccine!");
|
||||
if(%obj != %player)
|
||||
messageClient(%player.client, "", "\c2You overdosed the target with vaccine!");
|
||||
}
|
||||
}
|
||||
|
||||
function checkrevive(%obj){
|
||||
if(isObject(%obj.lasttouchedcorpse)){
|
||||
%Tobj = %obj.lasttouchedcorpse;
|
||||
if(%Tobj.infected == 1 || %Tobj.kibbled == 1){
|
||||
messageclient(%obj.client, 'MsgClient', "\c2This body is destroyed or ... changing.");
|
||||
return;
|
||||
}
|
||||
if(vectorDist(%obj.getPosition(),%Tobj.getPosition()) > 3){
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Must be in contact with a body to revive it.");
|
||||
return;
|
||||
}
|
||||
%eyevec = %obj.getEyeVector();
|
||||
%eyepos = posFromTransform(%obj.getEyeTransform());
|
||||
%Tvec = vectorNormalize(vectorSub(%Tobj.getPosition(),%eyepos));
|
||||
if(vectorDist(%eyevec, %Tvec) > 0.5){
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Must be looking at body.");
|
||||
return;
|
||||
}
|
||||
if(%Tobj.getState() !$= "dead"){
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Cannot revive, target isnt dead.");
|
||||
return;
|
||||
}
|
||||
if(%Tobj.team != %obj.team){
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Revive target should be the same team as you.");
|
||||
return;
|
||||
}
|
||||
if((%obj.getEnergyLevel() / %obj.getDataBlock().maxEnergy) >= 0.9){
|
||||
%obj.setEnergyLevel(0);
|
||||
revive(%obj, %tobj);
|
||||
}
|
||||
else
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Must have more energy to initiate reviver.");
|
||||
}
|
||||
else
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Must be in contact with a body to revive it.");
|
||||
}
|
||||
|
||||
function revive(%obj, %target){
|
||||
if(%target.client.getControlObject() !$= %target.client.player){
|
||||
//necessitys
|
||||
%target.setDamageLevel(%target.getdatablock().maxDamage - 0.1);
|
||||
%target.client.setControlObject(%target);
|
||||
%target.revived = 1;
|
||||
Cancel(%target.ParaLoop);
|
||||
Cancel(%target.revcheck);
|
||||
%target.client.player = %target;
|
||||
|
||||
//points and message
|
||||
%obj.client.revivecount++;
|
||||
messageclient(%target.client, 'MsgClient', "\c2You were revived by "@%obj.client.namebase@".");
|
||||
messageclient(%obj.client, 'MsgClient', "\c2You revived "@%target.client.namebase@".");
|
||||
|
||||
//effects
|
||||
%target.setDamageFlash(1);
|
||||
%target.setMoveState(true);
|
||||
playDeathCry(%target);
|
||||
revivestand(%target, 0);
|
||||
for(%i =0; %i<$InventoryHudCount; %i++)
|
||||
%target.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
|
||||
%target.client.clearBackpackIcon();
|
||||
|
||||
%obj.playAudio(0, ShockLanceHitSound);
|
||||
%p = new ShockLanceProjectile() {
|
||||
dataBlock = ReviveProj;
|
||||
initialDirection = vectorNormalize(vectorSub(%target.getPosition(),%obj.getMuzzlePoint($WeaponSlot)));
|
||||
initialPosition = %obj.getMuzzlePoint($WeaponSlot);
|
||||
sourceObject = %obj;
|
||||
sourceSlot = %obj.getMuzzlePoint($WeaponSlot);
|
||||
targetId = %target;
|
||||
};
|
||||
MissionCleanup.add(%p);
|
||||
}
|
||||
else
|
||||
messageclient(%obj.client, 'MsgClient', "\c2Target already has another clone in use.");
|
||||
}
|
||||
|
||||
function revivestand(%obj, %count){
|
||||
if(%obj.getstate() $= "dead")
|
||||
return;
|
||||
if(%count <= 2){
|
||||
%obj.setActionThread("scoutRoot",true);
|
||||
%obj.setDamageFlash(0.7);
|
||||
}
|
||||
else if(%count <= 5){
|
||||
%obj.setActionThread("sitting",true);
|
||||
%obj.setDamageFlash(0.4);
|
||||
}
|
||||
else if(%count >= 6){
|
||||
%obj.setActionThread("ski",true);
|
||||
%obj.setMoveState(false);
|
||||
return;
|
||||
}
|
||||
%count++;
|
||||
schedule(500, 0, "revivestand", %obj, %count);
|
||||
}
|
||||
406
Scripts/Packs/PurgeGenerator.cs
Normal file
406
Scripts/Packs/PurgeGenerator.cs
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
//==============================================================================
|
||||
// 'Purge' Shield Generator - Version 1.3
|
||||
// Made by Blnukem.
|
||||
//------------------------------------------------------------------------------
|
||||
// NOTES TO USERS:
|
||||
// • Useful for protecting an area from zombies.
|
||||
// • A large number of Zombie Demons or Lords can destroy the Purge easily.
|
||||
// • Heavy maintenence is required to keep the Purge active for a long period of
|
||||
// time, such as repairing the Generator constantly.
|
||||
// • The Purge has an automatic maintenence system that works great if you're
|
||||
// only fighting anything smaller than a Zombie Demon, but disables after a
|
||||
// certain amount of damage, so you need constant maintenence.
|
||||
//
|
||||
// When the maintenence system is near to be disabled or when it's first
|
||||
// activated, the Generator will signal an alarm.
|
||||
//==============================================================================
|
||||
// Lets set the amount of Purge Generators per team.
|
||||
$TeamDeployableMax[ShieldDeployable] = 2;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock EffectProfile(PurgeAlarmEffect)
|
||||
{
|
||||
effectname = "Bonuses/upward_perppass2_quark";
|
||||
minDistance = 25.0;
|
||||
maxDistance = 50.0;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock AudioProfile(PurgeAlarmSound)
|
||||
{
|
||||
filename = "fx/Bonuses/upward_perppass2_quark";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
effect = PurgeAlarmEffect;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedShield) : StaticShapeDamageProfile {
|
||||
className = shieldbase;
|
||||
shapeFile = "sensor_pulse_medium.dts";
|
||||
scale = "0.4 0.4 0.4";
|
||||
|
||||
maxDamage = 2.0;
|
||||
destroyedLevel = 2.0;
|
||||
disabledLevel = 1.5;
|
||||
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.8;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
humSound = SensorHumSound;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Purge';
|
||||
targetTypeTag = 'Shield Generator';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
deploySound = StationDeploySound;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(ShieldDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "pack_deploy_sensor_pulse.dts";
|
||||
item = ShieldDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedShield;
|
||||
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.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock ItemData(ShieldDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_sensor_pulse.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "ShieldDeployableImage";
|
||||
pickUpName = "a shield generator";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Shield Generator Functions.
|
||||
//==============================================================================
|
||||
|
||||
function ShieldDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShieldDeployableImage::testNoTerrainFound(%item) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShieldDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShieldDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
};
|
||||
|
||||
// Scale it.
|
||||
%deplobj.setscale(%deplobj.getdatablock().scale);
|
||||
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.shieldbase = %deplObj;
|
||||
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
%deplObj.playThread($AmbientThread,"ambient");
|
||||
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
// Start the loops.
|
||||
DeployedShieldLoop(%deplobj);
|
||||
RepairLoop(%deplobj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function DeployedShield::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, ShieldDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.shield.delete();
|
||||
%obj.emission.delete();
|
||||
%obj.schedule(800, "delete");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function DeployedShield::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
disassemble(%data,%plyr,%obj);
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
|
||||
%obj.shield.delete();
|
||||
%obj.emission.delete();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// By Blnukem:
|
||||
|
||||
function RepairLoop(%obj)
|
||||
{ // Lets initiate self-maintenence when we reach a certain amount of damage.
|
||||
if (!IsObject(%obj))
|
||||
return;
|
||||
|
||||
if (%obj.getDamageLevel() == 1.5 || %obj.getDamageLevel() > 1.5)
|
||||
{ // Initiate alarm - Generator is disabled.
|
||||
%obj.setRepairRate(0.0);
|
||||
serverPlay3d("PurgeAlarmSound", %obj.getWorldBoxCenter());
|
||||
Schedule(800,0,"RepairLoop",%obj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (%obj.getDamageLevel() < 0.01)
|
||||
{ // Stop repairing.
|
||||
%obj.setRepairRate(0.0);
|
||||
} else if (%obj.getDamageLevel() > 1.0)
|
||||
{ // Lets start repairing.
|
||||
%obj.setRepairRate(0.0025);
|
||||
}
|
||||
Schedule(800,0,"RepairLoop",%obj);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// By Blnukem:
|
||||
|
||||
function DeployedShieldLoop(%obj)
|
||||
{
|
||||
if (!IsObject(%obj))
|
||||
return;
|
||||
|
||||
if (%obj.getDamageLevel() == 1.5 || %obj.getDamageLevel() > 1.5)
|
||||
{
|
||||
schedule(100, 0, "DeployedShieldLoop", %obj);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!%obj.PowerCount)
|
||||
{
|
||||
schedule(100, 0, "DeployedShieldLoop", %obj);
|
||||
return;
|
||||
}
|
||||
|
||||
%Type = $TypeMasks::ProjectileObjectType | $TypeMasks::PlayerObjectType;
|
||||
InitContainerRadiusSearch(%obj.getPosition(), 25, %Type);
|
||||
while ((%target = ContainerSearchNext()) != 0)
|
||||
{
|
||||
if ((%target !$= %obj) && (strstr(%target.getDatablock().getName(), "Zombie") != -1))
|
||||
{ // Lets kill any Zombies in contact with the shield.
|
||||
%target.zapObject(1);
|
||||
%target.scriptkill($DamageType::Idiocy);
|
||||
serverPlay3d("ShockLanceHitSound",%target.getWorldBoxCenter());
|
||||
%obj.applydamage(0.1); // Damage the Purge Generator.
|
||||
%obj.playShieldEffect("1 1 1");
|
||||
} else if ((%target !$= %obj) && (%target.getDatablock().getName() $= "DemonFireball") || (%target.getDatablock().getName() $= "LZombieAcidBall"))
|
||||
{ // Lets delete any Zombie projectiles in contact with the shield.
|
||||
%obj.applydamage(0.05); // Damage the Purge Generator.
|
||||
%obj.playShieldEffect("1 1 1");
|
||||
%target.delete();
|
||||
}
|
||||
}
|
||||
schedule(100,0,"DeployedShieldLoop",%obj);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShieldDeployableImage::onMount(%data, %obj, %node) {
|
||||
return %data SPC %obj SPC %node;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ShieldDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
return %data SPC %obj SPC %node;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function DeployedShield::onGainPowerEnabled(%data,%obj) {
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
|
||||
if (!IsObject(%obj.shield))
|
||||
%obj.shield = createemitter(%obj.getposition(),ShieldBarrierSM,"0 0 0 0");
|
||||
if (!IsObject(%obj.emission))
|
||||
%obj.emission = createemitter(%obj.getposition(),ShieldEmission,"0 0 0 0");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function DeployedShield::onLosePowerDisabled(%data,%obj) {
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
|
||||
if (IsObject(%obj.shield))
|
||||
%obj.shield.delete();
|
||||
if (IsObject(%obj.emission))
|
||||
%obj.emission.delete();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Shield Particles.
|
||||
//==============================================================================
|
||||
// Made by Sloik:
|
||||
|
||||
datablock ParticleData(ShieldBarrierParticles)
|
||||
{
|
||||
dragCoefficient = 0.0;
|
||||
windCoefficient = 0;
|
||||
gravityCoefficient = 0;
|
||||
inheritedVelFactor = 0.0;
|
||||
constantAcceleration = 0;
|
||||
lifetimeMS = 5000;
|
||||
lifetimeVarianceMS = 0;
|
||||
useInvAlpha = false;
|
||||
spinRandomMin = -200.0;
|
||||
spinRandomMax = 200.0;
|
||||
textureName = "special/blasterHit";
|
||||
colors[0] = "0.01 0.01 0.01 1.0";
|
||||
colors[1] = "0.5 1.0 1.0 1.0";
|
||||
colors[2] = "0.01 0.01 0.01 0.0";
|
||||
sizes[0] = 0.05;
|
||||
sizes[1] = 0.2;
|
||||
sizes[2] = 0.05;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.7;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Made by Sloik:
|
||||
|
||||
datablock ParticleEmitterData(ShieldBarrierSM)
|
||||
{
|
||||
ejectionPeriodMS = 1;
|
||||
ejectionOffset = 25;
|
||||
periodVarianceMS = 0;
|
||||
ejectionVelocity = 0.0;
|
||||
velocityVariance = 0.0;
|
||||
thetaMin = 5;
|
||||
thetaMax = 175;
|
||||
phiReferenceVel = 0;
|
||||
phiVariance = 360;
|
||||
overrideAdvances = false;
|
||||
particles = "ShieldBarrierParticles";
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock ParticleData(ShieldEmissionParticle)
|
||||
{
|
||||
dragCoefficient = 2;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.2;
|
||||
constantAcceleration = -0.0;
|
||||
lifetimeMS = 1500;
|
||||
lifetimeVarianceMS = 800;
|
||||
textureName = "special/crescent3";
|
||||
colors[0] = "0.01 0.01 0.01 1.0";
|
||||
colors[1] = "0.5 1.0 1.0 1.0";
|
||||
colors[2] = "0.01 0.01 0.01 0.0";
|
||||
sizes[0] = 0.5;
|
||||
sizes[1] = 0.8;
|
||||
sizes[2] = 0.5;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
datablock ParticleEmitterData(ShieldEmission)
|
||||
{
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
ejectionVelocity = 40;
|
||||
velocityVariance = 5.0;
|
||||
ejectionOffset = 4.0;
|
||||
thetaMin = 5;
|
||||
thetaMax = 175;
|
||||
phiReferenceVel = 0;
|
||||
phiVariance = 360;
|
||||
overrideAdvances = false;
|
||||
orientParticles = true;
|
||||
particles = "ShieldEmissionParticle";
|
||||
};
|
||||
158
Scripts/Packs/SentinelPack.cs
Normal file
158
Scripts/Packs/SentinelPack.cs
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
datablock StaticShapeData(DeployedSentinelPatrol) : StaticShapeDamageProfile {
|
||||
className = "patrolpoint";
|
||||
shapeFile = "deploy_sensor_motion.dts";
|
||||
|
||||
maxDamage = 5.0;
|
||||
destroyedLevel = 5.0;
|
||||
disabledLevel = 4.21;
|
||||
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Sentinel';
|
||||
targetTypeTag = 'Patrol Point';
|
||||
deployAmbientThread = true;
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
|
||||
heatSignature = 0;
|
||||
needsPower = false;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(SentinelDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = SentinelDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedSentinelPatrol;
|
||||
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.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(SentinelDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "ZSpawnDeployableImage";
|
||||
pickUpName = "a sentinel patrol point pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function SentinelDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
%deplObj.setScale("5 5 5");
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
%deplObj.playThread($AmbientThread,"ambient");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
SentinelAI_AddPatrolPoint(%deplObj);
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function SentinelDeployable::onPickup(%data, %obj, %shape, %amount)
|
||||
{
|
||||
// No more spam
|
||||
}
|
||||
|
||||
function DeployedSentinelPatrol::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
SentinelAI_RemPatrolPoint(%obj);
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, SentinelDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function DeployedSentinelPatrol::disassemble(%data, %plyr, %obj)
|
||||
{
|
||||
SentinelAI_RemPatrolPoint(%obj);
|
||||
parent::disassemble(%data, %plyr, %obj);
|
||||
}
|
||||
1938
Scripts/Packs/ZSpawnpack.cs
Normal file
1938
Scripts/Packs/ZSpawnpack.cs
Normal file
File diff suppressed because it is too large
Load diff
334
Scripts/Packs/ammopack.cs
Normal file
334
Scripts/Packs/ammopack.cs
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
// ------------------------------------------------------------------
|
||||
// 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] = ChaingunAmmo;
|
||||
$AmmoItem[1] = MortarAmmo;
|
||||
$AmmoItem[2] = MissileLauncherAmmo;
|
||||
$AmmoItem[3] = MGclip;
|
||||
$AmmoItem[4] = SniperGunAmmo;
|
||||
$AmmoItem[5] = BazookaAmmo;
|
||||
$AmmoItem[6] = MG42Clip;
|
||||
$AmmoItem[7] = RepairKit;
|
||||
$AmmoItem[8] = FlamerAmmo;
|
||||
$AmmoItem[9] = AALauncherAmmo;
|
||||
$AmmoItem[10] = RifleClip;
|
||||
$AmmoItem[11] = ShotgunClip;
|
||||
$AmmoItem[12] = RShotgunClip;
|
||||
$AmmoItem[13] = LMissileLauncherAmmo;
|
||||
$AmmoItem[14] = RPGAmmo;
|
||||
$AmmoItem[15] = PBCAmmo;
|
||||
$AmmoItem[16] = NapalmAmmo;
|
||||
$AmmoItem[17] = RailGunAmmo;
|
||||
|
||||
|
||||
$numAmmoItems = 18;
|
||||
|
||||
$grenAmmoType[0] = Grenade;
|
||||
$grenAmmoType[1] = ConcussionGrenade;
|
||||
$grenAmmoType[2] = FlashGrenade;
|
||||
$grenAmmoType[3] = FlareGrenade;
|
||||
$grenAmmoType[4] = SmokeGrenade;
|
||||
$grenAmmoType[5] = BeaconSmokeGrenade;
|
||||
|
||||
$numGrenTypes = 6;
|
||||
|
||||
datablock ShapeBaseImageData(AmmoPackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
item = AmmoPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
mass = 20;
|
||||
};
|
||||
|
||||
datablock ItemData(AmmoPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
mass = 1.0;
|
||||
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[ChaingunAmmo] = 1500;
|
||||
max[MortarAmmo] = 4;
|
||||
max[MissileLauncherAmmo] = 4;
|
||||
max[Mgclip] = 3;
|
||||
max[SniperGunAmmo] = 10;
|
||||
max[BazookaAmmo] = 2;
|
||||
max[MG42Clip] = 2;
|
||||
max[FlamerAmmo] = 0;
|
||||
max[Grenade] = 2;
|
||||
max[Mine] = 1;
|
||||
max[AALauncherAmmo] = 2;
|
||||
max[RepairKit] = 1;
|
||||
max[RifleClip] = 2;
|
||||
max[ShotgunClip] = 2;
|
||||
max[RShotgunClip] = 1;
|
||||
max[LMissileLauncherAmmo] = 1;
|
||||
max[RPGAmmo] = 2;
|
||||
max[PBCAmmo] = 2;
|
||||
max[NapalmAmmo] = 5;
|
||||
max[RailGunAmmo] = 2;
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Scripts/Packs/artillerybarrelPack.cs
Normal file
59
Scripts/Packs/artillerybarrelPack.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Chaingun barrel pack
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(artilleryBarrelPackImage)
|
||||
{
|
||||
mass = 15;
|
||||
|
||||
shapeFile = "pack_barrel_fusion.dts";
|
||||
item = artilleryBarrelPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
turretBarrel = "artilleryBarrelLarge";
|
||||
|
||||
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(artilleryBarrelPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_barrel_fusion.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "artilleryBarrelPackImage";
|
||||
pickUpName = "a artillery barrel pack";
|
||||
|
||||
computeCRC = true;
|
||||
|
||||
};
|
||||
|
||||
function artilleryBarrelPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
checkTurretMount(%data, %obj, %slot); // This cheks if there is a turret where the player is aiming.
|
||||
}
|
||||
|
||||
function artilleryBarrelPackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
%obj.setImageTrigger($BackpackSlot, false);
|
||||
}
|
||||
|
||||
function artilleryBarrelPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
240
Scripts/Packs/blastfloor.cs
Normal file
240
Scripts/Packs/blastfloor.cs
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable floor
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedFloor) : StaticShapeDamageProfile {
|
||||
className = "floor";
|
||||
shapeFile = "smiscf.dts";
|
||||
|
||||
maxDamage = 4;
|
||||
destroyedLevel = 4;
|
||||
disabledLevel = 3.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 30;
|
||||
maxEnergy = 200;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Medium Blast floor';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(FloorDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = FloorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedFloor;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = false;
|
||||
maxDepSlope = 360; // also see FloorDeployableImage::testSlopeTooGreat()
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(FloorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "FloorDeployableImage";
|
||||
pickUpName = "a medium floor pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function FloorDeployableImage::testSlopeTooGreat(%item) {
|
||||
if (%item.surface) {
|
||||
// Do we link with another Medium Floor?
|
||||
if (%item.surface.getClassName() $= "StaticShape") {
|
||||
if (%item.surface.getDataBlock().className $= "floor") {
|
||||
%floor = 1;
|
||||
}
|
||||
}
|
||||
if (%floor) {
|
||||
if ($Host::Purebuild == true && $Host::Hazard::Enabled != true)
|
||||
return getTerrainAngle(%item.surfaceNrm) > %item.maxDepSlope;
|
||||
else
|
||||
return getTerrainAngle(%item.surfaceNrm) > 1;
|
||||
}
|
||||
else
|
||||
return getTerrainAngle(%item.surfaceNrm) > %item.maxDepSlope;
|
||||
}
|
||||
}
|
||||
|
||||
function FloorDeployableImage::testObjectTooClose(%item) {
|
||||
if ($Host::Purebuild == true && $Host::Hazard::Enabled != true)
|
||||
return "";
|
||||
else {
|
||||
%terrain = %item.surface.getClassName() $= "TerrainBlock";
|
||||
%interior = %item.surface.getClassName() $= "InteriorInstance";
|
||||
if (%item.surface.getClassName() $= "StaticShape") {
|
||||
if (%item.surface.getDataBlock().className $= "floor") {
|
||||
%floor = 1;
|
||||
}
|
||||
}
|
||||
return !(%terrain || %interior || %floor);
|
||||
}
|
||||
}
|
||||
|
||||
function FloorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function FloorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function FloorDeployableImage::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");
|
||||
|
||||
%rot = intRot("1 0 0 0",%playerVector);
|
||||
|
||||
%scale = getWords($packSetting["floor",%plyr.packSet],0,2);
|
||||
|
||||
if ($Host::ExpertMode == 1)
|
||||
%scale = getWords(%scale,0,1) SPC firstWord($expertSetting["floor",%plyr.expertSet]);
|
||||
|
||||
%surfaceAdjust = 1;
|
||||
// Do we link with another Medium Floor?
|
||||
if (%item.surface.getClassName() $= "StaticShape") {
|
||||
if (%item.surface.getDataBlock().className $= "floor") {
|
||||
%surfaceAdjust = 0;
|
||||
// [[Most]] Get the relative x y location from the "pure" information.
|
||||
%link = sidelink(%item.surface,%item.surfaceNrm,%item.surfacePt,getWords($packSetting["floor",%plyr.packSet],3,5),"0 0 -0.5");
|
||||
%location = getWords(%link,0,2);
|
||||
%side = getWords(%link,3,5);
|
||||
%dirside = getWords(%link,6,8);
|
||||
// [[Most]] Set the rotation to match the surfaceNrm and match the side.
|
||||
// The power of the full rotation system.. ;)
|
||||
%rot = fullRot(%item.surfaceNrm,vectorScale(%dirside,-1));
|
||||
// [[Most]] Adjust the location to match the scale.
|
||||
%adjust = vectorScale(%item.surfaceNrm,GetWord(%scale,2));
|
||||
%item.surfacePt = vectorSub(%location, %adjust);
|
||||
}
|
||||
}
|
||||
|
||||
// If we do not link with another Medium Floor
|
||||
if(%surfaceAdjust) {
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,"0 0" SPC getWord(%scale,2) - 1); // Rise 1 meter above surface
|
||||
}
|
||||
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedFloor::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, FloorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function FloorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasFloor = true; // set for floorcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function FloorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasFloor = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
271
Scripts/Packs/blastwall.cs
Normal file
271
Scripts/Packs/blastwall.cs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable wall, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedWall) : StaticShapeDamageProfile {
|
||||
className = "wall";
|
||||
shapeFile = "Bmiscf.dts"; // dmiscf.dts, alternate
|
||||
|
||||
maxDamage = 2;
|
||||
destroyedLevel = 2;
|
||||
disabledLevel = 1.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 60;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Blast Wall';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(WallDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = WallDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedWall;
|
||||
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;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(WallDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "WallDeployableImage";
|
||||
pickUpName = "a light blast wall pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function WallDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function WallDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function WallDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function WallDeployableImage::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"));
|
||||
}
|
||||
|
||||
%scale = "0.5 8 40"; // Search range for total blast wall size.
|
||||
|
||||
%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);
|
||||
%offset = %plyr.packSet - 1;
|
||||
if (%plyr.packSet == 3) {
|
||||
%double = 1;
|
||||
%offset = 1;
|
||||
}
|
||||
|
||||
%scale = vectorAdd(%scale,vectorScale("1.01 1.01" SPC %double,mAbs(%offset)));
|
||||
|
||||
%pup = mCeil(getWord(%scale,0)/4); //4 = Avarage blast wall height.
|
||||
%pside = mCeil(getWord(%scale,1)/4); //4 = Avarage blast wall width.
|
||||
%upiece = getWord(%scale,0)/%pup;
|
||||
%spiece = getWord(%scale,1)/%pside;
|
||||
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
%dir = VectorNormalize(vectorSub(%item.surfacePt,%plyr.getposition()));
|
||||
%adjust = vectorNormalize(vectorProject(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
|
||||
// %adjust = vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2));
|
||||
|
||||
if (%plyr.packSet == 3)
|
||||
%offset = Lev(vectorCouple(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
|
||||
|
||||
%adjust = vectorScale(%adjust,-0.5 * %offset);
|
||||
|
||||
if ($Host::ExpertMode == 1 && %plyr.expertSet == 1) {
|
||||
for (%x = 0;%x < %pup;%x++){
|
||||
for (%y = 0;%y < %pside;%y++){
|
||||
%scale = %upiece SPC %spiece SPC 0.5 + %double;
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
%up = vectorScale(%item.surfaceNrm,%upiece * (%x - (%pup / 2) + 0.5));
|
||||
%side = vectorScale(%item.surfaceNrm2,%spiece * (%y - (%pside / 2) + 0.5));
|
||||
%tadjust = vectorAdd(%up,vectorAdd(%side,%adjust));
|
||||
%deplObj.setTransform(vectorAdd(%item.surfacePt,%tadjust) SPC %rot);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.Needsfit = 1;
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
// let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
%deplObj.setTransform(vectorAdd(%item.surfacePt,%adjust) SPC %rot);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.Needsfit = 1;
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
}
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedWall::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, WallDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function WallDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasBlast = true; // set for blastcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function WallDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasBlast = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function doorfunction(%player,%door)
|
||||
{
|
||||
%vec = VectorSub(%door,%player);
|
||||
%dir = VectorNormalize(%vec);
|
||||
%nrm = topVec(VirVec(%door,%dir));
|
||||
}
|
||||
225
Scripts/Packs/blastwwall.cs
Normal file
225
Scripts/Packs/blastwwall.cs
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable wall, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedwWall) : StaticShapeDamageProfile {
|
||||
className = "wwall";
|
||||
shapeFile = "smiscf.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Walk Way';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(wWallDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = wwallDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedwWall;
|
||||
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;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(wwallDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "wWallDeployableImage";
|
||||
pickUpName = "a light walkway pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function wWallDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function wWallDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function wwallDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function wWallDeployableImage::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");
|
||||
|
||||
%rot = intRot("1 0 0 0",%playerVector);
|
||||
|
||||
%scale ="5 5 0.5";
|
||||
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (%plyr.expertSet == 2)
|
||||
%scale = getWord(%scale,0) * 2 SPC getWords(%scale,1,2);
|
||||
if (%plyr.expertSet == 3)
|
||||
%scale = getWord(%scale,0) SPC getWord(%scale,1) * 2 SPC getWord(%scale,2);
|
||||
}
|
||||
|
||||
%surfaceAdjust = 1;
|
||||
// Do we link with another shape?
|
||||
if (%item.surface.getClassName() $= "StaticShape") {
|
||||
%surfaceAdjust = 0;
|
||||
// [[Most]] Get the relative x y location from the "pure" informtation.
|
||||
%link = sidelink(%item.surface,%item.surfaceNrm,%item.surfacePt,%scale,"0 0 -0.5");
|
||||
%location = getWords(%link,0,2);
|
||||
%side = getWords(%link,3,5);
|
||||
%dirside = getWords(%link,6,8);
|
||||
// [[Most]] Set the rotation to match the surfaceNrm and match the side.
|
||||
// The power of the full rotation system.. ;)
|
||||
%rot = fullRot(%item.surfaceNrm,%dirside);
|
||||
// [[Most]] Adjust the location to match the scale.
|
||||
%adjust = vectorScale(%item.surfaceNrm,getWord(%scale,2));
|
||||
%item.surfacePt = vectorSub(%location, %adjust);
|
||||
}
|
||||
|
||||
// If we do not link with another shape
|
||||
if(%surfaceAdjust) {
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,"0 0" SPC getWord(%scale,2) - 1); // Rise 1 meter above surface
|
||||
}
|
||||
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
%axis = vectorCross(virvec(%item.surface,%item.surfaceNrm),virvec(%item.surface,%side));
|
||||
%axis = vectorScale(%axis,-1);
|
||||
%vec1 = vectorScale(virvec(%item.surface,%side),0.5);
|
||||
%vec2 = vectorAdd(vectorScale(virvec(%item.surface,%item.surfaceNrm),-0.5),"0 0 -0.5");
|
||||
|
||||
deployEffect(%deplObj,%location,%side,"walk");
|
||||
%angle = getWord($packSetting["walk",%plyr.packSet],0)/180*$Pi;
|
||||
%deplObj.setTransform(remoterotate(%deplObj,%axis SPC %angle,%item.surface,vectorAdd(%vec2,%vec1)));
|
||||
|
||||
if ($Host::ExpertMode == 1 && %plyr.expertSet == 1) {
|
||||
%v = getRandom()*0.02 SPC getRandom()*0.02 SPC getRandom()*0.02;
|
||||
%deplObj.setTransform(vectorAdd(pos(%deplObj),%v) SPC rot(%deplObj));
|
||||
}
|
||||
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedwWall::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, wwallDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function wWallDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasWalk = true; // set for wwallcheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function wWallDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.packSet = 0;
|
||||
%obj.hasWalk = "";
|
||||
}
|
||||
272
Scripts/Packs/cratepack.cs
Normal file
272
Scripts/Packs/cratepack.cs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Crates
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedCrate) : StaticShapeDamageProfile {
|
||||
className = "crate";
|
||||
shapeFile = "stackable3s.dts";
|
||||
|
||||
maxDamage = 4.5;
|
||||
destroyedLevel = 4.5;
|
||||
disabledLevel = 4.0;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.3;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Crate';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate0) : DeployedCrate {
|
||||
shapeFile = "stackable1s.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate1) : DeployedCrate {
|
||||
shapeFile = "stackable1m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate2) : DeployedCrate {
|
||||
shapeFile = "stackable1l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate3) : DeployedCrate {
|
||||
shapeFile = "stackable2s.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate4) : DeployedCrate {
|
||||
shapeFile = "stackable2m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate5) : DeployedCrate {
|
||||
shapeFile = "stackable2l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate6) : DeployedCrate {
|
||||
shapeFile = "stackable3s.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate7) : DeployedCrate {
|
||||
shapeFile = "stackable3m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate8) : DeployedCrate {
|
||||
shapeFile = "stackable3l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate9) : DeployedCrate {
|
||||
shapeFile = "stackable4m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate10) : DeployedCrate {
|
||||
shapeFile = "stackable4l.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate11) : DeployedCrate {
|
||||
shapeFile = "stackable5m.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedCrate12) : DeployedCrate {
|
||||
shapeFile = "stackable5l.dts";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(CrateDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = CrateDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedCrate;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(CrateDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "CrateDeployableImage";
|
||||
pickUpName = "a crate pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function CrateDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function CrateDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function CrateDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function CrateDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed @ %plyr.packSet;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedCrate::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, CrateDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function CrateDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasCrate = true; // set for cratecheck
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function CrateDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasCrate = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function DeployedCrate0::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate1::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, CrateDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
%pos = %obj.getposition();
|
||||
%rot = %obj.getrotation();
|
||||
%team = %obj.team;
|
||||
schedule(501, 0, "MakeFCrate", %pos, %rot, %team);
|
||||
}
|
||||
|
||||
function DeployedCrate2::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate3::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate4::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate5::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate6::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate7::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate8::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate9::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate10::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate11::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedCrate12::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function MakeFCrate(%pos, %rot, %team){
|
||||
%pos = vectorAdd(%pos, "0 0 0.1");
|
||||
%Fcrate = new WheeledVehicle()
|
||||
{
|
||||
dataBlock = VehicleTestCrate1;
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
team = %team;
|
||||
};
|
||||
MissionCleanUp.add(%Fcrate);
|
||||
%Fcrate.setTransform(%pos @ " " @ %rot);
|
||||
%Fcrate.schedule(60000, delete);
|
||||
}
|
||||
|
||||
51
Scripts/Packs/deconExamples.cs
Normal file
51
Scripts/Packs/deconExamples.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//------------------------------------------------
|
||||
// Examples of item specific disassemble.
|
||||
//================================================
|
||||
// ----------------
|
||||
// 1. ONE
|
||||
// ================
|
||||
function TelePadDeployedBase::disassemble(%data, %plyr, %hTgt)
|
||||
{
|
||||
%teleteam = %hTgt.team;
|
||||
if(%obj.Hacked) // is it hacked currently?
|
||||
{
|
||||
%teleteam = %hTgt.OldTeam;
|
||||
echo("hacked!");
|
||||
}
|
||||
|
||||
// dising a telepad makes it yours, remove from the other teams list
|
||||
if($TeamDeployedCount[%teleteam, TelePadPack] > 0) // this wasnt the last
|
||||
{
|
||||
if($firstPad[%teleteam] == %hTgt) // the first was disassembled
|
||||
{
|
||||
echo("first pad disassembled");
|
||||
$firstPad[%teleteam] = %ohTgtbj.nextPad; // make the second one the first
|
||||
%hTgt.prevPad = -1;
|
||||
%hTgt.nextPad = %obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
%lastPad = $firstPad[%teleteam];
|
||||
%hTgt.prevPad.nextPad = %hTgt.nextPad;
|
||||
%hTgt.nextPad.prevPad = %hTgt.prevPad;
|
||||
}
|
||||
|
||||
}
|
||||
else // last one
|
||||
{
|
||||
$firstPad[%teleteam] = ""; // remove it
|
||||
}
|
||||
|
||||
%hTgt.shield.delete();
|
||||
}
|
||||
|
||||
// --------------
|
||||
// 2. Two
|
||||
// ==============
|
||||
|
||||
function MobileBaseVehicle::disassemble(%data, %plyr, %hTgt)
|
||||
{
|
||||
%mpbpos = %hTgt.gettransform();
|
||||
%hTgt.delete();
|
||||
teleporteffect(posfromtransform(%mpbpos));
|
||||
}
|
||||
380
Scripts/Packs/decorationpack.cs
Normal file
380
Scripts/Packs/decorationpack.cs
Normal file
|
|
@ -0,0 +1,380 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Decoration
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration) : StaticShapeDamageProfile {
|
||||
className = "decoration";
|
||||
shapeFile = "banner_unity.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Decoration';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration0) : DeployedDecoration {
|
||||
shapeFile = "banner_unity.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration1) : DeployedDecoration {
|
||||
shapeFile = "banner_strength.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration2) : DeployedDecoration {
|
||||
shapeFile = "banner_honor.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration3) : DeployedDecoration {
|
||||
shapeFile = "light_male_dead.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration4) : DeployedDecoration {
|
||||
shapeFile = "medium_male_dead.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration5) : DeployedDecoration {
|
||||
shapeFile = "heavy_male_dead.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration6) : DeployedDecoration {
|
||||
shapeFile = "statue_base.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration7) : DeployedDecoration {
|
||||
shapeFile = "statue_lmale.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration8) : DeployedDecoration {
|
||||
shapeFile = "statue_lfemale.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration9) : DeployedDecoration {
|
||||
shapeFile = "statue_hmale.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration10) : DeployedDecoration {
|
||||
shapeFile = "vehicle_grav_tank_wreck.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration11) : DeployedDecoration {
|
||||
shapeFile = "vehicle_air_scout_wreck.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration12) : DeployedDecoration {
|
||||
shapeFile = "billboard_1.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration13) : DeployedDecoration {
|
||||
shapeFile = "billboard_2.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration14) : DeployedDecoration {
|
||||
shapeFile = "billboard_3.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration15) : DeployedDecoration {
|
||||
shapeFile = "billboard_4.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedDecoration16) : DeployedDecoration {
|
||||
shapeFile = "goal_panel.dts";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(DecorationDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "statue_lfemale.dts"; // "stackable1s.dts";
|
||||
item = DecorationDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.6 -1.9";
|
||||
rotation = "0 0.1 1 180";
|
||||
deployed = DeployedDecoration;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(DecorationDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "DecorationDeployableImage";
|
||||
pickUpName = "a decoration pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function DecorationDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function DecorationDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function DecorationDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function DecorationDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1") {
|
||||
if (%plyr.packSet == 3 || %plyr.packSet == 5)
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
}
|
||||
else {
|
||||
if (%plyr.packSet < 3)
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
else {
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
if (%plyr.packSet == 3 || %plyr.packSet == 5)
|
||||
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
|
||||
}
|
||||
}
|
||||
if (%item.surface.needsFit == 1) {
|
||||
if (%plyr.packSet > 5 && %plyr.packSet < 10 && %item.surface.getDataBlock().getName() $= "DeployedDecoration6") {
|
||||
%item.surfaceNrm2 = vectorCross(%item.surfaceNrm,realVec(%item.surface,"0 -1 0"));
|
||||
}
|
||||
}
|
||||
%item.surfaceNrm3 = vectorCross(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed @ %plyr.packSet;
|
||||
};
|
||||
|
||||
if (%plyr.packSet < 3) {
|
||||
%surfacePt2 = %item.surfacePt;
|
||||
%rot2 = %rot;
|
||||
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm3,2.80));
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.25));
|
||||
%rot = rotAdd(%rot,"1 0 0" SPC $Pi / 2);
|
||||
%rot = rotAdd(%rot,"0 1 0" SPC $Pi);
|
||||
%deplObj.lTarget = new StaticShape () {
|
||||
datablock = DeployedLTarget;
|
||||
scale = 2.5/4 SPC 5/3 SPC 0.15 * 2;
|
||||
};
|
||||
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
|
||||
%deplObj.lTarget.lMain = %deplObj;
|
||||
}
|
||||
|
||||
if (%plyr.packSet > 2 && %plyr.packSet < 6) {
|
||||
%surfacePt2 = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.2));
|
||||
%rot2 = %rot;
|
||||
if (%plyr.packSet == 3) {
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,-0.14));
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,0.51));
|
||||
}
|
||||
else if (%plyr.packSet == 4) {
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,0.25));
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,-0.4));
|
||||
}
|
||||
else if (%plyr.packSet == 5) {
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,0.05));
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,0.4));
|
||||
%rot = rotAdd(%rot,"0 0 -1" SPC $Pi / 4);
|
||||
}
|
||||
%deplObj.lTarget = new StaticShape () {
|
||||
datablock = DeployedLTarget;
|
||||
scale = 0.4/4 SPC 0.5/3 SPC 0.05 * 2;
|
||||
};
|
||||
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
|
||||
%deplObj.lTarget.lMain = %deplObj;
|
||||
}
|
||||
|
||||
if (%plyr.packSet == 11)
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,-2));
|
||||
|
||||
if (%plyr.packSet > 11 && %plyr.packSet < 16) {
|
||||
%surfacePt2 = %item.surfacePt;
|
||||
%rot2 = %rot;
|
||||
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,10.9));
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm,34));
|
||||
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,-1));
|
||||
%rot2 = rotAdd(%rot,"1 0 0" SPC $Pi / 2);
|
||||
%deplObj.lTarget = new StaticShape () {
|
||||
datablock = DeployedLTarget;
|
||||
scale = 74/4 SPC 49/3 SPC 4;
|
||||
};
|
||||
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
|
||||
%deplObj.lTarget.lMain = %deplObj;
|
||||
}
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate) {
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
%deplObj.lTarget.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
}
|
||||
|
||||
// [[Settings]]:
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
if (%deplObj.lTarget) {
|
||||
%deplObj.lTarget.team = %plyr.client.Team;
|
||||
%deplObj.lTarget.setOwner(%plyr);
|
||||
}
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
if (%deplObj.lTarget)
|
||||
addToDeployGroup(%deplObj.lTarget);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client,%deplObj);
|
||||
if (%deplObj.lTarget)
|
||||
AIDeployObject(%plyr.client,%deplObj.lTarget);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
if (%deplObj.lTarget)
|
||||
addDSurface(%deplObj,%deplObj.lTarget);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedDecoration::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, DecorationDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
if (isObject(%obj.lTarget))
|
||||
%obj.lTarget.schedule(500, "delete");
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function DecorationDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasDecoration = true; // set for decorationcheck
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function DecorationDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasDecoration = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function DeployedDecoration0::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration1::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration2::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration3::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration4::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration5::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration6::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration7::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration8::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration9::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration10::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration11::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration12::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration13::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration14::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration15::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedDecoration16::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
397
Scripts/Packs/door.cs
Normal file
397
Scripts/Packs/door.cs
Normal file
|
|
@ -0,0 +1,397 @@
|
|||
//client.player.setInventory(doorDeployable,1,true);
|
||||
//---------------------------------------------------------
|
||||
// Deployable mspine, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
datablock StaticShapeData(DeployedDoor) : StaticShapeDamageProfile {
|
||||
className = "door";
|
||||
shapeFile = "Pmiscf.dts"; // b or dmiscf.dts, alternate
|
||||
|
||||
maxDamage = 5;
|
||||
destroyedLevel = 5;
|
||||
disabledLevel = 4;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 60;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Door';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(DoorDeployableImage) {
|
||||
mass = 1;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = DoorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedDoor;
|
||||
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;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(DoorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "DoorDeployableImage";
|
||||
pickUpName = "a door pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function DoorDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function DoorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function DoorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function doorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasDoor = true; // set for blastcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 3;
|
||||
displayPowerFreq(%obj);
|
||||
|
||||
}
|
||||
|
||||
function doorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasDoor = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function doorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%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"));
|
||||
}
|
||||
}
|
||||
|
||||
%rot1 = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%scale1 = "0.5 6 160";
|
||||
%scale2 = "0.5 8 160";
|
||||
%dataBlock = %item.deployed;
|
||||
|
||||
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale1,$AllObjMask);
|
||||
if (%space != getWord(%scale1,1))
|
||||
%type = true;
|
||||
%scale1 = getWord(%scale1,0) SPC getWord(%scale1,0) SPC %space;
|
||||
|
||||
|
||||
%mCenter = "0 0 -0.5";
|
||||
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale2,%mCenter);
|
||||
%scale2 = getWords(%pad,0,2);
|
||||
%item.surfacePt2 = getWords(%pad,3,5);
|
||||
|
||||
//%vec1 = realVec(getWord(%item.surface,0),%item.surfaceNrm);
|
||||
//%vec1 = realVec(%pad,%item.surfaceNrm);
|
||||
%vec1 =validateVal(MatrixMulVector("0 0 0",%item.surfaceNrm));
|
||||
|
||||
if (!%scaleIsSet){
|
||||
%scale1 = vectorMultiply(%scale1,1/4 SPC 1/3 SPC 2);
|
||||
%scale2 = vectorMultiply(%scale2,1/4 SPC 1/3 SPC 2);
|
||||
%x = (getWord(%scale2,1)/0.166666)*0.125;
|
||||
%scale3 = %x SPC 0.166666 SPC getWord(%scale1,2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
%dir1 = VectorNormalize(vectorSub(%item.surfacePt,%item.surfacePt2));
|
||||
%adjust1 = vectorNormalize(vectorProject(%dir1,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
|
||||
%offset1 = -0.5;
|
||||
%adjust1 = vectorScale(%adjust1,-0.5 * %offset1);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %dataBlock;
|
||||
scale = %scale3;
|
||||
};
|
||||
%deplObj.closedscale = %scale3;
|
||||
%deplObj.openedscale = getwords(%scale3,0,1) SPC 0.1;
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// exact:
|
||||
//%deplObj.setTransform(%item.surfacePt SPC %rot1);
|
||||
%deplObj.setTransform(vectorAdd(VectorAdd(%item.surfacePt2, VectorScale(%vec1,getword(%scale3,2)/-4)),%adjust1) SPC %rot1);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
%deplObj.isdoor = 1;
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
%deplobj.timeout = getWord($expertSetting["Door", %plyr.expertSet], 0);
|
||||
%deplobj.hasslided = 0;
|
||||
%deplobj.state = "Closed";
|
||||
|
||||
if (%plyr.packset==0)
|
||||
%deplobj.toggletype=0;
|
||||
|
||||
if (%plyr.packset==1)
|
||||
%deplobj.toggletype=1;
|
||||
|
||||
if (%plyr.packset==2) {
|
||||
%deplobj.powercontrol=1;
|
||||
%deplobj.toggletype=1;
|
||||
}
|
||||
|
||||
if (%plyr.packset==3) {
|
||||
%deplobj.powercontrol=2;
|
||||
%deplobj.toggletype=1;
|
||||
}
|
||||
|
||||
if (%plyr.packset==4) {
|
||||
%deplobj.collisionType = 1;
|
||||
%deplobj.toggletype=0; // This is left mostly as a reference.
|
||||
}
|
||||
|
||||
if (%plyr.packset==5)
|
||||
{
|
||||
%deplobj.collisionType = 2;
|
||||
%deplobj.accessLevel = 1;
|
||||
%deplobj.toggletype=0; // This is left mostly as a reference.
|
||||
messageClient(%plyr.client, "", "\c2Use \c3/setAccess [level] \c2- to set the access level needed for this door, use \c3/setPAccess [name] [level] \c2- to set someone's access level over your pieces.");
|
||||
}
|
||||
|
||||
if (%plyr.packset==6) {
|
||||
%deplobj.collisionType = 3;
|
||||
%deplobj.toggletype=0; // This is left mostly as a reference.
|
||||
}
|
||||
|
||||
if (%plyr.packset==7) {
|
||||
%deplobj.collisionType = 4;
|
||||
%deplobj.toggletype=0; // This is left mostly as a reference.
|
||||
}
|
||||
|
||||
%deplobj.canmove = true;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj); // Keep this down here. It updates the state of the powered doors.
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function Deployeddoor::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, DoorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function Deployeddoor::disassemble(%data,%plyr,%hTgt) {
|
||||
disassemble(%data,%plyr,%hTgt);
|
||||
}
|
||||
|
||||
function doorDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasdoor = true; // set for mspinecheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function doorDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasdoor = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
|
||||
function Deployeddoor::onGainPowerEnabled(%data,%obj) {
|
||||
if(%obj.canmove == true && %obj.powercontrol >= 1)
|
||||
{
|
||||
if(%obj.powerControl == 1 && %obj.state !$= "opened") // open when powered
|
||||
schedule(10, 0, "open", %obj);
|
||||
else if(%obj.powerControl == 2 && %obj.state !$= "closed") // closed when powered
|
||||
schedule(10, 0, "close", %obj, 1);
|
||||
}
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function Deployeddoor::onLosePowerDisabled(%data,%obj) {
|
||||
if(%obj.canmove == true && %obj.powercontrol >= 1)
|
||||
{
|
||||
if(%obj.powerControl == 1 && %obj.state !$= "closed") // open when unpowered
|
||||
schedule(10, 0, "close", %obj, 1);
|
||||
else if(%obj.powerControl == 2 && %obj.state !$= "opened") // closed when unpowered
|
||||
schedule(10, 0, "open", %obj);
|
||||
}
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
|
||||
function DeployedDoor::onCollision(%data, %obj, %col)
|
||||
{
|
||||
if(%obj.canMove == true && %obj.collisionType > 0 && %col.getDataBlock().getClassName() $= "PlayerData")
|
||||
{
|
||||
switch$(%obj.collisionType)
|
||||
{
|
||||
case 1:
|
||||
Open(%obj);
|
||||
case 2:
|
||||
if(%col.client.givenAccess[%obj.getOwner()] >= %obj.accessLevel || %obj.getOwner() == %col.client)
|
||||
Open(%obj);
|
||||
else
|
||||
messageClient(%col.client, "", "\c3Access denied. \c2You need \c3level-"@%obj.accessLevel@"\c2 from \c3"@%obj.getOwner().nameBase@"\c2 to access this door.");
|
||||
case 3:
|
||||
if(%obj.getOwner() == %col.client)
|
||||
Open(%obj);
|
||||
else
|
||||
messageClient(%col.client, "", "\c3Access denied. \c2This door is only for \c3"@%obj.getOwner().nameBase@"\c2.");
|
||||
case 4:
|
||||
if(%col.client.isAdmin || %obj.getOwner() == %col.client)
|
||||
Open(%obj);
|
||||
else
|
||||
messageClient(%col.client, "", "\c3Access denied. \c2This door is for \c3admins \c2or \c3"@%obj.getOwner().nameBase@"\c2 only.");
|
||||
}
|
||||
}
|
||||
|
||||
// Don't call parent! It causes console spam!
|
||||
// -- Eolk
|
||||
}
|
||||
|
||||
////////////////////
|
||||
////////////////////
|
||||
function open(%obj)
|
||||
{
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
|
||||
if (%obj.canmove == true)
|
||||
{
|
||||
%obj.moving = "open";
|
||||
%obj.prevscale = %obj.scale;
|
||||
%obj.closedscale= %obj.scale;
|
||||
%obj.canmove = false;
|
||||
}
|
||||
|
||||
if (getWord(%obj.scale, 2) < 0.3)
|
||||
{
|
||||
%obj.issliding = 0;
|
||||
%obj.scale = getWord(%obj.scale,0) SPC getWord(%obj.scale,1) SPC 0.1;
|
||||
%obj.settransform(%obj.gettransform());
|
||||
%obj.state = "opened";
|
||||
%obj.openedscale= %obj.scale;
|
||||
|
||||
if (%obj.toggletype == 0)
|
||||
schedule(%obj.timeout * 1000, 0, "close", %obj, 1);
|
||||
else
|
||||
%obj.canmove = true;
|
||||
return;
|
||||
}
|
||||
|
||||
%obj.scale = getWord(%obj.scale, 0) SPC getWord(%obj.scale, 1) SPC getWord(%obj.prevscale ,2) - 0.4;
|
||||
%obj.settransform(%obj.gettransform());
|
||||
%obj.prevscale = %obj.scale;
|
||||
schedule(40, 0, "open", %obj);
|
||||
}
|
||||
/////////////////////
|
||||
/////////////////////
|
||||
function close(%obj,%timeout)
|
||||
{
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
|
||||
if (%obj.canmove == true)
|
||||
{
|
||||
%obj.moving = "close";
|
||||
%obj.prevscale =%obj.scale;
|
||||
%obj.openedscale=%obj.scale;
|
||||
%obj.canmove = false;
|
||||
}
|
||||
|
||||
if (getWord(%obj.scale, 2) > getWord(%obj.closedscale, 2) - 0.2)
|
||||
{
|
||||
%obj.issliding = 0;
|
||||
%obj.scale = getWord(%obj.scale,0) SPC getWord(%obj.scale,1) SPC getWord(%obj.closedscale,2);
|
||||
%obj.settransform(%obj.gettransform());
|
||||
%obj.state = "closed";
|
||||
%obj.closedscale= %obj.scale;
|
||||
%obj.canmove = true;
|
||||
return;
|
||||
}
|
||||
%obj.scale = getWord(%obj.scale, 0) SPC getWord(%obj.scale, 1) SPC getWord(%obj.prevscale, 2) + 0.4;
|
||||
%obj.settransform(%obj.gettransform());
|
||||
%obj.prevscale = %obj.scale;
|
||||
schedule(40, 0, "close", %obj);
|
||||
}
|
||||
1161
Scripts/Packs/forcefieldpack.cs
Normal file
1161
Scripts/Packs/forcefieldpack.cs
Normal file
File diff suppressed because it is too large
Load diff
145
Scripts/Packs/generator.cs
Normal file
145
Scripts/Packs/generator.cs
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Generator
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(GeneratorDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = GeneratorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = GeneratorLarge;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 2;
|
||||
maxDeployDis = 5;
|
||||
};
|
||||
|
||||
datablock ItemData(GeneratorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.8 0.8 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "GeneratorDeployableImage";
|
||||
pickUpName = "a generator pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function GeneratorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function GeneratorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),2));
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = GeneratorLarge;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set power
|
||||
%deplObj.setSelfPowered();
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// add to power list
|
||||
$PowerList = listAdd($PowerList,%deplObj,-1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function GeneratorLarge::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if (%obj.deployed && ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon)) {
|
||||
%obj.isRemoved = true;
|
||||
%loc = findWord($PowerList,%obj);
|
||||
if (%loc !$= "")
|
||||
$PowerList = listDel($PowerList,%loc);
|
||||
$TeamDeployedCount[%obj.team,GeneratorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
Parent::onDestroyed(%data,%obj,%prevState);
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasGen = true; // set for gencheck
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasGen = "";
|
||||
}
|
||||
344
Scripts/Packs/gravityfieldpack.cs
Normal file
344
Scripts/Packs/gravityfieldpack.cs
Normal file
|
|
@ -0,0 +1,344 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Gravity Field
|
||||
//---------------------------------------------------------
|
||||
|
||||
// Translucencies
|
||||
%fieldTrans = 1.0;
|
||||
%powerOffTrans = 0.25;
|
||||
|
||||
// RGB
|
||||
%colourOn = 0.6;
|
||||
%colourOff = 0.15;
|
||||
%dimDiv = 3;
|
||||
|
||||
datablock ForceFieldBareData(DeployedGravityField) {
|
||||
className = "gravityfield";
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = "1.0 1.0 1.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'GravityField';
|
||||
texture[0] = "skins/forcef1";
|
||||
texture[1] = "skins/forcef2";
|
||||
texture[2] = "skins/forcef3";
|
||||
texture[3] = "skins/forcef4";
|
||||
texture[4] = "skins/forcef5";
|
||||
framesPerSec = 10;
|
||||
numFrames = 5;
|
||||
scrollSpeed = 15;
|
||||
umapping = 1.0;
|
||||
vmapping = 0.15;
|
||||
deployedFrom = GravityFieldDeployable;
|
||||
velocityMod = 1;
|
||||
gravityMod = 1;
|
||||
appliedForce = "0 0 0";
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
// slow
|
||||
datablock ForceFieldBareData(DeployedGravityField0) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff/%dimDiv SPC %colourOn/%dimDiv SPC %colourOff/%dimDiv;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// fast
|
||||
datablock ForceFieldBareData(DeployedGravityField1) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// zero gravity
|
||||
datablock ForceFieldBareData(DeployedGravityField2) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// fastfield
|
||||
datablock ForceFieldBareData(DeployedGravityField3) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn/%dimDiv SPC %colourOff/%dimDiv SPC %colourOn/%dimDiv;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1.5;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// super fastfield
|
||||
datablock ForceFieldBareData(DeployedGravityField4) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1.7;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(GravityFieldDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "ammo_chaingun.dts";
|
||||
item = GravityFieldDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "-0.2 -0.125 0";
|
||||
rotation = "0 -1 0 90";
|
||||
deployed = DeployedGravityField;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(GravityFieldDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
joint = "4.75 4.75 4.75";
|
||||
rotate = true;
|
||||
image = "GravityFieldDeployableImage";
|
||||
pickUpName = "a gravity field pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function GravityFieldDeployableImage::testObjectTooClose(%item) {
|
||||
return;
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function GravityFieldDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
//Object
|
||||
%className = "ForceFieldBare";
|
||||
|
||||
%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"));
|
||||
}
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%scale = getWords($packSetting["gravfield",%plyr.packSet],0,2);
|
||||
|
||||
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale);
|
||||
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
|
||||
|
||||
// Shift field position since field handle is not field center
|
||||
%mod = firstWord($packSetting["gravfield",%plyr.packSet]) / 2;
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%mod));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%mod));
|
||||
|
||||
// Add padding
|
||||
%padSize = 0.01;
|
||||
%scale = vectorAdd(%scale,%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%padSize));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%padSize));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%padSize));
|
||||
|
||||
// Set datablock
|
||||
if (%plyr.packSet == 0)
|
||||
%dataBlock = nameToID(%item.deployed @ 0);
|
||||
else if (%plyr.packSet == 1)
|
||||
%dataBlock = nameToID(%item.deployed @ 1);
|
||||
else if (%plyr.packSet == 2)
|
||||
%dataBlock = nameToID(%item.deployed @ 0);
|
||||
else if (%plyr.packSet == 3)
|
||||
%dataBlock = nameToID(%item.deployed @ 1);
|
||||
else if (%plyr.packSet == 4)
|
||||
%dataBlock = nameToID(%item.deployed @ 2);
|
||||
else if (%plyr.packSet == 5)
|
||||
%dataBlock = nameToID(%item.deployed @ 3);
|
||||
else if (%plyr.packSet == 6)
|
||||
%dataBlock = nameToID(%item.deployed @ 4);
|
||||
|
||||
%appliedForceVec = vectorNormalize(%item.surfaceNrm);
|
||||
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (isCubic(%item.surface) && (%plyr.expertSet == 1 || %plyr.expertSet == 2) && %plyr.team == %item.surface.team
|
||||
&& %item.surface.getType() & $TypeMasks::StaticShapeObjectType
|
||||
&& (($Host::OnlyOwnerCubicReplace == 0) || (%plyr.client == %item.surface.getOwner()))) {
|
||||
if (%plyr.expertSet == 2)
|
||||
%appliedForceVec = vectorNormalize(realVec(%item.surface,"0 0 1"));
|
||||
%scale = vectorAdd(realSize(%item.surface),%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
|
||||
%center = realVec(%item.surface,vectorScale(getWords(%scale,0,1) SPC "0",-0.5));
|
||||
%item.surfacePt = vectorAdd(pos(%item.surface),%center);
|
||||
%rot = rot(%item.surface);
|
||||
%mod = vectorScale(matrixMulVector("0 0 0" SPC %rot ,"0 0 1"),-%padSize);
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,%mod);
|
||||
%item.surface.getDataBlock().disassemble(%plyr, %item.surface);
|
||||
}
|
||||
}
|
||||
|
||||
%velocityMod = %dataBlock.velocityMod;
|
||||
%gravityMod = %dataBlock.gravityMod;
|
||||
%appliedForce = %dataBlock.appliedForce;
|
||||
|
||||
%slowForce = 500;
|
||||
%fastForce = 1000;
|
||||
|
||||
if (%plyr.packSet == 0)
|
||||
%appliedForce = vectorScale(%appliedForceVec,%slowForce);
|
||||
else if (%plyr.packSet == 1)
|
||||
%appliedForce = vectorScale(%appliedForceVec,%fastForce);
|
||||
else if (%plyr.packSet == 2)
|
||||
%appliedForce = vectorScale(%appliedForceVec,-%slowForce);
|
||||
else if (%plyr.packSet == 3)
|
||||
%appliedForce = vectorScale(%appliedForceVec,-%fastForce);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %dataBlock;
|
||||
scale = %scale;
|
||||
velocityMod = %velocityMod;
|
||||
gravityMod = %gravityMod;
|
||||
appliedForce = %appliedForce;
|
||||
};
|
||||
|
||||
// Take the deployable off the player's back and out of inventory
|
||||
if ($Host::ExpertMode == 0) {
|
||||
%plyr.unMountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
}
|
||||
|
||||
////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
%deplObj.pzone.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
if (!%deplObj.powerCount > 0) {
|
||||
%deplObj.getDataBlock().disassemble(0,%deplObj); // Run Item Specific code.
|
||||
messageClient(%plyr.client,'MsgDeployFailed','\c2Gravity field lost - no power source found!%1','~wfx/misc/misc.error.wav');
|
||||
}
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
function GravityFieldDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasGravField = true; // set for gravfieldcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasGravField = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function DeployedGravityField::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField0::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField1::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField2::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField3::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField4::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
176
Scripts/Packs/jumpad.cs
Normal file
176
Scripts/Packs/jumpad.cs
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Jumpad
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedJumpad) : StaticShapeDamageProfile {
|
||||
className = "jumpad";
|
||||
shapeFile = "nexusbase.dts"; // dmiscf.dts, alternate
|
||||
maxDamage = 2.0;
|
||||
destroyedLevel = 2.0;
|
||||
disabledLevel = 2.0;
|
||||
mass = 1.2;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
collideable = 1;
|
||||
pickupRadius = 1;
|
||||
sticky=false;
|
||||
|
||||
impulse = 5000;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.8 0.8 1.0";
|
||||
lightTime = "100";
|
||||
lightRadius = "3";
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
|
||||
targetNameTag = 'Jump';
|
||||
targetTypeTag = 'Pad';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(JumpadDeployableImage) {
|
||||
mass = 10;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = JumpadDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedJumpad;
|
||||
heatSignature = 0;
|
||||
collideable = 1;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360; // 30
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(JumpadDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "JumpadDeployableImage";
|
||||
pickUpName = "a jump pad pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function JumpadDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%impulse = firstWord($packSetting["jumpad",%plyr.packSet]);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = "1 1 2";
|
||||
};
|
||||
|
||||
// set impulse (jump pad strength)
|
||||
%deplObj.impulse = %impulse;
|
||||
|
||||
// set orientation
|
||||
%deplObj.setDeployRotation(getWords(%item.surfacePt, 0, 1) SPC getWord(%item.surfacePt, 2) + 0.1, %item.surfaceNrm);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedJumpad::onCollision(%data,%obj,%col) {
|
||||
// TODO - update escape pod
|
||||
if (%col.getClassName() !$= "Player" && %col.getDataBlock().getName() !$= "EscapePodVehicle")
|
||||
return; // Only boost players
|
||||
if (%obj.team == %col.team) {
|
||||
%vel = %col.getVelocity();
|
||||
%vec = realVec(%obj,"0 0 1");
|
||||
%position = getWords(%col.getTransform(), 0, 2);
|
||||
// %impulseVec = vectorScale(%vec,1000); // Jump clear of the pad
|
||||
// %col.applyImpulse(%position, %impulseVec);
|
||||
%col.playAudio(0, MortarFireSound);
|
||||
%impulseVec = vectorScale(%vec,%obj.impulse);
|
||||
// %col.schedule(50, "applyImpulse", %position, %impulseVec);
|
||||
%col.applyImpulse(%position, %impulseVec);
|
||||
}
|
||||
}
|
||||
|
||||
function DeployedJumpad::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, JumpadDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasJumpad = true; // set for jumpadcheck
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasJumpad = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
123
Scripts/Packs/largeInventory.cs
Normal file
123
Scripts/Packs/largeInventory.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Large Inventory Station
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(LargeInventoryDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = LargeInventoryDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = StationInventory;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(LargeInventoryDeployable)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "LargeInventoryDeployableImage";
|
||||
joint = "4.5 4.5 4.5";
|
||||
pickUpName = "a large inventory station pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function LargeInventoryDeployable::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
%plyr.unMountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
%grounded = 0;
|
||||
if (%item.surface.getClassName() $= TerrainBlock)
|
||||
%grounded = 1;
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() //Inventory Station
|
||||
{
|
||||
dataBlock = StationInventory;
|
||||
position = %surfacePt;
|
||||
rotation = %rot;
|
||||
deployed = true;
|
||||
};
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Adjust the trigger object
|
||||
adjustTrigger(%deplObj);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::testNoTerrainFound(%item)
|
||||
{
|
||||
//return %item.surface.getClassName() !$= TerrainBlock;
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::onMount(%data, %obj, %node) {
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
127
Scripts/Packs/largeSensor.cs
Normal file
127
Scripts/Packs/largeSensor.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Large Pulse Sensor
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(LargeSensorDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = LargeSensorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = SensorLargePulse;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(LargeSensorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "LargeSensorDeployableImage";
|
||||
joint = "4.5 4.5 4.5";
|
||||
pickUpName = "a large pulse sensor pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function LargeSensorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function LargeSensorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function LargeSensorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = SensorLargePulse;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
// setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// %deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function SensorLargePulse::onDestroyed(%data,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if (%obj.deployed) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team,LargeSensorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
Parent::onDestroyed(%data,%obj,%prevState);
|
||||
}
|
||||
|
||||
function LargeSensorDeployableImage::onMount(%data, %obj, %node) {
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
164
Scripts/Packs/laserturret.cs
Normal file
164
Scripts/Packs/laserturret.cs
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Large Mortar Turret
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Sounds
|
||||
//--------------------------------------
|
||||
datablock EffectProfile(MBLSwitchEffect)
|
||||
{
|
||||
effectname = "powered/turret_heavy_activate";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 5.0;
|
||||
};
|
||||
|
||||
datablock EffectProfile(MBLFireEffect)
|
||||
{
|
||||
effectname = "powered/turret_mortar_fire";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 5.0;
|
||||
};
|
||||
|
||||
datablock AudioProfile(MBLSwitchSound)
|
||||
{
|
||||
filename = "fx/powered/turret_heavy_activate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
effect = MBLSwitchEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(MBLFireSound)
|
||||
{
|
||||
filename = "fx/powered/turret_mortar_fire.wav";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
effect = MBLFireEffect;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
//--------------------------------------
|
||||
|
||||
datablock AudioProfile(MortarTurretProjectileSound)
|
||||
{
|
||||
filename = "fx/weapons/mortar_projectile.wav";
|
||||
description = ProjectileLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock GrenadeProjectileData(MortarTurretShot)
|
||||
{
|
||||
projectileShapeName = "mortar_projectile.dts";
|
||||
emitterDelay = -1;
|
||||
directDamage = 0.0;
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 1.32;
|
||||
damageRadius = 30.0;
|
||||
radiusDamageType = $DamageType::MortarTurret;
|
||||
kickBackStrength = 3000;
|
||||
|
||||
explosion = "MortarExplosion";
|
||||
velInheritFactor = 0.5;
|
||||
splash = MortarSplash;
|
||||
|
||||
baseEmitter = MortarSmokeEmitter;
|
||||
bubbleEmitter = MortarBubbleEmitter;
|
||||
|
||||
grenadeElasticity = 0.25;
|
||||
grenadeFriction = 0.4;
|
||||
armingDelayMS = 1500; // z0dd - ZOD, 4/25/02. Was 2000
|
||||
gravityMod = 1.2; // z0dd - ZOD, 5/18/02. Make mortar projectile heavier, less floaty
|
||||
muzzleVelocity = 75.95; // z0dd - ZOD, 8/13/02. More speed to compensate for higher gravity. Was 63.7
|
||||
drag = 0.1;
|
||||
|
||||
sound = MortarTurretProjectileSound;
|
||||
|
||||
hasLight = true;
|
||||
lightRadius = 3;
|
||||
lightColor = "0.05 0.2 0.05";
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//-------------------------------------- Fusion Turret Image
|
||||
//
|
||||
datablock TurretImageData(MortarBarrelLarge)
|
||||
{
|
||||
shapeFile = "turret_mortar_large.dts";
|
||||
item = MortarBarrelPack; // z0dd - ZOD, 4/25/02. Was wrong: MortarBarrelLargePack
|
||||
|
||||
projectile = MortarTurretShot;
|
||||
projectileType = GrenadeProjectile;
|
||||
usesEnergy = true;
|
||||
fireEnergy = 30;
|
||||
minEnergy = 30;
|
||||
emap = true;
|
||||
|
||||
// don't let a mortar turret blow itself up
|
||||
dontFireInsideDamageRadius = true;
|
||||
damageRadius = 40;
|
||||
|
||||
param = ScoutMortarParam;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 700; // z0dd - ZOD, 4/25/02. Was 1000. Amount of time it takes turret to unfold
|
||||
deactivateDelayMS = 1500;
|
||||
thinkTimeMS = 140; // z0dd - ZOD, 4/25/02. Was 200. Amount of time before turret starts to unfold (activate)
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 960;
|
||||
attackRadius = 400; // z0dd - ZOD, 4/25/02. Was 160
|
||||
|
||||
// State transitions
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnNotLoaded[0] = "Dead";
|
||||
stateTransitionOnLoaded[0] = "ActivateReady";
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateSequence[1] = "Activate";
|
||||
stateSound[1] = MBLSwitchSound;
|
||||
stateTimeoutValue[1] = 1;
|
||||
stateTransitionOnTimeout[1] = "Ready";
|
||||
stateTransitionOnNotLoaded[1] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[1] = "NoAmmo";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateTransitionOnNotLoaded[2] = "Deactivate";
|
||||
stateTransitionOnTriggerDown[2] = "Fire";
|
||||
stateTransitionOnNoAmmo[2] = "NoAmmo";
|
||||
|
||||
stateName[3] = "Fire";
|
||||
stateTransitionOnTimeout[3] = "Reload";
|
||||
stateTimeoutValue[3] = 0.3;
|
||||
stateFire[3] = true;
|
||||
stateRecoil[3] = LightRecoil;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateSound[3] = MBLFireSound;
|
||||
stateScript[3] = "onFire";
|
||||
|
||||
stateName[4] = "Reload";
|
||||
stateTimeoutValue[4] = 1.5;
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "Reload";
|
||||
stateTransitionOnTimeout[4] = "Ready";
|
||||
stateTransitionOnNotLoaded[4] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[4] = "NoAmmo";
|
||||
|
||||
stateName[5] = "Deactivate";
|
||||
stateSequence[5] = "Activate";
|
||||
stateDirection[5] = false;
|
||||
stateTimeoutValue[5] = 1;
|
||||
stateTransitionOnLoaded[5] = "ActivateReady";
|
||||
stateTransitionOnTimeout[5] = "Dead";
|
||||
|
||||
stateName[6] = "Dead";
|
||||
stateTransitionOnLoaded[6] = "ActivateReady";
|
||||
|
||||
stateName[7] = "NoAmmo";
|
||||
stateTransitionOnAmmo[7] = "Reload";
|
||||
stateSequence[7] = "NoAmmo";
|
||||
};
|
||||
|
||||
|
||||
|
||||
325
Scripts/Packs/lightpack.cs
Normal file
325
Scripts/Packs/lightpack.cs
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Light
|
||||
//---------------------------------------------------------
|
||||
|
||||
%colourOn = 0.5;
|
||||
%colourOff = 0.1;
|
||||
|
||||
%strobeColourOn = 1.0;
|
||||
%strobeColourOff = 0.0;
|
||||
|
||||
datablock StaticShapeData(DeployedLightBase) : StaticShapeDamageProfile {
|
||||
className = "lightbase";
|
||||
shapeFile = "pack_deploy_sensor_motion.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Light';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight) {
|
||||
shapeFile = "turret_muzzlepoint.dts";
|
||||
hasLight = true;
|
||||
lightType = "ConstantLight";
|
||||
lightColor = "1.0 1.0 1.0 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "15";
|
||||
};
|
||||
|
||||
// Constant
|
||||
|
||||
datablock ItemData(DeployedLight0) : DeployedLight {
|
||||
lightColor = %colourOn SPC %colourOn SPC %colourOn;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight1) : DeployedLight {
|
||||
lightColor = %colourOn SPC %colourOff SPC %colourOff;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight2) : DeployedLight {
|
||||
lightColor = %colourOff SPC %colourOn SPC %colourOff;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight3) : DeployedLight {
|
||||
lightColor = %colourOff SPC %colourOff SPC %colourOn;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight4) : DeployedLight {
|
||||
lightColor = %colourOff SPC %colourOn SPC %colourOn;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight5) : DeployedLight {
|
||||
lightColor = %colourOn SPC %colourOff SPC %colourOn;
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight6) : DeployedLight {
|
||||
lightColor = %colourOn SPC %colourOn SPC %colourOff;
|
||||
};
|
||||
|
||||
// Strobe
|
||||
|
||||
datablock ItemData(DeployedLight7) : DeployedLight {
|
||||
lightColor = %strobeColourOn SPC %strobeColourOn SPC %strobeColourOn;
|
||||
lightType = "PulsingLight";
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight8) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOn SPC %strobeColourOff SPC %strobeColourOff;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight9) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOff SPC %strobeColourOn SPC %strobeColourOff;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight10) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOff SPC %strobeColourOff SPC %strobeColourOn;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight11) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOff SPC %strobeColourOn SPC %strobeColourOn;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight12) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOn SPC %strobeColourOff SPC %strobeColourOn;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ItemData(DeployedLight13) : DeployedLight {
|
||||
lightType = "PulsingLight";
|
||||
lightColor = %strobeColourOn SPC %strobeColourOn SPC %strobeColourOff;
|
||||
lightTime = "50";
|
||||
lightRadius = "10";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(LightDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = LightDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedLightBase;
|
||||
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.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(LightDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "LightDeployableImage";
|
||||
pickUpName = "a light pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function LightDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function LightDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function LightDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function LightDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
};
|
||||
|
||||
%deplObj.LgtColor = %plyr.packset;
|
||||
|
||||
%deplObj.light = new Item() {
|
||||
datablock = DeployedLight @ %plyr.packSet;
|
||||
static = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
adjustLight(%deplObj);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.light.lightBase = %deplObj;
|
||||
%deplObj.lightPowerMode = %plyr.expertSet;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
%deplObj.playThread($AmbientThread,"ambient");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedLightBase::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, LightDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
if (isObject(%obj.light))
|
||||
%obj.light.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function DeployedLightBase::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.light))
|
||||
%obj.light.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function adjustLight(%obj) {
|
||||
%obj.light.setTransform(vectorAdd(%obj.getPosition(),vectorScale(realVec(%obj,"0 0 1"),1)) SPC %obj.getRotation());
|
||||
}
|
||||
|
||||
function LightDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasLight = true; // set for lightcheck
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function LightDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasLight = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function DeployedLightBase::onGainPowerEnabled(%data,%obj) {
|
||||
if (%obj.lightPowerMode)
|
||||
{
|
||||
if(isObject(%obj.light))
|
||||
%obj.light.delete();
|
||||
} // have to put brackets here or `else` will be confused
|
||||
else
|
||||
{
|
||||
if (isObject(%obj.light))
|
||||
%obj.light.delete();
|
||||
%Obj.light = new Item() {
|
||||
datablock = DeployedLight @ %Obj.LgtColor;
|
||||
static = true;
|
||||
};
|
||||
// set orientation
|
||||
adjustLight(%Obj);
|
||||
}
|
||||
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function DeployedLightBase::onLosePowerDisabled(%data,%obj) {
|
||||
if (!%obj.lightPowerMode)
|
||||
{
|
||||
if(isObject(%obj.light))
|
||||
%obj.light.delete();
|
||||
} // have to put brackets here or `else` will be confused
|
||||
else
|
||||
{
|
||||
if (isObject(%obj.light))
|
||||
%obj.light.delete();
|
||||
%Obj.light = new Item() {
|
||||
datablock = DeployedLight @ %Obj.LgtColor;
|
||||
static = true;
|
||||
};
|
||||
// set orientation
|
||||
adjustLight(%Obj);
|
||||
}
|
||||
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
237
Scripts/Packs/logoprojectorpack.cs
Normal file
237
Scripts/Packs/logoprojectorpack.cs
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Logo Logo Projector
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedLogoProjector) : StaticShapeDamageProfile {
|
||||
className = "logoprojector";
|
||||
shapeFile = "teamlogo_projector.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Logo Projector';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(LogoProjectorDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "teamlogo_projector.dts";
|
||||
item = LogoProjectorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
rotation = "-1 0 0 90";
|
||||
deployed = DeployedLogoProjector;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(LogoProjectorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "LogoProjectorDeployableImage";
|
||||
pickUpName = "a logo projector pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function LogoProjectorDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function LogoProjectorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
};
|
||||
|
||||
if ($Host::Purebuild == 1)
|
||||
if (%plyr.packSet == 0)
|
||||
%logo = 0;
|
||||
else
|
||||
%logo = %plyr.packSet;
|
||||
else {
|
||||
%logo = 0;
|
||||
}
|
||||
|
||||
switch (%logo) {
|
||||
case 1:
|
||||
%logo = "Base";
|
||||
case 2:
|
||||
%logo = "BaseB";
|
||||
case 3:
|
||||
%logo = "Swolf";
|
||||
case 4:
|
||||
%logo = "DSword";
|
||||
case 5:
|
||||
%logo = "BEagle";
|
||||
case 6:
|
||||
%logo = "COTP";
|
||||
case 7:
|
||||
%logo = "Bioderm";
|
||||
default:
|
||||
%logo = "0";
|
||||
}
|
||||
|
||||
if (%logo $= "0")
|
||||
%deplObj.holoBlock = getTaggedString(Game.getTeamSkin(%plyr.client.team)) @ "Logo";
|
||||
else
|
||||
%deplObj.holoBlock = %logo @ "Logo";
|
||||
|
||||
%deplObj.holo = new StaticShape() {
|
||||
datablock = %deplObj.holoBlock;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
adjustHolo(%deplObj);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.holo.team = %plyr.client.Team;
|
||||
%deplObj.holo.setOwner(%plyr);
|
||||
%deplObj.holo.projector = %deplObj;
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client,%deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedLogoProjector::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, LogoProjectorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
if (isObject(%obj.holo))
|
||||
%obj.holo.schedule(500, "delete");
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function DeployedLogoProjector::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.holo))
|
||||
%obj.holo.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedLogoProjector::onGainPowerEnabled(%data,%obj) {
|
||||
if (shouldChangePowerState(%obj,true)) {
|
||||
if (isObject(%obj.holo))
|
||||
%obj.holo.delete();
|
||||
%obj.holo = new StaticShape() {
|
||||
datablock = %obj.holoBlock;
|
||||
projector = %obj;
|
||||
};
|
||||
adjustHolo(%obj);
|
||||
}
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function DeployedLogoProjector::onLosePowerDisabled(%data,%obj) {
|
||||
if (shouldChangePowerState(%obj,false)) {
|
||||
if (isObject(%obj.holo))
|
||||
%obj.holo.delete();
|
||||
}
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
|
||||
function adjustHolo(%obj) {
|
||||
%obj.holo.setTransform(vectorAdd(%obj.getPosition(),vectorScale(realVec(%obj,"0 0 1"),10)) SPC %obj.getRotation());
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasProjector = true; // set for projectorcheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasProjector = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
127
Scripts/Packs/mediumSensor.cs
Normal file
127
Scripts/Packs/mediumSensor.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Medium Pulse Sensor
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MediumSensorDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = MediumSensorDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = SensorMediumPulse;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(MediumSensorDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "MediumSensorDeployableImage";
|
||||
joint = "4.5 4.5 4.5";
|
||||
pickUpName = "a medium pulse sensor pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function MediumSensorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function MediumSensorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function MediumSensorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = SensorMediumPulse;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
// setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// %deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function SensorMediumPulse::onDestroyed(%data,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if (%obj.deployed) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team,MediumSensorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
Parent::onDestroyed(%data,%obj,%prevState);
|
||||
}
|
||||
|
||||
function MediumSensorDeployableImage::onMount(%data, %obj, %node) {
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
274
Scripts/Packs/mspine.cs
Normal file
274
Scripts/Packs/mspine.cs
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable mspine, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedMSpine) : StaticShapeDamageProfile {
|
||||
className = "mspine";
|
||||
shapeFile = "dmiscf.dts";
|
||||
|
||||
maxDamage = 5.0;
|
||||
destroyedLevel = 5.0;
|
||||
disabledLevel = 2.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 5.0;
|
||||
expDamage = 0.5;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Medium Support Beam';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedMSpinering) : DeployedMSpine {
|
||||
maxDamage = 1.0;
|
||||
destroyedLevel = 1.0;
|
||||
disabledLevel = 0.75;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(mspineDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = mspineDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedMSpine;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.1;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(mspineDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
joint = "1 1 1";
|
||||
rotate = true;
|
||||
image = "mspineDeployableImage";
|
||||
pickUpName = "a medium support beam pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function mspineDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function mspineDeployableImage::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"));
|
||||
}
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%scale = getWords($packSetting["mspine",%plyr.packSet],0,2);
|
||||
|
||||
%mod = 0.5;
|
||||
|
||||
if (%plyr.packSet >= 5 && %plyr.packSet < 8) {
|
||||
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale,$AllObjMask);
|
||||
|
||||
if (%space != getWord(%scale,1))
|
||||
%type = 1;
|
||||
|
||||
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
|
||||
if (%plyr.packSet == 7)
|
||||
%mod = -0.01;
|
||||
}
|
||||
|
||||
%scaler = getWords($packSetting["mspine",%plyr.packSet],3,5);
|
||||
|
||||
%deplObj = new (%className)() { //Main Spine
|
||||
dataBlock = %item.deployed;
|
||||
scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
};
|
||||
|
||||
if (%plyr.packSet != 0 && (%plyr.packSet == 6 || %plyr.packSet == 7 || %plyr.expertSet == 1)) {
|
||||
%deplObj1 = new (%className)() { //Top add
|
||||
dataBlock = "DeployedMSpinering";
|
||||
scale = vectorMultiply(%scaler,1/4 SPC 1/3 SPC 2);
|
||||
};
|
||||
%deplObj2 = new (%className)() { //Bottom add
|
||||
dataBlock = "DeployedMSpinering";
|
||||
scale = vectorMultiply(%scaler,1/4 SPC 1/3 SPC 2);
|
||||
};
|
||||
|
||||
%h1=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%mod));
|
||||
%h2=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),GetWord(%scale,2)-%mod-0.5));
|
||||
|
||||
%deplObj1.setTransform(%h1 SPC %rot);
|
||||
%deplObj2.setTransform(%h2 SPC %rot);
|
||||
addDSurface(%deplObj,%deplObj1);
|
||||
%deplObj1.grounded = %grounded;
|
||||
%deplObj1.needsFit = 1;
|
||||
addDSurface(%deplObj,%deplObj2);
|
||||
%deplObj2.grounded = %grounded;
|
||||
%deplObj2.needsFit = 1;
|
||||
%deplObj1.team = %plyr.client.team;
|
||||
%deplObj1.setOwner(%plyr);
|
||||
%deplObj2.team = %plyr.client.team;
|
||||
%deplObj2.setOwner(%plyr);
|
||||
if(%deplObj1.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj2.getTarget(), %plyr.client.team);
|
||||
if(%deplObj2.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj2.getTarget(), %plyr.client.team);
|
||||
addToDeployGroup(%deplObj1);
|
||||
addToDeployGroup(%deplObj2);
|
||||
AIDeployObject(%plyr.client, %deplObj1);
|
||||
AIDeployObject(%plyr.client, %deplObj2);
|
||||
%deplObj.right = %deplObj1;
|
||||
%deplObj.left = %deplObj2;
|
||||
}
|
||||
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
%deplObj.right.powerFreq = %plyr.powerFreq;
|
||||
%deplObj.left.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
if (isObject(%deplObj.right))
|
||||
checkPowerObject(%deplObj.right);
|
||||
if (isObject(%deplObj.left))
|
||||
checkPowerObject(%deplObj.left);
|
||||
|
||||
if (!%type)
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"mspine");
|
||||
else
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"mspine1");
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedMSpine::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, mspineDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
if (isObject(%obj.right))
|
||||
%obj.right.schedule(500,setDamageState,Destroyed);
|
||||
if (isObject(%obj.left))
|
||||
%obj.left.schedule(500,setDamageState,Destroyed);
|
||||
}
|
||||
|
||||
function DeployedMSpinering::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function DeployedMSpine::disassemble(%data,%plyr,%hTgt) {
|
||||
if ($Host::Purebuild == 1) { // Remove console spam
|
||||
if (isObject(%hTgt.right))
|
||||
%hTgt.right.getDataBlock().schedule(500,disassemble,0,%hTgt.right);
|
||||
if (isObject(%hTgt.left))
|
||||
%hTgt.left.getDataBlock().schedule(500,disassemble,0,%hTgt.left);
|
||||
}
|
||||
disassemble(%data,%plyr,%hTgt);
|
||||
}
|
||||
|
||||
function mspineDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasMSpine = true; // set for mspinecheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function mspineDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasMSpine = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
105
Scripts/Packs/parachutepack.cs
Normal file
105
Scripts/Packs/parachutepack.cs
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
// ------------------------------------------------------------------
|
||||
// PARACHUTE PACK
|
||||
//
|
||||
|
||||
datablock ShapeBaseImageData(ParachutePackImage)
|
||||
{
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
item = ParachutePack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
mass = 10;
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateSequence[1] = "fire";
|
||||
stateSound[1] = CloakingPackActivateSound;
|
||||
stateEnergyDrain[1] = 1;
|
||||
stateTransitionOnTriggerUp[1] = "Deactivate";
|
||||
stateTransitionOnNoAmmo[1] = "Deactivate";
|
||||
|
||||
stateName[2] = "Deactivate";
|
||||
stateScript[2] = "onDeactivate";
|
||||
stateTransitionOnTimeout[2] = "Idle";
|
||||
};
|
||||
|
||||
datablock ItemData(ParachutePack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
shapeFile = "pack_upgrade_ammo.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.5;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
image = "ParachutePackImage";
|
||||
pickUpName = "a Parachute pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(parachuteImage)
|
||||
{
|
||||
shapeFile = "Pmiscf.dts";
|
||||
mountPoint = 1;
|
||||
|
||||
offset = "0.0 0.0 2.0"; // L/R - F/B - T/B
|
||||
rotation = "0 0 0 0"; // L/R - F/B - T/B
|
||||
};
|
||||
|
||||
function ParachutePackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
if (%obj.getState() !$= "dead"){
|
||||
Cancel(%obj.ParaLoop);
|
||||
%obj.unmountImage(4);
|
||||
}
|
||||
}
|
||||
|
||||
function ParachutePackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
if(%obj.getArmorSize() $= "Light")
|
||||
{
|
||||
messageClient(%obj.client, "", "\c2Can't use this with Technician.");
|
||||
return;
|
||||
}
|
||||
|
||||
messageClient(%obj.client, 'MsgParachuteOpened', '\c2Parachute opened.');
|
||||
%newspeed = vectorscale(%obj.getvelocity(),0.5);
|
||||
%obj.setvelocity(%newspeed);
|
||||
%obj.paraLoop = schedule(1000, 0, "parachuteLoop", %obj);
|
||||
%obj.mountImage(ParachuteImage, 4);
|
||||
}
|
||||
|
||||
function ParachutePackImage::onDeactivate(%data, %obj, %slot)
|
||||
{
|
||||
if(%obj.getArmorSize() $= "Light")
|
||||
{
|
||||
messageClient(%obj.client, "", "\c2Can't use this with Technician.");
|
||||
return;
|
||||
}
|
||||
|
||||
messageClient(%obj.client, 'MsgParachuteClosed', '\c2Parachute Closed.');
|
||||
Cancel(%obj.ParaLoop);
|
||||
%obj.unmountImage(4);
|
||||
}
|
||||
|
||||
function parachuteLoop(%obj)
|
||||
{
|
||||
if(isObject(%obj))
|
||||
{
|
||||
%vec = vectornormalize(%obj.getMuzzleVector($WeaponSlot));
|
||||
%move = vectorscale(%vec,10);
|
||||
%x = getword(%move,0);
|
||||
%y = getword(%move,1);
|
||||
%z = (getword(%move,2) - 15);
|
||||
%obj.setvelocity(%x@" "@%y@" "@%z);
|
||||
%obj.paraLoop = schedule(100, 0, "parachuteLoop", %obj);
|
||||
}
|
||||
}
|
||||
650
Scripts/Packs/repairpack.cs
Normal file
650
Scripts/Packs/repairpack.cs
Normal file
|
|
@ -0,0 +1,650 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
// JTL
|
||||
beamRange = 10; //10
|
||||
// End JTL
|
||||
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 = 0;
|
||||
cutOffEnergy = 5.0;
|
||||
emap = true;
|
||||
|
||||
repairFactorPlayer = 0.002; // <--- attention DaveG!
|
||||
repairFactorObject = 0.008; // <--- 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] = 32;
|
||||
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
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
|
||||
|
||||
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
|
||||
|
||||
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);
|
||||
if ( !isDemo() )
|
||||
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);
|
||||
if ( !isDemo() )
|
||||
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::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
|
||||
// JTL - repair ourselves if target is not damaged
|
||||
if(%obj.getDamageLevel()) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
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::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;
|
||||
};
|
||||
MissionCleanup.add(%player.repairProjectile);
|
||||
}
|
||||
}
|
||||
751
Scripts/Packs/satchelCharge.cs
Normal file
751
Scripts/Packs/satchelCharge.cs
Normal file
|
|
@ -0,0 +1,751 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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.
|
||||
|
||||
// Set up defaults for nonexisting vars
|
||||
|
||||
$SatchelChargeMultiplier = 1;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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;
|
||||
mass = 16;
|
||||
};
|
||||
|
||||
datablock ItemData(SatchelCharge)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
image = SatchelChargeImage;
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
mass = 8.0;
|
||||
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;
|
||||
underwaterExplosion = UnderwaterSatchelMainExplosion;
|
||||
mass = 1.5;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
rotate = false;
|
||||
pickupRadius = 0;
|
||||
noTimeout = true;
|
||||
armDelay = 1000;
|
||||
maxDamage = 2.5;
|
||||
|
||||
kickBackStrength = 5000;
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function SatchelCharge::onUse(%this, %obj)
|
||||
{
|
||||
if (!$Host::SatchelChargeEnabled) {
|
||||
if ($Host::Purebuild == 1)
|
||||
messageAll('msgClient','\c2%1 just tried to drop a Satchel Charge!',%obj.client.name);
|
||||
else
|
||||
messageTeam(%obj.client.team,'msgClient','\c2%1 just tried to drop a Satchel Charge!',%obj.client.name);
|
||||
%obj.decInventory(SatchelCharge, 1);
|
||||
return;
|
||||
}
|
||||
if ($Host::Purebuild == 1)
|
||||
messageAll('msgClient','\c2%1 just dropped a Satchel Charge!',%obj.client.name);
|
||||
else
|
||||
messageTeam(%obj.client.team,'msgClient','\c2%1 just dropped a Satchel Charge!',%obj.client.name);
|
||||
%item = new Item() {
|
||||
dataBlock = SatchelChargeThrown;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
scale = $SatchelChargeMultiplier SPC $SatchelChargeMultiplier SPC $SatchelChargeMultiplier;
|
||||
};
|
||||
if ($Host::Purebuild == 0)
|
||||
%item = new Item() {
|
||||
dataBlock = SatchelChargeThrown;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
scale = $SatchelChargeMultiplier SPC $SatchelChargeMultiplier SPC $SatchelChargeMultiplier;
|
||||
};
|
||||
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, "initArmSatchelCharge", %item);
|
||||
messageClient(%obj.client, 'MsgSatchelChargePlaced', "\c2Satchel charge deployed.");
|
||||
}
|
||||
|
||||
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:
|
||||
if (isObject(%player.client))
|
||||
%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 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 = 23 * $SatchelChargeMultiplier;
|
||||
%dmgMod = 2.0 * $SatchelChargeMultiplier;
|
||||
%expImpulse = limitSatchelImpulse(1000 * $SatchelChargeMultiplier);
|
||||
%dmgType = $DamageType::SatchelCharge;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge detonated!");
|
||||
%dmgRadius = 30 * $SatchelChargeMultiplier;
|
||||
%dmgMod = 3.0 * $SatchelChargeMultiplier;
|
||||
%expImpulse = limitSatchelImpulse(2500 * $SatchelChargeMultiplier);
|
||||
%dmgType = $DamageType::SatchelCharge;
|
||||
}
|
||||
|
||||
%object.blowingUp = true;
|
||||
RadiusExplosion(%object, %object.getPosition(), %dmgRadius, %dmgMod, %expImpulse, %object.sourceObject, %dmgType);
|
||||
|
||||
%object.schedule(1000, "delete");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// z0dd - ZOD, 5/8/02. Addition. 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::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:
|
||||
if (isObject(%targetObject.sourceObject.client))
|
||||
%targetObject.sourceObject.client.clearBackPackIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function limitSatchelImpulse(%val) {
|
||||
if (%val > 50000)
|
||||
%val = 50000;
|
||||
return %val;
|
||||
}
|
||||
134
Scripts/Packs/sentryturretpack.cs
Normal file
134
Scripts/Packs/sentryturretpack.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
datablock ShapeBaseImageData(SentryTurretDeployableImage)
|
||||
{
|
||||
mass = 15;
|
||||
emap = true;
|
||||
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = TurretSentryPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.2 0";
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
|
||||
deployed = TurretDeployedSentry;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = StationDeploySound;
|
||||
};
|
||||
|
||||
datablock ItemData(TurretSentryPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "SentryTurretDeployableImage";
|
||||
pickUpName = "a sentry turret pack";
|
||||
heatSignature = 0;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock TurretData(TurretDeployedSentry) : TurretDamageProfile
|
||||
{
|
||||
className = DeployedTurret;
|
||||
shapeFile = "turret_sentry.dts";
|
||||
|
||||
rechargeRate = 0.40;
|
||||
|
||||
selfPower = false;
|
||||
|
||||
needsPower = true;
|
||||
mass = 5.0;
|
||||
maxDamage = 1.2;
|
||||
destroyedLevel = 1.2;
|
||||
disabledLevel = 0.84;
|
||||
repairRate = 0;
|
||||
explosion = ShapeExplosion;
|
||||
expDmgRadius = 5.0;
|
||||
expDamage = 0.4;
|
||||
expImpulse = 1000.0;
|
||||
|
||||
deployedObject = true;
|
||||
|
||||
thetaMin = 89;
|
||||
thetaMax = 175;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 100;
|
||||
maxEnergy = 150;
|
||||
|
||||
heatSignature = 1;
|
||||
|
||||
canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Deployed Sentry';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = SentryMotionSensor;
|
||||
sensorRadius = SentryMotionSensor.detectRadius;
|
||||
sensorColor = "9 136 255";
|
||||
|
||||
firstPersonOnly = true;
|
||||
};
|
||||
|
||||
function SentryTurretDeployableImage::onDeploy(%item, %plyr, %slot)
|
||||
{
|
||||
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
|
||||
|
||||
%deplObj.mountImage(SentryTurretBarrel, 0, false);
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
%item.surfacenrm = VectorNormalize(%item.surfacenrm);
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
MTZAxisReverse(%plyr.client, %deplObj); // Super cheap hack. Makes things REALLY easy, though.
|
||||
|
||||
%realVec = realVec(%deplObj, "0 0 1");
|
||||
%toAdd = VectorScale(%realvec, -0.6);
|
||||
%newPos = VectorAdd(posFromTransform(%deplObj.getTransform()), %toAdd);
|
||||
%deplObj.setTransform(%newPos SPC %deplObj.getRotation());
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
%deplObj.team = %plyr.team;
|
||||
|
||||
checkPowerObject(%deplObj);
|
||||
}
|
||||
|
||||
function SentryTurretDeployableImage::onMount(%data, %obj, %node)
|
||||
{
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TurretSentryPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// No more spam!
|
||||
}
|
||||
143
Scripts/Packs/solarpanel.cs
Normal file
143
Scripts/Packs/solarpanel.cs
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Solar Panel
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(SolarPanelDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = SolarPanelDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = SolarPanel;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 1.5;
|
||||
maxDeployDis = 5;
|
||||
};
|
||||
|
||||
datablock ItemData(SolarPanelDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.8 0.8 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "SolarPanelDeployableImage";
|
||||
pickUpName = "a solar panel pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function SolarPanelDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function SolarPanelDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function SolarPanelDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = SolarPanel;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set power
|
||||
%deplObj.setSelfPowered();
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// add to power list
|
||||
$PowerList = listAdd($PowerList,%deplObj,-1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function SolarPanel::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if (%obj.deployed && ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon)) {
|
||||
%obj.isRemoved = true;
|
||||
%loc = findWord($PowerList,%obj);
|
||||
if (%loc !$= "")
|
||||
$PowerList = listDel($PowerList,%loc);
|
||||
$TeamDeployedCount[%obj.team,SolarPanelDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
Parent::onDestroyed(%data,%obj,%prevState);
|
||||
}
|
||||
|
||||
function SolarPanelDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasGen = true; // set for gencheck
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function SolarPanelDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasGen = "";
|
||||
}
|
||||
212
Scripts/Packs/spawnpointpack.cs
Normal file
212
Scripts/Packs/spawnpointpack.cs
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Telepad
|
||||
//---------------------------------------------------------
|
||||
// Thanks to Krash for the idea to make spawn points power things within a small radius
|
||||
|
||||
datablock ShapeBaseImageData(SpawnPointImage) {
|
||||
mass = 15;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = SpawnPointPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = SpawnPoint;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = StationDeploySound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(SpawnPointPack) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "SpawnPointImage";
|
||||
pickUpName = "a SpawnPoint pack";
|
||||
heatSignature = 0;
|
||||
joint = "2 2 2";
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(SpawnPoint) : StaticShapeDamageProfile {
|
||||
className = "Generator";
|
||||
shapeFile = "station_teleport.dts";
|
||||
|
||||
maxDamage = 5.00;
|
||||
destroyedLevel = 5.00;
|
||||
disabledLevel = 4.0;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 150;
|
||||
maxEnergy = 150;
|
||||
rechargeRate = 1;
|
||||
|
||||
explosion = ShapeExplosion; // DeployablesExplosion;
|
||||
expDmgRadius = 18.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "Support";
|
||||
cmdIcon = CMDSwitchIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Spawn Point';
|
||||
|
||||
debrisShapeName = "debris_generic.dts";
|
||||
debris = DeployableDebris;
|
||||
|
||||
heatSignature = 0;
|
||||
// needsPower = true;
|
||||
|
||||
// humSound = SensorHumSound;
|
||||
// pausePowerThread = true;
|
||||
sensorData = TelePadBaseSensorObj;
|
||||
sensorRadius = TelePadBaseSensorObj.detectRadius;
|
||||
sensorColor = "0 212 45";
|
||||
firstPersonOnly = true;
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0 1 0 1";
|
||||
lightTime = 1200;
|
||||
lightRadius = 6;
|
||||
powerRadius = 25;
|
||||
};
|
||||
|
||||
function SpawnPoint::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
// checkEndTCCMGame(%obj.team);
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team,SpawnPoint]--;
|
||||
%obj.isRemoved = true;
|
||||
remDSurface(%obj);
|
||||
%obj.active = 0;
|
||||
|
||||
remTeamSpawnPoint(%obj);
|
||||
|
||||
if(!$Host::InvincibleDeployables)
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
|
||||
function SpawnPoint::disassemble(%data,%plyr,%obj) {
|
||||
// checkEndTCCMGame(%obj.team);
|
||||
remTeamSpawnPoint(%obj);
|
||||
parent::disassemble(%data, %plyr, %obj);
|
||||
}
|
||||
|
||||
function SpawnPointPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// Thou shalt not spam.
|
||||
}
|
||||
|
||||
function SpawnPoint::onGainPowerEnabled(%data,%obj) {
|
||||
%obj.active = 1;
|
||||
parent::onGainPowerEnabled(%data, %obj); // Eolk - call parent
|
||||
}
|
||||
|
||||
function SpawnPoint::onLosePowerDisabled(%data,%obj) {
|
||||
%obj.active = 0;
|
||||
parent::onLosePowerDisabled(%data, %obj); // Eolk - call parent
|
||||
}
|
||||
|
||||
function SpawnPointImage::onDeploy(%item,%plyr,%slot) {
|
||||
%className = "StaticShape";
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = SpawnPoint;
|
||||
scale = "1 1 1";
|
||||
deployed = true;
|
||||
};
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
setTargetName(%deplObj.target, addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
%deplObj.setSelfPowered();
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(),%plyr.client.team);
|
||||
addToDeployGroup(%deplObj);
|
||||
AIDeployObject(%plyr.client,%deplObj);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
serverPlay3D(%item.deploySound,%deplObj.getTransform());
|
||||
$TeamDeployedCount[%plyr.team,%item.item]++;
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
|
||||
addTeamSpawnPoint(%deplObj);
|
||||
|
||||
if(%plyr.client.SPname $= "")
|
||||
%piece.name = getWords(%position,0,1);
|
||||
else
|
||||
%piece.name = %plyr.client.SPname;
|
||||
%piece.active = 0;
|
||||
|
||||
setTargetName(%deplObj.target,addTaggedString(%deplObj.name));
|
||||
|
||||
$PowerList = listAdd($PowerList, %deplObj, -1);
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function SpawnPointImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasGen = true;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function SpawnPointImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasGen = "";
|
||||
}
|
||||
|
||||
function addTeamSpawnPoint(%obj)
|
||||
{
|
||||
if(%obj.getDatablock().getName() !$= "SpawnPoint")
|
||||
return;
|
||||
|
||||
if($teamSPs[%obj.team] $= "")
|
||||
$TeamSPs[%obj.team] = 0;
|
||||
$teamSP[%obj.team,$teamSPs[%obj.team]] = %obj;
|
||||
$teamSPs[%obj.team]++;
|
||||
}
|
||||
|
||||
function remTeamSpawnPoint(%obj)
|
||||
{
|
||||
if(%obj.getDatablock().getName() !$= "SpawnPoint")
|
||||
return;
|
||||
|
||||
for(%i = 0; %i < $teamSPs[%obj.team]; %i++){
|
||||
if($teamSP[%obj.team,%i] $= %obj)
|
||||
%spawn = %i;
|
||||
}
|
||||
|
||||
if(%spawn < ($teamSPs[%obj.team] - 1)){
|
||||
$teamSP[%obj.team,%spawn] = $teamSP[%obj.team,($teamSPs[%obj.team] - 1)];
|
||||
$teamSP[%obj.team,($teamSPs[%obj.team] - 1)] = "";
|
||||
}
|
||||
|
||||
$teamSPs[%obj.team]--;
|
||||
}
|
||||
297
Scripts/Packs/spine.cs
Normal file
297
Scripts/Packs/spine.cs
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Spine, Code by Mostlikely, Prettied by JackTL
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedSpine) : StaticShapeDamageProfile {
|
||||
className = "spine";
|
||||
shapeFile = "Pmiscf.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Support Beam';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
datablock StaticShapeData(DeployedSpine2) : StaticShapeDamageProfile {
|
||||
className = "spine";
|
||||
shapeFile = "Xmiscf.dts";
|
||||
|
||||
maxDamage = 25.0;
|
||||
destroyedLevel = 25.0;
|
||||
disabledLevel = 24.0;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Support Beam';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
datablock StaticShapeData(DeployedWoodSpine) : StaticShapeDamageProfile {
|
||||
className = "spine";
|
||||
shapeFile = "stackable5m.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Support Beam';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(spineDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "ammo_plasma.dts";
|
||||
item = spineDeployable;
|
||||
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(spineDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "spineDeployableImage";
|
||||
pickUpName = "a light support beam pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function spineDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function spineDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function spineDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function spineDeployableImage::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);
|
||||
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);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %dataBlock;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
if (%pad)
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
|
||||
else if (%type)
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"spine1");
|
||||
else
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"spine");
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
function DeployedSpine::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, spineDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function DeployedSpine2::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, spineDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function DeployedWoodSpine::onDestroyed(%this, %obj, %prevState) {
|
||||
DeployedSpine::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function spineDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasSpine = true; // set for spinecheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function spineDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasSpine = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
273
Scripts/Packs/switch.cs
Normal file
273
Scripts/Packs/switch.cs
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Switch
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedSwitch) : StaticShapeDamageProfile {
|
||||
className = "switch";
|
||||
shapeFile = "switch.dts";
|
||||
|
||||
maxDamage = 1.00;
|
||||
destroyedLevel = 1.00;
|
||||
disabledLevel = 0.75;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 30;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.05;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.3;
|
||||
expImpulse = 500;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Switch';
|
||||
// deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(SwitchDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = SwitchDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedSwitch;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
flatMinDeployDis = 0.25;
|
||||
flatMaxDeployDis = 5.0;
|
||||
|
||||
minDeployDis = 2;
|
||||
maxDeployDis = 5;
|
||||
};
|
||||
|
||||
datablock ItemData(SwitchDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.8 0.8 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "SwitchDeployableImage";
|
||||
pickUpName = "a switch pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SwitchToggledSound) {
|
||||
filename = "fx/misc/flipflop_taken.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
function SwitchDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function SwitchDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function SwitchDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
scale = "0.5 0.5 0.5";
|
||||
dataBlock = DeployedSwitch;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
%deplObj.switchRadius = $packSetting["switch",%plyr.packSet];
|
||||
|
||||
// TODO - handle normal state on deploy
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (%plyr.expertSet == 1)
|
||||
%deplObj.timed = 1;
|
||||
else if (%plyr.expertSet == 2)
|
||||
%deplObj.timed = 2;
|
||||
}
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set skin
|
||||
setTargetSkin(%deplObj.target,Game.getTeamSkin(%plyr.client.team));
|
||||
|
||||
// set power
|
||||
%deplObj.setSelfPowered();
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
%deplObj.playThread($AmbientThread,"ambient");
|
||||
|
||||
if (%deplObj.timed == 2) {
|
||||
%deplObj.stopThread($AmbientThread);
|
||||
setTargetName(%deplObj.target,addTaggedString("Disabled Frequency" SPC %deplObj.powerFreq));
|
||||
%deplObj.isSwitchedOff = true;
|
||||
}
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedSwitch::onCollision(%data,%obj,%col) {
|
||||
toggleSwitch(%obj,-1,%col);
|
||||
}
|
||||
|
||||
function toggleSwitch(%obj,%state,%col,%delayed) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
// TODO - prevent switching while waiting for timed delay / cancel timed delay if switch is hit?
|
||||
%switchDelay = 1000;
|
||||
%switchTimedDelay = 5000;
|
||||
if (%state $= "")
|
||||
%state = -1;
|
||||
if (%col == 0 || %col $= "")
|
||||
%force = true;
|
||||
if (!%force) {
|
||||
if (%col.getClassName() !$= "Player")
|
||||
return;
|
||||
if (%col.getState() $= "Dead" || %col.FFZapped == true)
|
||||
return;
|
||||
if (%obj.team != %col.team && %obj.team != 0)
|
||||
return;
|
||||
if (!(%obj.switchTime < getSimTime())) {
|
||||
messageClient(%col.client, 'msgClient', '\c2Must wait %1 seconds between switching states.',mCeil((%obj.switchTime - getSimTime())/1000));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((%obj.isSwitchedOff || (%force == true && %state == true)) && !(%force == true && %state == false)) {
|
||||
%state = true;
|
||||
%obj.isSwitchedOff = "";
|
||||
}
|
||||
else {
|
||||
%state = false;
|
||||
%obj.isSwitchedOff = true;
|
||||
}
|
||||
%switchCount = 0;
|
||||
%count = getWordCount($PowerList);
|
||||
// TODO - report number of successes and failures
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord($PowerList,%i);
|
||||
if (vectorDist(%obj.getPosition(),%powerObj.getPosition()) < %obj.switchRadius
|
||||
&& !%powerObj.isRemoved && %obj.powerFreq == %powerObj.powerFreq
|
||||
&& %obj.team == %powerObj.team) {
|
||||
toggleGenerator(%powerObj,%state);
|
||||
%switchCount++;
|
||||
}
|
||||
}
|
||||
if (%state == true) {
|
||||
%obj.play3D(SwitchToggledSound);
|
||||
%obj.playThread($AmbientThread,"ambient");
|
||||
setTargetName(%obj.target,addTaggedString("Frequency" SPC %obj.powerFreq));
|
||||
if (!%force)
|
||||
messageClient(%col.client, 'msgClient', '\c2%1 objects attempted switched on.',%switchCount);
|
||||
}
|
||||
else {
|
||||
%obj.play3D(SwitchToggledSound);
|
||||
%obj.stopThread($AmbientThread);
|
||||
setTargetName(%obj.target,addTaggedString("Disabled Frequency" SPC %obj.powerFreq));
|
||||
if (!%force)
|
||||
messageClient(%col.client, 'msgClient', '\c2%1 objects attempted switched off.',%switchCount);
|
||||
}
|
||||
%obj.switchTime = getSimTime() + %switchDelay;
|
||||
cancel(%obj.timedSched);
|
||||
if (%obj.timed > 0 && !%delayed) {
|
||||
if (%obj.timed == 1)
|
||||
%obj.timedSched = schedule(%switchTimedDelay,0,toggleSwitch,%obj,1,0,true);
|
||||
else if (%obj.timed == 2)
|
||||
%obj.timedSched = schedule(%switchTimedDelay,0,toggleSwitch,%obj,0,0,true);
|
||||
%obj.switchTime = getSimTime() + %switchDelay + %switchTimedDelay;
|
||||
}
|
||||
}
|
||||
|
||||
function DeployedSwitch::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, SwitchDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function SwitchDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasSwitch = true; // set for switchcheck
|
||||
%obj.packSet = 2;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function SwitchDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasSwitch = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
562
Scripts/Packs/telepadpack.cs
Normal file
562
Scripts/Packs/telepadpack.cs
Normal file
|
|
@ -0,0 +1,562 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Telepad
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(TelePadDeployableImage) {
|
||||
mass = 15;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = TelePadPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = TelePadDeployedBase;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = StationDeploySound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(TelePadPack) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "TelePadDeployableImage";
|
||||
pickUpName = "a teleport pad pack";
|
||||
heatSignature = 0;
|
||||
joint = "2 2 2";
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock SensorData(TelePadBaseSensorObj) {
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = false;
|
||||
detectsActiveJammed = false;
|
||||
detectsCloaked = false;
|
||||
detectionPings = true;
|
||||
detectRadius = 10;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(TelePadDeployedBase) : StaticShapeDamageProfile {
|
||||
className = "teleport";
|
||||
shapeFile = "nexuscap.dts";
|
||||
|
||||
maxDamage = 2.00;
|
||||
destroyedLevel = 2.00;
|
||||
disabledLevel = 1.35;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 250;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 1;
|
||||
|
||||
explosion = ShapeExplosion; // DeployablesExplosion;
|
||||
expDmgRadius = 18.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSwitchIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Teleport Pad';
|
||||
|
||||
debrisShapeName = "debris_generic.dts";
|
||||
debris = DeployableDebris;
|
||||
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
|
||||
humSound = SensorHumSound;
|
||||
pausePowerThread = true;
|
||||
sensorData = TelePadBaseSensorObj;
|
||||
sensorRadius = TelePadBaseSensorObj.detectRadius;
|
||||
sensorColor = "0 212 45";
|
||||
firstPersonOnly = true;
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0 1 0 1";
|
||||
lightTime = 1200;
|
||||
lightRadius = 6;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(TelePadBeam) {
|
||||
className = "Station";
|
||||
catagory = "DSupport";
|
||||
shapefile = "nexus_effect.dts";
|
||||
collideable = 1;
|
||||
needsNoPower = true;
|
||||
emap="true";
|
||||
sensorData = TelePadBaseSensorObj;
|
||||
sensorRadius = TelePadBaseSensorObj.detectRadius;
|
||||
sensorColor = "0 212 45";
|
||||
|
||||
cmdCategory = "DSupport";
|
||||
targetNameTag = 'Teleport';
|
||||
targetTypeTag = 'Pad';
|
||||
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0 1 0 1";
|
||||
lightTime = 1200;
|
||||
lightRadius = 6;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TelePadAccessDeniedSound) {
|
||||
filename = "gui/vote_nopass.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TelePadBeamSound) {
|
||||
filename = "fx/vehicles/inventory_pad_on.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TelePadPowerUpSound) {
|
||||
filename = "fx/powered/turret_heavy_activate.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TelePadPowerDownSound) {
|
||||
filename = "fx/powered/inv_pad_off.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock ParticleData(TelePadTeleportParticle)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 1200;
|
||||
lifetimeVarianceMS = 400;
|
||||
|
||||
textureName = "special/lightFalloffMono";
|
||||
|
||||
useInvAlpha = false;
|
||||
spinRandomMin = -200.0;
|
||||
spinRandomMax = 200.0;
|
||||
|
||||
colors[0] = "0.5 0.8 0.2 1.0";
|
||||
colors[1] = "0.6 0.9 0.3 1.0";
|
||||
colors[2] = "0.7 1.0 0.4 1.0";
|
||||
sizes[0] = 0.2;
|
||||
sizes[1] = 0.1;
|
||||
sizes[2] = 0.05;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.5;
|
||||
times[2] = 1.0;
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(TelePadTeleportEmitter)
|
||||
{
|
||||
ejectionPeriodMS = 1;
|
||||
ejectionOffset = 7.0;
|
||||
periodVarianceMS = 0.0;
|
||||
ejectionVelocity = 2.0;
|
||||
velocityVariance = 2.0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 10.0;
|
||||
lifetimeMS = 0;
|
||||
|
||||
particles = "TelePadTeleportParticle";
|
||||
};
|
||||
|
||||
function TelePadDeployedBase::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team,TelePadPack]--;
|
||||
%obj.isRemoved = true;
|
||||
remDSurface(%obj);
|
||||
%obj.beam.schedule(150,"delete");
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
|
||||
function TelePadDeployedBase::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.beam))
|
||||
%obj.beam.delete();
|
||||
%obj.isRemoved = true;
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function TelePadDeployedBase::onGainPowerEnabled(%data,%obj) {
|
||||
if (shouldChangePowerState(%obj,true)) {
|
||||
tp_fadeIn(%obj,true);
|
||||
%obj.playThread($AmbientThread,"ambient");
|
||||
%obj.setThreadDir($AmbientThread,true);
|
||||
|
||||
%obj.playThread($ActivateThread,"transition");
|
||||
%obj.setThreadDir($ActivateThread,false);
|
||||
|
||||
%obj.play3D(TelePadPowerUpSound);
|
||||
}
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function TelePadDeployedBase::onLosePowerDisabled(%data,%obj) {
|
||||
if (shouldChangePowerState(%obj,false)) {
|
||||
tp_fadeOut(%obj,true);
|
||||
%obj.stopThread($AmbientThread);
|
||||
|
||||
%obj.playThread($ActivateThread,"transition");
|
||||
%obj.setThreadDir($ActivateThread,true);
|
||||
|
||||
%obj.play3D(TelePadPowerDownSound);
|
||||
}
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
|
||||
function TelePadDeployedBase::onCollision(%data,%obj,%col) {
|
||||
if (%col.justTeleported || %obj.isRemoved)
|
||||
return;
|
||||
|
||||
// verify pad.team is team associated and is on player's team
|
||||
if (%obj.team != %col.team && %obj.team != 0 && %obj.teleMode != 1 && %obj.frequency > 0 && %obj.ishacked != 1) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
messageClient(%col.client,'msgClient','\c2Access Denied -- Wrong team use, /hack help , to hack this teleport.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
// verify that pad can transmit
|
||||
if (%obj.teleMode == 3) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
messageClient(%col.client,'msgClient','\c2Access Denied -- This pad can only receive.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
// Discover next pad to teleport to
|
||||
%dgroup = nameToID(Deployables);
|
||||
%destPad = 0;
|
||||
%firstPad = 0;
|
||||
for(%depIndex = 0; %depIndex < %dgroup.getCount(); %depIndex++) {
|
||||
%dep = %dgroup.getObject(%depIndex);
|
||||
if (%dep.getDataBlock().className $= "teleport") {
|
||||
if (%dep != %obj && %dep.frequency == %obj.frequency && %dep.team == %obj.team && %dep.teleMode != 2) {
|
||||
if (%dep.isPowered() && %dep.isEnabled() && !(%dep.getEnergyLevel() < %dep.getDataBlock().maxEnergy)) {
|
||||
if (!%firstPad || %dep < %firstPad)
|
||||
%firstPad = %dep;
|
||||
if (%dep > %obj && (!%destPad || %dep < %destPad)) {
|
||||
%destPad = %dep;
|
||||
}
|
||||
}
|
||||
else
|
||||
%notEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!%destPad)
|
||||
%destPad = %firstPad;
|
||||
|
||||
if (!%obj.isPowered() || !%obj.isEnabled()) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
if (!%obj.isPowered() && !%obj.isEnabled())
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is damaged and has no power.');
|
||||
else if (!%obj.isEnabled())
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is damaged.');
|
||||
else if (!%obj.isPowered())
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is not powered.');
|
||||
else
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad malfunction.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!%destPad) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
if (%notEnabled)
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, destination is damaged, has no power or is recharging.');
|
||||
else
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, no other pads to teleport to.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tp_isBlocked(%destPad,%col)) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, destination is blocked.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
if (%obj.getEnergyLevel() < %obj.getDataBlock().maxEnergy) {
|
||||
%obj.play3D(TelePadAccessDeniedSound);
|
||||
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is recharging.');
|
||||
%col.justTeleported = true;
|
||||
schedule(2000,0,"unTeleport",%col);
|
||||
return;
|
||||
}
|
||||
|
||||
// center player on pad
|
||||
if (!tp_isBlocked(%obj,%col))
|
||||
tp_adjustPlayer(%obj,%col);
|
||||
|
||||
// fade out player
|
||||
%col.disableMove(true);
|
||||
pl_fadeOut(%col);
|
||||
|
||||
// pad power up effect
|
||||
tp_fadePadIn(%obj);
|
||||
tp_fadePadIn(%destPad);
|
||||
|
||||
// fade out beams
|
||||
schedule(600,0,"tp_fadeOut",%obj);
|
||||
schedule(750,0,"tp_fadeOut",%destPad);
|
||||
|
||||
// pad power down effect
|
||||
schedule(1500,0,"tp_fadePadOut",%obj);
|
||||
schedule(1550,0,"tp_fadePadOut",%destPad);
|
||||
|
||||
// fade in beams
|
||||
schedule(3000,0,"tp_fadeIn",%obj);
|
||||
schedule(3050,0,"tp_fadeIn",%destPad);
|
||||
|
||||
// Zap energy
|
||||
%obj.setEnergyLevel(0);
|
||||
%destPad.setEnergyLevel(0);
|
||||
|
||||
%col.justTeleported = true;
|
||||
|
||||
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
|
||||
schedule(500,0,"teleport",%col,%destPad,%obj); // schedule their teleportation
|
||||
tp_emitter(%obj);
|
||||
}
|
||||
|
||||
function tp_isBlocked(%pad,%obj) {
|
||||
%padPos = %pad.getPosition();
|
||||
%telePos = vectorAdd(%padPos,vectorScale(realVec(%pad,"0 0 1"),-2.5));
|
||||
if (containerRayCast(%padPos,%telePos,-1,%pad))
|
||||
%blocked = true;
|
||||
if (!$Host::AllowUnderground) {
|
||||
%terrain = getTerrainHeight2(%telePos);
|
||||
if (getWord(%telePos,2) < getWord(%terrain,2) || %terrain $= "")
|
||||
%blocked = true;
|
||||
}
|
||||
if (isObject(%obj)) {
|
||||
%adjust = vectorAdd(vectorScale(vectorNormalize(realVec(%pad,"0 0 1")),-1.35),vectorSub(%obj.getPosition(),%obj.getWorldBoxCenter()));
|
||||
%pos = vectorAdd(%padPos,%adjust);
|
||||
if (!$Host::AllowUnderground) {
|
||||
%terrain = getTerrainHeight2(%pos);
|
||||
if (getWord(%pos,2) < getWord(%terrain,2) || %terrain $= "")
|
||||
%blocked = true;
|
||||
}
|
||||
if (containerRayCast(%telePos,%pos,-1,%obj))
|
||||
%blocked = true;
|
||||
}
|
||||
return %blocked;
|
||||
}
|
||||
|
||||
// player
|
||||
function pl_fadeIn(%obj) {
|
||||
%obj.startFade(500,0,false);
|
||||
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
|
||||
}
|
||||
|
||||
function pl_fadeOut(%obj) {
|
||||
%obj.startFade(500,0,true);
|
||||
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
|
||||
}
|
||||
|
||||
// beam and sound
|
||||
function tp_fadeIn(%obj,%silent) {
|
||||
if (%obj.isPowered() && %obj.isEnabled()) {
|
||||
if (!%silent)
|
||||
%obj.play3D(DiscReloadSound);
|
||||
%obj.beam.startFade(100,0,false);
|
||||
}
|
||||
}
|
||||
|
||||
function tp_fadeOut(%obj,%silent) {
|
||||
if (!%silent)
|
||||
%obj.play3D(TelePadBeamSound);
|
||||
%obj.beam.startFade(100,0,true);
|
||||
}
|
||||
|
||||
// pad
|
||||
function tp_fadePadIn(%obj) {
|
||||
%obj.playThread($ActivateThread,"transition");
|
||||
%obj.setThreadDir($ActivateThread,true);
|
||||
}
|
||||
|
||||
function tp_fadePadOut(%obj) {
|
||||
%obj.playThread($ActivateThread,"transition");
|
||||
%obj.setThreadDir($ActivateThread,false);
|
||||
}
|
||||
|
||||
// fancy emitter
|
||||
function tp_emitter(%obj) {
|
||||
%em = new ParticleEmissionDummy() {
|
||||
scale = "1 1 1";
|
||||
dataBlock = "defaultEmissionDummy";
|
||||
emitter = "TelePadTeleportEmitter";
|
||||
velocity = "1";
|
||||
};
|
||||
%adjust = vectorScale(realVec(%obj,"0 0 1"),7);
|
||||
%em.setTransform(vectorAdd(%obj.getPosition(),%adjust) SPC rotAdd(%obj.getRotation(),"1 0 0" SPC $Pi));
|
||||
MissionCleanup.add(%em);
|
||||
%em.schedule(1000,"delete");
|
||||
}
|
||||
|
||||
function unTeleport(%pl) {
|
||||
if (isObject(%pl))
|
||||
%pl.justTeleported = false;
|
||||
}
|
||||
|
||||
function teleport(%pl,%destPad,%src) {
|
||||
%pl.setVelocity("0 0 0"); //slow me down, ive been falling :)
|
||||
%pl.schedule(500,disableMove,false);
|
||||
pl_fadeIn(%pl);
|
||||
schedule(2650,0,"unTeleport",%pl);
|
||||
|
||||
if (!isObject(%destPad)) {// lost the destination
|
||||
messageClient(%pl.client,'msgClient','\c2Lost destination!');
|
||||
tp_adjustPlayer(%src,%pl);
|
||||
}
|
||||
else {
|
||||
if (%pl.team == %src.team)
|
||||
messageClient(%pl.client,'msgClient','\c2Teleporting on frequency %1.',%src.frequency);
|
||||
else
|
||||
messageClient(%pl.client,'msgClient','\c2Teleporting on ENEMY frequency %1!',%src.frequency);
|
||||
tp_adjustPlayer(%destPad,%pl);
|
||||
tp_emitter(%destPad);
|
||||
}
|
||||
}
|
||||
|
||||
function tp_adjustPlayer(%pad,%obj) {
|
||||
%adjust = vectorAdd(vectorScale(vectorNormalize(realVec(%pad,"0 0 1")),-1.35),vectorSub(%obj.getPosition(),%obj.getWorldBoxCenter()));
|
||||
%rot = %obj.getRotation();
|
||||
%obj.setTransform(vectorAdd(%pad.getPosition(),%adjust) SPC %rot);
|
||||
}
|
||||
|
||||
function tp_adjustBeam(%pad) {
|
||||
%rot = rotAdd(%pad.getRotation(),"1 0 0" SPC $Pi);
|
||||
%pad.beam.setTransform(%pad.getPosition() SPC %rot);
|
||||
}
|
||||
|
||||
function TelePadDeployableImage::onDeploy(%item,%plyr,%slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.4));
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(vectorScale(%item.surfaceNrm,-1),%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = TelePadDeployedBase;
|
||||
scale = "1 1 1";
|
||||
deployed = true;
|
||||
teleMode = %plyr.expertSet;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(),%plyr.client.team);
|
||||
|
||||
// set frequency
|
||||
%frequency = %plyr.packSet;
|
||||
if (!%frequency)
|
||||
%frequency = 1;
|
||||
%deplObj.frequency = %frequency;
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %frequency));
|
||||
|
||||
// attach beam
|
||||
%deplObj.beam = new (StaticShape)() {
|
||||
dataBlock = TelePadBeam;
|
||||
scale = "1 1 0.4";
|
||||
};
|
||||
|
||||
// set orientation
|
||||
tp_adjustBeam(%deplObj);
|
||||
|
||||
%deplObj.beam.playThread(0,"ambient");
|
||||
%deplObj.beam.setThreadDir(0,true);
|
||||
// The flash animation plays forwards, then back automatically,so we have to alternate the thread direcction...
|
||||
%deplObj.beam.flashThreadDir = true;
|
||||
|
||||
%deplObj.beam.base = %deplObj;
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client,%deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound,%deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team,%item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
teleresethack(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function TelePadDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasTele = true; // set for telecheck
|
||||
%obj.packSet = 1;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TelePadDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasTele = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
258
Scripts/Packs/treepack.cs
Normal file
258
Scripts/Packs/treepack.cs
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Tree, original code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedTree) : StaticShapeDamageProfile {
|
||||
className = "tree";
|
||||
shapeFile = "borg19.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Tree';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree0) : DeployedTree {
|
||||
shapeFile = "borg16.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree1) : DeployedTree {
|
||||
shapeFile = "borg17.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree2) : DeployedTree {
|
||||
shapeFile = "borg18.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree3) : DeployedTree {
|
||||
shapeFile = "borg19.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree4) : DeployedTree {
|
||||
shapeFile = "dorg15.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree5) : DeployedTree {
|
||||
shapeFile = "dorg16.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree6) : DeployedTree {
|
||||
shapeFile = "dorg17.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree7) : DeployedTree {
|
||||
shapeFile = "dorg18.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree8) : DeployedTree {
|
||||
shapeFile = "dorg19.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree9) : DeployedTree {
|
||||
shapeFile = "porg3.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree10) : DeployedTree {
|
||||
shapeFile = "porg6.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree11) : DeployedTree {
|
||||
shapeFile = "sorg20.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree12) : DeployedTree {
|
||||
shapeFile = "sorg22.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree13) : DeployedTree {
|
||||
shapeFile = "xorg3.dts";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(TreeDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = TreeDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedTree;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = ItemPickupSound;
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 50.0;
|
||||
};
|
||||
|
||||
datablock ItemData(TreeDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "TreeDeployableImage";
|
||||
pickUpName = "a tree pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function TreeDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function TreeDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function TreeDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TreeDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed @ %plyr.packSet;
|
||||
scale = vectorScale("1 1 1",$expertSetting["tree",%plyr.expertSet]);
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedTree::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, TreeDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function TreeDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasTree = true; // set for treecheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 5;
|
||||
}
|
||||
|
||||
function TreeDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasTree = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function DeployedTree0::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree1::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree2::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree3::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree4::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree5::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree6::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree7::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree8::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree9::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree10::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree11::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree12::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
function DeployedTree13::onDestroyed(%this,%obj,%prevState) {
|
||||
DeployedTree::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
432
Scripts/Packs/tripwire.cs
Normal file
432
Scripts/Packs/tripwire.cs
Normal file
|
|
@ -0,0 +1,432 @@
|
|||
// Tripwire
|
||||
|
||||
datablock ForceFieldBareData(TripField) : DeployedForceField {
|
||||
baseTranslucency = 0.1;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = "1 0 0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
deployedFrom = "";
|
||||
needsPower = false;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TripwireSound) {
|
||||
filename = "fx/misc/rolechange.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock TriggerData(TripTrigger) {
|
||||
// TODO - check this
|
||||
tickPeriodMS = 200;
|
||||
};
|
||||
|
||||
function TripTrigger::onEnterTrigger(%data, %obj, %colObj) {
|
||||
// TODO - keep trip FF scaled down until trip is triggered - vehicle fix?
|
||||
%baseObj = %obj.baseObj;
|
||||
%baseObj.triggerCount++;
|
||||
if (%baseObj.triggerCount > 1)
|
||||
return;
|
||||
%baseObj.play3D(TripwireSound);
|
||||
if (isObject(%baseObj.tripField)) {
|
||||
cancel(%baseObj.tripField.hideSched);
|
||||
%baseObj.tripField.getDataBlock().gainPower(%baseObj.tripField);
|
||||
}
|
||||
%tripMode = %baseObj.tripMode;
|
||||
while (%tripMode > 1 && %tripMode > -1 && %tripMode !$= "")
|
||||
%tripMode = %tripMode - 2;
|
||||
%count = getWordCount($PowerList);
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord($PowerList,%i);
|
||||
if (vectorDist(%baseObj.getPosition(),%powerObj.getPosition()) < %baseObj.switchRadius
|
||||
&& !%powerObj.isRemoved && %baseObj.powerFreq == %powerObj.powerFreq
|
||||
&& %baseObj.team == %powerObj.team) {
|
||||
%r = toggleGenerator(%powerObj,!%tripMode);
|
||||
%r1 = firstWord(%r);
|
||||
%r2 = getTaggedString(getWord(%r,1));
|
||||
%r3 = getWord(%r,2);
|
||||
if (%r1 == -3) {
|
||||
cancel(%powerObj.toggleSched);
|
||||
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,!%tripMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function TripTrigger::onLeaveTrigger(%data, %obj, %colObj) {
|
||||
%baseObj = %obj.baseObj;
|
||||
%baseObj.triggerCount--;
|
||||
if (%baseObj.triggerCount > 0)
|
||||
return;
|
||||
%baseObj.play3D(TripwireSound);
|
||||
if (isObject(%baseObj.tripField)) {
|
||||
cancel(%baseObj.tripField.hideSched);
|
||||
%baseObj.tripField.hideSched = %baseObj.tripField.getDataBlock().schedule(2000,losePower,%baseObj.tripField);
|
||||
}
|
||||
%tripMode = %baseObj.tripMode;
|
||||
if (%tripMode == 2 || %tripMode == 3)
|
||||
return;
|
||||
if (%tripMode == 4 || %tripMode == 5)
|
||||
%timed = true;
|
||||
while (%tripMode > 1 && %tripMode > -1 && %tripMode !$= "")
|
||||
%tripMode = %tripMode - 2;
|
||||
%count = getWordCount($PowerList);
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord($PowerList,%i);
|
||||
if (vectorDist(%baseObj.getPosition(),%powerObj.getPosition()) < %baseObj.switchRadius
|
||||
&& !%powerObj.isRemoved && %baseObj.powerFreq == %powerObj.powerFreq
|
||||
&& %baseObj.team == %powerObj.team) {
|
||||
if (%timed) {
|
||||
cancel(%powerObj.toggleSched);
|
||||
%powerObj.toggleSched = schedule(5000,0,delayedToggleGenerator,%powerObj,%tripMode);
|
||||
}
|
||||
else {
|
||||
%r = toggleGenerator(%powerObj,%tripMode);
|
||||
%r1 = firstWord(%r);
|
||||
%r2 = getTaggedString(getWord(%r,1));
|
||||
%r3 = getWord(%r,2);
|
||||
if (%r1 == -3) {
|
||||
cancel(%powerObj.toggleSched);
|
||||
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,%tripMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function delayedToggleGenerator(%powerObj,%tripMode) {
|
||||
%r = toggleGenerator(%powerObj,%tripMode);
|
||||
%r1 = firstWord(%r);
|
||||
%r2 = getTaggedString(getWord(%r,1));
|
||||
%r3 = getWord(%r,2);
|
||||
if (%r1 == -3) {
|
||||
cancel(%powerObj.toggleSched);
|
||||
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,%tripMode);
|
||||
}
|
||||
}
|
||||
|
||||
function TripTrigger::onTickTrigger(%data, %obj) {
|
||||
}
|
||||
|
||||
function TripTrigger::onTrigger(%this, %triggerId, %on) {
|
||||
}
|
||||
|
||||
datablock StaticShapeData(DeployedTripwire) : StaticShapeDamageProfile {
|
||||
className = "tripwire";
|
||||
shapeFile = "camera.dts";
|
||||
|
||||
maxDamage = 0.2;
|
||||
destroyedLevel = 0.2;
|
||||
disabledLevel = 0.2;
|
||||
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 40;
|
||||
maxEnergy = 30;
|
||||
rechargeRate = 0.05;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.3;
|
||||
expImpulse = 500;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Tripwire';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(TripwireDeployableImage) {
|
||||
mass = 20;
|
||||
emap = true;
|
||||
shapeFile = "camera.dts";
|
||||
item = TripwireDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
rotation = "-1 0 0 90";
|
||||
deployed = DeployedTripwire;
|
||||
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.25;
|
||||
maxDeployDis = 5;
|
||||
};
|
||||
|
||||
datablock ItemData(TripwireDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 5.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "TripwireDeployableImage";
|
||||
pickUpName = "a tripwire pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function TripwireDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function TripwireDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TripwireDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%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"));
|
||||
}
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = DeployedTripwire;
|
||||
};
|
||||
|
||||
%deplObj.switchRadius = getWord($packSetting[TripwireDeployableImage, %plyr.packSet[0]], 0);
|
||||
%deplObj.fieldMode = %plyr.packSet[2];
|
||||
%deplObj.tripMode = %plyr.packSet[1];
|
||||
if (%deplObj.fieldMode == 1)
|
||||
%deplObj.beamRange = 160;
|
||||
else
|
||||
%deplObj.beamRange = 30;
|
||||
|
||||
if(!%plyr.packSet[3])
|
||||
{
|
||||
%deplObj.tripField = new ForceFieldBare() {
|
||||
dataBlock = TripField;
|
||||
scale = "0.05 0.05 0.1";
|
||||
};
|
||||
|
||||
%deplObj.tripField.pzone.delete();
|
||||
}
|
||||
|
||||
%deplObj.tripTrigger = new Trigger() {
|
||||
dataBlock = TripTrigger;
|
||||
polyhedron = "0 1 0 1 0 0 0 -1 0 0 0 1";
|
||||
scale = "0.05 0.05 0.1";
|
||||
};
|
||||
|
||||
%deplObj.tripTrigger.baseObj = %deplObj;
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
adjustTripwire(%deplObj);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedTripwire::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, TripwireDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
if (isObject(%obj.tripField))
|
||||
%obj.tripField.schedule(500, "delete");
|
||||
if (isObject(%obj.tripTrigger))
|
||||
%obj.tripTrigger.schedule(500, "delete");
|
||||
}
|
||||
|
||||
function DeployedTripwire::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.tripField))
|
||||
%obj.tripField.delete();
|
||||
if (isObject(%obj.tripTrigger))
|
||||
%obj.tripTrigger.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function adjustTripwire(%obj) {
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
cancel(%obj.adjustSched);
|
||||
%pos = %obj.getPosition();
|
||||
%nrm = realVec(%obj,"0 0 1");
|
||||
%nrm2 = realVec(%obj,"1 0 0");
|
||||
%nrm3 = realVec(%obj,"0 1 0");
|
||||
|
||||
// TODO - temporary - remove
|
||||
if ($TripWireFlareMode == true) {
|
||||
%pos = vectorAdd(%obj.getPosition(),vectorScale(%nrm,0.35));
|
||||
%vec = vectorScale(%nrm,0.7);
|
||||
%p = new FlareProjectile() {
|
||||
dataBlock = FlareGrenadeProj;
|
||||
initialDirection = %vec;
|
||||
initialPosition = %pos;
|
||||
sourceObject = %obj;
|
||||
sourceSlot = 0;
|
||||
};
|
||||
FlareSet.add(%p);
|
||||
MissionCleanup.add(%p);
|
||||
%p.schedule(6000,"delete");
|
||||
}
|
||||
|
||||
// save ourselves re-doing some calculations
|
||||
%mask = $TypeMasks::VehicleObjectType | $TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType | $TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::DamagableItemObjectType;
|
||||
if (%obj.fieldMode == 1) {
|
||||
// new pad data can be done here for both field and trigger
|
||||
// "normal" (no hit) beamRange limited to 0.5m - 8m
|
||||
// max beamRange limited to 0.5m - 160m
|
||||
%pad = pad(%obj.getPosition() SPC realVec(%obj,"0 0 1") SPC realVec(%obj,"1 0 0"),0.5 SPC limit(%obj.beamRange,0.5,8) SPC limit(%obj.beamRange,0.5,160),"-0.5 -0.5 -0.5",%mask,%obj.tripField);
|
||||
%newScale = getWords(%pad,0,2);
|
||||
%newPos = getWords(%pad,3,5);
|
||||
%newRot = getWords(%pad,6,9);
|
||||
}
|
||||
else {
|
||||
// beam
|
||||
%dist = rayDist(vectorAdd(%pos,vectorScale(%nrm,0.1)) SPC %nrm,1 SPC %obj.beamRange SPC %obj.beamRange,%mask,%obj.tripField);
|
||||
}
|
||||
|
||||
if (isObject(%obj.tripField)) {
|
||||
%obj2 = %obj.tripField;
|
||||
if (%obj.fieldMode == 0) {
|
||||
%scale = %obj2.getScale();
|
||||
%newPos = vectorAdd(%pos,vectorAdd(vectorScale(%nrm2,-(getWord(%scale,0) / 2)),vectorScale(%nrm3,-(getWord(%scale,1) / 2))));
|
||||
%newRot = %obj.getRotation();
|
||||
%newScale = getWords(%scale,0,1) SPC %dist;
|
||||
}
|
||||
%oldData = %obj2.oldData;
|
||||
%newData = %newPos SPC %newRot SPC %newScale;
|
||||
if (%oldData !$= %newData && %obj.triggerCount == 0) {
|
||||
// call gainPower() before modifying forcefield!
|
||||
%obj2.getDataBlock().gainPower(%obj2);
|
||||
%obj2.setTransform(%newPos SPC %newRot);
|
||||
%obj2.setScale(%newScale);
|
||||
%obj2.oldData = %newData;
|
||||
cancel(%obj2.hideSched);
|
||||
%obj2.hideSched = %obj2.getDataBlock().schedule(2000,losePower,%obj2);
|
||||
}
|
||||
}
|
||||
if (isObject(%obj.tripTrigger)) {
|
||||
%obj2 = %obj.tripTrigger;
|
||||
if (%obj.fieldMode == 0) {
|
||||
%scale = %obj2.getScale();
|
||||
%newPos = vectorAdd(%pos,vectorAdd(vectorScale(%nrm2,-(getWord(%scale,0) / 2)),vectorScale(%nrm3,-(getWord(%scale,1) / 2))));
|
||||
%newRot = %obj.getRotation();
|
||||
%newScale = getWords(%scale,0,1) SPC %dist;
|
||||
}
|
||||
%oldData = %obj2.oldData;
|
||||
%newData = %newPos SPC %newRot SPC %newScale;
|
||||
if (%oldData !$= %newData && %obj.triggerCount == 0) {
|
||||
%obj2.setTransform(%newPos SPC %newRot);
|
||||
%obj2.setScale(%newScale);
|
||||
%obj2.oldData = %newData;
|
||||
}
|
||||
}
|
||||
%obj.adjustSched = schedule(1000,0,adjustTripwire,%obj);
|
||||
}
|
||||
|
||||
function TripwireDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasTripwire = true; // set for tripcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.packSet[0] = 0;
|
||||
%obj.packSet[1] = 0;
|
||||
%obj.packSet[2] = 0;
|
||||
%obj.packSet[3] = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TripwireDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.packSet = 0;
|
||||
%obj.packSet[0] = 0;
|
||||
%obj.packSet[1] = 0;
|
||||
%obj.packSet[2] = 0;
|
||||
%obj.packSet[3] = 0;
|
||||
%obj.hasTripwire = "";
|
||||
}
|
||||
|
||||
function TripwireDeployableImage::ChangeMode(%data,%plyr,%val,%level)
|
||||
{
|
||||
if (%level == 0)
|
||||
{
|
||||
%set = %plyr.expertSet;
|
||||
if(%set $= "")
|
||||
%set = 0;
|
||||
%image = %data.getName();
|
||||
%settings = $packSettings[%image,%set];
|
||||
|
||||
%plyr.packSet[%set] = %plyr.packSet[%set] + %val;
|
||||
if (%plyr.packSet[%set] > getWord(%settings,0))
|
||||
%plyr.packSet[%set] = 0;
|
||||
if (%plyr.packSet[%set] < 0)
|
||||
%plyr.packSet[%set] = getWord(%settings,0);
|
||||
|
||||
%packname = GetWords(%settings,2,getWordCount(%settings));
|
||||
%curset = $PackSetting[%image,%plyr.packSet[%set],%set];
|
||||
if (getWord(%settings,1) == -1)
|
||||
%line = GetWords(%curset,0,getWordCount(%curset));
|
||||
else
|
||||
%line = GetWords(%curset,0,getWord(%settings,1));
|
||||
bottomPrint(%plyr.client,%packname SPC "set to"SPC %line,2,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent::ChangeMode(%data,%plyr,%val,%level);
|
||||
}
|
||||
}
|
||||
138
Scripts/Packs/turretpack.cs
Normal file
138
Scripts/Packs/turretpack.cs
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
// turretpack.cs - turret pack
|
||||
//
|
||||
|
||||
datablock ShapeBaseImageData(TurretDeployableImage)
|
||||
{
|
||||
mass = 15;
|
||||
emap = true;
|
||||
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = TurretBasePack;
|
||||
mountPoint = 1;
|
||||
offset = "0 -0.2 0";
|
||||
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
|
||||
deployed = TurretDeployedBase;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = StationDeploySound;
|
||||
};
|
||||
|
||||
datablock ItemData(TurretBasePack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "TurretDeployableImage";
|
||||
pickUpName = "a base turret pack";
|
||||
heatSignature = 0;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock TurretData(TurretDeployedBase) : TurretDamageProfile
|
||||
{
|
||||
className = DeployedTurret;
|
||||
shapeFile = "turret_base_large.dts";
|
||||
|
||||
rechargeRate = 0.31;
|
||||
|
||||
selfPower = true;
|
||||
|
||||
needsPower = true;
|
||||
mass = 5.0;
|
||||
maxDamage = 2.25;
|
||||
destroyedLevel = 2.25;
|
||||
disabledLevel = 1.35;
|
||||
repairRate = 0;
|
||||
explosion = TurretExplosion;
|
||||
expDmgRadius = 15.0;
|
||||
expDamage = 0.7;
|
||||
expImpulse = 2000.0;
|
||||
|
||||
deployedObject = true;
|
||||
|
||||
thetaMin = 15;
|
||||
thetaMax = 140;
|
||||
//thetaNull = 90;
|
||||
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 50;
|
||||
maxEnergy = 150;
|
||||
|
||||
humSound = SensorHumSound;
|
||||
heatSignature = 1;
|
||||
pausePowerThread = true;
|
||||
|
||||
canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Deployed Base';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = TurretBaseSensorObj;
|
||||
sensorRadius = TurretBaseSensorObj.detectRadius;
|
||||
sensorColor = "0 212 45";
|
||||
|
||||
firstPersonOnly = true;
|
||||
|
||||
debrisShapeName = "debris_generic.dts";
|
||||
debris = TurretDebris;
|
||||
};
|
||||
|
||||
function TurretDeployableImage::onDeploy(%item, %plyr, %slot)
|
||||
{
|
||||
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
|
||||
%origBarrel = %item.item.origBarrel;
|
||||
if(%origBarrel !$= "")
|
||||
{
|
||||
%deplObj.mountImage(%origBarrel, 0, false);
|
||||
%item.item.origBarrel = "";
|
||||
}
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
%item.surfacenrm = VectorNormalize(%item.surfacenrm);
|
||||
//echo(%playervector);
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
//%deplObj.setSelfPowered();
|
||||
//%deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
addToDeployGroup(%deplObj);
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
%deplObj.team = %plyr.team;
|
||||
checkPowerObject(%deplObj);
|
||||
}
|
||||
|
||||
function TurretDeployableImage::onMount(%data, %obj, %node) {
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TurretBasePack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// This is here to prevent console spam
|
||||
}
|
||||
816
Scripts/Packs/vehiclepad.cs
Normal file
816
Scripts/Packs/vehiclepad.cs
Normal file
|
|
@ -0,0 +1,816 @@
|
|||
//======================================
|
||||
// made by dynablade
|
||||
//====================================== Deployable Vehicle Pad
|
||||
|
||||
|
||||
datablock StaticShapeData(DeployableVehicleStation) : StaticShapeDamageProfile
|
||||
{
|
||||
className = Station;
|
||||
catagory = "Stations";
|
||||
shapeFile = "Vehicle_pad_station.dts";
|
||||
maxDamage = 7.5;
|
||||
destroyedLevel = 7.5;
|
||||
disabledLevel = 7.5;
|
||||
explosion = ShapeExplosion;
|
||||
expDmgRadius = 10.0;
|
||||
expDamage = 0.4;
|
||||
expImpulse = 1500.0;
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 500;
|
||||
maxEnergy = 250;
|
||||
rechargeRate = 0.31;
|
||||
humSound = StationVehicleHumSound;
|
||||
|
||||
cmdCategory = "Support";
|
||||
cmdIcon = CMDVehicleStationIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_vehicle_pad_inventory";
|
||||
targetTypeTag = 'Deployable Vehicle Station';
|
||||
|
||||
debrisShapeName = "debris_generic.dts";
|
||||
debris = StationDebris;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployableVehiclePad)
|
||||
{
|
||||
className = vpad;
|
||||
catagory = "Stations";
|
||||
shapeFile = "Vehicle_pad.dts";
|
||||
maxDamage = 7.5;
|
||||
destroyedLevel = 7.5;
|
||||
disabledLevel = 7.5;
|
||||
explosion = ShapeExplosion;
|
||||
expDmgRadius = 10.0;
|
||||
expDamage = 0.4;
|
||||
expImpulse = 1500.0;
|
||||
rechargeRate = 0.05;
|
||||
targetTypeTag = 'Deployable Vehicle Station';
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployableVehiclePad2) : DeployableVehiclePad
|
||||
{
|
||||
className = vpad;
|
||||
shapeFile = "station_teleport.dts";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
datablock StaticShapeData(DeployableVehiclePadBottom) : StaticShapeDamageProfile {
|
||||
className = "floor";
|
||||
shapeFile = "bmiscf.dts";
|
||||
|
||||
maxDamage = 4;
|
||||
destroyedLevel = 4;
|
||||
disabledLevel = 3.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 30;
|
||||
maxEnergy = 200;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Medium Blast floor';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(PotPipe) : DeployableVehiclePadBottom
|
||||
{
|
||||
shapeFile = "silver_pole.dts";
|
||||
targetNameTag = 'Pot Powered';
|
||||
targetTypeTag = 'Alloy forge';
|
||||
};
|
||||
|
||||
datablock ParticleData(DVPADP)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 1500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 30.0;
|
||||
spinRandomMax = 30.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/jetflare03";
|
||||
|
||||
colors[0] = "0.3 0.3 1.0 0.1";
|
||||
colors[1] = "0.3 0.3 1.0 1";
|
||||
colors[2] = "0.3 0.3 1.0 1";
|
||||
colors[3] = "0.3 0.3 1.0 0.1";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 5;
|
||||
sizes[2] = 5;
|
||||
sizes[3] = 5;
|
||||
|
||||
times[0] = 0.25;
|
||||
times[1] = 0.5;
|
||||
times[2] = 0.75;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(DVPADE)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.01;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 8;
|
||||
thetaMin = 80.0;
|
||||
thetaMax = 100.0;
|
||||
|
||||
phiReferenceVel = "180";
|
||||
phiVariance = "5";
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "DVPADP";
|
||||
};
|
||||
|
||||
datablock ParticleData(SIGMAP)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = -0.5;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 1500;
|
||||
lifetimeVarianceMS = 1000;
|
||||
|
||||
spinRandomMin = -30.0;
|
||||
spinRandomMax = 30.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/jetflare03";
|
||||
|
||||
colors[0] = "1 1 0 0"; //Wacky collors :P
|
||||
colors[1] = "0 1 1 1";
|
||||
colors[2] = "1 0 1 1";
|
||||
colors[3] = "0 1 0 1";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 5;
|
||||
sizes[2] = 5;
|
||||
sizes[3] = 5;
|
||||
|
||||
times[0] = 0.5;
|
||||
times[1] = 0.6;
|
||||
times[2] = 0.8;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(SIGMAE)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 50;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 1.0;
|
||||
velocityVariance = 0.5;
|
||||
ejectionoffset = 0.5;
|
||||
thetaMin = 80.0;
|
||||
thetaMax = 100.0;
|
||||
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "360";
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "SIGMAP";
|
||||
};
|
||||
|
||||
|
||||
function DeployableVehicleStation::onAdd(%this, %obj)
|
||||
{
|
||||
Parent::onAdd(%this, %obj);
|
||||
|
||||
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
|
||||
%trigger = new Trigger()
|
||||
{
|
||||
dataBlock = stationTrigger;
|
||||
polyhedron = "-0.75 0.75 0.0 1.5 0.0 0.0 0.0 -1.5 0.0 0.0 0.0 2.0";
|
||||
};
|
||||
MissionCleanup.add(%trigger);
|
||||
%trigger.setTransform(%obj.getTransform());
|
||||
%trigger.station = %obj;
|
||||
%obj.trigger = %trigger;
|
||||
}
|
||||
|
||||
function DeployableVehicleStation::stationReady(%data, %obj)
|
||||
{
|
||||
// Make sure none of the other popup huds are active:
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
|
||||
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
|
||||
|
||||
//Display the Vehicle Station GUI
|
||||
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
|
||||
}
|
||||
|
||||
function DeployableVehicleStation::stationFinished(%data, %obj)
|
||||
{
|
||||
//Hide the Vehicle Station GUI
|
||||
commandToClient(%obj.triggeredBy.client, 'StationVehicleHideHud');
|
||||
}
|
||||
|
||||
function DeployableVehicleStation::getSound(%data, %forward)
|
||||
{
|
||||
if(%forward)
|
||||
return "StationVehicleAcitvateSound";
|
||||
else
|
||||
return "StationVehicleDeactivateSound";
|
||||
}
|
||||
|
||||
function DeployableVehicleStation::setPlayersPosition(%data, %obj, %trigger, %colObj)
|
||||
{
|
||||
%vel = getWords(%colObj.getVelocity(), 0, 1) @ " 0";
|
||||
if((VectorLen(%vel) < 22) && (%obj.triggeredBy != %colObj))
|
||||
{
|
||||
%posXY = getWords(%trigger.getTransform(),0 ,1);
|
||||
%posZ = getWord(%trigger.getTransform(), 2);
|
||||
%rotZ = getWord(%obj.getTransform(), 5);
|
||||
%angle = getWord(%obj.getTransform(), 6);
|
||||
%angle += 3.141592654;
|
||||
if(%angle > 6.283185308)
|
||||
%angle = %angle - 6.283185308;
|
||||
%colObj.setvelocity("0 0 0");
|
||||
%colObj.setTransform(%posXY @ " " @ %posZ + 0.2 @ " " @ "0 0 " @ %rotZ @ " " @ %angle );//center player on object
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::onAdd(%this, %obj)
|
||||
{
|
||||
Parent::onAdd(%this, %obj);
|
||||
|
||||
%obj.ready = true;
|
||||
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::onAdd(%this, %obj)
|
||||
{
|
||||
Parent::onAdd(%this, %obj);
|
||||
|
||||
%obj.ready = true;
|
||||
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
|
||||
}
|
||||
|
||||
|
||||
function GiveStation(%obj,%transform)
|
||||
{
|
||||
%pos = getWords(%transform,0,2);
|
||||
%rot = getWords(%transform,3,5) SPC (getWord(%transform,6)/3.14*180);
|
||||
%sv = new StaticShape()
|
||||
{
|
||||
scale = "1 1 1";
|
||||
dataBlock = DeployableVehicleStation;
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
team = %obj.team;
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
};
|
||||
|
||||
%sv.setTransform(%transform);
|
||||
%sv.powerFreq = %obj.powerFreq;
|
||||
MissionCleanup.add(%sv);
|
||||
//%sv.getDataBlock().gainPower(%sv);
|
||||
//%obj.getDatablock().gainPower(%obj);
|
||||
checkPowerObject(%obj);
|
||||
checkPowerObject(%sv);
|
||||
%sv.pad = %obj;
|
||||
%obj.station = %sv;
|
||||
%sv.trigger.mainObj = %obj;
|
||||
%sv.trigger.disableObj = %sv;
|
||||
adjustTrigger(%sv);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Original Code in Station.cs
|
||||
// Code made by Blnukem.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Basic Restriction to Construction Vehicles in the Construction Gametype.
|
||||
if ($CurrentMissionType $= "Construction") {
|
||||
%sv.vehicle[HawkFlyer] = true;
|
||||
%sv.vehicle[Personelboat] = true;
|
||||
// Now to set the vehicle defaults for Non-Construction Gametypes.
|
||||
} else if ($CurrentMissionType !$= "Construction") {
|
||||
%sv.vehicle[boat] = true;
|
||||
%sv.vehicle[sub] = true;
|
||||
%sv.vehicle[Personelboat] = true;
|
||||
%sv.vehicle[scoutFlyer] = true;
|
||||
%sv.vehicle[AWACS] = true;
|
||||
%sv.vehicle[helicopter] = true;
|
||||
%sv.vehicle[HeavyChopper] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function GiveStation2(%obj,%transform)
|
||||
{
|
||||
%pos = getWords(%transform,0,2);
|
||||
%rot = getWords(%transform,3,5) SPC (getWord(%transform,6)/3.14*180);
|
||||
%sv = new StaticShape()
|
||||
{
|
||||
scale = "1 1 1";
|
||||
dataBlock = DeployableVehicleStation;
|
||||
lockCount = "0";
|
||||
homingCount = "0";
|
||||
team = %obj.team;
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
};
|
||||
|
||||
%sv.setTransform(%transform);
|
||||
%sv.powerFreq = %obj.powerFreq;
|
||||
MissionCleanup.add(%sv);
|
||||
checkPowerObject(%obj);
|
||||
checkPowerObject(%sv);
|
||||
%sv.pad = %obj;
|
||||
%obj.station = %sv;
|
||||
%sv.trigger.mainObj = %obj;
|
||||
%sv.trigger.disableObj = %sv;
|
||||
adjustTrigger(%sv);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// Original Code in Station.cs
|
||||
// Code made by Blnukem.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Basic Restriction to Construction Vehicles in the Construction Gametype.
|
||||
if ($CurrentMissionType $= "Construction") {
|
||||
%sv.vehicle[SuperScoutVehicle] = true;
|
||||
%sv.vehicle[HawkFlyer] = true;
|
||||
%sv.vehicle[mobileBasevehicle] = true;
|
||||
%sv.vehicle[hapcFlyer] = true;
|
||||
%sv.vehicle[bomberFlyer] = true;
|
||||
// Now to set the vehicle defaults for Non-Construction Gametypes.
|
||||
} else if ($CurrentMissionType !$= "Construction") {
|
||||
%sv.vehicle[mobileBasevehicle] = true;
|
||||
%sv.vehicle[scoutFlyer] = true;
|
||||
%sv.vehicle[hapcFlyer] = true;
|
||||
%sv.vehicle[CGTank] = true;
|
||||
%sv.vehicle[helicopter] = true;
|
||||
%sv.vehicle[StrikeFlyer] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::onEndSequence(%data, %obj, %thread)
|
||||
{
|
||||
if(%thread == $ActivateThread)
|
||||
{
|
||||
%obj.ready = true;
|
||||
%obj.stopThread($ActivateThread);
|
||||
}
|
||||
Parent::onEndSequence(%data, %obj, %thread);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::onEndSequence(%data, %obj, %thread)
|
||||
{
|
||||
if(%thread == $ActivateThread)
|
||||
{
|
||||
%obj.ready = true;
|
||||
%obj.stopThread($ActivateThread);
|
||||
}
|
||||
Parent::onEndSequence(%data, %obj, %thread);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::gainPower(%data, %obj)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
%obj.station.setSelfPowered();
|
||||
Parent::gainPower(%data, %obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::gainPower(%data, %obj)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
%obj.station.setSelfPowered();
|
||||
Parent::gainPower(%data, %obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::losePower(%data, %obj)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
%obj.station.clearSelfPowered();
|
||||
Parent::losePower(%data, %obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::losePower(%data, %obj)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
%obj.station.clearSelfPowered();
|
||||
Parent::losePower(%data, %obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::onDestroyed(%this, %obj, %prevState)
|
||||
{
|
||||
if (isObject(%obj))
|
||||
disassembleVehilcepad(%obj,%plyr);
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
|
||||
%obj.schedule(500, "delete");
|
||||
%obj.station.schedule(500, "delete");
|
||||
%obj.back.schedule(500,"delete");
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::onDestroyed(%this, %obj, %prevState)
|
||||
{
|
||||
if (isObject(%obj))
|
||||
disassembleVehilcepad(%obj,%plyr);
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
|
||||
%obj.schedule(500, "delete");
|
||||
%obj.station.schedule(500, "delete");
|
||||
%obj.back.schedule(500,"delete");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function DeployableVehicleStation::onDestroyed(%this, %obj, %prevState)
|
||||
{
|
||||
if (isObject(%obj.pad))
|
||||
disassembleVehilcepad(%obj.pad,%plyr);
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
|
||||
%obj.schedule(500, "delete");
|
||||
%obj.station.schedule(500, "delete");
|
||||
%obj.back.schedule(500,"delete");
|
||||
}
|
||||
|
||||
function DeployableVehiclePadBottom::onDestroyed(%this, %obj, %prevState)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
disassembleVehilcepad(%obj.station,%plyr);
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
|
||||
%obj.schedule(500, "delete");
|
||||
%obj.station.schedule(500, "delete");
|
||||
%obj.back.schedule(500,"delete");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock ShapeBaseImageData(VehiclePadPackImage)
|
||||
{
|
||||
mass = 10;
|
||||
emap = true;
|
||||
|
||||
shapeFile = "pack_deploy_inventory.dts";
|
||||
item = VehiclePadPack;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
heatSignature = 0;
|
||||
deployed = DeployableVehiclePad;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
maxDepSlope = 360;
|
||||
deploySound = StationDeploySound;
|
||||
|
||||
minDeployDis = 0;
|
||||
maxDeployDis = 50.0; //meters from body
|
||||
};
|
||||
|
||||
datablock ItemData(VehiclePadPack)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_inventory.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "VehiclePadPackImage";
|
||||
pickUpName = "a deployable vehicle pad";
|
||||
heatSignature = 0;
|
||||
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function VehiclePadPackImage::onMount(%this, %obj, %slot)
|
||||
{
|
||||
%this.imagemount = %obj;
|
||||
%obj.hasVehiclepad = 1;
|
||||
}
|
||||
|
||||
function VehiclePadPackImage::onUnmount(%data,%obj,%node)
|
||||
{
|
||||
%obj.hasVehiclepad = "";
|
||||
}
|
||||
|
||||
function VehiclePadPack::onPickup(%this, %pack, %player, %amount)
|
||||
{
|
||||
%player.packcharge = %pack.charge;
|
||||
%player.lastvpad = %pack.vpad;
|
||||
}
|
||||
|
||||
|
||||
function VehiclePadPack::onThrow(%this,%pack,%player)
|
||||
{
|
||||
%this.charge = %player.packcharge;
|
||||
%this.vpad = %player.lastvpad;
|
||||
%player.packcharge = "";
|
||||
%player.lastvpad = "";
|
||||
serverPlay3D(ItemThrowSound, %player.getTransform());
|
||||
%pack.schedulePop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function VehiclePadPackImage::onDeploy(%item, %plyr, %slot)
|
||||
{
|
||||
if (IsObject(%plyr.lastvpad) && IsObject(%plyr.lastvpad.station))
|
||||
%plyr.packcharge = 0;
|
||||
if (IsObject(%plyr.lastvpad) && !IsObject(%plyr.lastvpad.station))
|
||||
%plyr.packcharge = 1;
|
||||
if (!IsObject(%plyr.lastvpad))
|
||||
%plyr.packcharge = 0;
|
||||
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
if (%plyr.packcharge == 1)
|
||||
{
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%vpad = %plyr.lastvpad;
|
||||
if (%plyr.packset == 1)
|
||||
%deplObj = GiveStation(%vpad,%item.surfacePt SPC %rot);
|
||||
else
|
||||
%deplObj = GiveStation2(%vpad,%item.surfacePt SPC %rot);
|
||||
%deplObj.deploy();
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
%deplObj.setOwner(%plyr);
|
||||
%plyr.packcharge = "";
|
||||
%plyr.lastvpad = "";
|
||||
%vpad.isRemoved = 0;
|
||||
%vpad.back.isRemoved = 0;
|
||||
if (%vpad.style ==2)
|
||||
{
|
||||
%deplObj.emitter = CreateEmitter(%item.surfacePt,SIGMAE);
|
||||
%deplObj.emitter.setRotation(%deplObj.getRotation());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%dist = VectorSub(%item.surfacept,%plyr.getTransform());
|
||||
%nrm = VirVec(%item.surface,%item.surfacenrm);
|
||||
%img = VirVec(%item.surface,VectorNormalize(VectorCross(VectorCross(%item.surfacenrm,%dist),%item.surfacenrm)));
|
||||
%item.surfacenrm2 = realvec(%item.surface,VectorCross(%nrm,topvec(%img)));
|
||||
// create the actual deployable
|
||||
%rot = %item.getInitialRotation(%plyr);
|
||||
|
||||
if (%plyr.packset == 1)
|
||||
%block = DeployableVehiclePad2;
|
||||
else
|
||||
%block = DeployableVehiclePad;
|
||||
|
||||
%deplObj = new StaticShape()
|
||||
{
|
||||
dataBlock = %block;
|
||||
};
|
||||
%back = new StaticShape()
|
||||
{
|
||||
dataBlock = DeployableVehiclePadBottom;
|
||||
};
|
||||
%back.needsfit = 1;
|
||||
%deplObj.needsfit = 1;
|
||||
%deplObj.style = %plyr.packset;
|
||||
%pos = getWords(%item.surface.getEdge(%nrm),0,2);
|
||||
%deplObj.setTransform(%pos SPC fullrot(%item.surfacenrm,%item.surfacenrm2));
|
||||
if (VectorDot(vAbs(VectorNormalize(topvec(%img))),%item.surface.getRealSize())== %item.surfacesizex)
|
||||
{
|
||||
%x= %item.surfacesizex;
|
||||
%y= %item.surfacesizey;
|
||||
%item.surfacesizex = %y;
|
||||
%item.surfacesizey = %x;
|
||||
}
|
||||
%deplObj.setRealSize(%item.surfacesizex SPC %item.surfacesizey SPC "1.5");
|
||||
%back.setTransform(%pos SPC fullrot(%item.surfacenrm,%item.surfacenrm2));
|
||||
%back.setRealSize(VectorMultiply(%deplObj.getRealSize(),"1 1 0.1"));
|
||||
if (%plyr.packset == 2)
|
||||
{
|
||||
%back.potpipes();
|
||||
}
|
||||
// %deplObj.setTransform(modifyTransform(%pos SPC %rot, "0 0 -1 0 0 0 0"));
|
||||
%deplObj.back = %back;
|
||||
%back.station = %deplObj;
|
||||
// set the recharge rate right away
|
||||
if(%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%back.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%back.setOwner(%plyr);
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
addToDeployGroup(%deplObj.back);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
%deplObj.getDatablock().onAdd(%deplObj);
|
||||
%deplObj.deploy();
|
||||
//%deplObj.setSelfPowered();
|
||||
%plyr.packcharge++;
|
||||
%plyr.lastvpad = %deplObj;
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
%back.powerFreq = %plyr.powerFreq;
|
||||
checkPowerObject(%deplobj);
|
||||
checkPowerObject(%back);
|
||||
%deplObj.isRemoved = 1;
|
||||
%back.isRemoved = 1;
|
||||
schedule(6000,0,"FadePad",%deplObj,%plyr);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
addDSurface(%item.surface,%back);
|
||||
}
|
||||
}
|
||||
|
||||
function FadePad(%obj,%plyr)
|
||||
{
|
||||
if (!Isobject(%obj.station))
|
||||
{
|
||||
schedule(100,%obj,"disassembleVehilcepad",%obj,%plyr);
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::PotPipes(%obj)
|
||||
{
|
||||
%obj.pipe1 = new StaticShape()
|
||||
{
|
||||
dataBlock = PotPipe;
|
||||
scale = "0.5 0.5 0.5";
|
||||
};
|
||||
%obj.pipe2 = new StaticShape()
|
||||
{
|
||||
dataBlock = PotPipe;
|
||||
scale = "0.5 0.5 0.5";
|
||||
};
|
||||
%obj.pipe3 = new StaticShape()
|
||||
{
|
||||
dataBlock = PotPipe;
|
||||
scale = "0.5 0.5 0.5";
|
||||
};
|
||||
%obj.pipe4 = new StaticShape()
|
||||
{
|
||||
dataBlock = PotPipe;
|
||||
scale = "0.5 0.5 0.5";
|
||||
};
|
||||
%obj.pipe1.setTransform(%obj.getEdge("0.9 0.9 1") SPC %obj.getRotation());
|
||||
%obj.pipe2.setTransform(%obj.getEdge("0.9 -0.9 1")SPC %obj.getRotation());
|
||||
%obj.pipe3.setTransform(%obj.getEdge("-0.9 -0.9 1")SPC %obj.getRotation());
|
||||
%obj.pipe4.setTransform(%obj.getEdge("-0.9 0.9 1")SPC %obj.getRotation());
|
||||
%obj.pipe1.emitter = CreateEmitter(%obj.pipe1.getEdge("0 0 1"),HeavyDamageSmoke);
|
||||
%obj.pipe2.emitter = CreateEmitter(%obj.pipe2.getEdge("0 0 1"),HeavyDamageSmoke);
|
||||
%obj.pipe3.emitter = CreateEmitter(%obj.pipe3.getEdge("0 0 1"),HeavyDamageSmoke);
|
||||
%obj.pipe4.emitter = CreateEmitter(%obj.pipe4.getEdge("0 0 1"),HeavyDamageSmoke);
|
||||
addToDeployGroup(%obj.pipe1);
|
||||
addToDeployGroup(%obj.pipe2);
|
||||
addToDeployGroup(%obj.pipe3);
|
||||
addToDeployGroup(%obj.pipe4);
|
||||
}
|
||||
|
||||
function GameBase::RemPotPipes(%obj)
|
||||
{
|
||||
if (IsObject(%obj.pipe1))
|
||||
{
|
||||
%obj.pipe1.emitter.delete();
|
||||
%obj.pipe1.delete();
|
||||
}
|
||||
if (IsObject(%obj.pipe2))
|
||||
{
|
||||
%obj.pipe2.emitter.delete();
|
||||
%obj.pipe2.delete();
|
||||
}
|
||||
if (IsObject(%obj.pipe3))
|
||||
{
|
||||
%obj.pipe3.emitter.delete();
|
||||
%obj.pipe3.delete();
|
||||
}
|
||||
if (IsObject(%obj.pipe4))
|
||||
{
|
||||
%obj.pipe4.emitter.delete();
|
||||
%obj.pipe4.delete();
|
||||
}
|
||||
}
|
||||
|
||||
function VehiclePadPackImage::testSurfaceTooNarrow(%item,%surface)
|
||||
{
|
||||
%nrm = getWords(%item.surface,4,6);
|
||||
%mask = invFace(%nrm);
|
||||
%narrower = vectorMultiply(%mask,%item.surface.getRealSize());
|
||||
%fx = vectorNormalize(topVec(%narrower));
|
||||
%fy = VectorCross(%nrm,%fx);
|
||||
%sx = VectorLen(VectorMultiply(%fx,%item.surface.getRealSize()));
|
||||
%sy = VectorLen(VectorMultiply(%fy,%item.surface.getRealSize()));
|
||||
|
||||
if (%sx < 17 || %sy < 17 || %sx < %sy*0.5 || %sy < %sx*0.5)
|
||||
{
|
||||
return !%item.imagemount.packcharge;
|
||||
}
|
||||
else
|
||||
{
|
||||
%item.surfacesizex = %sx;
|
||||
%item.surfacesizey = %sy;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function VehiclePadPackImage::testNoInteriorFound(%item,%surface)
|
||||
{
|
||||
return !IsCubic(%item.surface) && !%item.imagemount.packcharge;
|
||||
}
|
||||
|
||||
function DeployableVehiclePad::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
if (isObject(%obj))
|
||||
disassembleVehilcepad(%obj,%plyr);
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePad2::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
if (isObject(%obj))
|
||||
disassembleVehilcepad(%obj,%plyr);
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployableVehicleStation::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
if (isObject(%obj.pad))
|
||||
disassembleVehilcepad(%obj.pad,%plyr);
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployableVehiclePadBottom::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
if (isObject(%obj.station))
|
||||
disassembleVehilcepad(%obj.station,%plyr);
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function PotPipe::disassemble(%data,%plyr,%obj)
|
||||
{
|
||||
if (%obj.emitter)
|
||||
%obj.emitter.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function disassembleVehilcepad(%station,%plyr)
|
||||
{
|
||||
%station.back.rempotpipes();
|
||||
if (%station.station.emitter)
|
||||
%station.station.emitter.delete();
|
||||
if (isObject(%station.station))
|
||||
disassemble("",%plyr,%station.station);
|
||||
|
||||
if (isObject(%station.back))
|
||||
disassemble("",%plyr,%station.back);
|
||||
disassemble("",%plyr,%station);
|
||||
}
|
||||
292
Scripts/Packs/vehiclerepairpad.cs
Normal file
292
Scripts/Packs/vehiclerepairpad.cs
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
datablock StaticShapeData(RepairPad) : StaticShapeDamageProfile
|
||||
{
|
||||
className = Station;
|
||||
shapeFile = "station_teleport.dts";
|
||||
maxDamage = 5.50;
|
||||
destroyedLevel = 5.50;
|
||||
disabledLevel = 4.75;
|
||||
explosion = DeployablesExplosion;
|
||||
expDmgRadius = 15.0;
|
||||
expDamage = 0.65;
|
||||
expImpulse = 1500.0;
|
||||
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
isShielded = false;
|
||||
energyPerDamagePoint = 110;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.20;
|
||||
renderWhenDestroyed = false;
|
||||
doesRepair = true;
|
||||
|
||||
deployedObject = true;
|
||||
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDStationIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
|
||||
targetNameTag = 'Vehicle';
|
||||
targetTypeTag = 'Repair Pad';
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needspower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(RepairPadImage)
|
||||
{
|
||||
mass = 15;
|
||||
emap = true;
|
||||
|
||||
shapeFile = "pack_deploy_inventory.dts";
|
||||
item = RepairPadDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = RepairPad;
|
||||
heatSignature = 0;
|
||||
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
maxDepSlope = 30;
|
||||
deploySound = StationDeploySound;
|
||||
|
||||
flatMinDeployDis = 1.0;
|
||||
flatMaxDeployDis = 5.0;
|
||||
|
||||
minDeployDis = 2.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(RepairPadDeployable)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_inventory.dts";
|
||||
mass = 3.0;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "RepairPadImage";
|
||||
pickUpName = "a vehicle repair pad";
|
||||
heatSignature = 0;
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
|
||||
};
|
||||
|
||||
function RepairPadImage::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);
|
||||
%dataBlock = %item.deployed;
|
||||
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %dataBlock;
|
||||
scale = "4.5 4.5 1";
|
||||
};
|
||||
|
||||
//////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]];
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function RepairPad::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if(%obj.isreping == 1)
|
||||
stopVRepairLoop(%obj);
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, RepairPadDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function RepairPad::onGainPowerEnabled(%data,%obj) {
|
||||
if (%obj.reploop !$= "")
|
||||
Cancel(%obj.repLoop);
|
||||
%obj.isreping = 1;
|
||||
%obj.repLoop = schedule(1000, 0, "VRepairLoop", %obj);
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function RepairPad::onLosePowerDisabled(%data,%obj) {
|
||||
if (%obj.ZCloop !$= ""){
|
||||
Cancel(%obj.repLoop);
|
||||
stopVRepairLoop(%obj);
|
||||
}
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
|
||||
function VRepairLoop(%obj){
|
||||
if(isObject(%obj)){
|
||||
if(%obj.isreping == 0)
|
||||
return;
|
||||
|
||||
%targets = %obj.reptargets;
|
||||
%pos = %obj.getWorldBoxCenter();
|
||||
if(%targets !$= ""){
|
||||
%numtrgs = getNumberOfWords(%targets);
|
||||
for(%i = 0; %i < %numtrgs; %i++){
|
||||
%target = getWord(%targets, %i);
|
||||
if(vectorDist(%pos, %target.getWorldBoxCenter()) <= 20 && %target.getDamageLevel() > 0.0){
|
||||
if(%target.reping != 1){
|
||||
%target.reping = 1;
|
||||
%target.setRepairRate(%target.getRepairRate() + 0.01);
|
||||
if(%target.affected && %target.getDamagelevel() < %target.getDatablock().HDAddMassLevel) {
|
||||
if (%target.lastPilot.isPilot() == true)
|
||||
messageClient(%target.lastPilot.client, '', 'Vehicle Repaired, and Manuverability restored!');
|
||||
%target.unmountImage(7);
|
||||
%target.Affected = 0;
|
||||
if(%target.getClassName() $= "FlyingVehicle")
|
||||
Cancel(%target.dmgStallLoop);
|
||||
if(%target.getdatablock().getname() $= "scoutFlyer" || %target.getdatablock().getname() $= "strikeFlyer")
|
||||
checkStallLoop(%obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(%target.reping == 1){
|
||||
%target.reping = 0;
|
||||
%target.setRepairRate(%target.getRepairRate() - 0.01);
|
||||
}
|
||||
}
|
||||
%datablock = %target.getDatablock();
|
||||
if(%datablock.max[chaingunAmmo] !$= "" && %target.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
|
||||
if(%datablock.max[chaingunAmmo] < 100)
|
||||
%CGamount = 10;
|
||||
else
|
||||
%CGamount = 100;
|
||||
%target.incInventory(chaingunAmmo, %CGamount);
|
||||
%reloaded = 1;
|
||||
}
|
||||
else if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
|
||||
%target.incInventory(MissileLauncherAmmo, 1);
|
||||
%reloaded = 1;
|
||||
}
|
||||
else if(%datablock.max[MortarAmmo] !$= "" && %target.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
|
||||
%target.incInventory(MortarAmmo, 1);
|
||||
%reloaded = 1;
|
||||
}
|
||||
else if(%datablock.max[PlasmaAmmo] !$= "" && %target.inv[PlasmaAmmo] < %datablock.max[PlasmaAmmo]){
|
||||
%target.incInventory(PlasmaAmmo, 4);
|
||||
%reloaded = 1;
|
||||
}
|
||||
if(%reloaded == 1){
|
||||
%reloaded = 0;
|
||||
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
|
||||
}
|
||||
|
||||
if(isObject(%target.turretObject)){
|
||||
%datablock = %target.turretObject.getDatablock();
|
||||
if(%datablock.max[chaingunAmmo] !$= "" && %target.turretObject.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
|
||||
%target.turretObject.incInventory(chaingunAmmo, 100);
|
||||
%reloaded = 1;
|
||||
}
|
||||
else if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.turretObject.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
|
||||
%target.turretObject.incInventory(MissileLauncherAmmo, 1);
|
||||
%reloaded = 1;
|
||||
}
|
||||
else if(%datablock.max[MortarAmmo] !$= "" && %target.turretObject.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
|
||||
%target.turretObject.incInventory(MortarAmmo, 1);
|
||||
%reloaded = 1;
|
||||
}
|
||||
if(%reloaded == 1)
|
||||
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
|
||||
}
|
||||
}
|
||||
}
|
||||
%obj.reptargets = "";
|
||||
InitContainerRadiusSearch(%pos, 15, $TypeMasks::VehicleObjectType);
|
||||
while ((%targetObject = containerSearchNext()) != 0){
|
||||
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
|
||||
}
|
||||
if(%obj.isreping == 1)
|
||||
%obj.reploop = schedule(500, 0, "VRepairLoop", %obj);
|
||||
}
|
||||
}
|
||||
|
||||
function stopVRepairLoop(%obj){
|
||||
%obj.isreping = 0;
|
||||
if(%obj.reptargets !$= ""){
|
||||
%numtrgs = getNumberOfWords(%obj.reptargets);
|
||||
for(%i = 0; %i < %numtrgs; %i++){
|
||||
%target = getWord(%obj.reptargets, %i);
|
||||
if(%target.reping == 1){
|
||||
%target.reping = 0;
|
||||
%target.setRepairRate(%target.getRepairRate() - 0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue