mirror of
https://github.com/Ragora/TribesReplay.git
synced 2026-01-21 02:24:43 +00:00
Map Editor =================================== Several editor crashes have been resolved and this tool should be more stable for the MOD community now. VCR Mode =================================== The VCR Mode has been implemented. F3 starts recording. F4 stops the current recording. Multiple recordings can be made from the same mission. Other controls can be used while playing back a recording. They include: -- ESCAPE will stop the playback -- TAB will pop up the playback controls window in the upper part of the screen -- SPACEBAR will pause/unpause the playback -- Numpad + will increase the time step so that the playback accelerates (maximum of 16X speed) -- Numpad - will decrease the time step so that the playback slows down (minimum of 1/16X speed) ***If you Alt-Tab to windows to rename a demo file and then return to Tribes instead of using the rename file feature of the demo recorder you will crash after you exit the recorder. It is a windows issue and so we can't fix it. Satchel Charge Icon Glow =================================== When the satchel charge is deployed and ready to explode, the icon now glows. The icon disappears completely when the satchel is destroyed (either through activation or destruction). This allows players to more readily keep track of satchel charge status. "Visibility" option for Server Admins ===================================== Allows an Advanced Server option to indicate whether the server will use the "Speed" or "Distance" versions of the maps when hosting games. The "Distance" setting will use world versions with much less fog and more visible distance. The "Speed" setting will use the current foggier map settings. These settings will be displayed as a new column on the Master Server List titled "VISIBILITY" and the settings will be "Speed" or "Distance". NOTE: This visibility change won't be apparent on all maps. A map you can use as a test to show the differences is "Dessicator". World Skins Default to Main Tribes ========================================== The missions are now set up so they have default skins other than "Storm" vs. "Inferno". This occurs whenever a player has "Show Individual Skins" toggled OFF. In otherwords, some maps will have "Diamond Skin" vs. "StarWolf", while others will have different combinations. (NOTE: If a player has "Show Individual Skins" toggled ON, then he will see the regular individual skins for players.) New voice samples have been added to allow Victory messages indicate these new team skins. Also note: Bioderms are bioderms, regardless of the team they are on...we're not changing models or voice packages. Teams now use skins for CTF games relative to the planet - as follows: Terrain Team 1 Team 2 Ice Starwolf Blood Eagle Lush Blood Eagle Diamond Sword Badlands Starwolf Diamond Sword Desert Phoenix Blood Eagle Lava Diamond Sword Phoenix If the server admin wishes to specify team skins, set the variable $host:: useCustomSkins = true; in serverPrefs.cs if this variable is set true the skins and names used are $Host::TeamName1 and $Host::TeamName2 and $Host::TeamSkin1 and $Host::TeamSkin2 also set in serverPrefs.cs. These team and skin names are always used for non-CTF games. NOTE: In "Tournament" mode games, the skins will always default to Storm and Inferno rather than world-specific skins. This is to make it easier for League and Ladder players to assign teams to sides. Cheat Fixes =================================== Significant cheat prevention code has been implemented to eliminate known cheats, as well as to make it much more difficult for future cheating of a similar nature to occur. NOTE: If you have any troubles running a server now, you may have altered or removed something from the build on your server. The code is checking almost everything now (shapes, textures, etc.), so you should ensure that you have all files present from a normal build on your server. (Additional files, like MODs and extra art files won't be a problem...but all original files must be there as well.) Siege Halftime Improved =================================== The Siege halftime now gets a screen listing the winning team instead of simply "Switching Sides". CTF Individual Scoring =================================== No change was made whatsoever to the team CTF scoring. But the individual scoring now takes into account vehicle kills, more repair/destroy stuff, and makes it nice and robust for statistical tracking later. NOTE: The scores are dramatically inflated compared to previous individual scores so that we had more "granularity" in the system and didn't have to use decimal points. Thus, you will appear to be racking up a huge amount of points, but it's all relative when compared to other players in the game. Scoring Details ---------------------- Kill: 10 pts Flag Capture: 30 pts Flag Grab (if subsequently captured): 20 [A one player grab-and-cap you get both for a total of 50] Carrier Escort: 3 Sniper Headshot: 1 Turret kill: manned: 10 automated: 3 Flag Defend: 5 Flag Carrier Kill: 5 Flag Return: 0 - 10 pts [Points are scaled by distance: no points for a short return. 10 pts if the flag carrier gets all the way to the flag. 1 point per 10% (Halfway is 5 pts.)] 15 points if the return breaks a stalemate (both teams have had each others flags for 60 seconds or longer.) Generator Defend: 5 pts Object Destroy Repair Generator 10 8 Sensor 4 1 Base Turret 5 4 Inv Station 2 2 Vehicle Station 5 4 Solar Panel 5 4 Sentry Turret 4 2 Deployed sensor 1 0 Deployed inv station 2 0 Deployed turret 3 3 Shrike 5 Bomber 8 Havoc 5 Wildcat 5 Tank 8 MPB 12 *vehicles destroyed by mines are double points, vehicles destroyed by the Shrike are triple points **vehicles destroyed also score 2 points per passenger (after any multiplier) ***points accumulated in a vehicle are earned by everyone in the vehicle Heat Lock vs. Target Laser Lock =================================== Heat Locking now supercedes Targeting Laser Locking so that heat locks can be attained on objects that are being lazed by friends. Keep in mind that when the target is out of range for the ML, it will still lock onto the targeting laser giving the appearance that its locking onto the laser first. If the target is in range the ML will always look for heated targets first. Objective HUD Visible on Vehicles =================================== The objective HUD is now visible while flying/driving vehicles. Client-Side Toggle on Vehicle Tport =================================== The player now has the ability to toggle Vehicle Tport ability on/off (defaults to ON) as a client-side option in SETTINGS/GAME. EAX Sound Improvements =================================== EAX environmental sound reverbs have been included for underwater and interiors. Those sounds will only be heard when using EAX or EAX2 drivers. (We recommend EAX for best results.) IFeel Force Feedback Mouse =================================== The IFeel force feedback mouse vibrations should now work correctly again. They have also been enhanced beyond what was previously available. Vehicles Parking on Flags =================================== "Anti-Parking" code has been added to flags similar to the "anti-camping" code around a Nexus in Hunters. This results in vehicles taking damage over time when they are parked near a flag, eventually resulting in their destruction if left there too long. Aiming Up and Down =================================== The restrictions on aiming up and down have been virtually removed for all armors. NOTE: This will result in situations where your weapon can clip through the leg of your armor when looking straight down. If this bothers you, then change your graphics setting to "Items Only" so that your body is not drawn when in first-person perspective. Jetpower for Suits =================================== Scout jetpower (power of thrust) was reduced to previous levels, but their maximum speed velocity was increased somewhat. This removes the "butterfly" effect, but allows slightly faster skiing than previously allowed. Additionally, air resistance was reduced by 33% on all armors to further reduce the "floaty" feel. This also allows slightly faster speeds across the board. Splash Damage =================================== Splash damage on shots was reduced slightly. It is still much more powerful than when the game was released, but this change makes mortars and grenades more playable. Shrike Speed =================================== The Shrike thrust was returned to normal, making the Shrike very responsive again. A new maximum speed cap has been added to prevent it from going too fast, but the performance improvement on this vehicle is significant. Mine Damage =================================== Mine damage was reduced slightly to prevent Lights from being one-shotted by stepping on a mine. They will still be severely harmed, but won't go from 100% health to dead in one shot. Missile Launcher =================================== The Missile Launcher range had been inadvertently reduced during the reticule improvements a few patches back. It has now been increased back to its original design. Range is now 400m. Heat Signature Fall Off =================================== Heat reduces *very slightly* slower than it did previously. Players can still easily manage their heat signatures, but must be a bit more paranoid of missile launchers now (thus making it a bit easier for high-ping players to use this weapon). Suit Mortars vs. Tanks =================================== The strength of hand-held mortars versus Tanks was incorrectly weak. It has now been increased so that it is much more useful. Shrike Gun Changes =================================== The Shrike blasters have been moved out to the wing joints to allow easier strafing of objects. Additionally, there is some (very minor...one degree of spread) projectile spread on the blasters now to make strafing easier. (For comparison purposes, the chaingun has eight degrees of spread.)The range of the blasters was incorrectly enormous and has been reduced to a balanced distance (slightly outside the range of hand-held missile launchers). Water Movement =================================== Speeds in water have been greatly increased so as to make water a more viable playing environment. Whiteout Grenades =================================== A maximum saturation has been defined for the Whiteout grenades to keep your "whiteout" time to no more than two seconds. OOB Grid =================================== The mission boundary is now visually defined. As you approach a mission boundary, and "out of bounds grid" will fade into existence. If you go past the boundary, the grid will not fade out until you return inside the mission area. This is done to make it easier to avoid getting a flag stripped or getting damaged due to OOB damage. This visual option can be toggled OFF in your Game Settings area (option button is called "Show Out of Bounds Grid"). Wildcat Grav Bike =================================== "Suspension" has been added to the Wildcat making it easier to control over rough terrain. Air Drag =================================== Air Drag has been reduced making the game feel "faster". Panther XL Support Added =================================== Players will now be able to satisfactorily map the roller ball of the Panther XL. The Z axis or throttle is not configurable with T2 because of a Panther XL driver issue. Flight Ceiling limited for Shrike =================================== If you fly past the flight ceiling then you will lose your jetting and thrusting ability. Angle your nose down (when you are above the flight ceiling) and thrust will function normally. "Unassigned" Team =================================== This bug allowed a person to join as "unassigned" and view all friend/foe triangles as grey. It has been fixed. <Null> and random string issues =================================== There is a finite number of network strings available, the single quote strings. This problem occurs when all strings have been allocated. This is particularly common with mod servers, which appear to be allocating too many net strings. Mod and script developers need to be cautious when creating new strings. Don't create dynamic net strings unless you have a firm understanding of the implications. If a string is added using "AddTaggedString" make sure that there is a corresponding "RemoveTaggedSting" call when the string is no longer needed. Also be sure to limit the number of imbedded strings in your scripts.
1389 lines
42 KiB
C#
1389 lines
42 KiB
C#
// deployable objects script
|
|
//
|
|
// remote pulse sensor, remote motion sensor, remote turrets (indoor
|
|
// and outdoor), remote inventory station, remote ammo station
|
|
// Note: cameras are treated as grenades, not "regular" deployables
|
|
|
|
$TurretIndoorSpaceRadius = 20; // deployed turrets must be this many meters apart
|
|
$InventorySpaceRadius = 20; // deployed inventory must be this many meters apart
|
|
$TurretIndoorSphereRadius = 50; // radius for turret frequency check
|
|
$TurretIndoorMaxPerSphere = 4; // # of turrets allowed in above radius
|
|
|
|
$TurretOutdoorSpaceRadius = 25; // deployed turrets must be this many meters apart
|
|
$TurretOutdoorSphereRadius = 60; // radius for turret frequency check
|
|
$TurretOutdoorMaxPerSphere = 4; // # of turrets allowed in above radius
|
|
|
|
$TeamDeployableMax[InventoryDeployable] = 5;
|
|
$TeamDeployableMax[TurretIndoorDeployable] = 10;
|
|
$TeamDeployableMax[TurretOutdoorDeployable] = 10;
|
|
$TeamDeployableMax[PulseSensorDeployable] = 15;
|
|
$TeamDeployableMax[MotionSensorDeployable] = 15;
|
|
|
|
$TeamDeployableMin[TurretIndoorDeployable] = 4;
|
|
$TeamDeployableMin[TurretOutdoorDeployable] = 4;
|
|
|
|
$NotDeployableReason::None = 0;
|
|
$NotDeployableReason::MaxDeployed = 1;
|
|
$NotDeployableReason::NoSurfaceFound = 2;
|
|
$NotDeployableReason::SlopeTooGreat = 3;
|
|
$NotDeployableReason::SelfTooClose = 4;
|
|
$NotDeployableReason::ObjectTooClose = 5;
|
|
$NotDeployableReason::NoTerrainFound = 6;
|
|
$NotDeployableReason::NoInteriorFound = 7;
|
|
$NotDeployableReason::TurretTooClose = 8;
|
|
$NotDeployableReason::TurretSaturation = 9;
|
|
$NotDeployableReason::SurfaceTooNarrow = 10;
|
|
$NotDeployableReason::InventoryTooClose = 11;
|
|
|
|
$MinDeployableDistance = 2.5;
|
|
$MaxDeployableDistance = 5.0; //meters from body
|
|
|
|
// --------------------------------------------
|
|
// effect datablocks
|
|
// --------------------------------------------
|
|
|
|
datablock EffectProfile(TurretDeployEffect)
|
|
{
|
|
effectname = "packs/generic_deploy";
|
|
minDistance = 2.5;
|
|
maxDistance = 5.0;
|
|
};
|
|
|
|
datablock EffectProfile(SensorDeployEffect)
|
|
{
|
|
effectname = "powered/sensor_activate";
|
|
minDistance = 2.5;
|
|
maxDistance = 5.0;
|
|
};
|
|
|
|
datablock EffectProfile(MotionSensorDeployEffect)
|
|
{
|
|
effectname = "powered/motion_sensor_activate";
|
|
minDistance = 2.5;
|
|
maxDistance = 5.0;
|
|
};
|
|
|
|
datablock EffectProfile(StationDeployEffect)
|
|
{
|
|
effectname = "packs/inventory_deploy";
|
|
minDistance = 2.5;
|
|
maxDistance = 5.0;
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// sound datablocks
|
|
// --------------------------------------------
|
|
|
|
datablock AudioProfile(TurretDeploySound)
|
|
{
|
|
fileName = "fx/packs/turret_place.wav";
|
|
description = AudioClose3d;
|
|
preload = true;
|
|
effect = TurretDeployEffect;
|
|
};
|
|
|
|
datablock AudioProfile(SensorDeploySound)
|
|
{
|
|
fileName = "fx/powered/sensor_activate.wav";
|
|
description = AudioClose3d;
|
|
preload = true;
|
|
effect = SensorDeployEffect;
|
|
effect = MotionSensorDeployEffect;
|
|
};
|
|
|
|
datablock AudioProfile(MotionSensorDeploySound)
|
|
{
|
|
fileName = "fx/powered/motion_sensor_activate.wav";
|
|
description = AudioClose3d;
|
|
preload = true;
|
|
};
|
|
|
|
datablock AudioProfile(StationDeploySound)
|
|
{
|
|
fileName = "fx/packs/inventory_deploy.wav";
|
|
description = AudioClose3d;
|
|
preload = true;
|
|
effect = StationDeployEffect;
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// deployable debris definition
|
|
|
|
datablock DebrisData( DeployableDebris )
|
|
{
|
|
explodeOnMaxBounce = false;
|
|
|
|
elasticity = 0.40;
|
|
friction = 0.5;
|
|
|
|
lifetime = 17.0;
|
|
lifetimeVariance = 0.0;
|
|
|
|
minSpinSpeed = 60;
|
|
maxSpinSpeed = 600;
|
|
|
|
numBounces = 10;
|
|
bounceVariance = 0;
|
|
|
|
staticOnMaxBounce = true;
|
|
|
|
useRadiusMass = true;
|
|
baseRadius = 0.2;
|
|
|
|
velocity = 5.0;
|
|
velocityVariance = 2.5;
|
|
|
|
};
|
|
|
|
|
|
// --------------------------------------------
|
|
// deployable inventory station
|
|
|
|
datablock StaticShapeData(DeployedStationInventory) : StaticShapeDamageProfile
|
|
{
|
|
className = Station;
|
|
shapeFile = "deploy_inventory.dts";
|
|
maxDamage = 0.70;
|
|
destroyedLevel = 0.70;
|
|
disabledLevel = 0.42;
|
|
explosion = DeployablesExplosion;
|
|
expDmgRadius = 8.0;
|
|
expDamage = 0.35;
|
|
expImpulse = 500.0;
|
|
|
|
dynamicType = $TypeMasks::StationObjectType;
|
|
isShielded = true;
|
|
energyPerDamagePoint = 110;
|
|
maxEnergy = 50;
|
|
rechargeRate = 0.20;
|
|
renderWhenDestroyed = false;
|
|
doesRepair = true;
|
|
|
|
deployedObject = true;
|
|
|
|
cmdCategory = "DSupport";
|
|
cmdIcon = CMDStationIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
|
|
targetNameTag = 'Deployable';
|
|
targetTypeTag = 'Station';
|
|
|
|
debrisShapeName = "debris_generic_small.dts";
|
|
debris = DeployableDebris;
|
|
heatSignature = 0;
|
|
};
|
|
|
|
datablock ShapeBaseImageData(InventoryDeployableImage)
|
|
{
|
|
mass = 15;
|
|
emap = true;
|
|
|
|
shapeFile = "pack_deploy_inventory.dts";
|
|
item = InventoryDeployable;
|
|
mountPoint = 1;
|
|
offset = "0 0 0";
|
|
deployed = DeployedStationInventory;
|
|
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(InventoryDeployable)
|
|
{
|
|
className = Pack;
|
|
catagory = "Deployables";
|
|
shapeFile = "pack_deploy_inventory.dts";
|
|
mass = 3.0;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 1;
|
|
rotate = false;
|
|
image = "InventoryDeployableImage";
|
|
pickUpName = "an inventory pack";
|
|
heatSignature = 0;
|
|
|
|
computeCRC = true;
|
|
emap = true;
|
|
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// deployable motion sensor
|
|
|
|
datablock SensorData(DeployMotionSensorObj)
|
|
{
|
|
detects = true;
|
|
detectsUsingLOS = true;
|
|
detectsActiveJammed = false;
|
|
detectsPassiveJammed = true;
|
|
detectsCloaked = true;
|
|
detectionPings = false;
|
|
detectMinVelocity = 2;
|
|
detectRadius = 60;
|
|
};
|
|
|
|
datablock StaticShapeData(DeployedMotionSensor) : StaticShapeDamageProfile
|
|
{
|
|
className = Sensor;
|
|
shapeFile = "deploy_sensor_motion.dts";
|
|
maxDamage = 0.6;
|
|
destroyedLevel = 0.6;
|
|
disabledLevel = 0.4;
|
|
explosion = DeployablesExplosion;
|
|
dynamicType = $TypeMasks::SensorObjectType;
|
|
|
|
deployedObject = true;
|
|
|
|
cmdCategory = "DSupport";
|
|
cmdIcon = CMDSensorIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
|
targetNameTag = 'Deployable Motion';
|
|
targetTypeTag = 'Sensor';
|
|
sensorData = DeployMotionSensorObj;
|
|
sensorRadius = DeployMotionSensorObj.detectRadius;
|
|
sensorColor = "9 136 255";
|
|
deployAmbientThread = true;
|
|
|
|
debrisShapeName = "debris_generic_small.dts";
|
|
debris = DeployableDebris;
|
|
heatSignature = 0;
|
|
};
|
|
|
|
datablock ShapeBaseImageData(MotionSensorDeployableImage)
|
|
{
|
|
shapeFile = "pack_deploy_sensor_motion.dts";
|
|
item = MotionSensorDeployable;
|
|
mountPoint = 1;
|
|
offset = "0 0 0";
|
|
deployed = DeployedMotionSensor;
|
|
|
|
stateName[0] = "Idle";
|
|
stateTransitionOnTriggerDown[0] = "Activate";
|
|
|
|
stateName[1] = "Activate";
|
|
stateScript[1] = "onActivate";
|
|
stateTransitionOnTriggerUp[1] = "Idle";
|
|
|
|
maxDepSlope = 360;
|
|
deploySound = MotionSensorDeploySound;
|
|
emap = true;
|
|
heatSignature = 1;
|
|
|
|
minDeployDis = 0.5;
|
|
maxDeployDis = 5.0; //meters from body
|
|
};
|
|
|
|
datablock ItemData(MotionSensorDeployable)
|
|
{
|
|
className = Pack;
|
|
catagory = "Deployables";
|
|
shapeFile = "pack_deploy_sensor_motion.dts";
|
|
mass = 2.0;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 1;
|
|
rotate = false;
|
|
image = "MotionSensorDeployableImage";
|
|
pickUpName = "a motion sensor pack";
|
|
|
|
computeCRC = true;
|
|
emap = true;
|
|
heatSignature = 0;
|
|
|
|
//maxSensors = 3;
|
|
maxSensors = 2;
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// deployable pulse sensor
|
|
|
|
datablock SensorData(DeployPulseSensorObj)
|
|
{
|
|
detects = true;
|
|
detectsUsingLOS = true;
|
|
detectsPassiveJammed = false;
|
|
detectsCloaked = false;
|
|
detectionPings = true;
|
|
detectRadius = 150;
|
|
};
|
|
|
|
datablock StaticShapeData(DeployedPulseSensor) : StaticShapeDamageProfile
|
|
{
|
|
className = Sensor;
|
|
shapeFile = "deploy_sensor_pulse.dts";
|
|
maxDamage = 0.6;
|
|
destroyedLevel = 0.6;
|
|
disabledLevel = 0.4;
|
|
explosion = DeployablesExplosion;
|
|
dynamicType = $TypeMasks::SensorObjectType;
|
|
|
|
deployedObject = true;
|
|
|
|
cmdCategory = "DSupport";
|
|
cmdIcon = CMDSensorIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_deploypulsesensor";
|
|
targetNameTag = 'Deployable';
|
|
targetTypeTag = 'Pulse Sensor';
|
|
sensorData = DeployPulseSensorObj;
|
|
sensorRadius = DeployPulseSensorObj.detectRadius;
|
|
sensorColor = "255 194 9";
|
|
deployAmbientThread = true;
|
|
|
|
debrisShapeName = "debris_generic_small.dts";
|
|
debris = DeployableDebris;
|
|
heatSignature = 0;
|
|
};
|
|
|
|
datablock ShapeBaseImageData(PulseSensorDeployableImage)
|
|
{
|
|
shapeFile = "pack_deploy_sensor_pulse.dts";
|
|
item = PulseSensorDeployable;
|
|
mountPoint = 1;
|
|
offset = "0 0 0";
|
|
deployed = DeployedPulseSensor;
|
|
|
|
stateName[0] = "Idle";
|
|
stateTransitionOnTriggerDown[0] = "Activate";
|
|
|
|
stateName[1] = "Activate";
|
|
stateScript[1] = "onActivate";
|
|
stateTransitionOnTriggerUp[1] = "Idle";
|
|
deploySound = SensorDeploySound;
|
|
|
|
maxDepSlope = 40;
|
|
emap = true;
|
|
heatSignature = 0;
|
|
|
|
minDeployDis = 0.5;
|
|
maxDeployDis = 5.0; //meters from body
|
|
};
|
|
|
|
datablock ItemData(PulseSensorDeployable)
|
|
{
|
|
className = Pack;
|
|
catagory = "Deployables";
|
|
shapeFile = "pack_deploy_sensor_pulse.dts";
|
|
mass = 2.0;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 1;
|
|
rotate = false;
|
|
image = "PulseSensorDeployableImage";
|
|
pickUpName = "a pulse sensor pack";
|
|
|
|
computeCRC = true;
|
|
emap = true;
|
|
|
|
maxSensors = 2;
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// deployable outdoor turret
|
|
|
|
datablock ShapeBaseImageData(TurretOutdoorDeployableImage)
|
|
{
|
|
mass = 15;
|
|
|
|
shapeFile = "pack_deploy_turreto.dts";
|
|
item = TurretOutdoorDeployable;
|
|
mountPoint = 1;
|
|
offset = "0 0 0";
|
|
deployed = TurretDeployedOutdoor;
|
|
|
|
stateName[0] = "Idle";
|
|
stateTransitionOnTriggerDown[0] = "Activate";
|
|
|
|
stateName[1] = "Activate";
|
|
stateScript[1] = "onActivate";
|
|
stateTransitionOnTriggerUp[1] = "Idle";
|
|
|
|
maxDamage = 4.5;
|
|
destroyedLevel = 4.5;
|
|
disabledLevel = 4.0;
|
|
|
|
isLarge = true;
|
|
emap = true;
|
|
|
|
maxDepSlope = 40;
|
|
deploySound = TurretDeploySound;
|
|
|
|
minDeployDis = 0.5;
|
|
maxDeployDis = 5.0; //meters from body
|
|
};
|
|
|
|
datablock ItemData(TurretOutdoorDeployable)
|
|
{
|
|
className = Pack;
|
|
catagory = "Deployables";
|
|
shapeFile = "pack_deploy_turreto.dts";
|
|
mass = 3.0;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 1;
|
|
rotate = false;
|
|
image = "TurretOutdoorDeployableImage";
|
|
pickUpName = "a landspike turret pack";
|
|
|
|
computeCRC = true;
|
|
emap = true;
|
|
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// deployable indoor turret (3 varieties -- floor, wall and ceiling)
|
|
|
|
datablock ShapeBaseImageData(TurretIndoorDeployableImage)
|
|
{
|
|
mass = 15;
|
|
|
|
shapeFile = "pack_deploy_turreti.dts";
|
|
item = TurretIndoorDeployable;
|
|
mountPoint = 1;
|
|
offset = "0 0 0";
|
|
|
|
stateName[0] = "Idle";
|
|
stateTransitionOnTriggerDown[0] = "Activate";
|
|
|
|
stateName[1] = "Activate";
|
|
stateScript[1] = "onActivate";
|
|
stateTransitionOnTriggerUp[1] = "Idle";
|
|
|
|
isLarge = true;
|
|
emap = true;
|
|
|
|
maxDepSlope = 360;
|
|
deploySound = TurretDeploySound;
|
|
|
|
minDeployDis = 0.5;
|
|
maxDeployDis = 5.0; //meters from body
|
|
};
|
|
|
|
datablock ItemData(TurretIndoorDeployable)
|
|
{
|
|
className = Pack;
|
|
catagory = "Deployables";
|
|
shapeFile = "pack_deploy_turreti.dts";
|
|
mass = 3.0;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 1;
|
|
rotate = false;
|
|
image = "TurretIndoorDeployableImage";
|
|
pickUpName = "a spider clamp turret pack";
|
|
|
|
computeCRC = true;
|
|
emap = true;
|
|
|
|
};
|
|
|
|
// --------------------------------------------
|
|
// miscellaneous yet handy functions
|
|
|
|
function posFromTransform(%transform)
|
|
{
|
|
// the first three words of an object's transform are the object's position
|
|
%position = getWord(%transform, 0) @ " " @ getWord(%transform, 1) @ " " @ getWord(%transform, 2);
|
|
return %position;
|
|
}
|
|
|
|
function rotFromTransform(%transform)
|
|
{
|
|
// the last four words of an object's transform are the object's rotation
|
|
%rotation = getWord(%transform, 3) @ " " @ getWord(%transform, 4) @ " " @ getWord(%transform, 5) @ " " @ getWord(%transform, 6);
|
|
return %rotation;
|
|
}
|
|
|
|
function posFromRaycast(%transform)
|
|
{
|
|
// the 2nd, 3rd, and 4th words returned from a successful raycast call are the position of the point
|
|
%position = getWord(%transform, 1) @ " " @ getWord(%transform, 2) @ " " @ getWord(%transform, 3);
|
|
return %position;
|
|
}
|
|
|
|
function normalFromRaycast(%transform)
|
|
{
|
|
// the 5th, 6th and 7th words returned from a successful raycast call are the normal of the surface
|
|
%norm = getWord(%transform, 4) @ " " @ getWord(%transform, 5) @ " " @ getWord(%transform, 6);
|
|
return %norm;
|
|
}
|
|
|
|
function addToDeployGroup(%object)
|
|
{
|
|
// all deployables should go into a special group for AI purposes
|
|
%depGroup = nameToID("MissionCleanup/Deployables");
|
|
if(%depGroup <= 0) {
|
|
%depGroup = new SimGroup("Deployables");
|
|
MissionCleanup.add(%depGroup);
|
|
}
|
|
%depGroup.add(%object);
|
|
}
|
|
|
|
function Deployables::searchView(%obj, %searchRange, %mask)
|
|
{
|
|
// get the eye vector and eye transform of the player
|
|
%eyeVec = %obj.getEyeVector();
|
|
%eyeTrans = %obj.getEyeTransform();
|
|
|
|
// extract the position of the player's camera from the eye transform (first 3 words)
|
|
%eyePos = posFromTransform(%eyeTrans);
|
|
|
|
// normalize the eye vector
|
|
%nEyeVec = VectorNormalize(%eyeVec);
|
|
|
|
// scale (lengthen) the normalized eye vector according to the search range
|
|
%scEyeVec = VectorScale(%nEyeVec, %searchRange);
|
|
|
|
// add the scaled & normalized eye vector to the position of the camera
|
|
%eyeEnd = VectorAdd(%eyePos, %scEyeVec);
|
|
|
|
// see if anything gets hit
|
|
%searchResult = containerRayCast(%eyePos, %eyeEnd, %mask, 0);
|
|
|
|
return %searchResult;
|
|
}
|
|
|
|
//-----------------------//
|
|
// Deployable Procedures //
|
|
//-----------------------//
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testMaxDeployed(%item, %plyr)
|
|
{
|
|
if(%item.item $= TurretOutdoorDeployable || %item.item $= TurretIndoorDeployable)
|
|
%itemCount = countTurretsAllowed(%item.item);
|
|
else
|
|
%itemCount = $TeamDeployableMax[%item.item];
|
|
|
|
return $TeamDeployedCount[%plyr.team, %item.item] >= %itemCount;
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testNoSurfaceInRange(%item, %plyr)
|
|
{
|
|
return ! Deployables::searchView(%plyr, $MaxDeployDistance, $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType);
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testSlopeTooGreat(%item)
|
|
{
|
|
if (%item.surface)
|
|
{
|
|
return getTerrainAngle(%item.surfaceNrm) > %item.maxDepSlope;
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testSelfTooClose(%item, %plyr)
|
|
{
|
|
InitContainerRadiusSearch(%item.surfacePt, $MinDeployDistance, $TypeMasks::PlayerObjectType);
|
|
|
|
return containerSearchNext() == %plyr;
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testObjectTooClose(%item)
|
|
{
|
|
%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 TurretOutdoorDeployableImage::testNoTerrainFound(%item)
|
|
{
|
|
return %item.surface.getClassName() !$= TerrainBlock;
|
|
}
|
|
|
|
function ShapeBaseImageData::testNoTerrainFound(%item, %surface)
|
|
{
|
|
//don't check this for non-Landspike turret deployables
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function TurretIndoorDeployableImage::testNoInteriorFound(%item)
|
|
{
|
|
return %item.surface.getClassName() !$= InteriorInstance;
|
|
}
|
|
|
|
function ShapeBaseImageData::testNoInteriorFound(%item, %surface)
|
|
{
|
|
//don't check this for non-Clasping turret deployables
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function TurretIndoorDeployableImage::testHavePurchase(%item, %xform)
|
|
{
|
|
%footprintRadius = 0.34;
|
|
%collMask = $TypeMasks::InteriorObjectType;
|
|
return %item.deployed.checkDeployPurchase(%xform, %footprintRadius, %collMask);
|
|
}
|
|
|
|
function ShapeBaseImageData::testHavePurchase(%item, %xform)
|
|
{
|
|
//don't check this for non-Clasping turret deployables
|
|
return true;
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function ShapeBaseImageData::testInventoryTooClose(%item, %plyr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
function InventoryDeployableImage::testInventoryTooClose(%item, %plyr)
|
|
{
|
|
InitContainerRadiusSearch(%item.surfacePt, $InventorySpaceRadius, $TypeMasks::StaticShapeObjectType);
|
|
|
|
// old function was only checking whether the first object found was a turret -- also wasn't checking
|
|
// which team the object was on
|
|
%turretInRange = false;
|
|
while((%found = containerSearchNext()) != 0)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if( (%foundName $= DeployedStationInventory) )
|
|
if (%found.team == %plyr.team)
|
|
{
|
|
%turretInRange = true;
|
|
break;
|
|
}
|
|
}
|
|
return %turretInRange;
|
|
}
|
|
|
|
function TurretIndoorDeployableImage::testTurretTooClose(%item, %plyr)
|
|
{
|
|
InitContainerRadiusSearch(%item.surfacePt, $TurretIndoorSpaceRadius, $TypeMasks::StaticShapeObjectType);
|
|
|
|
// old function was only checking whether the first object found was a turret -- also wasn't checking
|
|
// which team the object was on
|
|
%turretInRange = false;
|
|
while((%found = containerSearchNext()) != 0)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if((%foundname $= TurretDeployedFloorIndoor) || (%foundName $= TurretDeployedWallIndoor) || (%foundName $= TurretDeployedCeilingIndoor) || (%foundName $= TurretDeployedOutdoor) )
|
|
if (%found.team == %plyr.team)
|
|
{
|
|
%turretInRange = true;
|
|
break;
|
|
}
|
|
}
|
|
return %turretInRange;
|
|
}
|
|
|
|
function TurretOutdoorDeployableImage::testTurretTooClose(%item, %plyr)
|
|
{
|
|
InitContainerRadiusSearch(%item.surfacePt, $TurretOutdoorSpaceRadius, $TypeMasks::StaticShapeObjectType);
|
|
|
|
// old function was only checking whether the first object found was a turret -- also wasn't checking
|
|
// which team the object was on
|
|
%turretInRange = false;
|
|
while((%found = containerSearchNext()) != 0)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if((%foundname $= TurretDeployedFloorIndoor) || (%foundName $= TurretDeployedWallIndoor) || (%foundName $= TurretDeployedCeilingIndoor) || (%foundName $= TurretDeployedOutdoor) )
|
|
if (%found.team == %plyr.team)
|
|
{
|
|
%turretInRange = true;
|
|
break;
|
|
}
|
|
}
|
|
return %turretInRange;
|
|
}
|
|
|
|
function ShapeBaseImageData::testTurretTooClose(%item, %plyr)
|
|
{
|
|
//don't check this for non-turret deployables
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
function TurretIndoorDeployableImage::testTurretSaturation(%item)
|
|
{
|
|
%highestDensity = 0;
|
|
InitContainerRadiusSearch(%item.surfacePt, $TurretIndoorSphereRadius, $TypeMasks::StaticShapeObjectType);
|
|
%found = containerSearchNext();
|
|
while(%found)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if((%foundname $= TurretDeployedFloorIndoor) || (%foundName $= TurretDeployedWallIndoor) || (%foundName $= TurretDeployedCeilingIndoor) || (%foundName $= TurretDeployedOutdoor) )
|
|
{
|
|
//found one
|
|
%numTurretsNearby++;
|
|
|
|
%nearbyDensity = testNearbyDensity(%found, $TurretIndoorSphereRadius);
|
|
if (%nearbyDensity > %highestDensity)
|
|
%highestDensity = %nearbyDensity;
|
|
}
|
|
%found = containerSearchNext();
|
|
}
|
|
|
|
if (%numTurretsNearby > %highestDensity)
|
|
%highestDensity = %numTurretsNearby;
|
|
return %highestDensity > $TurretIndoorMaxPerSphere;
|
|
}
|
|
|
|
function TurretOutdoorDeployableImage::testTurretSaturation(%item)
|
|
{
|
|
%highestDensity = 0;
|
|
InitContainerRadiusSearch(%item.surfacePt, $TurretOutdoorSphereRadius, $TypeMasks::StaticShapeObjectType);
|
|
%found = containerSearchNext();
|
|
while(%found)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if((%foundname $= TurretDeployedFloorIndoor) || (%foundName $= TurretDeployedWallIndoor) || (%foundName $= TurretDeployedCeilingIndoor) || (%foundName $= TurretDeployedOutdoor) )
|
|
{
|
|
//found one
|
|
%numTurretsNearby++;
|
|
|
|
%nearbyDensity = testNearbyDensity(%found, $TurretOutdoorSphereRadius);
|
|
if (%nearbyDensity > %highestDensity)
|
|
%highestDensity = %nearbyDensity;
|
|
}
|
|
%found = containerSearchNext();
|
|
}
|
|
|
|
if (%numTurretsNearby > %highestDensity)
|
|
%highestDensity = %numTurretsNearby;
|
|
return %highestDensity > $TurretOutdoorMaxPerSphere;
|
|
}
|
|
|
|
function ShapeBaseImageData::testTurretSaturation(%item, %surfacePt)
|
|
{
|
|
//don't check this for non-turret deployables
|
|
}
|
|
|
|
function testNearbyDensity(%item, %radius)
|
|
{
|
|
//this checks how many turrets are in adjacent spheres in case placing a new one overloads them.
|
|
%surfacePt = posFromTransform(%item.getTransform());
|
|
%turretCount = 0;
|
|
|
|
InitContainerRadiusSearch(%surfacePt, %radius, $TypeMasks::StaticShapeObjectType);
|
|
%found = containerSearchNext();
|
|
while(%found)
|
|
{
|
|
%foundName = %found.getDataBlock().getName();
|
|
if((%foundname $= TurretDeployedFloorIndoor) || (%foundName $= TurretDeployedWallIndoor) || (%foundName $= TurretDeployedCeilingIndoor) || (%foundName $= TurretDeployedOutdoor) )
|
|
%turretCount++;
|
|
%found = containerSearchNext();
|
|
}
|
|
return %turretCount;
|
|
}
|
|
|
|
//-------------------------------------------------
|
|
//if this function, or any of the included tests are changed, those changes need to be reflected in function:
|
|
//AIODeployEquipment::weight(%this, %client, %level), found in aiObjectives.cs --tinman
|
|
function ShapeBaseImageData::testInvalidDeployConditions(%item, %plyr, %slot)
|
|
{
|
|
cancel(%plyr.deployCheckThread);
|
|
%disqualified = $NotDeployableReason::None; //default
|
|
$MaxDeployDistance = %item.maxDeployDis;
|
|
$MinDeployDistance = %item.minDeployDis;
|
|
|
|
%surface = Deployables::searchView(%plyr,
|
|
$MaxDeployDistance,
|
|
($TypeMasks::TerrainObjectType |
|
|
$TypeMasks::InteriorObjectType));
|
|
if (%surface)
|
|
{
|
|
%surfacePt = posFromRaycast(%surface);
|
|
%surfaceNrm = normalFromRaycast(%surface);
|
|
|
|
// Check that point to see if anything is objstructing it...
|
|
%eyeTrans = %plyr.getEyeTransform();
|
|
%eyePos = posFromTransform(%eyeTrans);
|
|
|
|
%searchResult = containerRayCast(%eyePos, %surfacePt, -1, %plyr);
|
|
if (!%searchResult)
|
|
{
|
|
%item.surface = %surface;
|
|
%item.surfacePt = %surfacePt;
|
|
%item.surfaceNrm = %surfaceNrm;
|
|
}
|
|
else
|
|
{
|
|
if(checkPositions(%surfacePT, posFromRaycast(%searchResult)))
|
|
{
|
|
%item.surface = %surface;
|
|
%item.surfacePt = %surfacePt;
|
|
%item.surfaceNrm = %surfaceNrm;
|
|
}
|
|
else
|
|
{
|
|
// Don't set the item
|
|
%disqualified = $NotDeployableReason::ObjectTooClose;
|
|
}
|
|
}
|
|
if(!getTerrainAngle(%surfaceNrm) && %item.flatMaxDeployDis !$= "")
|
|
{
|
|
$MaxDeployDistance = %item.flatMaxDeployDis;
|
|
$MinDeployDistance = %item.flatMinDeployDis;
|
|
}
|
|
}
|
|
|
|
if (%item.testMaxDeployed(%plyr))
|
|
{
|
|
%disqualified = $NotDeployableReason::MaxDeployed;
|
|
}
|
|
else if (%item.testNoSurfaceInRange(%plyr))
|
|
{
|
|
%disqualified = $NotDeployableReason::NoSurfaceFound;
|
|
}
|
|
else if (%item.testNoTerrainFound(%surface))
|
|
{
|
|
%disqualified = $NotDeployableReason::NoTerrainFound;
|
|
}
|
|
else if (%item.testNoInteriorFound())
|
|
{
|
|
%disqualified = $NotDeployableReason::NoInteriorFound;
|
|
}
|
|
else if (%item.testSlopeTooGreat(%surface, %surfaceNrm))
|
|
{
|
|
%disqualified = $NotDeployableReason::SlopeTooGreat;
|
|
}
|
|
else if (%item.testSelfTooClose(%plyr, %surfacePt))
|
|
{
|
|
%disqualified = $NotDeployableReason::SelfTooClose;
|
|
}
|
|
else if (%item.testObjectTooClose(%surfacePt))
|
|
{
|
|
%disqualified = $NotDeployableReason::ObjectTooClose;
|
|
}
|
|
else if (%item.testTurretTooClose(%plyr))
|
|
{
|
|
%disqualified = $NotDeployableReason::TurretTooClose;
|
|
}
|
|
else if (%item.testInventoryTooClose(%plyr))
|
|
{
|
|
%disqualified = $NotDeployableReason::InventoryTooClose;
|
|
}
|
|
else if (%item.testTurretSaturation())
|
|
{
|
|
%disqualified = $NotDeployableReason::TurretSaturation;
|
|
}
|
|
else if (%disqualified == $NotDeployableReason::None)
|
|
{
|
|
// Test that there are no objstructing objects that this object
|
|
// will intersect with
|
|
//
|
|
%rot = %item.getInitialRotation(%plyr);
|
|
if(%item.deployed.className $= "DeployedTurret")
|
|
{
|
|
%xform = %item.deployed.getDeployTransform(%item.surfacePt, %item.surfaceNrm);
|
|
}
|
|
else
|
|
{
|
|
%xform = %surfacePt SPC %rot;
|
|
}
|
|
|
|
if (!%item.deployed.checkDeployPos(%xform))
|
|
{
|
|
%disqualified = $NotDeployableReason::ObjectTooClose;
|
|
}
|
|
else if (!%item.testHavePurchase(%xform))
|
|
{
|
|
%disqualified = $NotDeployableReason::SurfaceTooNarrow;
|
|
}
|
|
}
|
|
|
|
if (%plyr.getMountedImage($BackpackSlot) == %item) //player still have the item?
|
|
{
|
|
if (%disqualified)
|
|
activateDeploySensorRed(%plyr);
|
|
else
|
|
activateDeploySensorGrn(%plyr);
|
|
|
|
if (%plyr.client.deployPack == true)
|
|
%item.attemptDeploy(%plyr, %slot, %disqualified);
|
|
else
|
|
{
|
|
%plyr.deployCheckThread = %item.schedule(25, "testInvalidDeployConditions", %plyr, %slot); //update checks every 50 milliseconds
|
|
}
|
|
}
|
|
else
|
|
deactivateDeploySensor(%plyr);
|
|
}
|
|
|
|
function checkPositions(%pos1, %pos2)
|
|
{
|
|
%passed = true;
|
|
if((mFloor(getWord(%pos1, 0)) - mFloor(getWord(%pos2,0))))
|
|
%passed = false;
|
|
if((mFloor(getWord(%pos1, 1)) - mFloor(getWord(%pos2,1))))
|
|
%passed = false;
|
|
if((mFloor(getWord(%pos1, 2)) - mFloor(getWord(%pos2,2))))
|
|
%passed = false;
|
|
return %passed;
|
|
}
|
|
|
|
function ShapeBaseImageData::attemptDeploy(%item, %plyr, %slot, %disqualified)
|
|
{
|
|
deactivateDeploySensor(%plyr);
|
|
Deployables::displayErrorMsg(%item, %plyr, %slot, %disqualified);
|
|
}
|
|
|
|
function activateDeploySensorRed(%pl)
|
|
{
|
|
if(%pl.deploySensor !$= "red")
|
|
{
|
|
messageClient(%pl.client, 'msgDeploySensorRed', "");
|
|
%pl.deploySensor = "red";
|
|
}
|
|
}
|
|
|
|
function activateDeploySensorGrn(%pl)
|
|
{
|
|
if(%pl.deploySensor !$= "green")
|
|
{
|
|
messageClient(%pl.client, 'msgDeploySensorGrn', "");
|
|
%pl.deploySensor = "green";
|
|
}
|
|
}
|
|
|
|
function deactivateDeploySensor(%pl)
|
|
{
|
|
if (%pl.deploySensor !$= "")
|
|
{
|
|
messageClient(%pl.client, 'msgDeploySensorOff', "");
|
|
%pl.deploySensor = "";
|
|
}
|
|
}
|
|
|
|
function Deployables::displayErrorMsg(%item, %plyr, %slot, %error)
|
|
{
|
|
deactivateDeploySensor(%plyr);
|
|
|
|
%errorSnd = '~wfx/misc/misc.error.wav';
|
|
switch (%error)
|
|
{
|
|
case $NotDeployableReason::None:
|
|
%item.onDeploy(%plyr, %slot);
|
|
messageClient(%plyr.client, 'MsgTeamDeploySuccess', "");
|
|
return;
|
|
|
|
case $NotDeployableReason::NoSurfaceFound:
|
|
%msg = '\c2Item must be placed within reach.%1';
|
|
|
|
case $NotDeployableReason::MaxDeployed:
|
|
%msg = '\c2Your team\'s control network has reached its capacity for this item.%1';
|
|
|
|
case $NotDeployableReason::SlopeTooGreat:
|
|
%msg = '\c2Surface is too steep to place this item on.%1';
|
|
|
|
case $NotDeployableReason::SelfTooClose:
|
|
%msg = '\c2You are too close to the surface you are trying to place the item on.%1';
|
|
|
|
case $NotDeployableReason::ObjectTooClose:
|
|
%msg = '\c2You cannot place this item so close to another object.%1';
|
|
|
|
case $NotDeployableReason::NoTerrainFound:
|
|
%msg = '\c2You must place this on outdoor terrain.%1';
|
|
|
|
case $NotDeployableReason::NoInteriorFound:
|
|
%msg = '\c2You must place this on a solid surface.%1';
|
|
|
|
case $NotDeployableReason::TurretTooClose:
|
|
%msg = '\c2Interference from a nearby turret prevents placement here.%1';
|
|
|
|
case $NotDeployableReason::TurretSaturation:
|
|
%msg = '\c2There are too many turrets nearby.%1';
|
|
|
|
case $NotDeployableReason::SurfaceTooNarrow:
|
|
%msg = '\c2There is not adequate surface to clamp to here.%1';
|
|
|
|
case $NotDeployableReason::InventoryTooClose:
|
|
%msg = '\c2Interference from a nearby inventory prevents placement here.%1';
|
|
|
|
default:
|
|
%msg = '\c2Deploy failed.';
|
|
}
|
|
messageClient(%plyr.client, 'MsgDeployFailed', %msg, %errorSnd);
|
|
}
|
|
|
|
function ShapeBaseImageData::onActivate(%data, %obj, %slot)
|
|
{
|
|
//Tinman - apparently, anything that uses the generic onActivate() method is a deployable.
|
|
//repair packs, cloak packs, shield, etc... all overload this method...
|
|
%data.testInvalidDeployConditions(%obj, %slot);
|
|
|
|
//whether the test passed or not, reset the image trigger (deployables don't have an on/off toggleable state)
|
|
%obj.setImageTrigger(%slot, false);
|
|
}
|
|
|
|
function ShapeBaseImageData::onDeploy(%item, %plyr, %slot)
|
|
{
|
|
if(%item.item $= "MotionSensorDeployable" || %item.item $= "PulseSensorDeployable")
|
|
{
|
|
%plyr.deploySensors--;
|
|
%plyr.client.updateSensorPackText(%plyr.deploySensors);
|
|
if(%plyr.deploySensors <= 0)
|
|
{
|
|
// take the deployable off the player's back and out of inventory
|
|
%plyr.unmountImage(%slot);
|
|
%plyr.decInventory(%item.item, 1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// take the deployable off the player's back and out of inventory
|
|
%plyr.unmountImage(%slot);
|
|
%plyr.decInventory(%item.item, 1);
|
|
}
|
|
|
|
// create the actual deployable
|
|
%rot = %item.getInitialRotation(%plyr);
|
|
if(%item.deployed.className $= "DeployedTurret")
|
|
%className = "Turret";
|
|
else
|
|
%className = "StaticShape";
|
|
|
|
%deplObj = new (%className)() {
|
|
dataBlock = %item.deployed;
|
|
};
|
|
|
|
|
|
// set orientation
|
|
if(%className $= "Turret")
|
|
%deplObj.setDeployRotation(%item.surfacePt, %item.surfaceNrm);
|
|
else
|
|
%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.owner = %plyr.client;
|
|
|
|
// 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();
|
|
return %deplObj;
|
|
}
|
|
|
|
function ShapeBaseImageData::getInitialRotation(%item, %plyr)
|
|
{
|
|
return rotFromTransform(%plyr.getTransform());
|
|
}
|
|
|
|
function MotionSensorDeployableImage::getInitialRotation(%item, %plyr)
|
|
{
|
|
%rotAxis = vectorNormalize(vectorCross(%item.surfaceNrm, "0 0 1"));
|
|
if (getWord(%item.surfaceNrm, 2) == 1 || getWord(%item.surfaceNrm, 2) == -1)
|
|
%rotAxis = vectorNormalize(vectorCross(%item.surfaceNrm, "0 1 0"));
|
|
return %rotAxis SPC mACos(vectorDot(%item.surfaceNrm, "0 0 1"));
|
|
}
|
|
|
|
function MotionSensorDeployable::onPickup(%this, %pack, %player, %amount)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %pack = Sensor pack object number
|
|
// %player = player
|
|
// %amount = amount picked up (1)
|
|
|
|
if(%pack.sensors $= "")
|
|
{
|
|
// assume that this is a pack that has been placed in a mission
|
|
// this case was handled in ::onInventory below (max sensors);
|
|
}
|
|
else
|
|
{
|
|
// find out how many sensor were in the pack
|
|
%player.deploySensors = %pack.sensors;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
}
|
|
|
|
function MotionSensorDeployable::onThrow(%this,%pack,%player)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %pack = Sensor pack object number
|
|
// %player = player
|
|
|
|
%player.throwSensorPack = 1;
|
|
%pack.sensors = %player.deploySensors;
|
|
%player.deploySensors = 0;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
|
|
serverPlay3D(ItemThrowSound, %player.getTransform());
|
|
%pack.schedulePop();
|
|
}
|
|
|
|
function MotionSensorDeployable::onInventory(%this,%player,%value)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %player = player
|
|
// %value = 1 if gaining a pack, 0 if losing a pack
|
|
|
|
if(%player.getClassName() $= "Player")
|
|
{
|
|
if(%value)
|
|
{
|
|
// player picked up or bought a motion sensor pack
|
|
%player.deploySensors = %this.maxSensors;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
else
|
|
{
|
|
// player dropped or sold a motion sensor pack
|
|
if(%player.throwSensorPack)
|
|
{
|
|
// player threw the pack
|
|
%player.throwSensorPack = 0;
|
|
// everything handled in ::onThrow above
|
|
}
|
|
else
|
|
{
|
|
//the pack was sold at an inventory station, or unmounted because the player
|
|
// used all the sensors
|
|
%player.deploySensors = 0;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
}
|
|
}
|
|
Pack::onInventory(%this,%player,%value);
|
|
}
|
|
|
|
function PulseSensorDeployable::onPickup(%this, %pack, %player, %amount)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %pack = Sensor pack object number
|
|
// %player = player
|
|
// %amount = amount picked up (1)
|
|
|
|
if(%pack.sensors $= "")
|
|
{
|
|
// assume that this is a pack that has been placed in a mission
|
|
// this case was handled in ::onInventory below (max sensors);
|
|
}
|
|
else
|
|
{
|
|
// find out how many sensor were in the pack
|
|
%player.deploySensors = %pack.sensors;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
}
|
|
|
|
function PulseSensorDeployable::onThrow(%this,%pack,%player)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %pack = Sensor pack object number
|
|
// %player = player
|
|
|
|
%player.throwSensorPack = 1;
|
|
%pack.sensors = %player.deploySensors;
|
|
%player.deploySensors = 0;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
|
|
serverPlay3D(ItemThrowSound, %player.getTransform());
|
|
%pack.schedulePop();
|
|
}
|
|
|
|
function PulseSensorDeployable::onInventory(%this,%player,%value)
|
|
{
|
|
// %this = Sensor pack datablock
|
|
// %player = player
|
|
// %value = 1 if gaining a pack, 0 if losing a pack
|
|
|
|
if(%player.getClassName() $= "Player")
|
|
{
|
|
if(%value)
|
|
{
|
|
// player picked up or bought a motion sensor pack
|
|
%player.deploySensors = %this.maxSensors;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
else
|
|
{
|
|
// player dropped or sold a motion sensor pack
|
|
if(%player.throwSensorPack)
|
|
{
|
|
// player threw the pack
|
|
%player.throwSensorPack = 0;
|
|
// everything handled in ::onThrow above
|
|
}
|
|
else
|
|
{
|
|
//the pack was sold at an inventory station, or unmounted because the player
|
|
// used all the sensors
|
|
%player.deploySensors = 0;
|
|
%player.client.updateSensorPackText(%player.deploySensors);
|
|
}
|
|
}
|
|
}
|
|
Pack::onInventory(%this,%player,%value);
|
|
}
|
|
|
|
function TurretIndoorDeployableImage::getInitialRotation(%item, %plyr)
|
|
{
|
|
%surfaceAngle = getTerrainAngle(%item.surfaceNrm);
|
|
if(%surfaceAngle > 155)
|
|
%item.deployed = TurretDeployedCeilingIndoor;
|
|
else if(%surfaceAngle > 45)
|
|
%item.deployed = TurretDeployedWallIndoor;
|
|
else
|
|
%item.deployed = TurretDeployedFloorIndoor;
|
|
}
|
|
|
|
function TurretIndoorDeployable::onPickup(%this, %obj, %shape, %amount)
|
|
{
|
|
// created to prevent console errors
|
|
}
|
|
|
|
function TurretOutdoorDeployable::onPickup(%this, %obj, %shape, %amount)
|
|
{
|
|
// created to prevent console errors
|
|
}
|
|
|
|
function InventoryDeployable::onPickup(%this, %obj, %shape, %amount)
|
|
{
|
|
// created to prevent console errors
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------
|
|
// deployed station functions
|
|
function DeployedStationInventory::onEndSequence(%data, %obj, %thread)
|
|
{
|
|
Parent::onEndSequence(%data, %obj, %thread);
|
|
if(%thread == $DeployThread)
|
|
{
|
|
%trigger = new Trigger()
|
|
{
|
|
dataBlock = stationTrigger;
|
|
polyhedron = "-0.125 0.0 0.1 0.25 0.0 0.0 0.0 -0.7 0.0 0.0 0.0 1.0";
|
|
};
|
|
MissionCleanup.add(%trigger);
|
|
|
|
%trans = %obj.getTransform();
|
|
%vSPos = getWords(%trans,0,2);
|
|
%vRot = getWords(%trans,3,5);
|
|
%vAngle = getWord(%trans,6);
|
|
%matrix = VectorOrthoBasis(%vRot @ " " @ %vAngle + 0.0);
|
|
%yRot = getWords(%matrix, 3, 5);
|
|
%pos = vectorAdd(%vSPos, vectorScale(%yRot, -0.1));
|
|
|
|
%trigger.setTransform(%pos @ " " @ %vRot @ " " @ %vAngle);
|
|
|
|
// associate the trigger with the station
|
|
%trigger.station = %obj;
|
|
%trigger.mainObj = %obj;
|
|
%trigger.disableObj = %obj;
|
|
%obj.trigger = %trigger;
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
//DeployedMotionSensor:
|
|
//--------------------------------------------------------------------------
|
|
|
|
function DeployedMotionSensor::onDestroyed(%this, %obj, %prevState)
|
|
{
|
|
//%obj.hide(true);
|
|
Parent::onDestroyed(%this, %obj, %prevState);
|
|
$TeamDeployedCount[%obj.team, MotionSensorDeployable]--;
|
|
%obj.schedule(500, "delete");
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|
|
//DeployedPulseSensor:
|
|
//--------------------------------------------------------------------------
|
|
function PulseSensorDeployableImage::onActivate(%data, %obj, %slot)
|
|
{
|
|
Parent::onActivate( %data, %obj, %slot );
|
|
//%data.testInvalidDeployConditions(%obj, %slot);
|
|
}
|
|
|
|
function DeployedPulseSensor::onDestroyed(%this, %obj, %prevState)
|
|
{
|
|
Parent::onDestroyed(%this, %obj, %prevState);
|
|
$TeamDeployedCount[%obj.team, PulseSensorDeployable]--;
|
|
%obj.schedule(300, "delete");
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------
|
|
// deployed turret functions
|
|
|
|
function DeployedTurret::onAdd(%data, %obj)
|
|
{
|
|
Parent::onAdd(%data, %obj);
|
|
// auto-mount the barrel
|
|
%obj.mountImage(%data.barrel, 0, false);
|
|
}
|
|
|
|
function DeployedTurret::onDestroyed(%this, %obj, %prevState)
|
|
{
|
|
Parent::onDestroyed(%this, %obj, %prevState);
|
|
%turType = %this.getName();
|
|
// either it'll be an outdoor turret, or one of the three types of indoor turret
|
|
// (floor, ceiling, wall)
|
|
if(%turType $= "TurretDeployedOutdoor")
|
|
%turType = "TurretOutdoorDeployable";
|
|
else
|
|
%turType = "TurretIndoorDeployable";
|
|
|
|
// decrement team count
|
|
$TeamDeployedCount[%obj.team, %turType]--;
|
|
|
|
%obj.schedule(700, "delete");
|
|
}
|
|
|
|
function countTurretsAllowed(%type)
|
|
{
|
|
for(%j = 1; %j < Game.numTeams; %j++)
|
|
%teamPlayerCount[%j] = 0;
|
|
%numClients = ClientGroup.getCount();
|
|
for(%i = 0; %i < %numClients; %i++)
|
|
{
|
|
%cl = ClientGroup.getObject(%i);
|
|
if(%cl.team > 0)
|
|
%teamPlayerCount[%cl.team]++;
|
|
}
|
|
// the bigger team determines the number of turrets allowed
|
|
%maxPlayers = %teamPlayerCount[1] > %teamPlayerCount[2] ? %teamPlayerCount[1] : %teamPlayerCount[2];
|
|
// each team can have 1 turret of each type (indoor/outdoor) for every 2 players
|
|
// minimum and maximums are defined in deployables.cs
|
|
%teamTurretMax = mFloor(%maxPlayers / 2);
|
|
if(%teamTurretMax < $TeamDeployableMin[%type])
|
|
%teamTurretMax = $TeamDeployableMin[%type];
|
|
else if(%teamTurretMax > $TeamDeployableMax[%type])
|
|
%teamTurretMax = $TeamDeployableMax[%type];
|
|
|
|
return %teamTurretMax;
|
|
}
|
|
|