Initial commit.

This commit is contained in:
Ragora 2013-02-01 15:45:22 -05:00
commit f5a6cfce9b
262 changed files with 128936 additions and 0 deletions

116
ChangeLog.txt Normal file
View file

@ -0,0 +1,116 @@
ACCM 1.4.0 [For Deflun :] ------------------------------
* The turret override (disable / enable turrets) now works outside of purebuild.
* Emplacements can no longer be controlled via the command circuit.
* Fix an issue with doors not saving timeout when being re-textured. [Thanks, Deflun]
* Added power change modes to the light. [Request by Deflun]
* More tripwire modes for easier storm-making.
* Demon Mothers can now be spawned for the zombie spawn pack.
* Changed the spawn point shape and gave it a small power radius. [Request by Krash]
* Demon armor can now be controllable.
* Multiple instability and bug fixes.
* Fixed a crash related to sentinels firing with their turret.
* Human rapiers are no longer extremely hard to control. They now run and jet.
* Updated the command satellite to the version in CCM 3.4.
* Replaced the drone AI with the version in CCM 3.4 (because the old one caused the server to crash).
* Fixed the texture tool icon.
* Removed the advanced zombie spawns. The regular zombie spawn pack should be all you need.
ACCM 1.3.2 ---------------------------------------------
* Fixed the tripwire modes. There are no longer "blank" modes.
* Smurf identifying upon join is no longer displayed when playing LAN.
* Changes have been made to the Merge Tool.
* Fixed zombie jumping ability.
* Targeting lasers no longer leave a lingering beacon at "0 0 0" when not in a valid position.
* Fixed a bug which disallowed keepers and admins to make other people zombies.
* There is now a "Max Zombies" function.
* Fixed a fatal (to the server) exploit.
* Fixed a scoring-related console spam error with ccKillZombies.
* Added saving support for antidote station antidotes (they didn't save, often resulting in an empty antidote station loaded) and deployed waypoint. Older saves are still compatible.
* Added a way to refill antidote stations.
* Technicians cannot deploy satchel charges anymore, but, they may deploy antidote stations.
* Fixed a bug with ForceTeamSpawn.
* ccGag and ccEcho have been replaced with a more effective ccMute.
* Added a texture tool.
* Added the blue pad.
* Improved the doors.
* Multiple chat command improvements.
* There's now an ability to give pieces.
* Fixed the demon mother so it now bites and dies correctly.
ACCM 1.3.1 ---------------------------------------------
* Fixed the /BuyZPack command.
* Fixed the make person Zombie commands.
* Gave Zombies targets, they now have custom skins and stuff.
* Fixed the drop pods.
* Numerous bug fixes and tweaks.
ACCM 1.3 ---------------------------------------------
* New Weapons.
* New GUI.
* Redone the /Help Command.
* Fixed the Grav Cycle.
* Fixed the DeathMessages.
* Numerous bug fixes and tweaks.
ACCM 1.24 ---------------------------------------------
* Fixed the private messaging.
* Digger pack update rate is now set accordingly in serverDefaults.cs.
* Sentinels put back in for scripters who know how to access them. Help commands for them have been removed.
* /setScale and the editor tool now accept larger scales.
* Fixed a message error with /cancelVote.
* There is now an option to remove pods.
* Rapiers are now controllable.
* You may now vote someone "zombie keeper" if the server prefs allow it.
ACCM 1.23 ---------------------------------------------
* Added the changename function again.
* Fixed a few editing tool bugs.
* Fixed /admin and /superadmin to correctly add the super chaingun.
* Fixed an error with the wait message.
* More variables have been added in serverDefaults.cs.
* Tweaked a few help messages.
* Sentinels have been removed until all the bugs have been worked out or an alternative comes up. (Note: They're not COMPLETELY removed, just the brain is gone.)
* Admin password changer was broken.
ACCM 1.221 --------------------------------------------
* Fixed a bug that caused /Stalk to lock up.
* Removed the fix for lingering player objects. Claimed to cause UEs.
* Fixed the digger pack (thanks to Dark Dragon DX for pointing out).
ACCM 1.22 ---------------------------------------------
* /set has been split up.
* A new chat command: /power has been added.
* Added chat-logging. Toggleable by a variable.
* Tweaked the help commands. Fixed typos and added sentinels.
* Fixed a bug which caused Sentinels and Bot Zombies to leave lingering player objects.
* Fixed a bug which caused Sentinels and Bot Zombies to not drop correctly.
* Bot Zombies can now be accessed by chat command.
* Removed a lingering $testcheats in an if statement for the medpack which caused the random "burn" check to always turn up true.
* Help commands have been re-done to look more traditional.
* SentinelArmy command has been decreased from super admin to public admin.
* BurnSN command has been decreased from super admin to public admin.
* The Drone commands have been decreased from super admin to public admin.
* Tweaked the drone commands a bit so they are more efficient.
ACCM 1.21 ---------------------------------------------
* Fixed an exploit which could let admins to ban anyone.
* Replaced CCM crash protection with Classic Mod version. Less prone to mistakes.
* Patch for CCM has been applied. No more drop pod problems.
* Put protection on SAD. Can be toggled with a variable.
* SAD now has different passwords for Admin and Super Admin.
* Locking the teams is now supported through the /set.
* Admin and Super Admin passwording is now supported through /set.
* /set now exports to preferences whenever necessary.
* The useless SpecOps training has now been removed.
* "Fair Teams" has been taken from Classic and put in here.
* AI addon -- ai.cs. File was missing. Fixes sentinel AI.
* The capture pack has been put on hold.
* A new pack has been added: The Digger Pack.
* Waypoint pack has been removed.
* New File Added: serverDefaults.cs
* Fixed the load menu
ACCM 1.2 and lower ------------------------------------
* Not sure...

152
Chat Command List.txt Normal file
View file

@ -0,0 +1,152 @@
ACCM Advanced Help/Chat Command list.
Command Tutorial:
When you see anything similar to: "[SomeMessage]" next to a chat command, that means it is required to type after the chat command in order for the command to work.
For example, the first command on this list, /CreateSquad [Name], requires you to type a Name for the squad after typing /CreateSquad.
Example: /CreateSquad Rouges - This will create a squad called "Rouges"
There may be specified options that you MUST choose from, for example, the command /DroneBattle has many options. The most useful is that you can customize the battles.
The command looks something like this: /DroneBattle [Single/Battle/Custom], you need to choose one of those variables that are divided by a "/" by simply typing it after the command.
There are times where the variables are told while you are typing the command, and are not specified in the /help command. For example, if you just type: /DroneBattle Custom, an error
message will appear telling you to type the radius for the drones to spawn, this same thing can also occur with zombie commands as well, and it can occur multiple times in a command.
If this comes up, don't worry, it's perfectly normal. You just need to type the varible the command is requesting.
If you type /DroneBattle Custom this exact message will pop up: "Please specify the spawn radius. Radius cannot be lower than 500 meters." This means you need to specify the radius by
typing: /DroneBattle Custom 500 (Or higher than 500 if you choose) then after you type that, another message will appear requesting another variable. So if a command is asking you to type
a variable, there is nothing wrong with the command, it's just asking to be completed.
Now you understand the basics of ACCM chat commands, if you are still unsure about something, ask a mod developer.
Chat Commands List:
1. Squad Commands:
• /CreateSquad [Name] - Create your own squad. (Sergeant Rank Required)
• /S [Text] - Privatly Chat with your squad.
• /LeaveSquad - Leave the squad you are in.
• /Invite [PlayerName] - Invite a person to your Squad.
• /RequestInvite [SquadName] - Request an Invite to a Squad.
• /Join - Use this to accept an invite to a squad.
• /SOL - Spawn around your squad's leader.
• /ListSquads - Lists all squads in the server.
• /Force [Join/Leave] [SquadName] [PlayerName] - Force a person to leave/join a squad. (General Rank Required)
2. Rank Commands:
• /ItemRestrictions - Gives a list of the weapons/packs that are restricted to ranks.
• /Top5 - Gives a list of players with the highest ranks.
• /ListRanks - Lists all the ranks and the points required to get that rank.
• /CheckStats - Check your current rank and score.
• /CheckStats [PlayerName] - Check the current rank and score of another person.
3. Zombie Point Help:
• /PlaceZombiePoint [SpawnName] [ZType] [Time] [MaxZombies] [ZombieLimit] - Places an advanced zombie point.
• /ListZombieSpawns - Lists all the advanced zombie points.
• /DisableSpawn [SpawnName] - Disables an advanced zombie point by label.
• /DisableAllSpawns - Disables all advanced zombie points.
• /EnableSpawn [SpawnName] - Enables an advanced zombie point by label.
• /EnableAllSpawns - Enables all advanced zombie points.
• /RemoveSpawn [SpawnName] - Removes an advanced zombie spawn.
• /RemoveAllSpawns - Removes all advanced zombie spawns.
• /GetStatus [SpawnName] - Get the status of a an advanced zombie spawn by label.
• /MarkZombieSpawns - Marks all zombie spawns.
• /SaveSpawns [Radius] [FileName.cs] - Save all of the advanced zombie spawns whithin said radius to said filename.
• /LoadSpawns [Radius] [FileName.cs] - Load zombie spawns whithin said filename.
• /ReplaceSpawn Type[Single/Radius/All] [Arg2] - Replaces advanced spawns with regular spawns. Which ones get replaced depends solely on your input.
4. "Quick Help" Commands:
• /BasicCMDS - Basic Commands.
• /BuildOptions - Building Options.
• /ZCMDS - Zombie Commands.
• /SCMDS - Sentinel Commands.
• /DCMDS- Drone Commands.
• /AdminCMDS - Admin Commands.
• /SACMDS - Super Admin Commands.
5. The /Help Command:
• Command Options: BasicCommands, BuildingOptions, AdminCommands, SACommands, SentinelCommands, ZombieCommands, DroneCommands and QuickCommands.
The /help command is like any command that requires options. You need to type "/Help" then type one of the options above. Example: /Help BuildingOptions will give you
a list of Building Options. It's pretty simple, there is also an in-game tutorial for using the /Help command known as "/Help Usage"
6. Building Options:
• /Delmypieces - Delete all of your pieces.
• /Objectscale [X Y Z] - Basic scaling function.
• /Getscale - Get the scale of an object.
• /Pos [X Y Z] - This will move an object in X Y Z format.
• /GetPos - This gets the postition of an object.
• /SetFreq [#] - Set your power frequency.
• /ObjectName [DesiredName] - Sets a name to a deployable.
• /Radius [Radius] - Sets the radius for Switches/Tripwires.
• /Cloak - Makes your pieces invisible.
7. Basic Commands:
• ![PlayerName] [Message] - Private messaging.
• /Opendoor - Point at a door and use this command to open it. (You can also use /Open)
• /Opendoor [Password] - Point at a door and use this command to open it if it's passworded.
• /Setdoorpass [Password] - Point at a door and use this to set it\'s password.
• /ChooseSpawn [#]- Choose a selected spawnpoint to spawn there.
• /ListSpawns - Displays all spawnpoints on your team.
• /Hack Help - Tells you how to Hack enemy teleporters.
• /SquadHelp - Tells you how to use squad commands.
• /RankHelp - Tells you basic information on ranks.
• /Tips - This will give you a random tip.
• /Info [PlayerName] - Get basic info on a specified player.
8. Sentinel Commands:
Unfortunatally, since our AI developer is refusing to work, the Sentinels will not be available ACCM 1.3, we appologize for the inconvienence.
9. Drone Commands:
• /DroneBattle [Single/Battle/Custom] - Basic Command where you can spawn either single drones, full battles, or even customize battles.
10. Zombie Commands:
• /BuyZpack - Buy a zombie pack.
• /MakeZLord [PlayerName] - Make the person a lord zombie.
• /MakeRapier [PlayerName] - Make the person a regular zombie.
• /Stalk [PlayerName] [ZType] Difficulty[Cool/Light/Medium/Heavy] - Spawn zombies around around a target.
• /Cure [PlayerName] - Cures a person.
• /Infect [PlayerName] - Infect the target with the zombie virus.
• /KillZombies - Kills all zombies and infected.
• /ZDetectDist [Radius] - Set how large the zombie detection distance is.
• /SemiInfect [PlayerName] - Infect that person with the altrenative virus.
• /PlacePod [ZType] Respawn[Yes/No] - Places a zombie pod at your crossairs.
• /RemovePod - Point at a pod to remove it.
• /ZombiePointHelp - Displays the commands for advanced zombie spawn points.
11. Admin Commands:
• /JailPlayer [PlayerName] [Time] - Sends a specified player to jail for a set amount of time.
• /AddTeam - Add/Removes a second team.
• /Gag [PlayerName] [Time] - Silences an annoying player.
• /CancelVote - Cancels a vote.
• /DelPieces [PlayerName] - Deletes a specified player\'s pieces.
• /Kill [PlayerName] - Kill someone.
• /ChangeName [PlayerName] [Color] [NewName] - Changes the target\'s name.
• /Goto [PlayerName] - Go directly to a specified person.
• /Summon [PlayerName] - Summon a specified person.
• /Moveto [X Y Z] - Go directly to a desired location.
• /Moveme [X Y Z] - Move on your X, Y or Z axis.
• /BottomPrint [Text] - Send a message on the bottom of the screen.
• /CenterPrint [Text] - Send a message in the center of the screen.
• /ForceTeamSpawn [TeamName] [SpawnNumber] - Forces an entire team to spawn at one spawnpoint.
• /SaveBuilding [Radius] [FileName.cs] - Save buildings in the server.
• /LoadBuilding [FileName.cs] - Load a building file.
• /A [Message] - Admin private messaging.
• /BuySCG - Force a SCG into your inventory.
• /Turrets - Enables/disables turrets when purebuild is on.
12. Super Admin Commands:
• /Admin [PlayerName] - Force someone to become Admin.
• /SuperAdmin [PlayerName] - Force someone to become Super Admin.
• /Echo [PlayerName] - Silently mute someone without them knowing.
• /Shred [PlayerName] - Put someone in the ACCM paper shredder.
• /SA [Message] - Super Admin private messaging.

View file

@ -0,0 +1,53 @@
@echo OFF
echo Construction Mod 0.70
echo Advanced Mod Loader
echo.
echo Please choose options below to launch server:
echo.
echo Options:
echo 1) Launch Online Dedicated Server (Ispawn).
echo 2) Launch Online Dedicated Server.
echo 3) Launch Offline Dedicated Server (Ispawn).
echo 4) Launch Offline Dedicated Server.
echo 5) Launch Online Listen Server.
echo 6) Launch Offline Listen Server.
echo 7) Exit.
set /p Input=Press enter after selection (1-7):
if %Input%==7 goto exit
set /p RemDSO=Would you like to remove all DSOs from your Tribes 2 install? (y/n):
cd ..
if %RemDSO%==y del /s /q *.dso
if %Input%==1 goto NDI
if %Input%==2 goto ND
if %Input%==3 goto FDI
if %Input%==4 goto FD
if %Input%==5 goto NL
if %Input%==6 goto FL
goto exit
:NDI
start ispawn.exe 28000 Tribes2.exe -dedicated -mod Construction
goto exit
:ND
start Tribes2.exe -dedicated -mod Construction
goto exit
:FDI
start ispawn.exe 28000 Tribes2.exe -nologin -dedicated -mod Construction
goto exit
:FD
start Tribes2.exe -nologin -dedicated -mod Construction
goto exit
:NL
start Tribes2.exe -online -mod Construction
goto exit
:FL
start Tribes2.exe -nologin -mod Construction
goto exit
:exit

30
DSO Remover.bat Normal file
View file

@ -0,0 +1,30 @@
@echo off
color 2f
cls
echo;
echo;
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º 0.70 DSO Remover º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º This DOS batch file will remove those pesky dso's from º
echo º your Tribes 2 installation. Regardless of where it is. º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º Remove all DSO files(not flagged as read only) from º
echo º Tribes 2 directory by pressing enter. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo;
echo;
pause
cd ..
del /s /q *.dso
cls
echo;
echo;
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Success! º
echo º º
echo º All dso's from Tribes 2 have been removed. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo;
echo;
pause

22
MergeToolTemp.txt Normal file
View file

@ -0,0 +1,22 @@
//--- OBJECT WRITE BEGIN ---
new StaticShape() {
position = "20.5956 -19.0981 100";
rotation = "0 0 1 47.5405";
scale = "0.124997 0.0949413 8";
dataBlock = "DeployedSpine";
lockCount = "0";
homingCount = "0";
Target = "-1";
lastState = "0";
depTime = "117579";
dSurface = "1982";
ownerguid = "2000181";
grounded = "1";
team = "1";
needsFit = "1";
owner = "1997";
powerFreq = "1";
powerCount = "0";
};
//--- OBJECT WRITE END ---

2055
Scripts/CTFGame.cs Normal file

File diff suppressed because it is too large Load diff

1240
Scripts/CombatConGame.cs Normal file

File diff suppressed because it is too large Load diff

120
Scripts/ConstructionGame.cs Normal file
View file

@ -0,0 +1,120 @@
// DisplayName = Construction
//--- GAME RULES BEGIN ---
// Freebuild - Build whatever you want.
// Type: /Help to access a list of useful commands.
// Scoring System Disabled.
//--- GAME RULES END ---
// Now to get rid of most of the CCM Weapons.
$InvBanList[Construction, "RailGun"] = 1;
$InvBanList[Construction, "Bazooka"] = 1;
$InvBanList[Construction, "snipergun"] = 1;
$InvBanList[Construction, "flamer"] = 1;
$InvBanList[Construction, "Shotgun"] = 1;
$InvBanList[Construction, "RShotgun"] = 1;
$InvBanList[Construction, "HRPChaingun"] = 1;
$InvBanList[Construction, "RPChaingun"] = 1;
$InvBanList[Construction, "BoosterPack"] = 1;
$InvBanList[Construction, "NapalmMortar"] = 1;
$InvBanList[Construction, "M4"] = 1;
$InvBanList[Construction, "flamerammopack"] = 1;
$InvBanList[Construction, "ELFBarrelPack"] = 1;
$InvBanList[Construction, "artillerybarrelpack"] = 1;
$InvBanList[Construction, "artilleryWeaponPack"] = 1;
$InvBanList[Construction, "InventoryDeployable"] = 1;
$InvBanList[Construction, "SpySatelliteDeployable"] = 1;
function ConstructionGame::AIInit(%game) {
//call the default AIInit() function
AIInit();
}
function ConstructionGame::allowsProtectedStatics(%game) {
return true;
}
function ConstructionGame::clientMissionDropReady(%game, %client) {
messageClient(%client, 'MsgClientReady',"", %game.class);
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function ConstructionGame::onAIRespawn(%game, %client)
{
//add the default task
if (! %client.defaultTasksAdded)
{
%client.defaultTasksAdded = true;
%client.addTask(AIPickupItemTask);
%client.addTask(AIUseInventoryTask);
%client.addTask(AITauntCorpseTask);
%client.addTask(AIEngageTurretTask);
%client.addTask(AIDetectMineTask);
%client.addTask(AIBountyPatrolTask);
%client.bountyTask = %client.addTask(AIBountyEngageTask);
}
//set the inv flag
%client.spawnUseInv = true;
}
function ConstructionGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement) {
if (%game.testKill(%clVictim, %clKiller)) { //verify victim was an enemy
%game.awardScoreKill(%clKiller);
%game.awardScoreDeath(%clVictim);
}
else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide
%game.awardScoreSuicide(%clVictim);
}
function ConstructionGame::timeLimitReached(%game) {
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function ConstructionGame::scoreLimitReached(%game) {
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function ConstructionGame::gameOver(%game) {
//call the default
DefaultGame::gameOver(%game);
//send the winner message
%winner = "";
if ($teamScore[1] > $teamScore[2])
%winner = %game.getTeamName(1);
else if ($teamScore[2] > $teamScore[1])
%winner = %game.getTeamName(2);
if (%winner $= 'Storm')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav" );
else if (%winner $= 'Inferno')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav" );
else if (%winner $= 'Starwolf')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.swwin.wav" );
else if (%winner $= 'Blood Eagle')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.bewin.wav" );
else if (%winner $= 'Diamond Sword')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.dswin.wav" );
else if (%winner $= 'Phoenix')
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.pxwin.wav" );
else
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
messageAll('MsgClearObjHud', "");
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
%client = ClientGroup.getObject(%i);
%game.resetScore(%client);
}
for(%j = 1; %j <= %game.numTeams; %j++)
$TeamScore[%j] = 0;
}
function ConstructionGame::vehicleDestroyed(%game, %vehicle, %destroyer) {
}

View file

@ -0,0 +1,99 @@
//==============================================================================
// ACCM Message Database - By Blnukem.
//------------------------------------------------------------------------------
// This is the message database for Sentinels and other miscellaneous functions
// The following will be addressed in each message cluster on what can or cannot
// be used in those messages.
//
// This was made for the pleasure of ACCM users to customize Sentinel responses
// and a few other messages.
//------------------------------------------------------------------------------
// %1 = Sentinel's Name.
// %2 = Sender's Name.
// %3 = Sender/Target's Gender. (He/She)
// %4 = Sender/Target's Present Tense Gender. (Him/Her)
// %5 = Sender/Target's Possesive Gender. (His/Her)
// %6 = Target's Name. (Only if there is a target defined)
//==============================================================================
// No Target Client for this cluster exists:
$SentinelDenyFollowCount = 5;
$SentinelDenyFollow[0] = '\c2%1 ::\c0 %2, I am already occupied with a task, I cannot follow you.';
$SentinelDenyFollow[1] = '\c2%1 ::\c0 I\'m already engaged in a task, %2.';
$SentinelDenyFollow[2] = '\c2%1 ::\c0 I am occupied at the moment, %2. Sorry, but I cannot follow you.';
$SentinelDenyFollow[3] = '\c2%1 ::\c0 %2, I\'m busy doing something. I cannot follow you.';
$SentinelDenyFollow[4] = '\c2%1 ::\c0 I\'m already doing something, %2.';
//------------------------------------------------------------------------------
// Sender and Target Clients for this cluster exist:
$SentinelDenyAttackCount = 5;
$SentinelDenyAttack[0] = '\c2%1 ::\c0 I\'m already doing something, %2';
$SentinelDenyAttack[1] = '\c2%1 ::\c0 %2, I\'m busy doing something. I cannot engage %6.';
$SentinelDenyAttack[2] = '\c2%1 ::\c0 I am occupied at the moment, %2. Sorry, but I cannot do what you ask.';
$SentinelDenyAttack[3] = '\c2%1 ::\c0 %2, I am already occupied with a task, I cannot attack %6.';
$SentinelDenyAttack[4] = '\c2%1 ::\c0 I\'m already engaged in a task, %2.';
//------------------------------------------------------------------------------
// Sender and Target Clients for this cluster exist:
$SentinelAcceptAttackCount = 4;
$SentinelAcceptAttack[0] = '\c2%1 ::\c0 I\'m now engaging %6.';
$SentinelAcceptAttack[1] = '\c2%1 ::\c0 Command confirmed, I will now hunt down %6.';
$SentinelAcceptAttack[2] = '\c2%1 ::\c0 Attack protocol engaged, I will now hunt down %6.';
$SentinelAcceptAttack[3] = '\c2%1 ::\c0 Command confirmed %2, I will now attack %6.';
//------------------------------------------------------------------------------
// Sender and Target Clients for this cluster exist:
$SentinelAttackAlreadyDeadTargetCount = 1;
$SentinelAttackAlreadyDeadTarget[0] = '\c2%1 ::\c0 %6 is already dead.';
//------------------------------------------------------------------------------
// Sender and Target Clients for this cluster exist:
$SentinelTargetTooFarCount = 1;
$SentinelTargetTooFar[0] = '\c2%1 ::\c0 Command declined. %6 is out of range.';
//------------------------------------------------------------------------------
// No Target Client for this cluster exists:
$SentinelAttackSenderCount = 1;
$SentinelAttackSender[0] = '\c2%1 ::\c0 Command declined %2, I cannot kill the person giving me an order.';
//------------------------------------------------------------------------------
// No Target Client for this cluster exists:
$SentinelAttackSenderNotAdminCount = 1;
$SentinelAttackSenderNotAdmin[0] = '\c2%1 ::\c0 %2, you must be an admin to set an attack order.';
//------------------------------------------------------------------------------
// No Sender Client for this cluster exists:
$SentinelAnnoyedCount = 3;
$SentinelAnnoyed[0] = '\c2%1 ::\c0 %2, now you will learn not to fly around sentinels.';
$SentinelAnnoyed[1] = '\c2%1 ::\c0 Target Designated. %2, you were warned not to fly around Sentinels.';
$SentinelAnnoyed[2] = '\c2%1 ::\c0 %2, you need to learn to not fly around Sentinels.';
//------------------------------------------------------------------------------
// No Sender Client for this cluster exists:
$SentinelWarnCount = 4;
$SentinelWarn[0] = '\c2%1 ::\c0 Please stop flying around me, %2.';
$SentinelWarn[1] = '\c2%1 ::\c0 Quit flying around me %2.';
$SentinelWarn[2] = '\c2%1 ::\c0 Do not fly around me, %2.';
$SentinelWarn[3] = '\c2%1 ::\c0 %2, if you do not stop flying around me, you will be killed.';
//------------------------------------------------------------------------------
$ACCMTipCount = 10;
$ACCMTip[0] = "Random Tip:<font:Broadway Bt:14>\nRemember, type /help for a list of useful commands.";
$ACCMTip[1] = "Sentinel Network:<font:Broadway Bt:14>\nSentinels are your allies and will not attack you, unless you provoke them to do so.";
$ACCMTip[2] = "Central Command Intel Report:<font:Broadway Bt:14>\nYou can launch drop pods from Golem heavy transports by pressing your mine key while you're piloting.";
$ACCMTip[3] = "Random Tip:<font:Broadway Bt:14>\nThe easiest way to kill a Zombie or anyone for that matter, is to aim for the head.";
$ACCMTip[4] = "Central Command Intel Report:<font:Broadway Bt:14>\nThe medic pack has an antidote option for infected players, useable by pressing the right mouse button.";
$ACCMTip[5] = "Central Command Intel Report:<font:Broadway Bt:14>\nThe Flame turret barrel is the most effective turret barrel to kill Zombies, followed by the Chaingun turret barrel. The least effective is the Flak barrel.";
$ACCMTip[6] = "Sentinel Network:<font:Broadway Bt:14>\nSentinels are intended for Zombie containment and control, and will not attack humans unless provoked to do so.";
$ACCMTip[7] = "Central Command Intel Report:<font:Broadway Bt:14>\nThe Purge Field Generator is made to defend an area against Zombies, it's particle field will electrocute any Zombies within the field, but requires heavy maintenece.";
$ACCMTip[8] = "Random Tip:<font:Broadway Bt:14>\nUse /CheckStats to check out your current rank and how many points you need for your next rank.";
$ACCMTip[9] = "Random Tip:<font:Broadway Bt:14>\nThe Vehicle Repair Pad, Deployable Sentry Turret and the Purge Field Generator require power to operate, be sure to give them a power source when using them!";

764
Scripts/Data/PulseData.cs Normal file
View file

@ -0,0 +1,764 @@
datablock StaticShapeData(SelectionPad) : StaticShapeDamageProfile
{
className = "crate";
shapeFile = "station_inv_mpb.dts";//"vehicle_air_hapc.dts";
};
function SelectionPad::onDestroyed(%this, %obj, %prevState)
{
%obj.remTrigger();
Parent::onDestroyed(%this, %obj, %prevState);
%obj.schedule(500, "delete");
}
//Litle console spam remover.
function SelectionPad::hasDismountOverrides(%data, %obj)
{
return false;
}
function SelectionPad::playerDismounted(%data, %obj, %player)
{
%obj.setThreadDir(1,false);
}
function shockwave(%pos,%nrm,%dat)
{
if (%dat $= "")
%dat = BaseProjectile;
%p1 = new TracerProjectile()
{
dataBlock = %dat;
initialDirection = %nrm;
initialPosition = %pos;
};
}
//loading system
if ($mpm_AE != 1)
{
$mpm_load[$mpm_loads] = Mpm_AREP_Load;
$mpm_loads++;
$mpm_load[$mpm_loads] = Mpm_ACLK_Load;
$mpm_loads++;
$mpm_load[$mpm_loads] = Mpm_ADIS_Load;
$mpm_loads++;
$mpm_load[$mpm_loads] = Mpm_AESP_Load;
$mpm_loads++;
$mpm_load[$mpm_loads] = Mpm_AMOR_Load;
$mpm_loads++;
$mpm_AE = 1;
}
//Loads
datablock ItemData(Mpm_AREP_Load):Mpm_Base_Load
{
slot = 0;
cost = 25;
name = "[AID] Repair Pulse";
friendly = 1;
missile = Mpm_B_MIS4;
};
datablock ItemData(Mpm_ACLK_Load):Mpm_Base_Load
{
slot = 0;
cost = 30;
name = "[AID] Cloak Pulse";
friendly = 1;
missile = Mpm_B_MIS4;
};
datablock ItemData(Mpm_ADIS_Load):Mpm_Base_Load
{
slot = 0;
cost = 25;
name = "[AID] Dissasemble Pulse";
friendly = 0;
missile = Mpm_B_MIS4;
};
datablock ItemData(Mpm_AESP_Load):Mpm_Base_Load
{
slot = 0;
cost = 50;
name = "[AID] Electo Static Pulse";
friendly = 0;
missile = Mpm_B_MIS4;
};
datablock ItemData(Mpm_AMOR_Load):Mpm_Base_Load
{
slot = 0;
cost = 50;
name = "[AID] Morph Pulse";
friendly = 0;
missile = Mpm_B_MIS4;
};
function Mpm_AREP_Load::Explode(%data,%p,%pos)
{
if (IsObject(%p))
{
Aidpulse(%pos,%p.owner,0);
}
}
function Mpm_ACLK_Load::Explode(%data,%p,%pos)
{
if (IsObject(%p))
{
Aidpulse(%pos,%p.owner,1);
}
}
function Mpm_ADIS_Load::Explode(%data,%p,%pos)
{
if (IsObject(%p))
{
Aidpulse(%pos,%p.owner,2);
}
}
function Mpm_AESP_Load::Explode(%data,%p,%pos)
{
if (IsObject(%p))
{
Aidpulse(%pos,%p.owner,3);
}
}
function Mpm_AMOR_Load::Explode(%data,%p,%pos)
{
if (IsObject(%p))
{
Aidpulse(%pos,%p.owner,4);
}
}
//Shockwaves
datablock ShockwaveData(RepairWave) {
className = "ShockwaveData";
scale = "1 1 1";
delayMS = "0";
delayVariance = "0";
lifetimeMS = "10000";
lifetimeVariance = "0";
width = "1";
numSegments = "60";
numVertSegments = "30";
velocity = "10";
height = "20";
verticalCurve = "5";
acceleration = "1";
times[0] = "0";
times[1] = "0.25";
times[2] = "0.9";
times[3] = "1";
colors[0] = "1.000000 0.200000 0.200000 1.000000"; //1.0 0.9 0.9
colors[1] = "1.000000 0.200000 0.200000 1.000000"; //0.6 0.6 0.6
colors[2] = "1.000000 0.200000 0.200000 1.000000"; //0.6 0.6 0.6
colors[3] = "1.000000 0.200000 0.200000 0.000000";
texture[0] = "special/redbump2";
texture[1] = "special/shockwave4"; //gradient";
texWrap = "1";
is2D = "0";
mapToTerrain = "0";
orientToNormal = "1";
renderBottom = "1";
renderSquare = "0";
};
datablock ShockwaveData(CloakWave):RepairWave
{
colors[0] = "1 1 1 1";
colors[1] = "1 1 1 1";
colors[2] = "1 1 1 1";
colors[3] = "1 1 1 0";
texture[0] = "special/cloakTexture";
texture[1] = "special/shockwave4";
texWrap = "5";
};
datablock ShockwaveData(DisWave):RepairWave
{
colors[0] = "0.2 0.2 1 1";
colors[1] = "0.2 0.2 1 1";
colors[2] = "0.2 0.2 1 1";
colors[3] = "0.2 0.2 1 0";
texture[0] = "special/shockwave5";
texture[1] = "special/shockwave4";
texWrap = "1";
};
datablock ShockwaveData(EspWave):RepairWave
{
colors[0] = "0.8 0.2 1 1";
colors[1] = "0.8 0.2 1 1";
colors[2] = "0.8 0.2 1 1";
colors[3] = "0.8 0.2 1 0";
texture[0] = "special/shockwave5";
texture[1] = "special/shockwave4";
texWrap = "1";
};
datablock ShockwaveData(MORWave):RepairWave
{
colors[0] = "0.8 1 0.2 1";
colors[1] = "0.8 1 0.2 1";
colors[2] = "0.8 1 0.2 1";
colors[3] = "0.8 1 0.2 0";
texture[0] = "special/shockwave5";
texture[1] = "special/shockwave4";
texWrap = "1";
};
//Emitters
datablock ParticleData(RepairWave_P)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
lifetimeMS = 10000;
lifetimeVarianceMS = 0;
constantAcceleration = 0.1;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
windcoefficient = 0;
textureName = "special/redflare";
colors[0] = "1 0.2 0.2 1";
colors[1] = "1 0.2 0.2 1";
colors[2] = "1 0.2 0.2 1";
colors[3] = "1 0.2 0.2 0";
sizes[0] = 1;
sizes[1] = 2;
sizes[2] = 4;
sizes[3] = 5;
times[0] = "0";
times[1] = "0.25";
times[2] = "0.9";
times[3] = "1";
};
datablock ParticleData(CloakWave_P):RepairWave_P
{
textureName = "flarebase";
constantAcceleration = 0.1;
colors[0] = "1 1 1 1";
colors[1] = "1 1 1 1";
colors[2] = "1 1 1 1";
colors[3] = "1 1 1 0";
};
datablock ParticleData(DISWave_P):RepairWave_P
{
textureName = "flarebase";
constantAcceleration = 0.1;
colors[0] = "0.2 0.2 1 1";
colors[1] = "0.2 0.2 1 1";
colors[2] = "0.2 0.2 1 1";
colors[3] = "0.2 0.2 1 0";
};
datablock ParticleData(ESPWave_P):RepairWave_P
{
textureName = "flarebase";
constantAcceleration = 0.1;
colors[0] = "0.8 0.2 1 1";
colors[1] = "0.8 0.2 1 1";
colors[2] = "0.8 0.2 1 1";
colors[3] = "0.8 0.2 1 0";
};
datablock ParticleData(MORWave_P):RepairWave_P
{
textureName = "flarebase";
constantAcceleration = 0.1;
colors[0] = "0.8 1 0.2 1";
colors[1] = "0.8 1 0.2 1";
colors[2] = "0.8 1 0.2 1";
colors[3] = "0.8 1 0.2 0";
};
datablock ParticleEmitterData(RepairWave_E)
{
lifetimeMS = 1000;
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 0;
ejectionoffset = 5;
thetaMin = 0.0;
thetaMax = 180.0;
phiReferenceVel = "0";
phiVariance = "360";
orientParticles = false;
orientOnVelocity = false;
particles = "RepairWave_P";
};
datablock ParticleEmitterData(CLOAKWave_E):RepairWave_E
{
lifetimeMS = 1000;
ejectionPeriodMS = 1;
ejectionVelocity = 10;
ejectionoffset = 5;
velocityVariance = 0;
particles = "CloakWave_P";
thetaMin = 0.0;
thetaMax = 180.0;
phiReferenceVel = "0";
phiVariance = "360";
};
datablock ParticleEmitterData(DISWave_E):RepairWave_E
{
lifetimeMS = 1000;
ejectionPeriodMS = 1;
ejectionVelocity = 10;
ejectionoffset = 5;
velocityVariance = 0;
particles = "DISWave_P";
thetaMin = 0.0;
thetaMax = 180.0;
phiReferenceVel = "0";
phiVariance = "360";
};
datablock ParticleEmitterData(ESPWave_E):RepairWave_E
{
lifetimeMS = 1000;
ejectionPeriodMS = 1;
ejectionVelocity = 10;
velocityVariance = 0;
ejectionoffset = 5;
particles = "ESPWave_P";
thetaMin = 0.0;
thetaMax = 180.0;
phiReferenceVel = "0";
phiVariance = "360";
};
datablock ParticleEmitterData(MORWave_E):RepairWave_E
{
lifetimeMS = 1000;
ejectionPeriodMS = 1;
ejectionVelocity = 10;
velocityVariance = 0;
ejectionoffset = 5;
particles = "MORWave_P";
thetaMin = 0.0;
thetaMax = 180.0;
phiReferenceVel = "0";
phiVariance = "360";
};
datablock ExplosionData(RepairPulseExplosion):BaseExplosion //From blast.cs
{
emitter[0] = "RepairWave_E";
Shockwave = "RepairWave";
};
datablock ExplosionData(CloakPulseExplosion):BaseExplosion //From blast.cs
{
emitter[0] = "CloakWave_E";
Shockwave = "CloakWave";
};
datablock ExplosionData(DisPulseExplosion):BaseExplosion //From blast.cs
{
emitter[0] = "DISWave_E";
Shockwave = "DisWave";
};
datablock ExplosionData(ESPPulseExplosion):BaseExplosion //From blast.cs
{
emitter[0] = "ESPWave_E";
Shockwave = "ESPWave";
};
datablock ExplosionData(MORPulseExplosion):BaseExplosion //From blast.cs
{
emitter[0] = "MORWave_E";
Shockwave = "MORWave";
};
datablock TracerProjectileData(RepairPulseProjectile):BaseProjectile
{
Explosion = "RepairPulseExplosion";
};
datablock TracerProjectileData(CloakPulseProjectile):BaseProjectile
{
Explosion = "CloakPulseExplosion";
};
datablock TracerProjectileData(DisPulseProjectile):BaseProjectile
{
Explosion = "DisPulseExplosion";
};
datablock TracerProjectileData(ESPPulseProjectile):BaseProjectile
{
Explosion = "ESPPulseExplosion";
};
datablock TracerProjectileData(MORPulseProjectile):BaseProjectile
{
Explosion = "MORPulseExplosion";
};
function Aidpulse(%pos,%owner,%type,%nrm)
{
schedule(200,0,"Serverplay3D",FlashGrenadeExplosionSound,%pos);
%types = "RepairPulseProjectile CloakPulseProjectile DisPulseProjectile ESPPulseProjectile MORPulseProjectile";
%proj = GetWord(%types,%type);
%nrm = !%nrm ? "0 0 -1" : %nrm;
shockwave(%pos,%nrm,%proj);
%waveblock = %proj.explosion.shockwave;
%accel = %waveblock.acceleration; //accel of wave
%speed = %waveblock.velocity; //speed of wave
%mtime = %waveblock.lifetimeMS/1000; //time the wave lasts
%lastdist = 0;
%checks = %mtime/2; //2 per second
AidPulseWaved(%pos,%mtime,%speed,%accel,%waveblock,%owner);
Cancel(%owner.resetmorphsch);
%owner.resetmorphsch = Schedule(%mtime*1000+5000,%owner,"resetmorphsize",%owner);
for (%i = 1;%i<20;%i++)
{
%time = %i/2;
%dist = %time*%speed+1/2 * mPow(%time,2)*%accel+10;
schedule(%time*1000,0,"AidpulseWaver",%pos,%dist,%lastdist-2,%waveblock,%owner);
%lastdist = %dist;
}
}
function solveadist(%accel,%speed,%dist)
{
%awn = mSolveQuadratic(%accel/2,%speed,-1*%dist);
if (getWord(%awn,0) <0 || getWord(%awn,1) > 0)
return 0;
else
return -1*getWord(%awn,1);
}
function AidPulseWaved(%pos,%time,%speed,%accel,%wave,%owner)
{
%area = %time*%speed+1/2 * mPow(%time,2)*%accel+10;
InitContainerRadiusSearch(%pos, %area, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType );
while ((%targetObject = containerSearchNext()) != 0)
{
%dist = containerSearchCurrRadDamageDist();
%ttime = solveadist(%accel,%speed,%dist-10);
if (%ttime != 0 || %ttime < %time)
%wave.schedule(%ttime*1000,"AidEffect",%targetobject,%owner,%pos);
}
}
function AidpulseWaver(%pos,%area,%lastar,%wave,%owner)
{
InitContainerRadiusSearch(%pos, %area, $TypeMasks::VehicleObjectType | $TypeMasks::PlayerObjectType |$TypeMasks::ItemObjectType | $TypeMasks::CorpseObjectType );
while ((%targetObject = containerSearchNext()) != 0)
{
%dist = containerSearchCurrRadDamageDist();
if (%dist > %area || %dist < %lastar)
continue;
%wave.AidEffect(%targetobject,%owner,%pos);
}
}
function RepairWave::AidEffect(%block,%obj,%owner,%pos)
{
if (!isObject(%obj) || %obj.isforceField())
return "";
%obj.playShieldEffect("1 1 1");
%obj.setDamageLevel(0);
}
function CloakWave::AidEffect(%block,%obj,%owner,%pos)
{
if (!isObject(%obj) || %obj.isforceField())
return "";
Cancel(%obj.uncloaksch);
%obj.setCloaked(True);
%obj.uncloaksch = %obj.schedule(60000,"setCloaked",False);
}
function DisWave::AidEffect(%block,%obj,%owner,%Pos)
{
if (%obj.isRemoved || !isObject(%owner) || !isObject(%obj))
return;
%dataBlockName = %obj.getDataBlock().getName();
if (%dataBlockName $= "StationInventory" ||
%dataBlockName $= "GeneratorLarge" ||
%dataBlockName $= "SolarPanel" ||
%dataBlockName $= "SensorMediumPulse" ||
%dataBlockName $= "SensorLargePulse")
if (%obj.deployed != true)
return;
if ($reverseDeployItem[%obj.getDataBlock().getName()] $= "")
return;
if (%obj.team != %owner.team &&
!(%owner.isAdmin || %owner.isSuperAdmin))
return;
if ($Host::OnlyOwnerCascade == 1 &&
%obj.getOwner() != %owner &&
!(%owner.isAdmin || %owner.isSuperAdmin))
return;
%obj.getDataBlock().disassemble(%owner, %obj); // Run Item Specific code.
}
function ESPWave::AidEffect(%block,%obj,%owner,%pos)
{
if (!isObject(%obj))
return "";
%hadsch = %obj.uncloacksch ? 1 : 0;
Cancel(%obj.uncloaksch);
if (!%obj.isforcefield())
%obj.setCloaked(FALSE);
Cancel(%obj.unemplockschd);
if (%obj.isVehicle())
vehemplock(%obj);
else if (%obj.isPlayer())
PlayerEmpLock(%obj);
else if (%obj.getDatablock().maxEnergy !$= "")
{
if (%obj.getDataBlock().className $= "Generator" && %obj.lastState)
{
if (!%hadsch)
toggleGenerator(%obj,0);
%obj.unemplockschd = schedule(30000,%obj," toggleGenerator",%obj,0);
}
%obj.setEnergyLevel(0);
}
}
function MORWave::AidEffect(%block,%obj,%owner,%pos)
{
if (%obj.isRemoved ||
!isObject(%owner) ||
!isObject(%obj) ||
%obj.isPLayer() ||
%obj.isVehicle())
return;
if (!(deployables.isMember(%obj)))
return;
%dataBlockName = %obj.getDataBlock().getName();
if (%dataBlockName $= "StationInventory" ||
%dataBlockName $= "GeneratorLarge" ||
%dataBlockName $= "SolarPanel" ||
%dataBlockName $= "SensorMediumPulse" ||
%dataBlockName $= "SensorLargePulse")
if (%obj.deployed != true)
return;
if (%obj.team != %owner.team &&
!(%owner.isAdmin || %owner.isSuperAdmin))
return;
if ($Host::OnlyOwnerCascade == 1 &&
%obj.getOwner() != %owner &&
!(%owner.isAdmin || %owner.isSuperAdmin))
return;
Cancel(%obj.unmorphsch);
%obj.unmorphsch = Schedule(30000,%obj,"ResetMorphObject",%obj);
if (%obj.morphed)
return;
%obj.oldcenter = %obj.getEdge("0 0 0");
%obj.oldrealsize = %obj.getrealSize();
%obj.morphed = 1;
%size = %owner.morphpulsesize ? %owner.morphpulsesize : 0.1;
%scale = VectorScale("1 1 1",%size);
%offset = VectorMultiply(VectorSub(%obj.getEdge("0 0 0"),%pos),%scale);
%obj.setRealSize(VectorMultiply(%obj.getRealSize(),%scale));
%obj.setEdge(VectorAdd(%pos,%offset),"0 0 0");
if (!%obj.isforcefield())
%obj.startfade(500,0,0);
if (isObject(%obj.pzone))
{
%obj.pzone.setScale(%Obj.getScale);
%obj.pzone.setTransform(%obj.getTransform());
}
if (isObject(%obj.emitter))
{
%obj.emitter.oldsize = %obj.getScale();
%obj.emitter.setScale(VectorScale(%obj.emitter.getScale(),%size));
%obj.emitter.setTransform(%obj.getTransform());
}
if (isObject(%obj.trigger))
{
%obj.trigger.oldsize = %obj.getScale();
%obj.trigger.setScale(VectorScale(%obj.trigger.getScale(),%size));
%obj.trigger.setTransform(%obj.getTransform());
}
}
//ESP functions
function vehemplock(%vehicle)
{
Cancel(%vehicle.unemplockschd);
Cancel(%vehicle.lockff.unemplockschd);
%vehicle.setFrozenState(true);
%vehicle.zapObject();
forceFieldLock(%vehicle);
%vehicle.unemplockschd = Schedule(30000,%vehicle,"vehUnEmpLock",%vehicle);
%vehicle.lockff.unemplockschd = %vehicle.lockff.Schedule(30000,"delete");
}
function vehUnEmpLock(%vehicle)
{
Cancel(%vehicle.unemplockschd);
Cancel(%vehicle.lockff.unemplockschd);
%vehicle.lockff.delete();
%vehicle.setFrozenState(false);
}
function PlayerEmpLock(%player)
{
Cancel(%player.unemplockschd);
Cancel(%player.lockff.unemplockschd);
Cancel(%player.lock.unemplockschd);
if (!%player.isemped)
{
%lock = new StaticShape()
{
dataBlock = SelectionPad;
scale = "0.01 0.01 0.01";
};
%lock.startFade(0,0,1);
%vec = VectorNormalize(%player.getVelocity());
%vec = (VectorLen(%vec)>0.1) ? %vec : "0 0 1";
%center = %player.getEdge("0 0 0");
%rot = fullrot(%vec,VectorCross(%player.getEyeVector(),%vec));
%player.setTransform(%player.getEdge("0 0 -1") SPC %rot);
%player.setEdge(%center,"0 0 0");
%lock.setTransform(getWords(%player.getTransform(),0,2) SPC %rot);
%lock.mountObject(%player,0);
%lock.player = %player;
%player.emplock = %lock;
%player.isemped = 1;
%player.zapObject();
forceFieldLock(%player);
}
%player.unemplockschd = Schedule(30000,%player,"PlayerUnEmpLock",%player);
if (isObject(%player.lock))
%player.lock.unemplockschd = %player.lock.Schedule(30000,"delete");
if (isObject(%player.lockff))
%player.lockff.unemplockschd = %player.lockff.Schedule(30000,"delete");
}
function PlayerUnEmpLock(%player)
{
%player.isemped = 0;
Cancel(%player.unemplockschd);
Cancel(%player.lockff.unemplockschd);
Cancel(%player.lock.unemplockschd);
%player.lockff.delete();
%player.unMount();
if (isObject(%player.emplock))
%player.emplock.delete();
}
function forceFieldLock(%obj)
{
if (!isObject(%obj.lockff))
{
%ff = new ForceFieldBare() {
dataBlock = DeployedForceField5;
scale = "1 1 1";
};
%ff.noSlow = true;
// Eolk - needed a fix here to prevent console spam...
if(isObject(%ff.pzone))
%ff.pzone.delete();
%ff.pzone = "";
%obj.lockff = %ff;
%ff.obj = %obj;
%ff.setScale(%obj.getRealSize());
%ff.setTransform(%obj.getEdge("-1 -1 -1") SPC %Obj.getRotation());
}
}
//Morph functions
function ResetMorphObject(%obj)
{
Cancel(%obj.unmorphsch);
if (!%obj.isforcefield())
%obj.startfade(500,0,0);
%obj.setRealSize(%obj.oldrealsize);
%obj.setEdge(%obj.oldcenter,"0 0 0");
if (isObject(%obj.pzone))
{
%obj.pzone.setScale(%Obj.getScale);
%obj.pzone.setTransform(%obj.getTransform());
}
if (isObject(%obj.emitter))
{
%obj.emitter.setTransform(%obj.getTransform());
%obj.emitter.setScale(%obj.trigger.oldsize);
}
if (isObject(%obj.trigger))
{
%obj.trigger.setTransform(%obj.getTransform());
%obj.trigger.setScale(%obj.trigger.oldsize);
}
%obj.oldrealsize = "";
%obj.oldcenter = "";
%obj.morphed = "";
}
function resetmorphsize(%owner)
{
%size = (getRandom()*0.9+0.1);
%dir = (Getrandom()*2 > 1);
%owner.morphpulsesize = %dir ? %size : 1+%size+getRandom()*3;
}

View file

@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////
// VARIABLE DEFAULTS . CS
/////////////////////////////////////////////////////////
// This file overrides any important variables with blank values.
// Just for people who like to drop mods in then play them
// immediately after without setting up any preferences.
// ONLY PUT VARIABLES THAT ARE INTRODUCED BY ACCM IN HERE!
/////////////////////////////////////////////////////////
// CLIENT SAVING VARIABLES
/////////////////////////////////////////////////////////
if($Host::ClientSaving $= "")
$Host::ClientSaving = 1;
if($Host::MaxClientSaves $= "")
$Host::MaxClientSaves = 10;
if($Host::MaxPieceVote $= "")
$Host::MaxPieceVote = 400;
/////////////////////////////////////////////////////////
// DEPLOYABLE VARIABLES
/////////////////////////////////////////////////////////
if($Host::AntidoteStationMaxAntidotes $= "")
$Host::AntidoteStationMaxAntidotes = 20;
/////////////////////////////////////////////////////////
// ZOMBIE VARIABLES
/////////////////////////////////////////////////////////
if($Host::MaxZombies $= "")
$Host::MaxZombies = 35;
/////////////////////////////////////////////////////////
// CHAT VARIABLES
/////////////////////////////////////////////////////////
if($Host::ACCMChatLogging $= "")
$Host::ACCMChatLogging = 1;
if($Host::ACCMConnectionLogging $= "")
$Host::ACCMConnectionLogging = 1;
if($Host::ACCMEchoChat $= "")
$Host::ACCMEchoChat = 1;
if($Host::AllowKeeperPlayerVotes $= "")
$Host::AllowKeeperPlayerVotes = 1;
if($Host::KeepersGetMakerAbility $= "")
$Host::KeepersGetMakerAbility = 1;
if($Host::ObserversCannotChat $= "")
$Host::ObserversCannotChat = 1;
/////////////////////////////////////////////////////////
// MISC VARIABLES
/////////////////////////////////////////////////////////
if($Host::LockedTeams $= "")
$Host::LockedTeams = 0;
if($Host::NoInfection $= "")
$Host::NoInfection = 0;
if($Host::SADProtection $= "")
$Host::SADProtection = 1;
/////////////////////////////////////////////////////////

219
Scripts/InfectionGame.cs Normal file
View file

@ -0,0 +1,219 @@
// DisplayName = Infection
//--- GAME RULES BEGIN ---
// Build a Base or use Map bases.
// Defend your territory from the horde of undead.
// Either contain or destroy the Zombie infection.
// -25 points per team kill.
// -10 points per death or suicide.
//--- GAME RULES END ---
// Get Rid of those Underpowered weapons.
$InvBanList[Infection, "KriegRifle"] = 1;
$InvBanList[Infection, "PBC"] = 1;
// Infection Game
function InfectionGame::initGameVars(%game)
{
%game.SCORE_PER_SUICIDE = -10;
%game.SCORE_PER_TEAMKILL = -25;
%game.SCORE_PER_DEATH = -10;
%game.SCORE_PER_KILL = 0;
}
package InfectionGame {
function InfectionGame::timeLimitReached(%game)
{
logEcho("game over (timelimit)");
%game.gameOver();
cycleMissions();
}
function InfectionGame::scoreLimitReached(%game)
{
logEcho("game over (scorelimit)");
%game.gameOver();
cycleMissions();
}
function InfectionGame::gameOver(%game)
{
DefaultGame::gameOver(%game);
messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" );
cancel(%game.timeThread);
messageAll('MsgClearObjHud', "");
for(%i = 0; %i < ClientGroup.getCount(); %i ++) {
%client = ClientGroup.getObject(%i);
%game.resetScore(%client);
}
}
function InfectionGame::clientMissionDropReady(%game, %client)
{
messageClient(%client, 'MsgClientReady',"", %game.class);
%game.resetScore(%client);
for(%i = 1; %i <= %game.numTeams; %i++)
{
$Teams[%i].score = 0;
messageClient(%client, 'MsgInfectionAddTeam', "", %i, %game.getTeamName(%i), $flagStatus[%i], $TeamScore[%i]);
}
messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName );
DefaultGame::clientMissionDropReady(%game, %client);
}
function InfectionGame::assignClientTeam(%game, %client, %respawn)
{
DefaultGame::assignClientTeam(%game, %client, %respawn);
messageClient(%client, 'MsgCheckTeamLines', "", %client.team);
}
function InfectionGame::recalcScore(%game, %cl)
{
%killValue = %cl.kills * %game.SCORE_PER_KILL;
%deathValue = %cl.deaths * %game.SCORE_PER_DEATH;
if (%killValue - %deathValue == 0)
%killPoints = 0;
else
%killPoints = (%killValue * %killValue) / (%killValue - %deathValue);
if(!isDemo())
{
%cl.offenseScore = %killPoints +
%cl.suicides * %game.SCORE_PER_SUICIDE +
%cl.teamKills * %game.SCORE_PER_TEAMKILL +
%cl.vehicleScore + %cl.vehicleBonus;
%cl.defenseScore = %cl.genRepairs * %game.SCORE_PER_REPAIR_GEN +
%cl.returnPts;
}
%cl.score = mFloor(%cl.offenseScore + %cl.defenseScore + (%cl.zkills * $zombie::killpoints));
%game.recalcTeamRanks(%cl);
}
function InfectionGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement)
{
if( isObject( %implement ) )
{
if( %implement.getDataBlock().getName() $= "AssaultPlasmaTurret" || %implement.getDataBlock().getName() $= "BomberTurret" ) // gunner
%clKiller = %implement.vehicleMounted.getMountNodeObject(1).client;
else if(%implement.getDataBlock().catagory $= "Vehicles") // pilot
%clKiller = %implement.getMountNodeObject(0).client;
}
if(%game.testTurretKill(%implement))
%game.awardScoreTurretKill(%clVictim, %implement);
else if (%game.testKill(%clVictim, %clKiller))
{
%value = %game.awardScoreKill(%clKiller);
%game.shareScore(%clKiller, %value);
%game.awardScoreDeath(%clVictim);
if (%game.testEscortAssist(%clVictim, %clKiller))
%game.awardScoreEscortAssist(%clKiller);
}
else
{
if (%game.testSuicide(%clVictim, %clKiller, %damageType))
{
%game.awardScoreSuicide(%clVictim);
}
else
{
if (%game.testTeamKill(%clVictim, %clKiller))
%game.awardScoreTeamKill(%clVictim, %clKiller);
}
}
}
function InfectionGame::resetDontScoreTimer(%game, %team)
{
$dontScoreTimer[%team] = false;
}
function InfectionGame::resetScore(%game, %client)
{
%client.offenseScore = 0;
%client.kills = 0;
%client.deaths = 0;
%client.suicides = 0;
%client.teamKills = 0;
%client.vehicleScore = 0;
%client.vehicleBonus = 0;
%client.defenseScore = 0;
%client.genRepairs = 0;
%client.returnPts = 0;
%client.score = 0;
}
function InfectionGame::objectRepaired(%game, %obj, %objName)
{
%item = %obj.getDataBlock().getName();
switch$ (%item)
{
case generatorLarge :
%game.genOnRepaired(%obj, %objName);
case sensorMediumPulse :
}
%obj.wasDisabled = false;
}
function InfectionGame::genOnRepaired(%game, %obj, %objName)
{
if (%game.testValidRepair(%obj))
{
%repairman = %obj.repairedBy;
%game.awardScoreGenRepair(%obj.repairedBy);
}
}
function InfectionGame::awardScoreGenRepair(%game, %cl)
{
%cl.genRepairs++;
if (%game.SCORE_PER_REPAIR_GEN != 0)
{
messageClient(%cl, 'msgGenRep', '\c0You received a %1 point bonus for repairing a generator.', %game.SCORE_PER_REPAIR_GEN);
}
%game.recalcScore(%cl);
}
function InfectionGame::enterMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
%player.client.outOfBounds = false;
messageClient(%player.client, 'EnterMissionArea', '\c1You are back in the mission area.');
}
function InfectionGame::leaveMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
%player.client.outOfBounds = true;
messageClient(%player.client, 'MsgLeaveMissionArea', '\c1You have left the mission area.~wfx/misc/warning_beep.wav');
logEcho(%player.client.nameBase@" (pl "@%player@"/cl "@%player.client@") left mission area");
}
function InfectionGame::testKill(%game, %victimID, %killerID)
{
return ((%killerID !=0) && (%victimID.team != %killerID.team));
}
function InfectionGame::awardScoreKill(%game, %killerID)
{
%killerID.kills++;
%game.recalcScore(%killerID);
return %game.SCORE_PER_KILL;
}
};

194
Scripts/JTLmeteorStorm.cs Normal file
View file

@ -0,0 +1,194 @@
// JTLmeteorStorm.cs
//
// This script (C) 2002 by JackTL
//
// Use, modify, but give credit
//
// Functions:
//
// JTLMeteorStorm(obj,forcePlayer[1/0],maxRad,numFb,dropAlt,dropAltVariance,dbName,dbType,timeOutMS,randomRot[1/0],randomPulse[1/0],maxPulse,speedVec,offsetSpeedVec[1/0])
//
datablock ParticleData(JTLMeteorStormFireballParticle) {
dragCoeffiecient = 0.0;
gravityCoefficient = -0.2;
inheritedVelFactor = 0.0;
lifetimeMS = 350;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -160.0;
spinRandomMax = 160.0;
animateTexture = true;
framesPerSec = 15;
animTexName[0] = "special/Explosion/exp_0016";
animTexName[1] = "special/Explosion/exp_0018";
animTexName[2] = "special/Explosion/exp_0020";
animTexName[3] = "special/Explosion/exp_0022";
animTexName[4] = "special/Explosion/exp_0024";
animTexName[5] = "special/Explosion/exp_0026";
animTexName[6] = "special/Explosion/exp_0028";
animTexName[7] = "special/Explosion/exp_0030";
animTexName[8] = "special/Explosion/exp_0032";
colors[0] = "1.0 0.7 0.5 1.0";
colors[1] = "1.0 0.5 0.2 1.0";
colors[2] = "1.0 0.25 0.1 0.0";
sizes[0] = 3.0;
sizes[1] = 1.0;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(JTLMeteorStormFireballEmitter) {
ejectionPeriodMS = 5;
periodVarianceMS = 1;
ejectionVelocity = 0.25;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 30.0;
particles = "JTLMeteorStormFireballParticle";
};
datablock GrenadeProjectileData(JTLMeteorStormFireball) {
projectileShapeName = "weapon_chaingun_ammocasing.dts";
emitterDelay = -1;
directDamage = 0;
directDamageType = $DamageType::Meteor;
hasDamageRadius = true;
indirectDamage = 0.5;
damageRadius = 7.5;
radiusDamageType = $DamageType::Meteor;
kickBackStrength = 1750;
explosion = PlasmaBoltExplosion;
splash = PlasmaSplash;
baseEmitter = JTLMeteorStormFireballEmitter;
armingDelayMS = 50;
grenadeElasticity = 0.15;
grenadeFriction = 0.4;
drag = 0.1;
gravityMod = 0.0;
sound = GrenadeProjectileSound;
hasLight = true;
lightRadius = 20.0;
lightColor = "1 1 0.5";
};
function JTLMeteorStormFireball::onExplode(%data,%proj,%pos,%mod) {
if (%data.hasDamageRadius)
RadiusExplosion(%proj,%pos,%data.damageRadius,%data.indirectDamage,%data.kickBackStrength,%proj.sourceObject,%data.radiusDamageType);
%pos = %proj.getPosition();
%surface = containerRayCast(vectorAdd(%pos,"0 0 0.1"),vectorAdd(%pos,"0 0 -1"),-1,%proj);
%tObj = firstWord(%surface);
if (isObject(%tObj))
%tObj.damage(%proj,%pos,0.4,%proj.getDataBlock().directDamageType);
// ionStormBeam(vectorAdd(%pos,"0 0" SPC $IonStorm::Height));
}
function JTLMeteorStorm (%obj,%forcePlayer,%maxRad,%numFb,%dropAlt,%dropAltVariance,%dbName,%dbType,%timeOutMS,%randomRot,%randomPulse,%maxPulse,%speedVec,%offsetSpeedVec,%createFB,%pos,%target) {
%pi = 3.1415926535897932384626433832795; // Whoa..
if (%createFB) {
if (%randomRot)
%rot = "0 0 1" SPC getRandom() * (%pi * 2);
else
%rot = "1 0 0 0";
%fb = new (%dbType) (JTLMeteor) {
dataBlock = %dbName;
position = %pos; // Needed for non-projectile types
initialPosition = %pos;
initialDirection = %speedVec;
// sourceObject = 0;
sourceSlot = 0;
vehicleObject = 0;
};
if (isObject(%target) && $JTLMeteorStormSeek == 1 && %dbType $= "SeekerProjectile")
%fb.setObjectTarget(%target);
%fb.setRotation(%rot);
if (%randomPulse) {
%pulse = getRandom() * %maxPulse;
%iPos = vectorNormalize((getRandom() * 2) - 1 SPC (getRandom() * 2) - 1 SPC (getRandom() * 2) - 1);
%iPos = vectorAdd(%pos,%iPos);
%iVec = vectorScale(vectorNormalize(getRandom() SPC getRandom() SPC getRandom()),%pulse);
// Fix this, not for projectiles
%fb.applyImpulse(%iPos,%iVec);
}
if (%dbType $= "Item")
%fb.setVelocity(%speedVec); // Needed for non-projectile types
MissionCleanup.add(%fb);
if (%timeOutMS) {
%fb.schedule(%timeOutMS,setDamageState,Destroyed);
%fb.schedule(%timeOutMS+1000,delete);
}
return;
}
if (%forcePlayer) {
%obj = %obj.player;
}
else {
if (%obj.getClassName() $= "GameConnection") {
%obj2 = %obj.getControlObject();
if (isObject(%obj2))
%obj = %obj2;
}
}
if (isObject(%obj)) {
if (%maxRad < 1)
%maxRad = 50;
if (%numFb < 1)
%numFb = 100;
if (%dropAlt < 1)
%dropAlt = 100;
if (%dropAltVariance < 1)
%dropAltVariance = 500;
if (!isObject(%dbName))
%dbName = "JTLMeteorStormFireball";
if (%dbType $= "" || %dbType $= "0")
%dbType = "GrenadeProjectile";
if (%speedVec $= "" || %speedVec $= "0")
%speedVec = "0 0 -2";
if (%maxPulse < 1)
%maxPulse = 4000;
%p = %obj.getWorldBoxCenter();
%x = getWord(%p,0);
%y = getWord(%p,1);
%z = getWord(%p,2);
for (%i = 0; %i < %numFb; %i++) {
%dVec = getRandom() * %pi * 2;
%dRad = getRandom() * %maxRad;
%dX =mSin(%dVec) * %dRad;
%dY =mCos(%dVec) * %dRad;
%dZ =%dropAlt + (getRandom() * %dropAltVariance);
if (%offsetSpeedVec) {
%v2 = vectorCross(vectorNormalize(%speedVec),"1 0 0");
%v3 = vectorCross(vectorNormalize(%speedVec),%v2);
%dPos = vectorAdd(%p,vectorScale(vectorNormalize(%speedVec),-%dZ));
%dPos = vectorAdd(%dPos,vectorScale(%v2,%dX));
%dPos = vectorAdd(%dPos,vectorScale(%v3,%dY));
}
else {
%dX = %x + %dX;
%dY = %y + %dY;
%dZ = %z + %dZ;
%dPos = %dX SPC %dY SPC %dZ;
}
JTLMeteorStorm(0,0,0,0,0,0,%dbName,%dbType,%timeOutMS,%randomRot,%randomPulse,%maxPulse,%speedVec,0,true,%dPos,%obj);
}
}
else {
error("-JTLMeteorStorm- no valid object.");
error("Usage: JTLMeteorStorm(obj,forcePlayer[1/0],maxRad,numFb,dropAlt,dropAltVariance,dbName,dbType,timeOutMS,randomRot[1/0],randomPulse[1/0],maxPulse,speedVec,offsetSpeedVec[1/0])");
}
}

616
Scripts/LobbyGui.cs Normal file
View file

@ -0,0 +1,616 @@
//------------------------------------------------------------------------------
//
// LobbyGui.cs
//
//------------------------------------------------------------------------------
$InLobby = false;
//------------------------------------------------------------------------------
function LobbyGui::onAdd( %this )
{
// Add the Player popup menu:
new GuiControl(LobbyPlayerActionDlg) {
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
setFirstResponder = "0";
modal = "1";
new ShellPopupMenu( LobbyPlayerPopup ) {
profile = "ShellPopupProfile";
position = "0 0";
extent = "0 0";
minExtent = "0 0";
visible = "1";
maxPopupHeight = "200";
noButtonStyle = "1";
};
};
}
//------------------------------------------------------------------------------
function LobbyGui::onWake( %this )
{
if ( !%this.initialized )
{
LobbyPlayerList.setSortColumn( $pref::Lobby::SortColumnKey );
LobbyPlayerList.setSortIncreasing( $pref::Lobby::SortInc );
%this.initialized = true;
}
$InLobby = true;
//pop any key maps
moveMap.pop();
if ( isObject( passengerkeys ) )
passengerKeys.pop();
if ( isObject( observerBlockMap ) )
observerBlockMap.pop();
if ( isObject( observerMap ) )
observerMap.pop();
$enableDirectInput = "0";
deactivateDirectInput();
LobbyMessageVector.attach(HudMessageVector);
LobbyMessageScroll.scrollToBottom();
updateLobbyPlayerList();
LobbyServerName.setText( $clServerName );
%headerStyle = "<font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ "><color:00DC00>";
%statusText = "<spop><spush>" @ %headerStyle @ "MISSION TYPE:<spop>" SPC $clMissionType
NL "<spush>" @ %headerStyle @ "MISSION:<spop>" SPC $clMissionName
NL "<spush>" @ %headerStyle @ "OBJECTIVES:<spop>";
for ( %line = 0; %this.objLine[%line] !$= ""; %line++ )
%statusText = %statusText NL "<lmargin:10>* <lmargin:24>" @ %this.objLine[%line];
LobbyStatusText.setText( %statusText );
fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function LobbyGui::onSleep( %this )
{
if ( %this.playerDialogOpen )
LobbyPlayerPopup.forceClose();
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "";
LobbyCancelBtn.setVisible( false );
LobbyStatusText.setText( "" );
$InLobby = false;
}
//------------------------------------------------------------------------------
function lobbyDisconnect()
{
MessageBoxYesNo( "CONFIRM", "Are you sure you want to leave this game?", "lobbyLeaveGame();", "" );
}
//------------------------------------------------------------------------------
function lobbyLeaveGame()
{
Canvas.popDialog( LobbyGui );
Disconnect();
}
//------------------------------------------------------------------------------
function lobbyReturnToGame()
{
Canvas.setContent( PlayGui );
}
//------------------------------------------------------------------------------
function LobbyChatEnter::onEscape( %this )
{
%this.setValue( "" );
}
//------------------------------------------------------------------------------
function LobbyChatEnter::send( %this )
{
%text = %this.getValue();
if ( %text $= "" )
%text = " ";
commandToServer( 'MessageSent', %text );
%this.setValue( "" );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::initColumns( %this )
{
%this.clear();
%this.clearColumns();
%this.addColumn( 0, " ", 24, 24, 24, "center" ); // Flag column
%this.addColumn( 6, "lobby_headset", 36, 36, 36, "headericon" ); // Voice Com column
%this.addColumn( 1, "Player", $pref::Lobby::Column1, 50, 200 );
if ( $clTeamCount > 1 )
%this.addColumn( 2, "Team", $pref::Lobby::Column2, 50, 200 );
%this.addColumn( 3, "Score", $pref::Lobby::Column3, 25, 200, "numeric center" );
%this.addColumn( 4, "Ping", $pref::Lobby::Column4, 25, 200, "numeric center" );
%this.addColumn( 5, "PL", $pref::Lobby::Column5, 25, 200, "numeric center" );
commandToServer( 'getScores' );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onColumnResize( %this, %col, %size )
{
$pref::Lobby::Column[%this.getColumnKey( %col )] = %size;
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onSetSortKey( %this, %key, %increasing )
{
$pref::Lobby::SortColumnKey = %key;
$pref::Lobby::SortInc = %increasing;
}
//------------------------------------------------------------------------------
function updateLobbyPlayerList()
{
if ( $InLobby )
{
// Let the server know we want an update:
commandToServer( 'getScores' );
schedule( 4000, 0, updateLobbyPlayerList );
}
}
//------------------------------------------------------------------------------
function lobbyUpdatePlayer( %clientId )
{
%player = $PlayerList[%clientId];
if ( !isObject( %player ) )
{
warn( "lobbyUpdatePlayer( " @ %clientId @ " ) - there is no client object with that id!" );
return;
}
// Build the text:
if ( %player.isSuperAdmin )
%tag = "SA";
else if ( %player.isAdmin )
%tag = "A";
else if ( %player.isZombieKeeper )
%tag = "ZK";
else if ( %player.isBot )
%tag = "B";
else
%tag = " ";
if ( %player.canListen )
{
if ( %player.voiceEnabled )
{
%voiceIcons = "lobby_icon_speak";
if ( %player.isListening )
%voiceIcons = %voiceIcons @ ":lobby_icon_listen";
}
else
%voiceIcons = %player.isListening ? "lobby_icon_listen" : "";
}
else
%voiceIcons = "shll_icon_timedout";
if ( $clTeamCount > 1 )
{
if ( %player.teamId == 0 )
%teamName = "Observer";
else
%teamName = $clTeamScore[%player.teamId, 0] $= "" ? "-" : $clTeamScore[%player.teamId, 0];
%text = %tag TAB %voiceIcons TAB %player.name TAB %teamName TAB %player.score TAB %player.ping TAB %player.packetLoss;
}
else
%text = %tag TAB %voiceIcons TAB %player.name TAB %player.score TAB %player.ping TAB %player.packetLoss;
if ( LobbyPlayerList.getRowNumById( %clientId ) == -1 )
LobbyPlayerList.addRow( %clientId, %text );
else
LobbyPlayerList.setRowById( %clientId, %text );
if ( $InLobby )
LobbyPlayerList.sort();
}
//------------------------------------------------------------------------------
function lobbyRemovePlayer( %clientId )
{
LobbyPlayerList.removeRowById( %clientId );
}
//------------------------------------------------------------------------------
function LobbyPlayerList::onRightMouseDown( %this, %column, %row, %mousePos )
{
// Open the action menu:
%clientId = %this.getRowId( %row );
LobbyPlayerPopup.player = $PlayerList[%clientId];
if ( LobbyPlayerPopup.player !$= "" )
{
LobbyPlayerPopup.position = %mousePos;
Canvas.pushDialog( LobbyPlayerActionDlg );
LobbyPlayerPopup.forceOnAction();
}
}
//------------------------------------------------------------------------------
function LobbyPlayerActionDlg::onWake( %this )
{
LobbyGui.playerDialogOpen = true;
fillPlayerPopupMenu();
}
//------------------------------------------------------------------------------
function LobbyPlayerActionDlg::onSleep( %this )
{
LobbyGui.playerDialogOpen = false;
}
//------------------------------------------------------------------------------
function LobbyPlayerPopup::onSelect( %this, %id, %text )
{
//the id's for these are used in DefaultGame::sendGamePlayerPopupMenu()...
//mute: 1
//admin: 2
//kick: 3
//ban: 4
//force observer: 5
//switch team: 6
switch( %id )
{
case 1: // Mute/Unmute
togglePlayerMute(%this.player.clientId);
case 2: // Admin
MessageBoxYesNo( "CONFIRM", "Are you sure you want to make " @ %this.player.name @ " an admin?",
"lobbyPlayerVote( VoteAdminPlayer, \"ADMIN player\", " @ %this.player.clientId @ " );" );
case 3: // Kick
MessageBoxYesNo( "CONFIRM", "Are you sure you want to kick " @ %this.player.name @ "?",
"lobbyPlayerVote( VoteKickPlayer, \"KICK player\", " @ %this.player.clientId @ " );" );
case 4: // Ban
MessageBoxYesNo( "CONFIRM", "Are you sure you want to ban " @ %this.player.name @ "?",
"lobbyPlayerVote( BanPlayer, \"BAN player\", " @ %this.player.clientId @ " );" );
case 5: // force observer
forceToObserver(%this.player.clientId);
case 6: //change team 1
changePlayersTeam(%this.player.clientId, 1);
case 7: //change team 2
changePlayersTeam(%this.player.clientId, 2);
case 8:
adminAddPlayerToGame(%this.player.clientId);
case 9: // enable/disable voice communication
togglePlayerVoiceCom( %this.player );
case 10:
confirmAdminListAdd( %this.player, false );
case 11:
confirmAdminListAdd( %this.player, true );
Canvas.popDialog( LobbyPlayerActionDlg );
}
}
function confirmAdminListAdd( %client, %super )
{
if( %super )
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server super admin list?", "toSuperList( " @ %client.clientId @ " );" );
else
MessageBoxYesNo( "CONFIRM", "Are you sure you want to add " @ %client.name @ " to the server admin list?", "toAdminList( " @ %client.clientId @ " );" );
}
function toSuperList( %client )
{
commandToServer( 'AddToSuperAdminList', %client );
}
function toAdminList( %client )
{
commandToServer( 'AddToAdminList', %client );
}
//------------------------------------------------------------------------------
function LobbyPlayerPopup::onCancel( %this )
{
Canvas.popDialog( LobbyPlayerActionDlg );
}
//------------------------------------------------------------------------------
function togglePlayerMute(%client)
{
commandToServer( 'togglePlayerMute', %client );
}
//------------------------------------------------------------------------------
function togglePlayerVoiceCom( %playerRep )
{
commandToServer( 'ListenTo', %playerRep.clientId, !%playerRep.voiceEnabled, true );
}
//------------------------------------------------------------------------------
function forceToObserver( %client )
{
commandToServer( 'forcePlayerToObserver', %client );
}
function AdminAddPlayerToGame(%client)
{
CommandToServer( 'clientAddToGame', %client );
}
//------------------------------------------------------------------------------
function changePlayersTeam(%client, %team)
{
commandToServer( 'changePlayersTeam', %client, %team);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function fillLobbyVoteMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.tourneyChoose = 0;
commandToServer( 'GetVoteMenu', LobbyVoteMenu.key );
}
//------------------------------------------------------------------------------
function fillLobbyTeamMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "team";
commandToServer( 'GetTeamList', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
function fillPlayerPopupMenu()
{
LobbyPlayerPopup.key++;
LobbyPlayerPopup.clear();
LobbyPlayerPopup.add(LobbyPlayerPopup.player.name, 0);
commandToServer( 'GetPlayerPopupMenu', LobbyPlayerPopup.player.clientId, LobbyPlayerPopup.key );
}
//------------------------------------------------------------------------------
function fillLobbyMissionTypeMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "type";
commandToServer( 'GetMissionTypes', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
function fillLobbyMissionMenu( %type, %typeName )
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "mission";
LobbyVoteMenu.missionType = %type;
LobbyVoteMenu.typeName = %typeName;
commandToServer( 'GetMissionList', LobbyVoteMenu.key, %type );
}
//------------------------------------------------------------------------------
function fillLobbyTimeLimitMenu()
{
LobbyVoteMenu.key++;
LobbyVoteMenu.clear();
LobbyVoteMenu.mode = "timeLimit";
commandToServer( 'GetTimeLimitList', LobbyVoteMenu.key );
LobbyCancelBtn.setVisible( true );
}
//------------------------------------------------------------------------------
addMessageCallback( 'MsgVoteItem', handleVoteItemMessage );
addMessageCallback( 'MsgPlayerPopupItem', handlePlayerPopupMessage );
addMessageCallback( 'MsgVotePassed', handleVotePassedMessage );
addMessageCallback( 'MsgVoteFailed', handleVoteFailedMessage );
addMessageCallback( 'MsgAdminPlayer', handleAdminPlayerMessage );
addMessageCallback( 'MsgAdminAdminPlayer', handleAdminAdminPlayerMessage );
addMessageCallback( 'MsgSuperAdminPlayer', handleSuperAdminPlayerMessage );
addMessageCallback( 'MsgAdminForce', handleAdminForceMessage );
//------------------------------------------------------------------------------
function handleAdminForceMessage()
{
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleAdminAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
%player.isAdmin = true;
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
%player.isAdmin = true;
alxPlay(VotePassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleSuperAdminPlayerMessage( %msgType, %msgString, %client )
{
%player = $PlayerList[%client];
if(%player)
{
%player.isSuperAdmin = true;
%player.isAdmin = true;
}
alxPlay(AdminForceSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleVoteItemMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %sort )
{
if ( %key != LobbyVoteMenu.key )
return;
%index = LobbyVoteMenu.rowCount();
LobbyVoteMenu.addRow( %index, detag( %voteText ) );
if ( %sort )
LobbyVoteMenu.sort( 0 );
$clVoteCmd[%index] = detag( %voteName );
$clVoteAction[%index] = detag( %voteActionMsg );
}
//------------------------------------------------------------------------------
function handlePlayerPopupMessage( %msgType, %msgString, %key, %voteName, %voteActionMsg, %voteText, %popupEntryId )
{
if ( %key != LobbyPlayerPopup.key )
return;
LobbyPlayerPopup.add( " " @ detag( %voteText ), %popupEntryId );
}
//------------------------------------------------------------------------------
function handleVotePassedMessage( %msgType, %msgString, %voteName, %voteText )
{
if ( $InLobby )
fillLobbyVoteMenu();
alxPlay(VotePassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function handleVoteFailedMessage( %msgType, %msgString, %voteName, %voteText )
{
if ( $InLobby )
fillLobbyVoteMenu();
alxPlay(VoteNotPassSound, 0, 0, 0);
}
//------------------------------------------------------------------------------
function lobbyVote()
{
%id = LobbyVoteMenu.getSelectedId();
%text = LobbyVoteMenu.getRowTextById( %id );
switch$ ( LobbyVoteMenu.mode )
{
case "": // Default case...
// Test for special cases:
switch$ ( $clVoteCmd[%id] )
{
case "JoinGame":
CommandToServer( 'clientJoinGame' );
schedule( 100, 0, lobbyReturnToGame );
return;
case "ChooseTeam":
commandToServer( 'ClientJoinTeam', -1, true );
schedule( 100, 0, lobbyReturnToGame );
return;
case "VoteTournamentMode":
LobbyVoteMenu.tourneyChoose = 1;
fillLobbyMissionTypeMenu();
return;
case "VoteMatchStart":
startNewVote( "VoteMatchStart" );
schedule( 100, 0, lobbyReturnToGame );
return;
case "MakeObserver":
commandToServer( 'ClientMakeObserver' );
schedule( 100, 0, lobbyReturnToGame );
return;
case "VoteChangeMission":
fillLobbyMissionTypeMenu();
return;
case "VoteChangeTimeLimit":
fillLobbyTimeLimitMenu();
return;
case "Addbot":
commandToServer( 'addBot' );
return;
}
case "team":
commandToServer( 'ClientJoinTeam', %id++ );
LobbyVoteMenu.reset();
return;
case "type":
fillLobbyMissionMenu( $clVoteCmd[%id], %text );
return;
case "mission":
if( !LobbyVoteMenu.tourneyChoose )
{
startNewVote( "VoteChangeMission",
%text, // Mission display name
LobbyVoteMenu.typeName, // Mission type display name
$clVoteCmd[%id], // Mission id
LobbyVoteMenu.missionType ); // Mission type id
}
else
{
startNewVote( "VoteTournamentMode",
%text, // Mission display name
LobbyVoteMenu.typeName, // Mission type display name
$clVoteCmd[%id], // Mission id
LobbyVoteMenu.missionType ); // Mission type id
LobbyVoteMenu.tourneyChoose = 0;
}
LobbyVoteMenu.reset();
return;
case "timeLimit":
startNewVote( "VoteChangeTimeLimit", $clVoteCmd[%id] );
LobbyVoteMenu.reset();
return;
}
startNewVote( $clVoteCmd[%id], $clVoteAction[%id] );
fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function LobbyVoteMenu::reset( %this )
{
%this.mode = "";
%this.tourneyChoose = 0;
LobbyCancelBtn.setVisible( false );
fillLobbyVoteMenu();
}
//------------------------------------------------------------------------------
function lobbyPlayerVote(%voteType, %actionMsg, %playerId)
{
startNewVote(%voteType, %playerId, 0, 0, 0, true);
fillLobbyVoteMenu();
}

View file

@ -0,0 +1,722 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Drone AI by Dondelium_X
// CCM v3.4
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
$Drone::DetectDist = 500;
$Drone::TurnImpulse = 123;
$Drone::FrdImpulse = 525;
//$Drone::TurnImpulse = 675 / 3;
//$Drone::FrdImpulse = 525 * 3;
$Drone::newTargetChance = "1 100";
$Drone::paths = 4;
$Drone::path[1,1] = "0 1500 1000";
$Drone::path[1,2] = "1500 0 1000";
$Drone::path[1,3] = "0 -1500 1000";
$Drone::path[1,4] = "-1500 0 1000";
$Drone::path[2,1] = "0 -1500 1000";
$Drone::path[2,2] = "-1500 0 1000";
$Drone::path[2,3] = "0 1500 1000";
$Drone::path[2,4] = "1500 0 1000";
$Drone::path[3,1] = "0 2500 750";
$Drone::path[3,2] = "0 2500 1250";
$Drone::path[3,3] = "0 -2500 1250";
$Drone::path[3,4] = "0 -2500 750";
$Drone::path[4,1] = "2500 0 750";
$Drone::path[4,2] = "2500 0 1250";
$Drone::path[4,3] = "-2500 0 1250";
$Drone::path[4,4] = "-2500 0 750";
//-----Manuver Index-----
$flightManuvers::Behind[0] = Immelman;
$flightManuvers::Behind[1] = HalfFlip;
$flightManuvers::Behind[2] = BreakRight;
$flightManuvers::Behind[3] = BreakLeft;
$flightManuvers::Behind[4] = BarrelRoll;
$flightManuvers::Behind[5] = WingWaggle;
$flightManuvers::Behind[6] = Reversal;
//-----Manuvers-----
//Immelman
$flightManuver::Points[Immelman] = 5; //This signifies how many points are in the manuver
$flightManuver::Point[Immelman,0] = "0 1 0 0 0 1"; //each point represents the 3 numbers of the vector of the desired forward vector,
$flightManuver::Point[Immelman,1] = "0 0 1 0 -1 0"; //and then the 3 numbers of the vector for the desired Up vector
$flightManuver::Point[Immelman,2] = "0 -1 0 0 0 -1";
$flightManuver::Point[Immelman,3] = "0 -1 0 1 0 0";
$flightManuver::Point[Immelman,4] = "0 -1 0 0 0 1";
//halfFlip
$flightManuver::Points[HalfFlip] = 3;
$flightManuver::Point[HalfFlip,0] = "0 1 0 0 0 1";
$flightManuver::Point[HalfFlip,1] = "0 0 1 0 -1 0";
$flightManuver::Point[HalfFlip,2] = "0 -1 0 0 0 -1";
//breakRight
$flightManuver::Points[BreakRight] = 3;
$flightManuver::Point[BreakRight,0] = "0 1 0 0 0 1";
$flightManuver::Point[BreakRight,1] = "0 1 0 1 0 0";
$flightManuver::Point[BreakRight,2] = "1 0 0 0 -1 0";
//BreakLeft
$flightManuver::Points[BreakLeft] = 3;
$flightManuver::Point[BreakLeft,0] = "0 1 0 0 0 1";
$flightManuver::Point[BreakLeft,1] = "0 1 0 -1 0 0";
$flightManuver::Point[BreakLeft,2] = "-1 0 0 0 -1 0";
//BarrelRoll
$flightManuver::Points[BarrelRoll] = 5;
$flightManuver::Point[BarrelRoll,0] = "0 1 0 0 0 1";
$flightManuver::Point[BarrelRoll,1] = "0 1 0 1 0 0";
$flightManuver::Point[BarrelRoll,2] = "0 1 0 0 0 -1";
$flightManuver::Point[BarrelRoll,3] = "0 1 0 -1 0 0";
$flightManuver::Point[BarrelRoll,4] = "0 1 0 0 0 1";
//WingWaggle
$flightManuver::Points[WingWaggle] = 4;
$flightManuver::Point[WingWaggle,0] = "0 1 0 0 0 1";
$flightManuver::Point[WingWaggle,1] = "-1 1 0 0 0 1";
$flightManuver::Point[WingWaggle,2] = "1 1 0 0 0 1";
$flightManuver::Point[WingWaggle,3] = "0 1 0 0 0 1";
//Reversal
$flightManuver::Points[Reversal] = 7;
$flightManuver::Point[Reversal,0] = "0 1 0 0 0 1";
$flightManuver::Point[Reversal,1] = "0 0 1 0 -1 0";
$flightManuver::Point[Reversal,2] = "0 0 1 1 0 0";
$flightManuver::Point[Reversal,3] = "1 0 0 0 0 -1";
$flightManuver::Point[Reversal,4] = "0 0 -1 -1 0 0";
$flightManuver::Point[Reversal,5] = "0 0 -1 0 1 0";
$flightManuver::Point[Reversal,6] = "0 1 0 0 0 1";
//This is a function for mass spawning
function DroneBattle(%pos, %radius, %number, %teamlow, %teamhigh, %maxskill){
for(%i = 0; %i < %number; %i++){
%startpos = vectorAdd(%pos,(getRandom(0, %radius) - (%radius / 2))@" "@(getRandom(0, %radius) - (%radius / 2))@" 0");
%rotation = "0 0 1 "@getRandom(1,360);
if(%teamlow != %teamhigh)
%team = getRandom(%teamlow,%teamhigh);
else
%team = %teamlow;
StartDrone(%startpos,%rotation,%team,getRandom(1,%maxskill));
}
}
//This sets up the drone and the functions needed to start the drone.
function StartDrone(%pos, %rotation, %team, %skill){
if(%team $= "")
%team = 0;
if(%pos $= "")
%pos = "0 0 300";
if(%rotation $= "")
%rotation = "1 0 0 0";
if(%skill !$= "ace"){
if(%skill $= "" || %skill < 1)
%skill = 1;
else if(%skill > 10)
%skill = 10;
}
%Drone = new FlyingVehicle()
{
dataBlock = ScoutFlyer;
position = %pos;
rotation = %rotation;
team = %team;
};
MissionCleanUp.add(%Drone);
setTargetSensorGroup(%Drone.getTarget(), %team);
%drone.isdrone = 1;
%drone.dodgeGround = 0;
if(%skill $= "ace"){
%skill = 10;
%drone.isace = 1;
}
%drone.skill = 0.2 + (%skill / 12.5);
schedule(100, 0, "DroneForwardImpulse", %drone);
schedule(101, 0, "DronefindTarget", %drone);
schedule(102, 0, "DroneScanGround", %drone);
return %drone;
}
//This makes the drone move forward until it dies
function DroneForwardImpulse(%obj){
if(!isObject(%obj))
return;
if(!%obj.isace){
if(vectorLen(%obj.getVelocity()) < 165)
%obj.applyImpulse(%obj.getPosition(),vectorScale(%obj.getForwardVector(),$Drone::FrdImpulse));
}
else{
if(vectorLen(%obj.getVelocity()) < 225)
%obj.applyImpulse(%obj.getPosition(),vectorScale(%obj.getForwardVector(),$Drone::FrdImpulse * 3));
}
schedule(100, 0, "DroneForwardImpulse", %obj);
}
function DroneScanGround(%obj){
if(!isObject(%obj))
return;
%vec = %obj.getForwardVector();
%vector = vectorAdd(%obj.getPosition(),"0 0 -500");
%searchResult = containerRayCast(%obj.getWorldBoxCenter(), %vector, $TypeMasks::TerrainObjectType, %obj);
if(%searchResult){
%z = getWord(%vec,2);
%height = vectorDist(%obj.getPosition(),posFromRaycast(%searchresult));
if(%z < 0){
if(%height <= (200 + ((%z * -1) * 300))){
%obj.dodgeground = 1;
schedule(100, 0, "DroneDodgeGround", %obj);
return;
}
}
}
schedule(100, 0, "DroneScanGround", %obj);
}
function DroneDodgeGround(%obj){
if(!isObject(%obj))
return;
%vec = %obj.getForwardVector();
%z = getWord(%vec,2);
if(%z > 0){
%obj.dodgeground = 0;
schedule(100, 0, "DronefindTarget", %obj);
schedule(101, 0, "DroneScanGround", %obj);
return;
}
%pos = vectorAdd(%obj.getPosition(),%vec);
%obj.applyImpulse(%pos,vectorScale("0 0 1",$Drone::TurnImpulse * %obj.skill));
schedule(100, 0, "DroneDodgeGround", %obj);
}
//This function checks the area around it for any targets.
function DronefindTarget(%obj){
if(!isObject(%obj))
return;
%pos = %obj.getposition();
InitContainerRadiusSearch(%pos, $drone::detectdist + (800 + (600 * %obj.skill)), $TypeMasks::VehicleObjectType);
while ((%searchResult = containerSearchNext()) != 0){
%objtarget = firstWord(%searchResult);
if(isObject(%objtarget) && %objTarget !$= %obj){
%trgtype = %objtarget.getClassName();
if(%trgtype $= "FlyingVehicle" && %objtarget.team != %obj.team){
%testPos = %objtarget.getWorldBoxCenter();
%distance = vectorDist(%objtarget.getPosition(),%pos);
if (%distance > 0){
%target = %objtarget;
DroneDetermineManuver(%obj, %target);
return;
}
}
}
}
schedule(100, 0, "DronePatrol", %obj);
}
function DronePatrol(%obj){
if(!isObject(%obj))
return;
if($Drone::paths > 0){
if(%obj.path $= ""){
%obj.path = getRandom(1,$Drone::paths);
%obj.point = 0;
}
%obj.point++;
if($Drone::path[%obj.path,%obj.point] $= ""){
schedule(100, 0, "DronefindTarget", %obj);
%obj.path = "";
%obj.point = "";
}
else
schedule(100,0,"dronemovetopoint",%obj,$Drone::path[%obj.path,%obj.point]);
}
else
schedule(500, 0, "DronefindTarget", %obj);
}
function DroneMoveToPoint(%obj,%Tpos){
if(!isObject(%obj))
return;
if(%obj.dodgeground == 1)
return;
%pos = %obj.getPosition();
%objfrd = %obj.getForwardVector();
%objup = %obj.getUpVector();
%dist = vectorDist(%pos,%Tpos);
%aimvec = vectorNormalize(vectorSub(%Tpos,%pos));
%vec = vectorSub(%aimvec , %objfrd);
%vec = vectorCross(%vec, %objfrd);
%vec = vectorNormalize(vectorCross(%objfrd, %vec));
if(vectorDist(%objfrd,vectorNormalize(%aimvec)) < 0.1)
%obj.applyImpulse(vectorAdd(%obj.getPosition(),vectorScale(%objfrd,($Drone::TurnImpulse / 2))),%vec);
else if(vectorDist(%objup, %vec) > 0.1){
%vec = vectorSub(%vec, %objup);
%vec = vectorCross(%vec, %objup);
%vec = vectorNormalize(vectorCross(%objup, %vec));
%pos = vectorAdd(%obj.getPosition(),vectorScale(%objup,$Drone::TurnImpulse * 3 * %obj.skill));
%obj.applyImpulse(%pos,%vec);
}
else
%obj.applyImpulse(vectorAdd(%obj.getPosition(),%objfrd),vectorScale(%vec,$Drone::TurnImpulse * %obj.skill));
if(getRandom(0,getWord($Drone::newTargetChance,1)) <= (getWord($Drone::newTargetChance,0) * 10))
schedule(100, 0, "DronefindTarget", %obj, %target);
else if(%dist < 25)
schedule(100, 0, "DronePatrol", %obj);
else
schedule(100, 0, "DroneMoveToPoint", %obj, %tpos);
}
//This function figures out what the drone should do from where the target is.
function DroneDetermineManuver(%obj, %target){
if(!isObject(%obj))
return;
if(!isObject(%target)){
DronefindTarget(%obj);
return;
}
%pos = %obj.getPosition();
%Tpos = %Target.getPosition();
%objfrd = %obj.getForwardVector();
%trgfrd = %target.getForwardVector();
%vec = vectorSub(%Tpos,%pos);
%dirdist = vectorDist(%objfrd,vectorNormalize(%vec));
%vecdist = vectorDist(%objfrd,%trgfrd);
if(%dirdist > 1.41){
if(%vecdist < 1.41 && vectorDist(%pos,%Tpos) < 2000){
UnderFireManuver(%obj, $flightManuvers::Behind[getRandom(0,6)], "");
}
else
TurnToFire(%obj, %target);
}
else
TurnToFire(%obj, %target);
%obj.target = %target;
}
function TurnToFire(%obj, %target){
if(!isObject(%obj))
return;
if(!isObject(%target)){
DronefindTarget(%obj);
return;
}
if(%obj.dodgeground == 1)
return;
%pos = %obj.getPosition();
%Tpos = %target.getPosition();
%objfrd = %obj.getForwardVector();
%trgfrd = %target.getForwardVector();
%objup = %obj.getUpVector();
%Tvel = %target.getVelocity();
%dist = vectorDist(%pos,%Tpos);
%aimPos = vectorAdd(%Tpos, vectorScale(%Tvel,(%dist / 1750)));
%aimvec = vectorNormalize(vectorSub(%aimPos,%pos));
if(vectorDist(%objfrd,%aimvec) < 0.1 && %dist <= 1000){
if((vectorDist(%objfrd,%trgfrd) < 0.2 || vectorDist(%objfrd,%trgfrd) > 1.8) && %obj.missiling != 1){
%obj.setImageTrigger(4, true);
%obj.missiling = 1;
}
else if(%obj.missiling == 1){
%obj.setImageTrigger(4, false);
%obj.missiling = 0;
}
// if (%obj.firing != 1){
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(3, true);
%obj.firing = 1;
// }
}
else{
if(%obj.firing == 1){
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
%obj.firing = 0;
}
if(%obj.missiling == 1){
%obj.setImageTrigger(4, false);
%obj.missiling = 0;
}
}
%vec = vectorSub(%aimvec , %objfrd);
%vec = vectorCross(%vec, %objfrd);
%vec = vectorNormalize(vectorCross(%objfrd, %vec));
if(vectorDist(%objfrd,%trgfrd) > 1.8 && %dist <= 120){
%vec = vectorScale(%vec, -1);
if(vectorDist(%objfrd,vectorNormalize(%aimvec)) > 1.8)
%obj.applyImpulse(vectorAdd(%obj.getPosition(),vectorScale(%objfrd,($Drone::TurnImpulse / 2))),%vec);
else if(vectorDist(%objup, %vec) > 0.1){
%vec = vectorSub(%vec, %objup);
%vec = vectorCross(%vec, %objup);
%vec = vectorNormalize(vectorCross(%objup, %vec));
%pos = vectorAdd(%obj.getPosition(),vectorScale(%objup,$Drone::TurnImpulse * 3 * %obj.skill));
%obj.applyImpulse(%pos,%vec);
}
else
%obj.applyImpulse(vectorAdd(%obj.getPosition(),%objfrd),vectorScale(%vec,$Drone::TurnImpulse * %obj.skill));
}
else if(vectorDist(%objfrd,vectorNormalize(%aimvec)) < 0.1)
%obj.applyImpulse(vectorAdd(%obj.getPosition(),vectorScale(%objfrd,($Drone::TurnImpulse / 2))),%vec);
else if(vectorDist(%objup, %vec) > 0.1){
%vec = vectorSub(%vec, %objup);
%vec = vectorCross(%vec, %objup);
%vec = vectorNormalize(vectorCross(%objup, %vec));
%pos = vectorAdd(%obj.getPosition(),vectorScale(%objup,$Drone::TurnImpulse * 3 * %obj.skill));
%obj.applyImpulse(%pos,%vec);
}
else
%obj.applyImpulse(vectorAdd(%obj.getPosition(),%objfrd),vectorScale(%vec,$Drone::TurnImpulse * %obj.skill));
if(getRandom(0,getWord($Drone::newTargetChance,1)) <= getWord($Drone::newTargetChance,0))
schedule(100, 0, "DronefindTarget", %obj, %target);
else
schedule(100, 0, "TurnToFire", %obj, %target);
}
//This function preforms the manuver choosen in Determine Maunver function.
function UnderFireManuver(%obj, %manuver, %point, %count){
if(!isObject(%obj))
return;
if(%obj.dodgeground == 1)
return;
if(%count $= "")
%count = 0;
if(%point $= ""){
%point = 0;
SetPointVectors(%obj, %manuver);
}
if(%count >= 30){
schedule(100, 0, "DroneDetermineManuver", %obj, %obj.target);
return;
}
%frdvec = %obj.getForwardVector();
%upvec = %obj.getUpVector();
if(vectorDist(%frdvec, %obj.pointvecfront[%point]) < 0.15 && vectorDist(%upvec, %obj.pointvectop[%point]) < 0.15){
%point++;
if(%point < $flightManuver::Points[%manuver])
schedule(100, 0, "UnderFireManuver", %obj, %manuver, %point, 0);
else
schedule(100, 0, "DroneDetermineManuver", %obj, %obj.target);
return;
}
if(vectorDist(%frdvec, %obj.pointvecfront[%point]) > 0.1){
%vec = vectorSub(%obj.pointvecfront[%point], %frdvec);
%vec = vectorCross(%vec, %frdvec);
%vec = vectorCross(%frdvec, %vec);
%obj.applyImpulse(vectorAdd(%obj.getPosition(),vectorScale(%frdvec,$Drone::TurnImpulse * %obj.skill)),%vec);
}
if(vectorDist(%upvec, %obj.pointvectop[%point]) > 0.1){
%vec = vectorSub(%obj.pointvectop[%point], %upvec);
%vec = vectorCross(%vec, %upvec);
%vec = vectorCross(%upvec, %vec);
%pos = vectorAdd(%obj.getPosition(),vectorScale(%upvec,$Drone::TurnImpulse * 3 * %obj.skill));
%obj.applyImpulse(%pos,%vec);
}
%count++;
schedule(100, 0, "UnderFireManuver", %obj, %manuver, %point, %count);
}
//This function finds what vectors each point in the manuver is compaired to the drone.
function SetPointVectors(%obj, %manuver){
%up = %obj.getUpVector();
%forward = %obj.getForwardVector();
%right = vectorNormalize(vectorSub(%obj.getEdge("1 0 0"),%obj.getEdge("-1 0 0")));
for(%i = 0; %i < $flightManuver::Points[%manuver]; %i++){
%pointdir = $flightManuver::Point[%manuver, %i];
%topvec = "0 0 0";
%frontvec = "0 0 0";
if(getWord(%pointdir, 0) > 0)
%frontvec = vectorAdd(%frontvec, %right);
else if(getWord(%pointdir, 0) < 0)
%frontvec = vectorAdd(%frontvec, vectorScale(%right, -1));
if(getWord(%pointdir, 1) > 0)
%frontvec = vectorAdd(%frontvec, %forward);
else if(getWord(%pointdir, 1) < 0)
%frontvec = vectorAdd(%frontvec, vectorScale(%forward, -1));
if(getWord(%pointdir, 2) > 0)
%frontvec = vectorAdd(%frontvec, %up);
else if(getWord(%pointdir, 2) < 0)
%frontvec = vectorAdd(%frontvec, vectorScale(%up, -1));
if(getWord(%pointdir, 3) > 0)
%topvec = vectorAdd(%topvec, %right);
else if(getWord(%pointdir, 3) < 0)
%topvec = vectorAdd(%topvec, vectorScale(%right, -1));
if(getWord(%pointdir, 4) > 0)
%topvec = vectorAdd(%topvec, %forward);
else if(getWord(%pointdir, 4) < 0)
%topvec = vectorAdd(%topvec, vectorScale(%forward, -1));
if(getWord(%pointdir, 5) > 0)
%topvec = vectorAdd(%topvec, %up);
else if(getWord(%pointdir, 5) < 0)
%topvec = vectorAdd(%topvec, vectorScale(%up, -1));
%obj.pointvecfront[%i] = vectorNormalize(%frontvec);
%obj.pointvectop[%i] = vectorNormalize(%topvec);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Tank AI by Dondelium_X
// CCM v3.4
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
$DTank::ForwardForce = 7000;
$DTank::BackForce = 3000;
$DTank::TurnForce = 2500;
function StartDTank(%pos,%team,%skill){
if(%team $= "")
%team = 0;
if(%pos $= "")
%pos = "0 0 300";
if(%skill $= "" || %skill < 1)
%skill = 1;
else if(%skill > 10)
%skill = 10;
%Drone = new HoverVehicle()
{
dataBlock = HeavyTank;
position = %pos;
rotation = "0 0 1 0";
team = %team;
};
MissionCleanUp.add(%Drone);
setTargetSensorGroup(%Drone.getTarget(), %team);
%drone.skill = 0.6 + (%skill / 25);
schedule(100, 0, "DTankScanTargets",%drone);
}
function DTankScanTargets(%obj){
if(!isObject(%obj))
return;
%pos = %obj.getposition();
%closestClient = -1;
%closestDistance = 32767;
%scandist = 2000 * %obj.skill;
%airtrgs = "";
%groundtrgs = "";
%inftrgs = "";
InitContainerRadiusSearch(%pos, %scanDist, $TypeMasks::VehicleObjectType | $TypeMasks::PlayerObjectType);
while ((%searchResult = containerSearchNext()) != 0){
%objtarget = firstWord(%searchResult);
if(isObject(%objtarget) && %objTarget !$= %obj && %objtarget.team != %obj.team){
%trgtype = %objtarget.getClassName();
if(%trgtype $= "FlyingVehicle")
%airtrgs = %airtrgs SPC %objtarget;
else if(%trgtype $= "HoverVehicle")
%groundtrgs = %groundtrgs SPC %objtarget;
else if(%trgtype $= "Player")
%inftrgs = %inftrgs SPC %objtarget;
}
}
if(%groundtrgs){
%target = firstWord(%groundtrgs);
%groundtrgs = getWords(%groundtrgs,1,4);
DTankGroundCombat(%obj, %target,%groundtrgs);
}
else if(%inftrgs){
%target = firstWord(%inftrgs);
%inftrgs = getWords(%inftrgs,1,4);
DTankInfCombat(%obj, %target,%inftrgs);
}
else if(%airtrgs){
%target = firstWord(%airtrgs);
%airtrgs = getWords(%airtrgs,1,4);
DTankAACombat(%obj, %target,%airtrgs);
}
else{
schedule(3000, 0, "DTankScanTargets", %obj);
}
}
function DTankGroundCombat(%obj, %target, %Trglist){
if(!isObject(%obj))
return;
if(!isObject(%target)){
%obj.turretobject.setImageTrigger(4,false);
%obj.firing = "";
if(%TrgList){
%target = firstWord(%Trglist);
%trglist = getWords(%trglist,1,4);
}
else{
DTankScanTargets(%obj);
return;
}
}
%pos = %obj.getPosition();
%tpos = %target.getPosition();
%frdvec = vectorNormalize(getWords(%obj.getForwardVector(),0,1) SPC "0");
%chkvec = vectorSub(%tpos,%pos);
%chkvec = vectorNormalize(getWords(%chkvec,0,1) SPC "0");
%turnvec = vectorsub(%chkvec,%frdvec);
%vecdif = vectorlen(%turnvec);
if(vectorDist(%pos,%tpos) > 2000){
if(%obj.firing){
%obj.firing = "";
%obj.turret.setImageTrigger(4,false);
}
%target = "";
}
else if(vectorDist(%pos,%tpos) > 500){
if(%vecdif >= "0.1"){
%vec = vectorCross(%turnvec, %frdvec);
%vec = vectorNormalize(vectorCross(%obj.getForwardVector(), %vec));
%Imppos = vectorAdd(%pos,%obj.getForwardVector());
%obj.applyImpulse(%Imppos,vectorScale(%vec,$DTank::TurnForce * %obj.skill));
}
}
else{
if(!%obj.firing){
%obj.firing = 1;
%obj.turretobject.firetype = 3;
%obj.turretobject.setTargetObject(%Target);
%obj.turretobject.aquireTime = getSimTime();
%obj.turretobject.setImageTrigger(4,true);
}
if(%vecdif < "1.2" || %vecdif >= "1.6"){
%Tvec1 = vectorNormalize(vectorcross(%chkvec,"0 0 1"));
%Tvec2 = vectorScale(%Tvec1,-1);
if(vectordist(%frdvec,%Tvec1) < vectorDist(%frdvec,%Tvec2))
%tovec = vectorSub(%Tvec1,%frdvec);
else
%tovec = vectorSub(%Tvec2,%frdvec);
%vec = vectorCross(%Tvec2, %frdvec);
%vec = vectorNormalize(vectorCross(%obj.getForwardVector(), %vec));
%Imppos = vectorAdd(%pos,%obj.getForwardVector());
%obj.applyImpulse(%Imppos,vectorScale(%vec,$DTank::TurnForce * %obj.skill));
}
}
%obj.applyImpulse(%pos,vectorScale(%obj.getForwardVector(),$DTank::ForwardForce));
schedule(100, 0, "DTankGroundCombat",%obj,%target,%Trglist);
}
function DTankAACombat(%obj, %target, %Trglist){
if(!isObject(%obj))
return;
if(!isObject(%target)){
%obj.turretobject.setImageTrigger(2,false);
%obj.firing = "";
if(%TrgList){
%target = firstWord(%Trglist);
%trglist = getWords(%trglist,1,4);
}
else{
DTankScanTargets(%obj);
return;
}
}
%pos = %obj.getPosition();
%tpos = %target.getPosition();
if(vectorDist(%pos,%tpos) < 750){
if(!%obj.firing){
%obj.firing = 1;
%obj.turretobject.setTargetObject(%Target);
%obj.turretobject.aquireTime = getSimTime();
%obj.turretobject.setImageTrigger(2,true);
}
}
else if(vectorDist(%pos,%tpos) > 2000){
if(%obj.firing){
%obj.firing = "";
%obj.turretobject.setImageTrigger(2,false);
}
%target = "";
}
schedule(100, 0, "DTankAACombat",%obj,%target,%Trglist);
}
function DTankInfCombat(%obj, %target, %Trglist){
if(!isObject(%obj))
return;
if(!isObject(%target) || %target.getState() $= "dead"){
%obj.turretobject.setImageTrigger(3,false);
%obj.firing = "";
if(%TrgList){
%target = firstWord(%Trglist);
%trglist = getWords(%trglist,1,4);
}
else{
DTankScanTargets(%obj);
return;
}
}
%pos = %obj.getPosition();
%tpos = %target.getPosition();
%frdvec = vectorNormalize(getWords(%obj.getForwardVector(),0,1) SPC "0");
%chkvec = vectorSub(%tpos,%pos);
%chkvec = vectorNormalize(getWords(%chkvec,0,1) SPC "0");
%turnvec = vectorsub(%chkvec,%frdvec);
%vecdif = vectorlen(%turnvec);
if(vectorDist(%pos,%tpos) > 2000){
if(%obj.firing){
%obj.firing = "";
%obj.turret.setImageTrigger(3,false);
}
%target = "";
}
else if(vectorDist(%pos,%tpos) > 300){
if(%vecdif >= "0.1"){
%vec = vectorCross(%turnvec, %frdvec);
%vec = vectorNormalize(vectorCross(%obj.getForwardVector(), %vec));
%Imppos = vectorAdd(%pos,%obj.getForwardVector());
%obj.applyImpulse(%Imppos,vectorScale(%vec,$DTank::TurnForce * %obj.skill));
}
}
else{
if(!%obj.firing){
%obj.firing = 1;
%obj.turretobject.firetype = 1;
%obj.turretobject.setTargetObject(%Target);
%obj.turretobject.aquireTime = getSimTime();
%obj.turretobject.setImageTrigger(3,true);
}
if(vectorDist(%pos,%tpos) < 100){
if(%vecdif <= "1.6"){
%vec = vectorCross(%turnvec, %frdvec);
%vec = vectorNormalize(vectorCross(%obj.getForwardVector(), %vec));
%Imppos = vectorAdd(%pos,%obj.getForwardVector());
%obj.applyImpulse(%Imppos,vectorScale(%vec,$DTank::TurnForce * %obj.skill * "-1"));
}
}
else {
if(%vecdif < "1.2" || %vecdif >= "1.6"){
%Tvec1 = vectorNormalize(vectorcross(%chkvec,"0 0 1"));
%Tvec2 = vectorScale(%Tvec1,-1);
if(vectordist(%frdvec,%Tvec1) < vectorDist(%frdvec,%Tvec2))
%tovec = vectorSub(%Tvec1,%frdvec);
else
%tovec = vectorSub(%Tvec2,%frdvec);
%vec = vectorCross(%Tvec2, %frdvec);
%vec = vectorNormalize(vectorCross(%obj.getForwardVector(), %vec));
%Imppos = vectorAdd(%pos,%obj.getForwardVector());
%obj.applyImpulse(%Imppos,vectorScale(%vec,$DTank::TurnForce * %obj.skill));
}
}
}
%obj.applyImpulse(%pos,vectorScale(%obj.getForwardVector(),$DTank::ForwardForce));
schedule(100, 0, "DTankInfCombat",%obj,%target,%Trglist);
}

View file

@ -0,0 +1,283 @@
$S11manuverforce = 75;
$S11flyforce = 350;
$S11forwardspeed = 120;
$S11hoverheight = 3;
$S11hoverforce = 100;
$S11reconheight = "450 550";
$S11reconradius = 700;
$S11[move] = "TAKEOFF MOVE LAND IDLE";
$S11[guard] = "TAKEOFF RECON";
$S11[attack] = "TAKEOFF MOE FIRE MOVE LAND IDLE";
$S11[rearm] = "TAKEOFF MOVE LAND REARM TAKEOFF MOVE LAND IDLE";
function S11Think(%obj){
if(!isObject(%obj))
return;
if(%obj.tasks !$= ""){
%task = getWord(%obj.tasks,0);
%fun = "S11"@%task;
%obj.mode = %task;
if(%obj.specvar[%task] !$= "")
schedule(10, 0, %fun, %obj, %obj.specvar[%task]);
else
schedule(10, 0, %fun, %obj);
}
else{
%obj.mode = "IDLE";
S11IDLE(%obj);
}
}
function S11IDLE(%obj){
if(!isObject(%obj))
return;
if(%obj.mode !$= "IDLE")
return;
%pos = %obj.getPosition();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,vectorScale("0 0 -1",$S11hoverheight));
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
if(%searchresult){
%obj.applyImpulse(%pos,vectorScale("0 0 1",$S11hoverforce));
}
schedule(100, 0, "S11IDLE", %obj);
}
function S11TAKEOFF(%obj){
if(!isObject(%obj))
return;
if(%obj.mode !$= "TAKEOFF")
return;
%pos = %obj.getPosition();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,"0 0 -20");
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
if(%searchresult)
%obj.applyImpulse(%pos,"0 0 200");
else{
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
schedule(100, 0, "S11TAKEOFF", %obj);
}
function S11LAND(%obj){
if(!isObject(%obj))
return;
if(%obj.mode !$= "LAND")
return;
%pos = %obj.getPosition();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,"0 0" SPC (-10 - $S11hoverheight));
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
if(%searchresult){
%dist = vectorDist(%pos,posfromraycast(%searchresult));
if(%dist <= $S11hoverheight){
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%speed = vectorScale("0 0 -1",%dist);
%obj.setVelocity(%speed);
}
else{
%vel = %obj.getVelocity();
%reqvel = "0 0 -15";
%impvec = vectorScale(vectorSub(%reqvel,%vel),%obj.getDatablock().mass);
%obj.applyImpulse(%pos,%impvec);
}
schedule(100, 0, "S11LAND", %obj);
}
function S11MOVE(%obj, %movepos){
if(!isObject(%obj))
return;
if(%obj.mode !$= "MOVE")
return;
%pos = %obj.getPosition();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,"0 0 -150");
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
%vec = "0 0 0";
%frd = %obj.getForwardVector();
if(vectorlen(%obj.getVelocity()) <= $S11forwardspeed)
%vec = vectorScale(%frd,$S11flyforce);
if(%searchresult)
%vec = vectorAdd(%vec,"0 0 150");
%tstpos = getWords(%movepos,0,1) SPC getWord(%pos,2);
%dist = vectorDist(%tstpos,%pos);
if(%dist > 10){
%aimvec = vectorSub(%tstpos,%pos);
%tvec = vectorNormalize(vectorCross(%aimvec, %frd));
%tvec = vectorNormalize(vectorCross(%frd, %tvec));
%obj.applyImpulse(vectorAdd(%pos,%frd),vectorScale(%tvec,$S11manuverforce));
}
else{
if(%obj.specvar["MOVE",2] !$= ""){
%obj.specvar["MOVE"] = %obj.specvar["MOVE",2];
%obj.specvar["MOVE",2] = "";
}
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%obj.applyImpulse(%pos,%vec);
schedule(100, 0, "S11MOVE",%obj,%movepos);
}
function S11RECON(%obj,%reconPos){
if(!isObject(%obj))
return;
if(%obj.mode !$= "RECON")
return;
%pos = %obj.getPosition();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,"0 0 -1000");
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
if(%searchresult){
%frd = %obj.getForwardVector();
%vec = "0 0 0";
if(vectorlen(%obj.getVelocity()) <= $S11forwardspeed)
%vec = vectorScale(%frd,$S11flyforce);
%dist = vectorDist(%pos,posfromraycast(%searchresult));
if(%dist < getWord($S11reconheight,0))
%vec = vectorAdd(%vec,"0 0 450");
if(%dist > getWord($S11reconheight,1))
%vec = vectorAdd(%vec,"0 0 -450");
%tstpos = getWords(%reconPos,0,1) SPC getWord(%pos,2);
%dist = vectorDist(%tstpos,%pos);
if(%dist > $S11reconradius){
%aimvec = vectorSub(%tstpos,%pos);
%tvec = vectorNormalize(vectorCross(%aimvec, %frd));
%tvec = vectorNormalize(vectorCross(%frd, %tvec));
%obj.applyImpulse(vectorAdd(%pos,%frd),vectorScale(%tvec,$S11manuverforce));
}
%obj.applyImpulse(%pos,%vec);
}
else{
%vel = %obj.getVelocity();
%reqvel = "0 0 -50";
%impvec = vectorScale(vectorSub(%reqvel,%vel),%obj.getDatablock().mass);
%obj.applyImpulse(%pos,%impvec);
}
schedule(100, 0, "S11RECON",%obj,%reconpos);
}
function S11MOE(%obj,%target){
if(!isObject(%obj))
return;
if(%obj.mode !$= "MOE")
return;
if(!isObject(%target)){
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%pos = %obj.getPosition();
%frd = %obj.getForwardVector();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%pos,vectorScale(%frd,100));
%searchResult = containerRayCast(%pos, %vector, %mask, %obj);
if(!%searchResult){
%tstvec = vectorAdd(%vector,"0 0 -50");
%searchResult2 = containerRayCast(%vector, %tstvec, %mask, %obj);
if(%searchResult2)
%dir = "1";
else
%dir = "-1";
}
else
%dir = "2";
%impvec = vectorScale(%obj.getUpVector(),$S11manuverforce * %dir);
%Tpos = %target.getPosition();
%tstpos = getWords(%TPos,0,1) SPC getWord(%pos,2);
%aimvec = VectorNormalize(vectorSub(%tstpos,%pos));
%dist = vectorDist(%frd,%aimvec);
if(%dist > 0.1){
%aimvec = vectorSub(%tstpos,%pos);
%tvec = vectorNormalize(vectorCross(%aimvec, %frd));
%tvec = vectorNormalize(vectorCross(%frd, %tvec));
%impvec = vectorAdd(%impvec,vectorScale(%tvec,$S11manuverforce));
}
if(vectorDist(%pos, %Tpos) < 500){
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%obj.applyImpulse(vectorAdd(%pos,%frd),%impvec);
if(vectorlen(%obj.getVelocity()) <= $S11forwardspeed)
%obj.applyImpulse(%pos,vectorScale(%obj.getForwardVector(),$S11flyforce));
schedule(100, 0, "S11MOE", %obj,%target);
}
function S11REARM(%obj){
if(!isObject(%obj))
return;
if(%obj.mode !$= "REARM")
return;
%obj.setVelocity("0 0 0");
if (%obj.turret.inv[AALauncherAmmo] < 1)
%obj.turret.setInventory(AALauncherAmmo, 1);
else if(%DamageLevel > 0)
%obj.setRepairRate(0.01);
else {
%obj.setRepairRate(0);
S11Think(%obj);
return;
}
schedule(100, 0, "S11REARM", %obj, %target);
}
function S11FIRE(%obj,%target){
if(!isObject(%obj))
return;
if(%obj.mode !$= "FIRE")
return;
if(!isObject(%target)){
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%turret = %obj.turret;
if(%turret.inv[AALauncherAmmo] >= 1){
%turret.target = %target;
if(%obj.aiming != 1){
%obj.aiming = 1;
%turret.setTargetObject(%target);
%turret.aquireTime = getSimTime();
%turret.setImageTrigger(2,true);
}
else if(isObject(%turret.TLB)){
%turret.setImageTrigger(3,true);
}
}
else{
%obj.aiming = 0;
%turret.setImageTrigger(2,false);
%turret.setImageTrigger(3,false);
%obj.tasks = getWords(%obj.tasks,1,(getNumberOfWords(%obj.tasks) - 1));
S11Think(%obj);
return;
}
%frd = %obj.getForwardVector();
%impvec = vectorAdd(vectorScale(%frd,$S11flyforce),"0 0 150");
if(vectorlen(%obj.getVelocity()) <= $S11forwardspeed)
%obj.applyImpulse(%obj.getPosition(),%impvec);
schedule(100, 0, "S11FIRE", %obj, %target);
}

View file

@ -0,0 +1,107 @@
$S17moveforce = 500;
function S17Think(%obj){
if(!isObject(%obj))
return;
if(%obj.task !$= ""){
%task = %obj.task;
%fun = "S17"@%task;
%obj.mode = %task;
cancel(%obj.loop);cancel(%obj.loop);cancel(%obj.loop);
if(%obj.specvar[%task] !$= "")
%obj.loop = schedule(10, 0, %fun, %obj, %obj.specvar[%task]);
else
%obj.loop = schedule(10, 0, %fun, %obj);
}
}
function S17GUARD(%obj,%pos){
if(!isObject(%obj))
return;
%obj.mode = "MOVE";
S17MOVE(%obj,%pos);
}
function S17MOVE(%obj,%pos){
if(!isObject(%obj))
return;
if(%obj.mode !$= "MOVE")
return;
%objpos = %obj.getPosition();
%dist = vectorDist(%pos,%objpos);
if(%dist > 10){
%vec = vectorNormalize(vectorSub(%pos,%objpos));
%vec = vectorScale(%vec,$S17moveforce);
%obj.applyImpulse(%objpos,%vec);
}
else
return;
%obj.loop = schedule(100, 0, "S17MOVE",%obj,%pos);
}
function S17ATTACK(%obj,%target){
if(!isObject(%obj))
return;
if(!isObject(%target)){
%obj.val = "";
return;
}
if(%obj.mode !$= "ATTACK"){
%obj.val = "";
return;
}
%objpos = %obj.getPosition();
%trgpos = %target.getPosition();
%dist = vectorDist(%trgpos,%objpos);
if(%dist > 100){
%vec = vectorNormalize(vectorSub(%pos,%objpos));
%vec = vectorScale(%vec,$S17moveforce);
%obj.applyImpulse(%objpos,%vec);
}
else {
%vec = vectorSub(%trgpos,%objpos);
%random = getRandom(1,2);
if(%obj.val $= ""){
if(%random == 1)
%obj.val = "0 0 -1";
else
%obj.val = "0 0 1";
}
%vec = vectorNormalize(vectorCross(%vec,%val));
%vec = vectorScale(%vec,$S17moveforce);
%obj.applyImpulse(%objpos,%vec);
}
%obj.loop = schedule(100, 0, "S17ATTACK",%obj,%target);
}
function S17REARM(%obj,%target){
if(!isObject(%obj))
return;
if(!isObject(%target)){
%target.setRepairRate(0);
return;
}
if(%obj.mode !$= "REARM"){
%target.setRepairRate(0);
return;
}
%objpos = %obj.getPosition();
%trgpos = %target.getPosition();
%dist = vectorDist(%trgpos,%objpos);
%DamageLevel = %targetObject.getDamageLevel();
if(%dist > 6){
%vec = vectorNormalize(vectorCross(%vec,%val));
%vec = vectorScale(%vec,$S17moveforce);
%obj.applyImpulse(%objpos,%vec);
}
else if(%DamageLevel > 0)
%obj.setRepairRate(0.01);
else {
%obj.setRepairRate(0);
return;
}
%obj.loop = schedule(100, 0, "S17ATTACK",%obj,%target);
}

View file

@ -0,0 +1,71 @@
$sent::patrolwaittime = 10; // 10 secs
$sent::patrolsaturation = 2; // 2 sentinel patrolling one point at a time
// 1 = Normal Sentinel
// 2 = Sentinel Monitor
//==============================================================================
// CreateSentinel
//------------------------------------------------------------------------------
// %pos = position
// %team = team
// %quantity = how many sentinels to spawn
// %type = the type of sentinel to spawn [regular/monitor]
//------------------------------------------------------------------------------
// It creates a sentinel.
//==============================================================================
function CreateSentinel(%pos, %quantity, %type)
{
if(%quantity < 1)
return;
while(%quantity)
{
%data = (%type == 2 ? "SentinelMonitor" : "SentinelVehicle");
%sent = new FlyingVehicle() {
datablock = %data;
};
%sent.setTransform(%pos SPC "0 0 1 0");
%sent.team = 1;
MissionCleanup.add(%sent);
setTargetSensorGroup(%sent.getTarget(), 1);
$ignoreNextBotConnection = true;
%ai = aiConnect("_AISent");
ChangeName(%ai, "Sentinel"@%ai);
%ai.isSentinel = true;
%ai.sentVehicle = %sent;
%ai.sentinelType = %type;
%ai.setControlObject(%sent);
// SentinelAI_PatrolArea(%ai);
warn("Sentinel created: "@%ai@", VEHID"@%sent);
%quantity--;
}
}
function DropSentinel(%id)
{
if(!isObject(%id) || %id.isSentinel != true)
return;
if(isObject(%id.sentVehicle) && %id.sentVehicle.getDamageState() !$= "Destroyed")
%id.sentVehicle.setDamageState(Destroyed);
%id.drop();
}
function AIConnection::Sentinel_MoveTo(%client, %coords)
{
%client.clearStep();
%client.setPilotAim(%coords);
%client.setPilotDestination(%coords);
}
function AIConnection::Sentinel_Damaged

View file

@ -0,0 +1,654 @@
//==============================================================================
// Sentinel Data - Made by Blnukem
//==============================================================================
// Sentinel Sounds
//------------------------------------------------------------------------------
datablock EffectProfile(SentinelTurretSwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(SentinelTurretFireEffect)
{
filename = "fx/vehicles/tank_chaingun.wav";
minDistance = 2.5;
maxDistance = 8.0;
};
datablock EffectProfile(SentinelDeactivateEffect)
{
effectname = "powered/turret_heavy_reload";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(SentinelActivateEffect)
{
effectname = "powered/turret_light_reload";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(SentinelIdleEffect)
{
effectname = "powered/turret_light_idle";
minDistance = 1;
maxDistance = 2;
};
datablock AudioProfile(SentinelTurretSwitchSound)
{
filename = "fx/powered/turret_light_activate.wav";
description = AudioClose3d;
preload = true;
effect = SentinelTurretSwitchEffect;
};
datablock AudioProfile(SentinelTurretFireSound)
{
filename = "fx/vehicles/tank_chaingun.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = SentinelTurretFireEffect;
};
datablock AudioProfile(SentinelIdleSound)
{
filename = "fx/powered/turret_light_idle.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = SentinelIdleEffect;
};
datablock AudioProfile(SentinelActivateSound)
{
filename = "fx/powered/turret_light_reload.wav";
description = AudioClose3d;
preload = true;
effect = SentinelActivateEffect;
};
datablock AudioProfile(SentinelDeactivateSound)
{
filename = "fx/powered/turret_heavy_reload.wav";
description = AudioClose3d;
preload = true;
effect = SentinelDeactivateEffect;
};
//==============================================================================
// Vehicle Data
//==============================================================================
// Standard Sentinel
//------------------------------------------------------------------------------
datablock FlyingVehicleData(SentinelVehicle) : SentinelDamageProfile
{
spawnOffset = "0.0 0.0 0.1";
catagory = "Sentinels";
shapeFile = "stackable2s.dts";
multipassenger = false;
computeCRC = true;
debrisShapeName = "debris_generic.dts";
debris = TurretDebris;
renderWhenDestroyed = false;
drag = 0.15;
density = 1.0;
numMountPoints = 0;
cameraMaxDist = 15;
cameraOffset = 2.5;
cameraLag = 0.9;
explosion = TurretExplosion;
explosionDamage = 0.5;
explosionRadius = 5.0;
maxDamage = 0.5;
destroyedLevel = 0.5;
isShielded = true;
energyPerDamagePoint = 160;
maxEnergy = 280;
rechargeRate = 0.8;
minDrag = 30;
rotationalDrag = 2000;
maxAutoSpeed = 15;
autoAngularForce = 400;
autoLinearForce = 300;
autoInputDamping = 0.95;
maxSteeringAngle = 5;
horizontalSurfaceForce = 6;
verticalSurfaceForce = 4;
maneuveringForce = 5000;
steeringForce = 3000;
steeringRollForce = 0;
rollForce = 10;
hoverHeight = 10;
createHoverHeight = 2;
maxForwardSpeed = 15;
jetForce = 4500;
minJetEnergy = 0;
jetEnergyDrain = 0; // Auto stabilize speed
vertThrustMultiple = 0;
mass = 100;
bodyFriction = 0;
bodyRestitution = 0.5;
minRollSpeed = 0;
softImpactSpeed = 14;
hardImpactSpeed = 25;
minImpactSpeed = 10;
speedDamageScale = 0.06;
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
jetSound = "";
engineSound = SentinelIdleSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 15.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
dustEmitter = LiftoffDustEmitter;
triggerDustHeight = 1.0;
dustHeight = 0.1;
canControl = false;
minMountDist = 4;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
targetNameTag = 'Standard';
targetTypeTag = 'Sentinel';
sensorData = combatSensor;
sensorRadius = combatSensor.detectRadius;
sensorColor = "9 9 255";
checkRadius = 5.5;
observeParameters = "1 5 5";
canObserve = true;
runningLight[0] = ShrikeLight1;
shieldEffectScale = "2.0 2.0 2.0";
};
//==============================================================================
// Sentinel Monitor Vehicle Data
//==============================================================================
datablock FlyingVehicleData(SentinelMonitor) : SentinelDamageProfile
{
spawnOffset = "0.0 0.0 0.0";
catagory = "Sentinels";
shapeFile = "beacon.dts";
multipassenger = false;
computeCRC = true;
debrisShapeName = "debris_generic.dts";
debris = TurretDebris;
renderWhenDestroyed = false;
drag = 4.15;
density = 1.0;
numMountPoints = 0;
cameraMaxDist = 15;
cameraOffset = 2.5;
cameraLag = 0.9;
explosion = TurretExplosion;
explosionDamage = 0.5;
explosionRadius = 5.0;
maxDamage = 50.00;
destroyedLevel = 50.00;
isShielded = true;
rechargeRate = 2.5;
energyPerDamagePoint = 1;
maxEnergy = 500;
rechargeRate = 50.0;
minDrag = 30;
rotationalDrag = 2000;
maxAutoSpeed = 15;
autoAngularForce = 400;
autoLinearForce = 300;
autoInputDamping = 0.95;
maxSteeringAngle = 5;
horizontalSurfaceForce = 6;
verticalSurfaceForce = 4;
maneuveringForce = 5000;
steeringForce = 1000;
steeringRollForce = 0;
rollForce = 100;
hoverHeight = 15;
createHoverHeight = 2;
maxForwardSpeed = 15;
jetForce = 1500;
minJetEnergy = 0;
jetEnergyDrain = 0; // Auto stabilize speed
vertThrustMultiple = 0;
mass = 100;
bodyFriction = 0;
bodyRestitution = 0.5;
minRollSpeed = 0;
softImpactSpeed = 14;
hardImpactSpeed = 25;
minImpactSpeed = 25;
speedDamageScale = 0.06;
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
minTrailSpeed = 0.1;
trailEmitter = ContrailEmitter;
jetSound = "";
engineSound = SentinelIdleSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 15.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
dustEmitter = LiftoffDustEmitter;
triggerDustHeight = 2.0;
dustHeight = 0.0;
canControl = false;
damageEmitter[0] = LightDamageSmoke;
damageEmitter[1] = LightDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "0.0 0.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 1;
minMountDist = 4;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDCameraIcon;
cmdMiniIconName = "commander/MiniIcons/com_camera_grey";
targetNameTag = '';
targetTypeTag = 'Monitor';
sensorData = combatSensor;
sensorRadius = combatSensor.detectRadius;
sensorColor = "9 9 255";
checkRadius = 10.5;
observeParameters = "1 5 5";
canObserve = true;
runningLight[0] = ShrikeLight1;
shieldEffectScale = "2.0 2.0 2.0";
};
//==============================================================================
// Image Data
//==============================================================================
// Standard Sentinel Image Data:
//------------------------------------------------------------------------------
datablock ShapeBaseImageData(BodyImage) : SentinelVehicle
{
offset = "0.0 -0.2 0.3";
rotation = "0 0 1 0";
shapeFile = "turret_mortar_large.dts";
};
datablock ShapeBaseImageData(RightWing) : SentinelVehicle
{
offset = "0.2 0.0 0.4";
rotation = "0 0 -1 90";
shapeFile = "pack_deploy_sensor_pulse.dts";
};
datablock ShapeBaseImageData(LeftWing) : SentinelVehicle
{
offset = "-0.2 0.0 0.4";
rotation = "0 0 1 90";
shapeFile = "pack_deploy_sensor_pulse.dts";
};
datablock ShapeBaseImageData(Eye) : SentinelVehicle
{
offset = "0.0 1.1 0.22";
rotation = "1 0 0 90";
shapeFile = "beacon.dts";
};
//==============================================================================
// Sentinel Monitor Image Data:
//==============================================================================
datablock ShapeBaseImageData(Front) : SentinelMonitor
{
offset = "0.0 -0.02 0.0";
rotation = "1.0 0.0 0.0 90.0";
shapeFile = "camera.dts";
};
datablock ShapeBaseImageData(Rear) : SentinelMonitor
{
offset = "0.0 0.02 0.0";
rotation = "-1.0 0.0 0.0 90.0";
shapeFile = "camera.dts";
};
//==============================================================================
// Decals and Projectiles
//==============================================================================
// Default Sentinel bullet Decal image:
//------------------------------------------------------------------------------
datablock DecalData(SentinelDecal1)
{
sizeX = 0.15;
sizeY = 0.15;
textureName = "special/bullethole3";
};
//==============================================================================
// Standard Sentinel Bullet:
//==============================================================================
datablock TracerProjectileData(SentinelBullet)
{
doDynamicClientHits = true;
directDamage = 0.15;
directDamageType = $DamageType::Sentinel;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
HeadMultiplier = 1.5;
LegsMultiplier = 0.5;
kickBackStrength = 50.0;
sound = ChaingunProjectile;
dryVelocity = 800.0;
wetVelocity = 100.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 10.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 10.0/255.0 @ " " @ 30.0/255.0 @ " " @ 240.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.15;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = SentinelDecal1;
hasLight = true;
lightRadius = 8.0;
lightColor = "0.5 0.5 0.175";
};
//==============================================================================
// Turret Data
//==============================================================================
// Standard Sentinel Turret:
//------------------------------------------------------------------------------
datablock TurretData(SentinelTurret) : TurretDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "turret_belly_base.dts";
preload = true;
mass = 1.0;
maxDamage = 1.0;
destroyedLevel = 1.0;
repairRate = 0;
maxDamage = SentinelVehicle.maxDamage;
destroyedLevel = SentinelVehicle.destroyedLevel;
rechargeRate = 0.15;
thetaMin = 90;
thetaMax = 180;
thetaNull = 90;
rechargeRate = 0.15;
isShielded = false;
energyPerDamagePoint = 110;
maxEnergy = 60;
renderWhenDestroyed = true;
barrel = SentinelTurretBarrel;
heatSignature = 0;
canControl = false;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Sentinel';
targetTypeTag = 'Turret';
firstPersonOnly = true;
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
};
datablock TurretImageData(SentinelTurretBarrel)
{
shapeFile = "turret_muzzlepoint.dts";
mountPoint = 0;
projectile = SentinelBullet;
projectileType = TracerProjectile;
usesEnergy = true;
fireEnergy = 0.0;
minEnergy = 10.0;
emap = true;
activationMS = 700;
deactivateDelayMS = 1500;
thinkTimeMS = 120;
degPerSecTheta = 2000;
degPerSecPhi = 2000;
attackRadius = 100;
casing = ShellDebris;
shellExitDir = "0.0 -0.5 -0.5";
shellExitOffset = "0.0 0.0 0.0";
shellExitVariance = 20.0;
shellVelocity = 5.0;
projectileSpread = 2.0 / 1000.0;
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = SentinelActivateSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateSequence[3] = "Fire";
stateSequenceRandomFlash[3] = true;
stateSound[3] = ChaingunFireSound;
stateAllowImageChange[3] = false;
stateEmitter[3] = "GunFireEffectEmitter";
stateEmitterNode[3] = "muzzlepoint1";
stateEmitterTime[3] = 0.1;
stateScript[3] = "onFire";
stateFire[3] = true;
stateEjectShell[3] = true;
stateTimeoutValue[3] = 0.1;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Reload";
stateTransitionOnNoAmmo[3] = "noAmmo";
stateName[4] = "Reload";
stateTimeoutValue[4] = 0.01;
stateAllowImageChange[4] = false;
stateWaitForTimeout[4] = true;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateSound[5] = SentinelDeactivateSound;
stateEmitter[5] = "GunFireEffectEmitter";
stateEmitterNode[5] = "muzzlepoint1";
stateEmitterTime[5] = 0.2;
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};
//==============================================================================
// Vehicle Functions
//==============================================================================
// Sentinel Functions:
//------------------------------------------------------------------------------
function SentinelVehicle::deleteAllMounted(%data, %obj) {
$HostGamePlayerCount = ClientGroup.GetCount();
%turret = %obj.getMountNodeObject(10);
if (!%turret)
return;
%turret.altTrigger = 0;
%turret.fireTrigger = 0;
if (%client = %turret.getControllingClient()) {
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
%client.player.bomber = false;
%client.player.isBomber = false;
}
%turret.schedule(0, delete);
}
function SentinelVehicle::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.mountImage(BodyImage, 1);
%obj.mountImage(RightWing, 2);
%obj.mountImage(LeftWing, 3);
%obj.mountImage(Eye, 4);
%turret = TurretData::create(SentinelTurret);
%turret.scale = "0.45 0.45 0.45";
MissionCleanup.add(%turret);
%turret.team = 1;
%turret.selectedWeapon = 1;
%turret.setSelfPowered();
%obj.mountObject(%turret, 10);
%turret.mountImage(SentinelTurretBarrel, 0);
%obj.turretObject = %turret;
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%turret.vehicleMounted = %obj;
%turret.setAutoFire(true);
%turret.mountImage(AIAimingTurretBarrel, 1);
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
}
//==============================================================================
// Monitor Functions:
//==============================================================================
function SentinelMonitor::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.mountImage(Front, 1);
%obj.mountImage(Rear, 2);
}

View file

@ -0,0 +1,54 @@
//------------------------------------------------------------------------------
// ACCM AI Commands
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Drone Commands:
//------------------------------------------------------------------------------
// Made by Blnukem (edited by Eolk)
function ccDroneBattle(%sender, %args)
{
if(!%sender.isAdmin)
return;
%x = getword(%sender.player.position, 0);
%y = getword(%sender.player.position, 1);
%z = getword(%sender.player.position, 2) + 1200;
%newpos = %x SPC %y SPC %z;
%base = strlwr(getword(%args, 0));
%difficulty = getword(%args, 1);
if(%base $= "Battle")
%base = 1;
else if(%base $= "Single")
%base = 2;
else
{
messageClient(%sender, "", "\c2Invalid variable. Valid variables are:\c3 battle\c2 and \c3single\c2.");
return;
}
if(%difficulty $= "Easy")
%d = 1;
else if(%difficulty $= "Medium")
%d = 5;
else if(%difficulty $= "Hard")
%d = 10;
else if(%difficulty $= "Ace")
%d = "ace";
else
{
messageClient(%sender, "", "\c2Invalid difficulty. Difficulties are:\c3 Light\c2,\c3 Medium\c2,\c3 Hard\c2, and\c3 Ace\c2.");
return;
}
if(%base == 1)
DroneBattle(%newpos, 1000, 10, 10, 15, %d);
else if(%base == 2)
StartDrone(%newpos, "0 0 1 0", 5, %d);
messageAll("", "\c3"@%sender.nameBase@" \c2spawned a "@%difficulty@" "@(%base == 1 ? "drone battle" : "drone")@".~wgui/objective_Notification.wav");
}
function ccCreateSentinel(%sender, %args)
{
CreateSentinel("0 0 310", 1, 1);
}

View file

@ -0,0 +1,947 @@
//==============================================================================
// Admin Commands
//==============================================================================
// Command by Eolk. Modified by Blnukem.
function ccset(%sender, %args)
{
%base = strlwr(getword(%args, 0));
%param = getword(%args, 1);
switch$(%base)
{
case "canzombie":
if(%sender.isAdmin)
{
if(%param != 1 && %param != 0)
{
messageClient(%sender, "MsgNo", "\c2Invalid parameters. Use 1 for canZombie to be on, use 0 for canZombie to be off.");
return;
}
$Host::canZombie = %param;
messageAll('MsgAdminForce', "\c1"@%sender.nameBase@" \c2changed \c5HUMAN ZOMBIES \c2to \c5"@%param@"\c2.");
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::canZombie (human zombies) changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::canZombie@" via ccSet");
}
case "joinpw":
if(%sender.isSuperAdmin)
{
if(%param $= "")
{
messageClient(%sender, "MsgNo", "\c2No Changes. You did not supply a value. Use \"remove\" to remove join pw.");
return;
}
if(strlwr(%param) $= "remove")
$Host::Password = "";
else
$Host::Password = %param;
messageAll('MsgAdminForce', "\c1"@%sender.nameBase@" \c2changed \c5JOIN PASSWORD\c2.");
messageClient(%sender, "MsgYes", "\c2Join password changed to "@$Host::Password);
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::Password (server password) changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::Password@" via ccSet");
}
case "maxplyrs":
if(!%sender.isSuperAdmin)
return;
%failed = false;
for(%i = 0; %i < strlen(%param); %i++)
{
%temp = getsubstr(%param, %i, 1);
if(%temp !$= "1" && %temp !$= "2" && %temp !$= "3" && %temp !$= "4" && %temp !$= "5" && %temp !$= "6" && %temp !$= "7" && %temp !$= "8" && %temp !$= "9" && %temp !$= "0")
{
%failed = true;
break;
}
}
if(%param < 0)
%failed = true;
if(%failed == true)
{
messageClient(%sender, "MsgNo", "\c2No changes. You supplied an invalid number. Must be over 0.");
return;
}
$Host::MaxPlayers = %param;
messageAll('MsgAdminForce', "\c1"@%sender.nameBase@" \c2changed \c5MAX PLAYERS\c2 to \c5"@$Host::MaxPlayers@"\c2.");
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::MaxPlayers (maximum players allowed by the server) changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::MaxPlayers@" via ccSet");
case "restrict":
if(%sender.isAdmin)
{
%target = plnametocid(%param);
if(!isObject(%target))
{
messageClient(%sender, "MsgNo", "\c2Unable to find target.");
return;
}
if(%target.isAdmin)
{
messageClient(%sender, "MsgNo", "\c2Cannot do this to admins.");
return;
}
if(!%target.CannotDeploy)
{
%target.CannotDeploy = 1;
messageClient(%sender, "MsgYes", "\c2"@%target.nameBase@"'s ability to deploy things has been revoked.~wfx/misc/diagnostic_on.wav");
echo(%sender.namebase@" ("@%sender@") disabled "@%target.nameBase@"'s ("@%target@") ability to deploy objects");
}
else
{
%target.CannotDeploy = 0;
messageClient(%sender, "MsgYes", "\c2"@%target.nameBase@" is free to deploy things again.~wfx/misc/diagnostic_on.wav");
echo(%sender.namebase@" ("@%sender@") enabled "@%target.nameBase@"'s ("@%target@") ability to deploy objects");
}
}
case "noinfection":
if(%sender.isAdmin)
{
if(%param != 0 && %param != 1)
{
messageClient(%sender, "MsgNo", "\c2No changes. You supplied an invalid type. Use 1 for on, use 0 for off.");
return;
}
$Host::NoInfection = %param;
messageAll('MsgAdminForce', "\c1"@%sender.nameBase@" \c2changed \c5NO INFECTION \c2to \c5"@%param@"\c2.");
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::NoInfection (no infection) changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::NoInfection@" via ccSet");
}
case "autosave":
if(%sender.isSuperAdmin) // SA
{
if(%param != 1 && %param != 0)
{
messageClient(%sender, "MsgNo", "\c2Invalid parameters. Input 1 for start, input 0 for end.");
return;
}
if(%param == 1)
if($SaveBuilding::TimerEnabled)
{
saveBuildingTimerOn(); // This resets.
messageAll('MsgAdminForce', "\c2"@%sender.nameBase@" has reset the autosave timer.");
echo(%sender.nameBase@" ("@%sender@") has reset the autosave timer via ccSet");
}
else
{
saveBuildingTimer(0, 1, 0, 0);
messageAll('MsgAdminForce', "\c2"@%sender.nameBase@" has enabled the autosave timer.");
echo(%sender.nameBase@" ("@%sender@") has enabled the autosave timer via ccSet");
}
else
if($SaveBuilding::TimerEnabled)
{
saveBuildingTimerOff();
messageAll('MsgAdminForce', "\c2"@%sender.nameBase@" has disabled the autosave timer.");
echo(%sender.nameBase@" ("@%sender@") has disabled the autosave timer via ccSet");
}
else
messageClient(%sender, "", "\c2Cannot disable the autosave timer if it is already disabled!");
}
case "lockedteams":
if(%sender.isAdmin)
{
if(%param != 1 && %param != 0)
{
messageClient(%sender, "MsgNo", "\c2Invalid parameters. Input 1 for lock, input 0 for unlock.");
return;
}
$Host::LockedTeams = %param;
messageAll('MsgAdminForce', "\c2"@%sender.nameBase@" has changed locked teams to "@%param@".");
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::LockedTeams (locked, unchangeable teams) has been changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::LockedTeams@" via ccSet");
}
case "sapass":
if(%sender.isSuperAdmin)
{
$Host::SuperAdminPassword = %param;
messageClient(%sender, "", "\c2Super admin password changed to "@%param);
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::SuperAdminPassword (super admin password or SAD) has been changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::SuperAdminPassword@" via ccSet");
}
case "apass":
if(%sender.isSuperAdmin)
{
$Host::AdminPassword = %param;
messageClient(%sender, "", "\c2Admin password changed to "@%param);
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::AdminPassword (admin password or AD) has been changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::AdminPassword@" via ccSet");
}
case "fairteams":
if(%sender.isAdmin)
{
if(%param != 1 && %param != 0)
{
messageClient(%sender, "MsgNo", "\c2Invalid parameters. Input 1 for enabled, input 0 for disable.");
return;
}
$Host::FairTeams = %param;
messageAll("", "\c2"@%sender.nameBase@" has changed Fair Teams to "@%param@".");
export( "$Host::*", "prefs/ServerPrefs.cs", false );
echo("$Host::FairTeams (unbalanced team preventer) has been changed by "@%sender.nameBase@" ("@%sender@") to "@$Host::FairTeams@" via ccSet");
}
default:
messageClient(%sender, "MsgNo", "\c2Invalid command. Valid commands are canzombie, zombieteam, joinpw, maxplyrs, restrict, zturrets");
messageClient(%sender, "MsgNo", "\c2noinfection, dir, lockedteams, sapass, apass, fairteams, and autosave");
}
}
// Command by Eolk.
function ccA(%sender, %args)
{
if(!%sender.isAdmin)
return;
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl.isAdmin)
messageClient(%cl, 'MsgYes', "\c3[A]\c2"@%sender.nameBase@": "@%args);
}
logEcho("[ADMIN CHAT]: "@%sender.nameBase@": "@%args);
}
// Command by Eolk (honestly, even though it looks like someone else's code).
function ccCancelVote(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(Game.ScheduleVote $= "")
{
messageClient(%sender, "MsgNo", "\c2There is no vote to cancel!");
return;
}
cancel(Game.scheduleVote);
Game.votingArgs = "";
Game.scheduleVote = "";
Game.kickClient = "";
clearVotes();
messageAll('closeVoteHud', "");
if(%client.team != 0)
clearBottomPrint(%client);
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@" \c2has cancelled the vote.");
messageAll('MsgVoteFailed', "");
logEcho(%sender.nameBase@" ("@%sender@") has cancelled the vote");
}
// Command by Eolk.
function ccBottomPrint(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(%args $= "")
{
messageClient(%sender, 'MsgNo', "\c2Must supply text to display!");
return;
}
%print = %args;
%wave = strstr(%args, "~w");
if(%wave != -1)
%print = getsubstr(%args, 0, %wave);
BottomprintAll(%sender.nameBase@": "@%print, 10, 3);
messageAll("MsgAll", "\c2"@ %sender.namebase@": \c4"@%print@"~wgui/objective_Notification.wav");
logEcho("[BOTTOMPRINT]"@%sender.nameBase@" ("@%sender@"): "@%args);
}
// Command by Eolk. Modified by Blnukem
function ccCenterPrint(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(%args $= "")
{
messageClient(%sender, 'MsgNo', "\c2Must supply text to display!");
return;
}
%print = %args;
%wave = strstr(%args, "~w");
if(%wave != -1)
%print = getsubstr(%args, 0, %wave);
CenterprintAll(%sender.nameBase@": "@%print, 10, 3);
messageAll("MsgAll", "\c2"@ %sender.namebase@": \c4"@%print@"~wgui/objective_Notification.wav");
logEcho("[BOTTOMPRINT]"@%sender.nameBase@" ("@%sender@"): "@%args);
}
// Eolk
function ccJailPlayer(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(!$Host::Prison::Enabled)
{
messageClient(%sender, "MsgNo", "\c2Prison is not enabled.");
return;
}
%target = plnametocid(getword(%args, 0));
%time = getword(%args, 1);
if(!isObject(%target))
{
messageClient(%sender, "MsgNo", "\c2Target does not exist.");
return;
}
if(!isObject(%target.player))
{
messageClient(%sender, "MsgNo", "\c2Target's player does not exist.");
return;
}
if((%target.isAdmin && !%sender.isAdmin) || %target.isSuperAdmin)
{
messageClient(%sender, "MsgNo", "\c2You must outrank the target to jail them.");
return;
}
if(%target == %sender && %target.isJailed && !%sender.isSuperAdmin)
{
messageClient(%sender, "MsgNo", "\c2Can only unjail yourself if you are of super admin status.");
return;
}
if(%time > 600)
%time = 600;
%test = %target.isJailed;
JailPlayer(%target, %target.isJailed, %time);
if(!%test)
{
messageClient(%target, "MsgAdminForce", "\c2You have been sentenced to jail.");
messageAllExcept(%target, -1, "MsgAdminForce", "\c3"@%target.nameBase@" \c2has been sentenced to jail.");
logEcho(%target.nameBase@" ("@%target@") was sentenced to jail by "@%sender.nameBase@" ("@%sender@") for "@%time@" seconds");
}
else
{
messageClient(%target, "MsgAdminForce", "\c2You have had your jail sentence cut short.", %sender.nameBase);
messageAllExcept(%target, -1, "MsgAdminForce", "\c3"@%target.nameBase@" \c2has had their jail sentence cut short.");
logEcho(%target.nameBase@" ("@%target@") was released from jail by "@%sender.nameBase@" ("@%sender@")");
}
}
// Command by Eolk.
function ccMute(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2No such person.");
return;
}
if((%target.isAdmin && !%sender.isSuperAdmin) || %target.isSuperAdmin)
{
messageClient(%sender, "", "\c2Can't mute someone you don't outrank!");
return;
}
if(!%target.isSilenced)
{
messageClient(%target, "", "\c2You have been muted.");
%target.isSilenced = 1;
messageClient(%sender, "", "\c3"@%target.nameBase@"\c2 has been muted.");
logEcho(%sender.nameBase@" ("@%sender@") globally muted "@%target.nameBase@" ("@%target@")");
}
else
{
%target.isSilenced = 0;
messageClient(%sender, "", "\c3"@%target.nameBase@"\c2 has been unmuted.");
logEcho(%sender.nameBase@" ("@%sender@") globally unmuted "@%target.nameBase@" ("@%target@")");
}
}
// Chat command by Eolk (special thanks to Krash for bug fixes!)
// <3
function ccaddteam(%sender)
{
if(!%sender.isAdmin)
return;
if(Game.numTeams >= 2 && $AddedMoreTeams != 1)
{
messageClient(%sender, 'MsgNo', "\c2There are already enough teams.");
return;
}
if(!$AddedMoreTeams)
{
Game.numTeams++;
setSensorGroupCount(Game.numTeams);
// clearVehicleCount(Game.numTeams + 1); // Not sure about this...
$AddedMoreTeams = 1;
$NewTeam = Game.numTeams;
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@" \c2has added another team.");
warn(%sender.nameBase@" ("@%sender@") has added another team");
}
else
{
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%obj = ClientGroup.getObject(%i);
if(%obj.team == $NewTeam)
{
Game.forceObserver(%obj, "AdminForce");
messageClient(%obj, 'MsgYes', "\c2You have been forced into observer due to being on the deleted team.");
}
}
Game.numTeams--;
setSensorGroupCount(Game.numTeams);
$AddedMoreTeams = 0;
$NewTeam = "";
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@" \c2has deleted the new team. All people have been forced into observer.");
warn(%sender.nameBase@" ("@%sender@") has deleted the new team");
}
}
// Eolk
function ccSummon(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(%sender.isJailed)
{
messageclient(%sender, "MsgNo", "\c2You cannot do this command while in jail!");
return;
}
if(!isObject(%sender.player))
{
messageclient(%sender, "MsgNo", "\c2You must have a player object in order to do this.");
return;
}
%target = plnametocid(%args);
if(!isObject(%target))
{
messageclient(%sender, "MsgNo", "\c2Target does not exist.");
return;
}
if(%target.isJailed)
{
messageclient(%sender, "MsgNo", "\c2Target is jailed.");
return;
}
if(!isObject(%target.player))
{
messageclient(%sender, "MsgNo", "\c2Your target has to have a player object in order to do this.");
return;
}
%x = getword(%sender.player.position, 0);
%y = getword(%sender.player.position, 1);
%z = getword(%sender.player.position, 2) + 2.5;
%newpos = %x SPC %y SPC %z;
%target.player.setPosition(%newpos);
%target.player.setVelocity("0 0 0");
messageClient(%target, "MsgYes", "\c2You have been summoned by\c3 "@%sender.namebase@"\c2.");
messageClient(%sender, "MsgYes", "\c2You have summoned \c3"@%target.namebase@"\c2.");
}
// Blnukem/Eolk
function ccDesmurf(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Cannot find target.");
return;
}
if(!%target.isSmurf)
messageClient(%sender, "", "\c2No smurf name detected.");
else
getRealName(%target, %sender);
logEcho(%sender.nameBase@" ("@%sender@") requested non-smurf name of "@%target.nameBase@" ("@%target@")");
}
// Eolk
function ccGoto(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(%sender.isJailed)
{
messageclient(%sender, "MsgNo", "\c2You cannot do this command while in jail!");
return;
}
if(!isObject(%sender.player))
{
messageclient(%sender, "MsgNo", "\c2You must have a player object in order to do this.");
return;
}
%target = plnametocid(%args);
if(!isObject(%target))
{
messageclient(%sender, "MsgNo", "\c2Target does not exist.");
return;
}
if(%target.isJailed)
{
messageclient(%sender, "MsgNo", "\c2Target is jailed.");
return;
}
if(!isObject(%target.player))
{
messageclient(%sender, "MsgNo", "\c2Your target has to have a player object in order to do this.");
return;
}
%x = getword(%target.player.position, 0);
%y = getword(%target.player.position, 1);
%z = getword(%target.player.position, 2) + 2.5;
%newpos = %x SPC %y SPC %z;
%sender.player.setPosition(%newpos);
%sender.player.setVelocity("0 0 0");
messageClient(%sender, "MsgYes", "\c2You have gone to\c3 "@%target.namebase@"'s \c2location.");
if(%sender.isAdmin)
messageClient(%target, "MsgYes", "\c3"@%sender.nameBase@" \c2has come to you.");
}
// Eolk
function ccMoveme(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(getwordcount(%args) != 3)
{
messageClient(%sender, "MsgNo", "\c2Your movement was not specified in X Y Z format.");
return;
}
if(%sender.isJailed)
{
messageclient(%sender, "MsgNo", "\c2You cannot do this command while in jail!");
return;
}
%newpos = VectorAdd(%sender.player.position, %args);
%sender.player.setPosition(%newpos);
}
// Eolk
function ccmoveto(%sender, %args)
{
if(!%sender.isAdmin)
return;
if(getwordcount(%args) != 3)
{
messageClient(%sender, "MsgNo", "\c2Your movement was not specified in X Y Z format.");
return;
}
if(%sender.isJailed)
{
messageclient(%sender, "MsgNo", "\c2You cannot do this command while in jail!");
return;
}
%sender.player.setPosition(%args);
}
// Blnukem/Eolk
function ccKill(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(%args);
if(%target == %sender)
{
messageClient(%sender, "", "\c2You cannot kill yourself.");
return;
}
if(%target.isSuperAdmin)
{
messageClient(%sender, "", "\c2You cannot kill Super Admins.");
return;
}
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Cannot find target.");
return;
}
if(!isObject(%target.player))
{
messageClient(%sender, "", "\c2Cannot find target.");
return;
}
%target.player.scriptkill($DamageType::Idiocy);
messageAll("", "~wfx/misc/bounty_completed.wav");
warn(%sender.nameBase@" ("@%sender@") killed "@%target.nameBase@" ("@%target@") using admin force");
}
// Eolk
function ccForceTeamSpawn(%sender, %args)
{
if(!%sender.isAdmin)
return;
%team = getword(%args, 0);
%sp = getword(%args, 1);
if(%sp !$= "")
%sp = %sp - 1; // Subtract one to have things make a little more sense.
if(%team $= "")
{
messageClient(%sender, "MsgNo", "\c2A team must be specified.");
return;
}
if(%sp $= "")
{
$UseForcedTeamSpawn[%team] = 0;
$ForcedSpawn[%team] = "";
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has released the forced spawn for team \c3"@%team@"\c2. If you wish to not spawn at the point anymore, use /choosespawn to reset.");
return;
}
if(!isObject($teamSP[%team, %sp]))
{
messageClient(%sender, "MsgNo", "\c2The spawnpoint specified doesn't exist.");
return;
}
if(!$teamSP[%team, %sp].active)
{
messageClient(%sender, "MsgNo", "\c2The spawnpoint specified is not powered.");
return;
}
$UseForcedTeamSpawn[%team] = 1;
$ForcedSpawn[%team] = $teamSP[%team, %sp];
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has forced team\c3 "@%team@"\c2 to spawn at spawnpoint \c3"@%sp+1@"\c2.");
warn(%sender.nameBase@" ("@%sender@") forced team"@%team@" to spawn at spawn"@%sp);
}
// By Eolk
function ccSaveBuilding(%sender, %args)
{
if(!%sender.isAdmin)
return;
%rad = getword(%args, 0);
%file = getword(%args, 1);
SaveBuilding(%sender, %rad, %file, 1, 0);
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 is saving the buildings with a radius of \c3"@%rad@"\c2.");
messageClient(%sender, "", "\c2Building saved to\c3 "@$SaveBuilding::LastFile@"\c2.");
warn(%sender.nameBase@" ("@%sender@", GUID: "@%sender.guid@") attempted save buildings within a radius of "@%radius@" to file "@%file);
}
// Eolk
function ccLoadBuilding(%sender, %args)
{
if(!%sender.isAdmin)
return;
LoadBuilding(%args);
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@" \c2has loaded a building.");
warn(%sender.nameBase@" ("@%sender@", GUID: "@%sender.guid@") loaded file "@%args);
}
// Blnukem
function ccTurrets(%sender) {
if (!%sender.isAdmin)
return;
if ($TurretEnableOverride) {
$TurretEnableOverride = 0;
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has disabled turrets.");
}
else {
$TurretEnableOverride = 1;
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has enabled turrets.");
}
logEcho("$TurretEnableOverride (turrets work in purebuild) changed to "@$TurretEnableOverride@" by "@%sender.nameBase@" ("@%sender@") using ccTurrets");
}
// Blnukem
function ccBuySCG(%sender) {
if (!%sender.isAdmin)
return;
if(!isObject(%sender.player))
{
messageClient(%sender, "", "\c2You must be playing in order to get a Super Chaingun.");
return;
}
messageClient(%sender, "", "\c2A Super Chaingun has been added to your inventory.");
%sender.player.setInventory(SuperChaingun, 1, true);
}
// Eolk
function ccChangeName(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(getword(%args, 0));
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Invalid Target.");
return;
}
%name = getwords(%args, 1, getWordCount(%args) - 1);
if(%name $= "")
{
messageClient(%sender, 'MsgNo', "\c2Need to supply a name!");
return;
}
if(%name $= "reset")
{
ChangeName(%target, "reset");
messageClient(%target, "", "\c2Your name has been reset.");
warn(%sender.nameBase@" ("@%sender@") has reset "@%target.nameBase@"'s ("@%target@") name");
return;
}
ChangeName(%target, %name);
messageClient(%target, "", "\c2Your new name is \c3"@%name@"\c2.");
warn(%sender.nameBase@" ("@%sender@") changed "@%target.nameBase@"'s ("@%target@") name to "@%name);
}
// Eolk
function ccSavePlayer(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(getword(%args, 0));
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Invalid target.");
return;
}
%name = getword(%args, 1);
if(%name $= "")
{
messageClient(%sender, "", "\c2Invalid name.");
return;
}
%folder = $SaveBuilding::SaveFolder @ %name; // I really don't know if we should check for invalid characters
new FileObject("Building"); // or not. I think Tribes 2 does that automatically.
Building.openforwrite(%folder);
Building.writeLine("// Saved by \"" @ getField(%sender.nameBase,0) @ "\"");
Building.writeLine("// Created in mission \"" @ $MissionName @ "\"");
Building.writeLine("// Construction " @ $ModVersion);
Building.writeLine("");
%group = nameToID("MissionCleanup/Deployables"); // We should really check isObject here... and we will!
if(!isObject(%group))
{
messageClient(%sender, "", "\c2There are no deployables!");
return;
}
for(%i = 0; %i < %group.getCount(); %i++)
{
%depl = %group.getObject(%i);
if(isObject(%depl) && %depl.getOwner() == %target)
{
%towrite = writeBuildingComponent(%depl); // This will return null if invalid.
if(%towrite !$= "")
Building.writeline(%towrite);
}
}
Building.close();
Building.delete();
messageAll('MsgAdminForce', "\c2"@%sender.nameBase@" is saving "@%target.nameBase@"'s buildings.");
messageClient(%sender, "", "\c2Building saved to "@%folder@".");
logEcho(%sender.nameBase@" ("@%sender@") saved "@%target.nameBase@"'s pieces to file "@%name);
}
// Command made by Eolk.
function ccForceGivePieces(%sender, %args)
{
if(!%sender.isAdmin)
{
messageClient(%sender, "", "\c2This is the admin give pieces. Regular clients have to use /givepieces target.");
return;
}
%from = (getWord(%args, 0) !$= "orphan" ? plnametocid(getWord(%args, 0)) : "orphan");
%to = plnametocid(getWord(%args, 1));
if(%from !$= "orphan" && !isObject(%from))
{
messageClient(%sender, "", "\c2First argument - player doesn't exist.");
return;
}
if(!isObject(%to))
{
messageClient(%sender, "", "\c2Second argument - player doesn't exist.");
return;
}
GivePieces(%from, %to);
if(%from !$= "orphan")
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has forced \c3"@%from.nameBase@"\c2 to transfer "@(%from.sex $= "Male" ? "his" : "her")@" pieces to \c3"@%to.nameBase@"\c2.");
else
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has given all orphans to \c3"@%to.nameBase@"\c2.");
logEcho(%sender.nameBase@" ("@%sender@") gave "@(%from == "orphan" ? "all orphaned" : %from.nameBase@"'s ("@%from@")")@" pieces to "@%to.nameBase@" ("@%to@")");
}
// Eolk
function ccGiveClientPieces(%sender, %args)
{
if(!%sender.isAdmin)
{
messageClient(%sender, "", "\c2This command is for admins only.");
return;
}
%from = getword(%args, 0);
%to = plnametocid(getWord(%args, 1));
if(!isObject(%to))
{
messageClient(%sender, "", "\c2The receiving client doesn't exist.");
return;
}
GivePieces(%from, %to);
messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 has given all the pieces of client \c3"@%from@"\c2 to \c3"@%to.nameBase@".");
logEcho(%sender.nameBase@" ("@%sender@") gave all pieces owned by client "@%from@" to "@%to.nameBase@" ("@%to@")");
}
// Blnukem
function ccTest (%sender,%args)
{
if(!%sender.isAdmin){
return;
}
%x = getword(%sender.player.position, 0);
%y = getword(%sender.player.position, 1);
%z = getTerrainHeight(%x SPC %y) + 5;
%rot = "0 0 1 "@getRandom(1,360);
%newpos = %x SPC %y SPC %z;
if(%args $= "Raptor")
{
%type = ScoutFlyer;
} else if(%args $= "Airwing")
{
%type = StrikeFlyer;
} else if(%args $= "Superior")
{
%type = SuperiorityFighter;
}
if(%args $= "")
{
MessageClient(%sender, "Msg", "\c2Please specifiy the vehicle type.");
} else if(%args !$= "Raptor" && %args !$= "Airwing" && %args !$= "Superior")
{
MessageClient(%sender, "Msg", "\c3"@%args@"\c2 is not a valid vehicle.");
}
%veh = new FlyingVehicle()
{
dataBlock = ""@%type@"";
position = ""@%newpos@"";
rotation = ""@%rot@"";
team = %sender.team;
};
MissionCleanUp.add(%veh);
setTargetSensorGroup(%veh.getTarget(), %sender.team);
commandToClient(%sender,'SetDefaultVehicleKeys', true);
commandToClient(%sender,'SetPilotVehicleKeys', true);
%veh.mountObject(%sender.player,0);
%veh.playAudio(0, MountVehicleSound);
%sender.player.mVehicle = %col;
%datablock = %type;
%datablock.playerMounted(%veh,%sender.player, 0);
}
// Eolk
function ccNoVote(%sender, %args)
{
if(!%sender.isAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Target does not exist.");
return;
}
if(%target.isAdmin)
{
messageClient(%sender, "", "\c2This command does not affect admins.");
return;
}
if(Game.scheduleVote !$= "")
{
messageClient(%sender, "", "\c2Cannot do this while a vote is in progress.");
return;
}
if(%target.canVote)
{
messageClient(%sender, "", "\c3"@%target.nameBase@"'s \c2ability to vote has been taken away.");
%target.canVote = false;
}
else
{
messageClient(%sender, "", "\c3"@%target.nameBase@"'s \c2ability to vote has been given back.");
%target.canVote = true;
}
}

View file

@ -0,0 +1,234 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Help Commands, by Blnukem.
// Note to other ACCM Devs, this method is best for telling clients each command
// and it is pretty clean. Although it can be a pain when adding new commands,
// but I'll be doing that, not you guys. (Since Eolk will fuck it up [Again])
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function ccSquadHelp(%sender, %args){
messageClient(%sender, "", "\c3/CreateSquad [Name] \c2- Create your own squad. (Sergeant Rank Required)");
messageClient(%sender, "", "\c3/S [Text] \c2- Privatly Chat with your squad.");
messageClient(%sender, "", "\c3/LeaveSquad \c2- Leave the squad you are in.");
messageClient(%sender, "", "\c3/Invite [PlayerName] \c2- Invite a person to your Squad.");
messageClient(%sender, "", "\c3/RequestInvite [SquadName] \c2- Request an Invite to a Squad.");
messageClient(%sender, "", "\c3/Join \c2- Use this to accept an invite to a squad.");
messageClient(%sender, "", "\c3/SOL \c2- Spawn around your squad's leader.");
messageClient(%sender, "", "\c3/ListSquads \c2- Lists all squads in the server.");
messageClient(%sender, "", "\c3/Force [Join/Leave] [SquadName] [PlayerName] \c2- Force a person to leave/join a squad. (General Rank Required)");
}
function ccRankHelp(%sender, %args){
messageClient(%sender, "", "\c3/ItemRestrictions \c2- Gives a list of the weapons/packs that are restricted to ranks.");
messageClient(%sender, "", "\c3/Top5 \c2- Gives a list of players with the highest ranks.");
messageClient(%sender, "", "\c3/ListRanks \c2- Lists all the ranks and the points required to get that rank.");
messageClient(%sender, "", "\c3/CheckStats \c2- Check your current rank and score.");
messageClient(%sender, "", "\c3/CheckStats [PlayerName] \c2- Check the current rank and score of another person.");
}
function ccItemRestrictions(%sender, %args){
messageClient(%sender, "", "\c3M79 Grenade Launcher \c2- Points Required:\c3 1250\c2 Rank Required:\c3 Specialist\c2.");
messageClient(%sender, "", "\c3Gauss Cannon \c2- Points Required:\c3 4800\c2 Rank Required:\c3 Master Sergeant\c2.");
messageClient(%sender, "", "\c3Napalm Mortar \c2- Points Required:\c3 6000\c2 Rank Required:\c3 Second Lieutenant\c2.");
messageClient(%sender, "", "\c3Jet Booster Pack \c2- Points Required:\c3 2550\c2 Rank Required:\c3 Staff Sergeant\c2.");
messageClient(%sender, "", "\c3Flame Turret Barrel \c2- Points Required:\c3 1800\c2 Rank Required:\c3 Sergeant\c2.");
}
function ccListRanks(%sender, %args){
messageClient(%sender, "", "\c3Private\c2 - Points Required:\c3 250\c2.");
messageClient(%sender, "", "\c3Private First Class\c2 - Points Required:\c3 500\c2.");
messageClient(%sender, "", "\c3Corporal\c2 - Points Required:\c3 1250\c2.");
messageClient(%sender, "", "\c3Specialist\c2 - Points Required:\c3 1800\c2.");
messageClient(%sender, "", "\c3Sergeant\c2 - Points Required:\c3 2550\c2.");
messageClient(%sender, "", "\c3Staff Sergeant\c2 - Points Required:\c3 3600\c2.");
messageClient(%sender, "", "\c3Sergeant First Class\c2 - Points Required:\c3 4800\c2.");
messageClient(%sender, "", "\c3Master Sergeant\c2 - Points Required:\c3 6000\c2.");
messageClient(%sender, "", "\c3Second Lieutenant\c2 - Points Required:\c3 8500\c2.");
messageClient(%sender, "", "\c3First Lieutenant\c2 - Points Required:\c3 9750\c2.");
messageClient(%sender, "", "\c3Captian\c2 - Points Required:\c3 9750\c2.");
messageClient(%sender, "", "\c3Major\c2 - Points Required:\c3 11000\c2.");
messageClient(%sender, "", "\c3Lieutenant Colonel\c2 - Points Required:\c3 15500\c2.");
messageClient(%sender, "", "\c3Colonel\c2 - Points Required:\c3 18500\c2.");
messageClient(%sender, "", "\c3Brigadier General\c2 - Points Required:\c3 22500\c2.");
messageClient(%sender, "", "\c3Major General\c2 - Points Required:\c3 30000\c2.");
messageClient(%sender, "", "\c3Lieutenant General\c2 - Points Required:\c3 50000\c2.");
messageClient(%sender, "", "\c3General\c2 - Points Required:\c3 75000\c2.");
messageClient(%sender, "", "\c3General Of The Army\c2 - Points Required:\c3 90000\c2.");
}
function ccZombiePointHelp(%sender, %args){
return;
if(!%sender.isAdmin && !%sender.isZombieKeeper)
return;
messageClient(%sender, "", "\c3/PlaceZombiePoint [SpawnName] [ZType] [Time] [MaxZombies] [ZombieLimit] \c2- Places an advanced zombie point.");
messageClient(%sender, "", "\c3/ListZombieSpawns \c2- Lists all the advanced zombie points.");
messageClient(%sender, "", "\c3/DisableSpawn [SpawnName] \c2- Disables an advanced zombie point by label.");
messageClient(%sender, "", "\c3/DisableAllSpawns \c2- Disables all advanced zombie points.");
messageClient(%sender, "", "\c3/EnableSpawn [SpawnName] \c2- Enables an advanced zombie point by label.");
messageClient(%sender, "", "\c3/EnableAllSpawns \c2- Enables all advanced zombie points.");
messageClient(%sender, "", "\c3/RemoveSpawn [SpawnName] \c2- Removes an advanced zombie spawn.");
messageClient(%sender, "", "\c3/RemoveAllSpawns \c2- Removes all advanced zombie spawns.");
messageClient(%sender, "", "\c3/GetStatus [SpawnName] \c2- Get the status of a an advanced zombie spawn by label.");
messageClient(%sender, "", "\c3/MarkZombieSpawns \c2- Mark all zombie spawns.");
messageClient(%sender, "", "\c3/SaveSpawns [Radius] [FileName.cs] \c2- Save all of the advanced zombie spawns whithin said radius to said filename.");
messageClient(%sender, "", "\c3/LoadSpawns [Radius] [FileName.cs] \c2- Load zombie spawns whithin said filename.");
messageClient(%sender, "", "\c3/ReplaceSpawn Type[Single/Radius/All] [Arg2] \c2- Replaces advanced spawns with regular spawns. Which ones get replaced depends solely on your input.");
}
function ccHelp(%sender, %args)
{
%base = strlwr(getword(%args, 0));
switch$(%base){
case "":
messageClient(%sender, "", "\c2Help command options:");
messageClient(%sender, "", "\c3BasicCommands \c2- \c3BuildingOptions \c2- \c3AdminCommands \c2- \c3SACommands");
messageClient(%sender, "", "\c3SentinelCommands \c2- \c3ZombieCommands \c2- \c3DroneCommands \c2- \c3QuickCommands");
messageClient(%sender, "", "\c2Don't understand this command? Type:\c3 /Help Usage \c2to learn how it works.");
}
switch$(%base){
case "Usage":
messageClient(%sender, "", "\c0----------------------------------------------------------------------------------------------------------------------------------");
messageClient(%sender, "", "\c2To use the help command simply type:\c3 /Help \c2then the option you wish to use.");
messageClient(%sender, "", "\c2For Example, type this in global chat:\c3 /Help Test");
}
switch$(%base){
case "Test":
messageClient(%sender, "", "\c0----------------------------------------------------------------------------------------------------------------------------------");
messageClient(%sender, "", "\c2Good, you succesfully used the\c3 /Help \c2command.");
messageClient(%sender, "", "\c2You can also use Quick Commands if you don't feel like typing\c3 /Help \c2before each option.");
messageClient(%sender, "", "\c2To see the list of Quick Commands, type:\c3 /Help QuickCommands");
}
switch$(%base){
case "QuickCommands":
messageClient(%sender, "", "\c3/BasicCMDS \c2- Basic Commands.");
messageClient(%sender, "", "\c3/BuildOptions \c2- Building Options.");
messageClient(%sender, "", "\c3/ZCMDS \c2- Zombie Commands.");
messageClient(%sender, "", "\c3/SCMDS \c2- Sentinel Commands.");
messageClient(%sender, "", "\c3/DCMDS \c2- Drone Commands.");
messageClient(%sender, "", "\c3/AdminCMDS \c2- Admin Commands.");
messageClient(%sender, "", "\c3/SACMDS \c2- Super Admin Commands.");
}
switch$(%base){
case "BuildingOptions":
messageClient(%sender, "", "\c2Use the building manager in the Lobby to save your pieces.");
messageClient(%sender, "", "\c3/Delmypieces \c2- Delete all of your pieces.");
messageClient(%sender, "", "\c3/Objectscale [X Y Z] \c2- Basic scaling function.");
messageClient(%sender, "", "\c3/Getscale \c2- Get the scale of an object.");
messageClient(%sender, "", "\c3/Pos [X Y Z] \c2- This will move an object in X Y Z format.");
messageClient(%sender, "", "\c3/GetPos \c2- This gets the postition of an object.");
messageClient(%sender, "", "\c3/RankHelp \c2- Tells you basic information on ranks.");
messageClient(%sender, "", "\c3/SetFreq [#] \c2- Set your power frequency.");
messageClient(%sender, "", "\c3/ObjectName [Name] \c2- Sets a name to a deployable.");
messageClient(%sender, "", "\c3/Radius [Radius] \c2- Sets the radius for Switches/Tripwires.");
messageClient(%sender, "", "\c3/Cloak \c2- Makes your pieces invisible.");
}
switch$(%base){
case "BasicCommands":
messageClient(%sender, "", "\c3![PlayerName] [Message] \c2- Private messaging.");
messageClient(%sender, "", "\c3/Opendoor \c2- Point at a door and use this command to open it. (You can also use /Open)");
messageClient(%sender, "", "\c3/Opendoor [Password] \c2- Point at a door and use this command to open it if it\'s passworded.");
messageClient(%sender, "", "\c3/Setdoorpass [Password] \c2- Point at a door and use this to set it\'s password.");
messageClient(%sender, "", "\c3/ChooseSpawn [#] \c2- Choose a selected spawnpoint to spawn there.");
messageClient(%sender, "", "\c3/ListSpawns \c2- Displays all spawnpoints on your team.");
messageClient(%sender, "", "\c3/Hack Help \c2- Tells you how to Hack enemy teleporters.");
messageClient(%sender, "", "\c3/SquadHelp \c2- Tells you how to use squad commands.");
messageClient(%sender, "", "\c3/RankHelp \c2- Tells you basic information on ranks.");
messageClient(%sender, "", "\c3/Tips \c2- This will give you a random tip.");
}
switch$(%base){
case "SentinelCommands":
if (!%sender.isAdmin){
messageClient(%sender, "", "\c2Only Admins can use this command. ~wfx/misc/misc.error.wav");
%sender.player.scriptkill($DamageType::Idiocy);
return;
}
messageClient(%sender, "", "\c2Command\'s Temporarily Disabled.");
return;
}
switch$(%base){
case "ZombieCommands":
if ((!%sender.isAdmin) && (!%sender.isZombieKeeper)){
messageClient(%sender, "", "\c2Only Admins or Zombie Keepers can use this command. ~wfx/misc/misc.error.wav");
%sender.player.scriptkill($DamageType::Idiocy);
return;
}
messageClient(%sender, "", "\c3/BuyZpack \c2- Buy a zombie pack.");
messageClient(%sender, "", "\c3/MakeZLord [PlayerName] \c2- Make the person a lord zombie.");
messageClient(%sender, "", "\c3/MakeRapier [PlayerName] \c2- Make the person a regular zombie.");
messageClient(%sender, "", "\c3/Stalk [PlayerName] [ZType] Difficulty[Cool/Light/Medium/Heavy] \c2- Spawn zombies around a target.");
messageClient(%sender, "", "\c3/Cure [PlayerName] \c2- Cures a person.");
messageClient(%sender, "", "\c3/Infect [PlayerName] \c2- Infect the target with the zombie virus.");
messageClient(%sender, "", "\c3/KillZombies \c2- Kills all zombies and infected.");
messageClient(%sender, "", "\c3/ZDetectDist [Radius] \c2- Set how large the zombie detection distance is.");
messageClient(%sender, "", "\c3/SemiInfect [PlayerName] \c2- Infect that person with the altrenative virus.");
// messageClient(%sender, "", "\c3/ZombiePointHelp \c2- Displays commands fo advanced zombie spawn points.");
return;
}
switch$(%base){
case "DroneCommands":
if (!%sender.isAdmin){
messageClient(%sender, "", "\c2Only Admins can use this command. ~wfx/misc/misc.error.wav");
%sender.player.scriptkill($DamageType::Idiocy);
return;
}
messageClient(%sender, "", "\c3/DroneBattle [Single/Battle/Custom] \c2- Basic Command where you can spawn either single drones, full battles, or even customize battles.");
return;
}
switch$(%base){
case "AdminCommands":
if (!%sender.isAdmin){
messageClient(%sender, "", "\c2Only Admins can use this command. ~wfx/misc/misc.error.wav");
%sender.player.scriptkill($DamageType::Idiocy);
return;
}
messageClient(%sender, "", "\c3/JailPlayer [PlayerName] [Time] \c2- Sends a specified player to jail for a set amount of time.");
messageClient(%sender, "", "\c3/AddTeam \c2- Add/Removes a second team.");
messageClient(%sender, "", "\c3/Gag [PlayerName] [Time] \c2- Silences an annoying player.");
messageClient(%sender, "", "\c3/CancelVote \c2- Cancels a vote.");
messageClient(%sender, "", "\c3/DelPieces [PlayerName] \c2- Deletes a specified player\'s pieces.");
messageClient(%sender, "", "\c3/Kill [PlayerName] \c2- Kill someone.");
messageClient(%sender, "", "\c3/ChangeName [PlayerName] [NewName] \c2- Changes the target\'s name.");
messageClient(%sender, "", "\c3/Goto [PlayerName] \c2- Go directly to a specified person.");
messageClient(%sender, "", "\c3/Summon [PlayerName] \c2- Summon a specified person.");
messageClient(%sender, "", "\c3/Moveto [X Y Z] \c2- Go directly to a desired location.");
messageClient(%sender, "", "\c3/Moveme [X Y Z] \c2- Move on your X, Y or Z axis.");
messageClient(%sender, "", "\c3/BottomPrint [Text] \c2- Send a message on the bottom of the screen.");
messageClient(%sender, "", "\c3/CenterPrint [Text] \c2- Send a message in the center of the screen.");
messageClient(%sender, "", "\c3/ForceTeamSpawn [TeamName] [SpawnNumber] \c2- Forces an entire team to spawn at one spawnpoint.");
messageClient(%sender, "", "\c3/SaveBuilding [Radius] [FileName.cs] \c2- Save buildings in the server.");
messageClient(%sender, "", "\c3/LoadBuilding [FileName.cs] \c2- Load a building file.");
messageClient(%sender, "", "\c3/A [Message] \c2- Admin private messaging.");
messageClient(%sender, "", "\c3/BuySCG \c2- Force a SCG into your inventory.");
messageClient(%sender, "", "\c3/DeSmurf \c2- Remove a client\'s smurf name. And reset to their normal name.");
messageClient(%sender, "", "\c3/Turrets \c2- Enables/disables turrets.");
return;
}
switch$(%base){
case "SACommands":
if (!%sender.isSuperAdmin){
messageClient(%sender, "", "\c2Only Super Admins can use this command. ~wfx/misc/misc.error.wav");
%sender.player.scriptkill($DamageType::Idiocy);
return;
}
messageClient(%sender, "", "\c3/Admin [PlayerName] \c2- Force someone to become Admin.");
messageClient(%sender, "", "\c3/SuperAdmin [PlayerName] \c2- Force someone to become Super Admin.");
messageClient(%sender, "", "\c3/Info [PlayerName] \c2- Get basic info on a specified player.");
messageClient(%sender, "", "\c3/Echo [PlayerName] \c2- Silently mute someone without them knowing.");
messageClient(%sender, "", "\c3/Shred [PlayerName] \c2- Put someone in the ACCM paper shredder.");
messageClient(%sender, "", "\c3/SA [Message] \c2- Super Admin private messaging.");
return;
}
}

View file

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// ACCM Super Admin Commands
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Command by Eolk
function ccSA(%sender, %args)
{
if(!%sender.isSuperAdmin)
return;
for(%i = 0; %i < ClientGroup.getCount(); %i++)
{
%cl = ClientGroup.getObject(%i);
if(%cl.isSuperAdmin)
messageClient(%cl, 'MsgYes', "\c3[SA]\c2"@%sender.nameBase@": "@%args);
}
logEcho("[SUPERADMIN CHAT]: "@%sender.nameBase@": "@%args);
}
// Command by Blnukem
function ccDeadmin(%sender, %args)
{
if(!%sender.isSuperAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Unable to find target.");
return;
}
if(%target.isSuperAdmin || !%target.isAdmin)
{
messageClient(%sender, "", "\c2Target has incorrect status of adminship.");
return;
}
%target.isAdmin = false;
%target.isSuperAdmin = false;
messageAll( 'MsgStripAdminPlayer', '\c3%1 \c2has de-admined\c3 %2\c2.', %sender.name, %target.name, %target );
%target.player.setInventory("SuperChaingun", 0);
%target.player.setInventory("SuperChaingunAmmo", 0);
logEcho(%sender.nameBase@" ("@%sender@") de-admin'd "@%target.nameBase@" ("@%target@")");
}
// Command by Blnukem
function ccAdmin(%sender, %args)
{
if(!%sender.isSuperAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Unable to find target.");
return;
}
if(%target.isAdmin)
{
messageClient(%sender, "", "\c2Target has incorrect status of adminship.");
return;
}
Game.voteAdminPlayer(%sender, %target);
%target.player.setInventory("SuperChaingun", 1);
%target.player.setInventory("SuperChaingunAmmo", 999);
logEcho(%sender.nameBase@" ("@%sender@") gave admin to "@%target.nameBase@" ("@%target@")");
}
// Command by Blnukem
function ccSuperAdmin(%sender, %args)
{
if(!%sender.isSuperAdmin)
return;
%target = plnametocid(%args);
if(!isObject(%target))
{
messageClient(%sender, "", "\c2Unable to find target.");
return;
}
if(%target.isSuperAdmin)
{
messageClient(%sender, "", "\c2Target has incorrect status of adminship.");
return;
}
%target.isAdmin = true;
%target.isSuperAdmin = true;
%name = getTaggedString(%target.name);
messageAll( 'MsgSuperAdminPlayer', '\c3%3 \c2has made\c3 %2 \c2a super admin.', %target, %name, %sender.nameBase );
%target.player.setInventory("SuperChaingun", 1);
%target.player.setInventory("SuperChaingunAmmo", 999);
logEcho(%sender.nameBase@" ("@%sender@") gave super admin to "@%target.nameBase@" ("@%target@")");
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,763 @@
//==============================================================================
// Mod Functions
//==============================================================================
//------------------------------------------------------------------------------
// Made by Blnukem.
function AutoBan(%client)
{
MessageAll('MsgAdminForce', '\c3%1 \c2was automatically banned by the server.', %client.name);
%client.player.scriptKill(0);
%client.setDisconnectReason( "You have been automatically banned by the server." );
%client.schedule(0, "delete");
BanList::add(%client.guid, %client.getAddress(), $Host::BanTime);
}
//------------------------------------------------------------------------------
// Made by Blnukem and Dark Dragon DX.
function applyskin(%obj,%skin,%name)
{
%obj.target = createTarget(%obj, %name, %skin, "Male1", '', 0, PlayerSensor);
setTargetDataBlock(%obj.target, %obj.getDatablock());
setTargetSensorData(%obj.target, PlayerSensor);
setTargetSensorGroup(%obj.target, 6);
setTargetSkin(%obj.target, %skin);
setTargetName(%obj.target, addtaggedstring(%name));
}
//------------------------------------------------------------------------------
// Made by Blnukem.
function LoadDefaultSettings() {
$Host::Cascade = 0;
Call("EnableVehicles");
}
//------------------------------------------------------------------------------
// Made by Blnukem.
function ClearBasicTimer(%obj)
{
if(isObject(%obj))
{
if(%obj.BasicTimer > 0)
{
%obj.BasicTimer -= 1;
%obj.BasicTimerSchedule = Schedule(1000, 0, "ClearBasicTimer", %obj);
}
}
}
//------------------------------------------------------------------------------
// Originally by Eolk, revised by Blnukem.
function Cure(%args)
{
%args.player.infected = 0;
cancel(%args.player.infectedDamage);
%args.player.infectedDamage = "";
%args.player.beats = 0;
%args.player.canZkill = 0;
%args.player.hit = 0;
cancel(%args.player.zombieAttackImpulse);
}
//------------------------------------------------------------------------------
// Unknown Author
function plnametocid(%name)
{
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++)
{
%obj = ClientGroup.getObject(%i);
%nametest = strlwr(%obj.namebase);
%name = strlwr(%name);
if(strstr(%nametest, %name) != -1)
return %obj;
}
return 0;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function addToZombiePointGroup(%obj)
{
%grp = nameToId("MissionCleanup/ZombiePoints");
if(!isObject(%grp))
{
%grp = new SimGroup("ZombiePoints");
MissionCleanup.add(%grp);
}
%grp.add(%obj);
}
//------------------------------------------------------------------------------
// Made by Eolk... Just supposed to make things pretty
function ZombiePoint::setStatus(%this, %status)
{
%this.status = %status;
}
//------------------------------------------------------------------------------
// Made by Eolk... Long, isn't it?
function ZombiePoint::StartSpawnLoop(%this)
{
if(%this.disabled)
return;
if(%this.maximumZombies != -1)
%this.spawnedZombies++;
if(%this.maximumZombies != -1 && (%this.spawnedZombies >= %this.maximumZombies))
{
%this.disabled = 1;
return;
}
if(%this.zombieLimit != -1 && (getwordcount(%this.zombieList) >= %this.zombieLimit))
{
%this.zombieLoop = %this.schedule(%this.timeout * 1000, "StartSpawnLoop");
return;
}
if(ZombieGroup.getCount() >= $Host::MaxZombies && $Host::MaxZombies != -1)
{
%this.zombieLoop = %this.schedule(%this.timeout * 1000, "StartSpawnLoop");
return;
}
%test = %this.type;
if(%this.type $= "random")
{
%num = getRandom(1, 5);
if(%num == 2)
%test = "ravenger";
else if(%num == 3)
%test = "lord";
else if(%num == 4)
%test = "demon";
else if(%num == 5)
%test = "rapier";
else
%test = "regular";
}
switch$(%test)
{
case "regular":
%zombie = new Player() {
datablock = "ZombieArmor";
};
applyskin(%zombie,'Zombie',"Zombie");
%type = 1;
case "ravenger":
%zombie = new Player() {
datablock = "FZombieArmor";
};
applyskin(%zombie,'Zombie',"Ravenger Zombie");
%type = 2;
case "lord":
%zombie = new player(){
datablock = "LordZombieArmor";
};
applyskin(%zombie,'ZLord',"Zombie Lord");
%zombie.client = $zombie::Lclient;
%zombie.mountImage(ZHead, 3);
%zombie.mountImage(ZBack, 4);
%zombie.mountImage(ZDummyslotImg, 5);
%zombie.mountImage(ZDummyslotImg2, 6);
%zombie.firstFired = 0;
%zombie.canmove = 1;
%type = 3;
case "demon":
%zombie = new player(){
datablock = "DemonZombieArmor";
};
applyskin(%zombie,'Zombie',"Demon Zombie");
%zombie.mountImage(ZdummyslotImg, 4);
%type = 4;
case "rapier":
%zombie = new player(){
datablock = "RapierZombieArmor";
};
applyskin(%zombie,'Zombie',"Rapier Zombie");
%zombie.mountImage(ZWingImage, 3);
%zombie.mountImage(ZWingImage2, 4);
%zombie.setActionThread("scoutRoot",true);
%type = 5;
}
%zombie.type = %type;
%zombie.setTransform(%this.spawnTransform);
%zombie.team = 0;
%zombie.canJump = 1;
%zombie.hasTarget = 0;
%zombie.isCompZomb = 1;
if(%this.zombieLimit != -1)
{
%zombie.overwatcher = %this;
%this.zombieList = listAdd(%this.zombieList, %zombie, -1);
}
AddToZombieGroup(%zombie);
schedule(1000, %zombie, "ZSetRandomMove", %zombie);
schedule(1000, %zombie, "ZombieLookforTarget", %zombie);
%this.zombieLoop = %this.schedule(%this.timeout * 1000, "StartSpawnLoop");
%this.setStatus("Spawning zombies.");
}
//------------------------------------------------------------------------------
// Made by Eolk.
function zombieSpawnByName(%name)
{
%name = strlwr(%name);
%grp = nameToId("MissionCleanup/ZombiePoints");
if(!isObject(%grp))
return 0;
for(%i = 0; %i < %grp.getCount(); %i++)
{
%obj = %grp.getObject(%i);
%objname = strlwr(%obj.label);
if(%name $= %objname)
return %obj;
}
return 0;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function AssignStalkMonitor(%target, %ztype, %stype)
{
if(isObject(%target.stalkMonitor))
return;
%s = new ScriptObject()
{
class = StalkMonitor;
};
MissionCleanup.add(%s); // this kills any lingering ones at the mission end.
// assign the necessary flags.
%s.target = %target;
// note: these are already strlwr()ed.
%s.ztype = %ztype;
%s.stype = %stype;
// this is here mainly for a reminder...
// %s.lastztype = "";
// %s.laststype = "";
%s.coolvar = "light";
%s.coolcount = 0;
%s.coolup = 1;
// tag 'em.
%target.stalkMonitor = %s;
}
// This is for easy time adjusting.
$SwarmLoopTime["heavy"] = 1000; // 1 second.
$SwarmLoopTime["medium"] = 5000; // 5 seconds.
$SwarmLoopTime["light"] = 10000; // 10 seconds.
//------------------------------------------------------------------------------
// Made by Eolk.
function StalkMonitor::StalkLoop(%this)
{
if(!%this)
return;
%target = %this.target;
if(!isObject(%target))
{
// Let's pack our bags and go. Our work is done here.
%this.doneStalking();
return;
}
if(!isObject(%target.player))
{
if(%this.stype !$= "cool")
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.stype], "StalkLoop");
else // don't update. They were in observer.
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.coolvar], "StalkLoop");
return;
}
if(ZombieGroup.getCount() >= $Host::MaxZombies && $Host::MaxZombies != -1)
{
if(%this.stype !$= "cool")
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.stype], "StalkLoop");
else // don't update. There isn't an available zombie spot.
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.coolvar], "StalkLoop");
return;
}
%monitor = %target.stalkMonitor;
%test = %monitor.ztype;
if(%test $= "random")
{
%num = getRandom(1, 5);
if(%num == 2)
%test = "ravenger";
else if(%num == 3)
%test = "lord";
else if(%num == 4)
%test = "demon";
else if(%num == 5)
%test = "rapier";
else
%test = "regular";
}
switch$(%test)
{
case "regular":
%zombie = new Player() {
datablock = "ZombieArmor";
};
applyskin(%zombie,'Zombie',"Zombie");
%type = 1;
case "ravenger":
%zombie = new Player() {
datablock = "FZombieArmor";
};
applyskin(%zombie,'Zombie',"Ravenger Zombie");
%type = 2;
case "lord":
%zombie = new player(){
datablock = "LordZombieArmor";
};
applyskin(%zombie,'ZLord',"Zombie Lord");
%zombie.client = $zombie::Lclient;
%zombie.mountImage(ZHead, 3);
%zombie.mountImage(ZBack, 4);
%zombie.mountImage(ZDummyslotImg, 5);
%zombie.mountImage(ZDummyslotImg2, 6);
%zombie.firstFired = 0;
%zombie.canmove = 1;
%type = 3;
case "demon":
%zombie = new player(){
datablock = "DemonZombieArmor";
};
applyskin(%zombie,'Zombie',"Demon Zombie");
%zombie.mountImage(ZdummyslotImg, 4);
%type = 4;
case "rapier":
%zombie = new player(){
datablock = "RapierZombieArmor";
};
applyskin(%zombie,'Zombie',"Rapier Zombie");
%zombie.mountImage(ZWingImage, 3);
%zombie.mountImage(ZWingImage2, 4);
%zombie.setActionThread("scoutRoot",true);
%type = 5;
}
%zombie.type = %type;
%pos = %target.player.position;
// cheezy randomness. Should work.
// TODO: Add a check for interior, etc. Look at alternateSpawn.
%rand = getRandomB();
if(%rand)
%x = getword(%pos, 0) + getRandom(25, 100);
else
%x = getword(%pos, 0) - getRandom(25, 100);
%rand = getRandomB();
if(%rand)
%y = getword(%pos, 1) + getRandom(25, 100);
else
%y = getword(%pos, 1) - getRandom(25, 100);
%z = getTerrainHeight(%x SPC %y);
%dapos = %x SPC %y SPC %z;
%typeMasks = $TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType;
InitContainerRadiusSearch(%dapos, 2, %typeMasks);
if(ContainerSearchNext != 0)
{
// This position isn't valid, let's not spawn this round.
if(%this.stype !$= "cool")
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.stype], "StalkLoop");
else // don't update. They were in observer.
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.coolvar], "StalkLoop");
return;
}
%zombie.setTransform(%dapos SPC "1 0 0 0");
%zombie.team = 0;
%zombie.canJump = 1;
%zombie.hasTarget = 0;
%zombie.isCompZomb = 1;
AddToZombieGroup(%zombie);
schedule(1000, %zombie, "ZSetRandomMove", %zombie);
schedule(1000, %zombie, "ZombieLookforTarget", %zombie);
if(%this.stype !$= "cool")
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.stype], "StalkLoop");
else
{
%this.UpdateCoolVariables();
%this.stalkSchedule = %this.schedule($SwarmLoopTime[%this.coolvar], "StalkLoop");
}
}
$StalkCoolTime["light"] = 10; // 100 seconds of boredom. :P
$StalkCoolTime["medium"] = 15; // 75 seconds of balanced zombie invasions.
$StalkCoolTime["heavy"] = 30; // 30 seconds of pure heck. :)
//------------------------------------------------------------------------------
// Made by Eolk.
function StalkMonitor::UpdateCoolVariables(%this)
{
%this.coolcount++;
if(%this.coolcount >= ($StalkCoolTime[%this.coolvar] + 1)) // Add an extra to it so that the amount of times actually gets done.
{
%this.coolcount = 0;
if(%this.coolvar $= "light")
{
%this.coolvar = "medium";
%this.coolup = 1;
}
else if(%this.coolvar $= "medium")
{
if(%this.coolup == 1)
%this.coolvar = "heavy";
else
%this.coolvar = "light";
}
else if(%this.coolvar $= "heavy")
{
%this.coolvar = "medium";
%this.coolup = 0;
}
else
error(%this @": Cannot update cooldown count. Unknown coolvar.");
}
}
//------------------------------------------------------------------------------
// Made by Eolk.
function StalkMonitor::doneStalking(%this)
{
// echo(%this @": Done stalking. Terminating...");
cancel(%this.stalkSchedule);
%this.stalkSchedule = "";
%this.target.stalkMonitor = "";
%this.schedule(500, "delete");
}
//------------------------------------------------------------------------------
// Made by Eolk.
function opposite(%num)
{
return %num * -1;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function SimObject::isTSStaticObject(%obj)
{
// If it doesn't have a shape name, then it definately ain't.
if(%obj.shapeName $= "")
return 0;
for(%i = 0; %i < $NumStaticTSObjects; %i++)
{
if(getword($StaticTSObjects[%i], 2) $= %obj.shapeName)
return 1;
}
return 0;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ZombieGetRandom()
{
%rand = getRandom();
if(%rand > 0.9)
return 1; // Lord Zombie
else if(%rand <= 0.8 && %rand >= 0.7)
return 2; // Rapier
else
return 0; // Regular
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ClearSaveTimeout(%cl)
{
if(isObject(%cl))
{
if(%cl.saveTimeout > 0)
{
%cl.saveTimeout -= 1;
%cl.saveTimeoutSchedule = schedule(1000, 0, "ClearSaveTimeout", %cl);
}
}
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ClearLoadTimeout(%cl)
{
if(isObject(%cl))
{
if(%cl.loadTimeout > 0)
{
%cl.loadTimeout -= 1;
%cl.loadTimeoutSchedule = schedule(1000, 0, "ClearLoadTimeout", %cl);
}
}
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ReverseGetRot(%rot, %mult)
{
%x = getword(%rot, 0) / %mult;
%y = getword(%rot, 1) / %mult;
%z = getword(%rot, 2) / %mult;
return %x SPC %y SPC %z SPC %mult;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ACCMChatLog(%client, %msg, %type, %target)
{
if($Host::ACCMChatLogging != 1 && $Host::ACCMEchoChat != 1)
return;
%msg = stripChars(%msg, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\x10\x11");
switch$(%type)
{
case 0:
%t = "[GLOBAL]";
case 1:
%t = "[TEAM]";
case 2:
%t = "[PRIVATE]";
}
%logdate = formattimestring("m-d-y");
%dir = "ServerLogs/Chat/Log of "@%logdate@".log";
if($Host::ACCMChatLogging == 1)
{
%temp = new FileObject();
%temp.openforappend(%dir);
%temp.writeline(%t @" ("@formattimestring("D m/d/y hh:nn a")@") "@%client.nameBase @""@ (%t $= "[PRIVATE]" ? " (to "@%target.nameBase@")" : "")@": "@%msg);
%temp.close();
%temp.delete();
}
if($Host::ACCMEchoChat == 1)
echo(%t @" ("@formattimestring("D m/d/y hh:nn a")@") "@%client.nameBase @""@ (%t $= "[PRIVATE]" ? " (to "@%target.nameBase@")" : "")@": "@%msg);
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ACCMConnectionLog(%client, %type, %reason)
{
if($Host::ACCMConnectionLogging != 1)
return;
if(%client.nameBase $= "Sentinel" || %client.nameBase $= "Monitor")
return;
if(%reason $= "")
%reason = "Successful manual disconnect.";
switch$(%type)
{
case "connect":
%t = "joined the server";
case "disconnect":
%t = "disconnected from the server (reason: "@%reason@")";
default:
error("ACCMConnectionLog: %type turned up unknown value. Report this!");
return;
}
%logdate = formattimestring("m-d-y");
%dir = "ServerLogs/Connections/Log of "@%logdate@".log";
%authInfo = %client.getAuthInfo();
if($playingonline)
%str = "[ONLINE] "@formattimestring("D m/d/y hh:nn a")@" (GUID: "@%client.guid@", REAL NAME: "@getField(%authInfo, 0)@", SMURF: "@%client.isSmurf@", "@%client.getAddress()@") "@%client.nameBase@" "@%t@".";
else
%str = "[OFFLINE] "@formattimestring("D m/d/y hh:nn a")@" ("@%client.getAddress()@") "@%client.nameBase@" "@%t@".";
%temp = new FileObject();
%temp.openforappend(%dir);
%temp.writeline(%str);
%temp.close();
%temp.delete();
logEcho(%str);
}
//------------------------------------------------------------------------------
// Made by Eolk.
function VectorCheck(%vec)
{
if(getword(%vec, 0) > 0)
%x = 1;
else if(getword(%vec, 0) < 0)
%x = -1;
else
%x = 0;
if(getword(%vec, 1) > 0)
%y = 1;
else if(getword(%vec, 1) < 0)
%y = -1;
else
%y = 0;
if(getword(%vec, 2) > 0)
%z = 1;
else if(getword(%vec, 2) < 0)
%z = -1;
else
%z = 0;
return %x SPC %y SPC %z;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function VectorPositive(%vec)
{
if(getword(%vec, 0) < 0)
%x = opposite(getword(%vec, 0));
else
%x = getword(%vec, 0);
if(getword(%vec, 1) < 0)
%y = opposite(getword(%vec, 1));
else
%y = getword(%vec, 1);
if(getword(%vec, 2) < 0)
%z = opposite(getword(%vec, 2));
else
%z = getword(%vec, 2);
return %x SPC %y SPC %z;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function VectorAdd2(%vec, %adder)
{
if(getword(%vec, 0) != 0)
%new1 = getword(%vec, 0) + %adder;
else
%new1 = 0;
if(getword(%vec, 1) != 0)
%new2 = getword(%vec, 1) + %adder;
else
%new2 = 0;
if(getword(%vec, 2) != 0)
%new3 = getword(%vec, 2) + %adder;
else
%new3 = 0;
return %new1 SPC %new2 SPC %new3;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function CheckGUID(%client)
{
if(!$playingonline)
{
error("CheckGUID: This does not work offline!");
return;
}
%authinfo = %client.getAuthInfo();
%guid = getField(%authinfo, 3);
return %guid;
}
//------------------------------------------------------------------------------
// Made by Eolk.
function CreateWaypoint(%pos, %name)
{
%w = new WayPoint() {
datablock = WayPointMarker;
name = %name;
};
%w.setTransform(%pos SPC "0 0 1 0");
%w.team = 0;
MissionCleanup.add(%w);
%w.schedule(10000, "delete");
}
//------------------------------------------------------------------------------
// Made by Eolk.
function ChangeName(%client, %name)
{
if(%name $= "reset")
{
if(%client.oldName !$= "")
{
removeTaggedString(%client.name);
%client.name = "";
%client.name = addTaggedString(%client.oldname);
setTargetName(%client.target, addTaggedString(%client.oldName));
messageAll('MsgClientNameChanged', "", "", %client.name, %client);
%client.oldname = "";
return;
}
}
if(%client.oldName $= "")
%client.oldName = getTaggedString(%client.name);
removeTaggedString(%client.name);
%client.name = "";
%realname = "\x10\c6"@%name@"\x11";
%client.name = addTaggedString(%realname);
setTargetName(%client.target, addTaggedString(%realname));
messageAll('MsgClientNameChanged', "", %client.oldname, %client.name, %client);
}

2772
Scripts/OptionsDlg.cs Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,83 @@
//--------------------------------------------------------------------------
// Loadout Pack
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(artilleryWeaponPackImage)
{
mass = 15;
shapeFile = "turret_tank_barrelmortar.dts";
item = artilleryWeaponPack;
mountPoint = 1;
offset = "0 -0.3 -0.75";
rotation = "-1 0 0 90";
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Deactivate";
stateName[2] = "Deactivate";
stateScript[2] = "onDeactivate";
stateTransitionOnTimeOut[2] = "Idle";
isLarge = true;
};
datablock ItemData(artilleryWeaponPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "turret_tank_barrelmortar.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "artilleryWeaponPackImage";
pickUpName = "an artillery loadout pack";
computeCRC = true;
};
function artilleryWeaponPackImage::onMount(%data, %obj, %node){
%obj.hasArtWepPack = true;
}
function artilleryWeaponPackImage::onUnMount(%data, %obj, %node){
%obj.hasArtWepPack = false;
}
function artilleryWeaponPackImage::onActivate(%data, %obj, %slot)
{
%pos = %obj.getWorldBoxCenter();
%vec = %obj.getEyeVector();
%vec = vectorAdd(VectorScale(%vec,5),%pos);
%searchResult = containerRayCast(%pos, %vec, $TypeMasks::VehicleObjectType, %obj);
if(%searchResult){
%searchObj = getWord(%searchResult, 0);
if(%searchObj.getDataBlock().getName() $= "Artillery"){
if (%obj.packset==0){
%searchobj.turretObject.setInventory(MortarAmmo, 12);
%searchobj.selweapontype = 1;
%obj.unmountImage($backpackslot);
%obj.decInventory(artilleryWeaponPack, 1);
}
else if (%obj.packset==1){
%searchobj.turretObject.setInventory(MortarAmmo, 6);
%searchobj.selweapontype = 2;
%obj.unmountImage($backpackslot);
%obj.decInventory(artilleryWeaponPack, 1);
}
}
}
}
function artilleryWeaponPackImage::onDeactivate(%data, %obj, %slot)
{
%obj.setImageTrigger($BackpackSlot, false);
}
function artilleryWeaponPack::onPickup(%this, %obj, %shape, %amount){}

View file

@ -0,0 +1,882 @@
//Dont reorder these or change the first word in them (S11 S17)... do so at your own risk.
$commsatPurchase[1] = "S11 90 S11 Aerial Recon";
$commsatPurchase[2] = "S17 60 S17 Combat Drone";
//DO NOT CHANGE THESE, i did a bad job in scripting in a universal manner :), you can add more though shouldnt be too hard.
$commsatOrder[1] = "Move";
$commsatOrder[2] = "Attack";
$commsatOrder[3] = "Guard";
$commsatOrder[4] = "Rearm";
// ------------------------------------------
// SpySatellite.cs
// ------------------------------------------
datablock TurretData(DeployedSpySatellite) : TurretDamageProfile
{
className = DeployedTurret; // VehicleTurret;
shapeFile = "turret_indoor_deployc.dts";
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
preload = true;
canControl = false;
canObserve = true;
firstPersonOnly = true;
observeParameters = "0.5 4.5 4.5";
// deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDCameraIcon;
cmdMiniIconName = "commander/MiniIcons/com_camera_grey";
targetNameTag = 'command';
targetTypeTag = 'Satellite';
mass = 0.7;
repairRate = 0;
maxDamage = 1.0;
disabledLevel = 1.0;
destroyedLevel = 1.0;
explosion = CameraGrenadeExplosion;
renderWhenDestroyed = false;
thetaMin = 60;
thetaMax = 180;
thetaNull = 180;
// primaryAxis = zaxis; //revzaxis;
isShielded = false;
energyPerDamagePoint = 1;
maxEnergy = 1000;
rechargeRate = 1.0;
sensorData = CameraSensorObject;
sensorRadius = CameraSensorObject.detectRadius;
heatSignature = 0.0;
barrel = HeliTurretParam;
numWeapons = 5;
};
datablock TurretImageData(SpySatelliteBarrel)
{
shapeFile = "turret_muzzlepoint.dts";
item = SpySatelliteBarrel;
// Turret parameters
activationMS = 150;
deactivateDelayMS = 300;
thinkTimeMS = 150;
degPerSecTheta = 580;
degPerSecPhi = 960;
attackRadius = 1;
// State transitions
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.5;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
};
function SpySatelliteBarrel::onFire(%data,%obj,%slot)
{
%range = 1000; //Max range It can move.
%rot = rotFromTransform(%obj.getTransform());
%muzzlePos = %obj.getMuzzlePoint(%slot);
%muzzleVec = %obj.getMuzzleVector(%slot);
%endPos = VectorAdd(%muzzlePos, VectorScale(%muzzleVec, %range));
%damageMasks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType |
$TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType |
$TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType |
$TypeMasks::InteriorObjectType;
%terrain = ContainerRayCast(%muzzlePos, %endPos, $TypeMasks::TerrainObjectType, %obj);
%message = "";
if (%terrain)
{
%xy = getWords(%terrain, 1, 2);
%z = getWord(%terrain, 3);
%pos = %xy SPC %z + 200;
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType |
$TypeMasks::StaticShapeObjectType |
$TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType |
$TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType);
InitContainerRadiusSearch( %pos, 2, %mask );
%test = containerSearchNext();
if (%test)
%message = "Can\'t reposition the satellite. Trajectory Blocked";
else
{
%obj.setTransform(%pos SPC %rot);
}
}
else
%message = "Trajectory not understood. Reenter.";
if (%message !$= "")
messageClient(%obj.client, 'msgBlocked', %message);
}
datablock ShapeBaseImageData(SpySatelliteDeployableImage)
{
shapeFile = "pack_deploy_sensor_pulse.dts";
item = SpySatelliteDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedSpySatellite;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
deploySound = SpySatelliteDeploySound;
maxDepSlope = 40;
emap = true;
heatSignature = 0;
minDeployDis = 0.1;
maxDeployDis = 15.0; //meters from body
};
datablock ItemData(SpySatelliteDeployable)
{
className = Pack;
catagory = "Deployables";
shapeFile = "pack_deploy_sensor_pulse.dts";
mass = 2.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "SpySatelliteDeployableImage";
pickUpName = "a command satellite pack";
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(DronePadDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = DronePadDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = StationInventory;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(DronePadDeployable)
{
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "DronePadDeployableImage";
joint = "4.5 4.5 4.5";
pickUpName = "a Drone Pad pack";
heatSignature = 0;
emap = true;
};
datablock StaticShapeData(Dronepad) : StaticShapeDamageProfile
{
className = Station;
shapeFile = "station_teleport.dts";
maxDamage = 3.5;
destroyedLevel = 3.5;
disabledLevel = 3.2;
explosion = DeployablesExplosion;
expDmgRadius = 10.0;
expDamage = 0.4;
expImpulse = 1000.0;
dynamicType = $TypeMasks::StationObjectType;
isShielded = false;
energyPerDamagePoint = 110;
maxEnergy = 50;
rechargeRate = 0.20;
renderWhenDestroyed = false;
doesRepair = true;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDStationIcon;
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
targetNameTag = 'Command Satellite';
targetTypeTag = 'Drone Pad';
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needspower = true;
};
datablock HoverVehicleData(commsatControlStation) : MPBDamageProfile
{
spawnOffset = "0 0 0";
canControl = false;
floatingGravMag = 0;
catagory = "Vehicles";
shapeFile = "vehicle_grav_scout.dts";
computeCRC = true;
debrisShapeName = "vehicle_grav_scout_debris.dts";
debris = ShapeDebris;
renderWhenDestroyed = false;
drag = 0.0;
density = 0.9;
mountPose[0] = sitting;
isProtectedMountPoint[0] = true;
cameraMaxDist = 5.0;
cameraOffset = 0.7;
cameraLag = 0.5;
numMountPoints = 1;
explosion = VehicleExplosion;
explosionDamage = 0.5;
explosionRadius = 5.0;
// Damage Levels
maxDamage = 4;
destroyedLevel = 4;
cantAbandon = 1;
cantTeamSwitch = 1;
isShielded = false;
rechargeRate = 0.7;
energyPerDamagePoint = 75;
maxEnergy = 150;
minJetEnergy = 15;
jetEnergyDrain = 0.1;
// Rigid Body
mass = 300;
bodyFriction = 0.1;
bodyRestitution = 0.5;
softImpactSpeed = 0.5; // Play SoftImpact Sound
hardImpactSpeed = 1; // Play HardImpact Sound
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 55;
speedDamageScale = 0.007;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 1;
collDamageMultiplier = 0.02;
dragForce = 25 / 45.0;
vertFactor = 0.0;
floatingThrustFactor = 0.35;
mainThrustForce = 10;
reverseThrustForce = 10;
strafeThrustForce = 0;
turboFactor = 1;
brakingForce = 25;
brakingActivationSpeed = 4;
stabLenMin = 2.25;
stabLenMax = 3.25;
stabSpringConstant = 30;
stabDampingConstant = 12;
gyroDrag = 16;
normalForce = 30;
restorativeForce = 25;
steeringForce = 100;
rollForce = 15;
pitchForce = 7;
dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 0;
dustHeight = 1;
dustTrailEmitter = TireEmitter;
dustTrailOffset = "0.0 -1.0 0.5";
triggerTrailHeight = 3.6;
dustTrailFreqMod = 15.0;
jetSound = ScoutSqueelSound;
engineSound = ScoutEngineSound;
floatSound = ScoutThrustSound;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 20.0;
hardSplashSoundVelocity = 30.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterSoftSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterSoftSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeSoftSplashSound;
minMountDist = 4;
damageEmitter[0] = SmallLightDamageSmoke;
damageEmitter[1] = SmallHeavyDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.8;
numDmgEmitterAreas = 1;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
forwardJetEmitter = WildcatJetEmitter;
cmdCategory = Tactical;
cmdIcon = CMDHoverScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_landscout_grey";
targetNameTag = 'Command Satellite';
targetTypeTag = 'Control Station';
sensorData = PlayerSensor;
checkRadius = 1.7785;
observeParameters = "1 10 10";
runningLight[0] = WildcatLight1;
runningLight[1] = WildcatLight2;
runningLight[2] = WildcatLight3;
shieldEffectScale = "0.9375 1.125 0.6";
};
function DeployedSpySatellite::onTrigger(%data, %obj, %trigger, %state)
{
switch (%trigger) {
case 0: //leftclick
if(%state){
if(%obj.minedown == 1)
commsatCyclePurchase(%obj);
else if(%obj.grenadedown == 1)
commsatPurchase(%obj);
else if(%obj.rightdown == 1)
commsatAddToGroup(%obj,%obj.selectedWeapon);
else{
if(%obj.selectedWeapon >= 1 && %obj.selectedWeapon <= 3)
commsatSelectGroup(%obj,%obj.selectedWeapon);
else if(%obj.selectedWeapon == 4)
commsatReleaseSelected(%obj);
else
commsatSelectObj(%obj);
}
}
case 3: //rightclick
if(%state){
%obj.rightdown = 1;
if(%obj.minedown == 1)
commsatCycleOrders(%obj);
else if(%obj.grenadedown == 1)
commsatIssueOrders(%obj);
}
else
%obj.rightdown = 0;
case 4: //grenade
if(%state)
%obj.grenadedown = 1;
else
%obj.grenadedown = 0;
case 5: //mine
if(%state)
%obj.minedown = 1;
else
%obj.minedown = 0;
}
}
function commsatCyclePurchase(%obj){
%num = %obj.purchasenum + 1;
if($commsatPurchase[%num] $= "")
%num = 1;
%obj.purchasenum = %num;
bottomPrint(%obj.getcontrollingclient(), getWords($commsatPurchase[%num],3,4) SPC "selected for purchase.", 5, 2 );
}
function commsatPurchase(%obj){
%team = %obj.team;
if(!isObject($commsatVPad[%obj.team]))
return;
if(getWord($commsatPurchase[%obj.purchasenum],1) <= $teamcredits[%team]){
$teamcredits[%team] -= getWord($commsatPurchase[%obj.purchasenum],1);
$teamUsedCredits[%team] += getWord($commsatPurchase[%obj.purchasenum],1);
%pos = vectorAdd($commsatVpad[%team].getPosition(),"0 0 4");
%rotation = "1 0 0 0";
%drone = getWord($commsatPurchase[%obj.purchasenum],0);
if(%drone $= "S11"){
%veh = new FlyingVehicle(){
dataBlock = S11;
position = %pos;
rotation = %rotation;
team = %team;
};
} else if(%drone $= "S17"){
%veh = new HoverVehicle(){
dataBlock = S17;
position = %pos;
rotation = %rotation;
team = %team;
};
}
MissionCleanUp.add(%veh);
setTargetSensorGroup(%veh.getTarget(), %team);
bottomPrint(%obj.getcontrollingclient(), "Drone purchased.", 5, 2 );
}
else
bottomPrint(%obj.getcontrollingclient(), "Not enough credits to purchase" SPC getWords(2,4), 5, 2 );
}
function commsatAddToGroup(%obj,%num){
%x = 0;
%y = 0;
while(getWord(%obj.selected,%y) !$= ""){
%trg = getWord(%obj.selected,%y);
if(isobject(%trg)){
%obj.group[%num,%x] = %trg;
%x++;
}
%y++;
}
bottomPrint(%obj.getcontrollingclient(), "Group created.", 5, 2 );
}
function commsatSelectGroup(%obj,%num){
%x = 0;
while(%obj.group[%num,%x] !$= ""){
if(!(%obj.group[%num,%x].selected == 1)){
if(%obj.selected $= "")
%obj.selected = %obj.group[%num,%x];
else
%obj.selected = %obj.selected SPC %obj.group[%num,%x];
%obj.group[%num,%x].selected = 1;
%x++;
}
}
bottomPrint(%obj.getcontrollingclient(), "Group selected.", 5, 2 );
}
function commsatReleaseSelected(%obj){
%y = 0;
while(getWord(%obj.selected,%y) !$= ""){
%trg = getWord(%obj.selected,%y);
if(isobject(%trg))
%trg.selected = 0;
%y++;
}
%obj.selected = "";
bottomPrint(%obj.getcontrollingclient(), "All units deselected.", 5, 2 );
}
function commsatSelectObj(%obj){
%eye = %obj.getMuzzleVector(2);
%pos = %obj.getMuzzlePoint(2);
%search = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%eye,2000)), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TerrainObjectType, %obj);
if(%search){
%srcobj = firstWord(%search);
%srcpos = posFromRaycast(%search);
InitContainerRadiusSearch(%srcpos,10,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
while ((%TObject = containerSearchNext()) != 0){
if(%TObject.team == %obj.team && !(%Tobject.selected == 1)){
if(%obj.selected $= ""){
%obj.selected = %Tobject;
%Tobject.selected = 1;
bottomPrint(%obj.getcontrollingclient(), "Unit Selected.", 5, 2 );
return;
} else {
%obj.selected = %obj.selected SPC %Tobject;
%Tobject.selected = 1;
bottomPrint(%obj.getcontrollingclient(), "Unit Selected.", 5, 2 );
return;
}
}
}
}
}
function commsatCycleOrders(%obj){
%num = %obj.ordernum + 1;
if($commsatOrder[%num] $= "")
%num = 1;
%obj.ordernum = %num;
bottomPrint(%obj.getcontrollingclient(), "Current orders set to" SPC $commsatOrder[%num], 5, 2 );
}
function commsatIssueOrders(%obj){
%eye = %obj.getMuzzleVector(0);
%pos = %obj.getMuzzlePoint(0);
%search = containerRayCast(%pos,vectorAdd(%pos,vectorScale(%eye,2000)), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TerrainObjectType, %obj);
%tpos = posFromRaycast(%search);
if(%obj.ordernum == 2){
if(%search){
%srcobj = firstWord(%search);
%srcpos = posFromRaycast(%search);
InitContainerRadiusSearch(%srcpos,10,$TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType);
while ((%TObject = containerSearchNext()) != 0){
if(%TObject.team != %obj.team){
%target = %Tobject;
%valid = 1;
}
}
}
if(%valid != 1){
%team = %obj.team;
%beacon = new BeaconObject(){
datablock = SubBeacon;
beaconType = "enemy";
position = %tpos;
};
%beacon.team = %team;
%beacon.owner = %obj;
%beacon.setTarget(%team);
MissionCleanup.add(%beacon);
%beacon.schedule(60000,"delete");
} else {
%target.CommandAttachBeacon();
%beacon = %target.enemybeacon;
}
}
%y = 0;
while(getWord(%obj.selected,%y) !$= ""){
%trg = getWord(%obj.selected,%y);
if(isobject(%trg)){
%datablock = %trg.getDatablock().getName();
if(%datablock $= "S11"){
%trg.tasks = $S11[$commsatOrder[%obj.ordernum]];
if(%obj.ordernum == 1)
%trg.specvar[MOVE] = %tpos;
else if(%obj.ordernum == 2){
%trg.specvar[MOE] = %beacon;
%trg.specvar[FIRE] = %beacon;
%trg.specvar[MOVE] = %trg.getPosition();
}
else if(%obj.ordernum == 3)
%trg.specvar[RECON] = %tpos;
else if(%obj.ordernum == 4){
%trg.specvar[MOVE] = $commsatVpad[%obj.team].getPosition();
%trg.specvar[MOVE,2] = %trg.getPosition();
}
S11Think(%trg);
}
else if(%datablock $= "S17"){
%trg.task = $commsatOrder[%obj.ordernum];
if(%obj.ordernum == 1)
%trg.specvar[MOVE] = %tpos;
if(%obj.ordernum == 2)
%trg.specvar[ATTACK] = %beacon;
if(%obj.ordernum == 3)
%trg.specvar[GUARD] = %tpos;
if(%obj.ordernum == 4)
%trg.specvar[REARM] = $commsatVpad[%obj.team];
S17Think(%trg);
}
}
%y++;
}
}
function commsatHudUpdate(%obj){
if(!isObject(%obj))
return;
%client = %obj.getControllingClient();
if(%client){
%message = "CREDITS:"@$teamcredits[%obj.team];
%message = %message SPC "SELECTED: Purchase/"@getWords($commsatPurchase[%obj.purchasenum],3,4);
%message = %message SPC "Order/"@$commsatOrder[%obj.ordernum];
bottomPrint(%client, %message, 2, 2 );
}
schedule(1000, 0, "commsatHudUpdate",%obj);
}
function SimObject::CommandAttachBeacon(%obj){
if(isObject(%obj.enemyBeacon))
%obj.enemyBeacon.delete();
if (%obj.team == 1)
%team = 2;
else
%team = 1;
%beacon = new BeaconObject(){
datablock = SubBeacon;
beaconType = "enemy";
position = %obj.getWorldBoxCenter();
};
%beacon.team = %team;
%beacon.owner = %obj;
%beacon.setTarget(%team);
%obj.mountObject(%beacon, 9);
%obj.enemyBeacon = %beacon;
MissionCleanup.add(%beacon);
%beacon.schedule(60000,"delete");
%wa=new Waypoint() {
position = %obj.getWorldBoxCenter();
rotation = "1 0 0 0";
dataBlock = "WayPointMarker";
team = %team;
name = "Attack this target.";
};
MissionCleanup.add(%wa);
%wa.schedule(5000,"delete");
}
function SpySatelliteDeployable::onPickup(%this, %obj, %shape, %amount){}
function SpySatelliteDeployableImage::testObjectTooClose(%item){
%xy = getWords(%item.surfacePt, 0, 1);
%z = getWord(%item.surfacePt, 2);
%z += 200;
%item.surfacePt = %xy SPC %z;
%item.surfaceNrm = "0 0 -1";
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType |
$TypeMasks::StaticShapeObjectType |
$TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType |
$TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType);
InitContainerRadiusSearch( %item.surfacePt, $MinDeployDistance, %mask );
%test = containerSearchNext();
return %test;
}
function SpySatelliteDeployableImage::onDeploy(%item, %plyr, %slot){
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
%deplObj.setCloaked(true);
%deplObj.setPassiveJammed(true);
%deplObj.selectedWeapon = 1;
%deplobj.mountImage(GST1Param, 0);
%deplobj.mountImage(SpySatelliteBarrel, 2);
%deplobj.purchaseNum = 1;
%deplobj.orderNum = 1;
$commsat[%deplobj.team] = %deplobj;
commsatHudUpdate(%deplobj);
%item.surfacePt = vectorAdd(%item.surfacePt,"0 0 -200");
%pos = %item.surfacePt;
%Drone = new HoverVehicle()
{
dataBlock = commsatControlStation;
position = %pos;
rotation = %plyr.getRotation();
team = %plyr.team;
};
MissionCleanUp.add(%Drone);
setTargetSensorGroup(%Drone.getTarget(), %team);
$commsatCPad[%deplobj.team] = %Drone;
%pos = vectorAdd(%item.surfacePt,vectorScale(%plyr.getForwardvector(),1.25));
%deplObj = new (StaticShape)() {
dataBlock = DeployedCrate12;
scale = "0.6 0.3 1";
};
%deplObj.setTransform(%pos SPC %plyr.getRotation());
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj);
addDSurface(%item.surface,%deplObj);
if($teamcredits[1] $= ""){
for(%i = 1;%i <= game.numteams; %i++){
$teamcredits[%i] = 160;
$teamUsedCredits[%i] = 0;
$teamRepCredits[%i] = 0;
}
commsatcreditloop();
}
}
function DeployedSpySatellite::onDestroyed(%this, %obj, %prevState){
if (%obj.isRemoved)
return;
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
%obj.isRemoved = true;
$TeamDeployedCount[%obj.team, SpySatelliteDeployable]--;
remDSurface(%obj);
%obj.schedule(500, delete);
$commsatCPad[%obj.team].schedule(500, delete);
}
Parent::onDestroyed(%this, %obj, %prevState);
}
function commsatControlStation::onAdd(%this, %obj){
Parent::onAdd(%this, %obj);
%obj.selectedWeapon = 1;
%obj.schedule(5000, "playThread", $AmbientThread, "ambient");
}
function commsatControlStation::playerMounted(%data, %obj, %player, %node) {
%Player.setTransform("0 0 0 0 0 1 0");
%player.vehicleTurret = %turret;
%Player.CanControl = true;
%Player.schedule(650, "CanControl = false");
// If it is not a bot, then set them up controlling the turret
%Client = %Player.client;
if (%Client.isAIControlled() == false) {
%player.setcontrolObject($commsat[%obj.team]);
%client.setcontrolObject($commsat[%obj.team]);
%client.setObjectActiveImage($commsat[%obj.team], 0);
$commsat[%obj.team].selectedWeapon = 1;
commandToClient(%client,'SetWeaponryVehicleKeys', true);
commandToClient(%client, 'setHudMode', 'Pilot', "bomber", %node);
%player.incommsat = 1;
}
%player.isBomber = true;
%Player.lastWeapon = %Player.getMountedImage($WeaponSlot);
%Player.unmountImage($WeaponSlot);
if (%Client.HavocClient == true)
commandToClient(%obj.client,'SetPassengerVehicleKeys', true);
}
function commsatControlStation::playerDismounted(%data, %Seat, %Player) {
%Seat.fireWeapon = false;
%Seat.setImageTrigger(0, false);
%Player.MCSturret = "";
%Player.CanControl = "";
%player.incommsat = 0;
if (%Player.lastVehicle == %Seat)
%Player.lastVehicle = "";
%Seat.lastPilot = "";
}
function commsatControlStation::deleteAllMounted(%data, %obj){
$commsat[%obj.team].damage(0, $commsat[%obj.team].getPosition(), 1000, $DamageType::Default);
}
function commsatControlStation::playerDismounted(%data, %obj, %player){
setTargetSensorGroup(%obj.getTarget(), %obj.team);
if( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, true );
}
function DeployedSpySatelliteMOVE( %this,%data ){
%this.setImageTrigger(2, true);
schedule(100, 0, "DeployedSpySatelliteNOMOVE", %this);
}
function DeployedSpySatelliteNOMOVE(%obj){
%obj.setImageTrigger(2,false);
}
function DronePadDeployable::onPickup(%this, %obj, %shape, %amount){}
function DronePadDeployableImage::onDeploy(%item, %plyr, %slot){
%pos = %item.surfacePt;
%deplObj = new (StaticShape)() {
dataBlock = Dronepad;
scale = "2.5 2.5 1";
};
%deplObj.setTransform(%pos SPC %plyr.getRotation());
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj);
addDSurface(%item.surface,%deplObj);
$commsatVPad[%deplobj.team] = %deplobj;
}
function DronePadDeployableImage::testNoTerrainFound(%item){}
function DronePadDeployableImage::onMount(%data, %obj, %node) {}
function DronePad::onDestroyed(%this, %obj, %prevState){
if (%obj.isRemoved)
return;
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
remDSurface(%obj);
$TeamDeployedCount[%obj.team, DronePadDeployable]--;
%obj.schedule(500, delete);
}
Parent::onDestroyed(%this, %obj, %prevState);
}
function commsatcreditloop(){
%count = ClientGroup.getCount();
%amount = %count * 30 + 50;
if(%amount < 160)
%amount = 160;
for(%i = 1;%i <= game.numteams; %i++){
%currentmax = $teamRepCredits[%i] + $teamcredits[%i] + $teamUsedCredits[%i];
if(%currentmax > %amount){
%dif = %amount - %currentmax;
if(%dif <= $teamRepCredits[%i])
$teamRepCredits[%i] -= %dif;
else{
$teamcredits[%i] -= (%dif - $teamRepCredits[%i]);
$teamRepCredits[%i] = 0;
}
}
else if(%currentmax < %amount)
$teamRepCredits[%i] += %amount - %currentmax;
if($teamRepCredits[%i] > 0){
%RepAmt = (5 + %count);
if(%RepAmt > $teamRepCredits[%i])
%RepAmt = $teamRepCredits[%i];
$teamcredits[%i] += %RepAmt;
$teamRepCredits -= %RepAmt;
}
}
schedule(20000, 0, "commsatcreditloop");
}

View file

@ -0,0 +1,163 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Deployable Waypoint - Made by Dark Dragon DX
//------------------------------------------------------------------------------
datablock StaticShapeData(DeployedWaypoint) : StaticShapeDamageProfile {
className = "Waypoint";
shapeFile = "camera.dts";
maxDamage = 5.0;
destroyedLevel = 5.0;
disabledLevel = 2.5;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 5.0;
expDamage = 0.5;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Waypoint Pack';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(WaypointDeployableImage) {
mass = 1;
emap = true;
shapeFile = "stackable1s.dts";
item = Waypointdeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = Deployedwaypoint;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(WaypointDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
joint = "1 1 1";
rotate = true;
image = "WaypointDeployableImage";
pickUpName = "a waypoint pack";
heatSignature = 0;
emap = true;
};
function WaypointDeployableImage::testObjectTooClose(%item) {
return "";
}
function WaypointDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function WaypointDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function WaypointDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%scale = getWords($packSetting["mspine",%plyr.packSet],0,2);
%mod = 0.5;
%rndcolor = getrandom(0,5);
%deplObj = new (%className)() {
dataBlock = DeployedWaypoint;
team = %plyr.team;
scale = "1 1 1";
};
%deplObj.wp = new (WayPoint)(){
dataBlock = WayPointMarker;
name = %plyr.client.namebase@"'s Waypoint";
team = %plyr.team;
scale = "0.1 0.1 0.1";
};
MissionCleanup.add(%deplObj.wp);
%mod = 0;
%h1=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%mod));
%deplObj.wp.setTransform(%h1 SPC %rot);
%deplObj.setTransform(%h1 SPC %rot);
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
addToDeployGroup(%deplObj);
AIDeployObject(%plyr.client, %deplObj);
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
serverPlay3D(%item.deploySound, %deplObj.getTransform());
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
%deplObj.deploy();
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function deployedWaypoint::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, waypointdeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
%obj.wp.schedule(500,"delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function deployedwaypoint::disassemble(%data, %plyr, %obj){
disassemble(%data,%plyr,%obj);
%obj.wp.schedule(500, "delete");
}

1823
Scripts/Packs/Effectpacks.cs Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,144 @@
// ------------------------------------------------------------------
// Flamer Ammo Pack
datablock ShapeBaseImageData(FlamerAmmoPackImage)
{
shapeFile = "ammo_plasma.dts";
item = FlamerAmmoPack;
mountPoint = 1;
offset = "0 0 -0.4";
mass = 32;
};
datablock ItemData(FlamerAmmoPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "ammo_plasma.dts";
offset = "0 -0.2 -0.55";
mass = 18.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "FlamerAmmoPackImage";
pickUpName = "an flamer ammo pack";
computeCRC = true;
// lightType = "PulsingLight";
// lightColor = "0.2 0.4 0.0 1.0";
// lightTime = "1200";
// lightRadius = "1.0";
max[ChaingunAmmo] = 0;
max[MortarAmmo] = 0;
max[MissileLauncherAmmo] = 0;
max[mgclip] = 0;
max[SniperGunAmmo] = 0;
max[BazookaAmmo] = 0;
max[MG42Clip] = 0;
max[Pistolclip] = 0;
max[FlamerAmmo] = 150;
max[AALauncherAmmo] = 0;
max[RifleClip] = 0;
max[ShotgunClip] = 0;
max[RShotgunClip] = 0;
max[LMissileLauncherAmmo] = 0;
max[RPGAmmo] = 0;
max[PBCAmmo] = 0;
};
function FlamerAmmoPack::onPickup(%this,%pack,%player,%amount)
{
// %this = AmmoPack datablock
// %pack = AmmoPack object number
// %player = player
// %amount = 1
for (%idx = 0; %idx < $numAmmoItems; %idx++)
{
%ammo = $AmmoItem[%idx];
if (%pack.inv[%ammo] > 0)
{
%amount = %pack.getInventory(%ammo);
%player.incInventory(%ammo,%amount);
%pack.setInventory(%ammo,0);
}
else if(%pack.inv[%ammo] == -1)
{
// this particular type of ammo has already been exhausted for this pack;
// don't give the player any
}
else
{
// Assume it's full if no inventory has been assigned
%player.incInventory(%ammo,%this.max[%ammo]);
}
}
}
function FlamerAmmoPack::onThrow(%this,%pack,%player)
{
// %this = AmmoPack datablock
// %pack = AmmoPack object number
// %player = player
%player.throwflamerAmmoPack = 1;
dropFlamerAmmoPack(%pack, %player);
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
serverPlay3D(ItemThrowSound, %player.getTransform());
%pack.schedulePop();
}
function FlamerAmmoPack::onInventory(%this,%player,%value)
{
// %this = AmmoPack
// %player = player
// %value = 1 if gaining a pack, 0 if losing a pack
// the below test is necessary because this function is called everytime the ammo
// pack gains or loses an item
if(%player.getClassName() $= "Player")
{
if(!%value)
if(%player.throwflamerAmmoPack == 1)
{
%player.throwflamerAmmoPack = 0;
}
else
{
dropflamerAmmoPack(-1, %player);
}
}
Pack::onInventory(%this,%player,%value);
}
function dropFlamerAmmoPack(%packObj, %player)
{
// %packObj = Ammo Pack object number if pack is being thrown, -1 if sold at inv station
// %player = player object
for(%i = 0; %i < $numAmmoItems; %i++)
{
%ammo = $AmmoItem[%i];
%pAmmo = %player.getInventory(%ammo);
%pMax = %player.getDatablock().max[%ammo];
if(%pAmmo > %pMax)
{
if(%packObj > 0)
{
%packObj.setInventory(%ammo, %pAmmo - %pMax);
}
%player.setInventory(%ammo, %pMax);
}
else
{
if(%packObj > 0)
{
%packObj.inv[%ammo] = -1;
}
}
}
}

View file

@ -0,0 +1,53 @@
//------------------------------------------
// Jet Booster Pack
// Made by: Blnukem.
//------------------------------------------
//------------------------------------------
datablock ShapeBaseImageData(BoosterPackImage)
{
shapeFile = "pack_upgrade_energy.dts";
item = BoosterPack;
mountPoint = 1;
offset = "0 0 0";
rechargeRateBoost = 1.5;
minRankPoints = 2550;
stateName[0] = "default";
stateSequence[0] = "activation";
};
datablock ItemData(BoosterPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_upgrade_energy.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "BoosterPackImage";
pickUpName = "a jet booster pack";
computeCRC = true;
};
function BoosterPackImage::onMount(%data, %obj, %node)
{
%obj.setrechargeRate(%obj.getrechargeRate() + %data.rechargeRateBoost); // Allows the charging boost
%obj.hasBoosterPack = true;
}
function BoosterPackImage::onUnmount(%data, %obj, %node)
{
%obj.setrechargeRate(%obj.getrechargeRate() - %data.rechargeRateBoost); // Takes away the charging boost when the pack is gone
%obj.hasBoosterPack = "";
}
function BoosterPack::onPickup(%this, %obj, %shape, %amount)
{
// Prevents Console Errors
}

482
Scripts/Packs/Medpack.cs Normal file
View file

@ -0,0 +1,482 @@
datablock AudioProfile(MedPackCureSound)
{
filename = "fx/packs/shield_hit.wav";
description = AudioClosest3d;
preload = true;
};
datablock ShapeBaseImageData(MedPackImage)
{
shapeFile = "pack_upgrade_ammo.dts";
item = MedPack;
mountPoint = 1;
offset = "0 0 0";
emap = true;
gun = MedPackGunImage;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateSequence[1] = "fire";
stateSound[1] = RepairPackActivateSound;
stateTransitionOnTriggerUp[1] = "Deactivate";
stateName[2] = "Deactivate";
stateScript[2] = "onDeactivate";
stateTransitionOnTimeout[2] = "Idle";
};
datablock ItemData(MedPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_upgrade_ammo.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "MedPackImage";
pickUpName = "a Med pack";
lightOnlyStatic = true;
lightType = "PulsingLight";
lightColor = "1 0 0 1";
lightTime = 1200;
lightRadius = 4;
computeCRC = true;
emap = true;
};
datablock ShapeBaseImageData(MedpackImg1)
{
shapeFile = "pack_upgrade_repair.dts";
mountPoint = 1;
offset = "0 -0.05 0";
emap = true;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateSequence[1] = "fire";
stateTransitionOnTriggerUp[1] = "Idle";
};
datablock ShapeBaseImageData(MedpackImg2)
{
shapeFile = "repair_kit.dts";
mountPoint = 1;
offset = "0 -0.2 -0.18";
emap = true;
};
datablock ShapeBaseImageData(MedpackImg2b)
{
shapeFile = "repair_kit.dts";
mountPoint = 1;
offset = "0 -0.2 0.15";
emap = true;
};
//--------------------------------------------------------------------------
// Repair Gun
datablock ShockLanceProjectileData(ReviveProj)
{
directDamage = 0;
radiusDamageType = $DamageType::ShockLance;
kickBackStrength = 0; // z0dd - ZOD, 3/30/02. More lance kick. was 2500
velInheritFactor = 0;
sound = "";
zapDuration = 1.0;
impulse = 1800;
boltLength = 16.0;
extension = 16.0;
lightningFreq = 25.0;
lightningDensity = 3.0;
lightningAmp = 0.25;
lightningWidth = 0.05;
shockwave = ShocklanceHit;
boltSpeed[0] = 2.0;
boltSpeed[1] = -0.5;
texWrap[0] = 1.5;
texWrap[1] = 1.5;
startWidth[0] = 0.3;
endWidth[0] = 0.6;
startWidth[1] = 0.3;
endWidth[1] = 0.6;
texture[0] = "special/shockLightning01";
texture[1] = "special/shockLightning02";
texture[2] = "special/shockLightning03";
texture[3] = "special/ELFBeam";
emitter[0] = ShockParticleEmitter;
};
datablock ShapeBaseImageData(MedPackGunImage)
{
shapeFile = "pack_upgrade_repair.dts";
offset = "0 0.15 0";
rotation = "1 0 0 90";
usesEnergy = true;
minEnergy = 3;
cutOffEnergy = 3.1;
emap = true;
repairFactorPlayer = 0.005;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.25;
stateName[1] = "ActivateReady";
stateScript[1] = "onActivateReady";
stateSpinThread[1] = Stop;
stateTransitionOnAmmo[1] = "Ready";
stateTransitionOnNoAmmo[1] = "ActivateReady";
stateName[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnNoAmmo[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Repair";
stateName[4] = "Repair";
stateSound[4] = RepairPackFireSound;
stateScript[4] = "onRepair";
stateAllowImageChange[4] = false;
stateSequence[4] = "fire";
stateFire[4] = true;
stateEnergyDrain[4] = 32;
stateTransitionOnNoAmmo[4] = "Deactivate";
stateTransitionOnTriggerUp[4] = "Deactivate";
stateTransitionOnNotLoaded[4] = "Validate";
stateName[5] = "Deactivate";
stateScript[5] = "onDeactivate";
stateSpinThread[5] = SpinDown;
stateSequence[5] = "activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 0.2;
stateTransitionOnTimeout[5] = "ActivateReady";
};
//---------------------------
//PACK STUFF
//---------------------------
function MedPackImage::onMount(%data, %obj, %node){
%obj.mountImage(MedpackImg1, 4);
%obj.mountImage(MedpackImg2, 7);
}
function MedPackImage::onUnmount(%data, %obj, %node)
{
if(%obj.getMountedImage($WeaponSlot))
if(%obj.getMountedImage($WeaponSlot).getName() $= "MedPackGunImage")
%obj.unmountImage($WeaponSlot);
%obj.unmountImage(4);
%obj.unmountImage(7);
}
function MedPackImage::onActivate(%data, %obj, %slot)
{
%obj.setImageTrigger(4, true);
%obj.mountImage(MedpackImg2b, 7);
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
if(%obj.isPilot())
{
%obj.setImageTrigger(%slot, false);
return;
}
if(%obj.getMountedImage($WeaponSlot).getName() !$= "MedPackGunImage")
{
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Repair pack activated.');
%obj.setArmThread(look);
%obj.mountImage(MedPackGunImage, $WeaponSlot);
commandToClient(%obj.client, 'setRepairReticle');
}
}
function MedPackImage::onDeactivate(%data, %obj, %slot)
{
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(%slot, false);
if(%obj.getMountedImage($WeaponSlot).getName() $= "MedpackGunImage")
%obj.unmountImage($WeaponSlot);
%obj.mountImage(MedpackImg2, 7);
}
//---------------------------
//GUN STUFF
//---------------------------
function MedPackGunImage::onMount(%this,%obj,%slot)
{
%obj.setImageAmmo(%slot,true);
if ( !isDemo() )
commandToClient( %obj.client, 'setRepairPackIconOn' );
%obj.usingMedGun = 1;
Bottomprint(%obj.client, "Med Gun: Fire to repair whithin a radius, jet to revive someone.\nIf on mode 2 (use mine key to toggle), you will cure an infected person.", 5, 2);
}
function MedPackGunImage::onUnmount(%this,%obj,%slot)
{
if(%obj.isreping == 1)
MedstopRepair(%obj);
%obj.setImageTrigger(%slot, false);
%obj.setImageTrigger($BackpackSlot, false);
if ( !isDemo() )
commandToClient( %obj.client, 'setRepairPackIconOff' );
%obj.usingMedGun = 0;
}
function MedPackGunImage::onRepair(%this,%obj,%slot){
%obj.isreping = 1;
%pos = %obj.getWorldBoxCenter();
%obj.reptargets = "";
InitContainerRadiusSearch(%pos, 10, $TypeMasks::PlayerObjectType);
while ((%targetObject = containerSearchNext()) != 0){
if(%targetObject.getDamageLevel() > 0.0 && %targetObject.getState() !$= "dead")
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
}
if(%obj.reptargets $= ""){
messageclient(%obj.client, 'MsgClient', '\c2No targets to repair.');
}
Medrepair(%obj, %obj.reptargets);
}
function MedPackGunImage::onDeactivate(%this,%obj,%slot)
{
MedstopRepair(%obj);
}
function Medrepair(%obj, %targets){
if(%obj.isreping == 0)
return;
if(%targets !$= ""){
%numtrgs = getNumberOfWords(%targets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%targets, %i);
if(vectorDist(%obj.getWorldBoxCenter(), %target.getWorldBoxCenter()) <= 10 && %target.getDamageLevel() > 0.0){
if(%target.reping != 1){
%target.reping = 1;
%target.setRepairRate(%target.getRepairRate() + MedPackGunImage.repairFactorPlayer);
}
}
else{
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - MedPackGunImage.repairFactorPlayer);
}
}
}
}
%pos = %obj.getWorldBoxCenter();
%obj.reptargets = "";
InitContainerRadiusSearch(%pos, 10, $TypeMasks::PlayerObjectType);
while ((%targetObject = containerSearchNext()) != 0){
if(%targetObject.getDamageLevel() > 0.0 && %targetObject.getState() !$= "dead")
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
}
if(%obj.isreping == 1)
%obj.reploop = schedule(500, 0, "Medrepair", %obj, %obj.reptargets);
}
function MedstopRepair(%obj){
%obj.isreping = 0;
if(%obj.reptargets !$= ""){
%numtrgs = getNumberOfWords(%obj.reptargets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%obj.reptargets, %i);
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - MedPackGunImage.repairFactorPlayer);
}
}
}
}
//---------------------------
//REVIVE
//---------------------------
function checkcure(%player)
{
%pos = %player.getMuzzlePoint($WeaponSlot);
%vec = %player.getMuzzleVector($WeaponSlot);
%targetpos = vectoradd(%pos,vectorscale(%vec,5));
%obj = containerraycast(%pos, %targetpos, $TypeMasks::PlayerObjectType, %player);
%obj = getword(%obj, 0);
if(!isObject(%obj))
%obj = %player;
if(!isObject(%obj.client))
{
messageClient(%player.client, "", "\c2Either you're trying to cure a zombie or that is the wrong type of object.");
return;
}
if(%obj.client.team != %player.client.team)
{
messageClient(%player.client, "", "\c2You cannot cure the other team!");
return;
}
if(!%obj.infected)
{
if(%obj != %player)
messageClient(%player.client, "", "\c2That person isn't infected.");
else
messageClient(%player.client, "", "\c2You aren't infected.");
return;
}
%obj.infected = 0;
cancel(%obj.infectedDamage);
%obj.infectedDamage = "";
%obj.beats = 0;
%obj.canZkill = 0;
%obj.hit = 0; // Ravenger bite count.
cancel(%obj.zombieAttackImpulse);
serverPlay3d(MedPackCureSound, %obj.getTransform());
if(%obj != %player)
{
messageClient(%obj.client, "", "\c2"@%player.client.nameBase@" has cured you.");
messageClient(%player.client, "", "\c2You just cured "@%obj.client.nameBase@"!");
}
else
messageClient(%obj.client, "", "\c2You have cured yourself.");
if(getRandom() > 0.9)
{
%quarter = %obj.getDatablock().maxDamage / 4;
%obj.setDamageLevel(%obj.getDamageLevel() + %quarter);
%obj.setDamageFlash(0.5);
playPain(%obj);
// Eolk - this is just a safety.
if(%obj.getDamageLevel() >= %obj.getDatablock().maxDamage)
Game.onClientKilled(%obj.client, %player.client, $DamageType::MedPackVaccine);
messageClient(%obj.client, "", "\c2You have been overdosed on the antidote vaccine!");
if(%obj != %player)
messageClient(%player.client, "", "\c2You overdosed the target with vaccine!");
}
}
function checkrevive(%obj){
if(isObject(%obj.lasttouchedcorpse)){
%Tobj = %obj.lasttouchedcorpse;
if(%Tobj.infected == 1 || %Tobj.kibbled == 1){
messageclient(%obj.client, 'MsgClient', "\c2This body is destroyed or ... changing.");
return;
}
if(vectorDist(%obj.getPosition(),%Tobj.getPosition()) > 3){
messageclient(%obj.client, 'MsgClient', "\c2Must be in contact with a body to revive it.");
return;
}
%eyevec = %obj.getEyeVector();
%eyepos = posFromTransform(%obj.getEyeTransform());
%Tvec = vectorNormalize(vectorSub(%Tobj.getPosition(),%eyepos));
if(vectorDist(%eyevec, %Tvec) > 0.5){
messageclient(%obj.client, 'MsgClient', "\c2Must be looking at body.");
return;
}
if(%Tobj.getState() !$= "dead"){
messageclient(%obj.client, 'MsgClient', "\c2Cannot revive, target isnt dead.");
return;
}
if(%Tobj.team != %obj.team){
messageclient(%obj.client, 'MsgClient', "\c2Revive target should be the same team as you.");
return;
}
if((%obj.getEnergyLevel() / %obj.getDataBlock().maxEnergy) >= 0.9){
%obj.setEnergyLevel(0);
revive(%obj, %tobj);
}
else
messageclient(%obj.client, 'MsgClient', "\c2Must have more energy to initiate reviver.");
}
else
messageclient(%obj.client, 'MsgClient', "\c2Must be in contact with a body to revive it.");
}
function revive(%obj, %target){
if(%target.client.getControlObject() !$= %target.client.player){
//necessitys
%target.setDamageLevel(%target.getdatablock().maxDamage - 0.1);
%target.client.setControlObject(%target);
%target.revived = 1;
Cancel(%target.ParaLoop);
Cancel(%target.revcheck);
%target.client.player = %target;
//points and message
%obj.client.revivecount++;
messageclient(%target.client, 'MsgClient', "\c2You were revived by "@%obj.client.namebase@".");
messageclient(%obj.client, 'MsgClient', "\c2You revived "@%target.client.namebase@".");
//effects
%target.setDamageFlash(1);
%target.setMoveState(true);
playDeathCry(%target);
revivestand(%target, 0);
for(%i =0; %i<$InventoryHudCount; %i++)
%target.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1);
%target.client.clearBackpackIcon();
%obj.playAudio(0, ShockLanceHitSound);
%p = new ShockLanceProjectile() {
dataBlock = ReviveProj;
initialDirection = vectorNormalize(vectorSub(%target.getPosition(),%obj.getMuzzlePoint($WeaponSlot)));
initialPosition = %obj.getMuzzlePoint($WeaponSlot);
sourceObject = %obj;
sourceSlot = %obj.getMuzzlePoint($WeaponSlot);
targetId = %target;
};
MissionCleanup.add(%p);
}
else
messageclient(%obj.client, 'MsgClient', "\c2Target already has another clone in use.");
}
function revivestand(%obj, %count){
if(%obj.getstate() $= "dead")
return;
if(%count <= 2){
%obj.setActionThread("scoutRoot",true);
%obj.setDamageFlash(0.7);
}
else if(%count <= 5){
%obj.setActionThread("sitting",true);
%obj.setDamageFlash(0.4);
}
else if(%count >= 6){
%obj.setActionThread("ski",true);
%obj.setMoveState(false);
return;
}
%count++;
schedule(500, 0, "revivestand", %obj, %count);
}

View file

@ -0,0 +1,406 @@
//==============================================================================
// 'Purge' Shield Generator - Version 1.3
// Made by Blnukem.
//------------------------------------------------------------------------------
// NOTES TO USERS:
// • Useful for protecting an area from zombies.
// • A large number of Zombie Demons or Lords can destroy the Purge easily.
// • Heavy maintenence is required to keep the Purge active for a long period of
// time, such as repairing the Generator constantly.
// • The Purge has an automatic maintenence system that works great if you're
// only fighting anything smaller than a Zombie Demon, but disables after a
// certain amount of damage, so you need constant maintenence.
//
// When the maintenence system is near to be disabled or when it's first
// activated, the Generator will signal an alarm.
//==============================================================================
// Lets set the amount of Purge Generators per team.
$TeamDeployableMax[ShieldDeployable] = 2;
//------------------------------------------------------------------------------
datablock EffectProfile(PurgeAlarmEffect)
{
effectname = "Bonuses/upward_perppass2_quark";
minDistance = 25.0;
maxDistance = 50.0;
};
//------------------------------------------------------------------------------
datablock AudioProfile(PurgeAlarmSound)
{
filename = "fx/Bonuses/upward_perppass2_quark";
description = AudioClosest3d;
preload = true;
effect = PurgeAlarmEffect;
};
//------------------------------------------------------------------------------
datablock StaticShapeData(DeployedShield) : StaticShapeDamageProfile {
className = shieldbase;
shapeFile = "sensor_pulse_medium.dts";
scale = "0.4 0.4 0.4";
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 1.5;
maxEnergy = 50;
rechargeRate = 0.8;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
humSound = SensorHumSound;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Purge';
targetTypeTag = 'Shield Generator';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
deploySound = StationDeploySound;
};
//------------------------------------------------------------------------------
datablock ShapeBaseImageData(ShieldDeployableImage) {
mass = 20;
emap = true;
shapeFile = "pack_deploy_sensor_pulse.dts";
item = ShieldDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedShield;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
//------------------------------------------------------------------------------
datablock ItemData(ShieldDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "pack_deploy_sensor_pulse.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "ShieldDeployableImage";
pickUpName = "a shield generator";
heatSignature = 0;
emap = true;
};
//==============================================================================
// Shield Generator Functions.
//==============================================================================
function ShieldDeployableImage::testObjectTooClose(%item) {
return "";
}
//------------------------------------------------------------------------------
function ShieldDeployableImage::testNoTerrainFound(%item) {
}
//------------------------------------------------------------------------------
function ShieldDeployable::onPickup(%this, %obj, %shape, %amount) {
}
//------------------------------------------------------------------------------
function ShieldDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
};
// Scale it.
%deplobj.setscale(%deplobj.getdatablock().scale);
%deplObj.setTransform(%item.surfacePt SPC %rot);
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
%deplObj.shieldbase = %deplObj;
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj);
AIDeployObject(%plyr.client, %deplObj);
serverPlay3D(%item.deploySound, %deplObj.getTransform());
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
%deplObj.playThread($AmbientThread,"ambient");
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
%deplObj.powerFreq = %plyr.powerFreq;
checkPowerObject(%deplObj);
// Start the loops.
DeployedShieldLoop(%deplobj);
RepairLoop(%deplobj);
return %deplObj;
}
//------------------------------------------------------------------------------
function DeployedShield::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, ShieldDeployable]--;
remDSurface(%obj);
%obj.shield.delete();
%obj.emission.delete();
%obj.schedule(800, "delete");
}
//------------------------------------------------------------------------------
function DeployedShield::disassemble(%data,%plyr,%obj)
{
disassemble(%data,%plyr,%obj);
Parent::onDestroyed(%this,%obj,%prevState);
%obj.shield.delete();
%obj.emission.delete();
}
//------------------------------------------------------------------------------
// By Blnukem:
function RepairLoop(%obj)
{ // Lets initiate self-maintenence when we reach a certain amount of damage.
if (!IsObject(%obj))
return;
if (%obj.getDamageLevel() == 1.5 || %obj.getDamageLevel() > 1.5)
{ // Initiate alarm - Generator is disabled.
%obj.setRepairRate(0.0);
serverPlay3d("PurgeAlarmSound", %obj.getWorldBoxCenter());
Schedule(800,0,"RepairLoop",%obj);
return;
}
if (%obj.getDamageLevel() < 0.01)
{ // Stop repairing.
%obj.setRepairRate(0.0);
} else if (%obj.getDamageLevel() > 1.0)
{ // Lets start repairing.
%obj.setRepairRate(0.0025);
}
Schedule(800,0,"RepairLoop",%obj);
}
//------------------------------------------------------------------------------
// By Blnukem:
function DeployedShieldLoop(%obj)
{
if (!IsObject(%obj))
return;
if (%obj.getDamageLevel() == 1.5 || %obj.getDamageLevel() > 1.5)
{
schedule(100, 0, "DeployedShieldLoop", %obj);
return;
}
if (!%obj.PowerCount)
{
schedule(100, 0, "DeployedShieldLoop", %obj);
return;
}
%Type = $TypeMasks::ProjectileObjectType | $TypeMasks::PlayerObjectType;
InitContainerRadiusSearch(%obj.getPosition(), 25, %Type);
while ((%target = ContainerSearchNext()) != 0)
{
if ((%target !$= %obj) && (strstr(%target.getDatablock().getName(), "Zombie") != -1))
{ // Lets kill any Zombies in contact with the shield.
%target.zapObject(1);
%target.scriptkill($DamageType::Idiocy);
serverPlay3d("ShockLanceHitSound",%target.getWorldBoxCenter());
%obj.applydamage(0.1); // Damage the Purge Generator.
%obj.playShieldEffect("1 1 1");
} else if ((%target !$= %obj) && (%target.getDatablock().getName() $= "DemonFireball") || (%target.getDatablock().getName() $= "LZombieAcidBall"))
{ // Lets delete any Zombie projectiles in contact with the shield.
%obj.applydamage(0.05); // Damage the Purge Generator.
%obj.playShieldEffect("1 1 1");
%target.delete();
}
}
schedule(100,0,"DeployedShieldLoop",%obj);
}
//------------------------------------------------------------------------------
function ShieldDeployableImage::onMount(%data, %obj, %node) {
return %data SPC %obj SPC %node;
}
//------------------------------------------------------------------------------
function ShieldDeployableImage::onUnmount(%data, %obj, %node) {
return %data SPC %obj SPC %node;
}
//------------------------------------------------------------------------------
function DeployedShield::onGainPowerEnabled(%data,%obj) {
Parent::onGainPowerEnabled(%data,%obj);
if (!IsObject(%obj.shield))
%obj.shield = createemitter(%obj.getposition(),ShieldBarrierSM,"0 0 0 0");
if (!IsObject(%obj.emission))
%obj.emission = createemitter(%obj.getposition(),ShieldEmission,"0 0 0 0");
}
//------------------------------------------------------------------------------
function DeployedShield::onLosePowerDisabled(%data,%obj) {
Parent::onLosePowerDisabled(%data,%obj);
if (IsObject(%obj.shield))
%obj.shield.delete();
if (IsObject(%obj.emission))
%obj.emission.delete();
}
//==============================================================================
// Shield Particles.
//==============================================================================
// Made by Sloik:
datablock ParticleData(ShieldBarrierParticles)
{
dragCoefficient = 0.0;
windCoefficient = 0;
gravityCoefficient = 0;
inheritedVelFactor = 0.0;
constantAcceleration = 0;
lifetimeMS = 5000;
lifetimeVarianceMS = 0;
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/blasterHit";
colors[0] = "0.01 0.01 0.01 1.0";
colors[1] = "0.5 1.0 1.0 1.0";
colors[2] = "0.01 0.01 0.01 0.0";
sizes[0] = 0.05;
sizes[1] = 0.2;
sizes[2] = 0.05;
times[0] = 0.0;
times[1] = 0.7;
times[2] = 1.0;
};
//------------------------------------------------------------------------------
// Made by Sloik:
datablock ParticleEmitterData(ShieldBarrierSM)
{
ejectionPeriodMS = 1;
ejectionOffset = 25;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
thetaMin = 5;
thetaMax = 175;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "ShieldBarrierParticles";
};
//------------------------------------------------------------------------------
datablock ParticleData(ShieldEmissionParticle)
{
dragCoefficient = 2;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 800;
textureName = "special/crescent3";
colors[0] = "0.01 0.01 0.01 1.0";
colors[1] = "0.5 1.0 1.0 1.0";
colors[2] = "0.01 0.01 0.01 0.0";
sizes[0] = 0.5;
sizes[1] = 0.8;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
//------------------------------------------------------------------------------
datablock ParticleEmitterData(ShieldEmission)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 40;
velocityVariance = 5.0;
ejectionOffset = 4.0;
thetaMin = 5;
thetaMax = 175;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
particles = "ShieldEmissionParticle";
};

View file

@ -0,0 +1,158 @@
datablock StaticShapeData(DeployedSentinelPatrol) : StaticShapeDamageProfile {
className = "patrolpoint";
shapeFile = "deploy_sensor_motion.dts";
maxDamage = 5.0;
destroyedLevel = 5.0;
disabledLevel = 4.21;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Sentinel';
targetTypeTag = 'Patrol Point';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
};
datablock ShapeBaseImageData(SentinelDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = SentinelDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedSentinelPatrol;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
datablock ItemData(SentinelDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "ZSpawnDeployableImage";
pickUpName = "a sentinel patrol point pack";
heatSignature = 0;
emap = true;
};
function SentinelDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
%deplObj.setScale("5 5 5");
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
%deplObj.playThread($AmbientThread,"ambient");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// Power object
checkPowerObject(%deplObj);
SentinelAI_AddPatrolPoint(%deplObj);
return %deplObj;
}
function SentinelDeployable::onPickup(%data, %obj, %shape, %amount)
{
// No more spam
}
function DeployedSentinelPatrol::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
SentinelAI_RemPatrolPoint(%obj);
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, SentinelDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
}
function DeployedSentinelPatrol::disassemble(%data, %plyr, %obj)
{
SentinelAI_RemPatrolPoint(%obj);
parent::disassemble(%data, %plyr, %obj);
}

1938
Scripts/Packs/ZSpawnpack.cs Normal file

File diff suppressed because it is too large Load diff

334
Scripts/Packs/ammopack.cs Normal file
View file

@ -0,0 +1,334 @@
// ------------------------------------------------------------------
// AMMO PACK
// can be used by any armor type
// uses no energy, does not have to be activated
// increases the max amount of non-energy ammo carried
// put vars here for ammo max counts with ammo pack
$AmmoItem[0] = ChaingunAmmo;
$AmmoItem[1] = MortarAmmo;
$AmmoItem[2] = MissileLauncherAmmo;
$AmmoItem[3] = MGclip;
$AmmoItem[4] = SniperGunAmmo;
$AmmoItem[5] = BazookaAmmo;
$AmmoItem[6] = MG42Clip;
$AmmoItem[7] = RepairKit;
$AmmoItem[8] = FlamerAmmo;
$AmmoItem[9] = AALauncherAmmo;
$AmmoItem[10] = RifleClip;
$AmmoItem[11] = ShotgunClip;
$AmmoItem[12] = RShotgunClip;
$AmmoItem[13] = LMissileLauncherAmmo;
$AmmoItem[14] = RPGAmmo;
$AmmoItem[15] = PBCAmmo;
$AmmoItem[16] = NapalmAmmo;
$AmmoItem[17] = RailGunAmmo;
$numAmmoItems = 18;
$grenAmmoType[0] = Grenade;
$grenAmmoType[1] = ConcussionGrenade;
$grenAmmoType[2] = FlashGrenade;
$grenAmmoType[3] = FlareGrenade;
$grenAmmoType[4] = SmokeGrenade;
$grenAmmoType[5] = BeaconSmokeGrenade;
$numGrenTypes = 6;
datablock ShapeBaseImageData(AmmoPackImage)
{
shapeFile = "pack_upgrade_ammo.dts";
item = AmmoPack;
mountPoint = 1;
offset = "0 0 0";
mass = 20;
};
datablock ItemData(AmmoPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_upgrade_ammo.dts";
mass = 1.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "AmmoPackImage";
pickUpName = "an ammo pack";
computeCRC = true;
// lightType = "PulsingLight";
// lightColor = "0.2 0.4 0.0 1.0";
// lightTime = "1200";
// lightRadius = "1.0";
max[ChaingunAmmo] = 1500;
max[MortarAmmo] = 4;
max[MissileLauncherAmmo] = 4;
max[Mgclip] = 3;
max[SniperGunAmmo] = 10;
max[BazookaAmmo] = 2;
max[MG42Clip] = 2;
max[FlamerAmmo] = 0;
max[Grenade] = 2;
max[Mine] = 1;
max[AALauncherAmmo] = 2;
max[RepairKit] = 1;
max[RifleClip] = 2;
max[ShotgunClip] = 2;
max[RShotgunClip] = 1;
max[LMissileLauncherAmmo] = 1;
max[RPGAmmo] = 2;
max[PBCAmmo] = 2;
max[NapalmAmmo] = 5;
max[RailGunAmmo] = 2;
};
function AmmoPack::onPickup(%this,%pack,%player,%amount)
{
// %this = AmmoPack datablock
// %pack = AmmoPack object number
// %player = player
// %amount = 1
for (%idx = 0; %idx < $numAmmoItems; %idx++)
{
%ammo = $AmmoItem[%idx];
if (%pack.inv[%ammo] > 0)
{
%amount = %pack.getInventory(%ammo);
%player.incInventory(%ammo,%amount);
%pack.setInventory(%ammo,0);
}
else if(%pack.inv[%ammo] == -1)
{
// this particular type of ammo has already been exhausted for this pack;
// don't give the player any
}
else
{
// Assume it's full if no inventory has been assigned
%player.incInventory(%ammo,%this.max[%ammo]);
}
}
// now check what type grenades (if any) player is carrying
%gFound = false;
for (%i = 0; %i < $numGrenTypes; %i++)
{
%gType = $grenAmmoType[%i];
if(%player.inv[%gType] > 0)
{
%gFound = true;
%playerGrenType = %gType;
break;
}
}
// if player doesn't have any grenades at all, give 'em whatever the ammo pack has
if(!%gFound)
{
%given = false;
for(%j = 0; %j < $numGrenTypes; %j++)
{
%packGren = $grenAmmoType[%j];
if(%pack.inv[%packGren] > 0)
{
// pack has some of these grenades
%player.incInventory(%packGren, %pack.getInventory(%packGren));
%pack.setInventory(%packGren, 0);
%given = true;
break;
}
else if(%pack.inv[%packGren] == -1)
{
// the pack doesn't have any of this type of grenades
}
else
{
// pack has full complement of this grenade type
%player.incInventory(%packGren, %this.max[%packGren]);
%given = true;
}
if(%given)
break;
}
}
else
{
// player had some amount of grenades before picking up pack
if(%pack.inv[%playerGrenType] > 0)
{
// pack has 1 or more of this type of grenade
%player.incInventory(%playerGrenType, %pack.getInventory(%playerGrenType));
%pack.setInventory(%playerGrenType, 0);
}
else if(%pack.inv[%playerGrenType] == -1)
{
// sorry Chester, the pack is out of these grenades.
}
else
{
// pack is uninitialized for this grenade type -- meaning it has full count
%player.incInventory(%playerGrenType, %this.max[%playerGrenType]);
}
}
// now see if player had mines selected and if they're allowed in this mission type
%mineFav = %player.client.favorites[getField(%player.client.mineIndex, 0)];
if ( ( $InvBanList[$CurrentMissionType, "Mine"] !$= "1" )
&& !( ( %mineFav $= "EMPTY" ) || ( %mineFav $= "INVALID" ) ) )
{
// player has selected mines, and they are legal in this mission type
if(%pack.inv[Mine] > 0)
{
// and the pack has some mines in it! bonus!
%player.incInventory(Mine, %pack.getInventory(Mine));
%pack.setInventory(Mine, 0);
}
else if(%pack.inv[Mine] == -1)
{
// no mines left in the pack. do nothing.
}
else
{
// assume it's full of mines if no inventory has been assigned
%player.incInventory(Mine,%this.max[Mine]);
}
}
}
function AmmoPack::onThrow(%this,%pack,%player)
{
// %this = AmmoPack datablock
// %pack = AmmoPack object number
// %player = player
%player.throwAmmoPack = 1;
dropAmmoPack(%pack, %player);
// do the normal ItemData::onThrow stuff -- sound and schedule deletion
serverPlay3D(ItemThrowSound, %player.getTransform());
%pack.schedulePop();
}
function AmmoPack::onInventory(%this,%player,%value)
{
// %this = AmmoPack
// %player = player
// %value = 1 if gaining a pack, 0 if losing a pack
// the below test is necessary because this function is called everytime the ammo
// pack gains or loses an item
if(%player.getClassName() $= "Player")
{
if(!%value)
if(%player.throwAmmoPack == 1)
{
%player.throwAmmoPack = 0;
// ammo stuff already handled by AmmoPack::onThrow
}
else
{
// ammo pack was sold at inventory station -- no need to worry about
// setting the ammo in the pack object (it doesn't exist any more)
dropAmmoPack(-1, %player);
}
}
Pack::onInventory(%this,%player,%value);
}
function dropAmmoPack(%packObj, %player)
{
// %packObj = Ammo Pack object number if pack is being thrown, -1 if sold at inv station
// %player = player object
for(%i = 0; %i < $numAmmoItems; %i++)
{
%ammo = $AmmoItem[%i];
// %pAmmo == how much of this ammo type the player has
%pAmmo = %player.getInventory(%ammo);
// %pMax == how much of this ammo type the player's datablock says can be carried
%pMax = %player.getDatablock().max[%ammo];
if(%pAmmo > %pMax)
{
// if player has more of this ammo type than datablock's max...
if(%packObj > 0)
{
// put ammo that player can't carry anymore in pack
%packObj.setInventory(%ammo, %pAmmo - %pMax);
}
// set player to max for this ammo type
%player.setInventory(%ammo, %pMax);
}
else
{
if(%packObj > 0)
{
// the pack gets -1 of this ammo type -- else it'll assume it's full
// can't use setInventory() because it won't allow values less than 1
%packObj.inv[%ammo] = -1;
}
}
}
// and, of course, a pass for the grenades. Whee.
%gotGren = false;
// check to see what kind of grenades the player has.
for(%j = 0; %j < $numGrenTypes; %j++)
{
%gType = $grenAmmoType[%j];
if(%player.inv[%gType] > 0)
{
%gotGren = true;
%playerGren = %gType;
break;
}
else
{
// ammo pack only carries type of grenades that player who bought it (or picked
// it up) had at the time -- all else are zeroed out (value of -1)
if(%packObj > 0)
%packObj.inv[%gType] = -1;
}
}
if(%gotGren)
{
%pAmmo = %player.getInventory(%playerGren);
%pMax = %player.getDatablock().max[%playerGren];
if(%pAmmo > %pMax)
{
if(%packObj > 0)
%packObj.setInventory(%playerGren, %pAmmo - %pMax);
%player.setInventory(%playerGren, %pMax);
}
else
if(%packObj > 0)
%packObj.inv[%playerGren] = -1;
}
else
{
// player doesn't have any grenades at all. nothing needs to be done here.
}
// crap. forgot the mines.
if(%player.getInventory(Mine) > %player.getDatablock().max[Mine])
{
// if player has more mines than datablock's max...
if(%packObj > 0)
{
// put mines that player can't carry anymore in pack
%packObj.setInventory(Mine, %player.getInventory(Mine) - %player.getDatablock().max[Mine]);
}
// set player to max mines
%player.setInventory(Mine, %player.getDatablock().max[Mine]);
}
else
{
if(%packObj > 0)
{
// the pack gets -1 for mines -- else it'll assume it's full
// can't use setInventory() because it won't allow values less than 1
%packObj.inv[Mine] = -1;
}
}
}

View file

@ -0,0 +1,59 @@
//--------------------------------------------------------------------------
// Chaingun barrel pack
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(artilleryBarrelPackImage)
{
mass = 15;
shapeFile = "pack_barrel_fusion.dts";
item = artilleryBarrelPack;
mountPoint = 1;
offset = "0 0 0";
turretBarrel = "artilleryBarrelLarge";
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Deactivate";
stateName[2] = "Deactivate";
stateScript[2] = "onDeactivate";
stateTransitionOnTimeOut[2] = "Idle";
isLarge = true;
};
datablock ItemData(artilleryBarrelPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_barrel_fusion.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "artilleryBarrelPackImage";
pickUpName = "a artillery barrel pack";
computeCRC = true;
};
function artilleryBarrelPackImage::onActivate(%data, %obj, %slot)
{
checkTurretMount(%data, %obj, %slot); // This cheks if there is a turret where the player is aiming.
}
function artilleryBarrelPackImage::onDeactivate(%data, %obj, %slot)
{
%obj.setImageTrigger($BackpackSlot, false);
}
function artilleryBarrelPack::onPickup(%this, %obj, %shape, %amount)
{
// created to prevent console errors
}

240
Scripts/Packs/blastfloor.cs Normal file
View file

@ -0,0 +1,240 @@
//---------------------------------------------------------
// Deployable floor
//---------------------------------------------------------
datablock StaticShapeData(DeployedFloor) : StaticShapeDamageProfile {
className = "floor";
shapeFile = "smiscf.dts";
maxDamage = 4;
destroyedLevel = 4;
disabledLevel = 3.5;
isShielded = true;
energyPerDamagePoint = 30;
maxEnergy = 200;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Medium Blast floor';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(FloorDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = FloorDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedFloor;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360; // also see FloorDeployableImage::testSlopeTooGreat()
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(FloorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "FloorDeployableImage";
pickUpName = "a medium floor pack";
heatSignature = 0;
emap = true;
};
function FloorDeployableImage::testSlopeTooGreat(%item) {
if (%item.surface) {
// Do we link with another Medium Floor?
if (%item.surface.getClassName() $= "StaticShape") {
if (%item.surface.getDataBlock().className $= "floor") {
%floor = 1;
}
}
if (%floor) {
if ($Host::Purebuild == true && $Host::Hazard::Enabled != true)
return getTerrainAngle(%item.surfaceNrm) > %item.maxDepSlope;
else
return getTerrainAngle(%item.surfaceNrm) > 1;
}
else
return getTerrainAngle(%item.surfaceNrm) > %item.maxDepSlope;
}
}
function FloorDeployableImage::testObjectTooClose(%item) {
if ($Host::Purebuild == true && $Host::Hazard::Enabled != true)
return "";
else {
%terrain = %item.surface.getClassName() $= "TerrainBlock";
%interior = %item.surface.getClassName() $= "InteriorInstance";
if (%item.surface.getClassName() $= "StaticShape") {
if (%item.surface.getDataBlock().className $= "floor") {
%floor = 1;
}
}
return !(%terrain || %interior || %floor);
}
}
function FloorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function FloorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function FloorDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
%rot = intRot("1 0 0 0",%playerVector);
%scale = getWords($packSetting["floor",%plyr.packSet],0,2);
if ($Host::ExpertMode == 1)
%scale = getWords(%scale,0,1) SPC firstWord($expertSetting["floor",%plyr.expertSet]);
%surfaceAdjust = 1;
// Do we link with another Medium Floor?
if (%item.surface.getClassName() $= "StaticShape") {
if (%item.surface.getDataBlock().className $= "floor") {
%surfaceAdjust = 0;
// [[Most]] Get the relative x y location from the "pure" information.
%link = sidelink(%item.surface,%item.surfaceNrm,%item.surfacePt,getWords($packSetting["floor",%plyr.packSet],3,5),"0 0 -0.5");
%location = getWords(%link,0,2);
%side = getWords(%link,3,5);
%dirside = getWords(%link,6,8);
// [[Most]] Set the rotation to match the surfaceNrm and match the side.
// The power of the full rotation system.. ;)
%rot = fullRot(%item.surfaceNrm,vectorScale(%dirside,-1));
// [[Most]] Adjust the location to match the scale.
%adjust = vectorScale(%item.surfaceNrm,GetWord(%scale,2));
%item.surfacePt = vectorSub(%location, %adjust);
}
}
// If we do not link with another Medium Floor
if(%surfaceAdjust) {
%item.surfacePt = vectorSub(%item.surfacePt,"0 0" SPC getWord(%scale,2) - 1); // Rise 1 meter above surface
}
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
scale = %scale;
};
//////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
%deplObj.setTransform(%item.surfacePt SPC %rot);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function DeployedFloor::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, FloorDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function FloorDeployableImage::onMount(%data, %obj, %node) {
%obj.hasFloor = true; // set for floorcheck
%obj.packSet = 0;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function FloorDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasFloor = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}

271
Scripts/Packs/blastwall.cs Normal file
View file

@ -0,0 +1,271 @@
//---------------------------------------------------------
// Deployable wall, Code by Parousia
//---------------------------------------------------------
datablock StaticShapeData(DeployedWall) : StaticShapeDamageProfile {
className = "wall";
shapeFile = "Bmiscf.dts"; // dmiscf.dts, alternate
maxDamage = 2;
destroyedLevel = 2;
disabledLevel = 1.5;
isShielded = true;
energyPerDamagePoint = 60;
maxEnergy = 100;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Blast Wall';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(WallDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = WallDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedWall;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0;
maxDeployDis = 50.0;
};
datablock ItemData(WallDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "WallDeployableImage";
pickUpName = "a light blast wall pack";
heatSignature = 0;
emap = true;
};
function WallDeployableImage::testObjectTooClose(%item) {
return "";
}
function WallDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function WallDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function WallDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%scale = "0.5 8 40"; // Search range for total blast wall size.
%mCenter = "0 0 -0.5";
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale,%mCenter);
%scale = getWords(%pad,0,2);
%item.surfacePt = getWords(%pad,3,5);
%rot = getWords(%pad,6,9);
%offset = %plyr.packSet - 1;
if (%plyr.packSet == 3) {
%double = 1;
%offset = 1;
}
%scale = vectorAdd(%scale,vectorScale("1.01 1.01" SPC %double,mAbs(%offset)));
%pup = mCeil(getWord(%scale,0)/4); //4 = Avarage blast wall height.
%pside = mCeil(getWord(%scale,1)/4); //4 = Avarage blast wall width.
%upiece = getWord(%scale,0)/%pup;
%spiece = getWord(%scale,1)/%pside;
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
%dir = VectorNormalize(vectorSub(%item.surfacePt,%plyr.getposition()));
%adjust = vectorNormalize(vectorProject(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
// %adjust = vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2));
if (%plyr.packSet == 3)
%offset = Lev(vectorCouple(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
%adjust = vectorScale(%adjust,-0.5 * %offset);
if ($Host::ExpertMode == 1 && %plyr.expertSet == 1) {
for (%x = 0;%x < %pup;%x++){
for (%y = 0;%y < %pside;%y++){
%scale = %upiece SPC %spiece SPC 0.5 + %double;
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
scale = %scale;
};
%up = vectorScale(%item.surfaceNrm,%upiece * (%x - (%pup / 2) + 0.5));
%side = vectorScale(%item.surfaceNrm2,%spiece * (%y - (%pside / 2) + 0.5));
%tadjust = vectorAdd(%up,vectorAdd(%side,%adjust));
%deplObj.setTransform(vectorAdd(%item.surfacePt,%tadjust) SPC %rot);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.Needsfit = 1;
addDSurface(%item.surface,%deplObj);
// [Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if(%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
// let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
}
}
}
else {
%deplObj = new (%className)() {
dataBlock = %item.deployed;
scale = %scale;
};
%deplObj.setTransform(vectorAdd(%item.surfacePt,%adjust) SPC %rot);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.Needsfit = 1;
addDSurface(%item.surface,%deplObj);
// [Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if(%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
}
// Power object
checkPowerObject(%deplObj);
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
return %deplObj;
}
function DeployedWall::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, WallDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function WallDeployableImage::onMount(%data, %obj, %node) {
%obj.hasBlast = true; // set for blastcheck
%obj.packSet = 0;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function WallDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasBlast = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}
function doorfunction(%player,%door)
{
%vec = VectorSub(%door,%player);
%dir = VectorNormalize(%vec);
%nrm = topVec(VirVec(%door,%dir));
}

225
Scripts/Packs/blastwwall.cs Normal file
View file

@ -0,0 +1,225 @@
//---------------------------------------------------------
// Deployable wall, Code by Parousia
//---------------------------------------------------------
datablock StaticShapeData(DeployedwWall) : StaticShapeDamageProfile {
className = "wwall";
shapeFile = "smiscf.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Walk Way';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(wWallDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = wwallDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedwWall;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0;
maxDeployDis = 50.0;
};
datablock ItemData(wwallDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "wWallDeployableImage";
pickUpName = "a light walkway pack";
heatSignature = 0;
emap = true;
};
function wWallDeployableImage::testObjectTooClose(%item) {
return "";
}
function wWallDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function wwallDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function wWallDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
%rot = intRot("1 0 0 0",%playerVector);
%scale ="5 5 0.5";
if ($Host::ExpertMode == 1) {
if (%plyr.expertSet == 2)
%scale = getWord(%scale,0) * 2 SPC getWords(%scale,1,2);
if (%plyr.expertSet == 3)
%scale = getWord(%scale,0) SPC getWord(%scale,1) * 2 SPC getWord(%scale,2);
}
%surfaceAdjust = 1;
// Do we link with another shape?
if (%item.surface.getClassName() $= "StaticShape") {
%surfaceAdjust = 0;
// [[Most]] Get the relative x y location from the "pure" informtation.
%link = sidelink(%item.surface,%item.surfaceNrm,%item.surfacePt,%scale,"0 0 -0.5");
%location = getWords(%link,0,2);
%side = getWords(%link,3,5);
%dirside = getWords(%link,6,8);
// [[Most]] Set the rotation to match the surfaceNrm and match the side.
// The power of the full rotation system.. ;)
%rot = fullRot(%item.surfaceNrm,%dirside);
// [[Most]] Adjust the location to match the scale.
%adjust = vectorScale(%item.surfaceNrm,getWord(%scale,2));
%item.surfacePt = vectorSub(%location, %adjust);
}
// If we do not link with another shape
if(%surfaceAdjust) {
%item.surfacePt = vectorSub(%item.surfacePt,"0 0" SPC getWord(%scale,2) - 1); // Rise 1 meter above surface
}
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
scale = %scale;
};
%deplObj.setTransform(%item.surfacePt SPC %rot);
%axis = vectorCross(virvec(%item.surface,%item.surfaceNrm),virvec(%item.surface,%side));
%axis = vectorScale(%axis,-1);
%vec1 = vectorScale(virvec(%item.surface,%side),0.5);
%vec2 = vectorAdd(vectorScale(virvec(%item.surface,%item.surfaceNrm),-0.5),"0 0 -0.5");
deployEffect(%deplObj,%location,%side,"walk");
%angle = getWord($packSetting["walk",%plyr.packSet],0)/180*$Pi;
%deplObj.setTransform(remoterotate(%deplObj,%axis SPC %angle,%item.surface,vectorAdd(%vec2,%vec1)));
if ($Host::ExpertMode == 1 && %plyr.expertSet == 1) {
%v = getRandom()*0.02 SPC getRandom()*0.02 SPC getRandom()*0.02;
%deplObj.setTransform(vectorAdd(pos(%deplObj),%v) SPC rot(%deplObj));
}
//////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function DeployedwWall::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, wwallDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function wWallDeployableImage::onMount(%data, %obj, %node) {
%obj.hasWalk = true; // set for wwallcheck
%obj.packSet = 0;
displayPowerFreq(%obj);
}
function wWallDeployableImage::onUnmount(%data, %obj, %node) {
%obj.packSet = 0;
%obj.hasWalk = "";
}

272
Scripts/Packs/cratepack.cs Normal file
View file

@ -0,0 +1,272 @@
//---------------------------------------------------------
// Deployable Crates
//---------------------------------------------------------
datablock StaticShapeData(DeployedCrate) : StaticShapeDamageProfile {
className = "crate";
shapeFile = "stackable3s.dts";
maxDamage = 4.5;
destroyedLevel = 4.5;
disabledLevel = 4.0;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.3;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed Crate';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
};
datablock StaticShapeData(DeployedCrate0) : DeployedCrate {
shapeFile = "stackable1s.dts";
};
datablock StaticShapeData(DeployedCrate1) : DeployedCrate {
shapeFile = "stackable1m.dts";
};
datablock StaticShapeData(DeployedCrate2) : DeployedCrate {
shapeFile = "stackable1l.dts";
};
datablock StaticShapeData(DeployedCrate3) : DeployedCrate {
shapeFile = "stackable2s.dts";
};
datablock StaticShapeData(DeployedCrate4) : DeployedCrate {
shapeFile = "stackable2m.dts";
};
datablock StaticShapeData(DeployedCrate5) : DeployedCrate {
shapeFile = "stackable2l.dts";
};
datablock StaticShapeData(DeployedCrate6) : DeployedCrate {
shapeFile = "stackable3s.dts";
};
datablock StaticShapeData(DeployedCrate7) : DeployedCrate {
shapeFile = "stackable3m.dts";
};
datablock StaticShapeData(DeployedCrate8) : DeployedCrate {
shapeFile = "stackable3l.dts";
};
datablock StaticShapeData(DeployedCrate9) : DeployedCrate {
shapeFile = "stackable4m.dts";
};
datablock StaticShapeData(DeployedCrate10) : DeployedCrate {
shapeFile = "stackable4l.dts";
};
datablock StaticShapeData(DeployedCrate11) : DeployedCrate {
shapeFile = "stackable5m.dts";
};
datablock StaticShapeData(DeployedCrate12) : DeployedCrate {
shapeFile = "stackable5l.dts";
};
datablock ShapeBaseImageData(CrateDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = CrateDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedCrate;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
datablock ItemData(CrateDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "CrateDeployableImage";
pickUpName = "a crate pack";
heatSignature = 0;
emap = true;
};
function CrateDeployableImage::testObjectTooClose(%item) {
return "";
}
function CrateDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function CrateDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function CrateDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed @ %plyr.packSet;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function DeployedCrate::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, CrateDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
}
function CrateDeployableImage::onMount(%data, %obj, %node) {
%obj.hasCrate = true; // set for cratecheck
%obj.packSet = 0;
}
function CrateDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasCrate = "";
%obj.packSet = 0;
}
function DeployedCrate0::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate1::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, CrateDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
%pos = %obj.getposition();
%rot = %obj.getrotation();
%team = %obj.team;
schedule(501, 0, "MakeFCrate", %pos, %rot, %team);
}
function DeployedCrate2::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate3::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate4::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate5::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate6::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate7::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate8::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate9::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate10::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate11::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function DeployedCrate12::onDestroyed(%this,%obj,%prevState) {
DeployedCrate::onDestroyed(%this,%obj,%prevState);
}
function MakeFCrate(%pos, %rot, %team){
%pos = vectorAdd(%pos, "0 0 0.1");
%Fcrate = new WheeledVehicle()
{
dataBlock = VehicleTestCrate1;
position = %pos;
rotation = %rot;
team = %team;
};
MissionCleanUp.add(%Fcrate);
%Fcrate.setTransform(%pos @ " " @ %rot);
%Fcrate.schedule(60000, delete);
}

View file

@ -0,0 +1,51 @@
//------------------------------------------------
// Examples of item specific disassemble.
//================================================
// ----------------
// 1. ONE
// ================
function TelePadDeployedBase::disassemble(%data, %plyr, %hTgt)
{
%teleteam = %hTgt.team;
if(%obj.Hacked) // is it hacked currently?
{
%teleteam = %hTgt.OldTeam;
echo("hacked!");
}
// dising a telepad makes it yours, remove from the other teams list
if($TeamDeployedCount[%teleteam, TelePadPack] > 0) // this wasnt the last
{
if($firstPad[%teleteam] == %hTgt) // the first was disassembled
{
echo("first pad disassembled");
$firstPad[%teleteam] = %ohTgtbj.nextPad; // make the second one the first
%hTgt.prevPad = -1;
%hTgt.nextPad = %obj;
}
else
{
%lastPad = $firstPad[%teleteam];
%hTgt.prevPad.nextPad = %hTgt.nextPad;
%hTgt.nextPad.prevPad = %hTgt.prevPad;
}
}
else // last one
{
$firstPad[%teleteam] = ""; // remove it
}
%hTgt.shield.delete();
}
// --------------
// 2. Two
// ==============
function MobileBaseVehicle::disassemble(%data, %plyr, %hTgt)
{
%mpbpos = %hTgt.gettransform();
%hTgt.delete();
teleporteffect(posfromtransform(%mpbpos));
}

View file

@ -0,0 +1,380 @@
//---------------------------------------------------------
// Deployable Decoration
//---------------------------------------------------------
datablock StaticShapeData(DeployedDecoration) : StaticShapeDamageProfile {
className = "decoration";
shapeFile = "banner_unity.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed Decoration';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
};
datablock StaticShapeData(DeployedDecoration0) : DeployedDecoration {
shapeFile = "banner_unity.dts";
};
datablock StaticShapeData(DeployedDecoration1) : DeployedDecoration {
shapeFile = "banner_strength.dts";
};
datablock StaticShapeData(DeployedDecoration2) : DeployedDecoration {
shapeFile = "banner_honor.dts";
};
datablock StaticShapeData(DeployedDecoration3) : DeployedDecoration {
shapeFile = "light_male_dead.dts";
};
datablock StaticShapeData(DeployedDecoration4) : DeployedDecoration {
shapeFile = "medium_male_dead.dts";
};
datablock StaticShapeData(DeployedDecoration5) : DeployedDecoration {
shapeFile = "heavy_male_dead.dts";
};
datablock StaticShapeData(DeployedDecoration6) : DeployedDecoration {
shapeFile = "statue_base.dts";
};
datablock StaticShapeData(DeployedDecoration7) : DeployedDecoration {
shapeFile = "statue_lmale.dts";
};
datablock StaticShapeData(DeployedDecoration8) : DeployedDecoration {
shapeFile = "statue_lfemale.dts";
};
datablock StaticShapeData(DeployedDecoration9) : DeployedDecoration {
shapeFile = "statue_hmale.dts";
};
datablock StaticShapeData(DeployedDecoration10) : DeployedDecoration {
shapeFile = "vehicle_grav_tank_wreck.dts";
};
datablock StaticShapeData(DeployedDecoration11) : DeployedDecoration {
shapeFile = "vehicle_air_scout_wreck.dts";
};
datablock StaticShapeData(DeployedDecoration12) : DeployedDecoration {
shapeFile = "billboard_1.dts";
};
datablock StaticShapeData(DeployedDecoration13) : DeployedDecoration {
shapeFile = "billboard_2.dts";
};
datablock StaticShapeData(DeployedDecoration14) : DeployedDecoration {
shapeFile = "billboard_3.dts";
};
datablock StaticShapeData(DeployedDecoration15) : DeployedDecoration {
shapeFile = "billboard_4.dts";
};
datablock StaticShapeData(DeployedDecoration16) : DeployedDecoration {
shapeFile = "goal_panel.dts";
};
datablock ShapeBaseImageData(DecorationDeployableImage) {
mass = 20;
emap = true;
shapeFile = "statue_lfemale.dts"; // "stackable1s.dts";
item = DecorationDeployable;
mountPoint = 1;
offset = "0 -0.6 -1.9";
rotation = "0 0.1 1 180";
deployed = DeployedDecoration;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
datablock ItemData(DecorationDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "DecorationDeployableImage";
pickUpName = "a decoration pack";
heatSignature = 0;
emap = true;
};
function DecorationDeployableImage::testObjectTooClose(%item) {
return "";
}
function DecorationDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function DecorationDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function DecorationDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1") {
if (%plyr.packSet == 3 || %plyr.packSet == 5)
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
else
%item.surfaceNrm2 = %playerVector;
}
else {
if (%plyr.packSet < 3)
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
else {
%item.surfaceNrm2 = %playerVector;
if (%plyr.packSet == 3 || %plyr.packSet == 5)
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
}
}
if (%item.surface.needsFit == 1) {
if (%plyr.packSet > 5 && %plyr.packSet < 10 && %item.surface.getDataBlock().getName() $= "DeployedDecoration6") {
%item.surfaceNrm2 = vectorCross(%item.surfaceNrm,realVec(%item.surface,"0 -1 0"));
}
}
%item.surfaceNrm3 = vectorCross(%item.surfaceNrm,%item.surfaceNrm2);
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed @ %plyr.packSet;
};
if (%plyr.packSet < 3) {
%surfacePt2 = %item.surfacePt;
%rot2 = %rot;
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm3,2.80));
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.25));
%rot = rotAdd(%rot,"1 0 0" SPC $Pi / 2);
%rot = rotAdd(%rot,"0 1 0" SPC $Pi);
%deplObj.lTarget = new StaticShape () {
datablock = DeployedLTarget;
scale = 2.5/4 SPC 5/3 SPC 0.15 * 2;
};
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
%deplObj.lTarget.lMain = %deplObj;
}
if (%plyr.packSet > 2 && %plyr.packSet < 6) {
%surfacePt2 = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.2));
%rot2 = %rot;
if (%plyr.packSet == 3) {
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,-0.14));
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,0.51));
}
else if (%plyr.packSet == 4) {
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,0.25));
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,-0.4));
}
else if (%plyr.packSet == 5) {
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm2,0.05));
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,0.4));
%rot = rotAdd(%rot,"0 0 -1" SPC $Pi / 4);
}
%deplObj.lTarget = new StaticShape () {
datablock = DeployedLTarget;
scale = 0.4/4 SPC 0.5/3 SPC 0.05 * 2;
};
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
%deplObj.lTarget.lMain = %deplObj;
}
if (%plyr.packSet == 11)
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,-2));
if (%plyr.packSet > 11 && %plyr.packSet < 16) {
%surfacePt2 = %item.surfacePt;
%rot2 = %rot;
%item.surfaceNrm2 = vectorScale(%item.surfaceNrm2,-1);
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,10.9));
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm,34));
%surfacePt2 = vectorAdd(%surfacePt2,vectorScale(%item.surfaceNrm3,-1));
%rot2 = rotAdd(%rot,"1 0 0" SPC $Pi / 2);
%deplObj.lTarget = new StaticShape () {
datablock = DeployedLTarget;
scale = 74/4 SPC 49/3 SPC 4;
};
%deplObj.lTarget.setTransform(%surfacePt2 SPC %rot2);
%deplObj.lTarget.lMain = %deplObj;
}
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate) {
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
%deplObj.lTarget.setRechargeRate(%deplObj.getDatablock().rechargeRate);
}
// [[Settings]]:
%deplObj.needsFit = 1;
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
if (%deplObj.lTarget) {
%deplObj.lTarget.team = %plyr.client.Team;
%deplObj.lTarget.setOwner(%plyr);
}
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
if (%deplObj.lTarget)
addToDeployGroup(%deplObj.lTarget);
//let the AI know as well...
AIDeployObject(%plyr.client,%deplObj);
if (%deplObj.lTarget)
AIDeployObject(%plyr.client,%deplObj.lTarget);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
if (%deplObj.lTarget)
addDSurface(%deplObj,%deplObj.lTarget);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function DeployedDecoration::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, DecorationDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
if (isObject(%obj.lTarget))
%obj.lTarget.schedule(500, "delete");
fireBallExplode(%obj,1);
}
function DecorationDeployableImage::onMount(%data, %obj, %node) {
%obj.hasDecoration = true; // set for decorationcheck
%obj.packSet = 0;
}
function DecorationDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasDecoration = "";
%obj.packSet = 0;
}
function DeployedDecoration0::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration1::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration2::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration3::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration4::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration5::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration6::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration7::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration8::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration9::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration10::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration11::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration12::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration13::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration14::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration15::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}
function DeployedDecoration16::onDestroyed(%this,%obj,%prevState) {
DeployedDecoration::onDestroyed(%this,%obj,%prevState);
}

397
Scripts/Packs/door.cs Normal file
View file

@ -0,0 +1,397 @@
//client.player.setInventory(doorDeployable,1,true);
//---------------------------------------------------------
// Deployable mspine, Code by Parousia
//---------------------------------------------------------
datablock StaticShapeData(DeployedDoor) : StaticShapeDamageProfile {
className = "door";
shapeFile = "Pmiscf.dts"; // b or dmiscf.dts, alternate
maxDamage = 5;
destroyedLevel = 5;
disabledLevel = 4;
isShielded = true;
energyPerDamagePoint = 60;
maxEnergy = 100;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Door';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(DoorDeployableImage) {
mass = 1;
emap = true;
shapeFile = "stackable1s.dts";
item = DoorDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedDoor;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0;
maxDeployDis = 50.0;
};
datablock ItemData(DoorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "DoorDeployableImage";
pickUpName = "a door pack";
heatSignature = 0;
emap = true;
};
function DoorDeployableImage::testObjectTooClose(%item) {
return "";
}
function DoorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function DoorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function doorDeployableImage::onMount(%data, %obj, %node) {
%obj.hasDoor = true; // set for blastcheck
%obj.packSet = 0;
%obj.expertSet = 3;
displayPowerFreq(%obj);
}
function doorDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasDoor = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}
function doorDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1"){
%item.surfaceNrm2 = %playerVector;
}
else{
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
}
%rot1 = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%scale1 = "0.5 6 160";
%scale2 = "0.5 8 160";
%dataBlock = %item.deployed;
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale1,$AllObjMask);
if (%space != getWord(%scale1,1))
%type = true;
%scale1 = getWord(%scale1,0) SPC getWord(%scale1,0) SPC %space;
%mCenter = "0 0 -0.5";
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale2,%mCenter);
%scale2 = getWords(%pad,0,2);
%item.surfacePt2 = getWords(%pad,3,5);
//%vec1 = realVec(getWord(%item.surface,0),%item.surfaceNrm);
//%vec1 = realVec(%pad,%item.surfaceNrm);
%vec1 =validateVal(MatrixMulVector("0 0 0",%item.surfaceNrm));
if (!%scaleIsSet){
%scale1 = vectorMultiply(%scale1,1/4 SPC 1/3 SPC 2);
%scale2 = vectorMultiply(%scale2,1/4 SPC 1/3 SPC 2);
%x = (getWord(%scale2,1)/0.166666)*0.125;
%scale3 = %x SPC 0.166666 SPC getWord(%scale1,2);
}
%dir1 = VectorNormalize(vectorSub(%item.surfacePt,%item.surfacePt2));
%adjust1 = vectorNormalize(vectorProject(%dir1,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
%offset1 = -0.5;
%adjust1 = vectorScale(%adjust1,-0.5 * %offset1);
%deplObj = new (%className)() {
dataBlock = %dataBlock;
scale = %scale3;
};
%deplObj.closedscale = %scale3;
%deplObj.openedscale = getwords(%scale3,0,1) SPC 0.1;
//////////////////////////Apply settings//////////////////////////////
// exact:
//%deplObj.setTransform(%item.surfacePt SPC %rot1);
%deplObj.setTransform(vectorAdd(VectorAdd(%item.surfacePt2, VectorScale(%vec1,getword(%scale3,2)/-4)),%adjust1) SPC %rot1);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
%deplObj.isdoor = 1;
// [[Normal Stuff]]:
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
%deplobj.timeout = getWord($expertSetting["Door", %plyr.expertSet], 0);
%deplobj.hasslided = 0;
%deplobj.state = "Closed";
if (%plyr.packset==0)
%deplobj.toggletype=0;
if (%plyr.packset==1)
%deplobj.toggletype=1;
if (%plyr.packset==2) {
%deplobj.powercontrol=1;
%deplobj.toggletype=1;
}
if (%plyr.packset==3) {
%deplobj.powercontrol=2;
%deplobj.toggletype=1;
}
if (%plyr.packset==4) {
%deplobj.collisionType = 1;
%deplobj.toggletype=0; // This is left mostly as a reference.
}
if (%plyr.packset==5)
{
%deplobj.collisionType = 2;
%deplobj.accessLevel = 1;
%deplobj.toggletype=0; // This is left mostly as a reference.
messageClient(%plyr.client, "", "\c2Use \c3/setAccess [level] \c2- to set the access level needed for this door, use \c3/setPAccess [name] [level] \c2- to set someone's access level over your pieces.");
}
if (%plyr.packset==6) {
%deplobj.collisionType = 3;
%deplobj.toggletype=0; // This is left mostly as a reference.
}
if (%plyr.packset==7) {
%deplobj.collisionType = 4;
%deplobj.toggletype=0; // This is left mostly as a reference.
}
%deplobj.canmove = true;
// Power object
checkPowerObject(%deplObj); // Keep this down here. It updates the state of the powered doors.
return %deplObj;
}
function Deployeddoor::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, DoorDeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function Deployeddoor::disassemble(%data,%plyr,%hTgt) {
disassemble(%data,%plyr,%hTgt);
}
function doorDeployableImage::onMount(%data,%obj,%node) {
%obj.hasdoor = true; // set for mspinecheck
%obj.packSet = 0;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function doorDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasdoor = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}
function Deployeddoor::onGainPowerEnabled(%data,%obj) {
if(%obj.canmove == true && %obj.powercontrol >= 1)
{
if(%obj.powerControl == 1 && %obj.state !$= "opened") // open when powered
schedule(10, 0, "open", %obj);
else if(%obj.powerControl == 2 && %obj.state !$= "closed") // closed when powered
schedule(10, 0, "close", %obj, 1);
}
Parent::onGainPowerEnabled(%data,%obj);
}
function Deployeddoor::onLosePowerDisabled(%data,%obj) {
if(%obj.canmove == true && %obj.powercontrol >= 1)
{
if(%obj.powerControl == 1 && %obj.state !$= "closed") // open when unpowered
schedule(10, 0, "close", %obj, 1);
else if(%obj.powerControl == 2 && %obj.state !$= "opened") // closed when unpowered
schedule(10, 0, "open", %obj);
}
Parent::onLosePowerDisabled(%data,%obj);
}
function DeployedDoor::onCollision(%data, %obj, %col)
{
if(%obj.canMove == true && %obj.collisionType > 0 && %col.getDataBlock().getClassName() $= "PlayerData")
{
switch$(%obj.collisionType)
{
case 1:
Open(%obj);
case 2:
if(%col.client.givenAccess[%obj.getOwner()] >= %obj.accessLevel || %obj.getOwner() == %col.client)
Open(%obj);
else
messageClient(%col.client, "", "\c3Access denied. \c2You need \c3level-"@%obj.accessLevel@"\c2 from \c3"@%obj.getOwner().nameBase@"\c2 to access this door.");
case 3:
if(%obj.getOwner() == %col.client)
Open(%obj);
else
messageClient(%col.client, "", "\c3Access denied. \c2This door is only for \c3"@%obj.getOwner().nameBase@"\c2.");
case 4:
if(%col.client.isAdmin || %obj.getOwner() == %col.client)
Open(%obj);
else
messageClient(%col.client, "", "\c3Access denied. \c2This door is for \c3admins \c2or \c3"@%obj.getOwner().nameBase@"\c2 only.");
}
}
// Don't call parent! It causes console spam!
// -- Eolk
}
////////////////////
////////////////////
function open(%obj)
{
if (!isObject(%obj))
return;
if (%obj.canmove == true)
{
%obj.moving = "open";
%obj.prevscale = %obj.scale;
%obj.closedscale= %obj.scale;
%obj.canmove = false;
}
if (getWord(%obj.scale, 2) < 0.3)
{
%obj.issliding = 0;
%obj.scale = getWord(%obj.scale,0) SPC getWord(%obj.scale,1) SPC 0.1;
%obj.settransform(%obj.gettransform());
%obj.state = "opened";
%obj.openedscale= %obj.scale;
if (%obj.toggletype == 0)
schedule(%obj.timeout * 1000, 0, "close", %obj, 1);
else
%obj.canmove = true;
return;
}
%obj.scale = getWord(%obj.scale, 0) SPC getWord(%obj.scale, 1) SPC getWord(%obj.prevscale ,2) - 0.4;
%obj.settransform(%obj.gettransform());
%obj.prevscale = %obj.scale;
schedule(40, 0, "open", %obj);
}
/////////////////////
/////////////////////
function close(%obj,%timeout)
{
if (!isObject(%obj))
return;
if (%obj.canmove == true)
{
%obj.moving = "close";
%obj.prevscale =%obj.scale;
%obj.openedscale=%obj.scale;
%obj.canmove = false;
}
if (getWord(%obj.scale, 2) > getWord(%obj.closedscale, 2) - 0.2)
{
%obj.issliding = 0;
%obj.scale = getWord(%obj.scale,0) SPC getWord(%obj.scale,1) SPC getWord(%obj.closedscale,2);
%obj.settransform(%obj.gettransform());
%obj.state = "closed";
%obj.closedscale= %obj.scale;
%obj.canmove = true;
return;
}
%obj.scale = getWord(%obj.scale, 0) SPC getWord(%obj.scale, 1) SPC getWord(%obj.prevscale, 2) + 0.4;
%obj.settransform(%obj.gettransform());
%obj.prevscale = %obj.scale;
schedule(40, 0, "close", %obj);
}

File diff suppressed because it is too large Load diff

145
Scripts/Packs/generator.cs Normal file
View file

@ -0,0 +1,145 @@
//--------------------------------------------------------------------------
// Deployable Generator
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(GeneratorDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = GeneratorDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = GeneratorLarge;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 2;
maxDeployDis = 5;
};
datablock ItemData(GeneratorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
hasLight = true;
lightType = "PulsingLight";
lightColor = "0.1 0.8 0.8 1.0";
lightTime = "1000";
lightRadius = "3";
elasticity = 0.2;
friction = 0.6;
pickupRadius = 3;
rotate = true;
image = "GeneratorDeployableImage";
pickUpName = "a generator pack";
heatSignature = 0;
emap = true;
};
function GeneratorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function GeneratorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function GeneratorDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),2));
%deplObj = new (%className)() {
dataBlock = GeneratorLarge;
deployed = true;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set power
%deplObj.setSelfPowered();
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// add to power list
$PowerList = listAdd($PowerList,%deplObj,-1);
return %deplObj;
}
function GeneratorLarge::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
if (%obj.deployed && ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon)) {
%obj.isRemoved = true;
%loc = findWord($PowerList,%obj);
if (%loc !$= "")
$PowerList = listDel($PowerList,%loc);
$TeamDeployedCount[%obj.team,GeneratorDeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
}
Parent::onDestroyed(%data,%obj,%prevState);
}
function GeneratorDeployableImage::onMount(%data,%obj,%node) {
%obj.hasGen = true; // set for gencheck
displayPowerFreq(%obj);
}
function GeneratorDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasGen = "";
}

View file

@ -0,0 +1,344 @@
//---------------------------------------------------------
// Deployable Gravity Field
//---------------------------------------------------------
// Translucencies
%fieldTrans = 1.0;
%powerOffTrans = 0.25;
// RGB
%colourOn = 0.6;
%colourOff = 0.15;
%dimDiv = 3;
datablock ForceFieldBareData(DeployedGravityField) {
className = "gravityfield";
fadeMS = 1000;
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = "1.0 1.0 1.0";
powerOffColor = "0.0 0.0 0.0";
targetTypeTag = 'GravityField';
texture[0] = "skins/forcef1";
texture[1] = "skins/forcef2";
texture[2] = "skins/forcef3";
texture[3] = "skins/forcef4";
texture[4] = "skins/forcef5";
framesPerSec = 10;
numFrames = 5;
scrollSpeed = 15;
umapping = 1.0;
vmapping = 0.15;
deployedFrom = GravityFieldDeployable;
velocityMod = 1;
gravityMod = 1;
appliedForce = "0 0 0";
needsPower = true;
};
// slow
datablock ForceFieldBareData(DeployedGravityField0) : DeployedGravityField {
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = %colourOff/%dimDiv SPC %colourOn/%dimDiv SPC %colourOff/%dimDiv;
powerOffColor = "0.0 0.0 0.0";
velocityMod = 1;
gravityMod = 0;
};
// fast
datablock ForceFieldBareData(DeployedGravityField1) : DeployedGravityField {
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = %colourOff SPC %colourOn SPC %colourOff;
powerOffColor = "0.0 0.0 0.0";
velocityMod = 1;
gravityMod = 0;
};
// zero gravity
datablock ForceFieldBareData(DeployedGravityField2) : DeployedGravityField {
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = %colourOn SPC %colourOn SPC %colourOff;
powerOffColor = "0.0 0.0 0.0";
velocityMod = 1;
gravityMod = 0;
};
// fastfield
datablock ForceFieldBareData(DeployedGravityField3) : DeployedGravityField {
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = %colourOn/%dimDiv SPC %colourOff/%dimDiv SPC %colourOn/%dimDiv;
powerOffColor = "0.0 0.0 0.0";
velocityMod = 1.5;
gravityMod = 0;
};
// super fastfield
datablock ForceFieldBareData(DeployedGravityField4) : DeployedGravityField {
baseTranslucency = %fieldTrans;
powerOffTranslucency = %powerOffTrans;
teamPermiable = true;
otherPermiable = true;
color = %colourOn SPC %colourOff SPC %colourOn;
powerOffColor = "0.0 0.0 0.0";
velocityMod = 1.7;
gravityMod = 0;
};
datablock ShapeBaseImageData(GravityFieldDeployableImage) {
mass = 20;
emap = true;
shapeFile = "ammo_chaingun.dts";
item = GravityFieldDeployable;
mountPoint = 1;
offset = "-0.2 -0.125 0";
rotation = "0 -1 0 90";
deployed = DeployedGravityField;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(GravityFieldDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
joint = "4.75 4.75 4.75";
rotate = true;
image = "GravityFieldDeployableImage";
pickUpName = "a gravity field pack";
heatSignature = 0;
emap = true;
};
function GravityFieldDeployableImage::testObjectTooClose(%item) {
return;
}
function GravityFieldDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function GravityFieldDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function GravityFieldDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "ForceFieldBare";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%scale = getWords($packSetting["gravfield",%plyr.packSet],0,2);
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale);
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
// Shift field position since field handle is not field center
%mod = firstWord($packSetting["gravfield",%plyr.packSet]) / 2;
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%mod));
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%mod));
// Add padding
%padSize = 0.01;
%scale = vectorAdd(%scale,%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%padSize));
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%padSize));
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%padSize));
// Set datablock
if (%plyr.packSet == 0)
%dataBlock = nameToID(%item.deployed @ 0);
else if (%plyr.packSet == 1)
%dataBlock = nameToID(%item.deployed @ 1);
else if (%plyr.packSet == 2)
%dataBlock = nameToID(%item.deployed @ 0);
else if (%plyr.packSet == 3)
%dataBlock = nameToID(%item.deployed @ 1);
else if (%plyr.packSet == 4)
%dataBlock = nameToID(%item.deployed @ 2);
else if (%plyr.packSet == 5)
%dataBlock = nameToID(%item.deployed @ 3);
else if (%plyr.packSet == 6)
%dataBlock = nameToID(%item.deployed @ 4);
%appliedForceVec = vectorNormalize(%item.surfaceNrm);
if ($Host::ExpertMode == 1) {
if (isCubic(%item.surface) && (%plyr.expertSet == 1 || %plyr.expertSet == 2) && %plyr.team == %item.surface.team
&& %item.surface.getType() & $TypeMasks::StaticShapeObjectType
&& (($Host::OnlyOwnerCubicReplace == 0) || (%plyr.client == %item.surface.getOwner()))) {
if (%plyr.expertSet == 2)
%appliedForceVec = vectorNormalize(realVec(%item.surface,"0 0 1"));
%scale = vectorAdd(realSize(%item.surface),%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
%center = realVec(%item.surface,vectorScale(getWords(%scale,0,1) SPC "0",-0.5));
%item.surfacePt = vectorAdd(pos(%item.surface),%center);
%rot = rot(%item.surface);
%mod = vectorScale(matrixMulVector("0 0 0" SPC %rot ,"0 0 1"),-%padSize);
%item.surfacePt = vectorAdd(%item.surfacePt,%mod);
%item.surface.getDataBlock().disassemble(%plyr, %item.surface);
}
}
%velocityMod = %dataBlock.velocityMod;
%gravityMod = %dataBlock.gravityMod;
%appliedForce = %dataBlock.appliedForce;
%slowForce = 500;
%fastForce = 1000;
if (%plyr.packSet == 0)
%appliedForce = vectorScale(%appliedForceVec,%slowForce);
else if (%plyr.packSet == 1)
%appliedForce = vectorScale(%appliedForceVec,%fastForce);
else if (%plyr.packSet == 2)
%appliedForce = vectorScale(%appliedForceVec,-%slowForce);
else if (%plyr.packSet == 3)
%appliedForce = vectorScale(%appliedForceVec,-%fastForce);
%deplObj = new (%className)() {
dataBlock = %dataBlock;
scale = %scale;
velocityMod = %velocityMod;
gravityMod = %gravityMod;
appliedForce = %appliedForce;
};
// Take the deployable off the player's back and out of inventory
if ($Host::ExpertMode == 0) {
%plyr.unMountImage(%slot);
%plyr.decInventory(%item.item,1);
}
////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
%deplObj.setTransform(%item.surfacePt SPC %rot);
%deplObj.pzone.setTransform(%item.surfacePt SPC %rot);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]]:
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
// Power object
checkPowerObject(%deplObj);
if (!%deplObj.powerCount > 0) {
%deplObj.getDataBlock().disassemble(0,%deplObj); // Run Item Specific code.
messageClient(%plyr.client,'MsgDeployFailed','\c2Gravity field lost - no power source found!%1','~wfx/misc/misc.error.wav');
}
return %deplObj;
}
/////////////////////////////////////
function GravityFieldDeployableImage::onMount(%data, %obj, %node) {
%obj.hasGravField = true; // set for gravfieldcheck
%obj.packSet = 0;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function GravityFieldDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasGravField = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}
function DeployedGravityField::disassemble(%data,%plyr,%obj) {
if (isObject(%obj.pzone))
%obj.pzone.delete();
disassemble(%data,%plyr,%obj);
}
function DeployedGravityField0::disassemble(%data,%plyr,%obj) {
DeployedGravityField::disassemble(%data,%plyr,%obj);
}
function DeployedGravityField1::disassemble(%data,%plyr,%obj) {
DeployedGravityField::disassemble(%data,%plyr,%obj);
}
function DeployedGravityField2::disassemble(%data,%plyr,%obj) {
DeployedGravityField::disassemble(%data,%plyr,%obj);
}
function DeployedGravityField3::disassemble(%data,%plyr,%obj) {
DeployedGravityField::disassemble(%data,%plyr,%obj);
}
function DeployedGravityField4::disassemble(%data,%plyr,%obj) {
DeployedGravityField::disassemble(%data,%plyr,%obj);
}

176
Scripts/Packs/jumpad.cs Normal file
View file

@ -0,0 +1,176 @@
//--------------------------------------------------------------------------
// Jumpad
//--------------------------------------------------------------------------
datablock StaticShapeData(DeployedJumpad) : StaticShapeDamageProfile {
className = "jumpad";
shapeFile = "nexusbase.dts"; // dmiscf.dts, alternate
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 2.0;
mass = 1.2;
elasticity = 0.1;
friction = 0.9;
collideable = 1;
pickupRadius = 1;
sticky=false;
impulse = 5000;
hasLight = true;
lightType = "PulsingLight";
lightColor = "0.1 0.8 0.8 1.0";
lightTime = "100";
lightRadius = "3";
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Jump';
targetTypeTag = 'Pad';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
};
datablock ShapeBaseImageData(JumpadDeployableImage) {
mass = 10;
emap = true;
shapeFile = "stackable1s.dts";
item = JumpadDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedJumpad;
heatSignature = 0;
collideable = 1;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360; // 30
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(JumpadDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "JumpadDeployableImage";
pickUpName = "a jump pad pack";
heatSignature = 0;
emap = true;
};
function JumpadDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function JumpadDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%impulse = firstWord($packSetting["jumpad",%plyr.packSet]);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
scale = "1 1 2";
};
// set impulse (jump pad strength)
%deplObj.impulse = %impulse;
// set orientation
%deplObj.setDeployRotation(getWords(%item.surfacePt, 0, 1) SPC getWord(%item.surfacePt, 2) + 0.1, %item.surfaceNrm);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
return %deplObj;
}
function DeployedJumpad::onCollision(%data,%obj,%col) {
// TODO - update escape pod
if (%col.getClassName() !$= "Player" && %col.getDataBlock().getName() !$= "EscapePodVehicle")
return; // Only boost players
if (%obj.team == %col.team) {
%vel = %col.getVelocity();
%vec = realVec(%obj,"0 0 1");
%position = getWords(%col.getTransform(), 0, 2);
// %impulseVec = vectorScale(%vec,1000); // Jump clear of the pad
// %col.applyImpulse(%position, %impulseVec);
%col.playAudio(0, MortarFireSound);
%impulseVec = vectorScale(%vec,%obj.impulse);
// %col.schedule(50, "applyImpulse", %position, %impulseVec);
%col.applyImpulse(%position, %impulseVec);
}
}
function DeployedJumpad::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, JumpadDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
fireBallExplode(%obj,1);
}
function JumpadDeployableImage::onMount(%data, %obj, %node) {
%obj.hasJumpad = true; // set for jumpadcheck
%obj.packSet = 0;
}
function JumpadDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasJumpad = "";
%obj.packSet = 0;
}

View file

@ -0,0 +1,123 @@
//--------------------------------------------------------------------------
// Large Inventory Station
//
//
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(LargeInventoryDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = LargeInventoryDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = StationInventory;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(LargeInventoryDeployable)
{
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "LargeInventoryDeployableImage";
joint = "4.5 4.5 4.5";
pickUpName = "a large inventory station pack";
heatSignature = 0;
emap = true;
};
function LargeInventoryDeployable::onPickup(%this, %obj, %shape, %amount)
{
// created to prevent console errors
}
function LargeInventoryDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%plyr.unMountImage(%slot);
%plyr.decInventory(%item.item,1);
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() //Inventory Station
{
dataBlock = StationInventory;
position = %surfacePt;
rotation = %rot;
deployed = true;
};
%deplObj.setTransform(%item.surfacePt SPC %rot);
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
addDSurface(%item.surface,%deplObj);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
if(%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// Adjust the trigger object
adjustTrigger(%deplObj);
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function LargeInventoryDeployableImage::testNoTerrainFound(%item)
{
//return %item.surface.getClassName() !$= TerrainBlock;
}
function LargeInventoryDeployableImage::onMount(%data, %obj, %node) {
displayPowerFreq(%obj);
}

View file

@ -0,0 +1,127 @@
//--------------------------------------------------------------------------
// Large Pulse Sensor
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(LargeSensorDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = LargeSensorDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = SensorLargePulse;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(LargeSensorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "LargeSensorDeployableImage";
joint = "4.5 4.5 4.5";
pickUpName = "a large pulse sensor pack";
heatSignature = 0;
emap = true;
};
function LargeSensorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function LargeSensorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function LargeSensorDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = SensorLargePulse;
deployed = true;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
// %deplObj.playThread($PowerThread,"Power");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function SensorLargePulse::onDestroyed(%data,%obj,%prevState) {
if (%obj.isRemoved)
return;
if (%obj.deployed) {
%obj.isRemoved = true;
$TeamDeployedCount[%obj.team,LargeSensorDeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
}
Parent::onDestroyed(%data,%obj,%prevState);
}
function LargeSensorDeployableImage::onMount(%data, %obj, %node) {
displayPowerFreq(%obj);
}

View file

@ -0,0 +1,164 @@
//--------------------------------------------------------------------------
// Large Mortar Turret
//
//
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Sounds
//--------------------------------------
datablock EffectProfile(MBLSwitchEffect)
{
effectname = "powered/turret_heavy_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(MBLFireEffect)
{
effectname = "powered/turret_mortar_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(MBLSwitchSound)
{
filename = "fx/powered/turret_heavy_activate.wav";
description = AudioClose3d;
preload = true;
effect = MBLSwitchEffect;
};
datablock AudioProfile(MBLFireSound)
{
filename = "fx/powered/turret_mortar_fire.wav";
description = AudioDefault3d;
preload = true;
effect = MBLFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock AudioProfile(MortarTurretProjectileSound)
{
filename = "fx/weapons/mortar_projectile.wav";
description = ProjectileLooping3d;
preload = true;
};
datablock GrenadeProjectileData(MortarTurretShot)
{
projectileShapeName = "mortar_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 1.32;
damageRadius = 30.0;
radiusDamageType = $DamageType::MortarTurret;
kickBackStrength = 3000;
explosion = "MortarExplosion";
velInheritFactor = 0.5;
splash = MortarSplash;
baseEmitter = MortarSmokeEmitter;
bubbleEmitter = MortarBubbleEmitter;
grenadeElasticity = 0.25;
grenadeFriction = 0.4;
armingDelayMS = 1500; // z0dd - ZOD, 4/25/02. Was 2000
gravityMod = 1.2; // z0dd - ZOD, 5/18/02. Make mortar projectile heavier, less floaty
muzzleVelocity = 75.95; // z0dd - ZOD, 8/13/02. More speed to compensate for higher gravity. Was 63.7
drag = 0.1;
sound = MortarTurretProjectileSound;
hasLight = true;
lightRadius = 3;
lightColor = "0.05 0.2 0.05";
};
//--------------------------------------------------------------------------
//-------------------------------------- Fusion Turret Image
//
datablock TurretImageData(MortarBarrelLarge)
{
shapeFile = "turret_mortar_large.dts";
item = MortarBarrelPack; // z0dd - ZOD, 4/25/02. Was wrong: MortarBarrelLargePack
projectile = MortarTurretShot;
projectileType = GrenadeProjectile;
usesEnergy = true;
fireEnergy = 30;
minEnergy = 30;
emap = true;
// don't let a mortar turret blow itself up
dontFireInsideDamageRadius = true;
damageRadius = 40;
param = ScoutMortarParam;
// Turret parameters
activationMS = 700; // z0dd - ZOD, 4/25/02. Was 1000. Amount of time it takes turret to unfold
deactivateDelayMS = 1500;
thinkTimeMS = 140; // z0dd - ZOD, 4/25/02. Was 200. Amount of time before turret starts to unfold (activate)
degPerSecTheta = 580;
degPerSecPhi = 960;
attackRadius = 400; // z0dd - ZOD, 4/25/02. Was 160
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = MBLSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.3;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = MBLFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTimeoutValue[4] = 1.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};

325
Scripts/Packs/lightpack.cs Normal file
View file

@ -0,0 +1,325 @@
//---------------------------------------------------------
// Deployable Light
//---------------------------------------------------------
%colourOn = 0.5;
%colourOff = 0.1;
%strobeColourOn = 1.0;
%strobeColourOff = 0.0;
datablock StaticShapeData(DeployedLightBase) : StaticShapeDamageProfile {
className = "lightbase";
shapeFile = "pack_deploy_sensor_motion.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed Light';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ItemData(DeployedLight) {
shapeFile = "turret_muzzlepoint.dts";
hasLight = true;
lightType = "ConstantLight";
lightColor = "1.0 1.0 1.0 1.0";
lightTime = "1000";
lightRadius = "15";
};
// Constant
datablock ItemData(DeployedLight0) : DeployedLight {
lightColor = %colourOn SPC %colourOn SPC %colourOn;
};
datablock ItemData(DeployedLight1) : DeployedLight {
lightColor = %colourOn SPC %colourOff SPC %colourOff;
};
datablock ItemData(DeployedLight2) : DeployedLight {
lightColor = %colourOff SPC %colourOn SPC %colourOff;
};
datablock ItemData(DeployedLight3) : DeployedLight {
lightColor = %colourOff SPC %colourOff SPC %colourOn;
};
datablock ItemData(DeployedLight4) : DeployedLight {
lightColor = %colourOff SPC %colourOn SPC %colourOn;
};
datablock ItemData(DeployedLight5) : DeployedLight {
lightColor = %colourOn SPC %colourOff SPC %colourOn;
};
datablock ItemData(DeployedLight6) : DeployedLight {
lightColor = %colourOn SPC %colourOn SPC %colourOff;
};
// Strobe
datablock ItemData(DeployedLight7) : DeployedLight {
lightColor = %strobeColourOn SPC %strobeColourOn SPC %strobeColourOn;
lightType = "PulsingLight";
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight8) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOn SPC %strobeColourOff SPC %strobeColourOff;
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight9) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOff SPC %strobeColourOn SPC %strobeColourOff;
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight10) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOff SPC %strobeColourOff SPC %strobeColourOn;
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight11) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOff SPC %strobeColourOn SPC %strobeColourOn;
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight12) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOn SPC %strobeColourOff SPC %strobeColourOn;
lightTime = "50";
lightRadius = "10";
};
datablock ItemData(DeployedLight13) : DeployedLight {
lightType = "PulsingLight";
lightColor = %strobeColourOn SPC %strobeColourOn SPC %strobeColourOff;
lightTime = "50";
lightRadius = "10";
};
datablock ShapeBaseImageData(LightDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = LightDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedLightBase;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
datablock ItemData(LightDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "LightDeployableImage";
pickUpName = "a light pack";
heatSignature = 0;
emap = true;
};
function LightDeployableImage::testObjectTooClose(%item) {
return "";
}
function LightDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function LightDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function LightDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
};
%deplObj.LgtColor = %plyr.packset;
%deplObj.light = new Item() {
datablock = DeployedLight @ %plyr.packSet;
static = true;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
adjustLight(%deplObj);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
%deplObj.light.lightBase = %deplObj;
%deplObj.lightPowerMode = %plyr.expertSet;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
%deplObj.playThread($AmbientThread,"ambient");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function DeployedLightBase::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, LightDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
if (isObject(%obj.light))
%obj.light.schedule(500, "delete");
}
function DeployedLightBase::disassemble(%data,%plyr,%obj) {
if (isObject(%obj.light))
%obj.light.delete();
disassemble(%data,%plyr,%obj);
}
function adjustLight(%obj) {
%obj.light.setTransform(vectorAdd(%obj.getPosition(),vectorScale(realVec(%obj,"0 0 1"),1)) SPC %obj.getRotation());
}
function LightDeployableImage::onMount(%data, %obj, %node) {
%obj.hasLight = true; // set for lightcheck
%obj.packSet = 0;
}
function LightDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasLight = "";
%obj.packSet = 0;
}
function DeployedLightBase::onGainPowerEnabled(%data,%obj) {
if (%obj.lightPowerMode)
{
if(isObject(%obj.light))
%obj.light.delete();
} // have to put brackets here or `else` will be confused
else
{
if (isObject(%obj.light))
%obj.light.delete();
%Obj.light = new Item() {
datablock = DeployedLight @ %Obj.LgtColor;
static = true;
};
// set orientation
adjustLight(%Obj);
}
Parent::onGainPowerEnabled(%data,%obj);
}
function DeployedLightBase::onLosePowerDisabled(%data,%obj) {
if (!%obj.lightPowerMode)
{
if(isObject(%obj.light))
%obj.light.delete();
} // have to put brackets here or `else` will be confused
else
{
if (isObject(%obj.light))
%obj.light.delete();
%Obj.light = new Item() {
datablock = DeployedLight @ %Obj.LgtColor;
static = true;
};
// set orientation
adjustLight(%Obj);
}
Parent::onLosePowerDisabled(%data,%obj);
}

View file

@ -0,0 +1,237 @@
//---------------------------------------------------------
// Deployable Logo Logo Projector
//---------------------------------------------------------
datablock StaticShapeData(DeployedLogoProjector) : StaticShapeDamageProfile {
className = "logoprojector";
shapeFile = "teamlogo_projector.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed Logo Projector';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(LogoProjectorDeployableImage) {
mass = 20;
emap = true;
shapeFile = "teamlogo_projector.dts";
item = LogoProjectorDeployable;
mountPoint = 1;
offset = "0 0 0";
rotation = "-1 0 0 90";
deployed = DeployedLogoProjector;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(LogoProjectorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "LogoProjectorDeployableImage";
pickUpName = "a logo projector pack";
heatSignature = 0;
emap = true;
};
function LogoProjectorDeployableImage::testObjectTooClose(%item) {
return "";
}
function LogoProjectorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function LogoProjectorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function LogoProjectorDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed;
};
if ($Host::Purebuild == 1)
if (%plyr.packSet == 0)
%logo = 0;
else
%logo = %plyr.packSet;
else {
%logo = 0;
}
switch (%logo) {
case 1:
%logo = "Base";
case 2:
%logo = "BaseB";
case 3:
%logo = "Swolf";
case 4:
%logo = "DSword";
case 5:
%logo = "BEagle";
case 6:
%logo = "COTP";
case 7:
%logo = "Bioderm";
default:
%logo = "0";
}
if (%logo $= "0")
%deplObj.holoBlock = getTaggedString(Game.getTeamSkin(%plyr.client.team)) @ "Logo";
else
%deplObj.holoBlock = %logo @ "Logo";
%deplObj.holo = new StaticShape() {
datablock = %deplObj.holoBlock;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
adjustHolo(%deplObj);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
%deplObj.holo.team = %plyr.client.Team;
%deplObj.holo.setOwner(%plyr);
%deplObj.holo.projector = %deplObj;
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client,%deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function DeployedLogoProjector::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, LogoProjectorDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
if (isObject(%obj.holo))
%obj.holo.schedule(500, "delete");
fireBallExplode(%obj,1);
}
function DeployedLogoProjector::disassemble(%data,%plyr,%obj) {
if (isObject(%obj.holo))
%obj.holo.delete();
disassemble(%data,%plyr,%obj);
}
function DeployedLogoProjector::onGainPowerEnabled(%data,%obj) {
if (shouldChangePowerState(%obj,true)) {
if (isObject(%obj.holo))
%obj.holo.delete();
%obj.holo = new StaticShape() {
datablock = %obj.holoBlock;
projector = %obj;
};
adjustHolo(%obj);
}
Parent::onGainPowerEnabled(%data,%obj);
}
function DeployedLogoProjector::onLosePowerDisabled(%data,%obj) {
if (shouldChangePowerState(%obj,false)) {
if (isObject(%obj.holo))
%obj.holo.delete();
}
Parent::onLosePowerDisabled(%data,%obj);
}
function adjustHolo(%obj) {
%obj.holo.setTransform(vectorAdd(%obj.getPosition(),vectorScale(realVec(%obj,"0 0 1"),10)) SPC %obj.getRotation());
}
function LogoProjectorDeployableImage::onMount(%data, %obj, %node) {
%obj.hasProjector = true; // set for projectorcheck
%obj.packSet = 0;
displayPowerFreq(%obj);
}
function LogoProjectorDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasProjector = "";
%obj.packSet = 0;
}

View file

@ -0,0 +1,127 @@
//--------------------------------------------------------------------------
// Medium Pulse Sensor
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(MediumSensorDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = MediumSensorDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = SensorMediumPulse;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(MediumSensorDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "MediumSensorDeployableImage";
joint = "4.5 4.5 4.5";
pickUpName = "a medium pulse sensor pack";
heatSignature = 0;
emap = true;
};
function MediumSensorDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function MediumSensorDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function MediumSensorDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = SensorMediumPulse;
deployed = true;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
// %deplObj.playThread($PowerThread,"Power");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// Power object
checkPowerObject(%deplObj);
return %deplObj;
}
function SensorMediumPulse::onDestroyed(%data,%obj,%prevState) {
if (%obj.isRemoved)
return;
if (%obj.deployed) {
%obj.isRemoved = true;
$TeamDeployedCount[%obj.team,MediumSensorDeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
}
Parent::onDestroyed(%data,%obj,%prevState);
}
function MediumSensorDeployableImage::onMount(%data, %obj, %node) {
displayPowerFreq(%obj);
}

274
Scripts/Packs/mspine.cs Normal file
View file

@ -0,0 +1,274 @@
//---------------------------------------------------------
// Deployable mspine, Code by Parousia
//---------------------------------------------------------
datablock StaticShapeData(DeployedMSpine) : StaticShapeDamageProfile {
className = "mspine";
shapeFile = "dmiscf.dts";
maxDamage = 5.0;
destroyedLevel = 5.0;
disabledLevel = 2.5;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 5.0;
expDamage = 0.5;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Medium Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock StaticShapeData(DeployedMSpinering) : DeployedMSpine {
maxDamage = 1.0;
destroyedLevel = 1.0;
disabledLevel = 0.75;
};
datablock ShapeBaseImageData(mspineDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = mspineDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedMSpine;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(mspineDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
joint = "1 1 1";
rotate = true;
image = "mspineDeployableImage";
pickUpName = "a medium support beam pack";
heatSignature = 0;
emap = true;
};
function mspineDeployableImage::testObjectTooClose(%item) {
return "";
}
function mspineDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%scale = getWords($packSetting["mspine",%plyr.packSet],0,2);
%mod = 0.5;
if (%plyr.packSet >= 5 && %plyr.packSet < 8) {
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale,$AllObjMask);
if (%space != getWord(%scale,1))
%type = 1;
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
if (%plyr.packSet == 7)
%mod = -0.01;
}
%scaler = getWords($packSetting["mspine",%plyr.packSet],3,5);
%deplObj = new (%className)() { //Main Spine
dataBlock = %item.deployed;
scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
};
if (%plyr.packSet != 0 && (%plyr.packSet == 6 || %plyr.packSet == 7 || %plyr.expertSet == 1)) {
%deplObj1 = new (%className)() { //Top add
dataBlock = "DeployedMSpinering";
scale = vectorMultiply(%scaler,1/4 SPC 1/3 SPC 2);
};
%deplObj2 = new (%className)() { //Bottom add
dataBlock = "DeployedMSpinering";
scale = vectorMultiply(%scaler,1/4 SPC 1/3 SPC 2);
};
%h1=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%mod));
%h2=vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),GetWord(%scale,2)-%mod-0.5));
%deplObj1.setTransform(%h1 SPC %rot);
%deplObj2.setTransform(%h2 SPC %rot);
addDSurface(%deplObj,%deplObj1);
%deplObj1.grounded = %grounded;
%deplObj1.needsFit = 1;
addDSurface(%deplObj,%deplObj2);
%deplObj2.grounded = %grounded;
%deplObj2.needsFit = 1;
%deplObj1.team = %plyr.client.team;
%deplObj1.setOwner(%plyr);
%deplObj2.team = %plyr.client.team;
%deplObj2.setOwner(%plyr);
if(%deplObj1.getTarget() != -1)
setTargetSensorGroup(%deplObj2.getTarget(), %plyr.client.team);
if(%deplObj2.getTarget() != -1)
setTargetSensorGroup(%deplObj2.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj1);
addToDeployGroup(%deplObj2);
AIDeployObject(%plyr.client, %deplObj1);
AIDeployObject(%plyr.client, %deplObj2);
%deplObj.right = %deplObj1;
%deplObj.left = %deplObj2;
}
//////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
%deplObj.setTransform(%item.surfacePt SPC %rot);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
%deplObj.right.powerFreq = %plyr.powerFreq;
%deplObj.left.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// Power object
checkPowerObject(%deplObj);
if (isObject(%deplObj.right))
checkPowerObject(%deplObj.right);
if (isObject(%deplObj.left))
checkPowerObject(%deplObj.left);
if (!%type)
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"mspine");
else
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"mspine1");
return %deplObj;
}
function DeployedMSpine::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, mspineDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
if (isObject(%obj.right))
%obj.right.schedule(500,setDamageState,Destroyed);
if (isObject(%obj.left))
%obj.left.schedule(500,setDamageState,Destroyed);
}
function DeployedMSpinering::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function DeployedMSpine::disassemble(%data,%plyr,%hTgt) {
if ($Host::Purebuild == 1) { // Remove console spam
if (isObject(%hTgt.right))
%hTgt.right.getDataBlock().schedule(500,disassemble,0,%hTgt.right);
if (isObject(%hTgt.left))
%hTgt.left.getDataBlock().schedule(500,disassemble,0,%hTgt.left);
}
disassemble(%data,%plyr,%hTgt);
}
function mspineDeployableImage::onMount(%data,%obj,%node) {
%obj.hasMSpine = true; // set for mspinecheck
%obj.packSet = 0;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function mspineDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasMSpine = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}

View file

@ -0,0 +1,105 @@
// ------------------------------------------------------------------
// PARACHUTE PACK
//
datablock ShapeBaseImageData(ParachutePackImage)
{
shapeFile = "pack_upgrade_ammo.dts";
item = ParachutePack;
mountPoint = 1;
offset = "0 0 0";
mass = 10;
usesEnergy = true;
minEnergy = 3;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateSequence[1] = "fire";
stateSound[1] = CloakingPackActivateSound;
stateEnergyDrain[1] = 1;
stateTransitionOnTriggerUp[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "Deactivate";
stateName[2] = "Deactivate";
stateScript[2] = "onDeactivate";
stateTransitionOnTimeout[2] = "Idle";
};
datablock ItemData(ParachutePack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_upgrade_ammo.dts";
mass = 5.0;
elasticity = 0.5;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "ParachutePackImage";
pickUpName = "a Parachute pack";
computeCRC = true;
};
datablock ShapeBaseImageData(parachuteImage)
{
shapeFile = "Pmiscf.dts";
mountPoint = 1;
offset = "0.0 0.0 2.0"; // L/R - F/B - T/B
rotation = "0 0 0 0"; // L/R - F/B - T/B
};
function ParachutePackImage::onUnmount(%data, %obj, %node)
{
if (%obj.getState() !$= "dead"){
Cancel(%obj.ParaLoop);
%obj.unmountImage(4);
}
}
function ParachutePackImage::onActivate(%data, %obj, %slot)
{
if(%obj.getArmorSize() $= "Light")
{
messageClient(%obj.client, "", "\c2Can't use this with Technician.");
return;
}
messageClient(%obj.client, 'MsgParachuteOpened', '\c2Parachute opened.');
%newspeed = vectorscale(%obj.getvelocity(),0.5);
%obj.setvelocity(%newspeed);
%obj.paraLoop = schedule(1000, 0, "parachuteLoop", %obj);
%obj.mountImage(ParachuteImage, 4);
}
function ParachutePackImage::onDeactivate(%data, %obj, %slot)
{
if(%obj.getArmorSize() $= "Light")
{
messageClient(%obj.client, "", "\c2Can't use this with Technician.");
return;
}
messageClient(%obj.client, 'MsgParachuteClosed', '\c2Parachute Closed.');
Cancel(%obj.ParaLoop);
%obj.unmountImage(4);
}
function parachuteLoop(%obj)
{
if(isObject(%obj))
{
%vec = vectornormalize(%obj.getMuzzleVector($WeaponSlot));
%move = vectorscale(%vec,10);
%x = getword(%move,0);
%y = getword(%move,1);
%z = (getword(%move,2) - 15);
%obj.setvelocity(%x@" "@%y@" "@%z);
%obj.paraLoop = schedule(100, 0, "parachuteLoop", %obj);
}
}

650
Scripts/Packs/repairpack.cs Normal file
View file

@ -0,0 +1,650 @@
//--------------------------------------------------------------------------
// Repair Pack
// can be used by any armor type
// when activated, gives user a "repair gun" that can be used to
// repair a damaged object or player. If there is no target in
// range for the repair gun, the user is repaired.
//--------------------------------------------------------------------------
// Sounds & feedback effects
datablock EffectProfile(RepairPackActivateEffect)
{
effectname = "packs/packs.repairPackOn";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock EffectProfile(RepairPackFireEffect)
{
effectname = "packs/repair_use";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(RepairPackActivateSound)
{
filename = "fx/packs/packs.repairPackOn.wav";
description = AudioClosest3d;
preload = true;
effect = RepairPackActivateEffect;
};
datablock AudioProfile(RepairPackFireSound)
{
filename = "fx/packs/repair_use.wav";
description = CloseLooping3d;
preload = true;
effect = RepairPackFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
datablock RepairProjectileData(DefaultRepairBeam)
{
sound = RepairPackFireSound;
// JTL
beamRange = 10; //10
// End JTL
beamWidth = 0.15;
numSegments = 20;
texRepeat = 0.20;
blurFreq = 10.0;
blurLifetime = 1.0;
cutoffAngle = 25.0;
textures[0] = "special/redbump2";
textures[1] = "special/redflare";
};
//-------------------------------------------------------------------------
// shapebase datablocks
datablock ShapeBaseImageData(RepairPackImage)
{
shapeFile = "pack_upgrade_repair.dts";
item = RepairPack;
mountPoint = 1;
offset = "0 0 0";
emap = true;
gun = RepairGunImage;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateSequence[1] = "fire";
stateSound[1] = RepairPackActivateSound;
stateTransitionOnTriggerUp[1] = "Deactivate";
stateName[2] = "Deactivate";
stateScript[2] = "onDeactivate";
stateTransitionOnTimeout[2] = "Idle";
};
datablock ItemData(RepairPack)
{
className = Pack;
catagory = "Packs";
shapeFile = "pack_upgrade_repair.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
image = "RepairPackImage";
pickUpName = "a repair pack";
lightOnlyStatic = true;
lightType = "PulsingLight";
lightColor = "1 0 0 1";
lightTime = 1200;
lightRadius = 4;
computeCRC = true;
emap = true;
};
//--------------------------------------------------------------------------
// Repair Gun
datablock ShapeBaseImageData(RepairGunImage)
{
shapeFile = "weapon_repair.dts";
offset = "0 0 0";
usesEnergy = true;
minEnergy = 0;
cutOffEnergy = 5.0;
emap = true;
repairFactorPlayer = 0.002; // <--- attention DaveG!
repairFactorObject = 0.008; // <--- attention DaveG!
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.25;
stateName[1] = "ActivateReady";
stateScript[1] = "onActivateReady";
stateSpinThread[1] = Stop;
stateTransitionOnAmmo[1] = "Ready";
stateTransitionOnNoAmmo[1] = "ActivateReady";
stateName[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnNoAmmo[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Validate";
stateName[3] = "Validate";
stateTransitionOnTimeout[3] = "Validate";
stateTimeoutValue[3] = 0.2;
stateEnergyDrain[3] = 3;
stateSpinThread[3] = SpinUp;
stateScript[3] = "onValidate";
stateIgnoreLoadedForReady[3] = true;
stateTransitionOnLoaded[3] = "Repair";
stateTransitionOnNoAmmo[3] = "Deactivate";
stateTransitionOnTriggerUp[3] = "Deactivate";
stateName[4] = "Repair";
stateSound[4] = RepairPackFireSound;
stateScript[4] = "onRepair";
stateSpinThread[4] = FullSpeed;
stateAllowImageChange[4] = false;
stateSequence[4] = "activate";
stateFire[4] = true;
stateEnergyDrain[4] = 32;
stateTimeoutValue[4] = 0.2;
stateTransitionOnTimeOut[4] = "Repair";
stateTransitionOnNoAmmo[4] = "Deactivate";
stateTransitionOnTriggerUp[4] = "Deactivate";
stateTransitionOnNotLoaded[4] = "Validate";
stateName[5] = "Deactivate";
stateScript[5] = "onDeactivate";
stateSpinThread[5] = SpinDown;
stateSequence[5] = "activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 0.2;
stateTransitionOnTimeout[5] = "ActivateReady";
};
function RepairPackImage::onUnmount(%data, %obj, %node)
{
// dismount the repair gun if the player had it mounted
// need the extra "if" statement to avoid a console error message
if(%obj.getMountedImage($WeaponSlot))
if(%obj.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
%obj.unmountImage($WeaponSlot);
// if the player was repairing something when the pack was thrown, stop repairing it
if(%obj.repairing != 0)
stopRepairing(%obj);
}
function RepairPackImage::onActivate(%data, %obj, %slot)
{
// don't activate the pack if player is piloting a vehicle
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
if(%obj.isPilot())
{
%obj.setImageTrigger(%slot, false);
return;
}
if(!isObject(%obj.getMountedImage($WeaponSlot)) || %obj.getMountedImage($WeaponSlot).getName() !$= "RepairGunImage")
{
messageClient(%obj.client, 'MsgRepairPackOn', '\c2Repair pack activated.');
// make sure player's arm thread is "look"
%obj.setArmThread(look);
// mount the repair gun
%obj.mountImage(RepairGunImage, $WeaponSlot);
// clientCmdsetRepairReticle found in hud.cs
commandToClient(%obj.client, 'setRepairReticle');
}
}
function RepairPackImage::onDeactivate(%data, %obj, %slot)
{
//called when the player hits the "pack" key again (toggle)
%obj.setImageTrigger(%slot, false);
// if repair gun was mounted, unmount it
if(%obj.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
%obj.unmountImage($WeaponSlot);
}
function RepairGunImage::onMount(%this,%obj,%slot)
{
%obj.setImageAmmo(%slot,true);
if ( !isDemo() )
commandToClient( %obj.client, 'setRepairPackIconOn' );
}
function RepairGunImage::onUnmount(%this,%obj,%slot)
{
// called when player switches to another weapon
// stop repairing whatever player was repairing
if(%obj.repairing)
stopRepairing(%obj);
%obj.setImageTrigger(%slot, false);
// "turn off" the repair pack -- player needs to hit the "pack" key to
// activate the repair gun again
%obj.setImageTrigger($BackpackSlot, false);
if ( !isDemo() )
commandToClient( %obj.client, 'setRepairPackIconOff' );
}
function RepairGunImage::onActivateReady(%this,%obj,%slot)
{
%obj.errMsgSent = false;
%obj.selfRepairing = false;
%obj.repairing = 0;
%obj.setImageLoaded(%slot, false);
}
function RepairGunImage::onValidate(%this,%obj,%slot)
{
// this = repairgunimage datablock
// obj = player wielding the repair gun
// slot = weapon slot
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
{
stopRepairing(%obj);
return;
}
%repGun = %obj.getMountedImage(%slot);
// muzVec is the vector coming from the repair gun's "muzzle"
%muzVec = %obj.getMuzzleVector(%slot);
// muzNVec = normalized muzVec
%muzNVec = VectorNormalize(%muzVec);
%repairRange = DefaultRepairBeam.beamRange;
// scale muzNVec to the range the repair beam can reach
%muzScaled = VectorScale(%muzNVec, %repairRange);
// muzPoint = the actual point of the gun's "muzzle"
%muzPoint = %obj.getMuzzlePoint(%slot);
// rangeEnd = muzzle point + length of beam
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
// search for just about anything that can be damaged as well as interiors
%searchMasks = $TypeMasks::VehicleObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType | $TypeMasks::InteriorObjectType;
// search for objects within the beam's range that fit the masks above
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
// screen out interiors
if(%scanTarg && !(%scanTarg.getType() & $TypeMasks::InteriorObjectType))
{
// a target in range was found
%repTgt = firstWord(%scanTarg);
// is the prospective target damaged?
if(%repTgt.notRepairable)
{
// this is an object that cant be repaired at all
// -- mission specific flag set on the object
if(!%obj.errMsgSent)
{
messageClient(%obj.client, 'MsgRepairPackIrrepairable', '\c2Target is not repairable.', %repTgt);
%obj.errMsgSent = true;
}
// if player was repairing something, stop the repairs -- we're done
if(%obj.repairing)
stopRepairing(%obj);
}
else if(%repTgt.getDamageLevel())
{
// yes, it's damaged
if(%repTgt != %obj.repairing)
{
if(isObject(%obj.repairing))
stopRepairing(%obj);
%obj.repairing = %repTgt;
}
// setting imageLoaded to true sends us to repair state (function onRepair)
%obj.setImageLoaded(%slot, true);
}
else
{
// there is a target in range, but it's not damaged
if(!%obj.errMsgSent)
{
// if the target isn't damaged, send a message to that effect only once
// JTL - repair ourselves if target is not damaged
if(%obj.getDamageLevel()) {
if(%obj.repairing != 0)
if(%obj.repairing != %obj)
stopRepairing(%obj);
if(isObject(%obj.repairing))
stopRepairing(%obj);
%obj.repairing = %obj;
// quick, to onRepair!
%obj.setImageLoaded(%slot, true);
return;
}
else {
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2Target is not damaged.', %repTgt);
%obj.errMsgSent = true;
}
}
// if player was repairing something, stop the repairs -- we're done
if(%obj.repairing)
stopRepairing(%obj);
}
}
//AI hack - too many things influence the aiming, so I'm going to force the repair object for bots only
else if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject))
{
%repTgt = %obj.client.repairObject;
%repPoint = %repTgt.getAIRepairPoint();
if (%repPoint $= "0 0 0")
%repPoint = %repTgt.getWorldBoxCenter();
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
//if the dot product is very close (ie. we're aiming in the right direction)
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
{
//do an LOS to make sure nothing is in the way...
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
if (firstWord(%scanTarg) == %repTgt)
{
// yes, it's damaged
if(isObject(%obj.repairing))
stopRepairing(%obj);
%obj.repairing = %repTgt;
// setting imageLoaded to true sends us to repair state (function onRepair)
%obj.setImageLoaded(%slot, true);
}
}
}
else if(%obj.getDamageLevel())
{
// there is no target in range, but the player is damaged
// check to see if we were repairing something before -- if so, stop repairing old target
if(%obj.repairing != 0)
if(%obj.repairing != %obj)
stopRepairing(%obj);
if(isObject(%obj.repairing))
stopRepairing(%obj);
%obj.repairing = %obj;
// quick, to onRepair!
%obj.setImageLoaded(%slot, true);
}
else
{
// there is no target in range, and the player isn't damaged
if(!%obj.errMsgSent)
{
// send an error message only once
messageClient(%obj.client, 'MsgRepairPackNoTarget', '\c2No target to repair.');
%obj.errMsgSent = true;
}
stopRepairing(%obj);
}
}
function RepairGunImage::onRepair(%this,%obj,%slot)
{
// this = repairgunimage datablock
// obj = player wielding the repair gun
// slot = weapon slot
if(%obj.getEnergyLevel() <= %this.cutOffEnergy)
{
stopRepairing(%obj);
return;
}
// reset the flag that indicates an error message has been sent
%obj.errMsgSent = false;
%target = %obj.repairing;
if(!%target)
{
// no target -- whoops! never mind
stopRepairing(%obj);
}
else
{
%target.repairedBy = %obj.client; //keep track of who last repaired this item
if(%obj.repairing == %obj)
{
// player is self-repairing
if(%obj.getDamageLevel())
{
if(!%obj.selfRepairing)
{
// no need for a projectile, just send a message and up the repair rate
messageClient(%obj.client, 'MsgRepairPackPlayerSelfRepair', '\c2Repairing self.');
%obj.selfRepairing = true;
startRepairing(%obj, true);
}
}
else
{
messageClient(%obj.client, 'MsgRepairPackSelfDone', '\c2Repairs completed on self.');
stopRepairing(%obj);
%obj.errMsgSent = true;
}
}
else
{
// make sure we still have a target -- more vector fun!!!
%muzVec = %obj.getMuzzleVector(%slot);
%muzNVec = VectorNormalize(%muzVec);
%repairRange = DefaultRepairBeam.beamRange;
%muzScaled = VectorScale(%muzNVec, %repairRange);
%muzPoint = %obj.getMuzzlePoint(%slot);
%rangeEnd = VectorAdd(%muzPoint, %muzScaled);
%searchMasks = $TypeMasks::VehicleObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType;
//AI hack to help "fudge" the repairing stuff...
if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject) && %obj.client.repairObject == %obj.repairing)
{
%repTgt = %obj.client.repairObject;
%repPoint = %repTgt.getAIRepairPoint();
if (%repPoint $= "0 0 0")
%repPoint = %repTgt.getWorldBoxCenter();
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
//if the dot product is very close (ie. we're aiming in the right direction)
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
}
else
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
if (%scanTarg)
{
%pos = getWords(%scanTarg, 1, 3);
%obstructMask = $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType;
%obstruction = ContainerRayCast(%muzPoint, %pos, %obstructMask, %obj);
if (%obstruction)
%scanTarg = "0";
}
if(%scanTarg)
{
// there's still a target out there
%repTgt = firstWord(%scanTarg);
// is the target damaged?
if(%repTgt.getDamageLevel())
{
if(%repTgt != %obj.repairing)
{
// the target is not the same as the one we were just repairing
// stop repairing old target, start repairing new target
stopRepairing(%obj);
if(isObject(%obj.repairing))
stopRepairing(%obj);
%obj.repairing = %repTgt;
// extract the name of what player is repairing based on what it is
// if it's a player, it's the player's name (duh)
// if it's an object, look for a nametag
// if object has no nametag, just say what it is (e.g. generatorLarge)
if(%repTgt.getClassName() $= Player)
%tgtName = getTaggedString(%repTgt.client.name);
else if(%repTgt.getGameName() !$= "")
%tgtName = %repTgt.getGameName();
else
%tgtName = %repTgt.getDatablock().getName();
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Repairing %1.', %tgtName, %repTgt);
startRepairing(%obj, false);
}
else
{
// it's the same target as last time
// changed to fix "2 players can't repair same object" bug
if(%obj.repairProjectile == 0)
{
if(%repTgt.getClassName() $= Player)
%tgtName = getTaggedString(%repTgt.client.name);
else if(%repTgt.getGameName() !$= "")
%tgtName = %repTgt.getGameName();
else
%tgtName = %repTgt.getDatablock().getName();
messageClient(%obj.client, 'MsgRepairPackRepairingObj', '\c2Repairing %1.', %tgtName, %repTgt);
startRepairing(%obj, false);
}
}
}
else
{
%rateOfRepair = %this.repairFactorObject;
if(%repTgt.getClassName() $= Player)
{
%tgtName = getTaggedString(%repTgt.client.name);
%rateOfRepair = %this.repairFactorPlayer;
}
else if(%repTgt.getGameName() !$= "")
%tgtName = %repTgt.getGameName();
else
%tgtName = %repTgt.getDatablock().getName();
if(%repTgt != %obj.repairing)
{
// it isn't the same object we were repairing previously
messageClient(%obj.client, 'MsgRepairPackNotDamaged', '\c2%1 is not damaged.', %tgtName);
}
else
{
// same target, but not damaged -- we must be done
messageClient(%obj.client, 'MsgRepairPackDone', '\c2Repairs completed.');
Game.objectRepaired(%repTgt, %tgtName);
}
%obj.errMsgSent = true;
stopRepairing(%obj);
}
}
else
{
// whoops, we lost our target
messageClient(%obj.client, 'MsgRepairPackLostTarget', '\c2Repair target no longer in range.');
stopRepairing(%obj);
}
}
}
}
function RepairGunImage::onDeactivate(%this,%obj,%slot)
{
stopRepairing(%obj);
}
function stopRepairing(%player)
{
// %player = the player who was using the repair pack
if(%player.selfRepairing)
{
// there is no projectile for self-repairing
%player.setRepairRate(%player.getRepairRate() - %player.repairingRate);
%player.selfRepairing = false;
}
else if(%player.repairing > 0)
{
// player was repairing something else
//if(%player.repairing.beingRepaired > 0)
//{
// don't decrement this stuff if it's already at 0 -- though it shouldn't be
//%player.repairing.beingRepaired--;
%player.repairing.setRepairRate(%player.repairing.getRepairRate() - %player.repairingRate);
//}
if(%player.repairProjectile > 0)
{
// is there a repair projectile? delete it
%player.repairProjectile.delete();
%player.repairProjectile = 0;
}
}
%player.repairing = 0;
%player.repairingRate = 0;
%player.setImageTrigger($WeaponSlot, false);
%player.setImageLoaded($WeaponSlot, false);
}
function startRepairing(%player, %self)
{
// %player = the player who was using the repair pack
// %self = boolean -- is player repairing him/herself?
if(%self)
{
// one repair, hold the projectile
%player.setRepairRate(%player.getRepairRate() + RepairGunImage.repairFactorPlayer);
%player.selfRepairing = true;
%player.repairingRate = RepairGunImage.repairFactorPlayer;
}
else
{
//if(%player.repairing.beingRepaired $= "")
// %player.repairing.beingRepaired = 1;
//else
// %player.repairing.beingRepaired++;
//AI hack...
if (%player.client.isAIControlled() && %player.client.repairObject == %player.repairing)
{
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
%initialDirection = VectorSub(%initialPosition, %player.repairing.getWorldBoxCenter());
}
else
{
%initialDirection = %player.getMuzzleVector($WeaponSlot);
%initialPosition = %player.getMuzzlePoint($WeaponSlot);
}
if(%player.repairing.getClassName() $= Player)
%repRate = RepairGunImage.repairFactorPlayer;
else
%repRate = RepairGunImage.repairFactorObject;
%player.repairing.setRepairRate(%player.repairing.getRepairRate() + %repRate);
%player.repairingRate = %repRate;
%player.repairProjectile = new RepairProjectile() {
dataBlock = DefaultRepairBeam;
initialDirection = %initialDirection;
initialPosition = %initialPosition;
sourceObject = %player;
sourceSlot = $WeaponSlot;
targetObject = %player.repairing;
};
MissionCleanup.add(%player.repairProjectile);
}
}

View file

@ -0,0 +1,751 @@
//--------------------------------------------------------------------------
// Satchel Charge pack
// can be used by any armor type
// when activated, throws the pack -- when activated again (before
// picking up another pack), detonates with a BIG explosion.
// Set up defaults for nonexisting vars
$SatchelChargeMultiplier = 1;
//--------------------------------------------------------------------------
// Sounds
datablock EffectProfile(SatchelChargeActivateEffect)
{
effectname = "packs/satchel_pack_activate";
minDistance = 2.5;
maxDistance = 2.5;
};
datablock EffectProfile(SatchelChargeExplosionEffect)
{
effectname = "packs/satchel_pack_detonate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(SatchelChargePreExplosionEffect)
{
effectname = "explosions/explosion.xpl03";
minDistance = 10.0;
maxDistance = 30.0;
};
datablock AudioProfile(SatchelChargeActivateSound)
{
filename = "fx/packs/satchel_pack_activate.wav";
description = AudioClose3d;
preload = true;
effect = SatchelChargeActivateEffect;
};
datablock AudioProfile(SatchelChargeExplosionSound)
{
filename = "fx/packs/satchel_pack_detonate.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = SatchelChargeExplosionEffect;
};
datablock AudioProfile(SatchelChargePreExplosionSound)
{
filename = "fx/explosions/explosion.xpl03.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = SatchelChargePreExplosionEffect;
};
datablock AudioProfile(UnderwaterSatchelChargeExplosionSound)
{
filename = "fx/weapons/mortar_explode_UW.wav";
description = AudioBIGExplosion3d;
preload = true;
effect = SatchelChargeExplosionEffect;
};
//----------------------------------------------------------------------------
// Satchel Debris
//----------------------------------------------------------------------------
datablock ParticleData( SDebrisSmokeParticle )
{
dragCoeffiecient = 1.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
lifetimeMS = 1000;
lifetimeVarianceMS = 100;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.4 0.4 0.4 1.0";
colors[1] = "0.3 0.3 0.3 0.5";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 0.0;
sizes[1] = 2.0;
sizes[2] = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData( SDebrisSmokeEmitter )
{
ejectionPeriodMS = 7;
periodVarianceMS = 1;
ejectionVelocity = 1.0; // A little oomph at the back end
velocityVariance = 0.2;
thetaMin = 0.0;
thetaMax = 40.0;
particles = "SDebrisSmokeParticle";
};
datablock DebrisData( SatchelDebris )
{
emitters[0] = SDebrisSmokeEmitter;
explodeOnMaxBounce = true;
elasticity = 0.4;
friction = 0.2;
lifetime = 0.3;
lifetimeVariance = 0.02;
};
//----------------------------------------------------------------------------
// Bubbles
//----------------------------------------------------------------------------
datablock ParticleData(SatchelBubbleParticle)
{
dragCoefficient = 0.0;
gravityCoefficient = -0.25;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 600;
useInvAlpha = false;
textureName = "special/bubbles";
spinRandomMin = -100.0;
spinRandomMax = 100.0;
colors[0] = "0.7 0.8 1.0 0.0";
colors[1] = "0.7 0.8 1.0 0.4";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 2.0;
sizes[1] = 2.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.8;
times[2] = 1.0;
};
datablock ParticleEmitterData(SatchelBubbleEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
ejectionOffset = 7.0;
velocityVariance = 0.5;
thetaMin = 0;
thetaMax = 80;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "MortarExplosionBubbleParticle";
};
//--------------------------------------------------------------------------
// Satchel Explosion Particle effects
//--------------------------------------
datablock ParticleData(SatchelExplosionSmoke)
{
dragCoeffiecient = 0.4;
gravityCoefficient = -0.0; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 2000;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "1.0 0.7 0.0 1.0";
colors[1] = "0.2 0.2 0.2 0.5";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 7.0;
sizes[1] = 17.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.4;
times[2] = 1.0;
};
datablock ParticleEmitterData(SatchelExplosionSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 14.25;
velocityVariance = 2.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 200;
particles = "SatchelExplosionSmoke";
};
datablock ParticleData(UnderwaterSatchelExplosionSmoke)
{
dragCoeffiecient = 105.0;
gravityCoefficient = -0.0;
inheritedVelFactor = 0.025;
constantAcceleration = -1.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.4 0.4 1.0 1.0";
colors[1] = "0.4 0.4 1.0 0.5";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 7.0;
sizes[1] = 17.0;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(UnderwaterSatchelExplosionSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 14.25;
velocityVariance = 2.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 200;
particles = "UnderwaterSatchelExplosionSmoke";
};
datablock ParticleData(SatchelSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 150;
textureName = "special/bigSpark";
colors[0] = "0.56 0.36 0.26 1.0";
colors[1] = "0.56 0.36 0.26 1.0";
colors[2] = "1.0 0.36 0.26 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.75;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(SatchelSparksEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 40;
velocityVariance = 20.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 200;
particles = "SatchelSparks";
};
datablock ParticleData(UnderwaterSatchelSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 350;
textureName = "special/underwaterSpark";
colors[0] = "0.6 0.6 1.0 1.0";
colors[1] = "0.6 0.6 1.0 1.0";
colors[2] = "0.6 0.6 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.75;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(UnderwaterSatchelSparksEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 30;
velocityVariance = 5.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 70;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "UnderwaterSatchelSparks";
};
//---------------------------------------------------------------------------
// Explosion
//---------------------------------------------------------------------------
datablock ExplosionData(SatchelSubExplosion)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "0.5 0.5 0.5";
debris = SatchelDebris;
debrisThetaMin = 10;
debrisThetaMax = 80;
debrisNum = 8;
debrisVelocity = 60.0;
debrisVelocityVariance = 15.0;
lifetimeMS = 1000;
delayMS = 0;
emitter[0] = SatchelExplosionSmokeEmitter;
emitter[1] = SatchelSparksEmitter;
offset = 0.0;
playSpeed = 1.5;
sizes[0] = "1.5 1.5 1.5";
sizes[1] = "3.0 3.0 3.0";
times[0] = 0.0;
times[1] = 1.0;
};
datablock ExplosionData(SatchelSubExplosion2)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "0.7 0.7 0.7";
debris = SatchelDebris;
debrisThetaMin = 10;
debrisThetaMax = 170;
debrisNum = 8;
debrisVelocity = 60.0;
debrisVelocityVariance = 15.0;
lifetimeMS = 1000;
delayMS = 50;
emitter[0] = SatchelExplosionSmokeEmitter;
emitter[1] = SatchelSparksEmitter;
offset = 9.0;
playSpeed = 1.5;
sizes[0] = "1.5 1.5 1.5";
sizes[1] = "1.5 1.5 1.5";
times[0] = 0.0;
times[1] = 1.0;
};
datablock ExplosionData(SatchelSubExplosion3)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "1.0 1.0 1.0";
debris = SatchelDebris;
debrisThetaMin = 10;
debrisThetaMax = 170;
debrisNum = 8;
debrisVelocity = 60.0;
debrisVelocityVariance = 15.0;
lifetimeMS = 2000;
delayMS = 100;
emitter[0] = SatchelExplosionSmokeEmitter;
emitter[1] = SatchelSparksEmitter;
offset = 9.0;
playSpeed = 2.5;
sizes[0] = "1.0 1.0 1.0";
sizes[1] = "1.0 1.0 1.0";
times[0] = 0.0;
times[1] = 1.0;
};
datablock ExplosionData(SatchelMainExplosion)
{
soundProfile = SatchelChargePreExplosionSound;
subExplosion[0] = SatchelSubExplosion;
subExplosion[1] = SatchelSubExplosion2;
subExplosion[2] = SatchelSubExplosion3;
};
//---------------------------------------------------------------------------
// Underwater Explosion
//---------------------------------------------------------------------------
datablock ExplosionData(UnderwaterSatchelSubExplosion)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "0.5 0.5 0.5";
lifetimeMS = 1000;
delayMS = 0;
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
emitter[1] = UnderwaterSatchelSparksEmitter;
emitter[2] = SatchelBubbleEmitter;
offset = 0.0;
playSpeed = 0.75;
sizes[0] = "1.5 1.5 1.5";
sizes[1] = "2.5 2.5 2.5";
sizes[2] = "2.0 2.0 2.0";
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ExplosionData(UnderwaterSatchelSubExplosion2)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "0.7 0.7 0.7";
lifetimeMS = 1000;
delayMS = 50;
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
emitter[1] = UnderwaterSatchelSparksEmitter;
emitter[2] = SatchelBubbleEmitter;
offset = 9.0;
playSpeed = 0.75;
sizes[0] = "1.5 1.5 1.5";
sizes[1] = "1.0 1.0 1.0";
sizes[2] = "0.75 0.75 0.75";
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ExplosionData(UnderwaterSatchelSubExplosion3)
{
explosionShape = "disc_explosion.dts";
faceViewer = true;
explosionScale = "1.0 1.0 1.0";
lifetimeMS = 2000;
delayMS = 100;
emitter[0] = UnderwaterSatchelExplosionSmokeEmitter;
emitter[1] = UnderwaterSatchelSparksEmitter;
emitter[2] = SatchelBubbleEmitter;
offset = 9.0;
playSpeed = 1.25;
sizes[0] = "1.0 1.0 1.0";
sizes[1] = "1.0 1.0 1.0";
sizes[2] = "0.5 0.5 0.5";
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ExplosionData(UnderwaterSatchelMainExplosion)
{
soundProfile = UnderwaterSatchelChargeExplosionSound;
subExplosion[0] = UnderwaterSatchelSubExplosion;
subExplosion[1] = UnderwaterSatchelSubExplosion2;
subExplosion[2] = UnderwaterSatchelSubExplosion3;
};
//--------------------------------------------------------------------------
// Projectile
//-------------------------------------------------------------------------
// shapebase datablocks
datablock ShapeBaseImageData(SatchelChargeImage)
{
shapeFile = "pack_upgrade_satchel.dts";
item = SatchelCharge;
mountPoint = 1;
offset = "0 0 0";
emap = true;
mass = 16;
};
datablock ItemData(SatchelCharge)
{
className = Pack;
catagory = "Packs";
image = SatchelChargeImage;
shapeFile = "pack_upgrade_satchel.dts";
mass = 8.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 2;
rotate = true;
pickUpName = "a satchel charge pack";
computeCRC = true;
};
datablock ItemData(SatchelChargeThrown)
{
shapeFile = "pack_upgrade_satchel.dts";
explosion = SatchelMainExplosion;
underwaterExplosion = UnderwaterSatchelMainExplosion;
mass = 1.5;
elasticity = 0.1;
friction = 0.9;
rotate = false;
pickupRadius = 0;
noTimeout = true;
armDelay = 1000;
maxDamage = 2.5;
kickBackStrength = 5000;
computeCRC = true;
};
//--------------------------------------------------------------------------
function SatchelCharge::onUse(%this, %obj)
{
if (!$Host::SatchelChargeEnabled) {
if ($Host::Purebuild == 1)
messageAll('msgClient','\c2%1 just tried to drop a Satchel Charge!',%obj.client.name);
else
messageTeam(%obj.client.team,'msgClient','\c2%1 just tried to drop a Satchel Charge!',%obj.client.name);
%obj.decInventory(SatchelCharge, 1);
return;
}
if ($Host::Purebuild == 1)
messageAll('msgClient','\c2%1 just dropped a Satchel Charge!',%obj.client.name);
else
messageTeam(%obj.client.team,'msgClient','\c2%1 just dropped a Satchel Charge!',%obj.client.name);
%item = new Item() {
dataBlock = SatchelChargeThrown;
rotation = "0 0 1 " @ (getRandom() * 360);
scale = $SatchelChargeMultiplier SPC $SatchelChargeMultiplier SPC $SatchelChargeMultiplier;
};
if ($Host::Purebuild == 0)
%item = new Item() {
dataBlock = SatchelChargeThrown;
rotation = "0 0 1 " @ (getRandom() * 360);
scale = $SatchelChargeMultiplier SPC $SatchelChargeMultiplier SPC $SatchelChargeMultiplier;
};
MissionCleanup.add(%item);
// take pack out of inventory and unmount image
%obj.decInventory(SatchelCharge, 1);
%obj.throwObject(%item);
//error("throwing satchel charge #" @ %item);
%obj.thrownChargeId = %item;
%item.sourceObject = %obj;
%item.armed = false;
%item.damaged = 0.0;
%item.thwart = false;
// arm itself 3 seconds after being thrown
schedule(%item.getDatablock().armDelay, %item, "initArmSatchelCharge", %item);
messageClient(%obj.client, 'MsgSatchelChargePlaced', "\c2Satchel charge deployed.");
}
function initArmSatchelCharge(%satchel)
{
// "deet deet deet" sound
%satchel.playAudio(1, SatchelChargeActivateSound);
// also need to play "antenna extending" animation
%satchel.playThread(0, "deploy");
%satchel.playThread(1, "activate");
// delay the actual arming until after sound is done playing
schedule( 2200, 0, "armSatchelCharge", %satchel );
}
function armSatchelCharge(%satchel)
{
%satchel.armed = true;
commandToClient( %satchel.sourceObject.client, 'setSatchelArmed' );
}
function detonateSatchelCharge(%player)
{
%satchelCharge = %player.thrownChargeId;
// can't detonate the satchel charge if it isn't armed
if(!%satchelCharge.armed)
return;
//error("Detonating satchel charge #" @ %satchelCharge @ " for player #" @ %player);
if(%satchelCharge.getDamageState() !$= Destroyed)
{
%satchelCharge.setDamageState(Destroyed);
%satchelCharge.blowup();
}
// Clear the player's HUD:
if (isObject(%player.client))
%player.client.clearBackpackIcon();
}
function SatchelChargeThrown::onEnterLiquid(%data, %obj, %coverage, %type)
{
// lava types
if(%type >=4 && %type <= 6)
{
if(%obj.getDamageState() !$= "Destroyed")
{
%obj.armed = true;
detonateSatchelCharge(%obj.sourceObject);
return;
}
}
// quickSand
if(%type == 7)
if(isObject(%obj.sourceObject))
%obj.sourceObject.thrownChargeId = 0;
Parent::onEnterLiquid(%data, %obj, %coverage, %type);
}
function SatchelChargeImage::onMount(%data, %obj, %node)
{
%obj.thrownChargeId = 0;
}
function SatchelChargeThrown::onDestroyed(%this, %object, %lastState)
{
if(%object.kaboom)
return;
else
{
%object.kaboom = true;
// the "thwart" flag is set if the charge is destroyed with weapons rather
// than detonated. A less damaging explosion, but visually the same scale.
if(%object.thwart)
{
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge destroyed.");
%dmgRadius = 23 * $SatchelChargeMultiplier;
%dmgMod = 2.0 * $SatchelChargeMultiplier;
%expImpulse = limitSatchelImpulse(1000 * $SatchelChargeMultiplier);
%dmgType = $DamageType::SatchelCharge;
}
else
{
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge detonated!");
%dmgRadius = 30 * $SatchelChargeMultiplier;
%dmgMod = 3.0 * $SatchelChargeMultiplier;
%expImpulse = limitSatchelImpulse(2500 * $SatchelChargeMultiplier);
%dmgType = $DamageType::SatchelCharge;
}
%object.blowingUp = true;
RadiusExplosion(%object, %object.getPosition(), %dmgRadius, %dmgMod, %expImpulse, %object.sourceObject, %dmgType);
%object.schedule(1000, "delete");
}
// -------------------------------------------------------------------
// z0dd - ZOD, 5/8/02. Addition. Satchel bug fix. Prior to fix,
// clients couldn't pick up packs when satchel was destroyed from dmg.
if(isObject(%object.sourceObject))
%object.sourceObject.thrownChargeId = 0;
}
function SatchelChargeThrown::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
if (!%object.blowingUp)
{
%targetObject.damaged += %amount;
if(%targetObject.damaged >= %targetObject.getDataBlock().maxDamage &&
%targetObject.getDamageState() !$= Destroyed)
{
%targetObject.thwart = true;
%targetObject.setDamageState(Destroyed);
%targetObject.blowup();
// clear the player's HUD:
if (isObject(%targetObject.sourceObject.client))
%targetObject.sourceObject.client.clearBackPackIcon();
}
}
}
function limitSatchelImpulse(%val) {
if (%val > 50000)
%val = 50000;
return %val;
}

View file

@ -0,0 +1,134 @@
datablock ShapeBaseImageData(SentryTurretDeployableImage)
{
mass = 15;
emap = true;
shapeFile = "stackable1s.dts";
item = TurretSentryPack;
mountPoint = 1;
offset = "0 -0.2 0";
minDeployDis = 0.5;
maxDeployDis = 5.0;
deployed = TurretDeployedSentry;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = StationDeploySound;
};
datablock ItemData(TurretSentryPack)
{
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "SentryTurretDeployableImage";
pickUpName = "a sentry turret pack";
heatSignature = 0;
computeCRC = true;
emap = true;
};
datablock TurretData(TurretDeployedSentry) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_sentry.dts";
rechargeRate = 0.40;
selfPower = false;
needsPower = true;
mass = 5.0;
maxDamage = 1.2;
destroyedLevel = 1.2;
disabledLevel = 0.84;
repairRate = 0;
explosion = ShapeExplosion;
expDmgRadius = 5.0;
expDamage = 0.4;
expImpulse = 1000.0;
deployedObject = true;
thetaMin = 89;
thetaMax = 175;
isShielded = true;
energyPerDamagePoint = 100;
maxEnergy = 150;
heatSignature = 1;
canControl = true;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Deployed Sentry';
targetTypeTag = 'Turret';
sensorData = SentryMotionSensor;
sensorRadius = SentryMotionSensor.detectRadius;
sensorColor = "9 136 255";
firstPersonOnly = true;
};
function SentryTurretDeployableImage::onDeploy(%item, %plyr, %slot)
{
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
%deplObj.mountImage(SentryTurretBarrel, 0, false);
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfacenrm = VectorNormalize(%item.surfacenrm);
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj.setTransform(%item.surfacePt SPC %rot);
MTZAxisReverse(%plyr.client, %deplObj); // Super cheap hack. Makes things REALLY easy, though.
%realVec = realVec(%deplObj, "0 0 1");
%toAdd = VectorScale(%realvec, -0.6);
%newPos = VectorAdd(posFromTransform(%deplObj.getTransform()), %toAdd);
%deplObj.setTransform(%newPos SPC %deplObj.getRotation());
addDSurface(%item.surface,%deplObj);
addToDeployGroup(%deplObj);
%deplObj.powerFreq = %plyr.powerFreq;
%deplObj.team = %plyr.team;
checkPowerObject(%deplObj);
}
function SentryTurretDeployableImage::onMount(%data, %obj, %node)
{
displayPowerFreq(%obj);
}
function TurretSentryPack::onPickup(%this, %obj, %shape, %amount)
{
// No more spam!
}

143
Scripts/Packs/solarpanel.cs Normal file
View file

@ -0,0 +1,143 @@
//--------------------------------------------------------------------------
// Deployable Solar Panel
//--------------------------------------------------------------------------
datablock ShapeBaseImageData(SolarPanelDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = SolarPanelDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = SolarPanel;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 1.5;
maxDeployDis = 5;
};
datablock ItemData(SolarPanelDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
hasLight = true;
lightType = "PulsingLight";
lightColor = "0.1 0.8 0.8 1.0";
lightTime = "1000";
lightRadius = "3";
elasticity = 0.2;
friction = 0.6;
pickupRadius = 3;
rotate = true;
image = "SolarPanelDeployableImage";
pickUpName = "a solar panel pack";
heatSignature = 0;
emap = true;
};
function SolarPanelDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function SolarPanelDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function SolarPanelDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = SolarPanel;
deployed = true;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set power
%deplObj.setSelfPowered();
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
// add to power list
$PowerList = listAdd($PowerList,%deplObj,-1);
return %deplObj;
}
function SolarPanel::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
if (%obj.deployed && ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon)) {
%obj.isRemoved = true;
%loc = findWord($PowerList,%obj);
if (%loc !$= "")
$PowerList = listDel($PowerList,%loc);
$TeamDeployedCount[%obj.team,SolarPanelDeployable]--;
remDSurface(%obj);
%obj.schedule(500,"delete");
}
Parent::onDestroyed(%data,%obj,%prevState);
}
function SolarPanelDeployableImage::onMount(%data,%obj,%node) {
%obj.hasGen = true; // set for gencheck
displayPowerFreq(%obj);
}
function SolarPanelDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasGen = "";
}

View file

@ -0,0 +1,212 @@
//---------------------------------------------------------
// Deployable Telepad
//---------------------------------------------------------
// Thanks to Krash for the idea to make spawn points power things within a small radius
datablock ShapeBaseImageData(SpawnPointImage) {
mass = 15;
emap = true;
shapeFile = "stackable1s.dts";
item = SpawnPointPack;
mountPoint = 1;
offset = "0 0 0";
deployed = SpawnPoint;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = StationDeploySound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(SpawnPointPack) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "SpawnPointImage";
pickUpName = "a SpawnPoint pack";
heatSignature = 0;
joint = "2 2 2";
computeCRC = true;
emap = true;
};
datablock StaticShapeData(SpawnPoint) : StaticShapeDamageProfile {
className = "Generator";
shapeFile = "station_teleport.dts";
maxDamage = 5.00;
destroyedLevel = 5.00;
disabledLevel = 4.0;
isShielded = true;
energyPerDamagePoint = 150;
maxEnergy = 150;
rechargeRate = 1;
explosion = ShapeExplosion; // DeployablesExplosion;
expDmgRadius = 18.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StationObjectType;
deployedObject = true;
cmdCategory = "Support";
cmdIcon = CMDSwitchIcon;
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
targetNameTag = 'Deployed';
targetTypeTag = 'Spawn Point';
debrisShapeName = "debris_generic.dts";
debris = DeployableDebris;
heatSignature = 0;
// needsPower = true;
// humSound = SensorHumSound;
// pausePowerThread = true;
sensorData = TelePadBaseSensorObj;
sensorRadius = TelePadBaseSensorObj.detectRadius;
sensorColor = "0 212 45";
firstPersonOnly = true;
lightType = "PulsingLight";
lightColor = "0 1 0 1";
lightTime = 1200;
lightRadius = 6;
powerRadius = 25;
};
function SpawnPoint::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
// checkEndTCCMGame(%obj.team);
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team,SpawnPoint]--;
%obj.isRemoved = true;
remDSurface(%obj);
%obj.active = 0;
remTeamSpawnPoint(%obj);
if(!$Host::InvincibleDeployables)
%obj.schedule(500,"delete");
}
function SpawnPoint::disassemble(%data,%plyr,%obj) {
// checkEndTCCMGame(%obj.team);
remTeamSpawnPoint(%obj);
parent::disassemble(%data, %plyr, %obj);
}
function SpawnPointPack::onPickup(%this, %obj, %shape, %amount)
{
// Thou shalt not spam.
}
function SpawnPoint::onGainPowerEnabled(%data,%obj) {
%obj.active = 1;
parent::onGainPowerEnabled(%data, %obj); // Eolk - call parent
}
function SpawnPoint::onLosePowerDisabled(%data,%obj) {
%obj.active = 0;
parent::onLosePowerDisabled(%data, %obj); // Eolk - call parent
}
function SpawnPointImage::onDeploy(%item,%plyr,%slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = SpawnPoint;
scale = "1 1 1";
deployed = true;
};
%deplObj.setTransform(%item.surfacePt SPC %rot);
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
%deplObj.powerFreq = %plyr.powerFreq;
setTargetName(%deplObj.target, addTaggedString("Frequency" SPC %deplObj.powerFreq));
%deplObj.setSelfPowered();
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(),%plyr.client.team);
addToDeployGroup(%deplObj);
AIDeployObject(%plyr.client,%deplObj);
addDSurface(%item.surface,%deplObj);
serverPlay3D(%item.deploySound,%deplObj.getTransform());
$TeamDeployedCount[%plyr.team,%item.item]++;
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item,1);
addTeamSpawnPoint(%deplObj);
if(%plyr.client.SPname $= "")
%piece.name = getWords(%position,0,1);
else
%piece.name = %plyr.client.SPname;
%piece.active = 0;
setTargetName(%deplObj.target,addTaggedString(%deplObj.name));
$PowerList = listAdd($PowerList, %deplObj, -1);
return %deplObj;
}
function SpawnPointImage::onMount(%data,%obj,%node) {
%obj.hasGen = true;
displayPowerFreq(%obj);
}
function SpawnPointImage::onUnmount(%data,%obj,%node) {
%obj.hasGen = "";
}
function addTeamSpawnPoint(%obj)
{
if(%obj.getDatablock().getName() !$= "SpawnPoint")
return;
if($teamSPs[%obj.team] $= "")
$TeamSPs[%obj.team] = 0;
$teamSP[%obj.team,$teamSPs[%obj.team]] = %obj;
$teamSPs[%obj.team]++;
}
function remTeamSpawnPoint(%obj)
{
if(%obj.getDatablock().getName() !$= "SpawnPoint")
return;
for(%i = 0; %i < $teamSPs[%obj.team]; %i++){
if($teamSP[%obj.team,%i] $= %obj)
%spawn = %i;
}
if(%spawn < ($teamSPs[%obj.team] - 1)){
$teamSP[%obj.team,%spawn] = $teamSP[%obj.team,($teamSPs[%obj.team] - 1)];
$teamSP[%obj.team,($teamSPs[%obj.team] - 1)] = "";
}
$teamSPs[%obj.team]--;
}

297
Scripts/Packs/spine.cs Normal file
View file

@ -0,0 +1,297 @@
//---------------------------------------------------------
// Deployable Spine, Code by Mostlikely, Prettied by JackTL
//---------------------------------------------------------
datablock StaticShapeData(DeployedSpine) : StaticShapeDamageProfile {
className = "spine";
shapeFile = "Pmiscf.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock StaticShapeData(DeployedSpine2) : StaticShapeDamageProfile {
className = "spine";
shapeFile = "Xmiscf.dts";
maxDamage = 25.0;
destroyedLevel = 25.0;
disabledLevel = 24.0;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock StaticShapeData(DeployedWoodSpine) : StaticShapeDamageProfile {
className = "spine";
shapeFile = "stackable5m.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
isShielded = true;
energyPerDamagePoint = 240;
maxEnergy = 50;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Light Support Beam';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock ShapeBaseImageData(spineDeployableImage) {
mass = 20;
emap = true;
shapeFile = "ammo_plasma.dts";
item = spineDeployable;
mountPoint = 1;
offset = "0 -0.2 -0.55";
deployed = DeployedSpine;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.1;
maxDeployDis = 50.0;
};
datablock ItemData(spineDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "spineDeployableImage";
pickUpName = "a light support beam pack";
heatSignature = 0;
emap = true;
};
function spineDeployableImage::testObjectTooClose(%item) {
return "";
}
function spineDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function spineDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function spineDeployableImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%item.surfaceNrm3 = vectorCross(%item.surfaceNrm,%item.surfaceNrm2);
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%scale = getWords($packSetting["spine",%plyr.packSet],0,2);
%dataBlock = %item.deployed;
if (%plyr.packSet == 5) {
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale);
if (%space != getWord(%scale,1))
%type = true;
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
}
else if (%plyr.packSet == 6 || %plyr.packSet == 7) {
%mCenter = "0 0 -0.5";
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale,%mCenter);
%scale = getWords(%pad,0,2);
%item.surfacePt = getWords(%pad,3,5);
%rot = getWords(%pad,6,9);
if (%plyr.packSet == 7) {
%scale = vectorMultiply(%scale,1.845 SPC 2 SPC 1.744); // Update dfunctions.cs if changed!
%scaleIsSet = 1;
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm3,0.5));
%rot = rotAdd(%rot,"1 0 0" SPC $Pi);
%dataBlock = "DeployedWoodSpine";
}
}
if (!%scaleIsSet)
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
%deplObj = new (%className)() {
dataBlock = %dataBlock;
scale = %scale;
};
//////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
%deplObj.setTransform(%item.surfacePt SPC %rot);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]]:
// if(%deplObj.getDatablock().rechargeRate)
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// Power object
checkPowerObject(%deplObj);
if (%pad)
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
else if (%type)
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"spine1");
else
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"spine");
return %deplObj;
}
/////////////////////////////////////
function DeployedSpine::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, spineDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function DeployedSpine2::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, spineDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
cascade(%obj);
fireBallExplode(%obj,1);
}
function DeployedWoodSpine::onDestroyed(%this, %obj, %prevState) {
DeployedSpine::onDestroyed(%this, %obj, %prevState);
}
function spineDeployableImage::onMount(%data, %obj, %node) {
%obj.hasSpine = true; // set for spinecheck
%obj.packSet = 0;
displayPowerFreq(%obj);
}
function spineDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasSpine = "";
%obj.packSet = 0;
}

273
Scripts/Packs/switch.cs Normal file
View file

@ -0,0 +1,273 @@
//--------------------------------------------------------------------------
// Deployable Switch
//--------------------------------------------------------------------------
datablock StaticShapeData(DeployedSwitch) : StaticShapeDamageProfile {
className = "switch";
shapeFile = "switch.dts";
maxDamage = 1.00;
destroyedLevel = 1.00;
disabledLevel = 0.75;
isShielded = true;
energyPerDamagePoint = 30;
maxEnergy = 100;
rechargeRate = 0.05;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.3;
expImpulse = 500;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
targetNameTag = 'Deployed';
targetTypeTag = 'Switch';
// deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
emap = true;
};
datablock ShapeBaseImageData(SwitchDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = SwitchDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedSwitch;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
flatMinDeployDis = 0.25;
flatMaxDeployDis = 5.0;
minDeployDis = 2;
maxDeployDis = 5;
};
datablock ItemData(SwitchDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
hasLight = true;
lightType = "PulsingLight";
lightColor = "0.1 0.8 0.8 1.0";
lightTime = "1000";
lightRadius = "3";
elasticity = 0.2;
friction = 0.6;
pickupRadius = 3;
rotate = true;
image = "SwitchDeployableImage";
pickUpName = "a switch pack";
heatSignature = 0;
emap = true;
};
datablock AudioProfile(SwitchToggledSound) {
filename = "fx/misc/flipflop_taken.wav";
description = AudioClosest3d;
preload = true;
};
function SwitchDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function SwitchDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function SwitchDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
scale = "0.5 0.5 0.5";
dataBlock = DeployedSwitch;
deployed = true;
};
%deplObj.switchRadius = $packSetting["switch",%plyr.packSet];
// TODO - handle normal state on deploy
if ($Host::ExpertMode == 1) {
if (%plyr.expertSet == 1)
%deplObj.timed = 1;
else if (%plyr.expertSet == 2)
%deplObj.timed = 2;
}
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set skin
setTargetSkin(%deplObj.target,Game.getTeamSkin(%plyr.client.team));
// set power
%deplObj.setSelfPowered();
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
%deplObj.playThread($PowerThread,"Power");
%deplObj.playThread($AmbientThread,"ambient");
if (%deplObj.timed == 2) {
%deplObj.stopThread($AmbientThread);
setTargetName(%deplObj.target,addTaggedString("Disabled Frequency" SPC %deplObj.powerFreq));
%deplObj.isSwitchedOff = true;
}
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function DeployedSwitch::onCollision(%data,%obj,%col) {
toggleSwitch(%obj,-1,%col);
}
function toggleSwitch(%obj,%state,%col,%delayed) {
if (%obj.isRemoved)
return;
// TODO - prevent switching while waiting for timed delay / cancel timed delay if switch is hit?
%switchDelay = 1000;
%switchTimedDelay = 5000;
if (%state $= "")
%state = -1;
if (%col == 0 || %col $= "")
%force = true;
if (!%force) {
if (%col.getClassName() !$= "Player")
return;
if (%col.getState() $= "Dead" || %col.FFZapped == true)
return;
if (%obj.team != %col.team && %obj.team != 0)
return;
if (!(%obj.switchTime < getSimTime())) {
messageClient(%col.client, 'msgClient', '\c2Must wait %1 seconds between switching states.',mCeil((%obj.switchTime - getSimTime())/1000));
return;
}
}
if ((%obj.isSwitchedOff || (%force == true && %state == true)) && !(%force == true && %state == false)) {
%state = true;
%obj.isSwitchedOff = "";
}
else {
%state = false;
%obj.isSwitchedOff = true;
}
%switchCount = 0;
%count = getWordCount($PowerList);
// TODO - report number of successes and failures
for(%i=0;%i<%count;%i++) {
%powerObj = getWord($PowerList,%i);
if (vectorDist(%obj.getPosition(),%powerObj.getPosition()) < %obj.switchRadius
&& !%powerObj.isRemoved && %obj.powerFreq == %powerObj.powerFreq
&& %obj.team == %powerObj.team) {
toggleGenerator(%powerObj,%state);
%switchCount++;
}
}
if (%state == true) {
%obj.play3D(SwitchToggledSound);
%obj.playThread($AmbientThread,"ambient");
setTargetName(%obj.target,addTaggedString("Frequency" SPC %obj.powerFreq));
if (!%force)
messageClient(%col.client, 'msgClient', '\c2%1 objects attempted switched on.',%switchCount);
}
else {
%obj.play3D(SwitchToggledSound);
%obj.stopThread($AmbientThread);
setTargetName(%obj.target,addTaggedString("Disabled Frequency" SPC %obj.powerFreq));
if (!%force)
messageClient(%col.client, 'msgClient', '\c2%1 objects attempted switched off.',%switchCount);
}
%obj.switchTime = getSimTime() + %switchDelay;
cancel(%obj.timedSched);
if (%obj.timed > 0 && !%delayed) {
if (%obj.timed == 1)
%obj.timedSched = schedule(%switchTimedDelay,0,toggleSwitch,%obj,1,0,true);
else if (%obj.timed == 2)
%obj.timedSched = schedule(%switchTimedDelay,0,toggleSwitch,%obj,0,0,true);
%obj.switchTime = getSimTime() + %switchDelay + %switchTimedDelay;
}
}
function DeployedSwitch::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, SwitchDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
}
function SwitchDeployableImage::onMount(%data,%obj,%node) {
%obj.hasSwitch = true; // set for switchcheck
%obj.packSet = 2;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function SwitchDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasSwitch = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}

View file

@ -0,0 +1,562 @@
//---------------------------------------------------------
// Deployable Telepad
//---------------------------------------------------------
datablock ShapeBaseImageData(TelePadDeployableImage) {
mass = 15;
emap = true;
shapeFile = "stackable1s.dts";
item = TelePadPack;
mountPoint = 1;
offset = "0 0 0";
deployed = TelePadDeployedBase;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = StationDeploySound;
minDeployDis = 0.5;
maxDeployDis = 5.0;
};
datablock ItemData(TelePadPack) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "TelePadDeployableImage";
pickUpName = "a teleport pad pack";
heatSignature = 0;
joint = "2 2 2";
computeCRC = true;
emap = true;
};
datablock SensorData(TelePadBaseSensorObj) {
detects = true;
detectsUsingLOS = true;
detectsPassiveJammed = false;
detectsActiveJammed = false;
detectsCloaked = false;
detectionPings = true;
detectRadius = 10;
};
datablock StaticShapeData(TelePadDeployedBase) : StaticShapeDamageProfile {
className = "teleport";
shapeFile = "nexuscap.dts";
maxDamage = 2.00;
destroyedLevel = 2.00;
disabledLevel = 1.35;
isShielded = true;
energyPerDamagePoint = 250;
maxEnergy = 100;
rechargeRate = 1;
explosion = ShapeExplosion; // DeployablesExplosion;
expDmgRadius = 18.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StationObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSwitchIcon;
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
targetNameTag = 'Deployed';
targetTypeTag = 'Teleport Pad';
debrisShapeName = "debris_generic.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
humSound = SensorHumSound;
pausePowerThread = true;
sensorData = TelePadBaseSensorObj;
sensorRadius = TelePadBaseSensorObj.detectRadius;
sensorColor = "0 212 45";
firstPersonOnly = true;
lightType = "PulsingLight";
lightColor = "0 1 0 1";
lightTime = 1200;
lightRadius = 6;
};
datablock StaticShapeData(TelePadBeam) {
className = "Station";
catagory = "DSupport";
shapefile = "nexus_effect.dts";
collideable = 1;
needsNoPower = true;
emap="true";
sensorData = TelePadBaseSensorObj;
sensorRadius = TelePadBaseSensorObj.detectRadius;
sensorColor = "0 212 45";
cmdCategory = "DSupport";
targetNameTag = 'Teleport';
targetTypeTag = 'Pad';
lightType = "PulsingLight";
lightColor = "0 1 0 1";
lightTime = 1200;
lightRadius = 6;
};
datablock AudioProfile(TelePadAccessDeniedSound) {
filename = "gui/vote_nopass.wav";
description = AudioClosest3d;
preload = true;
};
datablock AudioProfile(TelePadBeamSound) {
filename = "fx/vehicles/inventory_pad_on.wav";
description = AudioClosest3d;
preload = true;
};
datablock AudioProfile(TelePadPowerUpSound) {
filename = "fx/powered/turret_heavy_activate.wav";
description = AudioClosest3d;
preload = true;
};
datablock AudioProfile(TelePadPowerDownSound) {
filename = "fx/powered/inv_pad_off.wav";
description = AudioClosest3d;
preload = true;
};
datablock ParticleData(TelePadTeleportParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
lifetimeMS = 1200;
lifetimeVarianceMS = 400;
textureName = "special/lightFalloffMono";
useInvAlpha = false;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
colors[0] = "0.5 0.8 0.2 1.0";
colors[1] = "0.6 0.9 0.3 1.0";
colors[2] = "0.7 1.0 0.4 1.0";
sizes[0] = 0.2;
sizes[1] = 0.1;
sizes[2] = 0.05;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(TelePadTeleportEmitter)
{
ejectionPeriodMS = 1;
ejectionOffset = 7.0;
periodVarianceMS = 0.0;
ejectionVelocity = 2.0;
velocityVariance = 2.0;
thetaMin = 0.0;
thetaMax = 10.0;
lifetimeMS = 0;
particles = "TelePadTeleportParticle";
};
function TelePadDeployedBase::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team,TelePadPack]--;
%obj.isRemoved = true;
remDSurface(%obj);
%obj.beam.schedule(150,"delete");
%obj.schedule(500,"delete");
}
function TelePadDeployedBase::disassemble(%data,%plyr,%obj) {
if (isObject(%obj.beam))
%obj.beam.delete();
%obj.isRemoved = true;
disassemble(%data,%plyr,%obj);
}
function TelePadDeployedBase::onGainPowerEnabled(%data,%obj) {
if (shouldChangePowerState(%obj,true)) {
tp_fadeIn(%obj,true);
%obj.playThread($AmbientThread,"ambient");
%obj.setThreadDir($AmbientThread,true);
%obj.playThread($ActivateThread,"transition");
%obj.setThreadDir($ActivateThread,false);
%obj.play3D(TelePadPowerUpSound);
}
Parent::onGainPowerEnabled(%data,%obj);
}
function TelePadDeployedBase::onLosePowerDisabled(%data,%obj) {
if (shouldChangePowerState(%obj,false)) {
tp_fadeOut(%obj,true);
%obj.stopThread($AmbientThread);
%obj.playThread($ActivateThread,"transition");
%obj.setThreadDir($ActivateThread,true);
%obj.play3D(TelePadPowerDownSound);
}
Parent::onLosePowerDisabled(%data,%obj);
}
function TelePadDeployedBase::onCollision(%data,%obj,%col) {
if (%col.justTeleported || %obj.isRemoved)
return;
// verify pad.team is team associated and is on player's team
if (%obj.team != %col.team && %obj.team != 0 && %obj.teleMode != 1 && %obj.frequency > 0 && %obj.ishacked != 1) {
%obj.play3D(TelePadAccessDeniedSound);
messageClient(%col.client,'msgClient','\c2Access Denied -- Wrong team use, /hack help , to hack this teleport.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
// verify that pad can transmit
if (%obj.teleMode == 3) {
%obj.play3D(TelePadAccessDeniedSound);
messageClient(%col.client,'msgClient','\c2Access Denied -- This pad can only receive.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
// Discover next pad to teleport to
%dgroup = nameToID(Deployables);
%destPad = 0;
%firstPad = 0;
for(%depIndex = 0; %depIndex < %dgroup.getCount(); %depIndex++) {
%dep = %dgroup.getObject(%depIndex);
if (%dep.getDataBlock().className $= "teleport") {
if (%dep != %obj && %dep.frequency == %obj.frequency && %dep.team == %obj.team && %dep.teleMode != 2) {
if (%dep.isPowered() && %dep.isEnabled() && !(%dep.getEnergyLevel() < %dep.getDataBlock().maxEnergy)) {
if (!%firstPad || %dep < %firstPad)
%firstPad = %dep;
if (%dep > %obj && (!%destPad || %dep < %destPad)) {
%destPad = %dep;
}
}
else
%notEnabled = true;
}
}
}
if (!%destPad)
%destPad = %firstPad;
if (!%obj.isPowered() || !%obj.isEnabled()) {
%obj.play3D(TelePadAccessDeniedSound);
if (!%obj.isPowered() && !%obj.isEnabled())
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is damaged and has no power.');
else if (!%obj.isEnabled())
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is damaged.');
else if (!%obj.isPowered())
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is not powered.');
else
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad malfunction.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
if (!%destPad) {
%obj.play3D(TelePadAccessDeniedSound);
if (%notEnabled)
messageClient(%col.client,'msgClient','\c2Unable to teleport, destination is damaged, has no power or is recharging.');
else
messageClient(%col.client,'msgClient','\c2Unable to teleport, no other pads to teleport to.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
if (tp_isBlocked(%destPad,%col)) {
%obj.play3D(TelePadAccessDeniedSound);
messageClient(%col.client,'msgClient','\c2Unable to teleport, destination is blocked.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
if (%obj.getEnergyLevel() < %obj.getDataBlock().maxEnergy) {
%obj.play3D(TelePadAccessDeniedSound);
messageClient(%col.client,'msgClient','\c2Unable to teleport, telepad is recharging.');
%col.justTeleported = true;
schedule(2000,0,"unTeleport",%col);
return;
}
// center player on pad
if (!tp_isBlocked(%obj,%col))
tp_adjustPlayer(%obj,%col);
// fade out player
%col.disableMove(true);
pl_fadeOut(%col);
// pad power up effect
tp_fadePadIn(%obj);
tp_fadePadIn(%destPad);
// fade out beams
schedule(600,0,"tp_fadeOut",%obj);
schedule(750,0,"tp_fadeOut",%destPad);
// pad power down effect
schedule(1500,0,"tp_fadePadOut",%obj);
schedule(1550,0,"tp_fadePadOut",%destPad);
// fade in beams
schedule(3000,0,"tp_fadeIn",%obj);
schedule(3050,0,"tp_fadeIn",%destPad);
// Zap energy
%obj.setEnergyLevel(0);
%destPad.setEnergyLevel(0);
%col.justTeleported = true;
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
schedule(500,0,"teleport",%col,%destPad,%obj); // schedule their teleportation
tp_emitter(%obj);
}
function tp_isBlocked(%pad,%obj) {
%padPos = %pad.getPosition();
%telePos = vectorAdd(%padPos,vectorScale(realVec(%pad,"0 0 1"),-2.5));
if (containerRayCast(%padPos,%telePos,-1,%pad))
%blocked = true;
if (!$Host::AllowUnderground) {
%terrain = getTerrainHeight2(%telePos);
if (getWord(%telePos,2) < getWord(%terrain,2) || %terrain $= "")
%blocked = true;
}
if (isObject(%obj)) {
%adjust = vectorAdd(vectorScale(vectorNormalize(realVec(%pad,"0 0 1")),-1.35),vectorSub(%obj.getPosition(),%obj.getWorldBoxCenter()));
%pos = vectorAdd(%padPos,%adjust);
if (!$Host::AllowUnderground) {
%terrain = getTerrainHeight2(%pos);
if (getWord(%pos,2) < getWord(%terrain,2) || %terrain $= "")
%blocked = true;
}
if (containerRayCast(%telePos,%pos,-1,%obj))
%blocked = true;
}
return %blocked;
}
// player
function pl_fadeIn(%obj) {
%obj.startFade(500,0,false);
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
}
function pl_fadeOut(%obj) {
%obj.startFade(500,0,true);
messageClient(%col.client,'msgClient',"~wfx/misc/diagnostic_on.wav");
}
// beam and sound
function tp_fadeIn(%obj,%silent) {
if (%obj.isPowered() && %obj.isEnabled()) {
if (!%silent)
%obj.play3D(DiscReloadSound);
%obj.beam.startFade(100,0,false);
}
}
function tp_fadeOut(%obj,%silent) {
if (!%silent)
%obj.play3D(TelePadBeamSound);
%obj.beam.startFade(100,0,true);
}
// pad
function tp_fadePadIn(%obj) {
%obj.playThread($ActivateThread,"transition");
%obj.setThreadDir($ActivateThread,true);
}
function tp_fadePadOut(%obj) {
%obj.playThread($ActivateThread,"transition");
%obj.setThreadDir($ActivateThread,false);
}
// fancy emitter
function tp_emitter(%obj) {
%em = new ParticleEmissionDummy() {
scale = "1 1 1";
dataBlock = "defaultEmissionDummy";
emitter = "TelePadTeleportEmitter";
velocity = "1";
};
%adjust = vectorScale(realVec(%obj,"0 0 1"),7);
%em.setTransform(vectorAdd(%obj.getPosition(),%adjust) SPC rotAdd(%obj.getRotation(),"1 0 0" SPC $Pi));
MissionCleanup.add(%em);
%em.schedule(1000,"delete");
}
function unTeleport(%pl) {
if (isObject(%pl))
%pl.justTeleported = false;
}
function teleport(%pl,%destPad,%src) {
%pl.setVelocity("0 0 0"); //slow me down, ive been falling :)
%pl.schedule(500,disableMove,false);
pl_fadeIn(%pl);
schedule(2650,0,"unTeleport",%pl);
if (!isObject(%destPad)) {// lost the destination
messageClient(%pl.client,'msgClient','\c2Lost destination!');
tp_adjustPlayer(%src,%pl);
}
else {
if (%pl.team == %src.team)
messageClient(%pl.client,'msgClient','\c2Teleporting on frequency %1.',%src.frequency);
else
messageClient(%pl.client,'msgClient','\c2Teleporting on ENEMY frequency %1!',%src.frequency);
tp_adjustPlayer(%destPad,%pl);
tp_emitter(%destPad);
}
}
function tp_adjustPlayer(%pad,%obj) {
%adjust = vectorAdd(vectorScale(vectorNormalize(realVec(%pad,"0 0 1")),-1.35),vectorSub(%obj.getPosition(),%obj.getWorldBoxCenter()));
%rot = %obj.getRotation();
%obj.setTransform(vectorAdd(%pad.getPosition(),%adjust) SPC %rot);
}
function tp_adjustBeam(%pad) {
%rot = rotAdd(%pad.getRotation(),"1 0 0" SPC $Pi);
%pad.beam.setTransform(%pad.getPosition() SPC %rot);
}
function TelePadDeployableImage::onDeploy(%item,%plyr,%slot) {
%className = "StaticShape";
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(%item.surfaceNrm,0.4));
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(vectorScale(%item.surfaceNrm,-1),%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = TelePadDeployedBase;
scale = "1 1 1";
deployed = true;
teleMode = %plyr.expertSet;
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(),%plyr.client.team);
// set frequency
%frequency = %plyr.packSet;
if (!%frequency)
%frequency = 1;
%deplObj.frequency = %frequency;
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %frequency));
// attach beam
%deplObj.beam = new (StaticShape)() {
dataBlock = TelePadBeam;
scale = "1 1 0.4";
};
// set orientation
tp_adjustBeam(%deplObj);
%deplObj.beam.playThread(0,"ambient");
%deplObj.beam.setThreadDir(0,true);
// The flash animation plays forwards, then back automatically,so we have to alternate the thread direcction...
%deplObj.beam.flashThreadDir = true;
%deplObj.beam.base = %deplObj;
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client,%deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound,%deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team,%item.item]++;
addDSurface(%item.surface,%deplObj);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item,1);
// Power object
checkPowerObject(%deplObj);
teleresethack(%deplObj);
return %deplObj;
}
function TelePadDeployableImage::onMount(%data,%obj,%node) {
%obj.hasTele = true; // set for telecheck
%obj.packSet = 1;
%obj.expertSet = 0;
displayPowerFreq(%obj);
}
function TelePadDeployableImage::onUnmount(%data,%obj,%node) {
%obj.hasTele = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}

258
Scripts/Packs/treepack.cs Normal file
View file

@ -0,0 +1,258 @@
//---------------------------------------------------------
// Deployable Tree, original code by Parousia
//---------------------------------------------------------
datablock StaticShapeData(DeployedTree) : StaticShapeDamageProfile {
className = "tree";
shapeFile = "borg19.dts";
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.3;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.05;
expImpulse = 200;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed Tree';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
};
datablock StaticShapeData(DeployedTree0) : DeployedTree {
shapeFile = "borg16.dts";
};
datablock StaticShapeData(DeployedTree1) : DeployedTree {
shapeFile = "borg17.dts";
};
datablock StaticShapeData(DeployedTree2) : DeployedTree {
shapeFile = "borg18.dts";
};
datablock StaticShapeData(DeployedTree3) : DeployedTree {
shapeFile = "borg19.dts";
};
datablock StaticShapeData(DeployedTree4) : DeployedTree {
shapeFile = "dorg15.dts";
};
datablock StaticShapeData(DeployedTree5) : DeployedTree {
shapeFile = "dorg16.dts";
};
datablock StaticShapeData(DeployedTree6) : DeployedTree {
shapeFile = "dorg17.dts";
};
datablock StaticShapeData(DeployedTree7) : DeployedTree {
shapeFile = "dorg18.dts";
};
datablock StaticShapeData(DeployedTree8) : DeployedTree {
shapeFile = "dorg19.dts";
};
datablock StaticShapeData(DeployedTree9) : DeployedTree {
shapeFile = "porg3.dts";
};
datablock StaticShapeData(DeployedTree10) : DeployedTree {
shapeFile = "porg6.dts";
};
datablock StaticShapeData(DeployedTree11) : DeployedTree {
shapeFile = "sorg20.dts";
};
datablock StaticShapeData(DeployedTree12) : DeployedTree {
shapeFile = "sorg22.dts";
};
datablock StaticShapeData(DeployedTree13) : DeployedTree {
shapeFile = "xorg3.dts";
};
datablock ShapeBaseImageData(TreeDeployableImage) {
mass = 20;
emap = true;
shapeFile = "stackable1s.dts";
item = TreeDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = DeployedTree;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.5;
maxDeployDis = 50.0;
};
datablock ItemData(TreeDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = true;
image = "TreeDeployableImage";
pickUpName = "a tree pack";
heatSignature = 0;
emap = true;
};
function TreeDeployableImage::testObjectTooClose(%item) {
return "";
}
function TreeDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function TreeDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function TreeDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfaceNrm2 = %playerVector;
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = %item.deployed @ %plyr.packSet;
scale = vectorScale("1 1 1",$expertSetting["tree",%plyr.expertSet]);
};
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
addDSurface(%item.surface,%deplObj);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function DeployedTree::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, TreeDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
}
function TreeDeployableImage::onMount(%data, %obj, %node) {
%obj.hasTree = true; // set for treecheck
%obj.packSet = 0;
%obj.expertSet = 5;
}
function TreeDeployableImage::onUnmount(%data, %obj, %node) {
%obj.hasTree = "";
%obj.packSet = 0;
%obj.expertSet = 0;
}
function DeployedTree0::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree1::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree2::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree3::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree4::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree5::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree6::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree7::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree8::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree9::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree10::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree11::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree12::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}
function DeployedTree13::onDestroyed(%this,%obj,%prevState) {
DeployedTree::onDestroyed(%this,%obj,%prevState);
}

432
Scripts/Packs/tripwire.cs Normal file
View file

@ -0,0 +1,432 @@
// Tripwire
datablock ForceFieldBareData(TripField) : DeployedForceField {
baseTranslucency = 0.1;
powerOffTranslucency = 0.0;
teamPermiable = true;
otherPermiable = true;
color = "1 0 0";
powerOffColor = "0.0 0.0 0.0";
deployedFrom = "";
needsPower = false;
};
datablock AudioProfile(TripwireSound) {
filename = "fx/misc/rolechange.wav";
description = AudioClosest3d;
preload = true;
};
datablock TriggerData(TripTrigger) {
// TODO - check this
tickPeriodMS = 200;
};
function TripTrigger::onEnterTrigger(%data, %obj, %colObj) {
// TODO - keep trip FF scaled down until trip is triggered - vehicle fix?
%baseObj = %obj.baseObj;
%baseObj.triggerCount++;
if (%baseObj.triggerCount > 1)
return;
%baseObj.play3D(TripwireSound);
if (isObject(%baseObj.tripField)) {
cancel(%baseObj.tripField.hideSched);
%baseObj.tripField.getDataBlock().gainPower(%baseObj.tripField);
}
%tripMode = %baseObj.tripMode;
while (%tripMode > 1 && %tripMode > -1 && %tripMode !$= "")
%tripMode = %tripMode - 2;
%count = getWordCount($PowerList);
for(%i=0;%i<%count;%i++) {
%powerObj = getWord($PowerList,%i);
if (vectorDist(%baseObj.getPosition(),%powerObj.getPosition()) < %baseObj.switchRadius
&& !%powerObj.isRemoved && %baseObj.powerFreq == %powerObj.powerFreq
&& %baseObj.team == %powerObj.team) {
%r = toggleGenerator(%powerObj,!%tripMode);
%r1 = firstWord(%r);
%r2 = getTaggedString(getWord(%r,1));
%r3 = getWord(%r,2);
if (%r1 == -3) {
cancel(%powerObj.toggleSched);
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,!%tripMode);
}
}
}
}
function TripTrigger::onLeaveTrigger(%data, %obj, %colObj) {
%baseObj = %obj.baseObj;
%baseObj.triggerCount--;
if (%baseObj.triggerCount > 0)
return;
%baseObj.play3D(TripwireSound);
if (isObject(%baseObj.tripField)) {
cancel(%baseObj.tripField.hideSched);
%baseObj.tripField.hideSched = %baseObj.tripField.getDataBlock().schedule(2000,losePower,%baseObj.tripField);
}
%tripMode = %baseObj.tripMode;
if (%tripMode == 2 || %tripMode == 3)
return;
if (%tripMode == 4 || %tripMode == 5)
%timed = true;
while (%tripMode > 1 && %tripMode > -1 && %tripMode !$= "")
%tripMode = %tripMode - 2;
%count = getWordCount($PowerList);
for(%i=0;%i<%count;%i++) {
%powerObj = getWord($PowerList,%i);
if (vectorDist(%baseObj.getPosition(),%powerObj.getPosition()) < %baseObj.switchRadius
&& !%powerObj.isRemoved && %baseObj.powerFreq == %powerObj.powerFreq
&& %baseObj.team == %powerObj.team) {
if (%timed) {
cancel(%powerObj.toggleSched);
%powerObj.toggleSched = schedule(5000,0,delayedToggleGenerator,%powerObj,%tripMode);
}
else {
%r = toggleGenerator(%powerObj,%tripMode);
%r1 = firstWord(%r);
%r2 = getTaggedString(getWord(%r,1));
%r3 = getWord(%r,2);
if (%r1 == -3) {
cancel(%powerObj.toggleSched);
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,%tripMode);
}
}
}
}
}
function delayedToggleGenerator(%powerObj,%tripMode) {
%r = toggleGenerator(%powerObj,%tripMode);
%r1 = firstWord(%r);
%r2 = getTaggedString(getWord(%r,1));
%r3 = getWord(%r,2);
if (%r1 == -3) {
cancel(%powerObj.toggleSched);
%powerObj.toggleSched = schedule(%r3 + 100,0,toggleGenerator,%powerObj,%tripMode);
}
}
function TripTrigger::onTickTrigger(%data, %obj) {
}
function TripTrigger::onTrigger(%this, %triggerId, %on) {
}
datablock StaticShapeData(DeployedTripwire) : StaticShapeDamageProfile {
className = "tripwire";
shapeFile = "camera.dts";
maxDamage = 0.2;
destroyedLevel = 0.2;
disabledLevel = 0.2;
isShielded = false;
energyPerDamagePoint = 40;
maxEnergy = 30;
rechargeRate = 0.05;
explosion = HandGrenadeExplosion;
expDmgRadius = 1.0;
expDamage = 0.3;
expImpulse = 500;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Deployed';
targetTypeTag = 'Tripwire';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
emap = true;
};
datablock ShapeBaseImageData(TripwireDeployableImage) {
mass = 20;
emap = true;
shapeFile = "camera.dts";
item = TripwireDeployable;
mountPoint = 1;
offset = "0 0 0";
rotation = "-1 0 0 90";
deployed = DeployedTripwire;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = false;
maxDepSlope = 360;
deploySound = ItemPickupSound;
minDeployDis = 0.25;
maxDeployDis = 5;
};
datablock ItemData(TripwireDeployable) {
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 5.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 3;
rotate = true;
image = "TripwireDeployableImage";
pickUpName = "a tripwire pack";
heatSignature = 0;
emap = true;
};
function TripwireDeployableImage::testNoTerrainFound(%item) {
// don't check this for non-Landspike turret deployables
}
function TripwireDeployable::onPickup(%this, %obj, %shape, %amount) {
// created to prevent console errors
}
function TripwireDeployableImage::onDeploy(%item, %plyr, %slot) {
%className = "StaticShape";
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj = new (%className)() {
dataBlock = DeployedTripwire;
};
%deplObj.switchRadius = getWord($packSetting[TripwireDeployableImage, %plyr.packSet[0]], 0);
%deplObj.fieldMode = %plyr.packSet[2];
%deplObj.tripMode = %plyr.packSet[1];
if (%deplObj.fieldMode == 1)
%deplObj.beamRange = 160;
else
%deplObj.beamRange = 30;
if(!%plyr.packSet[3])
{
%deplObj.tripField = new ForceFieldBare() {
dataBlock = TripField;
scale = "0.05 0.05 0.1";
};
%deplObj.tripField.pzone.delete();
}
%deplObj.tripTrigger = new Trigger() {
dataBlock = TripTrigger;
polyhedron = "0 1 0 1 0 0 0 -1 0 0 0 1";
scale = "0.05 0.05 0.1";
};
%deplObj.tripTrigger.baseObj = %deplObj;
// set orientation
%deplObj.setTransform(%item.surfacePt SPC %rot);
adjustTripwire(%deplObj);
// set the recharge rate right away
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
addDSurface(%item.surface,%deplObj);
// take the deployable off the player's back and out of inventory
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function DeployedTripwire::onDestroyed(%this,%obj,%prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this,%obj,%prevState);
$TeamDeployedCount[%obj.team, TripwireDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
if (isObject(%obj.tripField))
%obj.tripField.schedule(500, "delete");
if (isObject(%obj.tripTrigger))
%obj.tripTrigger.schedule(500, "delete");
}
function DeployedTripwire::disassemble(%data,%plyr,%obj) {
if (isObject(%obj.tripField))
%obj.tripField.delete();
if (isObject(%obj.tripTrigger))
%obj.tripTrigger.delete();
disassemble(%data,%plyr,%obj);
}
function adjustTripwire(%obj) {
if (!isObject(%obj))
return;
cancel(%obj.adjustSched);
%pos = %obj.getPosition();
%nrm = realVec(%obj,"0 0 1");
%nrm2 = realVec(%obj,"1 0 0");
%nrm3 = realVec(%obj,"0 1 0");
// TODO - temporary - remove
if ($TripWireFlareMode == true) {
%pos = vectorAdd(%obj.getPosition(),vectorScale(%nrm,0.35));
%vec = vectorScale(%nrm,0.7);
%p = new FlareProjectile() {
dataBlock = FlareGrenadeProj;
initialDirection = %vec;
initialPosition = %pos;
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
%p.schedule(6000,"delete");
}
// save ourselves re-doing some calculations
%mask = $TypeMasks::VehicleObjectType | $TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType | $TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::DamagableItemObjectType;
if (%obj.fieldMode == 1) {
// new pad data can be done here for both field and trigger
// "normal" (no hit) beamRange limited to 0.5m - 8m
// max beamRange limited to 0.5m - 160m
%pad = pad(%obj.getPosition() SPC realVec(%obj,"0 0 1") SPC realVec(%obj,"1 0 0"),0.5 SPC limit(%obj.beamRange,0.5,8) SPC limit(%obj.beamRange,0.5,160),"-0.5 -0.5 -0.5",%mask,%obj.tripField);
%newScale = getWords(%pad,0,2);
%newPos = getWords(%pad,3,5);
%newRot = getWords(%pad,6,9);
}
else {
// beam
%dist = rayDist(vectorAdd(%pos,vectorScale(%nrm,0.1)) SPC %nrm,1 SPC %obj.beamRange SPC %obj.beamRange,%mask,%obj.tripField);
}
if (isObject(%obj.tripField)) {
%obj2 = %obj.tripField;
if (%obj.fieldMode == 0) {
%scale = %obj2.getScale();
%newPos = vectorAdd(%pos,vectorAdd(vectorScale(%nrm2,-(getWord(%scale,0) / 2)),vectorScale(%nrm3,-(getWord(%scale,1) / 2))));
%newRot = %obj.getRotation();
%newScale = getWords(%scale,0,1) SPC %dist;
}
%oldData = %obj2.oldData;
%newData = %newPos SPC %newRot SPC %newScale;
if (%oldData !$= %newData && %obj.triggerCount == 0) {
// call gainPower() before modifying forcefield!
%obj2.getDataBlock().gainPower(%obj2);
%obj2.setTransform(%newPos SPC %newRot);
%obj2.setScale(%newScale);
%obj2.oldData = %newData;
cancel(%obj2.hideSched);
%obj2.hideSched = %obj2.getDataBlock().schedule(2000,losePower,%obj2);
}
}
if (isObject(%obj.tripTrigger)) {
%obj2 = %obj.tripTrigger;
if (%obj.fieldMode == 0) {
%scale = %obj2.getScale();
%newPos = vectorAdd(%pos,vectorAdd(vectorScale(%nrm2,-(getWord(%scale,0) / 2)),vectorScale(%nrm3,-(getWord(%scale,1) / 2))));
%newRot = %obj.getRotation();
%newScale = getWords(%scale,0,1) SPC %dist;
}
%oldData = %obj2.oldData;
%newData = %newPos SPC %newRot SPC %newScale;
if (%oldData !$= %newData && %obj.triggerCount == 0) {
%obj2.setTransform(%newPos SPC %newRot);
%obj2.setScale(%newScale);
%obj2.oldData = %newData;
}
}
%obj.adjustSched = schedule(1000,0,adjustTripwire,%obj);
}
function TripwireDeployableImage::onMount(%data, %obj, %node) {
%obj.hasTripwire = true; // set for tripcheck
%obj.packSet = 0;
%obj.packSet[0] = 0;
%obj.packSet[1] = 0;
%obj.packSet[2] = 0;
%obj.packSet[3] = 0;
displayPowerFreq(%obj);
}
function TripwireDeployableImage::onUnmount(%data, %obj, %node) {
%obj.packSet = 0;
%obj.packSet[0] = 0;
%obj.packSet[1] = 0;
%obj.packSet[2] = 0;
%obj.packSet[3] = 0;
%obj.hasTripwire = "";
}
function TripwireDeployableImage::ChangeMode(%data,%plyr,%val,%level)
{
if (%level == 0)
{
%set = %plyr.expertSet;
if(%set $= "")
%set = 0;
%image = %data.getName();
%settings = $packSettings[%image,%set];
%plyr.packSet[%set] = %plyr.packSet[%set] + %val;
if (%plyr.packSet[%set] > getWord(%settings,0))
%plyr.packSet[%set] = 0;
if (%plyr.packSet[%set] < 0)
%plyr.packSet[%set] = getWord(%settings,0);
%packname = GetWords(%settings,2,getWordCount(%settings));
%curset = $PackSetting[%image,%plyr.packSet[%set],%set];
if (getWord(%settings,1) == -1)
%line = GetWords(%curset,0,getWordCount(%curset));
else
%line = GetWords(%curset,0,getWord(%settings,1));
bottomPrint(%plyr.client,%packname SPC "set to"SPC %line,2,1);
}
else
{
Parent::ChangeMode(%data,%plyr,%val,%level);
}
}

138
Scripts/Packs/turretpack.cs Normal file
View file

@ -0,0 +1,138 @@
// turretpack.cs - turret pack
//
datablock ShapeBaseImageData(TurretDeployableImage)
{
mass = 15;
emap = true;
shapeFile = "stackable1s.dts";
item = TurretBasePack;
mountPoint = 1;
offset = "0 -0.2 0";
minDeployDis = 0.5;
maxDeployDis = 5.0;
deployed = TurretDeployedBase;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 360;
deploySound = StationDeploySound;
};
datablock ItemData(TurretBasePack)
{
className = Pack;
catagory = "Deployables";
shapeFile = "stackable1s.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "TurretDeployableImage";
pickUpName = "a base turret pack";
heatSignature = 0;
computeCRC = true;
emap = true;
};
datablock TurretData(TurretDeployedBase) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_base_large.dts";
rechargeRate = 0.31;
selfPower = true;
needsPower = true;
mass = 5.0;
maxDamage = 2.25;
destroyedLevel = 2.25;
disabledLevel = 1.35;
repairRate = 0;
explosion = TurretExplosion;
expDmgRadius = 15.0;
expDamage = 0.7;
expImpulse = 2000.0;
deployedObject = true;
thetaMin = 15;
thetaMax = 140;
//thetaNull = 90;
isShielded = false;
energyPerDamagePoint = 50;
maxEnergy = 150;
humSound = SensorHumSound;
heatSignature = 1;
pausePowerThread = true;
canControl = true;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Deployed Base';
targetTypeTag = 'Turret';
sensorData = TurretBaseSensorObj;
sensorRadius = TurretBaseSensorObj.detectRadius;
sensorColor = "0 212 45";
firstPersonOnly = true;
debrisShapeName = "debris_generic.dts";
debris = TurretDebris;
};
function TurretDeployableImage::onDeploy(%item, %plyr, %slot)
{
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
%origBarrel = %item.item.origBarrel;
if(%origBarrel !$= "")
{
%deplObj.mountImage(%origBarrel, 0, false);
%item.item.origBarrel = "";
}
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
%item.surfacenrm = VectorNormalize(%item.surfacenrm);
//echo(%playervector);
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%deplObj.setTransform(%item.surfacePt SPC %rot);
//%deplObj.setSelfPowered();
//%deplObj.playThread($PowerThread,"Power");
addDSurface(%item.surface,%deplObj);
addToDeployGroup(%deplObj);
%deplObj.powerFreq = %plyr.powerFreq;
%deplObj.team = %plyr.team;
checkPowerObject(%deplObj);
}
function TurretDeployableImage::onMount(%data, %obj, %node) {
displayPowerFreq(%obj);
}
function TurretBasePack::onPickup(%this, %obj, %shape, %amount)
{
// This is here to prevent console spam
}

816
Scripts/Packs/vehiclepad.cs Normal file
View file

@ -0,0 +1,816 @@
//======================================
// made by dynablade
//====================================== Deployable Vehicle Pad
datablock StaticShapeData(DeployableVehicleStation) : StaticShapeDamageProfile
{
className = Station;
catagory = "Stations";
shapeFile = "Vehicle_pad_station.dts";
maxDamage = 7.5;
destroyedLevel = 7.5;
disabledLevel = 7.5;
explosion = ShapeExplosion;
expDmgRadius = 10.0;
expDamage = 0.4;
expImpulse = 1500.0;
dynamicType = $TypeMasks::StationObjectType;
isShielded = true;
energyPerDamagePoint = 500;
maxEnergy = 250;
rechargeRate = 0.31;
humSound = StationVehicleHumSound;
cmdCategory = "Support";
cmdIcon = CMDVehicleStationIcon;
cmdMiniIconName = "commander/MiniIcons/com_vehicle_pad_inventory";
targetTypeTag = 'Deployable Vehicle Station';
debrisShapeName = "debris_generic.dts";
debris = StationDebris;
needsPower = true;
};
datablock StaticShapeData(DeployableVehiclePad)
{
className = vpad;
catagory = "Stations";
shapeFile = "Vehicle_pad.dts";
maxDamage = 7.5;
destroyedLevel = 7.5;
disabledLevel = 7.5;
explosion = ShapeExplosion;
expDmgRadius = 10.0;
expDamage = 0.4;
expImpulse = 1500.0;
rechargeRate = 0.05;
targetTypeTag = 'Deployable Vehicle Station';
needsPower = true;
};
datablock StaticShapeData(DeployableVehiclePad2) : DeployableVehiclePad
{
className = vpad;
shapeFile = "station_teleport.dts";
};
datablock StaticShapeData(DeployableVehiclePadBottom) : StaticShapeDamageProfile {
className = "floor";
shapeFile = "bmiscf.dts";
maxDamage = 4;
destroyedLevel = 4;
disabledLevel = 3.5;
isShielded = true;
energyPerDamagePoint = 30;
maxEnergy = 200;
rechargeRate = 0.25;
explosion = HandGrenadeExplosion;
expDmgRadius = 3.0;
expDamage = 0.1;
expImpulse = 200.0;
dynamicType = $TypeMasks::StaticShapeObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSensorIcon;
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
targetNameTag = 'Medium Blast floor';
deployAmbientThread = true;
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = true;
};
datablock StaticShapeData(PotPipe) : DeployableVehiclePadBottom
{
shapeFile = "silver_pole.dts";
targetNameTag = 'Pot Powered';
targetTypeTag = 'Alloy forge';
};
datablock ParticleData(DVPADP)
{
dragCoeffiecient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 0;
spinRandomMin = 30.0;
spinRandomMax = 30.0;
windcoefficient = 0;
textureName = "skins/jetflare03";
colors[0] = "0.3 0.3 1.0 0.1";
colors[1] = "0.3 0.3 1.0 1";
colors[2] = "0.3 0.3 1.0 1";
colors[3] = "0.3 0.3 1.0 0.1";
sizes[0] = 5;
sizes[1] = 5;
sizes[2] = 5;
sizes[3] = 5;
times[0] = 0.25;
times[1] = 0.5;
times[2] = 0.75;
times[3] = 1;
};
datablock ParticleEmitterData(DVPADE)
{
lifetimeMS = 10;
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 0.01;
velocityVariance = 0.0;
ejectionoffset = 8;
thetaMin = 80.0;
thetaMax = 100.0;
phiReferenceVel = "180";
phiVariance = "5";
orientParticles = false;
orientOnVelocity = false;
particles = "DVPADP";
};
datablock ParticleData(SIGMAP)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.5;
inheritedVelFactor = 0.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 1000;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
windcoefficient = 0;
textureName = "skins/jetflare03";
colors[0] = "1 1 0 0"; //Wacky collors :P
colors[1] = "0 1 1 1";
colors[2] = "1 0 1 1";
colors[3] = "0 1 0 1";
sizes[0] = 5;
sizes[1] = 5;
sizes[2] = 5;
sizes[3] = 5;
times[0] = 0.5;
times[1] = 0.6;
times[2] = 0.8;
times[3] = 1;
};
datablock ParticleEmitterData(SIGMAE)
{
lifetimeMS = 10;
ejectionPeriodMS = 50;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 0.5;
ejectionoffset = 0.5;
thetaMin = 80.0;
thetaMax = 100.0;
phiReferenceVel = "0";
phiVariance = "360";
orientParticles = false;
orientOnVelocity = false;
particles = "SIGMAP";
};
function DeployableVehicleStation::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
%trigger = new Trigger()
{
dataBlock = stationTrigger;
polyhedron = "-0.75 0.75 0.0 1.5 0.0 0.0 0.0 -1.5 0.0 0.0 0.0 2.0";
};
MissionCleanup.add(%trigger);
%trigger.setTransform(%obj.getTransform());
%trigger.station = %obj;
%obj.trigger = %trigger;
}
function DeployableVehicleStation::stationReady(%data, %obj)
{
// Make sure none of the other popup huds are active:
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
//Display the Vehicle Station GUI
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
}
function DeployableVehicleStation::stationFinished(%data, %obj)
{
//Hide the Vehicle Station GUI
commandToClient(%obj.triggeredBy.client, 'StationVehicleHideHud');
}
function DeployableVehicleStation::getSound(%data, %forward)
{
if(%forward)
return "StationVehicleAcitvateSound";
else
return "StationVehicleDeactivateSound";
}
function DeployableVehicleStation::setPlayersPosition(%data, %obj, %trigger, %colObj)
{
%vel = getWords(%colObj.getVelocity(), 0, 1) @ " 0";
if((VectorLen(%vel) < 22) && (%obj.triggeredBy != %colObj))
{
%posXY = getWords(%trigger.getTransform(),0 ,1);
%posZ = getWord(%trigger.getTransform(), 2);
%rotZ = getWord(%obj.getTransform(), 5);
%angle = getWord(%obj.getTransform(), 6);
%angle += 3.141592654;
if(%angle > 6.283185308)
%angle = %angle - 6.283185308;
%colObj.setvelocity("0 0 0");
%colObj.setTransform(%posXY @ " " @ %posZ + 0.2 @ " " @ "0 0 " @ %rotZ @ " " @ %angle );//center player on object
return true;
}
return false;
}
function DeployableVehiclePad::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.ready = true;
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
function DeployableVehiclePad2::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.ready = true;
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
function GiveStation(%obj,%transform)
{
%pos = getWords(%transform,0,2);
%rot = getWords(%transform,3,5) SPC (getWord(%transform,6)/3.14*180);
%sv = new StaticShape()
{
scale = "1 1 1";
dataBlock = DeployableVehicleStation;
lockCount = "0";
homingCount = "0";
team = %obj.team;
position = %pos;
rotation = %rot;
};
%sv.setTransform(%transform);
%sv.powerFreq = %obj.powerFreq;
MissionCleanup.add(%sv);
//%sv.getDataBlock().gainPower(%sv);
//%obj.getDatablock().gainPower(%obj);
checkPowerObject(%obj);
checkPowerObject(%sv);
%sv.pad = %obj;
%obj.station = %sv;
%sv.trigger.mainObj = %obj;
%sv.trigger.disableObj = %sv;
adjustTrigger(%sv);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Original Code in Station.cs
// Code made by Blnukem.
//------------------------------------------------------------------------------
// Basic Restriction to Construction Vehicles in the Construction Gametype.
if ($CurrentMissionType $= "Construction") {
%sv.vehicle[HawkFlyer] = true;
%sv.vehicle[Personelboat] = true;
// Now to set the vehicle defaults for Non-Construction Gametypes.
} else if ($CurrentMissionType !$= "Construction") {
%sv.vehicle[boat] = true;
%sv.vehicle[sub] = true;
%sv.vehicle[Personelboat] = true;
%sv.vehicle[scoutFlyer] = true;
%sv.vehicle[AWACS] = true;
%sv.vehicle[helicopter] = true;
%sv.vehicle[HeavyChopper] = true;
}
}
function GiveStation2(%obj,%transform)
{
%pos = getWords(%transform,0,2);
%rot = getWords(%transform,3,5) SPC (getWord(%transform,6)/3.14*180);
%sv = new StaticShape()
{
scale = "1 1 1";
dataBlock = DeployableVehicleStation;
lockCount = "0";
homingCount = "0";
team = %obj.team;
position = %pos;
rotation = %rot;
};
%sv.setTransform(%transform);
%sv.powerFreq = %obj.powerFreq;
MissionCleanup.add(%sv);
checkPowerObject(%obj);
checkPowerObject(%sv);
%sv.pad = %obj;
%obj.station = %sv;
%sv.trigger.mainObj = %obj;
%sv.trigger.disableObj = %sv;
adjustTrigger(%sv);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Original Code in Station.cs
// Code made by Blnukem.
//------------------------------------------------------------------------------
// Basic Restriction to Construction Vehicles in the Construction Gametype.
if ($CurrentMissionType $= "Construction") {
%sv.vehicle[SuperScoutVehicle] = true;
%sv.vehicle[HawkFlyer] = true;
%sv.vehicle[mobileBasevehicle] = true;
%sv.vehicle[hapcFlyer] = true;
%sv.vehicle[bomberFlyer] = true;
// Now to set the vehicle defaults for Non-Construction Gametypes.
} else if ($CurrentMissionType !$= "Construction") {
%sv.vehicle[mobileBasevehicle] = true;
%sv.vehicle[scoutFlyer] = true;
%sv.vehicle[hapcFlyer] = true;
%sv.vehicle[CGTank] = true;
%sv.vehicle[helicopter] = true;
%sv.vehicle[StrikeFlyer] = true;
}
}
function DeployableVehiclePad::onEndSequence(%data, %obj, %thread)
{
if(%thread == $ActivateThread)
{
%obj.ready = true;
%obj.stopThread($ActivateThread);
}
Parent::onEndSequence(%data, %obj, %thread);
}
function DeployableVehiclePad2::onEndSequence(%data, %obj, %thread)
{
if(%thread == $ActivateThread)
{
%obj.ready = true;
%obj.stopThread($ActivateThread);
}
Parent::onEndSequence(%data, %obj, %thread);
}
function DeployableVehiclePad::gainPower(%data, %obj)
{
if (isObject(%obj.station))
%obj.station.setSelfPowered();
Parent::gainPower(%data, %obj);
}
function DeployableVehiclePad2::gainPower(%data, %obj)
{
if (isObject(%obj.station))
%obj.station.setSelfPowered();
Parent::gainPower(%data, %obj);
}
function DeployableVehiclePad::losePower(%data, %obj)
{
if (isObject(%obj.station))
%obj.station.clearSelfPowered();
Parent::losePower(%data, %obj);
}
function DeployableVehiclePad2::losePower(%data, %obj)
{
if (isObject(%obj.station))
%obj.station.clearSelfPowered();
Parent::losePower(%data, %obj);
}
function DeployableVehiclePad::onDestroyed(%this, %obj, %prevState)
{
if (isObject(%obj))
disassembleVehilcepad(%obj,%plyr);
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
%obj.schedule(500, "delete");
%obj.station.schedule(500, "delete");
%obj.back.schedule(500,"delete");
}
function DeployableVehiclePad2::onDestroyed(%this, %obj, %prevState)
{
if (isObject(%obj))
disassembleVehilcepad(%obj,%plyr);
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
%obj.schedule(500, "delete");
%obj.station.schedule(500, "delete");
%obj.back.schedule(500,"delete");
}
function DeployableVehicleStation::onDestroyed(%this, %obj, %prevState)
{
if (isObject(%obj.pad))
disassembleVehilcepad(%obj.pad,%plyr);
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
%obj.schedule(500, "delete");
%obj.station.schedule(500, "delete");
%obj.back.schedule(500,"delete");
}
function DeployableVehiclePadBottom::onDestroyed(%this, %obj, %prevState)
{
if (isObject(%obj.station))
disassembleVehilcepad(%obj.station,%plyr);
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, VehiclePadPack]--;
%obj.schedule(500, "delete");
%obj.station.schedule(500, "delete");
%obj.back.schedule(500,"delete");
}
datablock ShapeBaseImageData(VehiclePadPackImage)
{
mass = 10;
emap = true;
shapeFile = "pack_deploy_inventory.dts";
item = VehiclePadPack;
mountPoint = 1;
offset = "0 0 0";
heatSignature = 0;
deployed = DeployableVehiclePad;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
maxDepSlope = 360;
deploySound = StationDeploySound;
minDeployDis = 0;
maxDeployDis = 50.0; //meters from body
};
datablock ItemData(VehiclePadPack)
{
className = Pack;
catagory = "Deployables";
shapeFile = "pack_deploy_inventory.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "VehiclePadPackImage";
pickUpName = "a deployable vehicle pad";
heatSignature = 0;
emap = true;
};
function VehiclePadPackImage::onMount(%this, %obj, %slot)
{
%this.imagemount = %obj;
%obj.hasVehiclepad = 1;
}
function VehiclePadPackImage::onUnmount(%data,%obj,%node)
{
%obj.hasVehiclepad = "";
}
function VehiclePadPack::onPickup(%this, %pack, %player, %amount)
{
%player.packcharge = %pack.charge;
%player.lastvpad = %pack.vpad;
}
function VehiclePadPack::onThrow(%this,%pack,%player)
{
%this.charge = %player.packcharge;
%this.vpad = %player.lastvpad;
%player.packcharge = "";
%player.lastvpad = "";
serverPlay3D(ItemThrowSound, %player.getTransform());
%pack.schedulePop();
}
function VehiclePadPackImage::onDeploy(%item, %plyr, %slot)
{
if (IsObject(%plyr.lastvpad) && IsObject(%plyr.lastvpad.station))
%plyr.packcharge = 0;
if (IsObject(%plyr.lastvpad) && !IsObject(%plyr.lastvpad.station))
%plyr.packcharge = 1;
if (!IsObject(%plyr.lastvpad))
%plyr.packcharge = 0;
// take the deployable off the player's back and out of inventory
if (%plyr.packcharge == 1)
{
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
$TeamDeployedCount[%plyr.team, %item.item]++;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = vectorScale(%playerVector,1);
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%vpad = %plyr.lastvpad;
if (%plyr.packset == 1)
%deplObj = GiveStation(%vpad,%item.surfacePt SPC %rot);
else
%deplObj = GiveStation2(%vpad,%item.surfacePt SPC %rot);
%deplObj.deploy();
addDSurface(%item.surface,%deplObj);
%deplObj.setOwner(%plyr);
%plyr.packcharge = "";
%plyr.lastvpad = "";
%vpad.isRemoved = 0;
%vpad.back.isRemoved = 0;
if (%vpad.style ==2)
{
%deplObj.emitter = CreateEmitter(%item.surfacePt,SIGMAE);
%deplObj.emitter.setRotation(%deplObj.getRotation());
}
}
else
{
%dist = VectorSub(%item.surfacept,%plyr.getTransform());
%nrm = VirVec(%item.surface,%item.surfacenrm);
%img = VirVec(%item.surface,VectorNormalize(VectorCross(VectorCross(%item.surfacenrm,%dist),%item.surfacenrm)));
%item.surfacenrm2 = realvec(%item.surface,VectorCross(%nrm,topvec(%img)));
// create the actual deployable
%rot = %item.getInitialRotation(%plyr);
if (%plyr.packset == 1)
%block = DeployableVehiclePad2;
else
%block = DeployableVehiclePad;
%deplObj = new StaticShape()
{
dataBlock = %block;
};
%back = new StaticShape()
{
dataBlock = DeployableVehiclePadBottom;
};
%back.needsfit = 1;
%deplObj.needsfit = 1;
%deplObj.style = %plyr.packset;
%pos = getWords(%item.surface.getEdge(%nrm),0,2);
%deplObj.setTransform(%pos SPC fullrot(%item.surfacenrm,%item.surfacenrm2));
if (VectorDot(vAbs(VectorNormalize(topvec(%img))),%item.surface.getRealSize())== %item.surfacesizex)
{
%x= %item.surfacesizex;
%y= %item.surfacesizey;
%item.surfacesizex = %y;
%item.surfacesizey = %x;
}
%deplObj.setRealSize(%item.surfacesizex SPC %item.surfacesizey SPC "1.5");
%back.setTransform(%pos SPC fullrot(%item.surfacenrm,%item.surfacenrm2));
%back.setRealSize(VectorMultiply(%deplObj.getRealSize(),"1 1 0.1"));
if (%plyr.packset == 2)
{
%back.potpipes();
}
// %deplObj.setTransform(modifyTransform(%pos SPC %rot, "0 0 -1 0 0 0 0"));
%deplObj.back = %back;
%back.station = %deplObj;
// set the recharge rate right away
if(%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
// set team, owner, and handle
%deplObj.team = %plyr.client.Team;
%back.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
%back.setOwner(%plyr);
// set the sensor group if it needs one
if(%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
addToDeployGroup(%deplObj.back);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
%deplObj.getDatablock().onAdd(%deplObj);
%deplObj.deploy();
//%deplObj.setSelfPowered();
%plyr.packcharge++;
%plyr.lastvpad = %deplObj;
%deplObj.powerFreq = %plyr.powerFreq;
%back.powerFreq = %plyr.powerFreq;
checkPowerObject(%deplobj);
checkPowerObject(%back);
%deplObj.isRemoved = 1;
%back.isRemoved = 1;
schedule(6000,0,"FadePad",%deplObj,%plyr);
addDSurface(%item.surface,%deplObj);
addDSurface(%item.surface,%back);
}
}
function FadePad(%obj,%plyr)
{
if (!Isobject(%obj.station))
{
schedule(100,%obj,"disassembleVehilcepad",%obj,%plyr);
}
}
function GameBase::PotPipes(%obj)
{
%obj.pipe1 = new StaticShape()
{
dataBlock = PotPipe;
scale = "0.5 0.5 0.5";
};
%obj.pipe2 = new StaticShape()
{
dataBlock = PotPipe;
scale = "0.5 0.5 0.5";
};
%obj.pipe3 = new StaticShape()
{
dataBlock = PotPipe;
scale = "0.5 0.5 0.5";
};
%obj.pipe4 = new StaticShape()
{
dataBlock = PotPipe;
scale = "0.5 0.5 0.5";
};
%obj.pipe1.setTransform(%obj.getEdge("0.9 0.9 1") SPC %obj.getRotation());
%obj.pipe2.setTransform(%obj.getEdge("0.9 -0.9 1")SPC %obj.getRotation());
%obj.pipe3.setTransform(%obj.getEdge("-0.9 -0.9 1")SPC %obj.getRotation());
%obj.pipe4.setTransform(%obj.getEdge("-0.9 0.9 1")SPC %obj.getRotation());
%obj.pipe1.emitter = CreateEmitter(%obj.pipe1.getEdge("0 0 1"),HeavyDamageSmoke);
%obj.pipe2.emitter = CreateEmitter(%obj.pipe2.getEdge("0 0 1"),HeavyDamageSmoke);
%obj.pipe3.emitter = CreateEmitter(%obj.pipe3.getEdge("0 0 1"),HeavyDamageSmoke);
%obj.pipe4.emitter = CreateEmitter(%obj.pipe4.getEdge("0 0 1"),HeavyDamageSmoke);
addToDeployGroup(%obj.pipe1);
addToDeployGroup(%obj.pipe2);
addToDeployGroup(%obj.pipe3);
addToDeployGroup(%obj.pipe4);
}
function GameBase::RemPotPipes(%obj)
{
if (IsObject(%obj.pipe1))
{
%obj.pipe1.emitter.delete();
%obj.pipe1.delete();
}
if (IsObject(%obj.pipe2))
{
%obj.pipe2.emitter.delete();
%obj.pipe2.delete();
}
if (IsObject(%obj.pipe3))
{
%obj.pipe3.emitter.delete();
%obj.pipe3.delete();
}
if (IsObject(%obj.pipe4))
{
%obj.pipe4.emitter.delete();
%obj.pipe4.delete();
}
}
function VehiclePadPackImage::testSurfaceTooNarrow(%item,%surface)
{
%nrm = getWords(%item.surface,4,6);
%mask = invFace(%nrm);
%narrower = vectorMultiply(%mask,%item.surface.getRealSize());
%fx = vectorNormalize(topVec(%narrower));
%fy = VectorCross(%nrm,%fx);
%sx = VectorLen(VectorMultiply(%fx,%item.surface.getRealSize()));
%sy = VectorLen(VectorMultiply(%fy,%item.surface.getRealSize()));
if (%sx < 17 || %sy < 17 || %sx < %sy*0.5 || %sy < %sx*0.5)
{
return !%item.imagemount.packcharge;
}
else
{
%item.surfacesizex = %sx;
%item.surfacesizey = %sy;
return false;
}
}
function VehiclePadPackImage::testNoInteriorFound(%item,%surface)
{
return !IsCubic(%item.surface) && !%item.imagemount.packcharge;
}
function DeployableVehiclePad::disassemble(%data,%plyr,%obj)
{
if (isObject(%obj))
disassembleVehilcepad(%obj,%plyr);
disassemble(%data,%plyr,%obj);
}
function DeployableVehiclePad2::disassemble(%data,%plyr,%obj)
{
if (isObject(%obj))
disassembleVehilcepad(%obj,%plyr);
disassemble(%data,%plyr,%obj);
}
function DeployableVehicleStation::disassemble(%data,%plyr,%obj)
{
if (isObject(%obj.pad))
disassembleVehilcepad(%obj.pad,%plyr);
disassemble(%data,%plyr,%obj);
}
function DeployableVehiclePadBottom::disassemble(%data,%plyr,%obj)
{
if (isObject(%obj.station))
disassembleVehilcepad(%obj.station,%plyr);
disassemble(%data,%plyr,%obj);
}
function PotPipe::disassemble(%data,%plyr,%obj)
{
if (%obj.emitter)
%obj.emitter.delete();
disassemble(%data,%plyr,%obj);
}
function disassembleVehilcepad(%station,%plyr)
{
%station.back.rempotpipes();
if (%station.station.emitter)
%station.station.emitter.delete();
if (isObject(%station.station))
disassemble("",%plyr,%station.station);
if (isObject(%station.back))
disassemble("",%plyr,%station.back);
disassemble("",%plyr,%station);
}

View file

@ -0,0 +1,292 @@
datablock StaticShapeData(RepairPad) : StaticShapeDamageProfile
{
className = Station;
shapeFile = "station_teleport.dts";
maxDamage = 5.50;
destroyedLevel = 5.50;
disabledLevel = 4.75;
explosion = DeployablesExplosion;
expDmgRadius = 15.0;
expDamage = 0.65;
expImpulse = 1500.0;
dynamicType = $TypeMasks::StationObjectType;
isShielded = false;
energyPerDamagePoint = 110;
maxEnergy = 50;
rechargeRate = 0.20;
renderWhenDestroyed = false;
doesRepair = true;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDStationIcon;
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
targetNameTag = 'Vehicle';
targetTypeTag = 'Repair Pad';
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
needspower = true;
};
datablock ShapeBaseImageData(RepairPadImage)
{
mass = 15;
emap = true;
shapeFile = "pack_deploy_inventory.dts";
item = RepairPadDeployable;
mountPoint = 1;
offset = "0 0 0";
deployed = RepairPad;
heatSignature = 0;
stateName[0] = "Idle";
stateTransitionOnTriggerDown[0] = "Activate";
stateName[1] = "Activate";
stateScript[1] = "onActivate";
stateTransitionOnTriggerUp[1] = "Idle";
isLarge = true;
maxDepSlope = 30;
deploySound = StationDeploySound;
flatMinDeployDis = 1.0;
flatMaxDeployDis = 5.0;
minDeployDis = 2.5;
maxDeployDis = 5.0;
};
datablock ItemData(RepairPadDeployable)
{
className = Pack;
catagory = "Deployables";
shapeFile = "pack_deploy_inventory.dts";
mass = 3.0;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
rotate = false;
image = "RepairPadImage";
pickUpName = "a vehicle repair pad";
heatSignature = 0;
computeCRC = true;
emap = true;
};
function RepairPadImage::onDeploy(%item, %plyr, %slot) {
//Object
%className = "StaticShape";
%grounded = 0;
if (%item.surface.getClassName() $= TerrainBlock)
%grounded = 1;
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
if (%item.surfaceinher == 0) {
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
%item.surfaceNrm2 = %playerVector;
else
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
}
%item.surfaceNrm3 = vectorCross(%item.surfaceNrm,%item.surfaceNrm2);
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
%dataBlock = %item.deployed;
%deplObj = new (%className)() {
dataBlock = %dataBlock;
scale = "4.5 4.5 1";
};
//////////////////////////Apply settings//////////////////////////////
// [[Location]]:
// exact:
%deplObj.setTransform(%item.surfacePt SPC %rot);
// misc info
addDSurface(%item.surface,%deplObj);
// [[Settings]]:
%deplObj.grounded = %grounded;
%deplObj.needsFit = 1;
// [[Normal Stuff]];
// set team, owner, and handle
%deplObj.team = %plyr.client.team;
%deplObj.setOwner(%plyr);
// set the sensor group if it needs one
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
addToDeployGroup(%deplObj);
//let the AI know as well...
AIDeployObject(%plyr.client, %deplObj);
// play the deploy sound
serverPlay3D(%item.deploySound, %deplObj.getTransform());
// increment the team count for this deployed object
$TeamDeployedCount[%plyr.team, %item.item]++;
%deplObj.deploy();
// set power frequency
%deplObj.powerFreq = %plyr.powerFreq;
// Power object
checkPowerObject(%deplObj);
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
return %deplObj;
}
function RepairPad::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
if(%obj.isreping == 1)
stopVRepairLoop(%obj);
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, RepairPadDeployable]--;
remDSurface(%obj);
%obj.schedule(500, "delete");
fireBallExplode(%obj,1);
}
function RepairPad::onGainPowerEnabled(%data,%obj) {
if (%obj.reploop !$= "")
Cancel(%obj.repLoop);
%obj.isreping = 1;
%obj.repLoop = schedule(1000, 0, "VRepairLoop", %obj);
Parent::onGainPowerEnabled(%data,%obj);
}
function RepairPad::onLosePowerDisabled(%data,%obj) {
if (%obj.ZCloop !$= ""){
Cancel(%obj.repLoop);
stopVRepairLoop(%obj);
}
Parent::onLosePowerDisabled(%data,%obj);
}
function VRepairLoop(%obj){
if(isObject(%obj)){
if(%obj.isreping == 0)
return;
%targets = %obj.reptargets;
%pos = %obj.getWorldBoxCenter();
if(%targets !$= ""){
%numtrgs = getNumberOfWords(%targets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%targets, %i);
if(vectorDist(%pos, %target.getWorldBoxCenter()) <= 20 && %target.getDamageLevel() > 0.0){
if(%target.reping != 1){
%target.reping = 1;
%target.setRepairRate(%target.getRepairRate() + 0.01);
if(%target.affected && %target.getDamagelevel() < %target.getDatablock().HDAddMassLevel) {
if (%target.lastPilot.isPilot() == true)
messageClient(%target.lastPilot.client, '', 'Vehicle Repaired, and Manuverability restored!');
%target.unmountImage(7);
%target.Affected = 0;
if(%target.getClassName() $= "FlyingVehicle")
Cancel(%target.dmgStallLoop);
if(%target.getdatablock().getname() $= "scoutFlyer" || %target.getdatablock().getname() $= "strikeFlyer")
checkStallLoop(%obj);
}
}
}
else{
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - 0.01);
}
}
%datablock = %target.getDatablock();
if(%datablock.max[chaingunAmmo] !$= "" && %target.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
if(%datablock.max[chaingunAmmo] < 100)
%CGamount = 10;
else
%CGamount = 100;
%target.incInventory(chaingunAmmo, %CGamount);
%reloaded = 1;
}
else if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
%target.incInventory(MissileLauncherAmmo, 1);
%reloaded = 1;
}
else if(%datablock.max[MortarAmmo] !$= "" && %target.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
%target.incInventory(MortarAmmo, 1);
%reloaded = 1;
}
else if(%datablock.max[PlasmaAmmo] !$= "" && %target.inv[PlasmaAmmo] < %datablock.max[PlasmaAmmo]){
%target.incInventory(PlasmaAmmo, 4);
%reloaded = 1;
}
if(%reloaded == 1){
%reloaded = 0;
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
}
if(isObject(%target.turretObject)){
%datablock = %target.turretObject.getDatablock();
if(%datablock.max[chaingunAmmo] !$= "" && %target.turretObject.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
%target.turretObject.incInventory(chaingunAmmo, 100);
%reloaded = 1;
}
else if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.turretObject.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
%target.turretObject.incInventory(MissileLauncherAmmo, 1);
%reloaded = 1;
}
else if(%datablock.max[MortarAmmo] !$= "" && %target.turretObject.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
%target.turretObject.incInventory(MortarAmmo, 1);
%reloaded = 1;
}
if(%reloaded == 1)
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
}
}
}
%obj.reptargets = "";
InitContainerRadiusSearch(%pos, 15, $TypeMasks::VehicleObjectType);
while ((%targetObject = containerSearchNext()) != 0){
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
}
if(%obj.isreping == 1)
%obj.reploop = schedule(500, 0, "VRepairLoop", %obj);
}
}
function stopVRepairLoop(%obj){
%obj.isreping = 0;
if(%obj.reptargets !$= ""){
%numtrgs = getNumberOfWords(%obj.reptargets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%obj.reptargets, %i);
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - 0.01);
}
}
}
}

842
Scripts/RankStuff.cs Normal file
View file

@ -0,0 +1,842 @@
//--------------------------------------------------
//RANKS
//--------------------------------------------------
$Ranks::MinPoints[0] = 0;
$Ranks::NewRank[0] = "Private";
$Ranks::MinPoints[1] = 250;
$Ranks::NewRank[1] = "Private First Class";
$Ranks::MinPoints[2] = 500;
$Ranks::NewRank[2] = "Corporal";
$Ranks::MinPoints[3] = 1250;
$Ranks::NewRank[3] = "Specialist";
$Ranks::MinPoints[4] = 1800;
$Ranks::NewRank[4] = "Sergeant";
$Ranks::MinPoints[5] = 2550;
$Ranks::NewRank[5] = "Staff Sergeant";
$Ranks::MinPoints[6] = 3600;
$Ranks::NewRank[6] = "Sergeant First Class";
$Ranks::MinPoints[7] = 4800;
$Ranks::NewRank[7] = "Master Sergeant";
$Ranks::MinPoints[8] = 6000;
$Ranks::NewRank[8] = "Second Lieutenant";
$Ranks::MinPoints[9] = 8500;
$Ranks::NewRank[9] = "First Lieutenant";
$Ranks::MinPoints[10] = 9750;
$Ranks::NewRank[10] = "Captain";
$Ranks::MinPoints[11] = 11000;
$Ranks::NewRank[11] = "Major";
$Ranks::MinPoints[12] = 15500;
$Ranks::NewRank[12] = "Lieutenant Colonel";
$Ranks::MinPoints[13] = 18500;
$Ranks::NewRank[13] = "Colonel";
$Ranks::MinPoints[14] = 22500;
$Ranks::NewRank[14] = "Brigadier General";
$Ranks::MinPoints[15] = 30000;
$Ranks::NewRank[15] = "Major General";
$Ranks::MinPoints[16] = 50000;
$Ranks::NewRank[16] = "Lieutenant General";
$Ranks::MinPoints[17] = 75000;
$Ranks::NewRank[17] = "General";
$Ranks::MinPoints[18] = 90000;
$Ranks::NewRank[18] = "General Of The Army";
exec( "prefs/Ranks.cs" );
exec( "prefs/Squads.cs" );
$canRecalcTop5 = 1;
function updateRankScores(%shouldloop,%clearLS){
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
if($Rank::numplayers $= "")
$Rank::numplayers=0;
%cl = ClientGroup.getObject(%i);
%name = %cl.NameBase;
if(%cl.lastscore $= "")
%cl.lastscore = 0;
if(%cl.ranknum $= ""){
for(%k = 0; %k < $Rank::numplayers; %k++){
if(%name $= $Rank::Name[%k]){
%cl.ranknum = %k;
%k = $Rank::numplayers - 1;
}
else if(%k >= ($Rank::numplayers - 1)){
$Rank::Name[$Rank::numplayers] = %name;
$Rank::Rank[$Rank::numplayers] = "Private";
$Rank::Score[$Rank::numplayers] = 0;
$Rank::numplayers++;
}
}
if(%k == 0 && %k == $Rank::numplayers){
$Rank::Name[$Rank::numplayers] = %name;
$Rank::Rank[$Rank::numplayers] = "Private";
$Rank::Score[$Rank::numplayers] = 0;
$Rank::numplayers++;
}
}
if($Rank::Squad[%cl.ranknum] !$= ""){
%squad = getWord($Rank::Squad[%cl.ranknum],1);
$squad::Score[%squad] = $squad::Score[%squad] + (%cl.score - %cl.lastscore);
%mem = 0;
%num = getWord($Rank::squad[%cl.ranknum],1)@%mem;
while($squad::member[%num] !$= ""){
%player = $squad::member[%num];
for(%l = 0; %l < %count; %l++){
%clt = ClientGroup.getObject(%l);
if(%clt.ranknum == %player){
$Rank::Squadscore[%player] = $Rank::Squadscore[%player] + ((%cl.score - %cl.lastscore) / 2);
$Rank::Score[%player] = $Rank::Score[%player] + ((%cl.score - %cl.lastscore) / 2);
%l = %count;
}
}
%mem++;
%num = %squad@%mem;
}
}
$Rank::Score[%cl.ranknum] = $Rank::Score[%cl.ranknum] + (%cl.score - %cl.lastscore);
%stat = $Rank::Score[%cl.ranknum];
%cl.lastscore = %cl.score;
for(%j = 18; %j > 0; %j--){
if($Rank::Score[%cl.ranknum] >= $Ranks::MinPoints[%j]){
if($Rank::Rank[%cl.ranknum] !$= $Ranks::NewRank[%j]){
$Rank::Rank[%cl.ranknum] = $Ranks::NewRank[%j];
messageAll('msgClient',"\c3"@%name@" \c2has become a\c3 "@$Ranks::NewRank[%j]@" \c2with a score of\c3 "@$Rank::Score[%cl.ranknum]@"\c2!");
bottomPrint(%cl, "Congratulations "@%name@" you have been promoted to the rank of: "@$Ranks::NewRank[%j]@"!", 5, 2 );
}
%j = 1;
}
}
if(%clearLS == 1){
%cl.lastscore = 0;
%cl.Zkills = 0;
}
}
export( "$squad::*", "prefs/Squads.cs", false );
export( "$Rank::*", "prefs/Ranks.cs", false );
if(%shouldloop == 1)
$RankUpdate = schedule(60000,0,"updateRankScores",1);
}
function ccCheckStats(%client, %args){
if(%args $= ""){
if(%client.ranknum $= ""){
messageClient(%client, 'MsgClient', "\c2Please wait a minute for your stats to load");
return;
}
%name = %client.NameBase;
%Rank = $Rank::Rank[%client.ranknum];
%Stats = $Rank::Score[%client.ranknum];
for(%i = 18; %i >= 0; %i--){
if($Rank::Score[%client.ranknum] >= $Ranks::MinPoints[%i]){
%nextrank = $Ranks::NewRank[(%i + 1)];
%nextrankscore = $Ranks::MinPoints[(%i + 1)];
%i = 0;
}
}
messageClient(%client, 'MsgClient', "\c2Your current rank is a\c3 "@%Rank@" \c2and you have a total of\c3 "@%stats@" \c2points. Your next rank is a\c3 "@%nextrank@" \c2and you need\c3 "@(%nextrankscore - %stats)@" \c2points.");
}
else{
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.nameBase $= %args){
if(%cl.ranknum $= ""){
messageClient(%client, 'MsgClient', "\c2Please wait a minute for this persons stats to load");
return;
}
%Rank = $Rank::Rank[%cl.ranknum];
%Stats = $Rank::Score[%cl.ranknum];
messageClient(%client, 'MsgClient', "\c3"@%args@"\'s \c2rank is a\c3 "@%Rank@"\c2 and his total score is: \c3"@%stats@"\c2 points.");
%i = %count;
}
else if(%i == (%count - 1))
messageClient(%client, 'MsgClient', "\c3"@%args@" \c2is not a valid player.");
}
}
}
function FindTopRanks()
{
%noabove = 1000000;
for (%i = 1; %i <= 5; %i++)
{
for (%j = 0; %j < $Rank::numplayers; %j++)
{
if (($Rank::Score[%j] >= %highest || %highest $= "") && $Rank::Score[%j] < %noabove)
{
%highest = $Rank::Score[%j];
%player = %j;
}
}
$Rank::Top[%i] = $Rank::Name[%player];
$Rank::TopScore[%i] = %highest;
%noabove = %highest;
%highest = "";
}
}
function ccTop5(%client,%args)
{
if($canrecalcTop5 == 1)
{
FindTopRanks();
$canrecalcTop5 = 0;
schedule(30000, 0, "restorerecalc");
}
messageClient(%client, 'MsgClient', "\c2Top five players are:");
if ($Rank::numplayers > 5)
{
%num = 5;
} else if ($Rank::numplayers <= 5)
%num = $Rank::numplayers;
for(%i = 1; %i <= %num; %i++)
{
messageClient(%client, 'MsgClient', "\c2"@%i@". "@$Rank::Top[%i]@" - Score: "@$Rank::TopScore[%i]@"");
}
}
function restorerecalc(){
$canreclacTop5 = 1;
}
//--------------------------------------------------
//SQUADS
//--------------------------------------------------
function cccreatesquad(%sender, %args){
if(%sender.ranknum $= ""){
messageclient(%sender, 'MsgClient', '\c2Please wait a minute for your stats to load.');
return;
}
if($Rank::Score[%sender.ranknum] < $Rank::MinPoints[4]){
messageclient(%sender, 'MsgClient', '\c2You must have a Sergeant rank or higher to make a squad.');
return;
}
if(%args $= ""){
messageclient(%sender, 'MsgClient', '\c2Please specify the name of new squad.');
return;
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(getWord(%args,0) $= $squad::Name[%i]){
messageclient(%sender, 'MsgClient', '\c2This squad already exists.');
return;
}
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%sender.namebase $= $squad::Leader[%i]){
messageclient(%sender, 'MsgClient', '\c2You already have a squad, you may not create a new one.');
return;
}
if($squad::Leader[%i] $= "")
%replacable = %i;
}
if($squad::numsquads $= "")
$squad::numsquads = 0;
if(%replacable !$= ""){
$squad::Name[%replacable] = getWord(%args,0);
$squad::Leader[%replacable] = %sender.namebase;
$squad::Score[%replacable] = 0;
} else{
$squad::Name[$squad::numsquads] = getWord(%args,0);
$squad::Leader[$squad::numsquads] = %sender.namebase;
$squad::Score[$squad::numsquads] = 0;
$squad::numsquads++;
}
messageclient(%sender, 'MsgClient', "\c2Squad\c3 "@getWord(%args,0)@" \c2has been created.");
ccJoin(%sender,getWord(%args,0));
}
function ccJoin(%sender,%name){
if(%sender.ranknum $= ""){
messageclient(%sender, 'MsgClient', '\c2Please wait a minute for your stats to load.');
return;
}
if($Rank::Squad[%sender.ranknum] !$= ""){
messageClient(%client, 'MsgClient', "\c2You are already in a squad.");
return;
}
if(%name $= ""){
messageclient(%sender, 'MsgClient', '\c2You have not been invited to a squad yet.');
return;
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%name $= $squad::Name[%i]){
%mem = 0;
%num = %i@%mem;
while($squad::member[%num] !$= ""){
%mem++;
%num = %i@%mem;
}
$squad::member[%num] = %sender.ranknum;
$Rank::Squad[%sender.ranknum] = %name@" "@%i;
$Rank::SquadScore[%sender.ranknum] = 0;
messageclient(%sender, 'MsgClient', "\c2You are now a part of squad\c3 "@%name@"\c2.");
return;
}
}
messageclient(%sender, 'MsgClient', "\c2Squad\c3 "@%name@" \c2dosent exist.");
}
function ccLeaveSquad(%sender,%args){
if(%sender.ranknum $= ""){
messageclient(%sender, 'MsgClient', '\c2Please wait a minute for your stats to load.');
return;
}
if($Rank::Squad[%sender.ranknum] $= ""){
messageClient(%sender, 'MsgClient', "\c2You are not currently in a squad.");
return;
}
%squad = getWord($Rank::Squad[%sender.ranknum],1);
if($squad::Leader[%squad] $= %sender.namebase){
$squad::Leader[%squad] = "";
$squad::Name[%squad] = "";
$squad::Score[%squad] = "";
%mem = 1;
%num = %squad@%mem;
while($squad::member[%num] !$= ""){
$Rank::Squad[$squad::member[%num]] = "";
$Rank::SquadScore[$squad::member[%num]] = "";
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.ranknum == $squad::member[%num])
%i = %count;
}
messageClient(%cl, 'MsgClient', "\c2Your squad has disbanned.");
$squad::member[%num] = "";
%mem++;
%num = %squad@%mem;
}
$Rank::Squad[%sender.ranknum] = "";
$Rank::SquadScore[%sender.ranknum] = "";
$squad::member[%squad@"0"] = "";
messageClient(%sender, 'MsgClient', "\c2You have disbanned your squad.");
} else {
%mem = 0;
%num = %squad@%mem;
while($squad::member[%num] !$= ""){
if(%sender.ranknum == $squad::member[%num])
%plrnum = %num;
%mem++;
%num = %squad@%mem;
}
%last = %squad@(%mem - 1);
$Rank::Squad[%sender.ranknum] = "";
$Rank::SquadScore[%sender.ranknum] = "";
if(%plrnum != %last){
$squad::member[%plrnum] = $squad::member[%last];
$squad::member[%last] = "";
}
messageClient(%sender, 'MsgClient', "\c2You have left the Squad.");
}
}
function ccInvite(%sender, %args){
if(%args $= ""){
messageclient(%sender, 'MsgClient', '\c2You must specify a player.');
return;
}
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.nameBase $= %args)
%i = %count;
else if(%i == (%count - 1)){
messageClient(%sender, 'MsgClient', "\c3"@%args@" \c2is not a valid player.");
return;
}
}
if($Rank::Squad[%cl.ranknum] !$= ""){
messageClient(%sender, 'MsgClient', "\c3"@%args@" \c2is already in a squad.");
return;
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%sender.namebase $= $squad::Leader[%i]){
%cl.sqinv = $squad::Name[%i];
messageclient(%sender, 'MsgClient', "\c3"@%args@" \c2as been invited to your squad.");
messageclient(%cl, 'MsgClient', "\c2You have been invited to squad\c3 "@$squad::Name[%i]@" \c2to join, type:\c3 /Join\c2.");
return;
}
}
messageclient(%sender, 'MsgClient', "\c2You are not a squad leader and cannot invite.");
}
function ccS(%sender, %args){
if($squad::Name[getWord($Rank::Squad[%sender.ranknum],1)] $= ""){
messageclient(%sender, 'MsgClient', "\c2You are not in a squad.");
return;
}
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
%mem = 0;
%num = getWord($Rank::Squad[%sender.ranknum],1)@%mem;
while($squad::member[%num] !$= ""){
if(%cl.ranknum == $squad::member[%num] && %cl.team == %sender.team)
messageclient(%cl, 'MsgClient', "\c0[Squad Chat] \c2"@%sender.namebase@": \c3"@%args);
%mem++;
%num = getWord($Rank::Squad[%sender.ranknum],1)@%mem;
}
}
}
function ccListSquads(%client, %args){
for(%i = 0; %i < $Squad::numsquads; %i++){
messageClient(%client, 'MsgClient', "\c2SQUAD "@(%i + 1)@": \c3"@$squad::Name[%i]@" \c2SCORE: \c3"@$squad::score[%i]@"");
%temp = 0;
%num = %i@%temp;
while($squad::member[%num] !$= ""){
if(%temp == 0)
%prefix = "Leader:";
else
%prefix = "member"@(%temp + 1)@":";
messageClient(%client, 'MsgClient', "\c2"@%prefix@" \c3"@$rank::Name[$squad::member[%num]]@" \c2teamscore: \c3"@$rank::squadscore[$squad::member[%num]]@"");
%temp++;
%num = %i@%temp;
}
if((%i + 1) < $squad::numsquads)
messageClient(%client, 'MsgClient', "\c2 ");
}
}
function ccRequestInvite(%client, %args){
if(%client.ranknum $= ""){
messageClient(%client, 'MsgClient', "\c2Please wait a minute for your stats to load");
return;
}
if($rank::squad[%client.ranknum] !$= ""){
messageClient(%client, 'MsgClient', "\c2You are already in a squad.");
return;
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%args $= $squad::Name[%i]){
messageclient(%sender, 'MsgClient', "\c2Request was sent to squa\c3 "@%args@"\c2.");
for(%j = 0; %j < %count; %j++){
%cl = ClientGroup.getObject(%j);
if(%cl.namebase $= $squad::Leader[%i])
messageclient(%cl, 'MsgClient', "\c3"@%client.namebase@"\c2 has requested to join your squad.");
}
return;
}
}
messageclient(%sender, 'MsgClient', "\c2Squad\c3 "@%args@" \c2dosent exist.");
}
//--------------------------------------------------
//COMMANDS
//--------------------------------------------------
function ccO(%sender,%args){
if(%sender.ranknum $= ""){
messageclient(%sender, 'MsgClient', '\c2Please wait a minute for your stats to load.');
return;
}
if($Rank::Score[%sender.ranknum] < $Ranks::MinPoints[12]){
messageclient(%sender, 'MsgClient', '\c2You must have a General or Commander rank to give orders.');
return;
}
if(%args $= "" || getWord(%args,1) $= ""){
messageclient(%sender, 'MsgClient', '\c2You must specify the order and then the target squad.');
return;
}
if(getWord(%args,0) !$= "attack" && getWord(%args,0) !$= "defend"){
messageclient(%sender, 'MsgClient', '\c2Order must be either "attack" or "defend".');
return;
}
%order = getWord(%args,0);
%name = getWord(%args,1);
for(%i = 0; %i < $squad::numsquads; %i++){
if(%name $= $squad::Name[%i]){
%check = 1;
%j = %i;
}
}
if(%check != 1){
messageclient(%sender, 'MsgClient', "\c2Squad\c3 "@%name@" \c2dosent exist.");
return;
}
%obj = %sender.getControlObject();
%eyeTrans = %obj.getEyeTransform();
%eyePos = posFromTransform(%eyeTrans);
%eyeVec = vectorScale(%obj.getEyeVector(),1000);
%searchResult = containerRayCast(%eyePos, vectorAdd(%eyeVec,%eyePos), $TypeMasks::TerrainObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType, %obj);
if(%searchResult){
%mem = 0;
%num = %j@%mem;
while($squad::member[%num] !$= ""){
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.ranknum == $squad::member[%num] && %cl.team == %sender.team)
messageclient(%cl, 'MsgClient', "\c2A general has ordered your squad to\c3 "@%order@" \c2this location.");
}
%mem++;
%num = %j@%mem;
}
%pos = posFromRaycast(%searchResult);
%wa=new Waypoint() {
position = %pos;
rotation = "1 0 0 0";
dataBlock = "WayPointMarker";
team = %sender.team;
name = %name@" "@%order@" this position";
};
MissionCleanup.add(%wa);
%nveh = 0;
%nplr = 0;
%nTrt = 0;
%ndep = 0;
InitContainerRadiusSearch(%pos, 100, $TypeMasks::PlayerObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType | $TypeMasks::VehicleObjectType);
while ((%targetObject = containerSearchNext()) != 0){
%target = getWord(%targetObject,0);
if(%order $= "attack" && %target.team != %sender.team){
if(%target.getType() & $TypeMasks::PlayerObjectType)
%nplr++;
if(%target.getType() & $TypeMasks::StaticShapeObjectType){
%Ttype = %target.getDataBlock().className ;
if(!(%Ttype $= "wall" || %Ttype $= "wWall" || %Ttype $= "spine" || %Ttype $= "mSpine" || %Ttype $= "floor" || %Ttype$= "forcefield"))
%ndep++;
}
if(%target.getType() & $TypeMasks::TurretObjectType)
%ntrt++;
if(%target.getType() & $TypeMasks::VehicleObjectType)
%nveh++;
}
else if(%order $= "defend" && %target.team == %sender.team){
if(%target.getType() & $TypeMasks::PlayerObjectType)
%nplr++;
if(%target.getType() & $TypeMasks::StaticShapeObjectType){
%Ttype = %target.getDataBlock().className ;
if(!(%Ttype $= "wall" || %Ttype $= "wWall" || %Ttype $= "spine" || %Ttype $= "mSpine" || %Ttype $= "floor" || %Ttype$= "forcefield"))
%ndep++;
}
if(%target.getType() & $TypeMasks::TurretObjectType)
%ntrt++;
if(%target.getType() & $TypeMasks::VehicleObjectType)
%nveh++;
}
}
%numtrg = %ntrt@" "@%nplr@" "@%nveh@" "@%ndep;
%numtrgs = %ntrt + %nplr + %nveh + %ndep;
if(%numtrgs >= 3){
schedule(%numtrgs * 20000, 0, "completeCommand", %order, %name, %numtrg, %pos, %sender);
schedule(10000, 0, "commandCheckupLoop", %name, %pos, %sender, (%numtrgs * 2) - 1);
%wa.schedule(%numtrgs * 20000, "delete");
}
else{
messageclient(%sender, 'MsgClient', "\c2Please specify a location with more targets.");
%wa.schedule(100, "delete");
}
}
else
messageclient(%sender, 'MsgClient', "\c2Please specify a valid target position.");
}
function commandCheckupLoop(%name, %pos, %issuer, %LCount){
if(%LCount < 1)
return;
for(%i = 0; %i < $squad::numsquads; %i++){
if(%name $= $squad::Name[%i]){
%j = %i;
}
}
%mem = 0;
%num = %j@%mem;
while($squad::member[%num] !$= ""){
%count = ClientGroup.getCount();
%player = $squad::member[%num];
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.ranknum == %player && %cl.team == %issuer.team){
%clpos = %cl.player.getPosition();
if(vectorDist(%clpos,%pos) <= 100){
bottomPrint(%cl, "\c2"@(%LCount * 10)@" seconds remain until objective is complete.", 5);
if(%cl.objectivecount $= "")
%cl.objectivecount = 0;
%cl.objectivecount++;
}
else
bottomPrint(%cl, "\c2You are to far away from the objective zone, you have "@(%LCount * 10)@" seconds left.", 5);
}
}
%mem++;
%num = %j@%mem;
}
%LCount--;
schedule(10000, 0, "commandCheckupLoop", %name, %pos, %issuer, %LCount);
}
function completeCommand(%order, %name, %numtrg, %pos, %issuer){
%oTrt = getWord(%numtrg,0);
%oplr = getWord(%numtrg,1);
%oveh = getWord(%numtrg,2);
%odep = getWord(%numtrg,3);
%nTrt = 0;
%nplr = 0;
%nveh = 0;
%ndep = 0;
InitContainerRadiusSearch(%pos, 100, $TypeMasks::PlayerObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType | $TypeMasks::VehicleObjectType);
while ((%targetObject = containerSearchNext()) != 0){
%target = getWord(%targetObject,0);
if(%order $= "attack" && %target.team != %issuer.team){
if(%target.getType() & $TypeMasks::PlayerObjectType)
%nplr++;
if(%target.getType() & $TypeMasks::StaticShapeObjectType){
%Ttype = %target.getDataBlock().className ;
if(!(%Ttype $= "wall" || %Ttype $= "wWall" || %Ttype $= "spine" || %Ttype $= "mSpine" || %Ttype $= "floor" || %Ttype$= "forcefield"))
%ndep++;
}
if(%target.getType() & $TypeMasks::TurretObjectType)
%ntrt++;
if(%target.getType() & $TypeMasks::VehicleObjectType)
%nveh++;
}
else if(%order $= "defend" && %target.team == %issuer.team){
if(%target.getType() & $TypeMasks::PlayerObjectType)
%nplr++;
if(%target.getType() & $TypeMasks::StaticShapeObjectType){
%Ttype = %target.getDataBlock().className ;
if(!(%Ttype $= "wall" || %Ttype $= "wWall" || %Ttype $= "spine" || %Ttype $= "mSpine" || %Ttype $= "floor" || %Ttype$= "forcefield"))
%ndep++;
}
if(%target.getType() & $TypeMasks::TurretObjectType)
%ntrt++;
if(%target.getType() & $TypeMasks::VehicleObjectType)
%nveh++;
}
}
%numtrg = %ntrt@" "@%nplr@" "@%nveh@" "@%ndep;
%numtrgs = %otrt + %oplr + %oveh + %odep;
%points = ((%otrt - %ntrt) * 4) +
((%oplr - %nplr) * 3) +
((%oveh - %nveh) * 2) +
((%odep - %ndep) * 2);
if(%order $= "defend"){
%startpoints = (%otrt * 8) + (%oplr * 6) + (%oveh * 4) + (%odep * 4);
%points = %startpoints - %points;
%percentRemaining = ((%ntrt + %nplr + %nveh + %ndep) / (%otrt + %oplr + %oveh + %odep)) * 100;
if(%percentRemaining >= 75){
%status = "success";
%points = %points + (15 * (%percentRemaining / 100) * %numtrgs);
%recomend = "keep up the good work!";
}
else{
%status = "failure";
%points = %points - (7.5 * ((100 - %percentRemaining) / 100) * %numtrgs);
%recomend = "try harder next time.";
}
}
else{
%percentRemaining = ((%ntrt + %nplr + %nveh + %ndep) / (%otrt + %oplr + %oveh + %odep)) * 100;
if(%percentRemaining <= 50){
%status = "success";
%points = %points + (20 * ((100 - %percentRemaining) / 100) * %numtrgs);
%recomend = "keep up the good work!";
}
else{
%status = "failure";
%points = %points - (10 * (%percentRemaining / 100) * %numtrgs);
%recomend = "try harder next time.";
}
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%name $= $squad::Name[%i]){
%j = %i;
}
}
%mem = 0;
%num = %j@%mem;
while($squad::member[%num] !$= ""){
%count = ClientGroup.getCount();
%player = $squad::member[%num];
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.ranknum == %player && %cl.team == %issuer.team){
%clpos = %cl.player.getPosition();
if((vectorDist(%clpos,%pos) <= 50 && %order $= "attack") || %cl.objectivecount >= (%numtrgs - 1) * 1.5){
messageclient(%cl, 'MsgClient', "\c2Your Objective was deemed a "@%status@" and you were given "@%points@" for this objective. You should "@%recomend);
$Rank::Squadscore[%player] = $Rank::Squadscore[%player] + %points;
$Rank::Score[%player] = $Rank::Score[%player] + %points;
}
else{
messageclient(%cl, 'MsgClient', "\c2You were to far away from the objective marker. "@(3 * %numtrgs)@" points were deducted from your score.");
$Rank::Squadscore[%player] = $Rank::Squadscore[%player] - (4 * %numtrgs);
$Rank::Score[%player] = $Rank::Score[%player] - (3 * %numtrgs);
}
%cl.objectivecount = 0;
}
}
%mem++;
%num = %j@%mem;
}
}
//--------------------------------------
//Force Capabilitys
//--------------------------------------
function ccforce(%sender, %args){
if(%sender.ranknum $= ""){
messageclient(%sender, 'MsgClient', '\c2Please wait a minute for your stats to load.');
return;
}
if($Rank::Score[%sender.ranknum] < $Ranks::MinPoints[8]){
messageclient(%sender, 'MsgClient', '\c2You are not high enough rank to force players.');
return;
}
if(%args $= ""){
messageclient(%sender, 'MsgClient', '\c2You must specify what you are forcing, "join" or "leave".');
return;
}
%cmd = getWord(%args, 0);
if(%cmd $= "join"){
%squad = getWord(%args, 1);
%target = getWords(%args, 2, 1 + getNumberOfWords(%args));
if(%squad $= "" || %target $= ""){
messageclient(%sender, 'MsgClient', '\c2You must specify the squad name and then player name for this to work.');
return;
}
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.namebase $= %target)
%i = %count;
else if(%i == (%count - 1)){
messageClient(%sender, 'MsgClient', "\c2"@%target@" is not a valid player.");
return;
}
}
if($Rank::Score[%cl.ranknum] >= $Ranks::MinPoints[8] && !($Rank::Score[%cl.ranknum] < $Ranks::MinPoints[14] && $Rank::Score[%sender.ranknum] >= $Ranks::MinPoints[14])){
messageclient(%sender, 'MsgClient', '\c2You may not force this player, he has too high of a rank.');
return;
}
for(%i = 0; %i < $squad::numsquads; %i++){
if(%squad $= $squad::Name[%i]){
if($Rank::Squad[%cl.ranknum] !$= ""){
messageclient(%cl, 'MsgClient', '\c2Higher Rank forced:');
ccLeaveSquad(%cl,"");
messageclient(%cl, 'MsgClient', '\c2 ');
}
messageclient(%sender, 'MsgClient', "\c3"@%target@" \c2has joined squad\c3 "@%squad@"\c2.");
messageclient(%cl, 'MsgClient', '\c2Higher Rank forced:');
ccJoin(%cl, %squad);
return;
}
if($squad::Leader[%i] $= "")
%replacable = %i;
}
if($squad::numsquads $= "")
$squad::numsquads = 0;
if(%replacable !$= ""){
$squad::Name[%replacable] = %squad;
$squad::Leader[%replacable] = %cl.namebase;
$squad::Score[%replacable] = 0;
} else{
$squad::Name[$squad::numsquads] = %squad;
$squad::Leader[$squad::numsquads] = %cl.namebase;
$squad::Score[$squad::numsquads] = 0;
$squad::numsquads++;
}
messageclient(%sender, 'MsgClient', "\c2Squad\c3 "@%squad@" \c2has been created with\c3 "@%target@" \c2as leader.");
if($Rank::Squad[%cl.ranknum] !$= ""){
messageclient(%cl, 'MsgClient', '\c2Higher Rank forced:');
ccLeaveSquad(%cl,"");
messageclient(%cl, 'MsgClient', '\c2 ');
}
messageclient(%cl, 'MsgClient', '\c2Higher Rank forced:');
ccJoin(%cl, %squad);
}
else if(%cmd $= "leave"){
%target = getWords(%args, 1, getNumberOfWords(%args) - 1);
echo(getNumberOfWords(%args));
echo(%target);
if(%target $= ""){
messageclient(%sender, 'MsgClient', '\c2You must specify the person you are forcing.');
return;
}
%count = ClientGroup.getCount();
for(%i = 0; %i < %count; %i++){
%cl = ClientGroup.getObject(%i);
if(%cl.namebase $= %target)
%i = %count;
else if(%i == (%count - 1)){
messageClient(%client, 'MsgClient', "\c3"@%target@" \c2is not a valid player.");
return;
}
}
if($Rank::Score[%cl.ranknum] >= $Ranks::MinPoints[8] && !($Rank::Score[%cl.ranknum] < $Ranks::MinPoints[14] && $Rank::Score[%sender.ranknum] >= $Ranks::MinPoints[14])){
messageclient(%sender, 'MsgClient', '\c2You may not force this player, he has too high of a rank.');
return;
}
if($Rank::Squad[%cl.ranknum] !$= ""){
messageclient(%cl, 'MsgClient', '\c2Higher Rank forced:');
ccLeaveSquad(%cl,"");
messageclient(%sender, 'MsgClient', '\c3'@%target@' \c2has been forced out of his squad.');
}
else
messageclient(%sender, 'MsgClient', '\c2This person does not have a squad to leave.');
}
else
messageclient(%sender, 'MsgClient', '\c2Please use "Join" or "leave" as command.');
}
//--------------------------------------
//Misc
//--------------------------------------
function cleanRanks(){
for(%i = 0; %i < $Rank::numplayers; %i++){
if($Rank::Score[%i] <= 10){
$Rank::Score[%i] = "";
$Rank::Name[%i] = "";
$Rank::Rank[%i] = "";
}
}
for(%i = 0; %i < $Rank::numplayers; %i++){
if($Rank::Score[%i] $= ""){
%replacenum = $Rank::numplayers;
while($Rank::Score[%replacenum] $= ""){
%replacenum--;
}
if(%i > %replacenum){
$Rank::numplayers = %i;
return;
}
$Rank::Score[%i] = $Rank::Score[%replacenum];
$Rank::Name[%i] = $Rank::Name[%replacenum];
$Rank::Rank[%i] = $Rank::Rank[%replacenum];
$Rank::Score[%replacenum] = "";
$Rank::Name[%replacenum] = "";
$Rank::Rank[%replacenum] = "";
}
}
}
function ccSOL(%sender, %args){
if(%sender.spawnOnLead $= "" || %sender.spawnOnLead == 0){
%sender.spawnOnLead = 1;
messageclient(%sender, 'MsgClient', '\c2You will now spawn on your squad leader.');
} else {
%sender.spawnOnLead = 0;
messageclient(%sender, 'MsgClient', '\c2You will no longer spawn on your squad leader.');
}
}
function getNumberOfWords(%path){
%number = 0;
for(%i = 0; %i < 1000; %i++){
if(getWord(%path,%i) !$= "")
%number++;
else
return %number;
}
}

View file

@ -0,0 +1,77 @@
$NightVisionValue = 0.2;
function NightVisionLoop(%client){
if(!isObject(%client.player))
return;
%client.player.setWhiteOut($NightVisionValue);
%client.player.nightvision = schedule(50, 0, "NightVisionLoop", %client);
}
function serverCmdDoGrab(%client){
%obj = %client.player;
if(!isObject(%obj))
return;
if(%obj.grabbing != 1){
%pos = %obj.getMuzzlePoint($WeaponSlot);
%vec = %obj.getMuzzleVector($WeaponSlot);
%targetpos = vectoradd(%pos,vectorscale(%vec,5));
%Tobj = containerraycast(%pos, %targetpos, $typemasks::PlayerObjectType | $typemasks::CorpseObjectType, %obj);
%Tobj = getword(%Tobj,0);
if(%Tobj.client.team == %client.team && !$TeamDamage)
return; // Can't pickup teammates now.
if(isObject(%Tobj)){
if(vectorDist(%obj.getForwardVector(),%Tobj.getForwardVector()) > 1.6)
return;
%armortype = %obj.getdatablock().getname();
if(!(%armortype $= "SpecOpsMaleHumanArmor" || %armortype $= "SpecOpsFemaleHumanArmor" || %armortype $= "SpecOpsMaleBiodermArmor"))
return;
if(%Tobj.grabbing == 1)
%Tobj.grabbing = 0;
if(%Tobj.grabbed == 1)
return;
%dataBlock = %Tobj.getDataBlock();
%mass = %dataBlock.mass;
if(%mass >= 150){
return;
}
%Tobj.grabbed = 1;
%Tobj.setMoveState(true);
%obj.grabbing = 1;
schedule(100, 0, "GrabLoop", %obj, %Tobj);
}
}
else
%obj.grabbing = 0;
}
function GrabLoop(%obj, %Tobj){
if(!(isObject(%obj) && isObject(%Tobj)))
return;
if(%obj.getstate() $= "dead"){
%Tobj.setMoveState(false);
%Tobj.grabbed = 0;
return;
}
if(%obj.grabbing != 1){
%Tobj.setMoveState(false);
%Tobj.grabbed = 1;
if(%Tobj.getState() !$= "Dead")
%Tobj.getDataBlock().damageObject(%Tobj, %obj, %Tobj.getPosition(), 10, $DamageType::blah, "0 0 1", %obj.getControllingClient(), %obj);
return;
}
if(%Tobj.getMountedImage($weaponslot) !$= "")
%Tobj.throwWeapon();
if(%Tobj.getMountedImage($Backpackslot) !$= "")
%Tobj.throwPack();
if(%obj.getMountedImage($weaponslot) !$= "")
%obj.unmountImage($weaponslot);
%pos = %obj.getPosition();
%rot = %obj.getRotation();
%vel = vectoradd(%obj.getvelocity(), "0 0 1");
%vec = vectorScale(%obj.getForwardVector(),3);
%vec = vectorAdd(%vec, "0 0 0.5");
%Tobj.setTransform(vectorAdd(%pos, %vec)@" "@%rot);
%Tobj.setvelocity(%vel);
schedule(100, 0, "GrabLoop", %obj, %Tobj);
}

31
Scripts/TR2Game.cs Normal file
View file

@ -0,0 +1,31 @@
// Bastardized for Contruction Mod to load the player datablocks
// without screwing up the rest of the game.
// DisplayName = Team Rabbit 2
//--- GAME RULES BEGIN ---
//Get the flag and throw it into the other team's goal
//You can only hold onto the flag for 15 seconds
//Passing the flag increases the size of the Jackpot
//Scoring a goal awards the Jackpot to your team!
//When your health reaches zero, you are knocked down
//Replenish your ammo by pressing your suicide button
//--- GAME RULES END ---
// Team Rabbit 2
// Created by Codality, Inc.
// www.codality.com
// -------------------------------
// Michael "KineticPoet" Johnston - Designer, Lead Programmer, Maps
// Dan "daunt" Kolta - Physics design, Maps
// Scott "FSB-AO" Estabrook - Programmer
// John "CObbler" Carter - Bonus sound effects
// Buddy "sLaM" Pritchard - Sound effects
// Gregg "illy" Fellows - 3D models and skins
// Alan "Nefilim" Schwertel; - Maps
// Kenneth "SONOFMAN" Cook - Sky art
exec("scripts/TR2Physics.cs");

43
Scripts/TR2medium_male.cs Normal file
View file

@ -0,0 +1,43 @@
datablock TSShapeConstructor(TR2MediumMaleDts)
{
baseShape = "TR2medium_male.dts";
sequence0 = "TR2medium_male_root.dsq root";
sequence1 = "TR2medium_male_forward.dsq run";
sequence2 = "TR2medium_male_back.dsq back";
sequence3 = "TR2medium_male_side.dsq side";
sequence4 = "medium_male_lookde.dsq look";
sequence5 = "medium_male_head.dsq head";
sequence6 = "TR2medium_male_fall.dsq fall";
sequence7 = "TR2medium_male_jet.dsq jet";
sequence8 = "TR2medium_male_land.dsq land";
sequence9 = "TR2medium_male_jump.dsq jump";
sequence10 = "medium_male_recoilde.dsq light_recoil";
sequence11 = "medium_male_headside.dsq headside";
sequence12 = "medium_male_looksn.dsq looksn";
sequence13 = "medium_male_lookms.dsq lookms";
sequence14 = "TR2medium_male_sitting.dsq sitting";
sequence15 = "TR2medium_male_diehead.dsq death1";
sequence16 = "TR2medium_male_diechest.dsq death2";
sequence17 = "TR2medium_male_dieback.dsq death3";
sequence18 = "TR2medium_male_diesidelf.dsq death4";
sequence19 = "TR2medium_male_diesidert.dsq death5";
sequence20 = "TR2medium_male_dieleglf.dsq death6";
sequence21 = "TR2medium_male_diechest.dsq death7"; // medium_male_dielegrt
sequence22 = "TR2medium_male_dieback.dsq death8";
sequence23 = "TR2medium_male_dieknees.dsq death9";
sequence24 = "TR2medium_male_dieforward.dsq death10";
sequence25 = "TR2medium_male_diespin.dsq death11";
sequence26 = "medium_male_idlepda.dsq pda";
sequence27 = "TR2medium_male_celsalute.dsq cel1";
sequence28 = "TR2medium_male_celwave.dsq cel2";
sequence29 = "TR2medium_male_tauntbest.dsq cel3";
sequence30 = "TR2medium_male_tauntimp.dsq cel4";
sequence31 = "TR2medium_male_celdance.dsq cel5";
sequence32 = "TR2medium_male_celflex.dsq cel6";
sequence33 = "TR2medium_male_celtaunt.dsq cel7";
sequence34 = "TR2medium_male_celrocky.dsq cel8";
sequence35 = "TR2medium_male_ski.dsq ski";
sequence36 = "TR2medium_male_standjump.dsq standjump";
sequence37 = "medium_male_looknw.dsq looknw";
};

View file

@ -0,0 +1,308 @@
//--------------------------------------------------------------------------
// Artillery Turret
//--------------------------------------------------------------------------
datablock ShockwaveData(artilleryShockwave)
{
width = 6.0;
numSegments = 32;
numVertSegments = 6;
velocity = 50;
acceleration = 20.0;
lifetimeMS = 500;
height = 3.0;
verticalCurve = 0.5;
is2D = false;
texture[0] = "special/shockwave4";
texture[1] = "special/gradient";
texWrap = 6.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "0.6 1.0 0.2 0.50";
colors[1] = "0.56 0.36 0.26 1.0";
colors[2] = "0.56 0.36 0.26 0.0";
mapToTerrain = true;
orientToNormal = false;
renderBottom = false;
};
datablock ParticleData(artilleryExplosionSmoke)
{
dragCoeffiecient = 6.0;
gravityCoefficient = 0.25; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 3000;
lifetimeVarianceMS = 200;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -100.0;
spinRandomMax = 100.0;
textureName = "special/Smoke/bigSmoke";
colors[0] = "0.2 0.2 0.2 0.6";
colors[1] = "0.25 0.25 0.25 0.4";
colors[2] = "0.4 0.4 0.4 0.0";
sizes[0] = 5.0;
sizes[1] = 8.0;
sizes[2] = 15.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleData(artilleryFallerSmoke)
{
dragCoeffiecient = 0.7;
gravityCoefficient = 2.0; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 6000;
lifetimeVarianceMS = 750;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -100.0;
spinRandomMax = 100.0;
textureName = "special/Smoke/bigSmoke";
colors[0] = "1.0 0.8 0.1 0.6";
colors[1] = "0.3 0.3 0.3 0.6";
colors[2] = "0.3 0.3 0.3 0.6";
colors[3] = "0.35 0.35 0.35 0.3";
colors[4] = "0.4 0.4 0.4 0.0";
sizes[0] = 3.0;
sizes[1] = 6.0;
sizes[2] = 7.0;
sizes[3] = 10.0;
sizes[4] = 15.0;
times[0] = 0.0;
times[1] = 0.1;
times[2] = 0.25;
times[3] = 0.5;
times[4] = 0.75;
};
datablock ParticleEmitterData(artilleryExplosionSmokeEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 0.0;
ejectionVelocity = 15.0;
velocityVariance = 10.0;
thetaMin = 89.0;
thetaMax = 90.0;
lifetimeMS = 500;
particles = "artilleryExplosionSmoke";
};
datablock ParticleEmitterData(artilleryExplosionSmokeEmitter2)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 0.0;
ejectionVelocity = 15.0;
velocityVariance = 15.0;
thetaMin = 0.0;
thetaMax = 10.0;
lifetimeMS = 350;
particles = "artilleryFallerSmoke";
};
datablock ParticleEmitterData(artilleryExplosionSmokeEmitter3)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionOffset = 12.0;
ejectionVelocity = 20.0;
velocityVariance = 5.0;
thetaMin = 0.0;
thetaMax = 25.0;
lifetimeMS = 350;
particles = "artilleryFallerSmoke";
};
datablock ExplosionData(artillerysubExplosion1)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
delayMS = 0;
offset = 0.0;
playSpeed = 0.6;
sizes[0] = "10.0 10.0 10.0";
sizes[1] = "15.0 15.0 15.0";
times[0] = 0.0;
times[1] = 1.0;
};
datablock ExplosionData(artillerybarrelExplosion)
{
soundProfile = MortarExplosionSound;
shockwave = artilleryShockwave;
shockwaveOnTerrain = true;
subExplosion[0] = artillerysubExplosion1;
emitter[0] = artilleryExplosionSmokeEmitter;
emitter[1] = artilleryExplosionSmokeEmitter2;
emitter[2] = artilleryExplosionSmokeEmitter3;
shakeCamera = true;
camShakeFreq = "8.0 9.0 7.0";
camShakeAmp = "100.0 100.0 100.0";
camShakeDuration = 1.3;
camShakeRadius = 40.0;
};
datablock GrenadeProjectileData(artillerybarrelshot)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 4.25;
damageRadius = 25.0;
radiusDamageType = $DamageType::Artillery;
kickBackStrength = 3000;
explosion = "artillerybarrelexplosion";
velInheritFactor = 0.0;
splash = GrenadeSplash;
baseEmitter = GrenadeSmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.25;
grenadeFriction = 0.3;
armingDelayMS = 500;
gravityMod = 0.8;
muzzleVelocity = 65.0;
drag = 0.1;
sound = MortarTurretProjectileSound;
hasLight = true;
lightRadius = 3;
lightColor = "0.05 0.2 0.05";
};
//--------------------------------------------------------------------------
// artillery explosion
//--------------------------------------------------------------------------
datablock TurretImageData(ArtilleryBarrelLarge)
{
shapeFile = "turret_tank_barrelmortar.dts";
item = artilleryBarrelLargePack;
projectile = artillerybarrelshot;
projectileType = GrenadeProjectile;
usesEnergy = true;
fireEnergy = 1;
minEnergy = 1;
emap = true;
// Eolk - There should be no spread.
muzzleFlash = ChaingunTurretMuzzleFlash;
// Turret parameters
activationMS = 300;
deactivateDelayMS = 600;
thinkTimeMS = 200;
degPerSecTheta = 580;
degPerSecPhi = 960;
attackRadius = 370;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = PBLSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
// fire off about 2 quick shots
stateName[3] = "Fire";
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = AssaultMortarFireSound;
stateScript[3] = "onFire";
stateTimeoutValue[3] = 3.0; //0.3
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Ready";
// stateTransitionOnTriggerUp[3] = "Reload";
stateTransitionOnNoAmmo[3] = "NoAmmo";
stateName[8] = "Reload";
stateTimeoutValue[7] = 5.0;
stateAllowImageChange[8] = false;
stateSequence[8] = "Reload";
stateTransitionOnTimeout[8] = "Ready";
stateTransitionOnNotLoaded[8] = "Deactivate";
stateTransitionOnNoAmmo[8] = "NoAmmo";
stateName[9] = "Deactivate";
stateSequence[9] = "Activate";
stateDirection[9] = false;
stateTimeoutValue[9] = 1;
stateTransitionOnLoaded[9] = "ActivateReady";
stateTransitionOnTimeout[9] = "Dead";
stateName[10] = "Dead";
stateTransitionOnLoaded[10] = "ActivateReady";
stateName[11] = "NoAmmo";
stateTransitionOnAmmo[11] = "Reload";
stateSequence[11] = "NoAmmo";
};

View file

@ -0,0 +1,163 @@
//--------------------------------------------------------------------------
// Gauss Cannon Turret
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Sounds
//--------------------------------------------------------------------------
datablock EffectProfile(EBLSwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(EBLSwitchSound)
{
filename = "fx/powered/turret_heavy_activate.wav";
description = AudioClose3d;
preload = true;
effect = EBLSwitchEffect;
};
datablock EffectProfile(FlameTurretFireEffect)
{
effectname = "Bonuses/Nouns/snake";
minDistance = 2.5;
maxDistance = 8.0;
};
datablock AudioProfile(FlameTurretFireSound)
{
filename = "fx/Bonuses/Nouns/snake.wav";
description = AudioClose3d;
preload = true;
effect = FlameTurretFireEffect;
};
datablock LinearFlareProjectileData(FlameTurretBolt)
{
projectileShapeName = "turret_muzzlepoint.dts";
scale = "1.0 1.0 1.0";
faceViewer = true;
directDamage = 0.08;
hasDamageRadius = true;
indirectDamage = 0.1;
damageRadius = 4.0;
kickBackStrength = 0.0;
radiusDamageType = $DamageType::Plasma;
explosion = "flameBoltExplosion";
splash = PlasmaSplash;
baseEmitter = FlameEmitter;
dryVelocity = 80.0; // z0dd - ZOD, 7/20/02. Faster plasma projectile. was 55
wetVelocity = -1;
velInheritFactor = 2.0;
fizzleTimeMS = 250;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = true;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = -1;
//activateDelayMS = 100;
activateDelayMS = -1;
size[0] = 0.2;
size[1] = 0.5;
size[2] = 0.1;
numFlares = 35;
flareColor = "1 0.18 0.03";
flareModTexture = "flaremod";
flareBaseTexture = "flarebase";
sound = PlasmaProjectileSound;
fireSound = PlasmaFireSound;
wetFireSound = PlasmaFireWetSound;
hasLight = true;
lightRadius = 10.0;
lightColor = "0.94 0.03 0.12";
};
datablock TurretImageData(ELFBarrelLarge)
{
shapeFile = "turret_elf_large.dts";
item = ELFBarrelPack;
projectile = FlameTurretBolt;
projectileType = LinearFlareProjectile;
usesEnergy = true;
fireEnergy = 0.01;
minEnergy = 0.01;
emap = true;
minRankPoints = 1800;
projectileSpread = 0.5 / 1000.0;
// Turret parameters
activationMS = 700;
deactivateDelayMS = 1500;
thinkTimeMS = 120;
degPerSecTheta = 300;
degPerSecPhi = 500;
attackRadius = 80;
// State transiltions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = EBLSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.05;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateScript[3] = "onFire";
stateSound[3] = FlameTurretFireSound;
stateName[4] = "Reload";
stateTimeoutValue[4] = 0.05;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateSound[4] = PlasmaReloadSound;
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};

View file

@ -0,0 +1,457 @@
//--------------------------------------
// Flak Turret - Created by Dondelium_X, Greatly Modified by Blnukem
//--------------------------------------
//--------------------------------------------------------------------------
// Sounds and feedback effects
//--------------------------------------
datablock EffectProfile(AASwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(AAFireEffect)
{
effectname = "weapons/chaingun_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(AASwitchSound)
{
filename = "fx/powered/turret_aa_activate.wav";
description = AudioClose3d;
preload = true;
effect = AASwitchEffect;
};
datablock AudioProfile(AAFireSound)
{
filename = "fx/weapons/plasma_rifle_fire.wav";
description = AudioDefault3d;
preload = true;
effect = AAFireEffect;
};
//--------------------------------------------------------------------------
// Particle effects
//--------------------------------------
datablock ParticleData(FlakDust)
{
dragCoefficient = 1.0;
gravityCoefficient = -0.01;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 1000;
lifetimeVarianceMS = 100;
useInvAlpha = true;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "particleTest";
colors[0] = "0.3 0.3 0.3 0.5";
colors[1] = "0.3 0.3 0.3 0.5";
colors[2] = "0.3 0.3 0.3 0.0";
sizes[0] = 6.6;
sizes[1] = 10.8;
sizes[2] = 12.0;
times[0] = 0.0;
times[1] = 0.7;
times[2] = 1.0;
};
datablock ParticleEmitterData(FlakDustEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionVelocity = 20.0;
velocityVariance = 5.0;
ejectionOffset = 0.0;
thetaMin = 88;
thetaMax = 92;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
lifetimeMS = 250;
particles = "FlakDust";
};
datablock ParticleData(FlakExplosionSmoke)
{
dragCoeffiecient = 0.4;
gravityCoefficient = -0.5; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 1250;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.7 0.7 0.7 1.0";
colors[1] = "0.2 0.2 0.2 1.0";
colors[2] = "0.1 0.1 0.1 0.0";
sizes[0] = 4.0;
sizes[1] = 13.0;
sizes[2] = 4.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(FExplosionSmokeEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 6.25;
velocityVariance = 0.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 200;
particles = "FlakExplosionSmoke";
};
datablock ParticleData(FlakSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 1000;
lifetimeVarianceMS = 650;
textureName = "special/bigspark";
colors[0] = "0.56 0.36 0.26 1.0";
colors[1] = "0.56 0.36 0.26 1.0";
colors[2] = "1.0 0.36 0.26 0.0";
sizes[0] = 3.0;
sizes[1] = 3.0;
sizes[2] = 4.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(FlakSparksEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 15;
velocityVariance = 5.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "FlakSparks";
};
datablock ParticleData(FlakFlashSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 250;
lifetimeVarianceMS = 650;
textureName = "special/bigspark";
colors[0] = "1.0 0.2 0.2 1.0";
colors[1] = "0.7 0.7 0.2 1.0";
colors[2] = "0.5 0.5 0.1 0.0";
sizes[0] = 4.0;
sizes[1] = 5.0;
sizes[2] = 6.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(FlakFlashSparksEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 25;
velocityVariance = 0.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = true;
lifetimeMS = 100;
particles = "FlakFlashSparks";
};
//----------------------------------------------------
// Explosion
//----------------------------------------------------
datablock ExplosionData(FlakExplosion)
{
soundProfile = GrenadeExplosionSound;
faceViewer = true;
explosionScale = "1.0 1.0 1.0";
emitter[0] = FlakDustEmitter;
emitter[1] = FExplosionSmokeEmitter;
emitter[2] = FlakSparksEmitter;
emitter[3] = FlakFlashSparksEmitter;
shakeCamera = true;
camShakeFreq = "10.0 6.0 9.0";
camShakeAmp = "20.0 20.0 20.0";
camShakeDuration = 0.5;
camShakeRadius = 20.0;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(Flak_Bullet)
{
doDynamicClientHits = true;
directDamage = 0.3;
directDamageType = $DamageType::AATurret;
explosion = FlakExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.15;
damageRadius = 25.0;
radiusDamageType = $DamageType::Flak;
kickBackStrength = 15;
sound = ChaingunProjectile;
dryVelocity = 600.0;
wetVelocity = 200.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 2000;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 15.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.35;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
datablock TracerProjectileData(Flak_Bullet_exp)
{
doDynamicClientHits = true;
directDamage = 0.3;
directDamageType = $DamageType::AATurret;
explosion = FlakExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.15;
damageRadius = 25.0;
radiusDamageType = $DamageType::Flak;
kickBackStrength = 150;
sound = ChaingunProjectile;
dryVelocity = 0.0;
wetVelocity = 0.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 10;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 1;
tracerLength = 0.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.35;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
//--------------------------------------------------------------------------
// Weapon
//--------------------------------------
datablock TurretImageData(AABarrelLarge)
{
shapeFile = "turret_aa_large.dts";
item = AABarrelPack; // z0dd - ZOD, 4/25/02. Was wrong: AABarrelLargePack
projectileType = TracerProjectile;
projectile = Flak_Bullet;
projectileSpread = 25.0 / 1000.0;
usesEnergy = true;
fireEnergy = 1.0;
minEnergy = 1.0;
emap = true;
isSeeker = true;
seekRadius = 300;
maxSeekAngle = 6;
seekTime = 1.0;
minSeekHeat = 0.6;
useTargetAudio = false;
// Turret parameters
activationMS = 175; // z0dd - ZOD, 3/27/02. Was 250. Amount of time it takes turret to unfold
deactivateDelayMS = 500;
thinkTimeMS = 140; // z0dd - ZOD, 3/27/02. Was 200. Amount of time before turret starts to unfold (activate)
degPerSecTheta = 600;
degPerSecPhi = 1080;
attackRadius = 1000;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = AASwitchSound;
stateTimeoutValue[1] = 1.0;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateScript[1] = "AAActivateReady";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire1";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateScript[2] = "AAReady";
stateName[3] = "Fire1";
stateTransitionOnTimeout[3] = "Reload1";
stateTimeoutValue[3] = 1.00;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire1";
stateSound[3] = AAFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload1";
stateTimeoutValue[4] = 0.08;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Fire2";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Fire2";
stateTransitionOnTimeout[5] = "Reload2";
stateTimeoutValue[5] = 1.00;
stateFire[5] = true;
stateRecoil[5] = LightRecoil;
stateAllowImageChange[5] = false;
stateSequence[5] = "Fire2";
stateSound[5] = AAFireSound;
stateScript[5] = "onFire";
stateName[6] = "Reload2";
stateTimeoutValue[6] = 0.08;
stateAllowImageChange[6] = false;
stateSequence[6] = "Reload";
stateTransitionOnTimeout[6] = "Ready";
stateTransitionOnNotLoaded[6] = "Deactivate";
stateTransitionOnNoAmmo[6] = "NoAmmo";
stateName[7] = "Deactivate";
stateSequence[7] = "Activate";
stateDirection[7] = false;
stateTimeoutValue[7] = 1.0;
stateTransitionOnLoaded[7] = "ActivateReady";
stateTransitionOnTimeout[7] = "Dead";
stateName[8] = "Dead";
stateTransitionOnLoaded[8] = "ActivateReady";
stateName[9] = "NoAmmo";
stateTransitionOnAmmo[9] = "Reload2";
stateSequence[9] = "NoAmmo";
};
function AABarrelLarge::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%p.doexplodecheck = schedule(250, 0, "TurretFlakExplode", %p);
}
function TurretFlakExplode(%p){
if(!isObject(%p))
return;
InitContainerRadiusSearch(%p.getPosition(), 25, $TypeMasks::VehicleObjectType);
while ((%SearchResult = containerSearchNext()) != 0)
{
%pn = new (TracerProjectile)() {
dataBlock = Flak_Bullet_exp;
initialPosition = %p.getPosition();
sourceObject = %p.sourceObject;
sourceSlot = %p.sourceSlot;
vehicleObject = %p.vehicleObject;
};
MissionCleanup.add(%pn);
%p.delete();
return;
}
%p.doexplodecheck = schedule(30, 0, "TurretFlakExplode", %p);
}

View file

@ -0,0 +1,531 @@
datablock EffectProfile(IBLSwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 5.0;
maxDistance = 5.0;
};
datablock EffectProfile(IBLFireEffect)
{
effectname = "powered/turret_indoor_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(IBLSwitchSound)
{
filename = "fx/powered/turret_light_activate.wav";
description = AudioClose3d;
preload = true;
effect = IBLSwitchEffect;
};
datablock AudioProfile(IBLFireSound)
{
filename = "fx/weapons/chaingun_fire.wav";
description = AudioDefault3d;
preload = true;
effect = IBLFireEffect;
};
datablock SensorData(DeployedIndoorTurretSensor)
{
detects = true;
detectsUsingLOS = true;
detectsPassiveJammed = false;
detectsActiveJammed = false;
detectsCloaked = false;
detectionPings = true;
detectRadius = 130;
};
datablock ShockwaveData(IndoorTurretMuzzleFlash)
{
width = 0.5;
numSegments = 13;
numVertSegments = 1;
velocity = 2.0;
acceleration = -1.0;
lifetimeMS = 300;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = false;
orientToNormal = true;
renderSquare = true;
texture[0] = "special/blasterHit";
texture[1] = "special/gradient";
texWrap = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "1.0 0.3 0.3 1.0";
colors[1] = "1.0 0.3 0.3 1.0";
colors[2] = "1.0 0.3 0.3 0.0";
};
datablock TurretData(TurretDeployedFloorIndoor) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_indoor_deployf.dts";
mass = 5.0;
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 1.8;
explosion = SmallTurretExplosion;
expDmgRadius = 5.0;
expDamage = 0.25;
expImpulse = 500.0;
repairRate = 0;
heatSignature = 0.0;
deployedObject = true;
thetaMin = 5;
thetaMax = 145;
thetaNull = 90;
primaryAxis = zaxis;
isShielded = true;
energyPerDamagePoint = 110;
maxEnergy = 30;
rechargeRate = 0.10;
barrel = DeployableIndoorBarrel;
canControl = false;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Emplacment';
targetTypeTag = 'Turret';
sensorData = DeployedIndoorTurretSensor;
sensorRadius = DeployedIndoorTurretSensor.detectRadius;
sensorColor = "191 0 226";
firstPersonOnly = true;
renderWhenDestroyed = false;
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
noFire = 1;
};
datablock TurretData(TurretDeployedWallIndoor) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_indoor_deployw.dts";
mass = 5.0;
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 1.8;
explosion = SmallTurretExplosion;
expDmgRadius = 5.0;
expDamage = 0.25;
expImpulse = 500.0;
repairRate = 0;
heatSignature = 0.0;
thetaMin = 5;
thetaMax = 145;
thetaNull = 90;
deployedObject = true;
primaryAxis = yaxis;
isShielded = true;
energyPerDamagePoint = 110;
maxEnergy = 30;
rechargeRate = 0.10;
barrel = DeployableIndoorBarrel;
canControl = false;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Emplacment';
targetTypeTag = 'Turret';
sensorData = DeployedIndoorTurretSensor;
sensorRadius = DeployedIndoorTurretSensor.detectRadius;
sensorColor = "191 0 226";
firstPersonOnly = true;
renderWhenDestroyed = false;
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
noFire = 1;
};
datablock TurretData(TurretDeployedCeilingIndoor) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_indoor_deployc.dts";
mass = 5.0;
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 1.8;
explosion = SmallTurretExplosion;
expDmgRadius = 5.0;
expDamage = 0.5;
expImpulse = 500.0;
repairRate = 0;
explosion = SmallTurretExplosion;
//thetaMin = 5;
//thetaMax = 145;
thetaMin = 35;
thetaMax = 175;
thetaNull = 90;
heatSignature = 0.0;
deployedObject = true;
primaryAxis = revzaxis;
isShielded = true;
energyPerDamagePoint = 110;
maxEnergy = 75;
rechargeRate = 0.5;
barrel = DeployableIndoorBarrel;
canControl = false;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Implacment';
targetTypeTag = 'Turret';
sensorData = DeployedIndoorTurretSensor;
sensorRadius = DeployedIndoorTurretSensor.detectRadius;
sensorColor = "191 0 226";
firstPersonOnly = true;
renderWhenDestroyed = false;
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
noFire = 1;
};
datablock StaticShapeData(ControlStation) : StaticShapeDamageProfile
{
className = Station;
shapeFile = "station_teleport.dts";
maxDamage = 2.0;
destroyedLevel = 2.0;
disabledLevel = 1.5;
explosion = DeployablesExplosion;
expDmgRadius = 8.0;
expDamage = 0.35;
expImpulse = 500.0;
dynamicType = $TypeMasks::StationObjectType;
isShielded = false;
energyPerDamagePoint = 110;
maxEnergy = 50;
rechargeRate = 0.20;
renderWhenDestroyed = false;
deployedObject = true;
cantAbandon = 1;
cmdCategory = "DSupport";
cmdIcon = CMDStationIcon;
cmdMiniIconName = "commander/MiniIcons/com_inventory_grey";
targetNameTag = 'Control';
targetTypeTag = 'Station';
debrisShapeName = "debris_generic_small.dts";
debris = DeployableDebris;
heatSignature = 0;
};
datablock TracerProjectileData(ImplacmentBullet)
{
doDynamicClientHits = true;
directDamage = 0.12; // z0dd - ZOD, 9-27-02. Was 0.0825
directDamageType = $DamageType::IndoorDepTurret;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
kickBackStrength = 1000.0;
sound = ChaingunProjectile;
//dryVelocity = 425.0;
dryVelocity = 1500.0; // z0dd - ZOD, 8-12-02. Was 425.0
wetVelocity = 1000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 15.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.12;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
datablock TurretImageData(DeployableIndoorBarrel)
{
shapeFile = "turret_tank_barrelchain.dts";
item = TurretIndoorDeployable; // z0dd - ZOD, 4/25/02. Was wrong: IndoorTurretBarrel
offset = "0 -1 0"; // L/R - F/B - T/B
rotation = "0 1 0 90";
projectile = ImplacmentBullet;
projectileType = TracerProjectile;
usesEnergy = true;
fireEnergy = 0.0;
minEnergy = 0.5;
projectileSpread = 0.5 / 1000.0;
maxSpread = 8 / 1000.0;
lightType = "WeaponFireLight";
lightColor = "0.25 0.15 0.15 1.0";
lightTime = "1000";
lightRadius = "2";
muzzleFlash = IndoorTurretMuzzleFlash;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1000;
thinkTimeMS = 100000;
degPerSecTheta = 580;
degPerSecPhi = 960;
attackRadius = 240;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = IBLSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.01;
stateFire[3] = true;
stateShockwave[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = IBLFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTimeoutValue[4] = 0.03;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};
function DeployableIndoorBarrel::onFire(%data, %obj, %slot){
%data.lightStart = getSimTime();
if(%obj.spread $= "")
%obj.spread = %data.projectileSpread;
else
%obj.spread = %obj.spread + (4 / 10000);
if(%obj.lowSpreadLoop $= "")
%obj.lowSpreadLoop = schedule(250, 0, "lowerSpread", %data, %obj);
if(%obj.spread > %data.maxspread)
%obj.spread = %data.maxspread;
%vec = %obj.getMuzzleVector(%slot);
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %obj.spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%vector = MatrixMulVector(%mat, %vec);
%initialPos = %obj.getMuzzlePoint(%slot);
%p = new (%data.projectileType)() {
dataBlock = %data.projectile;
initialDirection = %vector;
initialPosition = %initialPos;
sourceObject = %obj;
sourceSlot = %slot;
};
%obj.lastProjectile = %p;
MissionCleanup.add(%p);
if(%obj.client)
%obj.client.projectile = %p;
}
function lowerSpread(%data, %obj){
%obj.spread = %obj.spread - (4 / 10000);
if(%obj.spread < %data.projectileSpread){
%obj.spread = %data.projectileSpread;
%obj.lowSpreadLoop = "";
return;
}
%obj.lowSpreadLoop = schedule(120, 0, "lowerSpread", %data, %obj);
}
function TurretIndoorDeployableImage::onDeploy(%item, %plyr, %slot)
{
if(!isObject(%plyr.depTurret)){
%plyr.deplStation = "";
%plyr.depTurret = "";
}
if(%plyr.deplStation != 1){
%rot = %item.getInitialRotation(%plyr);
%className = "Turret";
%deplObj = new (%className)() {
dataBlock = %item.deployed;
};
%deplObj.setDeployRotation(%item.surfacePt, %item.surfaceNrm);
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj);
AIDeployObject(%plyr.client, %deplObj);
serverPlay3D(%item.deploySound, %deplObj.getTransform());
$TeamDeployedCount[%plyr.team, %item.item]++;
if (%classname !$= "Item")
%deplObj.deploy();
addDSurface(%item.surface,%deplObj);
%plyr.deplStation = 1;
%plyr.depTurret = %deplObj;
return %deplObj;
}
else {
%rot = %item.getInitialRotation(%plyr);
%className = "StaticShape";
%deplObj = new (%className)() {
dataBlock = "ControlStation";
scale = "0.3 0.3 1";
};
%rot = %plyr.getRotation();
%deplObj.setTransform(VectorAdd(%item.surfacePt, %plac) SPC %rot);
if (%deplObj.getDatablock().rechargeRate)
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
%deplObj.team = %plyr.client.Team;
%deplObj.setOwner(%plyr);
if (%deplObj.getTarget() != -1)
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
addToDeployGroup(%deplObj);
AIDeployObject(%plyr.client, %deplObj);
serverPlay3D(%item.deploySound, %deplObj.getTransform());
%deplObj.deploy();
%deplObj.Turret = %plyr.depTurret;
%deplObj.Turret.Base = %deplObj;
%startvec = vectorAdd(%deplObj.getPosition(), "0 0 2.5");
%endvec = %deplObj.Turret.getWorldBoxCenter();
if(vectorLen(vectorSub(%plyr.depTurret.getPosition(), %startvec)) >= 4){
%deplObj.schedule(10, "delete");
messageclient(%plyr.client, 'MsgClient', "Control position must be close to turret.");
return;
}
%search = containerRayCast(%startvec, %endvec, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TurretObjectType);
if(%search){
if(getWord(%search,0) $= %deplObj){
echo(%deplObj.Turret@" "@getWord(%search,0));
%deplObj.schedule(10, "delete");
messageclient(%plyr.client, 'MsgClient', "Must be able to grasp turret from control position.");
return;
}
}
%plyr.unmountImage(%slot);
%plyr.decInventory(%item.item, 1);
%plyr.deplStation = "";
%plyr.depTurret = "";
addDSurface(%item.surface,%deplObj);
return %deplObj;
}
}
function ControlStation::onCollision(%data,%obj,%col) {
if(%col.getDatablock().className !$= "Armor")
return;
if(%obj.getMountNodeObject(0) == 0 && %col.mountVehicle){
%obj.mountObject(%col,0);
%col.setControlObject(%obj.Turret);
%col.client.setObjectActiveImage(%obj.Turret, 0);
}
}

View file

@ -0,0 +1,236 @@
//--------------------------------------------------------------------------
// Large Missile Turret
//
// z0dd - ZOD, 4/25/02. Labels for sound datablocks were wrong.
//-------------------------------------------------------------
//--------------------------------------------------------------------------
// Sounds
//--------------------------------------
datablock EffectProfile(MILSwitchEffect)
{
effectname = "powered/turret_heavy_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(MILFireEffect)
{
effectname = "powered/turret_missile_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(MILSwitchSound)
{
filename = "fx/powered/turret_missile_activate.wav";
description = AudioClose3d;
preload = true;
effect = MILSwitchEffect;
};
datablock AudioProfile(MILFireSound)
{
filename = "fx/powered/turret_missile_fire.wav";
description = AudioDefault3d;
preload = true;
effect = MILFireEffect;
};
//--------------------------------------------------------------------------
// Particle effects: Note that we pull the below datablocks from
// scripts/weapons/missileLauncher.cs
//--------------------------------------
//datablock ParticleData(MissileSmokeParticle)
//datablock ParticleEmitterData(MissileSmokeEmitter)
//--------------------------------------------------------------------------
// Explosion: from scripts/weapons/disc.cs
//--------------------------------------
//dataBlock ExplosionData(DiscExplosion)
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock SeekerProjectileData(TurretMissile)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 1.0;
damageRadius = 4.0;
radiusDamageType = $DamageType::MissileTurret;
kickBackStrength = 2500;
flareDistance = 200;
flareAngle = 30;
minSeekHeat = 0.6;
explosion = "MissileExplosion";
velInheritFactor = 0.2;
splash = MissileSplash;
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
lifetimeMS = 20000;
muzzleVelocity = 90.0; // z0dd - ZOD, 3/27/02. Was 80. Velocity of projectile
turningSpeed = 90.0;
proximityRadius = 4;
terrainAvoidanceSpeed = 180;
terrainScanAhead = 25;
terrainHeightFail = 12;
terrainAvoidanceRadius = 100;
useFlechette = true;
flechetteDelayMs = 550;
casingDeb = FlechetteDebris;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock SeekerProjectileData(sidewinder_Turret)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 1.0;
damageRadius = 3.0;
radiusDamageType = $DamageType::Missile;
kickBackStrength = 650;
explosion = "MissileExplosion";
splash = MissileSplash;
velInheritFactor = 1.0; // to compensate for slow starting velocity, this value
// is cranked up to full so the missile doesn't start
// out behind the player when the player is moving
// very quickly - bramage
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
bubbleEmitTime = 1.0;
exhaustEmitter = MissileLauncherExhaustEmitter;
exhaustTimeMs = 300;
exhaustNodeName = "muzzlePoint1";
lifetimeMS = 15000; // z0dd - ZOD, 4/14/02. Was 6000
muzzleVelocity = 80.0;
maxVelocity = 350.0; // z0dd - ZOD, 4/14/02. Was 80.0
turningSpeed = 58.0;
acceleration = 75.0;
proximityRadius = 3;
terrainAvoidanceSpeed = 180;
terrainScanAhead = 25;
terrainHeightFail = 12;
terrainAvoidanceRadius = 100;
flareDistance = 200;
flareAngle = 30;
minSeekHeat = 0.0;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.2 0.05 0";
useFlechette = true;
flechetteDelayMs = 1000;
casingDeb = FlechetteDebris;
explodeOnWaterImpact = false;
};
//--------------------------------------------------------------------------
//-------------------------------------- Fusion Turret Image
//
datablock TurretImageData(MissileBarrelLarge)
{
shapeFile = "turret_missile_large.dts";
item = MissileBarrelPack; // z0dd - ZOD, 4/25/02. Was wrong: MissileBarrelLargePack
projectile = SideWinder_Turret;
projectileType = SeekerProjectile;
usesEnergy = true;
fireEnergy = 60.0;
minEnergy = 60.0;
isSeeker = true;
seekRadius = 400;
maxSeekAngle = 30;
seekTime = 0.35;
minSeekHeat = 0.6;
emap = true;
minTargetingDistance = 40;
// Turret parameters
activationMS = 175; // z0dd - ZOD, 3/27/02. Was 250. Amount of time it takes turret to unfold
deactivateDelayMS = 500;
thinkTimeMS = 140; // z0dd - ZOD, 3/27/02. Was 200. Amount of time before turret starts to unfold (activate)
degPerSecTheta = 580;
degPerSecPhi = 1080;
attackRadius = 400;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = MILSwitchSound; // z0dd - ZOD, 3/27/02. Was MBLSwitchSound, changed for sound fix.
stateTimeoutValue[1] = 2;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.3;
stateFire[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = MILFireSound; // z0dd - ZOD, 3/27/02. Was MBLFireSound, changed for sound fix.
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTimeoutValue[4] = 3.5;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 2;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,242 @@
// --------------------------------------------------------------
// Outdoor Deployable Turret barrel
// --------------------------------------------------------------
// --------------------------------------------------------------
// Sound datablocks
// --------------------------------------------------------------
datablock EffectProfile(OBLSwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock EffectProfile(OBLFireEffect)
{
effectname = "powered/turret_outdoor_fire";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(OBLSwitchSound)
{
filename = "fx/powered/turret_light_activate.wav";
description = AudioClose3d;
preload = true;
effect = OBLSwitchEffect;
};
datablock AudioProfile(OBLFireSound)
{
filename = "fx/powered/turret_outdoor_fire.wav";
description = AudioDefault3d;
preload = true;
effect = OBLFireEffect;
};
// --------------------------------------------------------------
// Projectile data
// --------------------------------------------------------------
datablock GrenadeProjectileData(AntiPersonnelMortar)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 0.15;
damageRadius = 20.0;
radiusDamageType = $DamageType::OutdoorDepTurret;
kickBackStrength = 0;
bubbleEmitTime = 1.0;
sound = GrenadeProjectileSound;
explosion = "GrenadeExplosion";
underwaterExplosion = "UnderwaterGrenadeExplosion";
velInheritFactor = 0.85; // z0dd - ZOD, 3/30/02. Was 0.5
splash = GrenadeSplash;
baseEmitter = GrenadeSmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.30;
grenadeFriction = 0.2;
armingDelayMS = 100;
muzzleVelocity = 50.0;
gravityMod = 1.0;
};
// --------------------------------------------------------------
datablock SensorData(DeployedOutdoorTurretSensor)
{
detects = true;
detectsUsingLOS = true;
detectsPassiveJammed = false;
detectsActiveJammed = false;
detectsCloaked = false;
detectionPings = true;
detectRadius = 60;
};
datablock ShockwaveData(OutdoorTurretMuzzleFlash)
{
width = 0.5;
numSegments = 13;
numVertSegments = 1;
velocity = 2.0;
acceleration = -1.0;
lifetimeMS = 300;
height = 0.1;
verticalCurve = 0.5;
mapToTerrain = false;
renderBottom = false;
orientToNormal = true;
renderSquare = true;
texture[0] = "special/blasterHit";
texture[1] = "special/gradient";
texWrap = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
colors[0] = "1.0 0.8 0.5 1.0";
colors[1] = "1.0 0.8 0.5 1.0";
colors[2] = "1.0 0.8 0.5 0.0";
};
datablock TurretData(TurretDeployedOutdoor) : TurretDamageProfile
{
className = DeployedTurret;
shapeFile = "turret_outdoor_deploy.dts";
rechargeRate = 0.15;
mass = 5.0;
maxDamage = 1.2;
destroyedLevel = 1.2;
disabledLevel = 0.9;
explosion = HandGrenadeExplosion;
expDmgRadius = 5.0;
expDamage = 0.3;
expImpulse = 500.0;
repairRate = 0;
deployedObject = true;
thetaMin = 0;
thetaMax = 145;
thetaNull = 90;
yawVariance = 30.0; // these will smooth out the elf tracking code.
pitchVariance = 30.0; // more or less just tolerances
isShielded = false;
energyPerDamagePoint = 110;
maxEnergy = 60;
renderWhenDestroyed = true;
barrel = DeployableOutdoorBarrel;
heatSignature = 0;
canControl = true;
cmdCategory = "DTactical";
cmdIcon = CMDTurretIcon;
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
targetNameTag = 'Anti-Infantry Mortar';
targetTypeTag = 'Turret';
sensorData = DeployedOutdoorTurretSensor;
sensorRadius = DeployedOutdoorTurretSensor.detectRadius;
sensorColor = "191 0 226";
firstPersonOnly = true;
debrisShapeName = "debris_generic_small.dts";
debris = TurretDebrisSmall;
};
datablock TurretImageData(DeployableOutdoorBarrel)
{
shapeFile = "turret_muzzlepoint.dts";
item = TurretOutdoorDeployable;
projectileType = GrenadeProjectile;
projectile = AntiPersonnelMortar;
usesEnergy = true;
fireEnergy = 0.0;
minEnergy = 30.0;
lightType = "WeaponFireLight";
lightColor = "0.25 0.25 0.15 0.2";
lightTime = "1000";
lightRadius = "2";
muzzleFlash = OutdoorTurretMuzzleFlash;
projectileSpread = 3.0 / 1000.0;
DontFireInsideDamageRadius = true;
DamageRadius = 30;
// Turret parameters
activationMS = 300;
deactivateDelayMS = 600;
thinkTimeMS = 200;
degPerSecTheta = 580;
degPerSecPhi = 960;
attackRadius = 240;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = OBLSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 1.5;
stateFire[3] = true;
stateShockwave[3] = true;
stateRecoil[3] = LightRecoil;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateSound[3] = OBLFireSound;
stateScript[3] = "onFire";
stateName[4] = "Reload";
stateTimeoutValue[4] = 0.8;
stateAllowImageChange[4] = false;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};

View file

@ -0,0 +1,178 @@
//--------------------------------------------------------------------------
// Chaingun Turret - Created by Dondelium_X, Greatly Modified by Blnukem
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Sounds
//--------------------------------------------------------------------------
datablock EffectProfile(HeavyCGTurretSwitchEffect)
{
effectname = "powered/turret_light_activate";
minDistance = 2.5;
maxDistance = 5.0;
};
datablock AudioProfile(HeavyCGTurretSwitchSound)
{
filename = "fx/powered/turret_light_activate.wav";
description = AudioClose3d;
preload = true;
effect = HeavyCGTurretSwitchEffect;
};
datablock EffectProfile(HeavyCGTurretFireEffect)
{
filename = "fx/vehicles/tank_chaingun.wav";
minDistance = 2.5;
maxDistance = 8.0;
};
datablock AudioProfile(HeavyCGTurretFireSound)
{
filename = "fx/vehicles/tank_chaingun.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = HeavyCGTurretFireEffect;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------------------------------------------
datablock TracerProjectileData(HVCGTurretBullet)
{
doDynamicClientHits = true;
directDamage = 0.13;
directDamageType = $DamageType::PlasmaTurret;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
HeadMultiplier = 1.5;
LegsMultiplier = 0.5;
kickBackStrength = 50.0;
sound = ChaingunProjectile;
dryVelocity = 3000.0;
wetVelocity = 1000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 3000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 15.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 10.0/255.0 @ " " @ 30.0/255.0 @ " " @ 240.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.2;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = MG42Decal1;
decalData[1] = MG42Decal2;
decalData[2] = MG42Decal3;
decalData[3] = MG42Decal4;
decalData[4] = MG42Decal5;
decalData[5] = MG42Decal6;
hasLight = true;
lightRadius = 4.0;
lightColor = "0.5 0.5 0.175";
};
//--------------------------------------------------------------------------
// Chaingun Turret Image
//--------------------------------------------------------------------------
datablock TurretImageData(PlasmaBarrelLarge)
{
shapeFile = "turret_tank_barrelchain.dts";
item = ChaingunBarrelPack; // z0dd - ZOD, 4/25/02. Was wrong: ChaingunBarrelLargePack
mountPoint = 0;
projectile = HVCGTurretBullet;
projectileType = TracerProjectile;
casing = ShellDebris;
shellExitDir = "0.0 -10.0 10.0";
shellExitOffset = "0.0 0.0 1.0";
shellExitVariance = 10.0;
shellVelocity = 3.5;
usesEnergy = true;
fireEnergy = 0;
minEnergy = 1;
emap = true;
projectileSpread = 6.0 / 1000.0;
// Turret parameters
activationMS = 700; // z0dd - ZOD, 3/27/02. Was 1000. Amount of time it takes turret to unfold
deactivateDelayMS = 1500;
thinkTimeMS = 120; // z0dd - ZOD, 3/27/02. Was 200. Amount of time before turret starts to unfold (activate)
degPerSecTheta = 300;
degPerSecPhi = 500;
attackRadius = 200; // z0dd - ZOD, 3/27/02. Was 120
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = HeavyCGTurretSwitchSound;
stateTimeoutValue[1] = 1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateSequence[3] = "Fire";
stateSequenceRandomFlash[3] = true;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSound[3] = HeavyCGTurretFireSound;
stateScript[3] = "onFire";
stateFire[3] = true;
stateEjectShell[3] = true;
stateTimeoutValue[3] = 0.1;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Reload";
stateTransitionOnNoAmmo[3] = "noAmmo";
stateName[4] = "Reload";
stateTimeoutValue[4] = 0.01;
stateAllowImageChange[4] = false;
stateWaitForTimeout[4] = true;
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNotLoaded[4] = "Deactivate";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 1;
stateTransitionOnLoaded[5] = "ActivateReady";
stateTransitionOnTimeout[5] = "Dead";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateName[7] = "NoAmmo";
stateTransitionOnAmmo[7] = "Reload";
stateSequence[7] = "NoAmmo";
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,525 @@
//------------------------------------------------------------------------------
datablock EffectProfile(VehicleAppearEffect)
{
effectname = "vehicles/inventory_pad_appear";
minDistance = 5;
maxDistance = 10;
};
datablock EffectProfile(ActivateVehiclePadEffect)
{
effectname = "powered/vehicle_pad_on";
minDistance = 20;
maxDistance = 30;
};
datablock AudioProfile(VehicleAppearSound)
{
filename = "fx/vehicles/inventory_pad_appear.wav";
description = AudioClosest3d;
preload = true;
effect = VehicleAppearEffect;
};
datablock AudioProfile(ActivateVehiclePadSound)
{
filename = "fx/powered/vehicle_pad_on.wav";
description = AudioClose3d;
preload = true;
effect = ActivateVehiclePadEffect;
};
datablock StationFXVehicleData( VehicleInvFX )
{
lifetime = 6.0;
glowTopHeight = 1.5;
glowBottomHeight = 0.1;
glowTopRadius = 12.5;
glowBottomRadius = 12.0;
numGlowSegments = 26;
glowFadeTime = 3.25;
armLightDelay = 2.3;
armLightLifetime = 3.0;
armLightFadeTime = 1.5;
numArcSegments = 10.0;
sphereColor = "0.1 0.1 0.5";
spherePhiSegments = 13;
sphereThetaSegments = 8;
sphereRadius = 12.0;
sphereScale = "1.05 1.05 0.85";
glowNodeName = "GLOWFX";
leftNodeName[0] = "LFX1";
leftNodeName[1] = "LFX2";
leftNodeName[2] = "LFX3";
leftNodeName[3] = "LFX4";
rightNodeName[0] = "RFX1";
rightNodeName[1] = "RFX2";
rightNodeName[2] = "RFX3";
rightNodeName[3] = "RFX4";
texture[0] = "special/stationGlow";
texture[1] = "special/stationLight2";
};
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function serverCmdBuyVehicle(%client, %blockName)
{
%team = %client.getSensorGroup();
if(vehicleCheck(%blockName, %team))
{
%station = %client.player.station.pad;
if( (%station.ready) && (%station.station.vehicle[%blockName]) )
{
%trans = %station.getTransform();
%pos = getWords(%trans, 0, 2);
%matrix = VectorOrthoBasis(getWords(%trans, 3, 6));
%yrot = getWords(%matrix, 3, 5);
%p = vectorAdd(%pos,vectorScale(%yrot, -3));
//%adjust = vectorMultiply(realVec(%station,"0 0 4"),"1 1 3");
//%adjustUp = getWord(%adjust,2);
//%adjust = getWords(%adjust,0,1) SPC ((%adjustUp * 0.5) + (mAbs(%adjustUp) * -0.5));
%p = VectorAdd(%p,RealVec(%station,"0 0 7"));
// error(%blockName);
// error(%blockName.spawnOffset);
///[Most]
///Updated Build code for rotatable vehicle pad.
%p = vectorAdd(%p, RealVec(%station,VectorAdd(%blockName.spawnOffset,"0 0 1")));
%forward = VectorCross(VectorCross("0 0 1",realvec(%station,"1 0 0")),"0 0 1");
%rot = FullRot("0 0 1",%forward);
%rrot = RotAdd(%rot,"0 0 1 3.14");
//%rrot= %rot;
%rot = getWords(%rrot, 0,2);
%angle = getWord(%rrot, 3);
//[Most]
%mask = $TypeMasks::VehicleObjectType | $TypeMasks::PlayerObjectType |
$TypeMasks::StationObjectType | $TypeMasks::TurretObjectType;
InitContainerRadiusSearch(%p, %blockName.checkRadius, %mask);
%clear = 1;
for (%x = 0; (%obj = containerSearchNext()) != 0; %x++)
{
if((%obj.getType() & $TypeMasks::VehicleObjectType) && (%obj.getDataBlock().checkIfPlayersMounted(%obj)))
{
%clear = 0;
break;
}
else
if (%obj !=%station.station)
%removeObjects[%x] = %obj;
}
if(%clear)
{
%fadeTime = 0;
for(%i = 0; %i < %x; %i++)
{
if(%removeObjects[%i].getType() & $TypeMasks::PlayerObjectType)
{
%pData = %removeObjects[%i].getDataBlock();
%pData.damageObject(%removeObjects[%i], 0, "0 0 0", 1000, $DamageType::VehicleSpawn);
}
else
{
%removeObjects[%i].mountable = 0;
%removeObjects[%i].startFade( 1000, 0, true );
%removeObjects[%i].schedule(1001, "delete");
%fadeTime = 1500;
}
}
schedule(%fadeTime, 0, "createVehicle", %client, %station, %blockName, %team , %p, %rot, %angle);
}
else
MessageClient(%client, "", 'Can\'t create vehicle. A player is on the creation pad.');
}
}
}
function createVehicle(%client, %station, %blockName, %team , %pos, %rot, %angle)
{
%obj = %blockName.create(%team);
if(%obj)
{
%station.ready = false;
%obj.team = %team;
%obj.useCreateHeight(true);
%obj.schedule(5500, "useCreateHeight", false);
%obj.getDataBlock().isMountable(%obj, false);
%obj.getDataBlock().schedule(6500, "isMountable", %obj, true);
vehicleListAdd(%blockName, %obj);
MissionCleanup.add(%obj);
%turret = %obj.getMountNodeObject(10);
if(%turret > 0)
{
%turret.setCloaked(true);
%turret.schedule(4800, "setCloaked", false);
}
%obj.setCloaked(true);
%obj.setTransform(%pos @ " " @ %rot @ " " @ %angle);
%obj.schedule(3700, "playAudio", 0, VehicleAppearSound);
%obj.schedule(4800, "setCloaked", false);
if(%client.player.lastVehicle)
{
%client.player.lastVehicle.lastPilot = "";
vehicleAbandonTimeOut(%client.player.lastVehicle);
%client.player.lastVehicle = "";
}
%client.player.lastVehicle = %obj;
%obj.lastPilot = %client.player;
%station.playAudio($ActivateSound, ActivateVehiclePadSound);
%ppos = VectorAdd(%station.getTransform(),RealVec(%station,"0 0 2"));
if (%station.getDatablock().getName() $= "DeployableVehiclePad")
{
%station.playThread($ActivateThread,"activate2");
%up = realvec(%station,"0 0 1");
%forward = realvec(%station,"1 0 0");
%p1 = CreateEmitter(%ppos,DVPADE);
%p2 = CreateEmitter(%ppos,DVPADE);
%p1.setRotation(FullRot(%up,%forward));
%p2.setRotation(FullRot(VectorScale(%up,-1),%forward));
%p1.schedule(5000,"delete");
%p2.schedule(5000,"delete");
}
else if (%station.getDatablock().getName() $= "DeployableVehiclePad2")
{
%station.playThread($ActivateThread,"activate");
%up = realvec(%station,"0 0 1");
%forward = realvec(%station,"1 0 0");
%p1 = CreateEmitter(%ppos,DVPADE);
%p2 = CreateEmitter(%ppos,DVPADE);
%p1.setRotation(FullRot(%up,%forward));
%p2.setRotation(FullRot(VectorScale(%up,-1),%forward));
%p1.schedule(5000,"delete");
%p2.schedule(5000,"delete");
}
else
{
%station.playThread($ActivateThread,"activate2");
// play the FX
%fx = new StationFXVehicle()
{
dataBlock = VehicleInvFX;
stationObject = %station;
};
}
//[[CHANGE]]!! If player is telebuying.. put him incontrol...
if ( (%client.isVehicleTeleportEnabled()) && (!%client.telebuy))
%obj.getDataBlock().schedule(5000, "mountDriver", %obj, %client.player);
else
{
if(%obj.getDataBlock().canControl)
{
//serverCmdResetControlObject(%client);
%client.setControlObject(%obj);
commandToClient(%client, 'ControlObjectResponse', true, getControlObjectType(%obj,%client.player));
%obj.clientControl = %client;
}
}
//[[End CHANGE]]
}
if(%obj.getTarget() != -1)
setTargetSensorGroup(%obj.getTarget(), %client.getSensorGroup());
// We are now closing the vehicle hud when you buy a vehicle, making the following call
// unnecessary (and it breaks stuff, too!)
//VehicleHud.updateHud(%client, 'vehicleHud');
}
//------------------------------------------------------------------------------
function VehicleData::mountDriver(%data, %obj, %player)
{
if(isObject(%obj) && %obj.getDamageState() !$= "Destroyed")
{
%player.startFade(1000, 0, true);
schedule(1000, 0, "testVehicleForMount", %player, %obj);
%player.schedule(1500,"startFade",1000, 0, false);
}
}
function testVehicleForMount(%player, %obj)
{
if(isObject(%obj) && %obj.getDamageState() !$= "Destroyed")
%player.getDataBlock().onCollision(%player, %obj, 0);
}
//------------------------------------------------------------------------------
function VehicleData::checkIfPlayersMounted(%data, %obj)
{
for(%i = 0; %i < %obj.getDatablock().numMountPoints; %i++)
if (%obj.getMountNodeObject(%i))
return true;
return false;
}
//------------------------------------------------------------------------------
function VehicleData::isMountable(%data, %obj, %val)
{
%obj.mountable = %val;
}
//------------------------------------------------------------------------------
function vehicleCheck(%blockName, %team)
{
if(($VehicleMax[%blockName] - $VehicleTotalCount[%team, %blockName]) > 0)
return true;
// else
// {
// for(%i = 0; %i < $VehicleMax[%blockName]; %i++)
// {
// %obj = $VehicleInField[%blockName, %i];
// if(%obj.abandon)
// {
// vehicleListRemove(%blockName, %obj);
// %obj.delete();
// return true;
// }
// }
// }
return false;
}
//------------------------------------------------------------------------------
function VehicleHud::updateHud( %obj, %client, %tag ) {
%client.vehInvTag = %tag;
%client.vehInvPage = "";
if (%client.usedVehHud != 1) {
bottomPrint(%client, "Cycle weapons to view more vehicles.", 5, 1);
%client.usedVehHud = 1;
}
cycleVehicleHud(%obj, %client);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function cycleVehicleHud(%obj, %client,%data) {
%tag = %client.vehInvTag;
%page = %client.vehInvPage;
if (%page $= "")
%page = 0;
else {
if (%data $= "prev")
%page--;
else
%page++;
}
%count = %client.player.station.lastCount;
VehicleHud::clearHud( %obj, %client, %tag, %count );
%station = %client.player.station;
%team = %client.getSensorGroup();
%count = 0;
%i = 0;
if ( %station.vehicle[AWACS] ) {
%vehicleSet[AWACS] = %i;
%i++;
}
if ( %station.vehicle[HawkFlyer] ) {
%vehicleSet[HawkFlyer] = %i;
%i++;
}
if ( %station.vehicle[scoutFlyer] ) {
%vehicleSet[scoutFlyer] = %i;
%i++;
}
if ( %station.vehicle[StrikeFlyer] ) {
%vehicleSet[StrikeFlyer] = %i;
%i++;
}
if ( %station.vehicle[SuperiorityFighter] ) {
%vehicleSet[SuperiorityFighter] = %i;
%i++;
}
if ( %station.vehicle[helicopter] ) {
%vehicleSet[helicopter] = %i;
%i++;
}
if ( %station.vehicle[bomberFlyer] ) {
%vehicleSet[bomberFlyer] = %i;
%i++;
}
if ( %station.vehicle[HeavyTank] ) {
%vehicleSet[HeavyTank] = %i;
%i++;
}
if ( %station.vehicle[Personelboat] ) {
%vehicleSet[Personelboat] = %i;
%i++;
}
if ( %station.vehicle[boat] ) {
%vehicleSet[boat] = %i;
%i++;
}
if ( %station.vehicle[Sub] ) {
%vehicleSet[Sub] = %i;
%i++;
}
if ( %station.vehicle[scoutVehicle] ) {
%vehicleSet[scoutVehicle] = %i;
%i++;
}
if ( %station.vehicle[hapcFlyer] ) {
%vehicleSet[hapcFlyer] = %i;
%i++;
}
if ( %station.vehicle[gunship] ) {
%vehicleSet[gunship] = %i;
%i++;
}
if ( %station.vehicle[HeavyChopper] ) {
%vehicleSet[HeavyChopper] = %i;
%i++;
}
if ( %station.vehicle[CGTank] ) {
%vehicleSet[CGTank] = %i;
%i++;
}
if ( %station.vehicle[AssaultVehicle] ) {
%vehicleSet[AssaultVehicle] = %i;
%i++;
}
if ( %station.vehicle[mobileBaseVehicle] ) {
%vehicleSet[mobileBaseVehicle] = %i;
%i++;
}
if ( %station.vehicle[SuperScoutVehicle] && $Host::Purebuild == 1) {
%vehicleSet[SuperScoutVehicle] = %i;
%i++;
}
if ( %station.vehicle[SuperHAPCFlyer] && $Host::Purebuild == 1) {
%vehicleSet[SuperHAPCFlyer] = %i;
%i++;
}
if ( %station.vehicle[Artillery] ) {
%vehicleSet[Artillery] = %i;
%i++;
}
%totalPages = mCeil(%i / 6) - 1;
if (%page < 0)
%page = %totalPages;
if (%page > %totalPages)
%page = 0;
%initPos = (%page * 6);
%endPos = %initPos + 5;
if ( checkVehSet(%vehicleSet[AWACS], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "AWACS", "", AWACS, $VehicleMax[AWACS] - $VehicleTotalCount[%team, AWACS] );
%count++;
}
if ( checkVehSet(%vehicleSet[HawkFlyer], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "FC-13 Hawk Interceptor", "", HawkFlyer, $VehicleMax[HawkFlyer] - $VehicleTotalCount[%team, HawkFlyer] );
%count++;
}
if ( checkVehSet(%vehicleSet[SuperScoutVehicle], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Super Grav Cycle", "", SuperScoutVehicle, $VehicleMax[SuperScoutVehicle] - $VehicleTotalCount[%team,SuperScoutVehicle] );
%count++;
}
if ( checkVehSet(%vehicleSet[Superiorityfighter], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Tornado Superiority Fighter", "", Superiorityfighter, $VehicleMax[Superiorityfighter] - $VehicleTotalCount[%team, Superiorityfighter] );
%count++;
}
if ( checkVehSet(%vehicleSet[scoutFlyer], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "F39 Raptor II Interceptor", "", ScoutFlyer, $VehicleMax[ScoutFlyer] - $VehicleTotalCount[%team, ScoutFlyer] );
%count++;
}
if ( checkVehSet(%vehicleSet[StrikeFlyer], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "F41 Airwing Strike Fighter", "", StrikeFlyer, $VehicleMax[StrikeFlyer] - $VehicleTotalCount[%team, StrikeFlyer] );
%count++;
}
if ( checkVehSet(%vehicleSet[helicopter], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "WhiteHorse Assault Chopper", "", helicopter, $VehicleMax[helicopter] - $VehicleTotalCount[%team, helicopter] );
%count++;
}
if ( checkVehSet(%vehicleSet[bomberFlyer], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "B-34 Bomber", "", BomberFlyer, $VehicleMax[BomberFlyer] - $VehicleTotalCount[%team, BomberFlyer] );
%count++;
}
if ( checkVehSet(%vehicleSet[HeavyTank], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "M3A2 Faustes Assualt Tank", "", HeavyTank, $VehicleMax[HeavyTank] - $VehicleTotalCount[%team, HeavyTank] );
%count++;
}
if ( checkVehSet(%vehicleSet[Personelboat], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Grandens Transport Boat", "", Personelboat, $VehicleMax[Personelboat] - $VehicleTotalCount[%team, Personelboat] );
%count++;
}
if ( checkVehSet(%vehicleSet[boat], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Star II Heavy GunBoat", "", boat, $VehicleMax[boat] - $VehicleTotalCount[%team, boat] );
%count++;
}
if ( checkVehSet(%vehicleSet[sub], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Darwine IV Submarine", "", sub, $VehicleMax[sub] - $VehicleTotalCount[%team, sub] );
%count++;
}
if ( checkVehSet(%vehicleSet[scoutVehicle], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "MK II WildCat Grav Cycle", "", scoutVehicle, $VehicleMax[scoutVehicle] - $VehicleTotalCount[%team,scoutVehicle] );
%count++;
}
if ( checkVehSet(%vehicleSet[hapcFlyer], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "HVC Golem Heavy Transport", "", HAPCFlyer, $VehicleMax[HAPCFlyer] - $VehicleTotalCount[%team, HAPCFlyer] );
%count++;
}
if ( checkVehSet(%vehicleSet[gunship], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "AC-290 Saber Gunship", "", gunship, $VehicleMax[gunship] - $VehicleTotalCount[%team, gunship] );
%count++;
}
if ( checkVehSet(%vehicleSet[HeavyChopper], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Eagle VII Transport Chopper", "", HeavyChopper, $VehicleMax[HeavyChopper] - $VehicleTotalCount[%team, HeavyChopper] );
%count++;
}
if ( checkVehSet(%vehicleSet[CGTank], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Banshee 50mm Chaingun Tank", "", CGTank, $VehicleMax[CGTank] - $VehicleTotalCount[%team, CGTank] );
%count++;
}
if ( checkVehSet(%vehicleSet[AssaultVehicle], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "M4A1 Wolf Light Tank", "", AssaultVehicle, $VehicleMax[AssaultVehicle] - $VehicleTotalCount[%team, AssaultVehicle] );
%count++;
}
if ( checkVehSet(%vehicleSet[mobileBaseVehicle], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Jericho MPB", "", MobileBaseVehicle, $VehicleMax[MobileBaseVehicle] - $VehicleTotalCount[%team, MobileBaseVehicle] );
%count++;
}
if ( checkVehSet(%vehicleSet[Artillery], %initPos)) {
messageClient( %client, 'SetLineHud', "", %tag, %count, "Grendel Heavy Artillery", "", Artillery, $VehicleMax[Artillery] - $VehicleTotalCount[%team, Artillery] );
%count++;
}
%station.lastCount = %count;
%client.vehInvPage = %page;
}
//------------------------------------------------------------------------------
function VehicleHud::clearHud( %obj, %client, %tag, %count ) {
for ( %i = 0; %i < %count; %i++ )
messageClient( %client, 'RemoveLineHud', "", %tag, %i );
}
//------------------------------------------------------------------------------
function checkVehSet(%obj, %initpos) {
if ((%obj !$= "") && (%obj >= %initpos) && (%obj <= (%initpos + 5)))
return true;
else
return false;
}
//------------------------------------------------------------------------------
function serverCmdEnableVehicleTeleport( %client, %enabled )
{
%client.setVehicleTeleportEnabled( %enabled );
}

2247
Scripts/Vehicles/vehicle.cs Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,772 @@
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock SensorData(AWACSSensor)
{
detects = true;
detectsUsingLOS = true;
detectsPassiveJammed = false;
detectsActiveJammed = false;
detectsCloaked = false;
detectionPings = true;
detectRadius = 1750;
};
datablock FlyingVehicleData(AWACS) : BomberDamageProfile
{
spawnOffset = "0 0 2";
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_air_bomber.dts";
multipassenger = true;
computeCRC = true;
weaponNode = 1;
debrisShapeName = "vehicle_air_bomber.dts";
debris = MeShapeDebris;
renderWhenDestroyed = false;
drag = 0.2;
density = 1.0;
mountPose[0] = sitting;
mountPose[1] = sitting;
numMountPoints = 3;
isProtectedMountPoint[0] = true;
isProtectedMountPoint[1] = true;
isProtectedMountPoint[2] = false;
cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;
cameraMaxDist = 22;
cameraOffset = 5;
cameraLag = 1.0;
explosion = MFVehicleExplosion;
explosionDamage = 1.5;
explosionRadius = 20.0;
maxDamage = 5.0; // Total health
destroyedLevel = 5.0; // Damage textures show up at this health level
HDAddMassLevel = 3.5;
HDMassImage = HFlyerHDMassImage;
isShielded = false;
energyPerDamagePoint = 150;
maxEnergy = 400; // Afterburner and any energy weapon pool
minDrag = 60; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 1800; // Angular Drag (dampens the drift after you stop moving the mouse...also tumble drag)
rechargeRate = 0.8;
// Auto stabilize speed
maxAutoSpeed = 15; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 1500; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.95; // Dampen control input so you don't whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 8; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 5; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 8; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 5500; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 800; // Steering jets (force applied when you move the mouse)
steeringRollForce = 3000; // Steering jets (how much you heel over when you turn)
rollForce = 1; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 4; // Height off the ground at rest
createHoverHeight = 3; // Height off the ground when created
maxForwardSpeed = 130; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 5000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 40.0; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 2.5; // Energy use of the afterburners (low number is less drain...can be fractional)
vertThrustMultiple = 3.0;
dustEmitter = LargeVehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 2.0;
damageEmitter[0] = MFLightDamageSmoke;
damageEmitter[1] = MFHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "3.0 -3.0 0.0 ";
damageEmitterOffset[1] = "-3.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;
// Rigid body
mass = 350; // Mass of the vehicle
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't mess with this.
softImpactSpeed = 20; // Sound hooks. This is the soft hit.
hardImpactSpeed = 25; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 20; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.060;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 25;
collDamageMultiplier = 0.020;
//
minTrailSpeed = 15; // The speed your contrail shows up at.
trailEmitter = ContrailEmitter;
forwardJetEmitter = FlyerJetEmitter;
downJetEmitter = FlyerJetEmitter;
//
jetSound = BomberFlyerThrustSound;
engineSound = BomberFlyerEngineSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 15.0;
mediumSplashSoundVelocity = 20.0;
hardSplashSoundVelocity = 30.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterHardSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterHardSound;
waterWakeSound = VehicleWakeHardSplashSound;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingBomberIcon;
cmdMiniIconName = "commander/MiniIcons/com_bomber_grey";
targetNameTag = 'C-410';
targetTypeTag = 'AWACS';
sensorData = AWACSSensor;
sensorRadius = AWACSSensor.detectRadius;
sensorColor = "9 9 255";
checkRadius = 7.1895;
observeParameters = "1 10 10";
shieldEffectScale = "0.75 0.975 0.375";
showPilotInfo = 1;
max[PlasmaAmmo] = 50;
replaceTime = 20;
};
datablock BombProjectileData(BuoyBomb)
{
projectileShapeName = "nexuscap.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 0.0;
damageRadius = 0;
radiusDamageType = $DamageType::BomberBombs;
kickBackStrength = 0;
explosion = "ChaingunExplosion";
velInheritFactor = 1.0;
grenadeElasticity = 0.25;
grenadeFriction = 0.4;
armingDelayMS = 2000;
muzzleVelocity = 0.1;
drag = 0.3;
minRotSpeed = "0.0 0.0 0.0";
maxRotSpeed = "0.0 0.0 10.0";
scale = "1.0 1.0 1.0";
// sound = BomberBombProjectileSound;
};
datablock TurretImageData(AWACSTorp)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
offset = "0 0 0";
item = Chaingun;
projectile = shrikeBomb;
projectileType = BombProjectile;
emap = true;
mountPoint = 1;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = true;
minEnergy = 5;
fireEnergy = 5.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4;
stateAllowImageChange[4] = false;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileReloadSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock TurretImageData(AWACSBuoy)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
offset = "0 0 0";
item = Chaingun;
projectile = BuoyBomb;
projectileType = BombProjectile;
emap = true;
mountPoint = 1;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = true;
minEnergy = 5;
fireEnergy = 5.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 4;
stateAllowImageChange[4] = false;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileReloadSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock StaticShapeData(SonarBuoy) : StaticShapeDamageProfile {
className = "teleport";
shapeFile = "nexuscap.dts";
maxDamage = 2.00;
destroyedLevel = 2.00;
disabledLevel = 1.35;
isShielded = true;
energyPerDamagePoint = 250;
maxEnergy = 100;
rechargeRate = 1;
explosion = ShapeExplosion;
expDmgRadius = 18.0;
expDamage = 0.3;
expImpulse = 200.0;
dynamicType = $TypeMasks::StationObjectType;
deployedObject = true;
cmdCategory = "DSupport";
cmdIcon = CMDSwitchIcon;
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
targetNameTag = 'Deployed';
targetTypeTag = 'Sonar Buoy';
debrisShapeName = "debris_generic.dts";
debris = DeployableDebris;
heatSignature = 0;
needsPower = false;
humSound = SensorHumSound;
pausePowerThread = true;
sensorData = TelePadBaseSensorObj;
sensorRadius = TelePadBaseSensorObj.detectRadius;
sensorColor = "0 212 45";
firstPersonOnly = true;
};
datablock ShapeBaseImageData(Rearmer)
{
mountPoint = 7;
className = WeaponImage;
shapeFile = "deploy_ammo.dts";
offset = "0 -35 -8";
rotation = "1 0 0 -120";
emap = true;
stateName[0] = "Activate";
stateSequence[0] = "Deploy";
};
function AWACS::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.setInventory(PlasmaAmmo, 50);
%turret = TurretData::create(BomberTurret);
MissionCleanup.add(%turret);
%turret.team = %obj.teamBought;
%turret.setSelfPowered();
%turret.selectedWeapon = 1;
%obj.mountObject(%turret, 10);
%turret.mountImage(GST1Param, 0);
%turret.mountImage(APCTurretBarrel, 2);
%turret.mountImage(AWACSTorp, 4);
%turret.mountImage(AWACSBuoy, 6);
%obj.turretObject = %turret;
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%turret.vehicleMounted = %obj;
%turret.setAutoFire(false);
%turret.mountobj = %obj;
%turret.team = %obj.team;
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
}
function AWACS::playerMounted(%data, %obj, %player, %node)
{
//[[CHANGE]]
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
if (%node == 0)
{
// pilot position
%player.setPilot(true);
commandToClient(%player.client, 'setHudMode', 'Pilot', "Bomber", %node);
bottomPrint(%player.client, "Pilot Postion: nade for flares and mine for resupply arm.", 5, 2 );
}
else if (%node == 1)
{
// bombardier position
%turret = %obj.getMountNodeObject(10);
%player.vehicleTurret = %turret;
%player.setTransform("0 0 0 0 0 1 0");
%player.lastWeapon = %player.getMountedImage($WeaponSlot);
%player.unmountImage($WeaponSlot);
if (!%player.client.isAIControlled())
{
%player.setControlObject(%turret);
%player.client.setObjectActiveImage(%turret, 2);
}
%turret.bomber = %player;
$bWeaponActive = 0;
%obj.getMountNodeObject(10).selectedWeapon = 1;
commandToClient(%player.client,'SetWeaponryVehicleKeys', true);
commandToClient(%player.client, 'setHudMode', 'Pilot', "Bomber", %node);
%player.isBomber = true;
centerPrint(%player.client, "WEP1: CG WEP2: Torp WEP3: sonar buoy dropper", 5, 2 );
}
%passString = buildPassengerString(%obj);
for(%i = 0; %i < %data.numMountPoints; %i++)
if (%obj.getMountNodeObject(%i) > 0)
commandToClient(%obj.getMountNodeObject(%i).client, 'checkPassengers', %passString);
if ( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
}
function AWACS::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(10);
if (isObject(%turret)){
%turret.altTrigger = 0;
%turret.fireTrigger = 0;
if (%client = %turret.getControllingClient())
{
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
%client.player.bomber = false;
%client.player.isBomber = false;
}
%turret.schedule(2000, delete);
}
}
function AWACS::onTrigger(%data, %obj, %trigger, %state)
{
if (%trigger ==4){
switch (%state)
{
case 0:
%obj.fireWeapon = false;
case 1:
if (%obj.inv[PlasmaAmmo] > 0){
%obj.fireWeapon = true;
%obj.decInventory(PlasmaAmmo, 1);
%Upvec = %obj.getUpVector();
%p = new FlareProjectile()
{
dataBlock = FlareGrenadeProj;
initialDirection = vectorScale(%Upvec, -1);
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
%p.schedule(6000, "delete");
%vec = vectornormalize(vectorcross(%obj.getForwardvector(),%Upvec));
%p = new FlareProjectile()
{
dataBlock = FlareGrenadeProj;
initialDirection = %vec;
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
%p.schedule(6000, "delete");
%p = new FlareProjectile()
{
dataBlock = FlareGrenadeProj;
initialDirection = vectorscale(%vec,-1);
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
%p.schedule(6000, "delete");
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
}
else if (%trigger ==5){
switch (%state)
{
case 1:
if(%obj.isreping == 1){
stopRearm(%obj);
%obj.unmountImage(6);
}
else{
%obj.isreping = 1;
RearmLoop(%obj);
%obj.mountImage(Rearmer, 6);
}
}
}
}
function RearmLoop(%obj){
if(isObject(%obj)){
if(%obj.isreping == 0)
return;
%targets = %obj.reptargets;
%vec = vectorAdd(vectorscale(%obj.getForwardVector(),-35),vectorscale(%obj.getUpVector(),-8));
%pos = vectorAdd(%obj.getWorldBoxCenter(),%vec);
if(%targets !$= ""){
%numtrgs = getNumberOfWords(%targets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%targets, %i);
if(vectorDist(%pos, %target.getWorldBoxCenter()) <= 20 && %target.getDamageLevel() > 0.0){
if(%target.reping != 1){
%target.reping = 1;
%target.setRepairRate(%target.getRepairRate() + 0.01);
}
}
else{
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - 0.01);
}
}
%datablock = %target.getDatablock();
if(%datablock.max[chaingunAmmo] !$= "" && %target.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
if(%datablock.max[chaingunAmmo] < 100)
%CGamount = 10;
else
%CGamount = 100;
%target.incInventory(chaingunAmmo, %CGamount);
%reloaded = 1;
}
if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
%target.incInventory(MissileLauncherAmmo, 1);
%reloaded = 1;
}
if(%datablock.max[MortarAmmo] !$= "" && %target.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
%target.incInventory(MortarAmmo, 1);
%reloaded = 1;
}
if(%datablock.max[PlasmaAmmo] !$= "" && %target.inv[PlasmaAmmo] < %datablock.max[PlasmaAmmo]){
%target.incInventory(PlasmaAmmo, 4);
%reloaded = 1;
}
if(%reloaded == 1){
%reloaded = 0;
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
}
if(isObject(%target.turretObject)){
%datablock = %target.turretObject.getDatablock();
if(%datablock.max[chaingunAmmo] !$= "" && %target.turretObject.inv[chaingunAmmo] < %datablock.max[chaingunAmmo]){
%target.turretObject.incInventory(chaingunAmmo, 100);
%reloaded = 1;
}
if(%datablock.max[MissileLauncherAmmo] !$= "" && %target.turretObject.inv[MissileLauncherAmmo] < %datablock.max[MissileLauncherAmmo]){
%target.turretObject.incInventory(MissileLauncherAmmo, 1);
%reloaded = 1;
}
if(%datablock.max[MortarAmmo] !$= "" && %target.turretObject.inv[MortarAmmo] < %datablock.max[MortarAmmo]){
%target.turretObject.incInventory(MortarAmmo, 1);
%reloaded = 1;
}
if(%reloaded == 1)
serverPlay3d("MissileReloadSound",%target.getWorldBoxCenter());
}
}
}
%obj.reptargets = "";
InitContainerRadiusSearch(%pos, 15, $TypeMasks::VehicleObjectType);
while ((%targetObject = containerSearchNext()) != 0){
// if(%targetObject.getClassName() $= "FlyingVehicle")
%obj.reptargets = %obj.reptargets @ %targetObject @" ";
}
if(%obj.isreping == 1)
%obj.reploop = schedule(500, 0, "RearmLoop", %obj);
}
}
function stopRearm(%obj){
%obj.isreping = 0;
if(%obj.reptargets !$= ""){
%numtrgs = getNumberOfWords(%obj.reptargets);
for(%i = 0; %i < %numtrgs; %i++){
%target = getWord(%obj.reptargets, %i);
if(%target.reping == 1){
%target.reping = 0;
%target.setRepairRate(%target.getRepairRate() - 0.01);
}
}
}
}
function AWACSTorp::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%p.initVel = vectorNormalize(%obj.mountobj.getVelocity());
%z = getWord(%p.initVel,2);
if(%z > 0)
%p.initVel = vectorNormalize(getWord(%p.initVel,0)@" "@getWord(%p.initVel,1)@" 0");
schedule(500, 0, "changethebomb", %p, "Torp");
}
function AWACSBuoy::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
schedule(500, 0, "changethebomb", %p, "Buoy");
}
function changethebomb(%obj, %type){
if(!isObject(%obj))
return;
%vec = "0 0 100";
%pos = %obj.getPosition();
%search = containerRayCast(%pos, vectorAdd(%pos,%vec), $TypeMasks::WaterObjectType, %obj);
if(%search){
if(%type $= "Torp"){
%p = new SeekerProjectile()
{
dataBlock = Torpedo;
initialDirection = %obj.initVel;
initialPosition = %pos;
sourceObject = %obj.sourceobject;
sourceSlot = 3;
};
%p.sourceobject = %obj.sourceobject;
%p.vector = %vec;
%p.count = 1;
TorpedoSeekLoop(%p);
%obj.schedule(10, "delete");
return;
}
else{
%pos = getWord(%search,1)@" "@getWord(%search,2)@" "@getWord(%search,3);
if($TeamDeployedCount[%obj.sourceObject.team, SonarBuoy] < 5){
%deplObj = new (StaticShape)() {
dataBlock = "SonarBuoy";
position = %pos;
rotation = "0 0 0 0";
scale = "1 1 1";
team = %obj.sourceObject.team;
deployed = "1";
};
%deplObj.setOwner(%obj.sourceObject.getControllingClient().player);
setTargetSensorGroup(%deplObj.getTarget(), %obj.sourceObject.team);
addToDeployGroup(%deplObj);
$TeamDeployedCount[%obj.sourceObject.team, SonarBuoy]++;
%deplObj.deploy();
SonarPingLoop(%deplObj);
%sensor = new (StaticShape) () {
datablock = "DeployedPulseSensor";
position = vectorAdd(%pos, "0 0 0.5");
rotation = "0 0 0 0";
scale = "1 1 1";
team = %obj.sourceObject.team;
deployed = "1";
powerFreq = "0";
};
%sensor.setOwner(%obj.sourceObject.getControllingClient().player);
setTargetSensorGroup(%sensor.getTarget(), %obj.sourceObject.team);
addToDeployGroup(%sensor);
%deplObj.sensor = %sensor;
}
else
BottomPrint(%obj.sourceObject.getControllingClient(), "Your team has reached the max of 5 Sonar Buoys.", 5);
%obj.schedule(10, "delete");
return;
}
}
schedule(100, 0, "changethebomb", %obj, %type);
}
function sonarPingLoop(%obj){
if(!isObject(%obj))
return;
InitContainerRadiusSearch(%obj.getPosition(), 300, $TypeMasks::VehicleObjectType);
while ((%SearchResult = containerSearchNext()) != 0){
%SearchObj = FirstWord(%SearchResult);
if(%searchObj.getDataBlock().getName() $= "Sub" || %searchObj.getDataBlock().getName() $= "Boat"){
if(isObject(%SearchObj.SnrBeacon[%obj.team]))
%SearchObj.SnrBeacon[%obj.team].setPosition(%searchObj.getWorldBoxCenter());
else{
%SearchObj.SnrBeacon[%obj.team] = new BeaconObject() {
dataBlock = "SubBeacon";
beaconType = "vehicle";
position = %SearchObj.getWorldBoxCenter();
};
%SearchObj.SnrBeacon[%obj.team].playThread($AmbientThread, "ambient");
%SearchObj.SnrBeacon[%obj.team].team = %obj.team;
%SearchObj.SnrBeacon[%obj.team].sourceObject = %SearchObj;
%SearchObj.SnrBeacon[%obj.team].setTarget(%obj.team);
MissionCleanup.add(%SearchObj.SnrBeacon[%obj.team]);
%SearchObj.SnrBeacon[%obj.team].schedule(9500, "delete");
}
serverPlay3d("InboundTorpPing",%SearchObj.getWorldBoxCenter());
}
}
%obj.sonarloop = schedule(2000, 0, "sonarPingLoop", %obj);
}
function AWACS::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}
function SonarBuoy::onDestroyed(%this, %obj, %prevState) {
if (%obj.isRemoved)
return;
%obj.isRemoved = true;
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, SonarBuoy]--;
// remDSurface(%obj);
%obj.schedule(500, "delete");
%obj.sensor.schedule(500, "delete");
fireBallExplode(%obj,1);
}

View file

@ -0,0 +1,705 @@
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock ParticleData(CLSubExplosionSmoke)
{
dragCoeffiecient = 1.0;
gravityCoefficient = -0.5; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 1250;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "0.5 0.5 0.5 1.0";
colors[1] = "0.5 0.5 0.5 0.5";
colors[2] = "0.6 0.6 0.6 0.0";
sizes[0] = 1.0;
sizes[1] = 2.0;
sizes[2] = 3.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(CLSubSmokeEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 6.0;
velocityVariance = 6.0;
thetaMin = 80.0;
thetaMax = 90.0;
lifetimeMS = 750;
particles = "CLSubExplosionSmoke";
};
datablock ParticleData(CLSubSparks)
{
dragCoefficient = 1;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 100;
textureName = "special/bigspark";
colors[0] = "0.56 0.36 0.26 1.0";
colors[1] = "0.56 0.36 0.26 1.0";
colors[2] = "1.0 0.36 0.26 0.0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 1.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(CLSubSparksEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 15;
velocityVariance = 10.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 90;
lifetimeMS = 500;
particles = "CLSubSparks";
};
//----------------------------------------------------
// Explosion
//----------------------------------------------------
datablock ExplosionData(ClusterSubExplosion)
{
soundProfile = GrenadeExplosionSound;
faceViewer = true;
explosionScale = "1.0 1.0 1.0";
emitter[0] = CLSubSmokeEmitter;
emitter[1] = CLSubSparksEmitter;
shakeCamera = true;
camShakeFreq = "10.0 6.0 9.0";
camShakeAmp = "10.0 10.0 10.0";
camShakeDuration = 1.0;
camShakeRadius = 10.0;
};
datablock WheeledVehicleData(Artillery) : TankDamageProfile
{
spawnOffset = "0 0 1.0";
renderWhenDestroyed = false;
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_land_mpbase.dts";
multipassenger = true;
computeCRC = true;
debrisShapeName = "vehicle_land_mpbase.dts";
debris = GShapeDebris;
drag = 0.0;
density = 20.0;
mountPose[0] = sitting;
numMountPoints = 1;
isProtectedMountPoint[0] = true;
cantAbandon = 1;
cameraMaxDist = 20;
cameraOffset = 6;
cameraLag = 1.5;
explosion = HGVehicleExplosion;
explosionDamage = 4.0;
explosionRadius = 20.0;
maxSteeringAngle = 0.3; // 20 deg.
// Rigid Body
mass = 2000;
bodyFriction = 0.8;
bodyRestitution = 0.5;
minRollSpeed = 3;
gyroForce = 400;
gyroDamping = 0.3;
stabilizerForce = 10;
minDrag = 10;
softImpactSpeed = 15; // Play SoftImpact Sound
hardImpactSpeed = 25; // Play HardImpact Sound
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 30;
speedDamageScale = 0.060;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 30;
collDamageMultiplier = 0.070;
// Engine
engineTorque = 10.0 * 745;
breakTorque = 6.0 * 745;
maxWheelSpeed = 15;
// Springs
springForce = 10000;
springDamping = 1000;
antiSwayForce = 7500;
staticLoadScale = 2;
// Tires
tireRadius = 2.5;
tireFriction = 50.0;
tireRestitution = 0.5;
tireLateralForce = 3000;
tireLateralDamping = 400;
tireLateralRelaxation = 1;
tireLongitudinalForce = 10000;
tireLongitudinalDamping = 400;
tireLongitudinalRelaxation = 1;
tireEmitter = TireEmitter;
//
maxDamage = 5.5;
destroyedLevel = 5.5;
HDAddMassLevel = 3.85;
HDMassImage = APCHDMassImage;
isShielded = false;
energyPerDamagePoint = 0;
maxEnergy = 600;
jetForce = 2800;
minJetEnergy = 60;
jetEnergyDrain = 0.1;
rechargeRate = 1.0;
jetSound = MPBThrustSound;
engineSound = MPBEngineSound;
squeelSound = AssaultVehicleSkid;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 5.0;
mediumSplashSoundVelocity = 8.0;
hardSplashSoundVelocity = 12.0;
exitSplashSoundVelocity = 8.0;
exitingWater = VehicleExitWaterSoftSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterHardSound;
waterWakeSound = VehicleWakeMediumSplashSound;
minMountDist = 10;
damageEmitter[0] = LightDamageSmoke;
damageEmitter[1] = MeHGHeavyDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "3.0 0.5 0.0 ";
damageEmitterOffset[1] = "-3.0 0.5 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDGroundMPBIcon;
cmdMiniIconName = "commander/MiniIcons/com_mpb_grey";
targetNameTag = 'Grendel';
targetTypeTag = 'Heavy Artillery';
sensorData = PlayerSensor;
checkRadius = 7.5225;
observeParameters = "1 12 12";
runningLight[0] = MPBLight1;
runningLight[1] = MPBLight2;
shieldEffectScale = "0.85 1.2 0.7";
max[MortarAmmo] = 12;
replaceTime = 60;
};
//---------------------------------------------
// Weapon Stuff
//---------------------------------------------
datablock TurretData(ArtilleryTurret) : TankDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "turret_base_large.dts";
preload = true;
canControl = false;
cmdCategory = "Tactical";
cmdIcon = CMDGroundTankIcon;
cmdMiniIconName = "commander/MiniIcons/com_tank_grey";
targetNameTag = 'Artillery';
targetTypeTag = 'Turret';
mass = 1.0; // Not really relevant
maxEnergy = 1000;
maxDamage = Artillery.maxDamage;
destroyedLevel = Artillery.destroyedLevel;
repairRate = 0;
// capacitor
maxCapacitorEnergy = 100;
capacitorRechargeRate = 1.5;
thetaMin = 30;
thetaMax = 100;
inheritEnergyFromMount = true;
firstPersonOnly = true;
useEyePoint = true;
numWeapons = 1;
cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;
targetNameTag = 'APC CG';
targetTypeTag = 'Turret';
max[MortarAmmo] = 12;
};
datablock GrenadeProjectileData(ArtilleryShot)
{
projectileShapeName = "grenade_projectile.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 3.5;
damageRadius = 25.0;
radiusDamageType = $DamageType::Artillery;
kickBackStrength = 4000;
explosion = "artillerybarrelexplosion";
velInheritFactor = 0.0;
splash = GrenadeSplash;
baseEmitter = TankArtillerySmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.0;
grenadeFriction = 0.3;
armingDelayMS = -1;
gravityMod = 1.0;
muzzleVelocity = 225.0;
drag = 0.1;
sound = MortarTurretProjectileSound;
hasLight = true;
lightRadius = 3;
lightColor = "0.05 0.2 0.05";
};
datablock GrenadeProjectileData(ClusterSubProj)
{
projectileShapeName = "grenade.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 0.5;
damageRadius = 12.0;
radiusDamageType = $DamageType::Artillery;
kickBackStrength = 2000;
explosion = "ClusterSubExplosion";
underwaterExplosion = "GrenadeExplosion";
velInheritFactor = 0.5;
splash = MissileSplash;
depthTolerance = 0.01;
baseEmitter = TankArtillerySmokeEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
grenadeElasticity = 0.0;
grenadeFriction = 0.0;
armingDelayMS = -1;
gravityMod = 1.0;
muzzleVelocity = 225.0;
drag = 0.2;
sound = MortarTurretProjectileSound;
hasLight = true;
lightRadius = 4;
lightColor = "0.05 0.2 0.05";
hasLightUnderwaterColor = true;
underWaterLightColor = "0.05 0.075 0.2";
};
datablock TurretImageData(ArtilleryBarrel)
{
className = WeaponImage;
shapeFile = "turret_tank_barrelmortar.dts";
item = MissileLauncher;
ammo = MortarAmmo;
projectile = ArtilleryShot;
projectileType = GrenadeProjectile;
offset = "0.5 0 0";
usesEnergy = false;
useMountEnergy = true;
fireEnergy = 0.0;
minEnergy = 0.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "WaitFire1";
stateTimeoutValue[0] = 1;
stateSequence[0] = "Activate";
stateName[1] = "WaitFire1";
stateTransitionOnTriggerDown[1] = "Fire1";
stateTransitionOnNoAmmo[1] = "NoAmmo1";
stateName[2] = "Fire1";
stateTransitionOnTimeout[2] = "Reload1";
stateTimeoutValue[2] = 2.0;
stateFire[2] = true;
stateEmitter[2] = "WhiteHorseHeatSeekerFireEffectEmitter";
stateEmitterNode[2] = "muzzlepoint1";
stateEmitterTime[2] = 1;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateSound[2] = AssaultMortarFireSound;
stateName[3] = "Reload1";
stateSequence[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateAllowImageChange[3] = false;
stateTransitionOnTimeout[3] = "WaitFire2";
stateTransitionOnNoAmmo[3] = "NoAmmo1";
stateName[4] = "NoAmmo1";
stateTransitionOnAmmo[4] = "AmmoLoading1";
stateSequence[4] = "NoAmmo1";
stateTransitionOnTriggerDown[4] = "DryFire1";
stateName[5] = "DryFire1";
stateSound[5] = BomberTurretDryFireSound;
stateTimeoutValue[5] = 0.75;
stateTransitionOnTimeout[5] = "NoAmmo1";
stateName[6] = "WaitFire2";
stateTransitionOnTriggerDown[6] = "Fire2";
stateTransitionOnNoAmmo[6] = "NoAmmo2";
stateName[7] = "Fire2";
stateTransitionOnTimeout[7] = "Reload2";
stateTimeoutValue[7] = 0.5;
stateScript[7] = "FirePair";
stateName[8] = "Reload2";
stateSequence[8] = "Reload";
stateTimeoutValue[8] = 4.0;
stateAllowImageChange[8] = false;
stateTransitionOnTimeout[8] = "WaitFire1";
stateTransitionOnNoAmmo[8] = "NoAmmo2";
stateName[9] = "NoAmmo2";
stateTransitionOnAmmo[9] = "AmmoLoading2";
stateSequence[9] = "NoAmmo2";
stateTransitionOnTriggerDown[9] = "DryFire2";
stateName[10] = "DryFire2";
stateSound[10] = BomberTurretDryFireSound;
stateTimeoutValue[10] = 0.75;
stateTransitionOnTimeout[10] = "NoAmmo2";
stateName[11] = "AmmoLoading1";
stateSound[11] = MissileReloadSound;
stateTimeoutValue[11] = 0.1;
stateAllowImageChange[11] = false;
stateTransitionOnTimeout[11] = "Reload1";
stateName[12] = "AmmoLoading2";
stateSound[12] = MissileReloadSound;
stateTimeoutValue[12] = 0.1;
stateAllowImageChange[12] = false;
stateTransitionOnTimeout[12] = "Reload2";
};
datablock TurretImageData(ArtilleryBarrel2)
{
className = WeaponImage;
shapeFile = "turret_tank_barrelmortar.dts";
item = MissileLauncher;
ammo = MortarAmmo;
projectile = ArtilleryShot;
projectileType = GrenadeProjectile;
offset = "-0.5 0 0";
usesEnergy = false;
useMountEnergy = true;
fireEnergy = 0.0;
minEnergy = 0.0;
stateName[0] = "WaitFire";
stateTransitionOnTriggerDown[0] = "Fire";
stateName[1] = "Fire";
stateTransitionOnTimeout[1] = "StopFire";
stateTimeoutValue[1] = 2.0;
stateFire[1] = true;
stateEmitter[1] = "WhiteHorseHeatSeekerFireEffectEmitter";
stateEmitterNode[1] = "muzzlepoint1";
stateEmitterTime[1] = 1;
stateAllowImageChange[1] = false;
stateSequence[1] = "Fire";
stateScript[1] = "onFire";
stateSound[1] = AssaultMortarFireSound;
stateName[2] = "StopFire";
stateTimeoutValue[2] = 0.1;
stateTransitionOnTimeout[2] = "WaitFire";
stateScript[2] = "stopFire";
};
datablock TurretImageData(ArtilleryParam)
{
mountPoint = 0;
shapeFile = "turret_muzzlepoint.dts";
offset = "0.0 1.0 0.0";
projectile = ArtilleryShot;
projectileType = GrenadeProjectile;
useCapacitor = false;
usesEnergy = true;
// Turret parameters
activationMS = 500;
deactivateDelayMS = 550;
thinkTimeMS = 200;
degPerSecTheta = 500;
degPerSecPhi = 500;
attackRadius = 225;
};
//---------------------------------------------
// Vehicle.cs stuff
//---------------------------------------------
function Artillery::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%obj.schedule(6000, "playThread", $ActivateThread, "activate");
%obj.selweapontype = 1;
%obj.firing = 0;
%turret = TurretData::create(ArtilleryTurret);
%turret.selectedWeapon = 1;
MissionCleanup.add(%turret);
%turret.team = %obj.teamBought;
%turret.setSelfPowered();
%obj.mountObject(%turret, 1);
%turret.mountImage(ArtilleryParam, 0);
%turret.mountImage(ArtilleryBarrel, 2);
%turret.mountImage(ArtilleryBarrel2, 3);
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%obj.turretObject = %turret;
%turret.setAutoFire(false);
%turret.setInventory(MortarAmmo, 10);
%turret.mountedto = %obj;
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
}
function Artillery::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(1);
if (!%turret)
return;
if (%client = %turret.getControllingClient())
{
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
}
%turret.schedule(1000, delete);
if(isObject(%obj.beacon))
%obj.beacon.schedule(50, delete);
}
function Artillery::playerMounted(%data, %obj, %player, %node)
{
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
if(%obj.firing == 1){
%turret = %obj.getMountNodeObject(1);
if (!%player.client.isAIControlled())
{
%player.setControlObject(%turret);
%player.client.setObjectActiveImage(%turret, 2);
}
}
commandToClient(%player.client, 'setHudMode', 'Pilot', "MPB", %node);
bottomPrint(%player.client, "Press Grenade button to switch to firing mode.", 5, 2 );
if ( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
}
//---------------------------------------------
// Weapon Stuff
//---------------------------------------------
function Artillery::onTrigger(%data, %obj, %trigger, %state)
{
%player = %obj.getMountNodeObject(0);
if(%trigger == 4)
{
switch (%state)
{
case 1:
%turret = %obj.getMountNodeObject(1);
if (!%player.client.isAIControlled())
{
%player.setControlObject(%turret);
%player.client.setObjectActiveImage(%turret, 2);
commandToClient(%player.client, 'setHudMode', 'Pilot', "Assault", 1);
}
%obj.firing = 1;
bottomPrint(%player.client, "Will need to be reloaded with Artillery Reloader Pack.", 5, 2 );
}
}
}
function ArtilleryTurret::onTrigger(%data, %obj, %trigger, %state)
{
switch (%trigger)
{
case 0:
%obj.fireTrigger = %state;
if(%state)
%obj.setImageTrigger(2, true);
else
%obj.setImageTrigger(2, false);
case 2:
if(%state)
%obj.getDataBlock().playerDismount(%obj);
case 4:
if(%state){
%client = %obj.getControllingClient();
if (!%client.isAIControlled())
%client.player.unmount();
%obj.mountedto.firing = 0;
}
}
}
function ArtilleryBarrel::firePair(%this, %obj, %slot){
%obj.setImageTrigger( 3, true);
}
function ArtilleryBarrel2::stopFire(%this, %obj, %slot){
%obj.setImageTrigger( 3, false);
}
function ArtilleryBarrel::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
if(%obj.mountedto.selweapontype == 2)
%p.cluster = schedule(1000, %p, "ARTdocluster", %p, %slot, %obj, 0);
}
function ArtilleryBarrel2::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
if(%obj.mountedto.selweapontype == 2)
%p.cluster = schedule(1000, %p, "ARTdocluster", %p, %slot, %obj, 0);
}
function ArtilleryTurret::playerDismount(%data, %obj)
{
//Passenger Exiting
%obj.fireTrigger = 0;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
%client = %obj.getControllingClient();
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
setTargetSensorGroup(%obj.getTarget(), 0);
setTargetNeverVisMask(%obj.getTarget(), 0xffffffff);
}
function ARTdocluster(%proj,%slot,%obj,%pos2){
%pos = %proj.getPosition();
if(%pos2 != 0){
%vec = vectorNormalize(vectorSub(%pos,%pos2));
%newvec = vectorscale(%vec, 380);
%newvec = vectoradd(%pos,%newvec);
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType;
%searchresult = containerRayCast(%pos, %newvec, %mask);
if(%searchresult){
for (%i=0; %i < 45; %i++)
{
%x = (getRandom() - 0.5) * 2 * 3.1415926 * 0.025;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * 0.013;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * 0.03;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%newvector = MatrixMulVector(%mat, %vec);
%newvector = vectorScale(%newvector, (getRandom() + 0.5));
%p = new GrenadeProjectile()
{
dataBlock = ClusterSubProj;
initialDirection = %newvector;
initialPosition = %pos;
sourceObject = %obj;
damageFactor = 1;
sourceSlot = %slot;
};
}
%proj.delete();
return;
}
}
%pos2 = %pos;
%proj.cluster = schedule(100, %proj, "ARTdocluster", %proj, %slot, %obj, %pos2);
}

View file

@ -0,0 +1,449 @@
$missile::maxturnspeed = 220;
$missile::maxforwardspeed = 900;
datablock TracerProjectileData(CGM_exp)
{
doDynamicClientHits = true;
directDamage = 0.0;
directDamageType = $DamageType::MissileTurret;
explosion = "artillerybarrelexplosion";
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 5.5;
damageRadius = 45.0;
radiusDamageType = $DamageType::MissileTurret;
kickBackStrength = 500;
sound = ChaingunProjectile;
dryVelocity = 1.0;
wetVelocity = 1.0;
velInheritFactor = 1.0;
fizzleTimeMS = 32;
lifetimeMS = 33;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 1;
tracerLength = 1.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.35;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
datablock FlyingVehicleData(CGmissile) : ShrikeDamageProfile
{
spawnOffset = "0 0 2";
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_grav_scout.dts";
multipassenger = false;
computeCRC = true;
debrisShapeName = "vehicle_grav_scout.dts";
debris = MeShapeDebris;
renderWhenDestroyed = false;
drag = 0.15;
density = 1.0;
numMountPoints = 0;
cameraMaxDist = 15;
cameraOffset = 2.5;
cameraLag = 0.9;
explosion = MeVehicleExplosion;
explosionDamage = 1.0;
explosionRadius = 20.0;
maxDamage = 0.5;
destroyedLevel = 0.5;
HDAddMassLevel = 0.4;
HDMassImage = ShrikeHDMassImage;
isShielded = false;
energyPerDamagePoint = 0;
maxEnergy = 280; // Afterburner and any energy weapon pool
rechargeRate = 0.8;
minDrag = 30; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 900; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 10000; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 200; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 0; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 1.0; // Dampen control input so you don't` whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 4.5; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 6; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 4; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 5250; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 600; // Steering jets (force applied when you move the mouse)
steeringRollForce = 3000; // Steering jets (how much you heel over when you turn)
rollForce = 1; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 1; // Height off the ground at rest
createHoverHeight = 1; // Height off the ground when created
maxForwardSpeed = 130; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 2500; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 28; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 0.1; // Energy use of the afterburners (low number is less drain...can be fractional) // Auto stabilize speed
vertThrustMultiple = 1.25;
// Rigid body
mass = 150; // Mass of the vehicle
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't mess with this.
softImpactSpeed = 14; // Sound hooks. This is the soft hit.
hardImpactSpeed = 25; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 20; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
//
minTrailSpeed = 150; // The speed your contrail shows up at.
trailEmitter = ContrailEmitter;
forwardJetEmitter = FlyerJetEmitter;
downJetEmitter = FlyerJetEmitter;
//
jetSound = ScoutFlyerThrustSound;
engineSound = ScoutFlyerThrustSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 15.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 1.0;
damageEmitter[0] = MissileSmokeEmitter;
damageEmitter[1] = MeHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "0.0 -0.3 0.0 ";
damageLevelTolerance[0] = 0.0;
damageLevelTolerance[1] = 0.75;
numDmgEmitterAreas = 1;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
targetNameTag = 'TomaHawk';
targetTypeTag = 'Cruise Missile';
sensorData = PlayerSensor;
checkRadius = 5.5;
observeParameters = "1 10 10";
runningLight[0] = ShrikeLight1;
shieldEffectScale = "0.937 1.125 0.60";
};
datablock TurretData(CGMTurret) : TurretDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "turret_base_large.dts";
preload = true;
canControl = false;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingBomberIcon;
cmdMiniIconName = "commander/MiniIcons/com_bomber_grey";
mass = 1.0; // Not really relevant
repairRate = 0;
maxDamage = CGmissile.maxDamage;
destroyedLevel = CGmissile.destroyedLevel;
thetaMin = 1;
thetaMax = 180;
thetaNull = 90;
// capacitor
maxCapacitorEnergy = 200;
capacitorRechargeRate = 5.0;
inheritEnergyFromMount = true;
firstPersonOnly = true;
useEyePoint = true;
numWeapons = 1;
targetNameTag = 'CGM';
targetTypeTag = 'Turret';
};
datablock TurretImageData(CGMTL)
{
className = WeaponImage;
shapeFile = "turret_muzzlepoint.dts";
offset = "0 0 0";
mountPoint = 1;
projectile = GunshipTlProj;
projectileType = TargetProjectile;
deleteLastProjectile = false;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = false;
minEnergy = 0;
fireEnergy = 1.0;
stateName[0] = "Activate";
stateSequence[0] = "Activate";
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateName[2] = "Fire";
stateEnergyDrain[2] = 0;
stateFire[2] = true;
stateScript[2] = "onFire";
stateTransitionOnTriggerUp[2] = "Deconstruct";
stateName[3] = "Deconstruct";
stateScript[3] = "onDecon";
stateTimeoutValue[3] = 0.1;
stateTransitionOnTimeout[3] = "Ready";
};
datablock StaticShapeData(TMShape) : StaticShapeDamageProfile {
shapeFile = "weapon_missile_projectile.dts";
mass = 1.0;
repairRate = 0;
dynamicType = $TypeMasks::StaticShapeObjectType;
heatSignature = 0;
};
function CGMTL::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%p.setTarget(%obj.team);
%obj.TL = %p;
CGMfollowloop(%obj.vehicleMounted);
schedule(1000, 0, 'CGMExplode', %obj.vehicleMounted);
}
function CGMTL::onDecon(%data,%obj,%slot){
%obj.TL.delete();
}
function CGmissile::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.schedule(5500, "playThread", $ActivateThread, "activate");
%turret = TurretData::create(CGMTurret);
MissionCleanup.add(%turret);
%turret.team = %obj.teamBought;
%turret.selectedWeapon = 1;
%turret.setSelfPowered();
%obj.mountObject(%turret, 10);
%turret.mountImage(AIAimingTurretBarrel, 0);
%turret.mountImage(CGMTL, 2);
%turret.setImageTrigger(2, true);
%obj.turretObject = %turret;
%turret.vehicleMounted = %obj;
%turret.setAutoFire(false);
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
%obj.startFade(0,10,1);
%turret.startFade(10,20,1);
%body = new StaticShape()
{
scale = "5 5 5";
dataBlock = "TMShape";
};
MissionCleanup.add(%body);
%obj.mountObject(%body, 1);
%body.vehicleMounted = %obj;
}
function startCGM(%p){
if(!isObject(%p))
return;
%data = "CGmissile";
%pn = %data.create(0);
%pn.setTransform(%p.getPosition() SPC "1 0 0 -90");
%pn.CGMsourceObject = %p.sourceObject;
%pn.CGMsourceSlot = %p.sourceSlot;
%pn.applyImpulse(%pn.getPosition(),vectorScale(%p.sourceObject.vehicleObject.getVelocity(),%data.mass));
MissionCleanup.add(%pn);
%client = %p.sourceObject.getControllingClient();
if (!%client.isAIControlled())
{
%client.player.setControlObject(%pn.turretObject);
%client.player.client.setObjectActiveImage(%pn.turretObject, 2);
}
%p.delete();
}
function CGMfollowloop(%obj){
if(!isObject(%obj))
return;
if(!isObject(%obj.turretObject.TL))
return;
%pos = %obj.getPosition();
%targetpos = %obj.turretObject.TL.getTargetPoint();
if(%targetpos $= "0 0 0 -1"){
%Tpos = %obj.turretObject.getPosition();
%Tvec = vectorScale(%obj.turretObject.getMuzzleVector(2),1500);
%targetpos = vectorAdd(%Tpos,%Tvec);
}
%frontvec = %obj.getForwardVector();
%vector = vectorNormalize(vectorSub(%targetpos,%pos));
%obj.applyImpulse(vectorAdd(%pos,%frontvec),vectorScale(%vector,$missile::maxturnspeed)); //make it turn toward Target
%obj.applyImpulse(%pos,vectorScale(%frontvec,$missile::maxforwardspeed)); //make it go forward
%obj.following = schedule(100, 0, "CGMfollowloop", %obj);
}
function CGMExplode(%obj){
if(!isObject(%obj))
return;
InitContainerRadiusSearch(%obj.getWorldBoxCenter(), 15, $TypeMasks::VehicleObjectType);
while ((%SearchResult = containerSearchNext()) != 0)
{
if(%searchObj !$= %obj){
%pn = new (TracerProjectile)() {
dataBlock = CGM_exp;
initialDirection = vectorNormalize(%obj.getVelocity());
initialPosition = %obj.getWorldBoxCenter();
sourceObject = %obj.CGMsourceObject;
sourceSlot = %obj.CGMsourceSlot;
};
MissionCleanup.add(%pn);
return;
}
}
%obj.doexplodecheck = schedule(30, 0, "CGMExplode", %obj);
}
function CGmissile::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(10);
if (isObject(%turret)){
%turret.altTrigger = 0;
%turret.fireTrigger = 0;
if (%client = %turret.getControllingClient())
{
if(isObject(%obj.CGMSourceObject)){
%client.player.setControlObject(%obj.CGMSourceObject);
%obj.CGMSourceObject.selectedWeapon = 1;
commandToClient(%client,'SetWeaponryVehicleKeys', true);
commandToClient(%client, 'setHudMode', 'Pilot', "bomber", %node);
} else {
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
%client.player.bomber = false;
%client.player.isBomber = false;
}
}
%turret.schedule(2000, delete);
if(isObject(%turret.TL))
%turret.TL.delete();
}
%body = %obj.getMountNodeObject(1);
if (isObject(%body))
%body.schedule(2000, delete);
%pn = new (TracerProjectile)() {
dataBlock = CGM_exp;
initialDirection = "0 0 1";
initialPosition = %obj.getWorldBoxCenter();
sourceObject = %obj.CGMsourceObject;
sourceSlot = %obj.CGMsourceSlot;
};
MissionCleanup.add(%pn);
}
function CGmissile::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

View file

@ -0,0 +1,525 @@
//**************************************************************
// Long Range Artillery
//**************************************************************
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock HoverVehicleData(CGTank) : TankDamageProfile
{
spawnOffset = "0 0 4";
floatingGravMag = 4.5;
catagory = "Vehicles";
shapeFile = "vehicle_grav_tank.dts";
multipassenger = true;
computeCRC = true;
renderWhenDestroyed = false;
weaponNode = 1;
debrisShapeName = "vehicle_grav_tank.dts";
debris = GShapeDebris;
drag = 0.0;
density = 0.9;
mountPose[0] = sitting;
mountPose[1] = sitting;
numMountPoints = 2;
isProtectedMountPoint[0] = true;
isProtectedMountPoint[1] = false;
cameraMaxDist = 20;
cameraOffset = 3;
cameraLag = 1.5;
explosion = HGVehicleExplosion;
explosionDamage = 1.5;
explosionRadius = 25.0;
maxSteeringAngle = 0.5; // 20 deg.
maxDamage = 3.2;
destroyedLevel = 3.2;
HDAddMassLevel = 2.24;
HDMassImage = TankHDMassImage;
isShielded = false;
rechargeRate = 1.0;
energyPerDamagePoint = 300;
maxEnergy = 400;
minJetEnergy = 15;
jetEnergyDrain = 2.0;
// Rigid Body
mass = 4000;
bodyFriction = 0.8;
bodyRestitution = 0.5;
minRollSpeed = 3;
gyroForce = 400;
gyroDamping = 0.3;
stabilizerForce = 20;
minDrag = 10;
softImpactSpeed = 15; // Play SoftImpact Sound
hardImpactSpeed = 18; // Play HardImpact Sound
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 17;
speedDamageScale = 0.060;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 18;
collDamageMultiplier = 0.045;
dragForce = 40 / 20;
vertFactor = 0.0;
floatingThrustFactor = 0.15;
mainThrustForce = 40;
reverseThrustForce = 25;
strafeThrustForce = 25;
turboFactor = 1.7;
brakingForce = 25;
brakingActivationSpeed = 4;
stabLenMin = 3.25;
stabLenMax = 4;
stabSpringConstant = 50;
stabDampingConstant = 20;
gyroDrag = 20;
normalForce = 20;
restorativeForce = 10;
steeringForce = 15;
rollForce = 5;
pitchForce = 3;
dustEmitter = TankDustEmitter;
triggerDustHeight = 3.5;
dustHeight = 1.0;
dustTrailEmitter = TireEmitter;
dustTrailOffset = "0.0 -1.0 0.5";
triggerTrailHeight = 3.6;
dustTrailFreqMod = 15.0;
jetSound = AssaultVehicleThrustSound;
engineSound = AssaultVehicleEngineSound;
floatSound = AssaultVehicleSkid;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
wheelImpactSound = WheelImpactSound;
forwardJetEmitter = TankJetEmitter;
//
softSplashSoundVelocity = 5.0;
mediumSplashSoundVelocity = 10.0;
hardSplashSoundVelocity = 15.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
minMountDist = 7;
damageEmitter[0] = SmallLightDamageSmoke;
damageEmitter[1] = MeHGHeavyDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "0.0 -1.5 3.5 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 1;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDGroundTankIcon;
cmdMiniIconName = "commander/MiniIcons/com_tank_grey";
targetNameTag = 'Bannshe 50mm';
targetTypeTag = 'chaingun tank';
sensorData = PlayerSensor;
checkRadius = 5.5535;
observeParameters = "1 10 10";
runningLight[0] = TankLight1;
runningLight[1] = TankLight2;
runningLight[2] = TankLight3;
runningLight[3] = TankLight4;
shieldEffectScale = "0.9 1.0 0.6";
showPilotInfo = 1;
replaceTime = 30;
};
//**************************************************************
// WEAPONS
//**************************************************************
datablock TracerProjectileData(BigBullet)
{
doDynamicClientHits = true;
directDamage = 0.4;
directDamageType = $DamageType::TankChaingun;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
kickBackStrength = 2000.0;
sound = ChaingunProjectile;
dryVelocity = 4000.0; // z0dd - ZOD, 8-12-02. Was 1000.0
wetVelocity = 1600.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 1000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 25.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.25;
crossSize = 0.25;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = MG42Decal1;
decalData[1] = MG42Decal2;
decalData[2] = MG42Decal3;
decalData[3] = MG42Decal4;
decalData[4] = MG42Decal5;
decalData[5] = MG42Decal6;
};
//-------------------------------------
// Artillery CHAINGUN CHARACTERISTICS
//-------------------------------------
datablock TurretImageData(CGTurretParam)
{
mountPoint = 2;
shapeFile = "turret_muzzlepoint.dts";
projectile = BigBullet;
projectileType = TracerProjectile;
useCapacitor = true;
usesEnergy = true;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 500;
degPerSecPhi = 500;
attackRadius = 750;
};
datablock TurretData(CGTurret) : TurretDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "Turret_tank_base.dts";
preload = true;
canControl = false;
cmdCategory = "Tactical";
cmdIcon = CMDGroundTankIcon;
cmdMiniIconName = "commander/MiniIcons/com_tank_grey";
targetNameTag = 'Bannshe';
targetTypeTag = '50mm chaingun turret';
mass = 1.0;
maxEnergy = 1;
maxDamage = CGTank.maxDamage;
destroyedLevel = CGTank.destroyedLevel;
repairRate = 0;
// capacitor
maxCapacitorEnergy = 1000;
capacitorRechargeRate = 10.0;
thetaMin = 0;
thetaMax = 100;
inheritEnergyFromMount = true;
firstPersonOnly = true;
useEyePoint = true;
cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;
targetNameTag = '50mm chaingun';
targetTypeTag = 'Turret';
};
datablock TurretImageData(CGTurretBarrel)
{
shapeFile = "turret_tank_barrelchain.dts";
mountPoint = 1;
projectile = BigBullet;
projectileType = TracerProjectile;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 15.0;
shellVelocity = 3.0;
projectileSpread = 1.5 / 1000.0;
useCapacitor = true;
usesEnergy = true;
useMountEnergy = true;
fireEnergy = 0.75;
minEnergy = 1.0;
// Turret parameters
activationMS = 2000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 360;
degPerSecPhi = 360;
attackRadius = 75;
// State transitions
stateName[0] = "Activate";
stateTransitionOnNotLoaded[0] = "Dead";
stateTransitionOnLoaded[0] = "ActivateReady";
stateSound[0] = AssaultTurretActivateSound;
stateName[1] = "ActivateReady";
stateSequence[1] = "Activate";
stateSound[1] = AssaultTurretActivateSound;
stateTimeoutValue[1] = 0.1;
stateTransitionOnTimeout[1] = "Ready";
stateTransitionOnNotLoaded[1] = "Deactivate";
stateName[2] = "Ready";
stateTransitionOnNotLoaded[2] = "Deactivate";
stateTransitionOnTriggerDown[2] = "Fire";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateName[3] = "Fire";
stateSequence[3] = "Fire";
stateSequenceRandomFlash[3] = true;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSound[3] = AssaultChaingunFireSound;
stateScript[3] = "onFire";
stateTimeoutValue[3] = 0.1;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Reload";
stateTransitionOnNoAmmo[3] = "noAmmo";
stateName[4] = "Reload";
stateSequence[4] = "Reload";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateTransitionOnTimeout[4] = "Ready";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateWaitForTimeout[4] = true;
stateName[5] = "Deactivate";
stateSequence[5] = "Activate";
stateDirection[5] = false;
stateTimeoutValue[5] = 0.1;
stateTransitionOnTimeout[5] = "ActivateReady";
stateName[6] = "Dead";
stateTransitionOnLoaded[6] = "ActivateReady";
stateTransitionOnTriggerDown[6] = "DryFire";
stateName[7] = "DryFire";
stateSound[7] = AssaultChaingunFireSound;
stateTimeoutValue[7] = 1.0;
stateTransitionOnTimeout[7] = "NoAmmo";
stateName[8] = "NoAmmo";
stateTransitionOnAmmo[8] = "Reload";
stateSequence[8] = "NoAmmo";
stateTransitionOnTriggerDown[8] = "DryFire";
};
datablock TurretImageData(CGTurretBarrel2) : CGTurretBarrel
{
mountPoint = 0;
};
function CGTank::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
%turret = TurretData::create(CGTurret);
%turret.selectedWeapon = 1;
MissionCleanup.add(%turret);
%turret.team = %obj.teamBought;
%turret.setSelfPowered();
%obj.mountObject(%turret, 10);
%turret.mountImage(CGTurretBarrel, 2);
%turret.mountImage(CGTurretBarrel2, 3);
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%obj.turretObject = %turret;
//vehicle turrets should not auto fire at targets
%turret.setAutoFire(false);
//Needed so we can set the turret parameters..
%turret.mountImage(CGTurretParam, 0);
%obj.schedule(6000, "playThread", $ActivateThread, "activate");
// set the turret's target info
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
}
function CGTank::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(10);
if (!%turret)
return;
if (%client = %turret.getControllingClient())
{
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
}
%turret.schedule(2000, delete);
}
function CGTank::playerMounted(%data, %obj, %player, %node)
{
if (%node == 0)
{
commandToClient(%player.client, 'setHudMode', 'Pilot', "Assault", %node);
}
else if (%node == 1)
{
%turret = %obj.getMountNodeObject(10);
%player.vehicleTurret = %turret;
%player.setTransform("0 0 0 0 0 1 0");
%player.lastWeapon = %player.getMountedImage($WeaponSlot);
%player.unmountImage($WeaponSlot);
if (!%player.client.isAIControlled())
{
%player.setControlObject(%turret);
%player.client.setObjectActiveImage(%turret, 2);
}
%turret.turreteer = %player;
$aWeaponActive = 0;
commandToClient(%player.client, 'setHudMode', 'Pilot', "Assault", %node);
}
if ( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
%passString = buildPassengerString(%obj);
for(%i = 0; %i < %data.numMountPoints; %i++)
if (%obj.getMountNodeObject(%i) > 0)
commandToClient(%obj.getMountNodeObject(%i).client, 'checkPassengers', %passString);
}
function CGTurret::onDamage(%data, %obj)
{
%newDamageVal = %obj.getDamageLevel();
if(%obj.lastDamageVal !$= "")
if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
%obj.getObjectMount().setDamageLevel(%newDamageVal);
%obj.lastDamageVal = %newDamageVal;
}
function CGTurret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
{
//If vehicle turret is hit then apply damage to the vehicle
%vehicle = %targetObject.getObjectMount();
if(%vehicle)
%vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
}
function CGTurret::onTrigger(%data, %obj, %trigger, %state)
{
switch (%trigger)
{
case 0:
%obj.fireTrigger = %state;
if(%state)
{
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(3, true);
}
else
{
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
}
case 2:
if(%state)
%obj.getDataBlock().playerDismount(%obj);
}
}
function CGTurret::playerDismount(%data, %obj)
{
%obj.fireTrigger = 0;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
%client = %obj.getControllingClient();
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
setTargetSensorGroup(%obj.getTarget(), 0);
setTargetNeverVisMask(%obj.getTarget(), 0xffffffff);
}
function CGTank::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

View file

@ -0,0 +1,410 @@
//**************************************************************
// Drop Pod
//**************************************************************
datablock AudioProfile(DropPodThrustSound)
{
filename = "fx/vehicles/shrike_boost.wav";
description = AudioDefault3d;
preload = true;
effect = ScoutFlyerThrustEffect;
};
datablock WheeledVehicleData(DropPod) : MPBDamageProfile
{
spawnOffset = "0 0 1.0";
renderWhenDestroyed = false;
canControl = true;
catagory = "Vehicles";
shapeFile = "stackable2l.dts";
multipassenger = false;
computeCRC = true;
debrisShapeName = "stackable2l.dts";
debris = GShapeDebris;
drag = 0.0;
density = 20.0;
mountPose[0] = sitting;
numMountPoints = 1;
isProtectedMountPoint[0] = true;
cameraMaxDist = 20;
cameraOffset = 6;
cameraLag = 1.5;
explosionDamage = 0.0;
explosionRadius = 0.0;
maxSteeringAngle = 0.3; // 20 deg.
// Used to test if the station can deploy
stationPoints[1] = "-2.3 -7.38703 -0.65";
stationPoints[2] = "-2.3 -11.8 -0.65";
stationPoints[3] = "0 -7.38703 -0.65";
stationPoints[4] = "0 -11.8 -0.65";
stationPoints[5] = "2.3 -7.38703 -0.65";
stationPoints[6] = "2.3 -11.8 -0.65";
// Rigid Body
mass = 1000;
bodyFriction = 0.8;
bodyRestitution = 0.5;
minRollSpeed = 3;
gyroForce = 400;
gyroDamping = 0.3;
stabilizerForce = 10;
minDrag = 10;
softImpactSpeed = 15; // Play SoftImpact Sound
hardImpactSpeed = 25; // Play HardImpact Sound
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 24;
speedDamageScale = 0.025;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 15;
collDamageMultiplier = 0.03;
// Engine
engineTorque = 0 * 745;
breakTorque = 0 * 745;
maxWheelSpeed = 10;
// Springs
springForce = 8000;
springDamping = 1300;
antiSwayForce = 6000;
staticLoadScale = 2;
// Tires
tireRadius = 1.6;
tireFriction = 10.0;
tireRestitution = 0.5;
tireLateralForce = 3000;
tireLateralDamping = 400;
tireLateralRelaxation = 1;
tireLongitudinalForce = 12000;
tireLongitudinalDamping = 600;
tireLongitudinalRelaxation = 1;
tireEmitter = TireEmitter;
//
maxDamage = 2.0;
destroyedLevel = 2.0;
HDAddMassLevel = 1.5;
HDMassImage = WCHDMassImage;
isShielded = false;
energyPerDamagePoint = 125;
maxEnergy = 600;
jetForce = 0;
minJetEnergy = 60;
jetEnergyDrain = 0;
rechargeRate = 1.0;
jetSound = MPBThrustSound;
engineSound = MPBEngineSound;
squeelSound = AssaultVehicleSkid;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 5.0;
mediumSplashSoundVelocity = 8.0;
hardSplashSoundVelocity = 12.0;
exitSplashSoundVelocity = 8.0;
exitingWater = VehicleExitWaterSoftSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterHardSound;
waterWakeSound = VehicleWakeMediumSplashSound;
minMountDist = 3;
damageEmitter[0] = SmallLightDamageSmoke;
damageEmitter[1] = SmallHeavyDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "3.0 0.5 0.0 ";
damageEmitterOffset[1] = "-3.0 0.5 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDGroundMPBIcon;
cmdMiniIconName = "commander/MiniIcons/com_mpb_grey";
targetNameTag = 'Drop';
targetTypeTag = 'Pod';
sensorData = VehiclePulseSensor;
checkRadius = 7.5225;
observeParameters = "1 12 12";
runningLight[0] = MPBLight1;
runningLight[1] = MPBLight2;
shieldEffectScale = "0.85 1.2 0.7";
replaceTime = 1;
};
datablock ParticleData(DropPodParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.02;
inheritedVelFactor = 1.0;
lifetimeMS = 4000;
lifetimeVarianceMS = 500;
textureName = "special/Smoke/bigSmoke";
useInvAlpha = true;
spinRandomMin = -90.0;
spinRandomMax = 90.0;
colors[0] = "0.8 0.4 0.1 0.5";
colors[1] = "0.6 0.2 0.2 0.4";
colors[2] = "0.4 0.4 0.4 0.0";
colors[3] = "0.4 0.4 0.4 0.3";
colors[4] = "0.5 0.5 0.5 0.3";
colors[5] = "0.6 0.6 0.6 0.0";
sizes[0] = 1;
sizes[1] = 1.75;
sizes[2] = 0;
sizes[3] = 5;
sizes[4] = 6;
sizes[5] = 8;
times[0] = 0.0;
times[1] = 0.05;
times[2] = 0.1;
times[3] = 0.15;
times[4] = 0.7;
times[5] = 1.0;
};
datablock ParticleEmitterData(DropPodEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 35;
velocityVariance = 10;
thetaMin = 175.0;
thetaMax = 180.0;
particles = "DropPodParticle";
};
function MakeDropPod(%pos, %team){
%pod = new WheeledVehicle()
{
dataBlock = DropPod;
position = %pos;
rotation = "0 0 1 0";
team = %team;
};
MissionCleanUp.add(%pod);
return %pod;
}
function DropPod::playerMounted(%data, %obj, %player, %node)
{
centerPrint(%player.client, "<font:Impact:20><color:ffffff>WARNING: Do not eject out of the drop pod while it is in flight. \n<font:Hey:15>Use /SetCoord and /LaunchPod to launch the Drop Pod to a desired location.", 9, 3 );
if( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
}
function DropPod::deleteAllMounted(%data, %obj)
{
if(%veh.beacon){
%veh.beacon.delete();
%veh.beacon = "";
}
}
function ccSetCoord(%sender, %args){
if(!isObject(%sender.player))
return;
%plyr = %sender.player;
if(%args $= ""){
messageclient(%sender, 'MsgClient', "\c2Coordinates must be specified.");
}
if(%plyr.mountedToV){
%veh = %plyr.VmountedTo;
if(%veh.getDataBlock().getName() $= "DropPod"){
%veh.DPcoord = getWord(%args, 0)@" "@getWord(%args, 1);
messageclient(%sender, 'MsgClient', "\c2Drop Pod coordinates set to\c3 "@%veh.DPcoord@"");
%search = containerRayCast(%veh.DPcoord@" 10000",%veh.DPcoord@" -100",$TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType, %veh);
%pos = getWords(%search,1,3);
echo(%pos);
if(%veh.beacon)
{
%veh.beacon.delete();
%veh.beacon = "";
}
%veh.beacon = new BeaconObject() {
dataBlock = "TargeterBeacon";
beaconType = "vehicle";
position = %pos;
};
%veh.beacon.playThread($AmbientThread, "ambient");
%veh.beacon.team = %plyr.team;
%veh.beacon.sourceObject = %veh;
// give it a team target
%veh.beacon.setTarget(%plyr.team);
MissionCleanup.add(%veh.beacon);
%sender.camera.setOrbitMode(%veh.beacon, %pos, 0.5, 10, 10);
%sender.camera.targetObj = %veh.beacon;
%sender.setControlObject( %sender.camera );
%sender.schedule(4000, "setControlObject", %plyr);
}
else
messageclient(%sender, 'MsgClient', '\c2You are not in a Drop Pod.');
}
else
messageclient(%sender, 'MsgClient', '\c2You are not in a Drop Pod.');
}
function ccLaunchPod(%sender, %args){
if(!isObject(%sender.player))
return;
%plyr = %sender.player;
if(%plyr.mountedToV){
%veh = %plyr.VmountedTo;
if(%veh.getDataBlock().getName() $= "DropPod"){
if(%veh.DPcoord !$= "")
launchDropPod(%veh);
else
messageclient(%sender, 'MsgClient', '\c2Please set the coordinates at which you wish to land with\c3 /SetCoord\c2.');
}
else
messageclient(%sender, 'MsgClient', '\c2You are not in a Drop Pod.');
}
else
messageclient(%sender, 'MsgClient', '\c2You are not in a Drop Pod.');
}
function launchDropPod(%obj){
if(!isObject(%obj))
return;
%vel = %obj.getVelocity();
if(vectorLen(%vel) < 200){
%obj.applyImpulse(%obj.getPosition(),vectorScale("0 0 1",(3.5 * %obj.getDatablock().mass)));
%charge = new ParticleEmissionDummy()
{
position = %obj.getPosition();
rotation = %obj.getRotation();
dataBlock = "defaultEmissionDummy";
emitter = "DropPodEmitter";
};
MissionCleanup.add(%charge);
%charge.schedule(100, "delete");
serverPlay3d("DropPodThrustSound",%obj.getPosition());
}
%z = getWord(%obj.getPosition(),2);
if(%z >= 10000){
%dist = vectorDist(%obj.DPcoord@" "@%z,%obj.getPosition());
%obj.setTransform(%obj.DPcoord@" "@%z@" 0 0 1 0");
%obj.setFrozenState(true);
%obj.schedule((%dist / 100) * 500,"setFrozenState",false);
schedule((%dist / 100) * 500, 0, "slowDropPod", %obj);
return;
}
if(vectorDist(%obj.getUpVector(),"0 0 1") >= 0.1){
%upvec = %obj.getUpVector();
%vec = vectorSub("0 0 1",%upvec);
%vec = vectorCross(%vec,%upvec);
%vec = vectorNormalize(vectorCross(%upvec,%vec));
%pos = vectorAdd(%obj.getPosition(),vectorScale(%upvec,(0.1 * %obj.getDatablock().mass)));
%obj.applyImpulse(%pos,%vec);
}
schedule(100, 0, "launchDropPod", %obj);
}
function slowDropPod(%obj){
if(!isObject(%obj))
return;
%vel = %obj.getVelocity();
if(%obj.slwspeed $= ""){
%Aresult = containerRayCast(%obj.getPosition(), vectorAdd(%obj.getPosition(),"0 0 -10000"), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType, 0);
%Avec = vectorSub(getWord(%Aresult,1)@" "@getWord(%Aresult,2)@" "@getWord(%Aresult,3),%obj.getPosition());
%obj.slwspeed = 3.0 + (mSqrt(vectorLen(%Avec)) / 18);
}
if(%obj.slowingdown != 1){
%result = containerRayCast(%obj.getPosition(), vectorAdd(%obj.getPosition(),vectorScale(%vel,3)), $TypeMasks::StaticShapeObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::TerrainObjectType, 0);
if(%result)
%obj.slowingdown = 1;
}
if(%obj.slowingdown == 1){
if(vectorLen(%vel) > 20){
%obj.applyImpulse(%obj.getPosition(),vectorScale("0 0 1",(%obj.slwspeed * %obj.getDatablock().mass)));
%charge = new ParticleEmissionDummy()
{
position = %obj.getPosition();
rotation = %obj.getRotation();
dataBlock = "defaultEmissionDummy";
emitter = "DropPodEmitter";
};
MissionCleanup.add(%charge);
%charge.schedule(100, "delete");
serverPlay3d("DropPodThrustSound",%obj.getPosition());
}
else if(getWord(%vel,2) > -5){
DropPodDismount(%obj);
return;
}
}
if(vectorDist(%obj.getUpVector(),"0 0 1") >= 0.1){
%upvec = %obj.getUpVector();
%vec = vectorSub("0 0 1",%upvec);
%vec = vectorCross(%vec,%upvec);
%vec = vectorNormalize(vectorCross(%upvec,%vec));
%pos = vectorAdd(%obj.getPosition(),vectorScale(%upvec,(0.1 * %obj.getDatablock().mass)));
%obj.applyImpulse(%pos,%vec);
}
schedule(100, 0, "slowDropPod", %obj);
}
function DropPodDismount(%obj){
if(!isObject(%obj))
return;
if(isObject(%obj.getMountNodeObject(0))){
%passenger = %obj.getMountNodeObject(0);
%passenger.unmount();
%pos = %obj.getPosition();
for(%i = 0; %i < 3; %i++){
%x = getWord(%pos, 0) + getRandom(3,8);
%y = getWord(%pos, 1) + getRandom(3,8);
%z = getWord(%pos, 2) + 10;
%startpos = %x@" "@%y@" "@%z;
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType;
%searchResult = containerRayCast(%startpos, vectorAdd(%startpos, "0 0 -20"), %mask, %leader.player);
if(%searchResult){
%trns = getWord(%searchResult, 1)@" "@getWord(%searchResult, 2)@" "@getWord(%searchResult, 3);
%i = 3;
}
}
if(%trns $= "")
%trns = %pos;
%passenger.setPosition(%trns);
// commandToClient(%passenger.client, 'setHudMode', 'Standard', "", 0);
schedule(100, 0, "commandToClient", %passenger.client, 'setHudMode', 'Standard', "", 0);
}
%obj.schedule(1000,"delete");
}

View file

@ -0,0 +1,630 @@
//**************************************************************
// Chopper
//**************************************************************
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock FlyingVehicleData(heavychopper) : ShrikeDamageProfile
{
spawnOffset = "0 0 2";
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_air_bomber.dts";
multipassenger = true;
computeCRC = true;
debrisShapeName = "vehicle_air_bomber.dts";
debris = ShapeDebris;
renderWhenDestroyed = false;
drag = 0.3;
density = 1.0;
mountPose[0] = sitting;
mountPose[1] = sitting;
mountPose[3] = sitting;
mountPose[4] = sitting;
mountPose[5] = sitting;
numMountPoints = 6;
isProtectedMountPoint[0] = false;
isProtectedMountPoint[1] = false;
isProtectedMountPoint[2] = false;
isProtectedMountPoint[3] = true;
isProtectedMountPoint[4] = true;
isProtectedMountPoint[5] = true;
cameraMaxDist = 15;
cameraOffset = 2.5;
cameraLag = 0.9;
explosion = MFVehicleExplosion;
explosionDamage = 1.5;
explosionRadius = 10.0;
maxDamage = 5.0;
destroyedLevel = 5.0;
HDAddMassLevel = 3.5;
HDMassImage = HHeliHDMassImage;
isShielded = false;
energyPerDamagePoint = 0;
maxEnergy = 150; // Afterburner and any energy weapon pool
rechargeRate = 1.0;
minDrag = 20; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 900; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 15; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 550; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 150; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 1.0; // Dampen control input so you don't` whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 7; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 6; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 2; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 0; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 425; // Steering jets (force applied when you move the mouse)
steeringRollForce = 30; // Steering jets (how much you heel over when you turn)
rollForce = 6; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 3; // Height off the ground at rest
createHoverHeight = 3; // Height off the ground when created
maxForwardSpeed = 30; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 1000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 1; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 0.1; // Energy use of the afterburners (low number is less drain...can be fractional) // Auto stabilize speed
vertThrustMultiple = 3.5;
// Rigid body
mass = 250; // Mass of the vehicle
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't mess with this.
softImpactSpeed = 14; // Sound hooks. This is the soft hit.
hardImpactSpeed = 25; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 15; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.08;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
//
minTrailSpeed = 100; // The speed your contrail shows up at.
trailEmitter = ContrailEmitter;
//
jetSound = ScoutFlyerThrustSound;
engineSound = ScoutFlyerEngineSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 15.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 1.0;
damageEmitter[0] = MFLightDamageSmoke;
damageEmitter[1] = MFHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 1;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
targetNameTag = 'Eagle VII';
targetTypeTag = 'Transport Chopper';
sensorData = PlayerSensor;
checkRadius = 5.5;
observeParameters = "1 10 10";
runningLight[0] = ShrikeLight1;
// runningLight[1] = ShrikeLight2;
shieldEffectScale = "0.937 1.125 0.60";
max[chaingunAmmo] = 1000;
max[PlasmaAmmo] = 20;
replaceTime = 50;
};
//**************************************************************
// WEAPONS
//**************************************************************
datablock ShapeBaseImageData(ChopperCGPairImage)
{
className = WeaponImage;
shapeFile = "turret_missile_large.dts";
item = Chaingun;
ammo = ChaingunAmmo;
projectile = Heli_CG_Bullet;
projectileType = TracerProjectile;
mountPoint = 10;
offset = "4.93 -4.52 0.044"; // L/R - F/B - T/B
projectileSpread = 1.0 / 1000.0;
usesEnergy = false;
emap = true;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.1;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.05;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateSound[3] = ShrikeBlasterFire;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.05;
stateAllowImageChange[4] = false;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ShrikeBlasterDryFireSound;
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock ShapeBaseImageData(ChopperCGImage) : ChopperCGPairImage
{
offset = "-4.93 -4.52 0.044";
};
datablock TracerProjectileData(HheliT_bullet)
{
doDynamicClientHits = true;
directDamage = 0.2; // z0dd - ZOD, 9-27-02. Was 0.0825
directDamageType = $DamageType::Bullet;
explosion = "ChaingunExplosion";
splash = ChaingunSplash;
kickBackStrength = 2000.0;
sound = ChaingunProjectile;
dryVelocity = 3000.0; // z0dd - ZOD, 8-12-02. Was 425.0
wetVelocity = 2500.0;
velInheritFactor = 0.0;
fizzleTimeMS = 3000;
lifetimeMS = 2500;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 10.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.06;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
};
datablock ShapeBaseImageData(HHeliChaingunImage)
{
className = WeaponImage;
shapeFile = "turret_tank_barrelchain.dts";
item = Chaingun;
ammo = ChaingunAmmo;
projectile = HheliT_bullet;
projectileType = TracerProjectile;
projectileSpread = 1.0 / 1000.0;
emap = true;
offset = "0.37 -0.4 -0.5";
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 5.0;
shellVelocity = 0.0;
mountPoint = 1;
usesEnergy = true;
useCapacitor = true;
useMountEnergy = true;
minEnergy = 8;
fireEnergy = 8;
stateName[0] = "Activate";
stateSequence[0] = "Activate";
// stateSound[0] = GravChaingunIdleSound;
stateAllowImageChange[0] = false;
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
stateName[3] = "Spinup";
stateScript[3] = "onSpinup";
stateSpinThread[3] = SpinUp;
stateSound[3] = ChaingunSpinupSound;
stateTimeoutValue[3] = 0.5;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = HeliturretFireSound;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateTimeoutValue[4] = 0.05;
stateTransitionOnTimeout[4] = "Fire";
stateName[5] = "Spindown";
stateScript[5] = "onSpindown";
stateSound[5] = ChaingunSpinDownSound;
stateSpinThread[5] = SpinDown;
stateTimeoutValue[5] = 0.5;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
stateName[6] = "EmptySpindown";
stateScript[6] = "onSpindown";
stateSound[6] = ChaingunSpinDownSound;
stateSpinThread[6] = SpinDown;
stateTimeoutValue[6] = 2.5;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "DryFire";
stateSound[7] = ShrikeBlasterDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock ShapeBaseImageData(HHeliChaingunImage2) : HHeliChaingunImage
{
offset = "-0.23 -0.4 -0.5";
};
datablock ShapeBaseImageData(ChopperParam)
{
mountPoint = 2;
shapeFile = "turret_muzzlepoint.dts";
offset = "0 5 0"; // L/R - F/B - T/B
projectile = BigBullet;
projectileType = TracerProjectile;
};
function HeavyChopper::onDestroyed(%data, %obj, %prevState)
{
if(%obj.lastPilot.lastVehicle == %obj)
if(%obj.getMountNodeObject(0) == %obj.lastPilot)
schedule(200, %obj.lastPilot, "scKillPilot", %obj.lastPilot, %obj.lastDamagedBy);
Parent::onDestroyed(%data, %obj, %prevState);
}
datablock ShapeBaseImageData(DummyslotImg)
{
shapeFile = "grenade.dts";
emap = false;
};
//******************************************************
// vehicle.cs and weapturretcode.cs functions
//******************************************************
//----------------------------
// Helicopter FLIER
//----------------------------
function HeavyChopper::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.mountImage(ChopperParam, 0);
%obj.mountImage(ChopperCGImage, 2);
%obj.mountImage(ChopperCGPairImage, 3);
%obj.mountImage(DummySlotImg, 4);
%obj.selectedWeapon = 1;
%obj.nextWeaponFire = 2;
%obj.setInventory(chaingunammo, 1000);
%obj.schedule(5500, "playThread", $ActivateThread, "activate");
%turret = TurretData::create(HeliTurret);
MissionCleanup.add(%turret);
%turret.team = %obj.teamBought;
%turret.selectedWeapon = 1;
%turret.setSelfPowered();
%obj.mountObject(%turret, 10);
%turret.mountImage(heliTurretParam, 0);
%turret.mountImage(Hhelichaingunimage, 2);
%turret.mountImage(Hhelichaingunimage2, 3);
%obj.turretObject = %turret;
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%turret.vehicleMounted = %obj;
%turret.setAutoFire(false);
%turret.mountImage(AIAimingTurretBarrel, 0);
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
%obj.canSwitchP = 1;
}
function HeavyChopper::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(10);
if (!%turret)
return;
%turret.altTrigger = 0;
%turret.fireTrigger = 0;
if (%client = %turret.getControllingClient())
{
%client.player.setControlObject(%client.player);
%client.player.mountImage(%client.player.lastWeapon, $WeaponSlot);
%client.player.mountVehicle = false;
%client.player.bomber = false;
%client.player.isBomber = false;
}
%turret.schedule(1000, delete);
}
function HeavyChopper::playerMounted(%data, %obj, %player, %node)
{
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
bottomPrint(%player.client, "Transport Chopper: carrys 6 peeps has 2 forward mounted cg's controlled by pilot and cg turret on bottom", 5, 2 );
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
if (%node == 0)
{
%player.setPilot(true);
commandToClient(%player.client, 'setHudMode', 'Pilot', "Bomber", %node);
}
else if (%node == 1)
{
%turret = %obj.getMountNodeObject(10);
%player.vehicleTurret = %turret;
%player.setTransform("0 0 0 0 0 1 0");
%player.lastWeapon = %player.getMountedImage($WeaponSlot);
%player.unmountImage($WeaponSlot);
if (!%player.client.isAIControlled())
{
%player.setControlObject(%turret);
%player.client.setObjectActiveImage(%turret, 2);
}
%turret.bomber = %player;
$bWeaponActive = 0;
%obj.getMountNodeObject(10).selectedWeapon = 1;
// commandToClient(%player.client,'SetWeaponryVehicleKeys', true);
commandToClient(%player.client, 'setHudMode', 'Pilot', "Bomber", %node);
%player.isBomber = true;
}
else
{
// all others
commandToClient(%player.client, 'setHudMode', 'Passenger', "HAPC", %node);
}
// build a space-separated string representing passengers
// 0 = no passenger; 1 = passenger (e.g. "1 0 0 ")
%passString = buildPassengerString(%obj);
// send the string of passengers to all mounted players
for(%i = 0; %i < %data.numMountPoints; %i++)
if (%obj.getMountNodeObject(%i) > 0)
commandToClient(%obj.getMountNodeObject(%i).client, 'checkPassengers', %passString);
// update observers who are following this guy...
if ( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
}
function HeavyChopper::onTrigger(%data, %obj, %trigger, %state)
{
// data = ScoutFlyer datablock
// obj = ScoutFlyer object number
// trigger = 0 for "fire", 1 for "jump", 3 for "thrust"
// state = 1 for firing, 0 for not firing
if(%trigger == 0)
{
switch (%state) {
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
case 1:
%obj.fireWeapon = true;
if(%obj.selectedWeapon == 1)
{
if(%obj.nextWeaponFire == 2)
{
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(3, true);
}
// else
// {
// %obj.setImageTrigger(2, false);
// %obj.setImageTrigger(3, true);
// }
}
else
{
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
}
}
}
else if (%trigger ==4) // Throw flare
{
switch (%state)
{
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(5, false);
case 1:
if (%obj.inv[PlasmaAmmo] > 0)
{
%obj.fireWeapon = true;
%obj.setImageTrigger(5, true);
%obj.decInventory(PlasmaAmmo, 1);
%p = new FlareProjectile()
{
dataBlock = FlareGrenadeProj;
initialDirection = "0 0 -1";
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%p.schedule(6000, "delete");
// miscellaneous grenade-throwing cleanup stuff
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
}
}
function HeavyChopper::playerDismounted(%data, %obj, %player)
{
%obj.fireWeapon = false;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(3, false);
setTargetSensorGroup(%obj.getTarget(), %obj.team);
if( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, true );
}
function ChopperCGImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%obj.getMountNodeObject(0).decInventory(%data.ammo, 1);
}
function ChopperCGPairImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
%obj.getMountNodeObject(0).decInventory(%data.ammo, 1);
}
function HHeliChaingunImage::OnSpinup(%data,%obj,%slot){
%obj.setImageTrigger(3,true);
}
function HHeliChaingunImage::OnSpindown(%data,%obj,%slot){
%obj.setImageTrigger(3,false);
}
function heavychopper::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,438 @@
//**************************************************************
// S17
//**************************************************************
datablock HoverVehicleData(S17) : ShrikeDamageProfile
{
spawnOffset = "0 0 1";
canControl = false;
floatingGravMag = 3.5;
catagory = "Vehicles";
shapeFile = "nexuscap.dts";
computeCRC = true;
debrisShapeName = "vehicle_grav_scout_debris.dts";
debris = ShapeDebris;
renderWhenDestroyed = false;
drag = 0.0;
density = 0.9;
cameraMaxDist = 5.0;
cameraOffset = 0.7;
cameraLag = 0.5;
numMountPoints = 0;
explosion = VehicleExplosion;
explosionDamage = 0.5;
explosionRadius = 5.0;
maxDamage = 1.5;
destroyedLevel = 1.5;
HDAddMassLevel = 1.2;
HDMassImage = WCHDMassImage;
isShielded = false;
rechargeRate = 0.7;
energyPerDamagePoint = 75;
maxEnergy = 150;
minJetEnergy = 15;
jetEnergyDrain = 0.1;
// Rigid Body
mass = 400;
bodyFriction = 0.1;
bodyRestitution = 0.5;
softImpactSpeed = 20; // Play SoftImpact Sound
hardImpactSpeed = 28; // Play HardImpact Sound
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 29;
speedDamageScale = 0.010;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23;
collDamageMultiplier = 0.030;
dragForce = 25 / 45.0;
vertFactor = 0.0;
floatingThrustFactor = 0.35;
mainThrustForce = 25;
reverseThrustForce = 15;
strafeThrustForce = 0;
turboFactor = 1.35;
brakingForce = 15;
brakingActivationSpeed = 3;
stabLenMin = 2.25;
stabLenMax = 3.75;
stabSpringConstant = 30;
stabDampingConstant = 16;
gyroDrag = 16;
normalForce = 30;
restorativeForce = 20;
steeringForce = 35;
rollForce = 15;
pitchForce = 7;
dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 2.5;
dustHeight = 1.0;
dustTrailEmitter = TireEmitter;
dustTrailOffset = "0.0 -1.0 0.5";
triggerTrailHeight = 3.6;
dustTrailFreqMod = 15.0;
jetSound = ScoutSqueelSound;
engineSound = ScoutEngineSound;
floatSound = ScoutThrustSound;
softImpactSound = GravSoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 20.0;
hardSplashSoundVelocity = 30.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterSoftSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterSoftSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeSoftSplashSound;
minMountDist = 4;
damageEmitter[0] = SmallLightDamageSmoke;
damageEmitter[1] = SmallHeavyDamageSmoke;
damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "0.0 -1.5 0.5 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.8;
numDmgEmitterAreas = 1;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
forwardJetEmitter = WildcatJetEmitter;
cmdCategory = Tactical;
cmdIcon = CMDHoverScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_landscout_grey";
targetNameTag = 'S17';
targetTypeTag = 'Combat Drone';
sensorData = PlayerSensor;
checkRadius = 1.7785;
observeParameters = "1 10 10";
runningLight[0] = WildcatLight1;
runningLight[1] = WildcatLight2;
runningLight[2] = WildcatLight3;
shieldEffectScale = "0.9375 1.125 0.6";
replaceTime = 20;
};
datablock StaticShapeData(S17switch) : StaticShapeDamageProfile {
shapeFile = "switch.dts";
mass = 1.0;
repairRate = 0;
dynamicType = $TypeMasks::StaticShapeObjectType;
heatSignature = 0;
};
//**************************************************************
// WEAPONS
//**************************************************************
//-------------------------------------
// CHOPPER BELLY TURRET CHARACTERISTICS
//-------------------------------------
datablock TurretData(S17Turret) : TurretDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "turret_base_large.dts";
preload = true;
canControl = false;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingBomberIcon;
cmdMiniIconName = "commander/MiniIcons/com_bomber_grey";
targetNameTag = 'S17';
targetTypeTag = 'Turret';
mass = 1.0; // Not really relevant
repairRate = 0;
maxDamage = S17.maxDamage;
destroyedLevel = S17.destroyedLevel;
maxEnergy = 1;
thetaMin = 60;
thetaMax = 150;
thetaNull = 90;
// capacitor
maxCapacitorEnergy = 200;
capacitorRechargeRate = 5.0;
inheritEnergyFromMount = true;
firstPersonOnly = true;
useEyePoint = true;
numWeapons = 1;
targetNameTag = 'Wildcat Chaingun';
targetTypeTag = 'Turret';
};
datablock TurretImageData(S17ChaingunImage)
{
className = WeaponImage;
shapeFile = "weapon_chaingun.dts";
// mountPoint = 1;
projectile = RPChaingunBullet;
projectileType = TracerProjectile;
projectileSpread = 1.2 / 1000.0;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 5.0;
shellVelocity = 0.0;
usesEnergy = true;
useCapacitor = true;
useMountEnergy = true;
minEnergy = 1;
fireEnergy = 0.1;
// Turret parameters
activationMS = 4000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 360;
degPerSecPhi = 360;
attackRadius = 75;
stateName[0] = "Activate";
stateSequence[0] = "deploy";
stateAllowImageChange[0] = false;
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";
stateTransitionOnNoAmmo[0] = "NoAmmo";
stateName[1] = "Ready";
stateSpinThread[1] = Stop;
stateTransitionOnTriggerDown[1] = "Spinup";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "NoAmmo";
stateTransitionOnAmmo[2] = "Ready";
stateSpinThread[2] = Stop;
stateTransitionOnTriggerDown[2] = "DryFire";
stateName[3] = "Spinup";
stateSpinThread[3] = SpinUp;
stateTimeoutValue[3] = 0.01;
stateWaitForTimeout[3] = false;
stateTransitionOnTimeout[3] = "Fire";
stateTransitionOnTriggerUp[3] = "Spindown";
stateName[4] = "Fire";
stateSequence[4] = "Fire";
stateSequenceRandomFlash[4] = true;
stateSpinThread[4] = FullSpeed;
stateSound[4] = ChaingunFireSound;
stateAllowImageChange[4] = false;
stateScript[4] = "onFire";
stateFire[4] = true;
stateEjectShell[4] = true;
stateTimeoutValue[4] = 0.15;
stateTransitionOnTimeout[4] = "Fire";
stateTransitionOnTriggerUp[4] = "Spindown";
stateTransitionOnNoAmmo[4] = "EmptySpindown";
stateName[5] = "Spindown";
stateSpinThread[5] = SpinDown;
stateTimeoutValue[5] = 0.1;
stateWaitForTimeout[5] = true;
stateTransitionOnTimeout[5] = "Ready";
stateTransitionOnTriggerDown[5] = "Spinup";
stateName[6] = "EmptySpindown";
stateSpinThread[6] = SpinDown;
stateTimeoutValue[6] = 0.5;
stateTransitionOnTimeout[6] = "NoAmmo";
stateName[7] = "DryFire";
stateSound[7] = ShrikeBlasterDryFireSound;
stateTimeoutValue[7] = 0.5;
stateTransitionOnTimeout[7] = "NoAmmo";
};
datablock TurretImageData(S17Param)
{
mountPoint = 2;
shapeFile = "turret_muzzlepoint.dts";
offset = "0.0 0.0 3.0";
Projectile = RPChaingunBullet;
ProjectileType = TracerProjectile;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 500;
degPerSecPhi = 500;
attackRadius = 75;
};
function S17::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.schedule(5500, "playThread", $ActivateThread, "activate");
%turret = TurretData::create(S17Turret);
%turret.scale = "0.5 0.5 1";
MissionCleanup.add(%turret);
%turret.team = %obj.team;
%turret.selectedWeapon = 1;
%turret.setSelfPowered();
%obj.mountObject(%turret, 10);
%turret.mountImage(S17Param, 0);
%turret.mountImage(S17chaingunimage, 2);
%obj.turret = %turret;
%obj.turretObject = %turret;
%turret.setCapacitorRechargeRate( %turret.getDataBlock().capacitorRechargeRate );
%turret.vehicleMounted = %obj;
%turret.setAutoFire(false);
setTargetSensorGroup(%turret.getTarget(), %turret.team);
setTargetNeverVisMask(%turret.getTarget(), 0xffffffff);
%sensor = new StaticShape()
{
scale = "1.3 1.3 0.1";
dataBlock = "S17switch";
};
MissionCleanup.add(%sensor);
%obj.mountObject(%sensor, 2);
%sensor.vehicleMounted = %obj;
%sensor.playThread($AmbientThread,"ambient");
schedule(5000, 0, "S17TurretAttackCheck",%obj);
}
function S17::deleteAllMounted(%data, %obj)
{
%turret = %obj.getMountNodeObject(10);
if (!%turret)
return;
%turret.schedule(2000, delete);
%body = %obj.getMountNodeObject(2);
if (isObject(%body))
%body.schedule(1000, delete);
$teamRepCredits[%obj.team] += getWord($commsatPurchase[2],1);
$teamUsedCredits[%obj.team] -= getWord($commsatPurchase[2],1);
}
function S17turret::onDamage(%data, %obj)
{
%newDamageVal = %obj.getDamageLevel();
if(%obj.lastDamageVal !$= "")
if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
%obj.getObjectMount().setDamageLevel(%newDamageVal);
%obj.lastDamageVal = %newDamageVal;
}
function S17turret::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
{
%vehicle = %targetObject.getObjectMount();
if(%vehicle)
%vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
}
function S17::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}
function S17TurretAttackCheck(%obj){
if(!isObject(%obj))
return;
%valid = 0;
%TargetSearchMask = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TurretObjectType;
InitContainerRadiusSearch(%obj.getPosition(),400,%TargetSearchMask);
while ((%potentialTarget = ContainerSearchNext()) != 0) {
if (%potentialtarget && %valid != 1) {
%PTT = %potentialtarget.team;
if(%PTT $= "")
%PTT = %obj.team;
if(!(%PTT == %obj.team) && %PTT != 0){
%valid = 1;
%target = %potentialtarget;
}
}
}
if(%valid == 1){
if(!%obj.firing){
%obj.firing = 1;
%obj.turretobject.setTargetObject(%target);
%obj.turretobject.aquireTime = getSimTime();
%obj.turretobject.setImageTrigger(2,true);
}
}
else{
if(%obj.firing){
%obj.firing = 0;
%obj.turretobject.setImageTrigger(2,false);
%obj.turretObject.clearTarget();
}
}
schedule(250, 0, "S17TurretAttackCheck",%obj);
}

View file

@ -0,0 +1,744 @@
//**************************************************************
// AIR SUPERIORITY FIGHTER
//**************************************************************
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock FlyingVehicleData(SuperiorityFighter) : ShrikeDamageProfile
{
spawnOffset = "0 0 2";
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_air_scout.dts";
multipassenger = false;
computeCRC = true;
debrisShapeName = "vehicle_air_scout.dts";
debris = MeShapeDebris;
renderWhenDestroyed = false;
drag = 0.15;
density = 1.0;
mountPose[0] = sitting;
numMountPoints = 1;
isProtectedMountPoint[0] = false;
cameraMaxDist = 15;
cameraOffset = 2.5;
cameraLag = 0.9;
explosion = MeVehicleExplosion;
explosionDamage = 1.0;
explosionRadius = 10.0;
maxDamage = 2.5;
destroyedLevel = 2.5;
HDAddMassLevel = 1.9;
HDMassImage = LflyerHDMassImage;
isShielded = false;
energyPerDamagePoint = 0;
maxEnergy = 2000; // Afterburner and any energy weapon pool
rechargeRate = 6;
minDrag = 22; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 900; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 66; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 400; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 1; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.8; // Dampen control input so you don't` whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 4.5; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 6; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 4; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 6250; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 750; // Steering jets (force applied when you move the mouse)
steeringRollForce = 3000; // Steering jets (how much you heel over when you turn)
rollForce = 1; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 2.5; // Height off the ground at rest
createHoverHeight = 1; // Height off the ground when created
maxForwardSpeed = 250; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 3250; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 40; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 18; // Energy use of the afterburners (low number is less drain...can be fractional) // Auto stabilize speed
vertThrustMultiple = 0;
// Rigid body
mass = 150; // Mass of the vehicle
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't mess with this.
softImpactSpeed = 14; // Sound hooks. This is the soft hit.
hardImpactSpeed = 25; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 20; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
//
minTrailSpeed = 150; // The speed your contrail shows up at.
trailEmitter = ContrailEmitter;
forwardJetEmitter = FlyerJetEmitter;
downJetEmitter = FlyerJetEmitter;
//
jetSound = ScoutFlyerThrustSound;
engineSound = ScoutFlyerEngineSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 10.0;
mediumSplashSoundVelocity = 15.0;
hardSplashSoundVelocity = 20.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterMediumSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterMediumSound;
waterWakeSound = VehicleWakeMediumSplashSound;
dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 1.0;
damageEmitter[0] = MeLightDamageSmoke;
damageEmitter[1] = MeHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.4;
damageLevelTolerance[1] = 0.75;
numDmgEmitterAreas = 1;
//
max[chaingunAmmo] = 750;
max[MissileLauncherAmmo] = 4;
max[MortarAmmo] = 3;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingScoutIcon;
cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
targetNameTag = 'F54 Tornado';
targetTypeTag = 'Superiority Fighter';
sensorData = combatSensor;
sensorRadius = combatSensor.detectRadius;
sensorColor = "9 9 255";
checkRadius = 5.5;
observeParameters = "1 10 10";
runningLight[0] = ShrikeLight1;
// runningLight[1] = ShrikeLight2;
shieldEffectScale = "0.937 1.125 0.60";
numWeapons = 3;
replaceTime = 130;
max[plasmaammo] = 20;
flaretime = 200;
flarelife = 850;
flarechance = 0.5;
};
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock TracerProjectileData(Superiority_bullet)
{
doDynamicClientHits = true;
directDamage = 0.25;
directDamageType = $DamageType::Bullet;
explosion = ChaingunExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.0225;
damageRadius = 0.5;
radiusDamageType = $DamageType::Bullet;
kickBackStrength = 5;
sound = ChaingunProjectile;
dryVelocity = 2250.0;
wetVelocity = 2000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 6000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 40.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.20;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
datablock SeekerProjectileData(LRAAM)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 2.1;
damageRadius = 10.0;
radiusDamageType = $DamageType::MissileTurret;
kickBackStrength = 500;
flareDistance = 200;
flareAngle = 30;
minSeekHeat = 0.0;
explosion = "MissileExplosion";
velInheritFactor = 1.0;
splash = MissileSplash;
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
lifetimeMS = 10000; // z0dd - ZOD, 4/14/02. Was 6000
muzzleVelocity = 25.0;
maxVelocity = 400.0; // z0dd - ZOD, 4/14/02. Was 80.0
turningSpeed = 50.0;
acceleration = 150.0;
proximityRadius = 6;
terrainAvoidanceSpeed = 100;
terrainScanAhead = 50;
terrainHeightFail = 50;
terrainAvoidanceRadius = 150;
useFlechette = true;
flechetteDelayMs = 225;
casingDeb = FlechetteDebris;
};
//**************************************************************
// WEAPONS
//**************************************************************
datablock ShapeBaseImageData(SuperiorityChaingunImage)
{
className = WeaponImage;
shapeFile = "turret_missile_large.dts"; //was turret_tank_barrelchain.dts
item = Chaingun;
ammo = ChaingunAmmo;
projectile = Superiority_bullet;
projectileType = TracerProjectile;
mountPoint = 10;
offset = "0 2.1 -0.2"; // L/R - F/B - T/B was "0 3.25 0.75"
rotation = "0 1 0 180";
projectileSpread = 1.0 / 1000.0;
velpredict = 0;
usesEnergy = false;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.1;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateFire[3] = true;
stateScript[3] = "onFire";
stateSound[3] = ShrikeBlasterFire;
stateTimeoutValue[3] = 0.01;
stateTransitionOnTimeout[3] = "Reload";
stateAllowImageChange[3] = false;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.01;
stateAllowImageChange[4] = false;
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ShrikeBlasterDryFireSound;
stateTimeoutValue[6] = 1.0;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock ShapeBaseImageData(SuperiorityMissileImage)
{
className = WeaponImage;
shapeFile = "weapon_energy_vehicle.dts";
item = MissileLauncher;
ammo = MissileLauncherAmmo;
projectile = sidewinder;
projectileType = SeekerProjectile;
mountPoint = 10;
offset = "0 -0 -0.15"; // L/R - F/B - T/B
usesEnergy = false;
useMountEnergy = true;
minEnergy = 100;
fireEnergy = 100;
fireTimeout = 125;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = MissileFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 1.0;
stateAllowImageChange[4] = false;
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = ShrikeBlasterDryFireSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
datablock ShapeBaseImageData(LRAAMImage)
{
className = WeaponImage;
shapeFile = "weapon_energy_vehicle.dts";
item = Mortar;
ammo = MortarAmmo;
projectile = LRAAM;
projectileType = SeekerProjectile;
mountPoint = 10;
offset = "0 -0 -0.15"; // L/R - F/B - T/B
usesEnergy = false;
useMountEnergy = true;
minEnergy = 100;
fireEnergy = 100;
fireTimeout = 125;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = BomberBombFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.5;
stateAllowImageChange[4] = false;
stateSound[4] = MissileReloadSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = BomberBombDryFireSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
function SuperiorityFighter::onAdd(%this, %obj)
{
Parent::onAdd(%this, %obj);
if (%obj.clientControl)
serverCmdResetControlObject(%obj.clientControl);
%obj.mountImage(ScoutChaingunParam, 0);
%obj.mountImage(SuperiorityChaingunImage, 2);
%obj.mountImage(superiorityMissileImage, 4);
%obj.mountImage(LRAAMImage, 5);
%obj.selectedWeapon = 1;
%obj.nextWeaponFire = 2;
%obj.setInventory(MissileLauncherAmmo, 4);
%obj.setInventory(MortarAmmo, 3);
%obj.setInventory(chaingunammo, 750);
%obj.setInventory(plasmaAmmo,25);
%obj.schedule(5500, "playThread", $ActivateThread, "activate");
schedule(2500, 0, "supersonicloop", %obj);
}
function SuperiorityFighter::playerMounted(%data, %obj, %player, %node)
{
%ammoAmt = %player.inv[MissileLauncherAmmo];
if(%ammoAmt)
%obj.incInventory(MissileLauncherAmmo, %ammoAmt);
%ammoAmt = %player.inv[MortarAmmo];
if(%ammoAmt)
%obj.incInventory(MortarAmmo, %ammoAmt);
%ammoAmt = %player.inv[chaingunAmmo];
if(%ammoAmt)
%obj.incInventory(chaingunAmmo, %ammoAmt);
bottomPrint(%player.client, "Tornado: wep1 CG, wep2 sidewinders, wep3 LRAAMS", 5, 2 );
commandToClient(%player.client, 'setHudMode', 'Pilot', "Shrike2", %node);
%obj.selectedWeapon = 1;
$numVWeapons = 3;
commandToClient(%player.client, 'SetWeaponryVehicleKeys', true);
if( %player.client.observeCount > 0 )
resetObserveFollow( %player.client, false );
}
function SuperiorityFighter::onTrigger(%data, %obj, %trigger, %state)
{
%player = %obj.getMountNodeObject(0);
if(%trigger == 0)
{
switch (%state)
{
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(5, false);
case 1:
%obj.fireWeapon = true;
if(%obj.selectedWeapon == 1){
%obj.setImageTrigger(2, true);
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(5, false);
}
else if(%obj.selectedWeapon == 2) {
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, true);
%obj.setImageTrigger(5, false);
}
else {
%obj.setImageTrigger(2, false);
%obj.setImageTrigger(4, false);
%obj.setImageTrigger(5, true);
}
}
}
else if (%trigger ==4){
switch (%state)
{
case 0:
%obj.flaring = 0;
case 1:
%obj.flaring = 1;
schedule(%data.flaretime, 0, "fighterdropflares",%obj,%data.flaretime,%data.flarelife,%data.flarechance);
}
}
}
function SuperiorityChaingunImage::onFire(%data,%obj,%slot){
%data.lightStart = getSimTime();
%vec = %obj.getMuzzleVector(%slot);
if(%data.velpredict == 1){
%target = %obj.getLockedTarget();
if(%target){
%Tpos = %target.getWorldBoxCenter();
%Opos = %obj.getMuzzlepoint(%slot);
%dist = vectorDist(%Tpos,%Opos);
%pos = vectorAdd(%Tpos, vectorScale(%target.getVelocity(),(%dist / 1750) ));
%dist = vectorDist(%pos,%Opos);
%pos = vectorAdd(%Tpos, vectorScale(%target.getVelocity(),(%dist / 1750) ));
%Tvec = vectorNormalize(vectorSub(%pos,%Opos));
%Fvec = %obj.getMuzzleVector(%slot);
if(vectorDist(%Tvec,%Fvec) <= 0.1)
%vec = vectorNormalize(vectorSub(%Tpos,%obj.getMuzzlePoint(%slot)));
}
}
%x = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%y = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%z = (getRandom() - 0.5) * 2 * 3.1415926 * %data.projectileSpread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%vector = MatrixMulVector(%mat, %vec);
%initialPos = %obj.getMuzzlePoint(%slot);
%p = new (%data.projectileType)() {
dataBlock = %data.projectile;
initialDirection = %vector;
initialPosition = %initialPos;
sourceObject = %obj;
sourceSlot = %slot;
vehicleObject = %vehicle;
};
MissionCleanup.add(%p);
if(%obj.client)
%obj.client.projectile = %p;
%obj.decInventory(%data.ammo,1);
return %p;
}
function superiorityMissileImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
MissileSet.add(%p);
if (%obj.getControllingClient())
%target = %obj.getLockedTarget();
else
%target = %obj.getTargetObject();
%homein = missileCheckAirTarget(%target);
if(%target && %homein)
%p.setObjectTarget(%target);
else if(%obj.isLocked())
%p.setPositionTarget(%obj.getLockedPosition());
else
%p.setNoTarget();
}
function LRAAMImage::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
MissileSet.add(%p);
if (%obj.getControllingClient())
%target = %obj.getLockedTarget();
else
%target = %obj.getTargetObject();
if(isobject(%target))
%homein = missileCheckAirTarget(%target);
if(%target && %homein)
%p.setObjectTarget(%target);
else if(%obj.isLocked())
%p.setPositionTarget(%obj.getLockedPosition());
else {
%p.dir = %obj.getForwardVector();
schedule(500, 0, "LRAAMFindTarget", %p);
}
}
function LRAAMFindTarget(%p){
if(!isObject(%p))
return;
%vec = vectorScale(vectorNormalize(%p.dir),600);
%pos = %p.getPosition();
%tpos = vectorAdd(%vec,%pos);
InitContainerRadiusSearch(%tpos, 500, $TypeMasks::VehicleObjectType);
while ((%searchResult = containerSearchNext()) != 0){
echo(%searchresult);
if(%searchResult.getClassName() $= "Flyingvehicle"){
%p.setObjectTarget(%searchResult);
return;
}
}
schedule(250, 0, "LRAAMFindTarget",%p);
}
function superiorityfighter::onDestroyed(%data, %obj, %prevState)
{
if(%obj.lastPilot.lastVehicle == %obj)
if(%obj.getMountNodeObject(0) == %obj.lastPilot)
schedule(200, %obj.lastPilot, "scKillPilot", %obj.lastPilot, %obj.lastDamagedBy);
Parent::onDestroyed(%data, %obj, %prevState);
}
function supersonicloop(%obj){
if(!isObject(%obj))
return;
%vec = %obj.getVelocity();
%vel = vectorlen(%vec);
if(%vel > 200){
%vec = vectorNormalize(%vec);
%vec = vectorScale(%vec,-75);
%pn = new (TracerProjectile)() {
dataBlock = SuperSonicDet;
initialDirection = "0 0 1";
initialPosition = vectoradd(%obj.getPosition(),%vec);
sourceObject = %obj;
sourceSlot = 1;
};
}
schedule(350, 0, "supersonicloop", %obj);
}
datablock TracerProjectileData(SuperSonicDet)
{
doDynamicClientHits = true;
directDamage = 0.0;
directDamageType = $DamageType::BomberBombs;
explosion = "";
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.1;
damageRadius = 50.0;
radiusDamageType = $DamageType::default;
kickBackStrength = 5000;
sound = ChaingunProjectile;
dryVelocity = 1.0;
wetVelocity = 1.0;
velInheritFactor = 1.0;
fizzleTimeMS = 32;
lifetimeMS = 33;
explodeOnDeath = true;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 1;
tracerLength = 1.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.35;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = ChaingunDecal1;
decalData[1] = ChaingunDecal2;
decalData[2] = ChaingunDecal3;
decalData[3] = ChaingunDecal4;
decalData[4] = ChaingunDecal5;
decalData[5] = ChaingunDecal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
function superiorityfighter::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,990 @@
//**************************************************************
// THUNDERSWORD BOMBER
//**************************************************************
//**************************************************************
// SOUNDS
//**************************************************************
datablock EffectProfile(BomberFlyerEngineEffect)
{
effectname = "vehicles/bomber_engine";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberFlyerThrustEffect)
{
effectname = "vehicles/bomber_boost";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberTurretFireEffect)
{
effectname = "weapons/missile_fire";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberTurretActivateEffect)
{
effectname = "vehicles/bomber_turret_activate";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberTurretReloadEffect)
{
effectname = "vehicles/bomber_turret_reload";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberTurretDryFireEffect)
{
effectname = "weapons/missile_launcher_dryfire";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberBombReloadEffect)
{
effectname = "vehicles/bomber_bomb_reload";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberBombDryFireEffect)
{
effectname = "vehicles/bomber_bomb_dryfire";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(BomberBombFireEffect)
{
effectname = "weapons/generic_throw";
minDistance = 10.0;
maxDistance = 20.0;
};
datablock AudioProfile(BomberFlyerEngineSound)
{
filename = "fx/vehicles/bomber_engine.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = BomberFlyerEngineEffect;
};
datablock AudioProfile(BomberFlyerThrustSound)
{
filename = "fx/vehicles/bomber_boost.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = BomberFlyerThrustEffect;
};
datablock AudioProfile(FusionExpSound)
// Sound played when mortar impacts on target
{
filename = "fx/powered/turret_mortar_explode.wav";
description = "AudioBIGExplosion3d";
preload = true;
};
datablock AudioProfile(BomberTurretFireSound)
{
filename = "fx/weapons/missile_fire.WAV";
description = AudioClose3d;
preload = true;
effect = BomberTurretFireEffect;
};
datablock AudioProfile(BomberTurretActivateSound)
{
filename = "fx/vehicles/bomber_turret_activate.wav";
description = AudioClose3d;
preload = true;
effect = BomberTurretActivateEffect;
};
datablock AudioProfile(BomberTurretReloadSound)
{
filename = "fx/weapons/weapon.missilereload.wav";
description = AudioClose3d;
preload = true;
effect = BomberTurretReloadEffect;
};
datablock AudioProfile(BomberTurretIdleSound)
{
filename = "fx/misc/diagnostic_on.wav";
description = ClosestLooping3d;
preload = true;
};
datablock AudioProfile(BomberTurretDryFireSound)
{
filename = "fx/weapons/missile_launcher_dryfire.wav";
description = AudioClose3d;
preload = true;
effect = BomberTurretDryFireEffect;
};
datablock AudioProfile(BomberBombReloadSound)
{
filename = "fx/vehicles/bomber_bomb_reload.wav";
description = AudioClose3d;
preload = true;
effect = BomberBombReloadEffect;
};
datablock AudioProfile(BomberBombProjectileSound)
{
filename = "fx/vehicles/bomber_bomb_projectile.wav";
description = AudioDefaultLooping3d;
preload = true;
effect = BomberBombFireEffect;
};
datablock AudioProfile(BomberBombDryFireSound)
{
filename = "fx/vehicles/bomber_bomb_dryfire.wav";
description = AudioClose3d;
preload = true;
effect = BomberBombDryFireEffect;
};
datablock AudioProfile(BomberBombFireSound)
{
filename = "fx/vehicles/bomber_bomb_reload.wav";
description = AudioClose3d;
preload = true;
effect = BomberBombFireEffect;
};
datablock AudioProfile(BomberBombIdleSound)
{
filename = "fx/misc/diagnostic_on.wav";
description = ClosestLooping3d;
preload = true;
};
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock FlyingVehicleData(BomberFlyer) : BomberDamageProfile
{
spawnOffset = "0 0 2";
canControl = false;
catagory = "Vehicles";
shapeFile = "vehicle_air_bomber.dts";
multipassenger = true;
computeCRC = true;
weaponNode = 1;
debrisShapeName = "vehicle_air_bomber.dts";
debris = MeShapeDebris;
renderWhenDestroyed = false;
drag = 0.2;
density = 1.0;
mountPose[0] = sitting;
mountPose[1] = sitting;
numMountPoints = 3;
isProtectedMountPoint[0] = true;
isProtectedMountPoint[1] = true;
isProtectedMountPoint[2] = false;
cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;
cameraMaxDist = 22;
cameraOffset = 5;
cameraLag = 1.0;
explosion = MFVehicleExplosion;
explosionDamage = 1.5;
explosionRadius = 20.0;
maxDamage = 5.0; // Total health
destroyedLevel = 5.0; // Damage textures show up at this health level
HDAddMassLevel = 3.5;
HDMassImage = HFlyerHDMassImage;
isShielded = false;
energyPerDamagePoint = 150;
maxEnergy = 400; // Afterburner and any energy weapon pool
minDrag = 60; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 1800; // Angular Drag (dampens the drift after you stop moving the mouse...also tumble drag)
rechargeRate = 0.8;
// Auto stabilize speed
maxAutoSpeed = 15; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 1500; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.95; // Dampen control input so you don't whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 8; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 5; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 8; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 5000; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 800; // Steering jets (force applied when you move the mouse)
steeringRollForce = 2500; // Steering jets (how much you heel over when you turn)
rollForce = 1; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 4; // Height off the ground at rest
createHoverHeight = 3; // Height off the ground when created
maxForwardSpeed = 110; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 5000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 40.0; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 2.5; // Energy use of the afterburners (low number is less drain...can be fractional)
vertThrustMultiple = 3.0;
dustEmitter = LargeVehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 2.0;
damageEmitter[0] = MFLightDamageSmoke;
damageEmitter[1] = MFHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "3.0 -3.0 0.0 ";
damageEmitterOffset[1] = "-3.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;
// Rigid body
mass = 350; // Mass of the vehicle
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't mess with this.
softImpactSpeed = 20; // Sound hooks. This is the soft hit.
hardImpactSpeed = 25; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 20; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.060;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 25;
collDamageMultiplier = 0.020;
//
minTrailSpeed = 15; // The speed your contrail shows up at.
trailEmitter = ContrailEmitter;
forwardJetEmitter = FlyerJetEmitter;
downJetEmitter = FlyerJetEmitter;
//
jetSound = BomberFlyerThrustSound;
engineSound = BomberFlyerEngineSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 15.0;
mediumSplashSoundVelocity = 20.0;
hardSplashSoundVelocity = 30.0;
exitSplashSoundVelocity = 10.0;
exitingWater = VehicleExitWaterHardSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterHardSound;
waterWakeSound = VehicleWakeHardSplashSound;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingBomberIcon;
cmdMiniIconName = "commander/MiniIcons/com_bomber_grey";
targetNameTag = 'B-34';
targetTypeTag = 'Bomber';
sensorData = combatSensor;
sensorRadius = combatSensor.detectRadius;
sensorColor = "9 9 255";
checkRadius = 7.1895;
observeParameters = "1 10 10";
shieldEffectScale = "0.75 0.975 0.375";
showPilotInfo = 1;
replaceTime = 75;
};
//**************************************************************
// WEAPONS
//**************************************************************
//--------------------------------------------------------------------------
// Projectile
//--------------------------------------
datablock SeekerProjectileData(sidewinder_MarkII)
{
casingShapeName = "weapon_missile_casement.dts";
projectileShapeName = "weapon_missile_projectile.dts";
hasDamageRadius = true;
indirectDamage = 0.75;
damageRadius = 10.0;
radiusDamageType = $DamageType::Missile;
kickBackStrength = 500;
explosion = "MissileExplosion";
splash = MissileSplash;
velInheritFactor = 1.0; // to compensate for slow starting velocity, this value
// is cranked up to full so the missile doesn't start
// out behind the player when the player is moving
// very quickly - bramage
baseEmitter = MissileSmokeEmitter;
delayEmitter = MissileFireEmitter;
puffEmitter = MissilePuffEmitter;
bubbleEmitter = GrenadeBubbleEmitter;
bubbleEmitTime = 1.0;
exhaustEmitter = MissileLauncherExhaustEmitter;
exhaustTimeMs = 300;
exhaustNodeName = "muzzlePoint1";
lifetimeMS = 15000; // z0dd - ZOD, 4/14/02. Was 6000
muzzleVelocity = 75.0;
maxVelocity = 210.0; // z0dd - ZOD, 4/14/02. Was 80.0
turningSpeed = 64.0;
acceleration = 100.0;
proximityRadius = 3;
terrainAvoidanceSpeed = 180;
terrainScanAhead = 25;
terrainHeightFail = 12;
terrainAvoidanceRadius = 100;
flareDistance = 200;
flareAngle = 30;
minSeekHeat = 0.0;
sound = MissileProjectileSound;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.2 0.05 0";
useFlechette = true;
flechetteDelayMs = 100;
casingDeb = FlechetteDebris;
explodeOnWaterImpact = false;
};
//-------------------------------------
// BOMBER BELLY TURRET CHARACTERISTICS
//-------------------------------------
datablock TurretData(BomberTurret) : TurretDamageProfile
{
className = VehicleTurret;
catagory = "Turrets";
shapeFile = "turret_belly_base.dts";
preload = true;
canControl = false;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingBomberIcon;
cmdMiniIconName = "commander/MiniIcons/com_bomber_grey";
targetNameTag = 'Thundersword';
targetTypeTag = 'Bomberturret';
mass = 1.0; // Not really relevant
repairRate = 0;
maxDamage = BomberFlyer.maxDamage;
destroyedLevel = BomberFlyer.destroyedLevel;
thetaMin = 90;
thetaMax = 180;
// capacitor
maxCapacitorEnergy = 1000;
capacitorRechargeRate = 1.2;
inheritEnergyFromMount = true;
firstPersonOnly = true;
useEyePoint = true;
numWeapons = 3;
targetNameTag = 'Thundersword Belly';
targetTypeTag = 'Turret';
isSeeker = true;
seekRadius = $Bomber::SeekRadius;
maxSeekAngle = 45;
seekTime = $Bomber::SeekTime;
minSeekHeat = $Bomber::minSeekHeat;
minTargetingDistance = $Bomber::minTargetingDistance;
useTargetAudio = $Bomber::useTargetAudio;
};
datablock TurretImageData(BomberTurretBarrel)
{
shapeFile = "stackable1s.dts";
rotation = "0 0 1 90";
offset = "0.4 -0.4 -0.4";
mountPoint = 0;
projectile = sidewinder_MarkII;
projectileType = SeekerProjectile;
usesEnergy = true;
useCapacitor = true;
useMountEnergy = true;
fireEnergy = 60.0;
minEnergy = 60.0;
isSeeker = true;
seekRadius = $Bomber::SeekRadius;
maxSeekAngle = 45;
seekTime = $Bomber::SeekTime;
minSeekHeat = $Bomber::minSeekHeat;
minTargetingDistance = $Bomber::minTargetingDistance;
useTargetAudio = $Bomber::useTargetAudio;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 360;
degPerSecPhi = 360;
attackRadius = 300;
// State transitions
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "WaitFire1";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateSound[0] = BomberTurretActivateSound;
stateName[1] = "WaitFire1";
stateTransitionOnTriggerDown[1] = "Fire1";
stateTransitionOnNoAmmo[1] = "NoAmmo1";
stateName[2] = "Fire1";
stateTransitionOnTimeout[2] = "Reload1";
stateTimeoutValue[2] = 2.0;
stateFire[2] = true;
stateRecoil[2] = LightRecoil;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateSound[2] = BomberTurretFireSound;
stateName[3] = "Reload1";
stateSequence[3] = "Reload";
stateTimeoutValue[3] = 0.75;
stateAllowImageChange[3] = false;
stateTransitionOnTimeout[3] = "WaitFire2";
stateTransitionOnNoAmmo[3] = "NoAmmo1";
stateName[4] = "NoAmmo1";
stateTransitionOnAmmo[4] = "Reload1";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateSequence[4] = "NoAmmo";
stateSequence[4] = "NoAmmo1";
stateTransitionOnTriggerDown[4] = "DryFire1";
stateName[5] = "DryFire1";
stateSound[5] = BomberTurretDryFireSound;
stateTimeoutValue[5] = 0.75;
stateTransitionOnTimeout[5] = "NoAmmo1";
stateName[6] = "WaitFire2";
stateTransitionOnTriggerDown[6] = "Fire2";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateTransitionOnNoAmmo[6] = "NoAmmo";
stateTransitionOnNoAmmo[6] = "NoAmmo2";
stateName[7] = "Fire2";
stateTransitionOnTimeout[7] = "Reload2";
stateTimeoutValue[7] = 0.75;
stateScript[7] = "FirePair";
stateName[8] = "Reload2";
stateSequence[8] = "Reload";
stateTimeoutValue[8] = 0.75;
stateAllowImageChange[8] = false;
stateTransitionOnTimeout[8] = "WaitFire1";
stateTransitionOnNoAmmo[8] = "NoAmmo2";
stateName[9] = "NoAmmo2";
stateTransitionOnAmmo[9] = "Reload2";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateSequence[9] = "NoAmmo";
stateSequence[9] = "NoAmmo2";
stateTransitionOnTriggerDown[9] = "DryFire2";
stateName[10] = "DryFire2";
stateSound[10] = BomberTurretDryFireSound;
stateTimeoutValue[10] = 0.75;
stateTransitionOnTimeout[10] = "NoAmmo2";
};
datablock TurretImageData(BomberTurretBarrelPair)
{
shapeFile = "stackable1s.dts";
rotation = "0 0 1 90";
offset = "-0.4 -0.4 -0.4";
mountPoint = 1;
projectile = sidewinder_MarkII;
projectileType = SeekerProjectile;
usesEnergy = true;
useCapacitor = true;
useMountEnergy = true;
fireEnergy = 60.0;
minEnergy = 60.0;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 360;
degPerSecPhi = 360;
attackRadius = 300;
stateName[0] = "WaitFire";
stateTransitionOnTriggerDown[0] = "Fire";
stateName[1] = "Fire";
stateTransitionOnTimeout[1] = "StopFire";
stateTimeoutValue[1] = 0.13;
stateFire[1] = true;
stateRecoil[1] = LightRecoil;
stateAllowImageChange[1] = false;
stateSequence[1] = "Fire";
stateScript[1] = "onFire";
stateSound[1] = BomberTurretFireSound;
stateName[2] = "StopFire";
stateTimeoutValue[2] = 0.1;
stateTransitionOnTimeout[2] = "WaitFire";
stateScript[2] = "stopFire";
};
datablock TurretImageData(AIAimingTurretBarrel)
{
shapeFile = "turret_muzzlepoint.dts";
mountPoint = 3;
projectile = sidewinder_MarkII;
// Turret parameters
activationMS = 1000;
deactivateDelayMS = 1500;
thinkTimeMS = 200;
degPerSecTheta = 500;
degPerSecPhi = 800;
isSeeker = true;
seekRadius = $Bomber::SeekRadius;
maxSeekAngle = 45;
seekTime = $Bomber::SeekTime;
minSeekHeat = $Bomber::minSeekHeat;
minTargetingDistance = $Bomber::minTargetingDistance;
useTargetAudio = $Bomber::useTargetAudio;
attackRadius = 300;
};
datablock ShapeBaseImageData(BomberBellyTurretParam)
{
mountPoint = 2;
shapeFile = "turret_muzzlepoint.dts";
Projectile = sidewinder_MarkII;
ProjectileType = SeekerProjectile;
isSeeker = true;
seekRadius = $Bomber::SeekRadius;
maxSeekAngle = 45;
seekTime = $Bomber::SeekTime;
minSeekHeat = $Bomber::minSeekHeat;
minTargetingDistance = $Bomber::minTargetingDistance;
useTargetAudio = $Bomber::useTargetAudio;
};
//-------------------------------------
// BOMBER BOMB PROJECTILE
//-------------------------------------
datablock BombProjectileData(BomberBomb)
{
projectileShapeName = "bomb.dts";
emitterDelay = -1;
directDamage = 0.0;
hasDamageRadius = true;
indirectDamage = 4.0;
damageRadius = 30;
radiusDamageType = $DamageType::BomberBombs;
kickBackStrength = 2500;
explosion = "VehicleBombExplosion";
velInheritFactor = 1.0;
grenadeElasticity = 0.25;
grenadeFriction = 0.4;
armingDelayMS = 2000;
muzzleVelocity = 0.1;
drag = 0.3;
minRotSpeed = "60.0 0.0 0.0";
maxRotSpeed = "80.0 0.0 0.0";
scale = "1.0 1.0 1.0";
sound = BomberBombProjectileSound;
};
//-------------------------------------
// BOMBER BOMB CHARACTERISTICS
//-------------------------------------
datablock ItemData(BombAmmo)
{
className = Ammo;
catagory = "Ammo";
shapeFile = "repair_kit.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
pickupRadius = 1;
computeCRC = true;
};
datablock StaticShapeData(DropBombs)
{
catagory = "Turrets";
shapeFile = "bombers_eye.dts";
maxDamage = 1.0;
disabledLevel = 0.6;
destroyedLevel = 0.8;
};
datablock TurretImageData(BomberBombImage)
{
shapeFile = "turret_muzzlepoint.dts";
offset = "2 -4 -0.5";
mountPoint = 10;
projectile = BomberBomb;
projectileType = BombProjectile;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = true;
fireEnergy = 110.0;
minEnergy = 110.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "WaitFire1";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "WaitFire1";
stateTransitionOnTriggerDown[1] = "Fire1";
stateTransitionOnNoAmmo[1] = "NoAmmo1";
stateName[2] = "Fire1";
stateTransitionOnTimeout[2] = "Reload1";
stateTimeoutValue[2] = 0.32;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateSound[2] = BomberBombFireSound;
stateName[3] = "Reload1";
stateSequence[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateAllowImageChange[3] = false;
stateTransitionOnTimeout[3] = "WaitFire2";
stateTransitionOnNoAmmo[3] = "NoAmmo1";
stateName[4] = "NoAmmo1";
stateTransitionOnAmmo[4] = "Reload1";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateSequence[4] = "NoAmmo";
stateSequence[4] = "NoAmmo1";
stateTransitionOnTriggerDown[4] = "DryFire1";
stateName[5] = "DryFire1";
stateSound[5] = BomberBombDryFireSound;
stateTimeoutValue[5] = 0.5;
stateTransitionOnTimeout[5] = "NoAmmo1";
stateName[6] = "WaitFire2";
stateTransitionOnTriggerDown[6] = "Fire2";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateTransitionOnNoAmmo[6] = "NoAmmo";
stateTransitionOnNoAmmo[6] = "NoAmmo2";
stateName[7] = "Fire2";
stateTransitionOnTimeout[7] = "Reload2";
stateTimeoutValue[7] = 0.32;
stateScript[7] = "FirePair";
stateName[8] = "Reload2";
stateSequence[8] = "Reload";
stateTimeoutValue[8] = 0.1;
stateAllowImageChange[8] = false;
stateTransitionOnTimeout[8] = "WaitFire1";
stateTransitionOnNoAmmo[8] = "NoAmmo2";
stateName[9] = "NoAmmo2";
stateTransitionOnAmmo[9] = "Reload2";
// ---------------------------------------------
// z0dd - ZOD, 5/8/02. Incorrect parameter value
//stateSequence[9] = "NoAmmo";
stateSequence[9] = "NoAmmo2";
stateTransitionOnTriggerDown[9] = "DryFire2";
stateName[10] = "DryFire2";
stateSound[10] = BomberBombDryFireSound;
stateTimeoutValue[10] = 0.5;
stateTransitionOnTimeout[10] = "NoAmmo2";
};
datablock TurretImageData(BomberBombPairImage)
{
shapeFile = "turret_muzzlepoint.dts";
offset = "-2 -4 -0.5";
mountPoint = 10;
projectile = BomberBomb;
projectileType = BombProjectile;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = true;
fireEnergy = 110.0;
minEnergy = 110.0;
stateName[0] = "WaitFire";
stateTransitionOnTriggerDown[0] = "Fire";
stateName[1] = "Fire";
stateTransitionOnTimeout[1] = "StopFire";
stateTimeoutValue[1] = 0.13;
stateFire[1] = true;
stateAllowImageChange[1] = false;
stateSequence[1] = "Fire";
stateScript[1] = "onFire";
stateSound[1] = BomberBombFireSound;
stateName[2] = "StopFire";
stateTimeoutValue[2] = 0.1;
stateTransitionOnTimeout[2] = "WaitFire";
stateScript[2] = "stopFire";
};
//**************************************************************
// WEAPONS SPECIAL EFFECTS
//**************************************************************
datablock TracerProjectileData(BomberCGBullet)
{
doDynamicClientHits = true;
directDamage = 0.0;
directDamageType = $DamageType::ACCG;
explosion = MissileExplosion;
splash = ChaingunSplash;
hasDamageRadius = true;
indirectDamage = 0.75;
damageRadius = 5.0;
radiusDamageType = $DamageType::ACCG;
kickBackStrength = 5;
sound = ChaingunProjectile;
dryVelocity = 2500.0;
wetVelocity = 1000.0;
velInheritFactor = 1.0;
fizzleTimeMS = 3000;
lifetimeMS = 6000;
explodeOnDeath = false;
reflectOnWaterImpactAngle = 0.0;
explodeOnWaterImpact = false;
deflectionOnWaterImpact = 0.0;
fizzleUnderwaterMS = 3000;
tracerLength = 40.0;
tracerAlpha = false;
tracerMinPixels = 6;
tracerColor = 211.0/255.0 @ " " @ 215.0/255.0 @ " " @ 120.0/255.0 @ " 0.75";
tracerTex[0] = "special/tracer00";
tracerTex[1] = "special/tracercross";
tracerWidth = 0.25;
crossSize = 0.20;
crossViewAng = 0.990;
renderCross = true;
decalData[0] = MG42Decal1;
decalData[1] = MG42Decal2;
decalData[2] = MG42Decal3;
decalData[3] = MG42Decal4;
decalData[4] = MG42Decal5;
decalData[5] = MG42Decal6;
hasLight = true;
lightRadius = 5.0;
lightColor = "0.5 0.5 0.175";
};
datablock TurretImageData(BomberCGImage)
{
className = WeaponImage;
shapeFile = "turret_belly_barrell.dts";
offset = "0.1 0 0";
item = Chaingun;
projectile = BomberCGBullet;
projectileType = TracerProjectile;
projectileSpread = 2.0 / 1000.0;
emap = true;
casing = ShellDebris;
shellExitDir = "1.0 0.3 1.0";
shellExitOffset = "0.15 -0.56 -0.1";
shellExitVariance = 5.0;
shellVelocity = 0.0;
mountPoint = 1;
usesEnergy = true;
useMountEnergy = true;
useCapacitor = true;
minEnergy = 5;
fireEnergy = 5.0;
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "ActivateReady";
stateTimeoutValue[0] = 0.5;
stateSequence[0] = "Activate";
stateName[1] = "ActivateReady";
stateTransitionOnLoaded[1] = "Ready";
stateTransitionOnNoAmmo[1] = "NoAmmo";
stateName[2] = "Ready";
stateTransitionOnNoAmmo[2] = "NoAmmo";
stateTransitionOnTriggerDown[2] = "Fire";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Reload";
stateTimeoutValue[3] = 0.1;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateScript[3] = "onFire";
stateEmitterTime[3] = 0.2;
stateSound[3] = SniperFireSound;
stateName[4] = "Reload";
stateTransitionOnNoAmmo[4] = "NoAmmo";
stateTransitionOnTimeout[4] = "Ready";
stateTimeoutValue[4] = 0.4;
stateAllowImageChange[4] = false;
stateSound[4] = ChaingunDryFireSound;
stateName[5] = "NoAmmo";
stateTransitionOnAmmo[5] = "Reload";
stateSequence[5] = "NoAmmo";
stateTransitionOnTriggerDown[5] = "DryFire";
stateName[6] = "DryFire";
stateSound[6] = MissileReloadSound;
stateTimeoutValue[6] = 1.5;
stateTransitionOnTimeout[6] = "NoAmmo";
};
function BomberTurretBarrelPair::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
MissileSet.add(%p);
%target = %obj.getLockedTarget();
%homein = missileCheckAirTarget(%target);
if(%target && %homein)
%p.setObjectTarget(%target);
else if(%obj.isLocked())
%p.setPositionTarget(%obj.getLockedPosition());
else
%p.setNoTarget();
}
function BomberTurretBarrel::onFire(%data,%obj,%slot)
{
%p = Parent::onFire(%data, %obj, %slot);
MissileSet.add(%p);
%target = %obj.getLockedTarget();
%homein = missileCheckAirTarget(%target);
if(%target && %homein)
%p.setObjectTarget(%target);
else if(%obj.isLocked())
%p.setPositionTarget(%obj.getLockedPosition());
else
%p.setNoTarget();
}
function Bomberflyer::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

View file

@ -0,0 +1,673 @@
$Bomber::SeekRadius = 500;
$Bomber::SeekTime = 0.25;
$Bomber::minSeekHeat = 0.6;
$Bomber::minTargetingDistance = 15;
$Bomber::useTargetAudio = true;
//**************************************************************
// Shrikes/Apaches/Scouts
//**************************************************************
datablock ParticleData(VehicleBoomSmoke)
{
dragCoeffiecient = 0.2;
gravityCoefficient = -0.25; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 4000;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "1.0 0.7 0.5 1.0";
colors[1] = "0.2 0.2 0.2 1.0";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 3.0;
sizes[1] = 8.0;
sizes[2] = 3.0;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 1.0;
};
datablock ParticleEmitterData(VehicleBoomSmokeEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 10.0;
velocityVariance = 0.25;
thetaMin = 0.0;
thetaMax = 180.0;
lifetimeMS = 150;
particles = "VehicleBoomSmoke";
};
datablock ParticleData(MeDebrisFireParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.2;
inheritedVelFactor = 0.0;
lifetimeMS = 350;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = false;
spinRandomMin = -160.0;
spinRandomMax = 160.0;
animateTexture = true;
framesPerSec = 15;
animTexName[0] = "special/Explosion/exp_0016";
animTexName[1] = "special/Explosion/exp_0018";
animTexName[2] = "special/Explosion/exp_0020";
animTexName[3] = "special/Explosion/exp_0022";
animTexName[4] = "special/Explosion/exp_0024";
animTexName[5] = "special/Explosion/exp_0026";
animTexName[6] = "special/Explosion/exp_0028";
animTexName[7] = "special/Explosion/exp_0030";
animTexName[8] = "special/Explosion/exp_0032";
colors[0] = "1.0 0.7 0.5 1.0";
colors[1] = "1.0 0.5 0.2 1.0";
colors[2] = "1.0 0.25 0.1 0.0";
sizes[0] = 0.5;
sizes[1] = 1.5;
sizes[2] = 0.7;
times[0] = 0.0;
times[1] = 0.2;
times[2] = 1.0;
};
datablock ParticleEmitterData(MeDebrisFireEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 1;
ejectionVelocity = 0.25;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 175.0;
particles = "MeDebrisFireParticle";
};
datablock ParticleData( MeDebrisSmokeParticle )
{
dragCoeffiecient = 4.0;
gravityCoefficient = -0.00; // rises slowly
inheritedVelFactor = 0.2;
lifetimeMS = 2500;
lifetimeVarianceMS = 100; // ...more or less
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0] = "0.3 0.3 0.3 0.0";
colors[1] = "0.2 0.2 0.2 1.0";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 2;
sizes[1] = 3.0;
sizes[2] = 4.5;
times[0] = 0.0;
times[1] = 0.7;
times[2] = 1.0;
};
datablock ParticleEmitterData( MeDebrisSmokeEmitter )
{
ejectionPeriodMS = 15;
periodVarianceMS = 2;
ejectionVelocity = 1.0; // A little oomph at the back end
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 15.0;
useEmitterSizes = true;
particles = "MeDebrisSmokeParticle";
};
datablock DebrisData( MeVehicleFireballDebris )
{
emitters[0] = MeDebrisSmokeEmitter;
emitters[1] = MeDebrisFireEmitter;
explosion = DebrisExplosion;
explodeOnMaxBounce = true;
elasticity = 0.4;
friction = 0.2;
lifetime = 100.0;
lifetimeVariance = 30.0;
numBounces = 0;
bounceVariance = 0;
};
datablock DebrisData( MeVSpikeDebris )
{
emitters[0] = VSmokeSpikeEmitter;
explodeOnMaxBounce = true;
elasticity = 0.4;
friction = 0.2;
lifetime = 0.3;
lifetimeVariance = 0.02;
};
datablock ExplosionData(MeVSpikeExplosion)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
delayMS = 0;
offset = 0.0;
playSpeed = 0.75;
sizes[0] = "5.0 5.0 5.0";
sizes[1] = "5.0 5.0 5.0";
times[0] = 0.0;
times[1] = 1.0;
debris = MeVSpikeDebris;
debrisThetaMin = 10;
debrisThetaMax = 175;
debrisNum = 5;
debrisNumVariance = 3;
debrisVelocity = 30.0;
debrisVelocityVariance = 7.0;
};
datablock ExplosionData(MeVehicleExplosion)
{
explosionShape = "disc_explosion.dts";
playSpeed = 1.5;
soundProfile = VehicleExplosionSound;
faceViewer = true;
emitter[0] = VehicleBoomSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 60;
debrisThetaMax = 90;
debrisNum = 20;
debrisNumVariance = 5;
debrisVelocity = 25.0;
debrisVelocityVariance = 2.0;
subExplosion = MeVSpikeExplosion;
shakeCamera = true;
camShakeFreq = "11.0 13.0 9.0";
camShakeAmp = "40.0 40.0 40.0";
camShakeDuration = 0.7;
camShakeRadius = 25.0;
};
datablock ParticleData(MeHeavyDamageSmokeParticle)
{
dragCoefficient = 0.4;
gravityCoefficient = -0.01;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 5000;
lifetimeVarianceMS = 200;
useInvAlpha = true;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
textureName = "particleTest";
colors[0] = "1.0 0.4 0.2 1.0";
colors[1] = "1.0 0.8 0.2 0.8";
colors[2] = "0.1 0.1 0.1 0.3";
colors[3] = "0.2 0.2 0.2 0.15";
colors[4] = "0.3 0.3 0.3 0.0";
sizes[0] = 2.0;
sizes[1] = 3.0;
sizes[2] = 4.5;
sizes[3] = 5.0;
sizes[4] = 8.0;
times[0] = 0.0;
times[1] = 0.05;
times[2] = 0.15;
times[3] = 0.4;
times[4] = 1.0;
};
datablock ParticleEmitterData(MeHeavyDamageSmoke)
{
ejectionPeriodMS = 3;
periodVarianceMS = 2;
ejectionVelocity = 3.0;
velocityVariance = 0.5;
ejectionOffset = 1.5;
thetaMin = 0;
thetaMax = 180;
overrideAdvances = false;
particles = "MeHeavyDamageSmokeParticle";
};
datablock ParticleData(MeLightDamageSmokeParticle)
{
dragCoefficient = 0.0;
gravityCoefficient = -0.01;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 4000;
lifetimeVarianceMS = 200;
useInvAlpha = true;
spinRandomMin = -45.0;
spinRandomMax = 45.0;
textureName = "particleTest";
colors[0] = "0.1 0.1 0.1 0.5";
colors[1] = "0.2 0.2 0.2 0.7";
colors[2] = "0.3 0.3 0.3 0.0";
sizes[0] = 1.5;
sizes[1] = 3.0;
sizes[2] = 4.0;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 1.0;
};
datablock ParticleEmitterData(MeLightDamageSmoke)
{
ejectionPeriodMS = 15;
periodVarianceMS = 6;
ejectionVelocity = 4.0;
velocityVariance = 0.5;
ejectionOffset = 1.5;
thetaMin = 0;
thetaMax = 180;
overrideAdvances = false;
particles = "MeLightDamageSmokeParticle";
};
datablock ParticleData(MeDamageBubbleParticle)
{
dragCoefficient = 0.0;
gravityCoefficient = -0.04;
inheritedVelFactor = 0.5;
constantAcceleration = 0.0;
lifetimeMS = 2000;
lifetimeVarianceMS = 200;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 90.0;
textureName = "special/bubbles";
colors[0] = "0.7 0.7 0.7 0.0";
colors[1] = "0.3 0.3 0.3 1.0";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 0.4;
sizes[1] = 1.6;
sizes[2] = 2.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(MeDamageBubbles)
{
ejectionPeriodMS = 15;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 0.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 35;
overrideAdvances = false;
particles = "MeDamageBubbleParticle";
};
datablock DebrisData( MeShapeDebris )
{
explodeOnMaxBounce = false;
elasticity = 0.1;
friction = 0.5;
lifetime = 25.0;
lifetimeVariance = 0.0;
minSpinSpeed = 0;
maxSpinSpeed = 25;
numBounces = 10;
bounceVariance = 0;
staticOnMaxBounce = true;
useRadiusMass = true;
baseRadius = 1.0;
velocity = 17.0;
velocityVariance = 7.0;
};
datablock DebrisData( GShapeDebris )
{
explodeOnMaxBounce = false;
elasticity = 0.0;
friction = 0.5;
lifetime = 25.0;
lifetimeVariance = 0.0;
minSpinSpeed = 0;
maxSpinSpeed = 5;
numBounces = 10;
bounceVariance = 0;
staticOnMaxBounce = true;
useRadiusMass = true;
baseRadius = 1.0;
velocity = 0.0;
velocityVariance = 0.0;
};
//**************************************************************
// Bombers/Havocs/Blackhawks
//**************************************************************
datablock ExplosionData(MFVSubExplosion)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
delayMS = 0;
offset = 0.0;
playSpeed = 0.65;
sizes[0] = "8.0 8.0 8.0";
sizes[1] = "8.0 8.0 8.0";
times[0] = 0.0;
times[1] = 1.0;
debris = MeVSpikeDebris;
debrisThetaMin = 10;
debrisThetaMax = 175;
debrisNum = 5;
debrisNumVariance = 3;
debrisVelocity = 30.0;
debrisVelocityVariance = 7.0;
};
datablock ExplosionData(MFVehicleExplosion)
{
explosionShape = "disc_explosion.dts";
playSpeed = 1.5;
soundProfile = VehicleExplosionSound;
faceViewer = true;
emitter[0] = VehicleBoomSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 35;
debrisThetaMax = 95;
debrisNum = 25;
debrisNumVariance = 5;
debrisVelocity = 20.0;
debrisVelocityVariance = 5.0;
subExplosion = MFVSubExplosion;
shakeCamera = true;
camShakeFreq = "11.0 13.0 9.0";
camShakeAmp = "40.0 40.0 40.0";
camShakeDuration = 0.7;
camShakeRadius = 35.0;
};
datablock ParticleEmitterData(MFHeavyDamageSmoke)
{
ejectionPeriodMS = 5;
periodVarianceMS = 2;
ejectionVelocity = 5.0;
velocityVariance = 1.0;
ejectionOffset = 2.5;
thetaMin = 0;
thetaMax = 180;
overrideAdvances = false;
particles = "MeHeavyDamageSmokeParticle";
};
datablock ParticleEmitterData(MFLightDamageSmoke)
{
ejectionPeriodMS = 15;
periodVarianceMS = 6;
ejectionVelocity = 5.0;
velocityVariance = 1.0;
ejectionOffset = 2.0;
thetaMin = 0;
thetaMax = 180;
overrideAdvances = false;
particles = "MeLightDamageSmokeParticle";
};
//**************************************************************
// Tanks/APC/MPB
//**************************************************************
datablock ParticleEmitterData(MeHGHeavyDamageSmoke)
{
ejectionPeriodMS = 7;
periodVarianceMS = 2;
ejectionVelocity = 3.0;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 135;
overrideAdvances = false;
particles = "MeLightDamageSmokeParticle";
};
datablock ParticleData(HGVExplosionSmoke)
{
dragCoeffiecient = 0.4;
gravityCoefficient = 0.0; // rises slowly
inheritedVelFactor = 0.025;
lifetimeMS = 2000;
lifetimeVarianceMS = 0;
textureName = "particleTest";
useInvAlpha = true;
spinRandomMin = -200.0;
spinRandomMax = 200.0;
textureName = "special/Smoke/smoke_001";
colors[0] = "1.0 0.7 0.0 1.0";
colors[1] = "0.2 0.2 0.2 0.5";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 5.0;
sizes[1] = 10.0;
sizes[2] = 12.0;
times[0] = 0.0;
times[1] = 0.4;
times[2] = 1.0;
};
datablock ParticleEmitterData(HGVExplosionSmokeEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionVelocity = 20.0;
velocityVariance = 4.0;
thetaMin = 70.0;
thetaMax = 110.0;
lifetimeMS = 150;
particles = "HGVExplosionSmoke";
};
datablock ExplosionData(HGVSubExplosion)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 3000;
delayMS = 0;
offset = 0.0;
playSpeed = 0.5;
sizes[0] = "8.0 8.0 8.0";
sizes[1] = "8.0 8.0 8.0";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = VehicleBoomSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 60;
debrisThetaMax = 90;
debrisNum = 10;
debrisNumVariance = 5;
debrisVelocity = 10.0;
debrisVelocityVariance = 9.0;
};
datablock ExplosionData(HGVSubExplosion2)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 3000;
delayMS = 200;
offset = 8.0;
playSpeed = 0.75;
sizes[0] = "4.0 4.0 4.0";
sizes[1] = "4.0 4.0 4.0";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = HGVExplosionSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 60;
debrisThetaMax = 120;
debrisNum = 5;
debrisNumVariance = 2;
debrisVelocity = 15.0;
debrisVelocityVariance = 5.0;
};
datablock ExplosionData(HGVSubExplosion3)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 3000;
delayMS = 400;
offset = 12.0;
playSpeed = 0.8;
sizes[0] = "3.5 3.5 3.5";
sizes[1] = "3.5 3.5 3.5";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = HGVExplosionSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 60;
debrisThetaMax = 120;
debrisNum = 5;
debrisNumVariance = 2;
debrisVelocity = 15.0;
debrisVelocityVariance = 5.0;
};
datablock ExplosionData(HGVSubExplosion4)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 3000;
delayMS = 600;
offset = 15.0;
playSpeed = 0.8;
sizes[0] = "3.0 3.0 3.0";
sizes[1] = "3.0 3.0 3.0";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = HGVExplosionSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 60;
debrisThetaMax = 120;
debrisNum = 5;
debrisNumVariance = 2;
debrisVelocity = 15.0;
debrisVelocityVariance = 5.0;
};
datablock ExplosionData(HGVSubExplosion5)
{
explosionShape = "effect_plasma_explosion.dts";
faceViewer = true;
lifetimeMS = 3000;
delayMS = 900;
offset = 20.0;
playSpeed = 0.4;
sizes[0] = "5.0 5.0 5.0";
sizes[1] = "5.0 5.0 5.0";
times[0] = 0.0;
times[1] = 1.0;
emitter[0] = VehicleBoomSmokeEmitter;
debris = MeVehicleFireballDebris;
debrisThetaMin = 0;
debrisThetaMax = 90;
debrisNum = 10;
debrisNumVariance = 0;
debrisVelocity = 15.0;
debrisVelocityVariance = 5.0;
};
datablock ExplosionData(HGVehicleExplosion)
{
soundProfile = VehicleExplosionSound;
subExplosion[0] = HGVSubExplosion;
subExplosion[1] = HGVSubExplosion2;
subExplosion[2] = HGVSubExplosion3;
subExplosion[3] = HGVSubExplosion4;
subExplosion[4] = HGVSubExplosion5;
shakeCamera = true;
camShakeFreq = "11.0 13.0 9.0";
camShakeAmp = "40.0 40.0 40.0";
camShakeDuration = 1.0;
camShakeRadius = 40.0;
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,464 @@
//**************************************************************
// HAVOC HEAVY TRANSPORT FLIER
//**************************************************************
//**************************************************************
// SOUNDS
//**************************************************************
datablock EffectProfile(HAPCFlyerEngineEffect)
{
effectname = "vehicles/htransport_thrust";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock EffectProfile(HAPCFlyerThrustEffect)
{
effectname = "vehicles/htransport_boost";
minDistance = 5.0;
maxDistance = 10.0;
};
datablock AudioProfile(HAPCFlyerEngineSound)
{
filename = "fx/vehicles/htransport_thrust.wav";
description = AudioDefaultLooping3d;
effect = HAPCFlyerEngineEffect;
};
datablock AudioProfile(HAPCFlyerThrustSound)
{
filename = "fx/vehicles/htransport_boost.wav";
description = AudioDefaultLooping3d;
effect = HAPCFlyerThrustEffect;
};
//**************************************************************
// VEHICLE CHARACTERISTICS
//**************************************************************
datablock FlyingVehicleData(HAPCFlyer) : HavocDamageProfile
{
spawnOffset = "0 0 6";
renderWhenDestroyed = false;
catagory = "Vehicles";
shapeFile = "vehicle_air_hapc.dts";
multipassenger = true;
computeCRC = true;
debrisShapeName = "vehicle_air_hapc.dts";
debris = ShapeDebris;
drag = 0.2;
density = 1.0;
mountPose[0] = sitting;
// mountPose[1] = sitting;
numMountPoints = 6;
isProtectedMountPoint[0] = true;
isProtectedMountPoint[1] = false;
isProtectedMountPoint[2] = false;
isProtectedMountPoint[3] = false;
isProtectedMountPoint[4] = false;
isProtectedMountPoint[5] = false;
canControl = true;
cameraMaxDist = 17;
cameraOffset = 2;
cameraLag = 8.5;
explosion = MFVehicleExplosion;
explosionDamage = 1.5;
explosionRadius = 20.0;
maxDamage = 8.0;
destroyedLevel = 8.0;
HDAddMassLevel = 5.6;
HDMassImage = HFlyerHDMassImage;
isShielded = false;
rechargeRate = 1.0;
energyPerDamagePoint = 175;
maxEnergy = 550;
minDrag = 100; // Linear Drag
rotationalDrag = 2700; // Anguler Drag
// Auto stabilize speed
maxAutoSpeed = 10;
autoAngularForce = 3000; // Angular stabilizer force
autoLinearForce = 450; // Linear stabilzer force
autoInputDamping = 0.95; //
// Maneuvering
maxSteeringAngle = 8;
horizontalSurfaceForce = 10; // Horizontal center "wing"
verticalSurfaceForce = 10; // Vertical center "wing"
maneuveringForce = 6000; // Horizontal jets
steeringForce = 1000; // Steering jets
steeringRollForce = 2500; // Steering jets
rollForce = 12; // Auto-roll
hoverHeight = 6; // Height off the ground at rest
createHoverHeight = 6; // Height off the ground when created
maxForwardSpeed = 90; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 5000;
minJetEnergy = 55;
jetEnergyDrain = 3.0;
vertThrustMultiple = 3.0;
dustEmitter = LargeVehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 2.0;
damageEmitter[0] = MFLightDamageSmoke;
damageEmitter[1] = MFHeavyDamageSmoke;
damageEmitter[2] = MeDamageBubbles;
damageEmitterOffset[0] = "3.0 -3.0 0.0 ";
damageEmitterOffset[1] = "-3.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 2;
// Rigid body
mass = 450;
bodyFriction = 0;
bodyRestitution = 0.3;
minRollSpeed = 0;
softImpactSpeed = 12; // Sound hooks. This is the soft hit.
hardImpactSpeed = 15; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 25; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.060;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 28;
collDamageMultiplier = 0.020;
//
minTrailSpeed = 15;
trailEmitter = ContrailEmitter;
forwardJetEmitter = FlyerJetEmitter;
downJetEmitter = FlyerJetEmitter;
//
jetSound = HAPCFlyerThrustSound;
engineSound = HAPCFlyerEngineSound;
softImpactSound = SoftImpactSound;
hardImpactSound = HardImpactSound;
//wheelImpactSound = WheelImpactSound;
//
softSplashSoundVelocity = 5.0;
mediumSplashSoundVelocity = 8.0;
hardSplashSoundVelocity = 12.0;
exitSplashSoundVelocity = 8.0;
exitingWater = VehicleExitWaterHardSound;
impactWaterEasy = VehicleImpactWaterSoftSound;
impactWaterMedium = VehicleImpactWaterMediumSound;
impactWaterHard = VehicleImpactWaterHardSound;
waterWakeSound = VehicleWakeHardSplashSound;
minMountDist = 7;
splashEmitter[0] = VehicleFoamDropletsEmitter;
splashEmitter[1] = VehicleFoamEmitter;
shieldImpact = VehicleShieldImpact;
cmdCategory = "Tactical";
cmdIcon = CMDFlyingHAPCIcon;
cmdMiniIconName = "commander/MiniIcons/com_hapc_grey";
targetNameTag = 'HVC Golem';
targetTypeTag = 'Heavy Transport';
sensorData = PlayerSensor;
checkRadius = 7.8115;
observeParameters = "1 15 15";
stuckTimerTicks = 32; // If the hapc spends more than 1 sec in contact with something
stuckTimerAngle = 80; // with a > 80 deg. pitch, BOOM!
shieldEffectScale = "1.0 0.9375 0.45";
max[PlasmaAmmo] = 20;
replaceTime = 40;
};
function HAPCFlyer::hasDismountOverrides(%data, %obj)
{
return true;
}
function HAPCFlyer::getDismountOverride(%data, %obj, %mounted)
{
%node = -1;
for (%i = 0; %i < %data.numMountPoints; %i++)
{
if (%obj.getMountNodeObject(%i) == %mounted)
{
%node = %i;
break;
}
}
if (%node == -1)
{
warning("Couldn't find object mount point");
return "0 0 1";
}
if (%node == 3 || %node == 2)
{
return "-1 0 1";
}
else if (%node == 5 || %node == 4)
{
return "1 0 1";
}
else
{
return "0 0 1";
}
}
//**************************************************************
// Vehicle pickup
//**************************************************************
datablock ShapeBaseImageData(FFTmountImage)
{
className = "WeaponImage";
shapeFile = "vehicle_land_mpbase.dts";
item = Disc;
offset = "0 0 -6";
emap = true;
mass = 500;
};
datablock ShapeBaseImageData(PanzermountImage)
{
className = "WeaponImage";
shapeFile = "vehicle_grav_tank.dts";
item = Disc;
offset = "0 0 -6";
emap = true;
mass = 325;
};
datablock ShapeBaseImageData(WC1Image)
{
className = "WeaponImage";
shapeFile = "vehicle_grav_scout.dts";
item = Disc;
offset = "0 0 -5"; // L/R - F/B - T/B
emap = true;
mass = 50;
};
datablock ShapeBaseImageData(WC2Image)
{
className = "WeaponImage";
shapeFile = "vehicle_grav_scout.dts";
item = Disc;
offset = "0 4 -5"; // L/R - F/B - T/B
emap = true;
mass = 50;
};
function HAPCflyer::onTrigger(%data, %obj, %trigger, %state)
{
if(!%obj.hasVEH && %state == 1 && %trigger == 0)
{
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType;
%dir = %obj.getTransform();
%dir = getWord(%dir, 5);
if(%dir > 0)
%dir *= -1;
if(vectorDot("0 0 -10", "0 0 "@ %dir) < 9)
return;
%vector = vectorAdd(%obj.getWorldBoxCenter(), "0 0 -10");
%searchResult = containerRayCast(%obj.getWorldBoxCenter(), %vector, %mask, %obj);
if(%searchResult)
{
%searchObj = GetWord(%searchResult, 0);
if(%searchObj.getClassName() $= "wheeledVehicle"){
%searchObj.setTransform(vectorAdd(%searchObj.getPosition(), "0 0 10000"));
%searchObj.setCloaked(true);
%obj.mountImage(FFTmountImage, 6);
%searchObj.setFrozenState(true);
%obj.hasVEH = true;
%obj.VEHmounted = %searchObj;
}
else if(%searchObj.getClassName() $= "HoverVehicle"){
%searchObj.setTransform(vectorAdd(%searchObj.getPosition(), "0 0 10000"));
%searchObj.setCloaked(true);
%searchObj.setFrozenState(true);
%obj.hasVEH = true;
%obj.VEHmounted = %searchObj;
if(%searchObj.getDataBlock().getName() $= "ScoutVehicle")
%obj.mountImage(WC1Image, 6);
else
%obj.mountImage(PanzermountImage, 6);
}
}
}
else if(%obj.hasVEH && %state == 1 && %trigger == 0)
{
%dir = %obj.getTransform();
%dir = getWord(%dir, 5);
if(%dir > 0)
%dir *= -1;
//echo(vectorDot("0 0 -10", "0 0 "@ %dir));
if(vectorDot("0 0 -10", "0 0 "@ %dir) < 9)
return;
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::TerrainObjectType;
%vector = vectorAdd(%obj.getWorldBoxCenter(), "0 0 -15");
%searchResult = containerRayCast(%obj.getWorldBoxCenter(), %vector, %mask, %obj);
%vec = %Obj.getvelocity();
if(%searchResult)
{
return;
}
if (%obj.VEHmounted !$= "")
{
%obj.VEHmounted.setFrozenState(false);
%obj.VEHmounted.setTransform(%obj.getTransform());
%vector = vectorAdd("0 0 -13", %obj.getWorldBoxCenter());
%obj.VEHmounted.setTransform(%vector);
%obj.VEHmounted.applyImpulse(%obj.VEHmounted.getPosition(),vectorScale(%vec,%obj.VEHmounted.getDataBlock().mass));
%obj.VEHmounted.setCloaked(false);
%obj.unMountImage(6);
%obj.unMountObject(%obj.MPBstaticMount);
%obj.hasVEH = false;
%obj.VEHmounted = "";
%obj.canpickupWC = false;
}
}
else if (%trigger ==4) // Throw flare
{
switch (%state)
{
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(5, false);
case 1:
if (%obj.inv[PlasmaAmmo] > 0)
{
%obj.fireWeapon = true;
%obj.setImageTrigger(5, true);
%obj.decInventory(PlasmaAmmo, 1);
%p = new FlareProjectile()
{
dataBlock = FlareGrenadeProj;
initialDirection = "0 0 -1";
initialPosition = getBoxCenter(%obj.getWorldBox());
sourceObject = %obj;
sourceSlot = 0;
};
FlareSet.add(%p);
MissionCleanup.add(%p);
serverPlay3D(GrenadeThrowSound, getBoxCenter(%obj.getWorldBox()));
%p.schedule(6000, "delete");
// miscellaneous grenade-throwing cleanup stuff
%obj.lastThrowTime[%data] = getSimTime();
%obj.throwStrength = 0;
}
}
}
%up = %obj.getUpVector();
if(%state == 1 && %trigger == 5 && vectorDist(%up,"0 0 1") <= 0.3){
%frd = %obj.getForwardVector();
%right = vectorNormalize(vectorSub(%obj.getEdge("1 0 0"),%obj.getEdge("-1 0 0")));
for(%i = 2; %i < 6; %i++){
if(%obj.getMountNodeObject(%i)){
%plyr = %obj.getMountNodeObject(%i);
%plyr.unmount();
%plyr.setPosition("0 0 1000");
%vec = vectorAdd(vectorScale(%right,getWord($PodPos[%i],0)),vectorScale(%frd,getWord($PodPos[%i],1)));
%pos = vectorAdd(%obj.getPosition(),%vec);
%pod = MakeDropPod(vectorAdd(%pos,"0 0 -15"),%obj.team);
slowDropPod(%pod);
// Eolk - was wrong. Didn't mount right.
// %pod.schedule(10, "mountObject", %plyr, 0);
%plyr.getDatablock().schedule(10, "onCollision", %plyr, %pod, 0);
commandToClient(%plyr.client, 'setHudMode', 'Standard', "", 0);
}
}
}
}
$PodPos[2] = "-3 7";
$PodPos[3] = "-3 3";
$PodPos[4] = "3 3";
$PodPos[5] = "3 7";
function HAPCflyer::onDestroyed(%data, %obj, %prevState){
%vec = %Obj.getvelocity();
if (%obj.VEHmounted !$= "")
{
%obj.VEHmounted.setFrozenState(false);
%obj.VEHmounted.setTransform(%obj.getTransform());
%vector = vectorAdd("0 0 -13", %obj.getWorldBoxCenter());
%obj.VEHmounted.setTransform(%vector);
%obj.VEHmounted.applyImpulse(%obj.VEHmounted.getPosition(),vectorScale(%vec,%obj.VEHmounted.getDataBlock().mass));
%obj.VEHmounted.setCloaked(false);
%obj.unMountImage(6);
%obj.unMountObject(%obj.MPBstaticMount);
%obj.hasVEH = false;
%obj.VEHmounted = "";
%obj.canpickupWC = false;
if(%obj.hasWC){
%obj.WCmounted.setFrozenState(false);
%obj.WCmounted.setTransform(%obj.getTransform());
%vector = vectorAdd("0 6 -13", %obj.getWorldBoxCenter());
%obj.WCmounted.setTransform(%vector);
%obj.WCmounted.applyImpulse(%obj.MPBmounted.getPosition(), vectorScale(%vec,ScoutVehicle.mass));
%obj.WCmounted.setCloaked(false);
%obj.unMountImage(7);
%obj.unMountObject(%obj.MPBstaticMount);
%obj.hasWC = false;
%obj.WCmounted = "";
}
}
Parent::onDestroyed(%data, %obj, %prevState);
}
function HAPCflyer::onEnterLiquid(%data, %obj, %coverage, %type)
{
switch(%type)
{
case 0:
//Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 1:
//Ocean Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 2:
//River Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 3:
//Stagnant Water
%obj.setHeat(0.0);
%obj.liquidDamage(%data, 0.1, $DamageType::Crash);
case 4:
//Lava
%obj.liquidDamage(%data, $VehicleDamageLava, $DamageType::Lava);
case 5:
//Hot Lava
%obj.liquidDamage(%data, $VehicleDamageHotLava, $DamageType::Lava);
case 6:
//Crusty Lava
%obj.liquidDamage(%data, $VehicleDamageCrustyLava, $DamageType::Lava);
case 7:
//Quick Sand
}
}

Some files were not shown because too many files have changed in this diff Show more