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.
1407 lines
43 KiB
C#
1407 lines
43 KiB
C#
//******************************************************************************
|
|
//* Default StaticShape functions
|
|
//******************************************************************************
|
|
|
|
function StaticShapeData::onGainPowerEnabled(%data, %obj)
|
|
{
|
|
if(%data.ambientThreadPowered)
|
|
%obj.playThread($AmbientThread, "ambient");
|
|
// if it's a deployed object, schedule the power thread; else play it immediately
|
|
if(%data.deployAmbientThread)
|
|
%obj.schedule(750, "playThread", $PowerThread, "Power");
|
|
else
|
|
%obj.playThread($PowerThread,"Power");
|
|
// deployable objects get their recharge rate set right away -- don't set it again unless
|
|
// the object has just been re-enabled
|
|
if(%obj.initDeploy)
|
|
%obj.initDeploy = false;
|
|
else
|
|
{
|
|
if(%obj.getRechargeRate() <= 0)
|
|
{
|
|
%oldERate = %obj.getRechargeRate();
|
|
%obj.setRechargeRate(%oldERate + %data.rechargeRate);
|
|
}
|
|
}
|
|
if(%data.humSound !$= "")
|
|
%obj.playAudio($HumSound, %data.humSound);
|
|
%obj.setPoweredState(true);
|
|
}
|
|
|
|
function StaticShapeData::onLosePowerDisabled(%data, %obj)
|
|
{
|
|
%client = %obj.getControllingClient();
|
|
if(%client != 0)
|
|
serverCmdResetControlObject(%client);
|
|
|
|
if(%data.ambientThreadPowered)
|
|
%obj.pauseThread($AmbientThread);
|
|
if(!%data.alwaysAmbient)
|
|
{
|
|
%obj.stopThread($PowerThread);
|
|
// MES -- drop shields and stop them from regenerating after power loss
|
|
%obj.setRechargeRate(0.0);
|
|
%obj.setEnergyLevel(0.0);
|
|
}
|
|
if(%data.humSound !$= "")
|
|
%obj.stopAudio($HumSound);
|
|
%obj.setPoweredState(false);
|
|
}
|
|
|
|
function StaticShapeData::gainPower(%data, %obj)
|
|
{
|
|
if(%obj.isEnabled())
|
|
%data.onGainPowerEnabled(%obj);
|
|
Parent::gainPower(%data, %obj);
|
|
}
|
|
|
|
function StaticShapeData::losePower(%data, %obj)
|
|
{
|
|
if(%obj.isEnabled())
|
|
%data.onLosePowerDisabled(%obj);
|
|
Parent::losePower(%data, %obj);
|
|
}
|
|
|
|
function ShapeBaseData::onEnabled()
|
|
{
|
|
}
|
|
|
|
function ShapeBaseData::onDisabled()
|
|
{
|
|
}
|
|
|
|
function StaticShapeData::onEnabled(%data, %obj, %prevState)
|
|
{
|
|
if(%obj.isPowered())
|
|
%data.onGainPowerEnabled(%obj);
|
|
Parent::onEnabled(%data, %obj, %prevState);
|
|
}
|
|
|
|
function StaticShapeData::onDisabled(%data, %obj, %prevState)
|
|
{
|
|
if(%obj.isPowered() || (%data.className $= "Generator"))
|
|
%data.onLosePowerDisabled(%obj);
|
|
Parent::onDisabled(%data, %obj, %prevState);
|
|
}
|
|
|
|
function StaticShape::deploy(%this)
|
|
{
|
|
%this.playThread($DeployThread, "deploy");
|
|
}
|
|
|
|
function StaticShapeData::onEndSequence(%data, %obj, %thread)
|
|
{
|
|
if(%thread == $DeployThread)
|
|
%obj.setSelfPowered();
|
|
Parent::onEndSequence(%data, %obj, %thread);
|
|
}
|
|
|
|
function ShapeBaseData::onEndSequence()
|
|
{
|
|
}
|
|
|
|
//******************************************************************************
|
|
//* Example explosion
|
|
//******************************************************************************
|
|
|
|
datablock EffectProfile(ShapeExplosionEffect)
|
|
{
|
|
effectname = "explosions/explosion.xpl03";
|
|
minDistance = 10;
|
|
maxDistance = 50;
|
|
};
|
|
|
|
datablock AudioProfile(ShapeExplosionSound)
|
|
{
|
|
filename = "fx/explosions/explosion.xpl03.wav";
|
|
description = AudioExplosion3d;
|
|
preload = true;
|
|
effect = ShapeExplosionEffect;
|
|
};
|
|
|
|
datablock ExplosionData(ShapeExplosion)
|
|
{
|
|
explosionShape = "disc_explosion.dts";
|
|
soundProfile = ShapeExplosionSound;
|
|
faceViewer = true;
|
|
};
|
|
|
|
//******************************************************************************
|
|
//* Player Armors - Data Blocks (live players are now StaticTSObjects)
|
|
//******************************************************************************
|
|
|
|
datablock StaticShapeData(HeavyMaleHuman_Dead)
|
|
{
|
|
className = "deadArmor";
|
|
catagory = "Player Armors";
|
|
shapeFile = "heavy_male_dead.dts";
|
|
isInvincible = true;
|
|
};
|
|
|
|
datablock StaticShapeData(MediumMaleHuman_Dead)
|
|
{
|
|
className = "deadArmor";
|
|
catagory = "Player Armors";
|
|
shapeFile = "medium_male_dead.dts";
|
|
isInvincible = true;
|
|
};
|
|
|
|
datablock StaticShapeData(LightMaleHuman_Dead)
|
|
{
|
|
className = "deadArmor";
|
|
catagory = "Player Armors";
|
|
shapeFile = "light_male_dead.dts";
|
|
isInvincible = true;
|
|
};
|
|
|
|
function deadArmor::onAdd(%data, %obj)
|
|
{
|
|
Parent::onAdd(%data, %obj);
|
|
}
|
|
|
|
//*****************************************************************************
|
|
//* Flagstands - Data Blocks
|
|
//*****************************************************************************
|
|
datablock StaticShapeData(InteriorFlagStand)
|
|
{
|
|
className = "FlagIntStand";
|
|
catagory = "Objectives";
|
|
shapefile = "int_flagstand.dts";
|
|
isInvincible = true;
|
|
needsNoPower = true;
|
|
};
|
|
|
|
datablock StaticShapeData(ExteriorFlagStand)
|
|
{
|
|
className = "FlagIntStand";
|
|
catagory = "Objectives";
|
|
shapefile = "ext_flagstand.dts";
|
|
isInvincible = true;
|
|
needsNoPower = true;
|
|
};
|
|
|
|
///////////////////////////////////////////
|
|
//flagIntStand::onAdd(%this, %obj)
|
|
//%this: objects datablock
|
|
//%obj: the actual object being added
|
|
///////////////////////////////////////////
|
|
|
|
function ExteriorFlagStand::onAdd(%this, %obj)
|
|
{
|
|
Parent::onAdd(%this, %obj);
|
|
%obj.playThread($ActivateThread, "activate");
|
|
}
|
|
|
|
function ExteriorFlagStand::onFlagTaken(%this, %obj)
|
|
{
|
|
%obj.setThreadDir($ActivateThread, 0);
|
|
}
|
|
|
|
function ExteriorFlagStand::onFlagReturn(%this, %obj)
|
|
{
|
|
%obj.setThreadDir($ActivateThread, 1);
|
|
}
|
|
|
|
function ExteriorFlagStand::onCollision(%this, %obj, %colObj)
|
|
{
|
|
game.flagStandCollision(%this, %obj, %colObj);
|
|
}
|
|
|
|
function InteriorFlagStand::onCollision(%this, %obj, %colObj)
|
|
{
|
|
game.flagStandCollision(%this, %obj, %colObj);
|
|
}
|
|
|
|
///////////////////////////////////////////////
|
|
//end flag stand functions
|
|
///////////////////////////////////////////////
|
|
|
|
datablock StaticShapeData(FlipFlop)
|
|
{
|
|
catagory = "Objectives";
|
|
shapefile = "switch.dts";
|
|
|
|
isInvincible = true;
|
|
cmdCategory = "Objectives";
|
|
cmdIcon = "CMDSwitchIcon";
|
|
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
|
targetTypeTag = 'Switch';
|
|
alwaysAmbient = true;
|
|
needsNoPower = true;
|
|
emap = true;
|
|
};
|
|
|
|
function FlipFlop::onCollision(%data,%obj,%col)
|
|
{
|
|
if (%col.getDataBlock().className $= Armor && %col.getState() !$= "Dead")
|
|
%data.playerTouch(%obj, %col);
|
|
}
|
|
|
|
function FlipFlop::playerTouch(%data,%obj,%col)
|
|
{
|
|
messageAll('MsgPlayerTouchSwitch', 'Player %1 touched switch %2', %col, %obj);
|
|
}
|
|
|
|
//******************************************************************************
|
|
//* Organics - *
|
|
//******************************************************************************
|
|
|
|
//function to add random Organics to mission pre-creation
|
|
//(could be used to add other things...its cool with bioderm armors ;) )
|
|
|
|
function randomOrg(%organicName, %num, %radius)
|
|
{
|
|
%SPACING = 1.0; //meters between center of organic and another object
|
|
|
|
//return help info
|
|
if(%organicName $="" || !%num || !%radius) {
|
|
echo("randomOrg(<shape name>, <quantity>, <radius of grove desired>);");
|
|
return;
|
|
}
|
|
|
|
%organicIndex = -1;
|
|
for (%i = 0; %i < $NumAStaticTSObjects; %i++) {
|
|
if (getWord($StaticTSObjects[%i], 1) $= %organicName) {
|
|
%organicIndex = %i;
|
|
break;
|
|
}
|
|
}
|
|
if (%organicIndex == -1) {
|
|
error("There is no static shape named" SPC %organicName);
|
|
return;
|
|
}
|
|
%shapeFileName = getWord($StaticTSObjects[%organicIndex], 2);
|
|
|
|
%maxSlope = getWord($StaticTSObjects[%organicIndex], 3);
|
|
if (%maxSlope $= "")
|
|
%maxSlope = 40;
|
|
|
|
%zOffset = getWord($StaticTSObjects[%organicIndex], 4);
|
|
if (%zOffset $= "")
|
|
%zOffset = 0;
|
|
|
|
%slopeWithTerrain = getWord($StaticTSObjects[%organicIndex], 5);
|
|
if (%slopeWithTerrain $= "")
|
|
%slopeWithTerrain = false;
|
|
|
|
%minScale = getWord($StaticTSObjects[%organicIndex], 6);
|
|
%maxScale = getWord($StaticTSObjects[%organicIndex], 7);
|
|
|
|
//set up folders in mis file
|
|
$RandomOrganicsAdded++; //to keep track of groups
|
|
if(!isObject(RandomOrganics)) {
|
|
%randomOrgGroup = new simGroup(RandomOrganics);
|
|
MissionGroup.add(%randomOrgGroup);
|
|
}
|
|
%groupName = "Addition"@$RandomOrganicsAdded@%organicName;
|
|
%group = new simGroup(%groupName);
|
|
RandomOrganics.add(%group);
|
|
|
|
|
|
%ctr = LocalClientConnection.camera.getPosition();
|
|
%areaX = getWord(%ctr, 0) - %radius;
|
|
%areaY = getWord(%ctr, 1) - %radius;
|
|
|
|
%orgCount = %num;
|
|
while((%orgCount > 0) && (%retries < (15000 / %maxSlope))) //theoretically, a thorough number of retries
|
|
{
|
|
//find a tile
|
|
%x = (getRandom(mFloor(%areaX / 8), mFloor((%areaX + (%radius * 2)) / 8)) * 8) + 4; //tile center
|
|
%y = (getRandom(mFloor(%areaY / 8), mFloor((%areaY + (%radius * 2)) / 8)) * 8) + 4;
|
|
|
|
%start = %x @ " " @ %y @ " 2000";
|
|
%end = %x @ " " @ %y @ " -1";
|
|
%ground = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
%z = getWord(%ground, 3);
|
|
%z += %zOffset;
|
|
%position = %x @ " " @ %y @ " " @ %z;
|
|
|
|
|
|
// get normal from both sides of the square
|
|
%start = %x + 2 @ " " @ %y @ " 2000";
|
|
%end = %x + 2 @ " " @ %y @ " -1";
|
|
%hit1 = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
|
|
%start = %x - 2 @ " " @ %y @ " 2000";
|
|
%end = %x - 2 @ " " @ %y @ " -1";
|
|
%hit2 = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
|
|
%norm1 = getWord(%hit1, 4) @ " " @ getWord(%hit1, 5) @ " " @ getWord(%hit1, 6);
|
|
%norm2 = getWord(%hit2, 4) @ " " @ getWord(%hit2, 5) @ " " @ getWord(%hit2, 6);
|
|
|
|
//if either side of tile has greater slope than allowed, move on.
|
|
%angNorm1 = getTerrainAngle(%norm1);
|
|
%angNorm2 = getTerrainAngle(%norm2);
|
|
if ((getTerrainAngle(%norm1) > %maxSlope) || (getTerrainAngle(%norm2) > %maxslope))
|
|
{
|
|
%retries++;
|
|
continue;
|
|
}
|
|
|
|
%terrainNormal = VectorAdd(%norm1, %norm2);
|
|
%terrainNormal = VectorNormalize(%terrainNormal);
|
|
|
|
//search surroundings for obstacles. If obstructed, move on.
|
|
InitContainerRadiusSearch(%position, %spacing, $TypeMasks::VehicleObjectType |
|
|
$TypeMasks::MoveableObjectType |
|
|
$TypeMasks::StaticShapeObjectType |
|
|
$TypeMasks::TSStaticShapeObjectType |
|
|
$TypeMasks::ForceFieldObjectType |
|
|
$TypeMasks::TurretObjectType |
|
|
$TypeMasks::InteriorObjectType |
|
|
$TypeMasks::ItemObjectType);
|
|
%this = containerSearchNext();
|
|
if(%this)
|
|
{
|
|
%retries++;
|
|
continue;
|
|
}
|
|
|
|
|
|
//rotate it
|
|
if(%slopeWithTerrain)
|
|
{
|
|
%rotAxis = vectorCross(%terrainNormal, "0 0 1");
|
|
%rotAxis = vectorNormalize(%rotAxis);
|
|
%rotation = %rotAxis @ " " @ getTerrainAngle(%terrainNormal);
|
|
}
|
|
else %rotation = "1 0 0 0";
|
|
%randomAngle = getRandom(360);
|
|
%zrot = MatrixCreate("0 0 0", "0 0 1 " @ %randomAngle);
|
|
%orient = MatrixCreate(%position, %rotation);
|
|
%finalXForm = MatrixMultiply(%orient, %zrot);
|
|
|
|
|
|
//scale it
|
|
%scaleMin = 8; //default min
|
|
%scaleMax = 14; //default max
|
|
if(%minScale)
|
|
%scaleMin = %minScale * 10;
|
|
if(%maxScale)
|
|
%scaleMax = %maxScale * 10;
|
|
%scaleInt = getRandom(%scaleMin, %scaleMax);
|
|
%scale = %scaleInt/10;
|
|
%evenScale = %scale SPC %scale SPC %scale;
|
|
|
|
//create it
|
|
%position = %x SPC %y SPC (%z += %zoffset);
|
|
%newOrganic = new TSStatic() {
|
|
position = %position;
|
|
rotation = %rotation;
|
|
scale = %evenScale;
|
|
shapeName = %shapeFileName;
|
|
};
|
|
%group.add(%newOrganic);
|
|
%newOrganic.setTransform(%finalXForm);
|
|
|
|
%orgCount--; //dec number of shapes left to place
|
|
%retries = 0; //reset retry counter
|
|
}
|
|
if (%orgCount > 0)
|
|
{
|
|
error("Unable to place all shapes, area saturated.");
|
|
error("Looking for clear area " @ (%spacing * 2) @ " meters in diameter, with a max slope of " @ %maxSlope);
|
|
}
|
|
echo("Placed " @ %num - %orgCount @ " of " @ %num);
|
|
}
|
|
|
|
function getTerrainAngle(%point)
|
|
{
|
|
%up = "0 0 1";
|
|
%angleRad = mACos(vectorDot(%point, %up));
|
|
%angleDeg = mRadToDeg(%angleRad);
|
|
//echo("angle is "@%angleDeg);
|
|
return %angleDeg;
|
|
}
|
|
function randomGrove(%organicName, %num, %radius)
|
|
{
|
|
%minHeight = 0;
|
|
%maxHeight = 1000;
|
|
%SPACING = 1.5; //meters between center of organic and another object
|
|
|
|
//return help info
|
|
if(%organicName $="" || !%num || !%radius) {
|
|
echo("randomOrg(<shape name>, <quantity>[, radius of grove desired]);");
|
|
return;
|
|
}
|
|
|
|
%organicIndex = -1;
|
|
for (%i = 0; %i < $NumStaticTSObjects; %i++) {
|
|
if (getWord($StaticTSObjects[%i], 1) $= %organicName) {
|
|
%organicIndex = %i;
|
|
break;
|
|
}
|
|
}
|
|
if (%organicIndex == -1) {
|
|
error("There is no static shape named" SPC %organicName);
|
|
return;
|
|
}
|
|
%shapeFileName = getWord($StaticTSObjects[%organicIndex], 2);
|
|
|
|
%maxSlope = getWord($StaticTSObjects[%organicIndex], 3);
|
|
if (%maxSlope $= "")
|
|
%maxSlope = 40;
|
|
|
|
%zOffset = getWord($StaticTSObjects[%organicIndex], 4);
|
|
if (%zOffset $= "")
|
|
%zOffset = 0;
|
|
|
|
%slopeWithTerrain = getWord($StaticTSObjects[%organicIndex], 5);
|
|
if (%slopeWithTerrain $= "")
|
|
%slopeWithTerrain = false;
|
|
|
|
%minScale = getWord($StaticTSObjects[%organicIndex], 6);
|
|
%maxScale = getWord($StaticTSObjects[%organicIndex], 7);
|
|
|
|
//set up folders in mis file
|
|
$RandomOrganicsAdded++; //to keep track of groups
|
|
if(!isObject(RandomOrganics)) {
|
|
%randomOrgGroup = new simGroup(RandomOrganics);
|
|
MissionGroup.add(%randomOrgGroup);
|
|
}
|
|
%groupName = "Addition"@$RandomOrganicsAdded@%organicName;
|
|
%group = new simGroup(%groupName);
|
|
RandomOrganics.add(%group);
|
|
|
|
|
|
%ctr = LocalClientConnection.camera.getPosition();
|
|
%areaX = getWord(%ctr, 0) - %radius;
|
|
%areaY = getWord(%ctr, 1) - %radius;
|
|
|
|
%orgCount = %num;
|
|
while((%orgCount > 0) && (%retries < (15000 / %maxSlope))) //theoretically, a thorough number of retries
|
|
{
|
|
//find a tile
|
|
%x = (getRandom(mFloor(%areaX / 8), mFloor((%areaX + (%radius * 2)) / 8)) * 8) + 4; //tile center
|
|
%y = (getRandom(mFloor(%areaY / 8), mFloor((%areaY + (%radius * 2)) / 8)) * 8) + 4;
|
|
|
|
%start = %x @ " " @ %y @ " 2000";
|
|
%end = %x @ " " @ %y @ " -1";
|
|
%ground = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
%z = getWord(%ground, 3);
|
|
|
|
|
|
// elevation test
|
|
if ((%z < %minHeight) || (%z > %maxHeight))
|
|
{
|
|
echo("Broke height range rules. Readjust allowable elevations.");
|
|
%retries++;
|
|
echo("Z is " @ %z);
|
|
continue;
|
|
}
|
|
%z += %zOffset;
|
|
%position = %x @ " " @ %y @ " " @ %z;
|
|
|
|
|
|
// get normal from both sides of the square
|
|
%start = %x + 2 @ " " @ %y @ " 2000";
|
|
%end = %x + 2 @ " " @ %y @ " -1";
|
|
%hit1 = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
|
|
%start = %x - 2 @ " " @ %y @ " 2000";
|
|
%end = %x - 2 @ " " @ %y @ " -1";
|
|
%hit2 = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
|
|
%norm1 = getWord(%hit1, 4) @ " " @ getWord(%hit1, 5) @ " " @ getWord(%hit1, 6);
|
|
%norm2 = getWord(%hit2, 4) @ " " @ getWord(%hit2, 5) @ " " @ getWord(%hit2, 6);
|
|
|
|
//if either side of tile has greater slope than allowed, move on.
|
|
%angNorm1 = getTerrainAngle(%norm1);
|
|
%angNorm2 = getTerrainAngle(%norm2);
|
|
if ((getTerrainAngle(%norm1) > %maxSlope) || (getTerrainAngle(%norm2) > %maxslope))
|
|
{
|
|
%retries++;
|
|
continue;
|
|
}
|
|
|
|
%terrainNormal = VectorAdd(%norm1, %norm2);
|
|
%terrainNormal = VectorNormalize(%terrainNormal);
|
|
|
|
//search surroundings for obstacles. If obstructed, move on.
|
|
InitContainerRadiusSearch(%position, %spacing, $TypeMasks::VehicleObjectType |
|
|
$TypeMasks::MoveableObjectType |
|
|
$TypeMasks::StaticShapeObjectType |
|
|
$TypeMasks::TSStaticShapeObjectType |
|
|
$TypeMasks::ForceFieldObjectType |
|
|
$TypeMasks::TurretObjectType |
|
|
$TypeMasks::InteriorObjectType |
|
|
$TypeMasks::ItemObjectType);
|
|
%this = containerSearchNext();
|
|
if(%this)
|
|
{
|
|
%retries++;
|
|
continue;
|
|
}
|
|
|
|
|
|
//rotate it
|
|
if(%slopeWithTerrain)
|
|
{
|
|
%rotAxis = vectorCross(%terrainNormal, "0 0 1");
|
|
%rotAxis = vectorNormalize(%rotAxis);
|
|
%rotation = %rotAxis @ " " @ getTerrainAngle(%terrainNormal);
|
|
}
|
|
else %rotation = "1 0 0 0";
|
|
%randomAngle = getRandom(360);
|
|
%zrot = MatrixCreate("0 0 0", "0 0 1 " @ %randomAngle);
|
|
%orient = MatrixCreate(%position, %rotation);
|
|
%finalXForm = MatrixMultiply(%orient, %zrot);
|
|
|
|
|
|
//scale it
|
|
%scaleMin = 8; //default min
|
|
%scaleMax = 14; //default max
|
|
if(%minScale)
|
|
%scaleMin = %minScale * 10;
|
|
if(%maxScale)
|
|
%scaleMax = %maxScale * 10;
|
|
%scaleInt = getRandom(%scaleMin, %scaleMax);
|
|
%scale = %scaleInt/10;
|
|
%evenScale = %scale SPC %scale SPC %scale;
|
|
|
|
//create it
|
|
|
|
%position = %x SPC %y SPC (%z += %zoffset);
|
|
%newOrganic = new TSStatic() {
|
|
position = %position;
|
|
rotation = %rotation;
|
|
scale = %evenScale;
|
|
shapeName = %shapeFileName;
|
|
};
|
|
%group.add(%newOrganic);
|
|
%newOrganic.setTransform(%finalXForm);
|
|
|
|
%orgCount--; //dec number of shapes left to place
|
|
%retries = 0; //reset retry counter
|
|
}
|
|
if (%orgCount > 0)
|
|
{
|
|
error("Unable to place all shapes, area saturated.");
|
|
error("Looking for clear area " @ (%spacing * 2) @ " meters in diameter, with a max slope of " @ %maxSlope);
|
|
}
|
|
echo("Placed " @ %num - %orgCount @ " of " @ %num);
|
|
}
|
|
|
|
|
|
function randomRock(%rock, %quantity, %radius, %maxElev)
|
|
{
|
|
if (!%radius || !%quantity || !%rock)
|
|
{
|
|
echo("randomRock(<name>, <quantity>, <radius>, [maximum elevation]");
|
|
return;
|
|
}
|
|
|
|
if (!%maxElev)
|
|
%maxElev = 2000;
|
|
|
|
|
|
%rotation[0] = "0 0 1 0";
|
|
%rotation[1] = "0.999378 -0.0145686 -0.0321219 194.406";
|
|
%rotation[2] = "0.496802 0.867682 0.0177913 176.44";
|
|
%rotation[3] = "0.991261 0.0933696 0.0931923 181.867";
|
|
%rotation[4] = "0.246801 0.360329 -0.899584 92.3648";
|
|
%rotation[5] = "1 0 0 82.59";
|
|
%rotation[6] = "0.0546955 -0.629383 0.55201 116.103";
|
|
|
|
%spacing = 4.0; //check 4 meters around object for collisions before placing
|
|
%ctr = localClientConnection.camera.getPosition();
|
|
%areaX = getWord(%ctr, 0) - %radius;
|
|
%areaY = getWord(%ctr, 1) - %radius;
|
|
|
|
$RandomOrganicsAdded++;
|
|
if(!isObject(RandomRocks)) {
|
|
%randomOrgGroup = new simGroup(RandomRocks);
|
|
MissionGroup.add(%randomOrgGroup);
|
|
}
|
|
%groupName = "Addition"@$RandomOrganicsAdded@%rock;
|
|
%group = new simGroup(%groupName);
|
|
RandomRocks.add(%group);
|
|
|
|
%orgCount = %quantity;
|
|
while((%orgCount > 0) && (%retries < (15000 / %maxSlope))) //theoretically, a thorough number of retries
|
|
{
|
|
//find a tile
|
|
%x = %areaX + getRandom(%radius * 2);
|
|
%y = %areaY + getRandom(%radius * 2);
|
|
|
|
%start = %x @ " " @ %y @ " 2000";
|
|
%end = %x @ " " @ %y @ " -1";
|
|
%ground = containerRayCast(%start, %end, $TypeMasks::TerrainObjectType, 0);
|
|
%position = getWord(%ground, 1) @ " " @ getWord(%ground, 2) @ " " @ getWord(%ground, 3);
|
|
echo("position =*" @ %position @ "*");
|
|
%z = getWord(%position, 2);
|
|
|
|
|
|
// elevation test
|
|
if (%z > %maxElev) //65 meters and above only
|
|
{
|
|
%retries++;
|
|
echo("Z is " @ %z);
|
|
continue;
|
|
}
|
|
|
|
|
|
//search surroundings for obstacles. If obstructed, move on.
|
|
InitContainerRadiusSearch(%position, %spacing, $TypeMasks::VehicleObjectType |
|
|
$TypeMasks::MoveableObjectType |
|
|
$TypeMasks::StaticShapeObjectType |
|
|
$TypeMasks::TSStaticShapeObjectType |
|
|
$TypeMasks::ForceFieldObjectType |
|
|
$TypeMasks::TurretObjectType |
|
|
$TypeMasks::InteriorObjectType |
|
|
$TypeMasks::ItemObjectType);
|
|
%this = containerSearchNext();
|
|
if(%this)
|
|
{
|
|
%retries++;
|
|
continue;
|
|
}
|
|
%primaryRot = %rotation[getRandom(7)];
|
|
|
|
%randomAngle = mDegToRad(getRandom(360));
|
|
%zrot = MatrixCreate("0 0 0", "0 0 1 " @ %randomAngle);
|
|
%orient = MatrixCreate(%position, %primaryRot);
|
|
|
|
|
|
%scale = getRandom(3);
|
|
%evenScale = %scale @ " " @ %scale @ " " @ %scale;
|
|
%newRock = new InteriorInstance() {
|
|
scale = %evenScale;
|
|
interiorFile = %rock @ ".dif";
|
|
showTerrainInside = "0";
|
|
};
|
|
%group.add(%newRock);
|
|
%transfrm = MatrixMultiply(%orient, %zrot);
|
|
echo("Transform = *" @ %transfrm @ "*");
|
|
%newRock.setTransform(%transfrm);
|
|
|
|
%orgCount--; //dec number of shapes left to place
|
|
%retries = 0; //reset retry counter
|
|
}
|
|
if (%orgCount > 0)
|
|
{
|
|
error("Unable to place all shapes, area saturated.");
|
|
error("Looking for clear area " @ (%spacing * 2) @ " meters in diameter, with a max slope of " @ %maxSlope);
|
|
}
|
|
echo("Placed " @ %num - %orgCount @ " of " @ %num);
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
//-------------------------------------- Organics
|
|
//--------------------------------------------------------------------------
|
|
|
|
|
|
//******************************************************************************
|
|
//* Pulse Sensor - Data Blocks *
|
|
//******************************************************************************
|
|
|
|
datablock DebrisData( StaticShapeDebris )
|
|
{
|
|
explodeOnMaxBounce = false;
|
|
|
|
elasticity = 0.20;
|
|
friction = 0.5;
|
|
|
|
lifetime = 17.0;
|
|
lifetimeVariance = 0.0;
|
|
|
|
minSpinSpeed = 60;
|
|
maxSpinSpeed = 600;
|
|
|
|
numBounces = 10;
|
|
bounceVariance = 0;
|
|
|
|
staticOnMaxBounce = true;
|
|
|
|
useRadiusMass = true;
|
|
baseRadius = 0.4;
|
|
|
|
velocity = 9.0;
|
|
velocityVariance = 4.5;
|
|
};
|
|
|
|
datablock DebrisData( SmallShapeDebris )
|
|
{
|
|
explodeOnMaxBounce = false;
|
|
|
|
elasticity = 0.20;
|
|
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;
|
|
};
|
|
|
|
datablock AudioProfile(SensorHumSound)
|
|
{
|
|
filename = "fx/powered/sensor_hum.wav";
|
|
description = CloseLooping3d;
|
|
preload = true;
|
|
};
|
|
|
|
datablock SensorData(SensorLgPulseObj)
|
|
{
|
|
detects = true;
|
|
detectsUsingLOS = true;
|
|
detectsPassiveJammed = false;
|
|
detectsActiveJammed = false;
|
|
detectsCloaked = false;
|
|
detectionPings = true;
|
|
detectRadius = 300;
|
|
};
|
|
|
|
datablock StaticShapeData(SensorLargePulse) : StaticShapeDamageProfile
|
|
{
|
|
className = Sensor;
|
|
catagory = "Sensors";
|
|
shapeFile = "sensor_pulse_large.dts";
|
|
maxDamage = 1.5;
|
|
destroyedLevel = 1.5;
|
|
disabledLevel = 0.85;
|
|
explosion = ShapeExplosion;
|
|
expDmgRadius = 10.0;
|
|
expDamage = 0.5;
|
|
expImpulse = 2000.0;
|
|
|
|
dynamicType = $TypeMasks::SensorObjectType;
|
|
isShielded = true;
|
|
energyPerDamagePoint = 33;
|
|
maxEnergy = 110;
|
|
rechargeRate = 0.31;
|
|
ambientThreadPowered = true;
|
|
humSound = SensorHumSound;
|
|
|
|
cmdCategory = "Support";
|
|
cmdIcon = CMDSensorIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_sensor_grey";
|
|
targetNameTag = 'Large';
|
|
targetTypeTag = 'Sensor';
|
|
sensorData = SensorLgPulseObj;
|
|
sensorRadius = SensorLgPulseObj.detectRadius;
|
|
sensorColor = "255 194 9";
|
|
|
|
debrisShapeName = "debris_generic.dts";
|
|
debris = StaticShapeDebris;
|
|
};
|
|
|
|
datablock SensorData(SensorMedPulseObj)
|
|
{
|
|
detects = true;
|
|
detectsUsingLOS = true;
|
|
detectsPassiveJammed = false;
|
|
detectsActiveJammed = false;
|
|
detectsCloaked = false;
|
|
detectionPings = true;
|
|
detectRadius = 175;
|
|
};
|
|
|
|
datablock StaticShapeData(SensorMediumPulse) : StaticShapeDamageProfile
|
|
{
|
|
className = Sensor;
|
|
catagory = "Sensors";
|
|
shapeFile = "sensor_pulse_medium.dts";
|
|
maxDamage = 1.2;
|
|
destroyedLevel = 1.2;
|
|
disabledLevel = 0.68;
|
|
explosion = ShapeExplosion;
|
|
expDmgRadius = 7.0;
|
|
expDamage = 0.4;
|
|
expImpulse = 1500;
|
|
|
|
dynamicType = $TypeMasks::SensorObjectType;
|
|
isShielded = true;
|
|
energyPerDamagePoint = 33;
|
|
maxEnergy = 90;
|
|
rechargeRate = 0.31;
|
|
ambientThreadPowered = true;
|
|
humSound = SensorHumSound;
|
|
|
|
cmdCategory = "Support";
|
|
cmdIcon = CMDSensorIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_sensor_grey";
|
|
targetNameTag = 'Medium';
|
|
targetTypeTag = 'Sensor';
|
|
sensorData = SensorMedPulseObj;
|
|
sensorRadius = SensorMedPulseObj.detectRadius;
|
|
sensorColor = "255 194 9";
|
|
|
|
debrisShapeName = "debris_generic.dts";
|
|
debris = StaticShapeDebris;
|
|
};
|
|
|
|
function Sensor::onGainPowerEnabled(%data, %obj)
|
|
{
|
|
setTargetSensorData(%obj.target, %data.sensorData);
|
|
Parent::onGainPowerEnabled(%data, %obj);
|
|
}
|
|
|
|
function Sensor::onLosePowerDisabled(%data, %obj)
|
|
{
|
|
setTargetSensorData(%obj.target, 0);
|
|
Parent::onLosePowerDisabled(%data, %obj);
|
|
}
|
|
|
|
//******************************************************************************
|
|
//* Generator - Data Blocks *
|
|
//******************************************************************************
|
|
|
|
datablock AudioProfile(GeneratorHumSound)
|
|
{
|
|
filename = "fx/powered/generator_hum.wav";
|
|
description = CloseLooping3d;
|
|
preload = true;
|
|
};
|
|
|
|
|
|
datablock StaticShapeData(GeneratorLarge) : StaticShapeDamageProfile
|
|
{
|
|
className = Generator;
|
|
catagory = "Generators";
|
|
shapeFile = "station_generator_large.dts";
|
|
explosion = ShapeExplosion;
|
|
maxDamage = 1.50;
|
|
destroyedLevel = 1.50;
|
|
disabledLevel = 0.85;
|
|
expDmgRadius = 10.0;
|
|
expDamage = 0.5;
|
|
expImpulse = 1500.0;
|
|
noIndividualDamage = true; //flag to make these invulnerable for certain mission types
|
|
|
|
dynamicType = $TypeMasks::GeneratorObjectType;
|
|
isShielded = true;
|
|
energyPerDamagePoint = 30;
|
|
maxEnergy = 50;
|
|
rechargeRate = 0.05;
|
|
humSound = GeneratorHumSound;
|
|
|
|
cmdCategory = "Support";
|
|
cmdIcon = "CMDGeneratorIcon";
|
|
cmdMiniIconName = "commander/MiniIcons/com_generator";
|
|
targetTypeTag = 'Generator';
|
|
|
|
debrisShapeName = "debris_generic.dts";
|
|
debris = StaticShapeDebris;
|
|
};
|
|
|
|
datablock StaticShapeData(SolarPanel) : StaticShapeDamageProfile
|
|
{
|
|
className = Generator;
|
|
catagory = "Generators";
|
|
shapeFile = "solarpanel.dts";
|
|
explosion = ShapeExplosion;
|
|
maxDamage = 1.00;
|
|
destroyedLevel = 1.00;
|
|
disabledLevel = 0.55;
|
|
expDmgRadius = 5.0;
|
|
expDamage = 0.3;
|
|
expImpulse = 1000.0;
|
|
noIndividualDamage = true; //flag to make these invulnerable for certain mission types
|
|
emap = true;
|
|
|
|
isShielded = true;
|
|
energyPerDamagePoint = 30;
|
|
rechargeRate = 0.05;
|
|
|
|
dynamicType = $TypeMasks::GeneratorObjectType;
|
|
maxEnergy = 30;
|
|
humSound = GeneratorHumSound;
|
|
|
|
cmdCategory = "Support";
|
|
cmdIcon = CMDSolarGeneratorIcon;
|
|
cmdMiniIconName = "commander/MiniIcons/com_solargen_grey";
|
|
targetTypeTag = 'Solar Panel';
|
|
|
|
debrisShapeName = "debris_generic.dts";
|
|
debris = StaticShapeDebris;
|
|
};
|
|
|
|
function Generator::onDisabled(%data, %obj, %prevState)
|
|
{
|
|
%obj.decPowerCount();
|
|
Parent::onDisabled(%data, %obj, %prevState);
|
|
}
|
|
|
|
function Generator::onEnabled(%data, %obj, %prevState)
|
|
{
|
|
%obj.incPowerCount();
|
|
Parent::onEnabled(%data, %obj, %prevState);
|
|
}
|
|
|
|
//******************************************************************************
|
|
//Nexus Effect (Hunters)
|
|
//******************************************************************************
|
|
|
|
datablock StaticShapeData(Nexus_Effect)
|
|
{
|
|
catagory = "Objectives";
|
|
shapefile = "nexus_effect.dts";
|
|
mass = 10;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 2;
|
|
};
|
|
|
|
|
|
datablock StaticShapeData(NexusBase)
|
|
{
|
|
catagory = "Objectives";
|
|
shapefile = "Nexusbase.dts";
|
|
mass = 10;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 2;
|
|
};
|
|
|
|
|
|
datablock StaticShapeData(NexusCap)
|
|
{
|
|
catagory = "Objectives";
|
|
shapefile = "Nexuscap.dts";
|
|
mass = 10;
|
|
elasticity = 0.2;
|
|
friction = 0.6;
|
|
pickupRadius = 2;
|
|
};
|
|
|
|
//******************************************************************************
|
|
//* Static Shape - Functions *
|
|
//******************************************************************************
|
|
|
|
function StaticShapeData::create(%block)
|
|
{
|
|
%obj = new StaticShape()
|
|
{
|
|
dataBlock = %block;
|
|
};
|
|
return(%obj);
|
|
}
|
|
|
|
function ShapeBase::damage(%this, %sourceObject, %position, %amount, %damageType)
|
|
{
|
|
%this.getDataBlock().damageObject(%this, %sourceObject, %position, %amount, %damageType);
|
|
}
|
|
|
|
function ShapeBaseData::damageObject(%data, %targetObject, %position, %sourceObject, %amount, %damageType)
|
|
{
|
|
|
|
}
|
|
|
|
function ShapeBaseData::onDestroyed(%data, %obj, %prevState)
|
|
{
|
|
|
|
}
|
|
|
|
function ShapeBaseData::checkShields(%data, %targetObject, %position, %amount, %damageType)
|
|
{
|
|
%energy = %targetObject.getEnergyLevel();
|
|
%strength = %energy / %data.energyPerDamagePoint;
|
|
%shieldScale = %data.shieldDamageScale[%damageType];
|
|
if(%shieldScale $= "")
|
|
%shieldScale = 1;
|
|
|
|
if (%amount * %shieldScale <= %strength) {
|
|
// Shield absorbs all
|
|
%lost = %amount * %shieldScale * %data.energyPerDamagePoint;
|
|
%energy -= %lost;
|
|
%targetObject.setEnergyLevel(%energy);
|
|
|
|
%normal = "0.0 0.0 1.0";
|
|
%targetObject.playShieldEffect( %normal );
|
|
|
|
return 0;
|
|
}
|
|
// Shield exhausted
|
|
%targetObject.setEnergyLevel(0);
|
|
return %amount - %strength / %shieldScale;
|
|
}
|
|
|
|
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
|
|
{
|
|
// if this is a non-team mission type and the object is "protected", don't damage it
|
|
if(%data.noIndividualDamage && Game.allowsProtectedStatics())
|
|
return;
|
|
|
|
// if this is a Siege mission and this object shouldn't take damage (e.g. vehicle stations)
|
|
if(%data.noDamageInSiege && Game.class $= "SiegeGame")
|
|
return;
|
|
|
|
if(%sourceObject && %targetObject.isEnabled())
|
|
{
|
|
if(%sourceObject.client)
|
|
{
|
|
%targetObject.lastDamagedBy = %sourceObject.client;
|
|
%targetObject.lastDamagedByTeam = %sourceObject.client.team;
|
|
%targetObject.damageTimeMS = GetSimTime();
|
|
}
|
|
else
|
|
{
|
|
%targetObject.lastDamagedBy = %sourceObject;
|
|
%targetObject.lastDamagedByTeam = %sourceObject.team;
|
|
%targetObject.damageTimeMS = GetSimTime();
|
|
}
|
|
}
|
|
|
|
// Scale damage type & include shield calculations...
|
|
if (%data.isShielded)
|
|
%amount = %data.checkShields(%targetObject, %position, %amount, %damageType);
|
|
|
|
%damageScale = %data.damageScale[%damageType];
|
|
if(%damageScale !$= "")
|
|
%amount *= %damageScale;
|
|
|
|
//if team damage is off, cap the amount of damage so as not to disable the object...
|
|
if (!$TeamDamage && !%targetObject.getDataBlock().deployedObject)
|
|
{
|
|
//see if the object is being shot by a friendly
|
|
if(%sourceObject.getDataBlock().catagory $= "Vehicles")
|
|
%attackerTeam = getVehicleAttackerTeam(%sourceObject);
|
|
else %attackerTeam = %sourceObject.team;
|
|
|
|
if ((%targetObject.getTarget() != -1) && isTargetFriendly(%targetObject.getTarget(), %attackerTeam))
|
|
{
|
|
%curDamage = %targetObject.getDamageLevel();
|
|
%availableDamage = %targetObject.getDataBlock().disabledLevel - %curDamage - 0.05;
|
|
if (%amount > %availableDamage)
|
|
%amount = %availableDamage;
|
|
}
|
|
}
|
|
|
|
// if there's still damage to apply
|
|
if (%amount > 0)
|
|
%targetObject.applyDamage(%amount);
|
|
}
|
|
|
|
// little special casing for the above function
|
|
function getVehicleAttackerTeam(%vehicleId)
|
|
{
|
|
%name = %vehicleId.getDataBlock().getName();
|
|
if(%name $= "BomberFlyer" || %name $= "AssaultVehicle")
|
|
%gunner = %vehicleId.getMountNodeObject(1);
|
|
else
|
|
%gunner = %vehicleId.getMountNodeObject(0);
|
|
|
|
if(%gunner)
|
|
return %gunner.team;
|
|
|
|
return %vehicleId.team;
|
|
}
|
|
|
|
|
|
function StaticShapeData::onDamage(%this,%obj)
|
|
{
|
|
// Set damage state based on current damage level
|
|
%damage = %obj.getDamageLevel();
|
|
if(%damage >= %this.destroyedLevel)
|
|
{
|
|
if(%obj.getDamageState() !$= "Destroyed")
|
|
{
|
|
%obj.setDamageState(Destroyed);
|
|
// if object has an explosion damage radius associated with it, apply explosion damage
|
|
if(%this.expDmgRadius)
|
|
RadiusExplosion(%obj, %obj.getWorldBoxCenter(), %this.expDmgRadius, %this.expDamage, %this.expImpulse, %obj, $DamageType::Explosion);
|
|
%obj.setDamageLevel(%this.maxDamage);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(%damage >= %this.disabledLevel)
|
|
{
|
|
if(%obj.getDamageState() !$= "Disabled")
|
|
%obj.setDamageState(Disabled);
|
|
}
|
|
else
|
|
{
|
|
if(%obj.getDamageState() !$= "Enabled")
|
|
%obj.setDamageState(Enabled);
|
|
}
|
|
}
|
|
}
|
|
|
|
// --------------------------------------------------------------------
|
|
// Team logos - only the logo projector should be placed in a mission
|
|
|
|
datablock StaticShapeData(BaseLogo) //storm logo
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_storm.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(BaseBLogo) //Inferno Logo
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_inf.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(BiodermLogo)
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_bd.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(BEagleLogo)
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_be.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(DSwordLogo)
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_ds.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(COTPLogo)
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_hb.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(SwolfLogo)
|
|
{
|
|
className = Logo;
|
|
shapeFile = "teamlogo_sw.dts";
|
|
alwaysAmbient = true;
|
|
};
|
|
|
|
datablock StaticShapeData(LogoProjector)
|
|
{
|
|
className = Projector;
|
|
catagory = "Objectives";
|
|
shapeFile = "teamlogo_projector.dts";
|
|
alwaysAmbient = true;
|
|
isInvincible = true;
|
|
};
|
|
|
|
function Projector::onAdd(%data, %obj)
|
|
{
|
|
Parent::onAdd(%data, %obj);
|
|
%obj.holo = 0;
|
|
}
|
|
|
|
////////////////////////////////////////////
|
|
// Tapestries
|
|
///////////////////////////////////////////
|
|
datablock StaticShapeData(Banner_Honor)
|
|
{
|
|
catagory = "Eyecandy";
|
|
shapefile = "banner_honor.dts";
|
|
};
|
|
|
|
datablock StaticShapeData(Banner_Strength)
|
|
{
|
|
catagory = "Eyecandy";
|
|
shapefile = "banner_strength.dts";
|
|
};
|
|
|
|
datablock StaticShapeData(Banner_Unity)
|
|
{
|
|
catagory = "Eyecandy";
|
|
shapefile = "banner_unity.dts";
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
|
|
//--------------------------------------------------------------------------
|
|
// Totally static objects
|
|
// The format of these strings are:
|
|
// 0: Catagory
|
|
// 1: Name
|
|
// 2: File
|
|
// 3: MaxSlope [ only used with the randomOrg function ]
|
|
// 4: ZOffset [ only used with the randomOrg function ]
|
|
// 5: slopeWithTerrain [ only used with the randomOrg function ]
|
|
// 6: minScale [ only used with the randomOrg function ]
|
|
// 7: maxScale [ only used with the randomOrg function ]
|
|
|
|
|
|
$StaticTSObjects[0] = "Organics BiodermPlant3 xorg3.dts";
|
|
$StaticTSObjects[1] = "Organics BiodermPlant4 xorg4.dts";
|
|
$StaticTSObjects[2] = "Organics BiodermPlant5 xorg5.dts";
|
|
$StaticTSObjects[3] = "Organics BiodermPlant20 xorg20.dts";
|
|
$StaticTSObjects[4] = "Organics BiodermPlant21 xorg21.dts";
|
|
$StaticTSObjects[5] = "Organics BiodermPlant22 xorg22.dts";
|
|
|
|
$StaticTSObjects[6] = "Organics BEPlant1 borg1.dts 40 0.35 1 0.5 2";
|
|
$StaticTSObjects[7] = "Organics BEPlant5 borg5.dts 40 0.0 1 1 1.5";
|
|
$StaticTSObjects[8] = "Organics BEPlant6 borg6.dts";
|
|
$StaticTSObjects[9] = "Organics BEPlant7 borg7.dts";
|
|
|
|
$StaticTSObjects[10] = "Organics BEPlant12 borg12.dts";
|
|
$StaticTSObjects[11] = "Organics BEPlant13 borg13.dts";
|
|
$StaticTSObjects[12] = "Organics BELgTree16 borg16.dts 20 -3.0 0 0.8 1.5";
|
|
$StaticTSObjects[13] = "Organics BESmTree17 borg17.dts 20 -3.0 1 0.8 1.5";
|
|
$StaticTSObjects[14] = "Organics BELgTree18 borg18.dts 20 -3.0 0 0.8 1.5";
|
|
$StaticTSObjects[15] = "Organics BELgTree19 borg19.dts 20 -3.0 0 0.8 1.5";
|
|
$StaticTSObjects[16] = "Organics BEPlant20 borg20.dts";
|
|
|
|
$StaticTSObjects[17] = "Organics BEPlant23 borg23.dts";
|
|
$StaticTSObjects[18] = "Organics BEPlant25 borg25.dts";
|
|
|
|
$StaticTSObjects[19] = "Organics BEPlant31 borg31.dts";
|
|
$StaticTSObjects[20] = "Organics BEPlant32 borg32.dts";
|
|
$StaticTSObjects[21] = "Organics BEPlant33 borg33.dts";
|
|
$StaticTSObjects[22] = "Organics BEPlant34 borg34.dts";
|
|
|
|
$StaticTSObjects[23] = "Organics PhoenixPlant1 porg1.dts";
|
|
$StaticTSObjects[24] = "Organics PhoenixPlant2 porg2.dts";
|
|
$StaticTSObjects[25] = "Organics PhoenixPlant3 porg3.dts";
|
|
$StaticTSObjects[26] = "Organics PhoenixPlant5 porg5.dts 25 -0.2 1 0.6 1.0";
|
|
$StaticTSObjects[27] = "Organics PhoenixPlant6 porg6.dts";
|
|
$StaticTSObjects[28] = "Organics PhoenixPlant20 porg20.dts";
|
|
|
|
$StaticTSObjects[29] = "Organics PhoenixPlant22 porg22.dts 25 0.1 1 0.8 1.4";
|
|
$StaticTSObjects[30] = "Organics SWTree20 sorg20.dts";
|
|
$StaticTSObjects[31] = "Organics SWShrub21 sorg21.dts";
|
|
$StaticTSObjects[32] = "Organics SWTree22 sorg22.dts";
|
|
$StaticTSObjects[33] = "Organics SWShrub23 sorg23.dts";
|
|
$StaticTSObjects[34] = "Organics SWShrub24 sorg24.dts";
|
|
$StaticTSObjects[35] = "Stackables Crate1 stackable1l.dts";
|
|
$StaticTSObjects[36] = "Stackables Crate2 stackable1m.dts";
|
|
$StaticTSObjects[37] = "Stackables Crate3 stackable1s.dts";
|
|
$StaticTSObjects[38] = "Stackables Crate4 stackable2l.dts";
|
|
$StaticTSObjects[39] = "Stackables Crate5 stackable2m.dts";
|
|
$StaticTSObjects[40] = "Stackables Crate6 stackable2s.dts";
|
|
$StaticTSObjects[41] = "Stackables Crate7 stackable3l.dts";
|
|
$StaticTSObjects[42] = "Stackables Crate8 stackable3m.dts";
|
|
$StaticTSObjects[43] = "Stackables Crate9 stackable3s.dts";
|
|
$StaticTSObjects[44] = "Stackables Crate10 stackable4l.dts";
|
|
$StaticTSObjects[45] = "Stackables Crate11 stackable4m.dts";
|
|
$StaticTSObjects[46] = "Stackables Crate12 stackable5l.dts";
|
|
$StaticTSObjects[47] = "Debris ScoutWreckageShape vehicle_air_scout_wreck.dts";
|
|
$StaticTSObjects[48] = "Debris TankWreckageShape vehicle_land_assault_wreck.dts";
|
|
$StaticTSObjects[49] = "Organics DSPlant16 dorg16.dts 20 -3.0 0 0.8 1.5";
|
|
$StaticTSObjects[50] = "Organics DSPlant17 dorg17.dts 20 -3.0 1 0.8 1.5";
|
|
$StaticTSObjects[51] = "Organics DSPlant18 dorg18.dts 20 -3.0 0 0.8 1.5";
|
|
$StaticTSObjects[52] = "Organics DSPlant19 dorg19.dts 20 -3.0 0 0.8 1.5";
|
|
|
|
$StaticTSObjects[53] = "PlayerArmors LightMaleHumanArmorImage light_male.dts";
|
|
$StaticTSObjects[54] = "PlayerArmors MediumMaleHumanArmorImage medium_male.dts";
|
|
$StaticTSObjects[55] = "PlayerArmors HeavyMaleHumanArmorImage heavy_male.dts";
|
|
$StaticTSObjects[56] = "PlayerArmors LightFemaleHumanArmorImage light_female.dts";
|
|
$StaticTSObjects[57] = "PlayerArmors MediumFemaleHumanArmorImage medium_female.dts";
|
|
$StaticTSObjects[58] = "PlayerArmors HeavyFemaleHumanArmorImage heavy_male.dts";
|
|
$StaticTSObjects[59] = "PlayerArmors LightMaleBiodermArmorImage bioderm_light.dts";
|
|
$StaticTSObjects[60] = "PlayerArmors MediumMaleBiodermArmorImage bioderm_medium.dts";
|
|
$StaticTSObjects[61] = "PlayerArmors HeavyMaleBiodermArmorImage bioderm_heavy.dts";
|
|
|
|
$StaticTSObjects[62] = "Organics BEGrass1 Borg6.dts";
|
|
|
|
$StaticTSObjects[63] = "Plugs bePlug bmiscf.dts";
|
|
$StaticTSObjects[64] = "Plugs dsPlug dmiscf.dts";
|
|
$StaticTSObjects[65] = "Plugs xPlug xmiscf.dts";
|
|
$StaticTSObjects[66] = "Plugs hPlug pmiscf.dts";
|
|
$StaticTSObjects[67] = "Plugs swPlug smiscf.dts";
|
|
|
|
$StaticTSObjects[68] = "Statues Base statue_base.dts";
|
|
$StaticTSObjects[69] = "Statues HeavyMaleStatue statue_hmale.dts";
|
|
$StaticTSObjects[70] = "Statues LightFemaleStatue statue_lfemale.dts";
|
|
$StaticTSObjects[71] = "Statues LightMaleStatue statue_lmale.dts";
|
|
$StaticTSObjects[72] = "Statues Plaque statue_plaque.dts";
|
|
|
|
$StaticTSObjects[73] = "Debris BomberDebris1 bdb1.dts";
|
|
$StaticTSObjects[74] = "Debris BomberDebris2 bdb2.dts";
|
|
$StaticTSObjects[75] = "Debris BomberDebris3 bdb3.dts";
|
|
$StaticTSObjects[76] = "Debris BomberDebris4 bdb4.dts";
|
|
$StaticTSObjects[77] = "Debris BomberDebris5 bdb5.dts";
|
|
$StaticTSObjects[78] = "Debris HavocDebris1 hdb1.dts";
|
|
$StaticTSObjects[79] = "Debris HavocDebris2 hdb2.dts";
|
|
$StaticTSObjects[80] = "Debris HavocDebris3 hdb3.dts";
|
|
$StaticTSObjects[81] = "Debris IDebris1 idb.dts";
|
|
$StaticTSObjects[82] = "Debris MPBDebris1 mpbdb1.dts";
|
|
$StaticTSObjects[83] = "Debris MPBDebris2 mpbdb2.dts";
|
|
$StaticTSObjects[84] = "Debris MPBDebris3 mpbdb3.dts";
|
|
$StaticTSObjects[85] = "Debris MPBDebris4 mpbdb4.dts";
|
|
$StaticTSObjects[86] = "Debris ScoutDebris1 sdb1.dts";
|
|
$StaticTSObjects[87] = "Debris TankDebris1 tdb1.dts";
|
|
$StaticTSObjects[88] = "Debris TankDebris2 tdb2.dts";
|
|
$StaticTSObjects[89] = "Debris TankDebris3 tdb3.dts";
|
|
$StaticTSObjects[90] = "Debris GraveMarker1 gravemarker1.dts";
|
|
$StaticTSObjects[91] = "Test Test1 test1.dts";
|
|
$StaticTSObjects[92] = "Test Test2 test2.dts";
|
|
$StaticTSObjects[93] = "Test Test3 test3.dts";
|
|
$StaticTSObjects[94] = "Test Test4 test4.dts";
|
|
$StaticTSObjects[95] = "Test Test5 test5.dts";
|
|
|
|
|
|
|
|
$NumStaticTSObjects = 96;
|
|
|
|
function TSStatic::create(%shapeName)
|
|
{
|
|
//echo("Foo:" SPC %shapeName);
|
|
%obj = new TSStatic()
|
|
{
|
|
shapeName = %shapeName;
|
|
};
|
|
return(%obj);
|
|
}
|
|
|
|
function TSStatic::damage(%this)
|
|
{
|
|
// prevent console error spam
|
|
}
|
|
|
|
function stripFields(%this)
|
|
{
|
|
if(%this $= "")
|
|
%this = MissionGroup;
|
|
for (%i = 0; %i < %this.getCount(); %i++){
|
|
%obj = %this.getObject(%i);
|
|
if (%obj.getClassName() $= SimGroup)
|
|
{
|
|
%obj.powerCount = "";
|
|
%obj.team = "";
|
|
stripFields(%obj);
|
|
}
|
|
else
|
|
{
|
|
%obj.threshold = "";
|
|
%obj.team = "";
|
|
%obj.powerCount = "";
|
|
%obj.trigger = "";
|
|
%obj.hidden = "";
|
|
%obj.locked = "true";
|
|
%obj.notReady = "";
|
|
%obj.inUse = "";
|
|
%obj.triggeredBy = "";
|
|
%obj.lastDamagedBy = "";
|
|
%obj.lastDamagedByTeam ="";
|
|
%obj.isHome = "";
|
|
%obj.originalPosition = "";
|
|
%obj.objectiveCompleted = "";
|
|
%obj.number = "";
|
|
%obj.target = "";
|
|
%obj.lockCount = "";
|
|
%obj.homingCount = "";
|
|
%obj.projector = "";
|
|
%obj.holo = "";
|
|
%obj.waypoint = "";
|
|
%obj.scoreValue ="";
|
|
%obj.damageTimeMS = "";
|
|
%obj.station = "";
|
|
%homingCount = "";
|
|
}
|
|
}
|
|
}
|