mirror of
https://github.com/mostlikely4r/construction-mod.git
synced 2026-01-19 11:14:45 +00:00
Initial commit
This commit is contained in:
parent
d305f694ac
commit
cbb5d08a0c
53
Construction Adv Launcher.bat
Normal file
53
Construction Adv Launcher.bat
Normal 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
|
||||
3
Construction Dedicated Server.bat
Normal file
3
Construction Dedicated Server.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
cd ..\
|
||||
start ispawn.exe 28000 Tribes2.exe -dedicated -mod Construction
|
||||
exit
|
||||
3
Construction Offline Practice And LAN.bat
Normal file
3
Construction Offline Practice And LAN.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
cd ..\
|
||||
start Tribes2.exe -nologin -mod Construction
|
||||
exit
|
||||
3
Construction Online Listen Server.bat
Normal file
3
Construction Online Listen Server.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
cd ..\
|
||||
start Tribes2.exe -online -mod Construction
|
||||
exit
|
||||
7
ConstructionPreferences.cs
Normal file
7
ConstructionPreferences.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
//Construction 0.70 Server Configuration File
|
||||
|
||||
//Logging:
|
||||
$Construction::Logging::EchoChat = 1;
|
||||
$Construction::Logging::LogConnects = 1; //disconnects too
|
||||
$Construction::Logging::LogChat = 1;
|
||||
|
||||
56
Credits.txt
Normal file
56
Credits.txt
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
Don't forget to add yourself to this list.. :D
|
||||
|
||||
**JackTL**
|
||||
For:
|
||||
Maintaining mod from v50a.
|
||||
|
||||
**Construct**
|
||||
For:
|
||||
providing main idea.
|
||||
still providing great ideas to keep the mod going.
|
||||
Testing and tweacking.
|
||||
lot's of additions and coding help.
|
||||
The neat installer.
|
||||
|
||||
**Tutorial makers**
|
||||
For:
|
||||
Making tutorials.. duh..
|
||||
|
||||
**Lucid**
|
||||
For:
|
||||
Helping me with the code.
|
||||
providing me with a great decontruct gun.
|
||||
the neat looking loadscreen.
|
||||
For being willing to help me with lots of stuff
|
||||
|
||||
**Badshot**
|
||||
For:
|
||||
Taking the time to help me with some nasty bugs.
|
||||
Knowing alot for tribes2 stuff.. and being willing to share it.
|
||||
Helping all those other modders.
|
||||
|
||||
**DynaBlade**
|
||||
For:
|
||||
His Awesome function librarys
|
||||
|
||||
**T2CC**
|
||||
For:
|
||||
Their great forum and putting all that coding power at your very fingertips.
|
||||
|
||||
**Child_Killer**
|
||||
For:
|
||||
Providing code that was posted before my time and being a great help so far.
|
||||
|
||||
**All those who I fogot to mention sofar**
|
||||
For:
|
||||
Whatever they did to help this mod.
|
||||
|
||||
**All those who wanted to help but couldn't**
|
||||
Remember, it's the thought that counts ;)
|
||||
|
||||
|
||||
**By**
|
||||
Mostlikely,
|
||||
|
||||
I don't need any credit for this mod, it was created for the people who want to play it (which includes me)
|
||||
Feel free to use any stuff from this mod or ask me about it if you can't extract it somehow.
|
||||
30
DSO Remover.bat
Normal file
30
DSO Remover.bat
Normal 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
|
||||
1108
Version-history.txt
Normal file
1108
Version-history.txt
Normal file
File diff suppressed because it is too large
Load diff
86
readme.txt
Normal file
86
readme.txt
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
Note: This readme.txt has not been updated recently. Please see Version-history.txt for latest changes.
|
||||
|
||||
----
|
||||
|
||||
The BASIC IDEA:
|
||||
|
||||
-------------------------------------------------------------------------------------------
|
||||
We just like to build stuff.
|
||||
-------------------------------------------------------------------------------------------
|
||||
Up to now mods like ninja mod and warped where used to create the wierdest of structures.
|
||||
However these mods being combat orientated where limited in their building flexiblity.
|
||||
Therefor the man with the vision started "the construction mod" (or is it the mod named "construction"?)
|
||||
Anyway this mod will feature tools to make building easier, better, more realistic, more balanced and all that what other modders promise.
|
||||
It might someday very well feature gameplay that suits builders as well as non-builders.
|
||||
However until that day this mod remains for the one intrested in building and only building.
|
||||
But hey, there's a builder in everyone.
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
*******************Features******************
|
||||
|
||||
[[Beacon switching]]
|
||||
-Some packs have more than one function.
|
||||
-use the beacon key to switch.
|
||||
|
||||
[[Border snapping]]
|
||||
-When deploying on the far edge of an object the object will snap correctly to the border.
|
||||
|
||||
****************Current deployables***********
|
||||
|
||||
[[Light support beam]]<<Light armor>>
|
||||
-Comes in 5 basic lengths 1.5 meter, 4 meter, 8 meter, 40 meter and 160 meter.
|
||||
-Has two smart functions
|
||||
+auto-size, will scales the beam between 0.5 and 16 meter, if not confined it will scale to 4 meters.
|
||||
+Pad, Sizes like the auto-size beam, but also streches to create a platform.
|
||||
|
||||
[[Light Blast Wall]]<<Light armor>>
|
||||
-Works like the padsetting of the light support beam.
|
||||
-User can specify if he's in or out side his building for deploy adjustments
|
||||
-Light Blast walls can now create an good defence for buildings.
|
||||
|
||||
Problems: Placing stuff on them doesn't not work 100%
|
||||
|
||||
[[Light Walk Way]]<<Light armor>>
|
||||
-Just face the edge of a cliff and deploy to create handy walkways.
|
||||
-Can be set to slope 0%, 20%, 45% and 90% up and down.
|
||||
-Use the beacons to switch modes.
|
||||
|
||||
[[Medium support Beam]]<<Medium armor>>
|
||||
-Much stronger than it's light counter part.
|
||||
-Doesn't adjust in lenght.
|
||||
-Comes with rings you can deploy on, and stand on to easaly deploy another medium spine ontop.
|
||||
-The rings can be removed sperately.
|
||||
|
||||
[[Medium Floor]]<<Medium armor>>
|
||||
-Deploy these for a good start.
|
||||
-Deploy floors on floors to create an adjectand floor at the closest edge your deploying on.
|
||||
|
||||
[[Jumpad]]<<Medium armor>>
|
||||
-Launch the player up some distance.
|
||||
|
||||
[[Telleporter]]<<Heavy armor>>
|
||||
-40 different telle port frequencies.
|
||||
-Will only telle port to the frequency it's set to.
|
||||
-Both teams use the same 40 frequencies.
|
||||
-Dangerous side effects that become worse when the telleport is damaged.
|
||||
|
||||
[[Energizers]]<<Heavy armor>>
|
||||
-Will replenish the energy of any player within its range.
|
||||
-Using a higly unstable reactor.
|
||||
-Don't touch these, and protect them from damage at all cost.
|
||||
|
||||
[[Disk turret]]<<Medium armor>>
|
||||
-Usefull for protection
|
||||
-Be carefull, if they hit your base, it will take damage.
|
||||
|
||||
[[Deployable base turret]]<<Heavy armor>>
|
||||
-Deploy these for extra protection.
|
||||
|
||||
[[Deployable tree]]<<Medium/Heavy armors>>
|
||||
-Make places look nicer with these things.
|
||||
|
||||
Problems: Deploying on them will be screwed up.
|
||||
|
||||
[[Deconsruct Gun]]<<all armors>>
|
||||
-If you make an mistake you can correct it with this with out any dangerous side effects.
|
||||
-Make sure you remove mistakes right after you made them.
|
||||
100
scripts/ConstructionGame.cs
Normal file
100
scripts/ConstructionGame.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// DisplayName = Construction
|
||||
|
||||
//--- GAME RULES BEGIN ---
|
||||
// Build
|
||||
//--- GAME RULES END ---
|
||||
|
||||
// spam fix
|
||||
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) {
|
||||
}
|
||||
|
||||
275
scripts/Function Library R3.txt
Normal file
275
scripts/Function Library R3.txt
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
Function.cs documantation - v3.5
|
||||
Created by DynaBlade
|
||||
==================================
|
||||
I dont mind if you use my scripts, as long as you say that
|
||||
you are using them somewhere in the credits, say a webpage or a startup screen.
|
||||
IF YOU DO NOT KNOW HOW TO USE THIS FUNCTION LIBRARY DO NOT ASK ME! This is
|
||||
provided as a library reference only!
|
||||
All functions used here are made strictly by DynaBlade.
|
||||
Functions made in the other attached files are made by their respective authors.
|
||||
|
||||
|
||||
TypeMasks
|
||||
---------
|
||||
$AllObjMask
|
||||
Every object in T2 falls under this category. Use this in your raycasts and
|
||||
containerBox searches if you just want to find anything
|
||||
|
||||
$DefaultLOSMask
|
||||
Basic mask, usually used with raycasting LOS
|
||||
|
||||
$CoreObjectMask
|
||||
Players, Vehicles, Stations, Generators and Sensors fall in this category
|
||||
|
||||
$EverythingObjectMask (not done)
|
||||
This includes everything, even projectiles and possibly GUI objects!
|
||||
|
||||
ShapeBase Commands
|
||||
------------------
|
||||
These commands work on any object derived from ShapeBase.
|
||||
|
||||
%obj.getRotation()
|
||||
Gets the rotation of the object
|
||||
|
||||
%obj.setRotation(%rot)
|
||||
Sets the object's rotation of to %rot
|
||||
|
||||
%obj.setPosition(%pos)
|
||||
Sets the object's position to %pos
|
||||
|
||||
%obj.getSlotRotation()
|
||||
Gets the rotation of a specific slot on an object
|
||||
|
||||
%obj.getSlotPosition()
|
||||
Gets the position of a specific slot on an object
|
||||
|
||||
%obj.zapObject()
|
||||
Plays Shocklance "zap" animation on object
|
||||
|
||||
%obj.zap2Object()
|
||||
Plays a different "zap" animation on object
|
||||
|
||||
%obj.stopZap()
|
||||
Stops the Shocklance "zap" animation prematurely
|
||||
(if you dont want it to fade out naturally)
|
||||
|
||||
%obj.isPlayer()
|
||||
Checks to see if object is a Player Object
|
||||
|
||||
%obj.isVehicle()
|
||||
Checks to see if object is a Vehicle Object
|
||||
|
||||
%obj.applyKick(%force)
|
||||
Applys a kick based on the force inputted based on the muzzle vector.
|
||||
If there is no muzzle, then it apply an impulse at "0 0 0" at the shape's
|
||||
current forward position
|
||||
|
||||
%obj.useEnergy(%amount)
|
||||
Uses %amount much energy assuming the shape has any
|
||||
|
||||
%obj.play3D(sound)
|
||||
Plays sound from the object
|
||||
|
||||
%obj.teleportStartFX()
|
||||
Teleportation fadeout used in Meltdown2
|
||||
|
||||
%obj.teleportEndFX()
|
||||
Teleportation fadein used in Meltdown2
|
||||
|
||||
%obj.getEyePoint()
|
||||
Usually used with Players, this gets the camera's current position
|
||||
|
||||
%obj.getForwardRaycastPt(%dist)
|
||||
Similar to MuzzleRaycast, but this one gets the raycast in whatever your
|
||||
forward direction is
|
||||
|
||||
%obj.getEyeRaycastPt(%dist)
|
||||
Gets the camera's raycast from the scanning distance
|
||||
|
||||
%obj.getMuzzleRaycastPt(%slot, %dist)
|
||||
Gets the muzzle's raycast from the object usind the slot and scanning distance
|
||||
|
||||
%obj.getMass()
|
||||
Returns the mass of the object
|
||||
|
||||
%obj.getAccel()
|
||||
Returns the acceleration of the object in 1 millisecond. If you want to get an
|
||||
acceleration of say, 1 second, you would scale the output vector by the number
|
||||
of miliseconds you want it to be, in this case, 1 second = 1000 milliseconds. So,
|
||||
|
||||
%accel_1_second = vectorScale(%obj.getAccel(), 1000);
|
||||
|
||||
%obj.getVelToForce()
|
||||
This converts the object's velocity to a force vector. This works sort of like a
|
||||
setVelocity for vehicles, in that it outputs the vector ready to be applied to the object.
|
||||
If you know what you're doing
|
||||
|
||||
%obj.getMaxEnergy()
|
||||
Returns the datablock maximum energy the object has, if any
|
||||
|
||||
%obj.getMaxDamage()
|
||||
Returns the datablock maximum damage the object has, if any
|
||||
|
||||
%obj.getDamageLeft()
|
||||
Returns the object's health, or damage away from the maximum, if any
|
||||
|
||||
%obj.getDamageLeftPct()
|
||||
Returns the percentage of non-damage on the object
|
||||
|
||||
%obj.getDamagePct()
|
||||
Returns the percentage of damage on the object
|
||||
|
||||
%obj.getEnergyPct()
|
||||
Returns the percentage of energy on the object
|
||||
|
||||
%obj.getTransformAngle(%trans)
|
||||
Returns the transform's angle
|
||||
|
||||
** EXPERIMENTAL FUNCTIONS **
|
||||
|
||||
%obj.createSlotExtension(%obj, %slot)
|
||||
Creates 8 more mountable slots at the cost of 1
|
||||
However, strange side effects seem to take place... You'd have to try this one out to see
|
||||
|
||||
%obj.deleteSlotExtension(%obj, %slot);
|
||||
Deletes the current slot extension.
|
||||
|
||||
isWithinVariance(%va, %vb, %variance)
|
||||
Tests vectors a and be to see if they are pointing within %variance direction
|
||||
I'm not sure if I have the math skill to figure this one out. So I copied something
|
||||
from inside T2's stuff that worked kinda like this.
|
||||
|
||||
Normal Commands
|
||||
---------------
|
||||
|
||||
combineVars(%a, %b, %c)
|
||||
Combines 3 variables together into 1 variable (ex. Position)
|
||||
|
||||
killit(%k)
|
||||
same as %obj.delete()
|
||||
|
||||
scanArea(%pos, %radius, %mask)
|
||||
scans for existance of %mask type objects in a %radius area starting from %pos position
|
||||
|
||||
testPosition(%pos)
|
||||
Tests to see if you can move to this position
|
||||
|
||||
createEmitter(%pos, %emitter, [%rot])
|
||||
Creates a particle emitter at %pos position and with particle emitter %emitter (rot is optional)
|
||||
|
||||
createLifeEmitter(%pos, %emitter, %lifeMS, [%rot])
|
||||
This creates an emitter for %lifeMS time, if you dont want to have to worry
|
||||
about deleting the particle emitter
|
||||
|
||||
sqr(num)
|
||||
returns number*number
|
||||
|
||||
cube(num)
|
||||
returns number*number*number
|
||||
|
||||
modifyTransform(%trans1, %trans2)
|
||||
This modifys transform1 based on transform2
|
||||
For example: modifyTransform("255 100 96 1 0 0 1.57", "-255 0 4 -1 1 0 0");
|
||||
would output the transform "0 100 100 0 1 0 1.57"
|
||||
|
||||
modifyTri(%trans1, %trans2)
|
||||
same as modifyTransform with 3 variables
|
||||
|
||||
modifyQuad(%trans1, %trans2)
|
||||
same as modifyTransform with 4 variables
|
||||
|
||||
shutdownServer(%time, %msg, %lines)
|
||||
Centerprints the text for %time amount of time and on %lines number of lines before
|
||||
the server shuts down
|
||||
|
||||
velToSingle(%vel)
|
||||
Converts a 3-unit velocity vector to a single number constant
|
||||
|
||||
msToKPH(%vel, true|false)
|
||||
Converts a single number constant (velToSingle) to KPH, and if bool = true, it will
|
||||
not round off calculations.
|
||||
|
||||
KPHToMPH(%vel, true|false)
|
||||
Converts a single number constant (velToSingle)from KPH to MPH, and if bool = true, it will
|
||||
not round off calculations.
|
||||
|
||||
vectorNeg(%vec)
|
||||
Returns the negative of the inputted vector
|
||||
|
||||
vectorClear(%vec)
|
||||
Yes.... people may actually find this useful.. lol
|
||||
|
||||
vectorCopy(%vec)
|
||||
Returns this vector (dont even ask why)
|
||||
|
||||
vectorCompare(%veca, %vecb)
|
||||
Returns 1 if the vectors are the same or similar
|
||||
|
||||
vectorToRotZ(%vec)
|
||||
Converts a vector to a Z rotation. Hey! I'm not that smart yet
|
||||
|
||||
getLOSOffset(%obj, %vec, %dist)
|
||||
Returns a position from a vector and a distance.
|
||||
|
||||
getVectorFromPoints(%a, %b)
|
||||
Returns the Normalized vector for pointa facing pointb
|
||||
|
||||
getVectorFromObjects(%a, %b)
|
||||
Same as above, but with objects
|
||||
|
||||
getDistance2D(%a, %b)
|
||||
Returns the distance between the 2 2-unit vectors
|
||||
|
||||
getDistance3D(%ptA, %ptB)
|
||||
returns the distance between two positions
|
||||
|
||||
getObjectDistance(%obj1, %obj2)
|
||||
returns the distance between 2 objects
|
||||
|
||||
setFlightCeiling(height)
|
||||
Sets the mission's flight 'ceiling', or maximum distance
|
||||
upwards before your engines/jets cut off
|
||||
|
||||
reload(%script)
|
||||
This functions like exec, only it causes lag because it is loading all
|
||||
the datablocks in the file you called this with to all the connected
|
||||
clients on the server, and to the server itself. This function, along
|
||||
with plain ol' exec will allow you to literally build your mod while
|
||||
others play it!
|
||||
|
||||
changeServerHostName(%name)
|
||||
Changes the name of server you are hosting, without need for reset.
|
||||
|
||||
changeServerPlayerCount(%number)
|
||||
Changes the # of players your server can accept, without need for reset.
|
||||
|
||||
changeServerAllowAliases(true|false)
|
||||
Changes the allow aliases switch while you are hosting, without need for reset.
|
||||
|
||||
changeServerAdminPassword(%pass)
|
||||
Changes the server admin password, without need for reset.
|
||||
|
||||
changeServerPassword(%name)
|
||||
Changes the entry password on server you are hosting, without need for reset.
|
||||
|
||||
setServerPrefs(%name, %aliases, %admin, %password, %numplayers)
|
||||
Changes all of the above, but with one function
|
||||
|
||||
getRandomN([%max, %min])
|
||||
Gets a random negative number, min and max values optional.
|
||||
|
||||
getRandomB()
|
||||
Returns true or false, at random.
|
||||
|
||||
getRandomT([%max, %min])
|
||||
Gets a positive OR negative random number at random will it be either
|
||||
Max and min values can be defined
|
||||
|
||||
vectorRandom()
|
||||
Creates a vector pointing in any random 360* direction
|
||||
|
||||
==================================================================================
|
||||
Notes:
|
||||
Particle emitter rptation should work now, and is optional.
|
||||
Reload doesnt always load the full datablock, and I dont know why.
|
||||
I am not good at math :(
|
||||
196
scripts/JTLmeteorStorm.cs
Normal file
196
scripts/JTLmeteorStorm.cs
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
// 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 = false; // true;
|
||||
indirectDamage = 0; // 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) {
|
||||
// Ass-ume gravity does not change vec.. (gravityMod = 0.0) :P
|
||||
%vec = vectorNormalize(%proj.initialDirection);
|
||||
if (%data.hasDamageRadius)
|
||||
RadiusExplosion(%proj,vectorAdd(%pos,vectorScale(%vec,-0.1)),%data.damageRadius,%data.indirectDamage,%data.kickBackStrength,%proj.sourceObject,%data.radiusDamageType);
|
||||
%pPos = %proj.getPosition();
|
||||
%surface = containerRayCast(vectorAdd(%pPos,vectorScale(%vec,-0.1)),vectorAdd(%pPos,vectorScale(%vec,1)),-1,%proj);
|
||||
%tObj = firstWord(%surface);
|
||||
if (isObject(%tObj))
|
||||
%tObj.damage(%proj,%pPos,0.4,%proj.getDataBlock().directDamageType);
|
||||
// ionStormBeam(vectorAdd(%pPos,"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" || %obj.getClassName() $= "AIConnection") {
|
||||
%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])");
|
||||
}
|
||||
}
|
||||
795
scripts/MPM/MPM.cs
Normal file
795
scripts/MPM/MPM.cs
Normal file
|
|
@ -0,0 +1,795 @@
|
|||
|
||||
|
||||
|
||||
|
||||
datablock ParticleData(MpmFlareParticle1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/jetflare03";
|
||||
|
||||
colors[0] = "0.7 0.7 1.0 0.5";
|
||||
colors[1] = "0.7 0.7 1.0 0.5";
|
||||
colors[2] = "0.7 0.7 1.0 0.5";
|
||||
colors[3] = "0.7 0.7 1.0 0.5";
|
||||
|
||||
sizes[0] = 50;
|
||||
sizes[1] = 50;
|
||||
sizes[2] = 50;
|
||||
sizes[3] = 50;
|
||||
|
||||
times[0] = 0.25;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.25;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleData(MpmFlareParticle3)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/jetflare03";
|
||||
|
||||
colors[0] = "0.7 0.7 1.0 0.5";
|
||||
colors[1] = "0.7 0.7 1.0 0.5";
|
||||
colors[2] = "0.7 0.7 1.0 0.5";
|
||||
colors[3] = "0.7 0.7 1.0 0.5";
|
||||
|
||||
sizes[0] = 50;
|
||||
sizes[1] = 50;
|
||||
sizes[2] = 50;
|
||||
sizes[3] = 50;
|
||||
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.5;
|
||||
times[3] = 0.75;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleData(MpmFlareParticle2):MpmFlareParticle1
|
||||
{
|
||||
textureName = "skins/jetpackflare_bio";
|
||||
useInvAlpha = 0;
|
||||
lifetimeMS = 2500;
|
||||
spinRandomMin = -360.0;
|
||||
spinRandomMax = 360.0;
|
||||
sizes[0] = 15;
|
||||
sizes[1] = 15;
|
||||
sizes[2] = 15;
|
||||
sizes[3] = 15;
|
||||
};
|
||||
|
||||
datablock ParticleData(MpmJetSmoke1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 60000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0.5;
|
||||
textureName = "skins/jetflare2";
|
||||
|
||||
colors[0] = "0.8 0.8 0.8 1";
|
||||
colors[1] = "0.8 0.8 0 0.9";
|
||||
colors[2] = "0.8 0.8 0.8 0.5";
|
||||
colors[3] = "0.8 0.8 0.8 0.0";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 17;
|
||||
sizes[2] = 18;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.5;
|
||||
times[3] = 0.75;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock ParticleData(MpmJetSmoke2):MpmJetSmoke1
|
||||
{
|
||||
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 60000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0.5;
|
||||
textureName = "skins/jetflare2";
|
||||
|
||||
colors[0] = "0.8 0.8 0.8 1";
|
||||
colors[1] = "0.8 0.8 0 0.9";
|
||||
colors[2] = "0.8 0.8 0.8 0.5";
|
||||
colors[3] = "0.8 0.8 0.8 0.0";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 17;
|
||||
sizes[2] = 18;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.5;
|
||||
times[3] = 0.75;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock ParticleEmitterData(MpmFlareEmitter1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 100;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 5;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 0.0;
|
||||
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "MpmFlareParticle1";
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(MpmFlareEmitter2):MpmFlareEmitter1
|
||||
{
|
||||
particles = "MpmFlareParticle2";
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(MpmJetEmitter1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 10.0;
|
||||
velocityVariance = 1.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 5.0;
|
||||
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "MpmJetSmoke1";
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(MpmJetEmitter2):MpmJetEmitter1
|
||||
{
|
||||
ejectionPeriodMS = 10;
|
||||
particles = "MpmJetSmoke2";
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 1.5;
|
||||
};
|
||||
|
||||
|
||||
datablock ParticleEmitterData(MpmJetEmitter3):MpmJetEmitter1
|
||||
{
|
||||
ejectionPeriodMS = 30;
|
||||
ejectionVelocity = 4.0;
|
||||
velocityVariance = 1.0;
|
||||
particles = "MpmFlareParticle2";
|
||||
ejectionoffset = 10;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 360.0;
|
||||
|
||||
};
|
||||
|
||||
datablock TracerProjectileData(Mpm_G_PR) {
|
||||
className = "TracerProjectileData";
|
||||
emitterDelay = "-1";
|
||||
velInheritFactor = "0";
|
||||
directDamage = "0";
|
||||
hasDamageRadius = "0";
|
||||
indirectDamage = "0";
|
||||
damageRadius = "0";
|
||||
radiusDamageType = "0";
|
||||
kickBackStrength = "0";
|
||||
Explosion = "TurretExplosion";
|
||||
hasLight = "0";
|
||||
lightRadius = "1";
|
||||
lightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
hasLightUnderwaterColor = "0";
|
||||
underWaterLightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
explodeOnWaterImpact = "0";
|
||||
depthTolerance = "5";
|
||||
bubbleEmitTime = "0.5";
|
||||
faceViewer = "0";
|
||||
scale = "1 1 1";
|
||||
dryVelocity = "0.1";
|
||||
wetVelocity = "0.1";
|
||||
fizzleTimeMS = "32";
|
||||
lifetimeMS = "32";
|
||||
explodeOnDeath = "1";
|
||||
reflectOnWaterImpactAngle = "0";
|
||||
deflectionOnWaterImpact = "0";
|
||||
fizzleUnderwaterMS = "-1";
|
||||
activateDelayMS = "-1";
|
||||
doDynamicClientHits = "0";
|
||||
tracerLength = "1";
|
||||
tracerMinPixels = "1";
|
||||
tracerAlpha = "0";
|
||||
tracerColor = "0.000000 0.000000 0.000000 0.000000";
|
||||
tracerTex[0] = "special/tracer00";
|
||||
tracerTex[1] = "special/tracercross";
|
||||
tracerWidth = "0.1";
|
||||
crossViewAng = "0.99";
|
||||
crossSize = "0.1";
|
||||
renderCross = "0";
|
||||
isFXUnit = "1";
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock SeekerProjectileData(MpmMissile1)
|
||||
{
|
||||
heatSignature = 1;
|
||||
sensorData = DeployedOutdoorTurretSensor;
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "bomb.dts";
|
||||
hasDamageRadius = false;
|
||||
indirectDamage = 0;
|
||||
damageRadius = 0;
|
||||
radiusDamageType = $DamageType::Missile;
|
||||
kickBackStrength = 20000;
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
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 = MpmJetEmitter1;
|
||||
delayEmitter = MpmFlareEmitter1;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 8000;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 1;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "1 1 0";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock GrenadeProjectileData(BoosterGrenade)
|
||||
{
|
||||
projectileShapeName = "grenade_projectile.dts";
|
||||
emitterDelay = -1;
|
||||
directDamage = 0.0;
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 0.1;
|
||||
damageRadius = 0.1;
|
||||
radiusDamageType = $DamageType::Grenade;
|
||||
kickBackStrength = 1500;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
sound = GrenadeProjectileSound;
|
||||
explosion = "GrenadeExplosion";
|
||||
underwaterExplosion = "UnderwaterGrenadeExplosion";
|
||||
velInheritFactor = 0.5;
|
||||
splash = GrenadeSplash;
|
||||
|
||||
//baseEmitter = //MpmJetEmitter2;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
|
||||
grenadeElasticity = 0.35;
|
||||
grenadeFriction = 0.2;
|
||||
armingDelayMS = 250;
|
||||
muzzleVelocity = 10;
|
||||
drag = 0.1;
|
||||
};
|
||||
|
||||
|
||||
datablock SeekerProjectileData(MpmMissile2):MpmMissile1
|
||||
{
|
||||
directDamage = 0.0;
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 0.1;
|
||||
damageRadius = 0.1;
|
||||
|
||||
explosion = LargeAirVehicleExplosion;
|
||||
explosionDamage = 0.5;
|
||||
explosionRadius = 0.2;
|
||||
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 80000;
|
||||
acceleration = 1;
|
||||
|
||||
projectileShapeName = "weapon_missile_casement.dts";
|
||||
baseEmitter = MpmJetEmitter2;
|
||||
delayEmitter = MpmFlareEmitter2;
|
||||
lifetimeMS = -1;
|
||||
sound = HAPCFlyerThrustSound;
|
||||
};
|
||||
|
||||
datablock SeekerProjectileData(MpmMissile3):MpmMissile2
|
||||
{
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 20; //5
|
||||
maxVelocity = 20;//80
|
||||
acceleration = 0; //1
|
||||
};
|
||||
|
||||
function MpmMissile1::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
function Mpm_B_MIS::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
function Mpm_B_MIS1::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
function Mpm_B_MIS2::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
//Anti missile missile :D
|
||||
//%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
function Mpm_B_MIS3::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
function Mpm_B_MIS4::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%proj.load.Explode(%proj,%pos);
|
||||
//parent::onExplode(%data,%proj,%pos,%mod);
|
||||
}
|
||||
|
||||
|
||||
function MpmMissile1::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
|
||||
{
|
||||
parent::onExplode(%data,%projectile,%position,%modifier);
|
||||
}
|
||||
|
||||
|
||||
function MpmMissile2::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
|
||||
%speed = GetWords(%proj.predict(),3,5);
|
||||
%dir = VectorScale(%speed,1/BasicGrenade.muzzlevelocity);
|
||||
%p1 = new GrenadeProjectile()
|
||||
{
|
||||
dataBlock = BoosterGrenade;
|
||||
initialDirection = %dir;
|
||||
initialPosition = %pos;
|
||||
};
|
||||
%proj.delete();
|
||||
}
|
||||
|
||||
function MpmMissile3::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
%speed = GetWords(%proj.predict(),3,5);
|
||||
%dir = VectorScale(%speed,1/BasicGrenade.muzzlevelocity);
|
||||
%p1 = new GrenadeProjectile()
|
||||
{
|
||||
dataBlock = BoosterGrenade;
|
||||
initialDirection = %dir;
|
||||
initialPosition = %pos;
|
||||
};
|
||||
%proj.delete();
|
||||
}
|
||||
|
||||
function SeekerProjectile::Predict(%p,%ttime)
|
||||
{
|
||||
%time = ((GetSimTime()+%ttime) - %p.createtime)/1000;
|
||||
%dat = %p.getDatablock();
|
||||
%startspeed = VectorScale(%p.InitialDirection,%dat.muzzleVelocity);
|
||||
if (%p.sourceObject)
|
||||
{
|
||||
%co1 = mAbs(VectorDot(%p.InitialDirection,VectorNormalize(%p.startVelocity)));
|
||||
%sourceSpeed = VectorScale(%p.startVelocity,%dat.velInheritFactor*%co1);
|
||||
//if (%p.speedmod == 1)
|
||||
%sourceSpeed = VectorAdd(%sourcespeed,VectorScale(VectorNormalize(%p.startVelocity),-0.5));
|
||||
%leng = mAbs(VectorDot(%p.InitialDirection,%p.startVelocity));
|
||||
%dir = VectorNormalize(%p.initialdirection);
|
||||
%sourceSpeedlen = VectorDot(%SourceSpeed,VectorNormalize(%p.initialDirection));
|
||||
}
|
||||
%speedaccel = Limit(%dat.acceleration*(%time-1),0,Limit(%dat.maxVelocity-(%dat.muzzleVelocity+%sourceSpeedlen),0));
|
||||
%accelVec = VectorScale(vectorNormalize(%p.InitialDirection),%speedaccel);
|
||||
|
||||
%Speed = VectorAdd(VectorAdd(%startspeed,%sourceSpeed),VectorAdd(%accelvec,%gravvec));
|
||||
|
||||
%distance1 = VectorScale(%startspeed,%time);
|
||||
%distance2 = VectorScale(%sourceSpeed,%time);
|
||||
|
||||
%distance3 = VectorScale(%accelvec,0.5*(%time));
|
||||
%distance = VectorAdd(VectorAdd(%p.initialPosition,%distance3),VectorAdd(%distance2,%distance1));
|
||||
|
||||
//if (!%p.speedmod)
|
||||
//%p.speedmod = 1;
|
||||
|
||||
//if (VectorDist(%distance,%p.getTransform())>4)
|
||||
//%p.speedmod *= -1;
|
||||
|
||||
if (getSimTime()-%p.lasttime>1000)
|
||||
%p.schedule(%ttime,"logerror",%distance);
|
||||
%distance=VectorAdd(%distance,VectorScale(%p.lasterror,-1));
|
||||
|
||||
return %distance SPC %speed;
|
||||
}
|
||||
|
||||
function testpred(%dir,%speed,%time)
|
||||
{
|
||||
%p = Launch_Mpm("0 0 110",%dir,%speed,%time*1000,mpmMissile1);
|
||||
for (%t=0;%t < %time;%t++)
|
||||
{
|
||||
%p.schedule(%t*1000,predict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function putwp(%pos)
|
||||
{
|
||||
|
||||
%wp = new WayPoint() {
|
||||
position = %pos;
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
team = 1;
|
||||
};
|
||||
%wp.schedule(5000,"delete");
|
||||
}
|
||||
|
||||
|
||||
function SeekerProjectile::logerror(%p,%distance)
|
||||
{
|
||||
%p.lasterror = VectorSub(%distance,%p.getTransform());
|
||||
%p.lasttime = (GetSimTime()-%p.createtime)/1000;
|
||||
}
|
||||
|
||||
|
||||
function ItemData::Stage1(%data,%p)
|
||||
{
|
||||
|
||||
if (IsObject(%p))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function ItemData::Stage2(%data,%p)
|
||||
{
|
||||
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%start = GetWords(%p.traject,0,2);
|
||||
%up = GetWords(%p.traject,3,5);
|
||||
%loc = GetWord(%p.traject,6);
|
||||
%a = GetWord(%p.traject,7);
|
||||
%vector = GetWords(%p.traject,8,10);
|
||||
%time = GetWord(%p.traject,11);
|
||||
%stlevel = %p.getTransform();//VectorAdd(%start,VectorScale(%up,%loc));
|
||||
%stspeed = VectorScale(%up,%a);
|
||||
%missileblock = %p.load.missile;
|
||||
%p2 = Launch_Mpm(%stlevel,%vector,%stspeed,%time+50000,%missileblock);
|
||||
%p2.team = %p.team;
|
||||
%p2.source = %p.source;
|
||||
%p2.traject = %p.traject;
|
||||
%p2.load = %p.load;
|
||||
%p2.owner = %p.owner;
|
||||
%p2.s2time = %time;
|
||||
%p2.targetlocation = %p.targetlocation;
|
||||
%p2.stage2 = %p2.load.schedule(%time,"AtTarget",%p2);
|
||||
if (%p.owner.getControlObject() == %p.owner.comcam && %p.owner.moveprojectile = %p)
|
||||
obsproj(%p2,%p.owner);
|
||||
return %p2;
|
||||
}
|
||||
}
|
||||
|
||||
datablock ItemData(Mpm_Null_Load)
|
||||
{
|
||||
cost = 0;
|
||||
missile = Mpm_B_MIS1;
|
||||
name = "Null";
|
||||
friendly = 0;
|
||||
};
|
||||
|
||||
function testenemy(%pos,%dir,%speed,%time)
|
||||
{
|
||||
%p = Launch_Mpm(%pos,%dir,%speed,%time,MpmMissile1);
|
||||
%p.team = 0;
|
||||
%p.load = Mpm_Null_Load;
|
||||
%p.schedule(360000,"delete");
|
||||
}
|
||||
|
||||
function ItemData::AtTarget(%data,%p)
|
||||
{
|
||||
|
||||
if (IsObject(%p))
|
||||
{
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
function ItemData::Explode(%data,%p,%pos)
|
||||
{
|
||||
|
||||
if (IsObject(%p))
|
||||
{
|
||||
if (IsObject(%data.vehicle))
|
||||
//if(VectorDist(%p.targetlocation,%pos)<50)
|
||||
Mpm_VE_Load0.AtTarget(%p);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Nuke_Load::Explode(%data,%p,%pos)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
BigFatNukeTarget(%pos);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Nuke2_Load::Explode(%data,%p,%pos)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
ShoulderNuclear.onExplode(%p, %pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Mpm_Hole_Load::Explode(%data,%p,%pos)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%mask = $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::InteriorObjectType;
|
||||
%res = containerRayCast(%pos,"0 0 500",%mask, %p);
|
||||
if (%res)
|
||||
%inside = 1;
|
||||
dome(VectorAdd(%pos,"0 0" SPC (1-%inside)*200),60000,%inside);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ItemData::InterCept(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
//Be suprised
|
||||
%p.delete();
|
||||
}
|
||||
}
|
||||
|
||||
function ItemData::Hazard(%data,%p,%obj,%radius)
|
||||
{
|
||||
if (%p.team != %obj.team)
|
||||
return 1;
|
||||
if (!%data.friendly && VectorDist(%p.targetlocation,%obj.getTransform())<%radius)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function PlayExplosion(%pos,%data,%dir)
|
||||
{
|
||||
if (%dir $= "")
|
||||
%dir = "0 0 1";
|
||||
if (IsObject(%data))
|
||||
{
|
||||
%p = new LinearProjectile()
|
||||
{
|
||||
dataBlock = %data;
|
||||
initialDirection = %dir;
|
||||
initialPosition = %pos;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function GrenadeProjectile::Predict(%p,%time)
|
||||
{
|
||||
//Todo: make this one
|
||||
}
|
||||
|
||||
|
||||
//Custon information functions (not used)
|
||||
function ListSpeed(%xlist,%tlist)
|
||||
{
|
||||
|
||||
if (GetWordCount(%xlist)<2)
|
||||
return "";
|
||||
for (%c=0;%c<GetWordCount(%xlist)-1;%c++)
|
||||
{
|
||||
%dx = GetWord(%xlist,%c+1)-GetWord(%xlist,%c);
|
||||
%dt = GetWord(%tlist,%c+1)-GetWord(%tlist,%c);
|
||||
if (%dx == 0 || %dt == 0)
|
||||
%slist = %slist SPC 0;
|
||||
else
|
||||
%slist = %slist SPC %dx/%dt;
|
||||
}
|
||||
return trim(%slist);
|
||||
}
|
||||
|
||||
function ListShift(%list)
|
||||
{
|
||||
if (GetWordCount(%list)<2)
|
||||
return 0;
|
||||
for (%c=0;%c<GetWordCount(%list)-1;%c++)
|
||||
{
|
||||
%mid = (GetWord(%list,%c+1)+GetWord(%list,%c))/2;
|
||||
%nlist = %nlist SPC %mid;
|
||||
}
|
||||
return trim(%nlist);
|
||||
}
|
||||
|
||||
function ListMean(%list)
|
||||
{
|
||||
if (GetWordCount(%list)<1)
|
||||
return "";
|
||||
for (%c=0;%c<GetWordCount(%list);%c++)
|
||||
{
|
||||
%mean+= GetWord(%list,%c);
|
||||
}
|
||||
return %mean/GetWordCount(%list);
|
||||
}
|
||||
|
||||
function ListSub(%list1,%list2)
|
||||
{
|
||||
if (GetWordCount(%list1)<1)
|
||||
return "";
|
||||
for (%c=0;%c<GetWordCount(%list1);%c++)
|
||||
{
|
||||
%mid = GetWord(%list1,%c)-GetWord(%list2,%c);
|
||||
%nlist = %nlist SPC %mid;
|
||||
}
|
||||
return trim(%nlist);
|
||||
}
|
||||
|
||||
function mechanics(%vec)
|
||||
{
|
||||
|
||||
%nrm = VectorNormalize(%vec);
|
||||
%p = Launch_Mpm("0 0 110",%nrm ,"0 0 10",12000,"mpmMissile1");
|
||||
%p.vec = %vec;
|
||||
%p.st = getSimTime();
|
||||
for (%i=0;%i<10;%i++)
|
||||
schedule(%i*1000,0,"noteinfo",%p);
|
||||
schedule(10000,0,"listinfo",%p);
|
||||
}
|
||||
|
||||
function noteinfo(%p)
|
||||
{
|
||||
%n = %p.noted;
|
||||
%p.noted++;
|
||||
%predict = %p.predict();
|
||||
%p.predict[%n] = %predict;
|
||||
%p.real[%n] = %p.getTransform();
|
||||
%p.time[%n] = (getSimTime()-%p.st)/1000;
|
||||
}
|
||||
|
||||
function listinfo(%p)
|
||||
{
|
||||
for (%i=0;%i<11;%i++)
|
||||
{
|
||||
%pxlist =trim(%pxlist SPC GetWord(%p.predict[%i],0));
|
||||
%pzlist =trim(%pzlist SPC GetWord(%p.predict[%i],2));
|
||||
%xlist =trim(%xlist SPC GetWord(%p.real[%i],0));
|
||||
%zlist =trim(%zlist SPC GetWord(%p.real[%i],2));
|
||||
%tlist = trim(%tlist SPC %p.time[%i]);
|
||||
}
|
||||
//echo(%tlist);
|
||||
//echo(%pxlist);
|
||||
//echo(%pzlist);
|
||||
//echo(%xlist);
|
||||
//echo(%zlist);
|
||||
%speed = listspeed(%pzlist,%tlist);
|
||||
%acc = listspeed(%speed,listshift(%tlist));
|
||||
//echo(%speed);
|
||||
|
||||
%speed1 = listspeed(%zlist,%tlist);
|
||||
%acc1 = listspeed(%speed1,listshift(%tlist));
|
||||
//echo(%speed1);
|
||||
%v1 = %speed-%acc*1/2;
|
||||
%v2 = %speed1-%acc1*1/2;
|
||||
$diff[getWord(%p.vec,0),getWord(%p.vec,2)] = %v1-%v2;
|
||||
//echo(ListSub(%speed,%speed1));
|
||||
//echo(listmean(%acc));
|
||||
//echo(listmean(%acc1));
|
||||
//echo(1/2*(listmean(%acc1)-listmean(%acc))*10*10);
|
||||
}
|
||||
|
||||
function testrange()
|
||||
{
|
||||
for (%x=-5;%x<6;%x+=0.2)
|
||||
{
|
||||
for (%y=0;%y<6;%y+=0.2)
|
||||
{
|
||||
%vec = %x SPC "0" SPC %y;
|
||||
schedule((%x+5)*100000+%y*10000,0,"mechanics",%vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function plotres()
|
||||
{
|
||||
for (%x=-5;%x<6;%x+=0.2)
|
||||
{
|
||||
for (%y=0;%y<6;%y+=0.2)
|
||||
{
|
||||
%line = %line SPC $diff[%x,%y];
|
||||
}
|
||||
echo(%line);
|
||||
%line = "";
|
||||
}
|
||||
}
|
||||
705
scripts/MPM/MPM_AE.cs
Normal file
705
scripts/MPM/MPM_AE.cs
Normal file
|
|
@ -0,0 +1,705 @@
|
|||
//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;
|
||||
%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;
|
||||
}
|
||||
1635
scripts/MPM/MPM_Blast.cs
Normal file
1635
scripts/MPM/MPM_Blast.cs
Normal file
File diff suppressed because it is too large
Load diff
185
scripts/MPM/MPM_Launch.cs
Normal file
185
scripts/MPM/MPM_Launch.cs
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
datablock AudioProfile(FwProjectileSound)
|
||||
{
|
||||
filename = "armor/thrust_UW.wav";
|
||||
description = ProjectileLooping3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock ItemData(MpmLaucher)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Funky";
|
||||
shapeFile = "Turret_Muzzlepoint.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.0;
|
||||
friction = 1.0;
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock TurretImageData(MpmLauchPoint)
|
||||
{
|
||||
shapeFile = "Turret_Muzzlepoint.dts";
|
||||
item = PlasmaBarrelLargePack;
|
||||
offset = "0 0 0";
|
||||
rotation = "0 1 0 90";
|
||||
};
|
||||
|
||||
///old algo
|
||||
//%time = Limit(VectorLen(%dist)/20,30,360);
|
||||
//%z = getWord(%dist,2);
|
||||
//%x = GetWord(%dist,0) SPC GetWord(%dist,1);
|
||||
//%x = Mpow(VectorDot(%x,%x),0.5);
|
||||
//%co1 = mpow(4*(mpow(%x,2))+ mpow(2*%muz*%time+%ac*mpow(%time,2)+2*%z,2),0.5);
|
||||
//%co2 = %time * (2*%muz * %time+%ac*mpow(%time,2)+2*%z);
|
||||
//%vector = (%x*%co1)/(%co2) SPC (%co1/(2*%time));
|
||||
//%vector = VectorAdd(VectorScale(VectorNormalize(GetWords(%dist,0,1)),getWord(%vector,0)) ,"0 0" SPC getWord(%vector,1));
|
||||
//%p=launchmpm(%start,"0 0 -1",%vector,%time*1000+5000);
|
||||
|
||||
|
||||
//Algo for mpm_missile lauch.
|
||||
//-Stage1-
|
||||
//Lauch up a certain amount of time
|
||||
//-Stage2-
|
||||
//Turn missile and head for target
|
||||
|
||||
function mpm_calc(%start,%end,%up,%dat)
|
||||
{
|
||||
if (!IsObject(%dat))
|
||||
%dat = MpmMissile1;
|
||||
if (%up $= "")
|
||||
%up = "0 0 1";
|
||||
|
||||
%ac = %dat.acceleration; //Acceleration for calc
|
||||
|
||||
%vector = VectorSub(%end,%start); //Vector source,target
|
||||
%dir = VectorNormalize(%vector);
|
||||
|
||||
if (mAbs(VectorDot(%up,%dir))==1) //can't fire directly up or down.
|
||||
return -1;
|
||||
%rup = VectorNormalize(VectorCross(%up,%dir));
|
||||
%up = VectorNormalize(%up);
|
||||
%ndir = VectorNormalize(VectorCross(VectorCross(%up,%dir),%up));
|
||||
|
||||
%z = VectorDot(%up,%dir)*VectorLen(%vector);
|
||||
%x = VectorDot(%ndir,%dir)*VectorLen(%vector);
|
||||
|
||||
%mintime = mSqrt(2*%x)/mSqrt(%ac); //Minium travel time
|
||||
%time = %mintime + 5; //Added 5 seconds for slack
|
||||
|
||||
//Calculations for preffered arc.
|
||||
%root = mSqrt(Mpow(%ac,2)*Mpow(%time,4)-4*Mpow(%x,2));
|
||||
|
||||
%ltimeco1 = %ac*Mpow(%time,2)+4*%root+8*%z;
|
||||
%ltimeco2 = -4*Mpow(%x,2)+%ac*Mpow(%time,2)*%ltimeco1;
|
||||
%ltimeco3 = 2*%ac*%time;
|
||||
%ltime = (-1*%root+mSqrt(%ltimeco2))/%ltimeco3;
|
||||
|
||||
%a = (%ac*%ltime) /2;
|
||||
%loc = %a*%ltime;
|
||||
|
||||
%co = %ac*mPow(%time,2);
|
||||
|
||||
%xx = 2*%x/%co;
|
||||
%zz = -1*(%root/%co);
|
||||
|
||||
%vz = VectorScale(%up,%zz);
|
||||
%vx = VectorScale(%ndir,%xx);
|
||||
|
||||
%vector = VectorAdd(%vx,%vz);
|
||||
|
||||
return %ltime SPC %time SPC %loc SPC %vector SPC %a;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Launch_Mpm(%pos,%dir,%speed,%time,%data)
|
||||
{
|
||||
%dir = VectorNormalize(%dir);
|
||||
|
||||
%obj = new Item()
|
||||
{
|
||||
className = Item;
|
||||
dataBlock = MpmLaucher;
|
||||
};
|
||||
%obj.mountimage(MpmLauchPoint,0);
|
||||
%obj.setTransform(%pos);
|
||||
%obj.setVelocity(%speed);
|
||||
%p = %obj.Fire_MpM(%dir,%data);
|
||||
%obj.schedule(50,"delete");
|
||||
|
||||
%p.lasterror = "0 0 0";
|
||||
%p.lasttime = GetSimTime();
|
||||
if (%time !$= "")
|
||||
%p.dietime = GetSimTime()+%time;
|
||||
%p.schedule(%time,"delete");
|
||||
|
||||
%p.addToMPMGroup();
|
||||
return %p;
|
||||
}
|
||||
|
||||
function ProjectileData::Create(%data,%pos,%dir,%speed)
|
||||
{
|
||||
%obj = new Item()
|
||||
{
|
||||
className = Item;
|
||||
dataBlock = MpmLaucher;
|
||||
};
|
||||
%obj.mountimage(MpmLauchPoint,0);
|
||||
%obj.setTransform(%pos);
|
||||
if (VectorLen(%speed) > 200)
|
||||
%speed = VectorScale(VectorNormalize(%speed),200);
|
||||
%obj.setVelocity(%speed);
|
||||
%p = %obj.Fire_MpM(%dir,%data);
|
||||
%obj.schedule(50,"delete");
|
||||
return %p;
|
||||
}
|
||||
|
||||
function GameBase::Fire_MpM(%obj,%dir,%data)
|
||||
{
|
||||
%speed = %obj.getVelocity();
|
||||
%classname = %data.classname;
|
||||
%class = getSubStr(%classname,0,strLen(%classname)-4);
|
||||
%p = new (%class)()
|
||||
{
|
||||
datablock = %data;
|
||||
initialDirection = %dir;
|
||||
initialPosition = %obj.getWorldBoxCenter();
|
||||
SourceObject = %obj;
|
||||
SourceSlot = 0;
|
||||
};
|
||||
%p.StartVelocity = %speed;
|
||||
%p.createtime=getSimTime();
|
||||
|
||||
return %p;
|
||||
}
|
||||
|
||||
function extend(%p,%odir)
|
||||
{
|
||||
%dir = %p.InitialDirection;
|
||||
%pos = VectorAdd(%p.InitialPosition,VectorScale(%dir,-0.5));
|
||||
%left = VectorNormalize(VectorCross(VectorNormalize(%odir),"0 0 1"));
|
||||
%p1 = new SeekerProjectile()
|
||||
{
|
||||
dataBlock = mpmmissile2;
|
||||
initialDirection = %dir;
|
||||
initialPosition = VectorAdd(%pos,VectorScale(%left,5));
|
||||
sourceObject = %p.sourceObject;
|
||||
};
|
||||
|
||||
%p2 = new SeekerProjectile()
|
||||
{
|
||||
dataBlock = mpmmissile2;
|
||||
initialDirection = %dir;
|
||||
initialPosition = VectorAdd(%pos,VectorScale(%left,-5));
|
||||
sourceObject = %p.sourceObject;
|
||||
};
|
||||
%p1.createtime=getSimTime();
|
||||
%p1.StartVelocity = %p.sourceObject.GetVelocity();
|
||||
%p2.createtime=getSimTime();
|
||||
%p2.StartVelocity = %p.sourceObject.GetVelocity();
|
||||
%dietime = %p.dietime-GetSimTime();
|
||||
%p1.schedule(%dietime+10000,"delete");
|
||||
%p2.schedule(%dietime+10000,"delete");
|
||||
}
|
||||
|
||||
|
||||
2320
scripts/MPM/MPM_base.cs
Normal file
2320
scripts/MPM/MPM_base.cs
Normal file
File diff suppressed because it is too large
Load diff
272
scripts/MPM/Mpm_BE.cs
Normal file
272
scripts/MPM/Mpm_BE.cs
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
|
||||
if ($mpm_BE != 1)
|
||||
{
|
||||
//$mpm_load[$mpm_loads] = Mpm_Base_Load;
|
||||
//$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_BBom_Load;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_BMis_Load;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_BMor_Load;
|
||||
$mpm_loads++;
|
||||
$mpm_BE = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
datablock ItemData(Mpm_Base_Load)
|
||||
{
|
||||
cost = 40;
|
||||
missile = Mpm_B_MIS1;
|
||||
name = "[Weapon] Base Explosion";
|
||||
friendly = 0;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_BBom_Load):Mpm_Base_Load
|
||||
{
|
||||
cost = 75;
|
||||
name = "[Cluster] Bomber Run";
|
||||
missile = Mpm_B_MIS1;
|
||||
offset = "0 100";
|
||||
slot = 4;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_BMis_Load):Mpm_Base_Load
|
||||
{
|
||||
cost = 50;
|
||||
name = "[Cluster] Cluster Missile";
|
||||
missile = Mpm_B_MIS1;
|
||||
offset = "0 0";
|
||||
slot = 4;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_BMor_Load):Mpm_Base_Load
|
||||
{
|
||||
cost = 75;
|
||||
name = "[Cluster] Mortar dump";
|
||||
missile = Mpm_B_MIS1;
|
||||
offset = "0 100";
|
||||
slot = 4;
|
||||
};
|
||||
|
||||
datablock AudioDescription(AudioMassiveExplosion) {
|
||||
volume = "1";
|
||||
isLooping = "0";
|
||||
is3D = "1";
|
||||
minDistance = "500";
|
||||
maxDistance = "9999";
|
||||
coneInsideAngle = "360";
|
||||
coneOutsideAngle = "360";
|
||||
coneOutsideVolume = "1";
|
||||
coneVector = "0 0 1";
|
||||
environmentLevel = "1";
|
||||
loopCount = "-1";
|
||||
minLoopGap = "0";
|
||||
maxLoopGap = "0";
|
||||
type = "3";
|
||||
};
|
||||
|
||||
datablock AudioProfile(Mpm_BE_Sound) {
|
||||
fileName = "fx/weapons/mortar_explode.wav";
|
||||
description = "AudioMassiveExplosion";
|
||||
Preload = "1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_BE_PA) {
|
||||
dragCoefficient = "0.6";
|
||||
windCoefficient = "0";
|
||||
gravityCoefficient = "0";
|
||||
inheritedVelFactor = "0";
|
||||
constantAcceleration = "0";
|
||||
lifetimeMS = "7000";
|
||||
lifetimeVarianceMS = "2000";
|
||||
spinSpeed = "0";
|
||||
spinRandomMin = "-500";
|
||||
spinRandomMax = "500";
|
||||
useInvAlpha = "0";
|
||||
animateTexture = "0";
|
||||
framesPerSec = "1";
|
||||
textureName = "special/expFlare";
|
||||
animTexName[0] = "special/expFlare";
|
||||
colors[0] = "1.000000 1.000000 1.000000 0.900000";
|
||||
colors[1] = "1.000000 0.400000 0.000000 0.300000";
|
||||
colors[2] = "1.000000 0.300000 0.000000 0.000000";
|
||||
colors[3] = "1.000000 1.000000 1.000000 1.000000";
|
||||
sizes[0] = "75";
|
||||
sizes[1] = "250";
|
||||
sizes[2] = "400";
|
||||
sizes[3] = "1";
|
||||
times[0] = "0";
|
||||
times[1] = "0.7";
|
||||
times[2] = "1";
|
||||
times[3] = "2";
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock ParticleEmitterData(Mpm_BE_PE) {
|
||||
className = "ParticleEmitterData";
|
||||
ejectionPeriodMS = "3";
|
||||
periodVarianceMS = "0";
|
||||
ejectionVelocity = "57";
|
||||
velocityVariance = "20";
|
||||
ejectionOffset = "6";
|
||||
thetaMin = "0";
|
||||
thetaMax = "110";
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "360";
|
||||
overrideAdvance = "0";
|
||||
orientParticles = "0";
|
||||
orientOnVelocity = "1";
|
||||
particles = "Mpm_BE_PA";
|
||||
lifetimeMS = "3600";
|
||||
lifetimeVarianceMS = "0";
|
||||
useEmitterSizes = "0";
|
||||
useEmitterColors = "0";
|
||||
overrideAdvances = "0";
|
||||
};
|
||||
|
||||
datablock ExplosionData(Mpm_BE) {
|
||||
className = "ExplosionData";
|
||||
soundProfile = "Mpm_BE_Sound";
|
||||
faceViewer = "0";
|
||||
particleDensity = "10";
|
||||
particleRadius = "1";
|
||||
explosionScale = "1 1 1";
|
||||
playSpeed = "1";
|
||||
emitter[0] = "Mpm_BE_PE";
|
||||
shockwaveOnTerrain = "0";
|
||||
debrisThetaMin = "0";
|
||||
debrisThetaMax = "90";
|
||||
debrisPhiMin = "0";
|
||||
debrisPhiMax = "360";
|
||||
debrisNum = "1";
|
||||
debrisNumVariance = "0";
|
||||
debrisVelocity = "2";
|
||||
debrisVelocityVariance = "0";
|
||||
delayMS = "0";
|
||||
delayVariance = "0";
|
||||
lifetimeMS = "1000";
|
||||
lifetimeVariance = "0";
|
||||
offset = "0";
|
||||
times[0] = "0";
|
||||
times[1] = "1";
|
||||
times[2] = "1";
|
||||
times[3] = "1";
|
||||
sizes[0] = "1 1 1";
|
||||
sizes[1] = "1 1 1";
|
||||
sizes[2] = "1 1 1";
|
||||
sizes[3] = "1 1 1";
|
||||
shakeCamera = "0";
|
||||
camShakeFreq = "10 10 10";
|
||||
camShakeAmp = "1 1 1";
|
||||
camShakeDuration = "1.5";
|
||||
camShakeRadius = "10";
|
||||
camShakeFalloff = "10";
|
||||
};
|
||||
|
||||
datablock TracerProjectileData(Mpm_BE_PR):Mpm_G_PR {
|
||||
Explosion = "Mpm_BE";
|
||||
};
|
||||
|
||||
|
||||
function Mpm_BBom_Load::Stage2(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%p2 = parent::Stage2(%data,%p);
|
||||
Cancel(%p2.stage2);
|
||||
%p2.stage2 = %data.schedule((%p2.s2time-5000),"AtTarget",%p2);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Bbom_Load::AtTarget(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%speed = GetWords(%p.predict(),3,5);
|
||||
%p.schedule(100,"Mpm_BomberRun");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Mpm_Bmis_Load::Stage2(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%p2 = parent::Stage2(%data,%p);
|
||||
Cancel(%p2.stage2);
|
||||
%p2.stage2 = %data.schedule((%p2.s2time-5000),"AtTarget",%p2);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Bmis_Load::AtTarget(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%speed = GetWords(%p.predict(),3,5);
|
||||
%p.schedule(250,"Mpm_MissileRun");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Mpm_Bmor_Load::Stage2(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%p2 = parent::Stage2(%data,%p);
|
||||
Cancel(%p2.stage2);
|
||||
%p2.stage2 = %data.schedule((%p2.s2time-5000),"AtTarget",%p2);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Bmor_Load::AtTarget(%data,%p)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%speed = GetWords(%p.predict(),3,5);
|
||||
%p.schedule(100,"Mpm_MortarRun");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function SeekerProjectile::Mpm_BomberRun(%p)
|
||||
{
|
||||
%speed = VectorNormalize(GetWords(%p.predict(),3,5));
|
||||
%adjust = VectorCross(%speed,"0 0 1");
|
||||
%adjust = VectorAdd(VectorScale(VectorCross(%adjust,%speed),GetRandom()*2-1),VectorScale(%adjust,GetRandom()*2-1));
|
||||
%p2=BomberBomb.Create(%p.getWorldBoxCenter(),"0 0 -1",VectorScale(VectorAdd(%speed,%adjust),25));
|
||||
%p.schedule(250,"Mpm_bomberRun");
|
||||
}
|
||||
|
||||
function SeekerProjectile::Mpm_MissileRun(%p)
|
||||
{
|
||||
%speed = GetWords(%p.predict(),3,5);
|
||||
%dir = VectorNormalize(%speed);
|
||||
%for = VectorScale(%dir,-89.3);
|
||||
%left = VectorNormalize(VectorCross("0 0 1",%for));
|
||||
%up = VectorNormalize(VectorCross(%for,%left));
|
||||
%var = VectorAdd(VectorScale(%left,getRandom()*20-10),VectorScale(%up,getRandom()*20-10));
|
||||
%vel = VectorAdd(%for,%var);
|
||||
ShoulderMissile.create(%p.getWorldBoxCenter(),%dir,%vel);
|
||||
%p.schedule(100,"Mpm_MissileRun");
|
||||
}
|
||||
|
||||
function SeekerProjectile::Mpm_MortarRun(%p)
|
||||
{
|
||||
%speed = VectorNormalize(GetWords(%p.predict(),3,5));
|
||||
%adjust = VectorCross(%speed,"0 0 1");
|
||||
%adjust = VectorAdd(VectorScale(VectorCross(%adjust,%speed),GetRandom()*2-1),VectorScale(%adjust,GetRandom()*2-1));
|
||||
|
||||
%p2=MortarShot.Create(%p.getWorldBoxCenter(),"0 0 -1",VectorScale(VectorAdd(%speed,%adjust),25));
|
||||
%p.schedule(150,"Mpm_MortarRun");
|
||||
}
|
||||
|
||||
function Mpm_Base_Load::Explode(%data,%p,%pos)
|
||||
{
|
||||
if (IsObject(%p))
|
||||
{
|
||||
PlayExplosion(%pos,"Mpm_BE_PR","0 0 -1");
|
||||
RadiusExplosion(%p, %pos, 50, 5, 5000, %p.owner, $DamageType::Missile);
|
||||
}
|
||||
}
|
||||
766
scripts/MPM/Mpm_SE.cs
Normal file
766
scripts/MPM/Mpm_SE.cs
Normal file
|
|
@ -0,0 +1,766 @@
|
|||
///Telleport missile
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS_P1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 8000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "special/lensflare/flare00";
|
||||
|
||||
colors[0] = "0.3 0.3 1.0 0";
|
||||
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] = 0;
|
||||
sizes[1] = 10;
|
||||
sizes[2] = 5;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0.1;
|
||||
times[1] = 0.2;
|
||||
times[2] = 0.3;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS_PE1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 0.0;
|
||||
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "360";
|
||||
orientParticles = true;
|
||||
orientOnVelocity = true;
|
||||
|
||||
particles = "Mpm_B_MIS_P1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS_P2):Mpm_B_MIS_P1
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 1500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "special/lensflare/flare00";
|
||||
|
||||
colors[0] = "0.3 0.3 1.0 0";
|
||||
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] = 0;
|
||||
sizes[1] = 8;
|
||||
sizes[2] = 8;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0.3;
|
||||
times[1] = 0.5;
|
||||
times[2] = 0.8;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS_PE2):Mpm_B_MIS_PE1
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 50;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 140.0;
|
||||
thetaMax = 160.0;
|
||||
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS_P2";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
datablock SeekerProjectileData(Mpm_B_MIS):MpmMissile1
|
||||
{
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "turret_muzzlePoint.dts";
|
||||
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
splash = MissileSplash;
|
||||
|
||||
baseEmitter = Mpm_B_MIS_PE1;
|
||||
delayEmitter = Mpm_B_MIS_PE2;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 80000;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 3;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "0 0 1";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
//Multi WarHead Missiles
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS1_P1)
|
||||
{
|
||||
dragCoefficient = 5;
|
||||
gravityCoefficient = 0;
|
||||
inheritedVelFactor = 0.0;
|
||||
constantAcceleration = 0;
|
||||
lifetimeMS = 30000;
|
||||
lifetimeVarianceMS = 0;
|
||||
textureName = "special/BigSpark";
|
||||
windcoefficient = 0;
|
||||
colors[0] = "0.6 0.6 0.6 1";
|
||||
colors[1] = "0.6 0.6 0.6 1";
|
||||
colors[2] = "0.6 0.6 0.6 1";
|
||||
colors[3] = "0.2 0.2 0.2 1";
|
||||
sizes[0] = 0;
|
||||
sizes[1] = 15;
|
||||
sizes[2] = 5;
|
||||
sizes[3] = 0;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.04;
|
||||
times[2] = 0.08;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS1_PE1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 10;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 2;
|
||||
thetaMin = 180.0;
|
||||
thetaMax = 180.0;
|
||||
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "0";
|
||||
orientParticles = true;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS1_P1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS1_P2):Mpm_B_MIS_P1
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
constantAcceleration = -0.25;
|
||||
lifetimeMS = 10000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "special/BigSpark";
|
||||
|
||||
colors[0] = "1 1 1.0 1";
|
||||
colors[1] = "1 1 1.0 1";
|
||||
colors[2] = "1 1 1.0 1";
|
||||
colors[3] = "1 1 1.0 0.1";
|
||||
|
||||
sizes[0] = 0;
|
||||
sizes[1] = 5;
|
||||
sizes[2] = 3;
|
||||
sizes[3] = 0;
|
||||
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.04;
|
||||
times[2] = 0.08;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS1_PE2):Mpm_B_MIS_PE1
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 50;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 5;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 5;
|
||||
thetaMin = 150.0;
|
||||
thetaMax = 180.0;
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "360";
|
||||
|
||||
orientParticles = true;
|
||||
orientOnVelocity = true;
|
||||
|
||||
particles = "Mpm_B_MIS1_P2";
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock SeekerProjectileData(Mpm_B_MIS1):MpmMissile1
|
||||
{
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "turret_muzzlePoint.dts";
|
||||
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
splash = MissileSplash;
|
||||
|
||||
baseEmitter = Mpm_B_MIS1_PE1;
|
||||
delayEmitter = Mpm_B_MIS1_PE2;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 80000;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 3;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "1 1 0";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//Anti Missile
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS2_P1)
|
||||
{
|
||||
dragCoefficient = 5;
|
||||
gravityCoefficient = 0;
|
||||
inheritedVelFactor = 0.0;
|
||||
constantAcceleration = 0;
|
||||
lifetimeMS = 30000;
|
||||
lifetimeVarianceMS = 0;
|
||||
textureName = "special/sniper00";
|
||||
windcoefficient = 0;
|
||||
colors[0] = "0.6 0.6 0.6 1";
|
||||
colors[1] = "0.6 0.6 0.6 1";
|
||||
colors[2] = "0.6 0.6 0.6 1";
|
||||
colors[3] = "0.2 0.2 0.2 0";
|
||||
sizes[0] = 0;
|
||||
sizes[1] = 5;
|
||||
sizes[2] = 2;
|
||||
sizes[3] = 2;
|
||||
times[0] = 0.0;
|
||||
times[1] = 0.04;
|
||||
times[2] = 0.08;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS2_PE1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 10;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 2;
|
||||
thetaMin = 180.0;
|
||||
thetaMax = 180.0;
|
||||
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "0";
|
||||
orientParticles = true;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS2_P1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS2_P2):Mpm_B_MIS_P1
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
constantAcceleration = 0.0;
|
||||
lifetimeMS = 500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = -30.0;
|
||||
spinRandomMax = 30.0;
|
||||
windcoefficient = 0.5;
|
||||
textureName = "special/flare3";
|
||||
colors[0] = "1 1 0.0 1";
|
||||
colors[1] = "1 1 0.0 1";
|
||||
colors[2] = "1 1 0.0 1";
|
||||
colors[3] = "1 1 0.0 0.1";
|
||||
|
||||
sizes[0] = 10;
|
||||
sizes[1] = 10;
|
||||
sizes[2] = 10;
|
||||
sizes[3] = 10;
|
||||
|
||||
times[0] = 0.4;
|
||||
times[1] = 0.6;
|
||||
times[2] = 0.8;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS2_PE2):Mpm_B_MIS_PE1
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 100;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 0.0;
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "0";
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS2_P2";
|
||||
};
|
||||
|
||||
datablock SeekerProjectileData(Mpm_B_MIS2):MpmMissile1
|
||||
{
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "turret_muzzlePoint.dts";
|
||||
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
splash = MissileSplash;
|
||||
|
||||
baseEmitter = Mpm_B_MIS2_PE1;
|
||||
delayEmitter = Mpm_B_MIS2_PE2;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 20.0;
|
||||
maxVelocity = 20;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 0;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "1 0 0";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//Vehicle Missile
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS3_P1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 60000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0.5;
|
||||
textureName = "skins/jetflare2";
|
||||
|
||||
colors[0] = "0.3 0.8 0.6 1";
|
||||
colors[1] = "0.3 0.8 0.0 0.9";
|
||||
colors[2] = "0.3 0.8 0.6 0.5";
|
||||
colors[3] = "0.3 0.8 0.6 0.0";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 17;
|
||||
sizes[2] = 18;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.5;
|
||||
times[3] = 0.75;
|
||||
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS3_PE1)
|
||||
{
|
||||
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 100;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 10.0;
|
||||
velocityVariance = 1.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 5.0;
|
||||
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS3_P1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS3_P2):Mpm_B_MIS_P1
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = -160.0;
|
||||
spinRandomMax = 160.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/flaregreen";
|
||||
UseInvAlpha = false;
|
||||
colors[0] = "0.7 0.7 1.0 0.5";
|
||||
colors[1] = "0.7 0.7 1.0 0.5";
|
||||
colors[2] = "0.7 0.7 1.0 0.5";
|
||||
colors[3] = "0.7 0.7 1.0 0.5";
|
||||
|
||||
sizes[0] = 20;
|
||||
sizes[1] = 20;
|
||||
sizes[2] = 20;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0.25;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.25;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS3_PE2):Mpm_B_MIS_PE1
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 100;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 0.0;
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "0";
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS3_P2";
|
||||
};
|
||||
|
||||
datablock SeekerProjectileData(Mpm_B_MIS3):MpmMissile1
|
||||
{
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "turret_muzzlePoint.dts";
|
||||
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
splash = MissileSplash;
|
||||
|
||||
baseEmitter = Mpm_B_MIS3_PE1;
|
||||
delayEmitter = Mpm_B_MIS3_PE2;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 80000;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 1;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "0 1 0";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//Aid Missile
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS4_P1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 60000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0.5;
|
||||
textureName = "skins/jetflare2";
|
||||
|
||||
colors[0] = "0.3 0.3 0.8 1";
|
||||
colors[1] = "0.0 0.0 0.8 0.9";
|
||||
colors[2] = "0.3 0.3 0.8 0.5";
|
||||
colors[3] = "0.3 0.3 0.8 0.0";
|
||||
|
||||
sizes[0] = 5;
|
||||
sizes[1] = 17;
|
||||
sizes[2] = 18;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.5;
|
||||
times[3] = 0.75;
|
||||
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS4_PE1)
|
||||
{
|
||||
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 50;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 10.0;
|
||||
velocityVariance = 1.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 5.0;
|
||||
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS4_P1";
|
||||
};
|
||||
|
||||
datablock ParticleData(Mpm_B_MIS4_P2):Mpm_B_MIS_P1
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 1.0;
|
||||
|
||||
lifetimeMS = 1000;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = -160.0;
|
||||
spinRandomMax = 160.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "skins/flaregreen";
|
||||
UseInvAlpha = false;
|
||||
colors[0] = "0.2 0.2 1.0 0.5";
|
||||
colors[1] = "0.2 0.2 1.0 0.5";
|
||||
colors[2] = "0.2 0.2 1.0 0.5";
|
||||
colors[3] = "0.2 0.2 1.0 0.5";
|
||||
|
||||
sizes[0] = 20;
|
||||
sizes[1] = 20;
|
||||
sizes[2] = 20;
|
||||
sizes[3] = 20;
|
||||
|
||||
times[0] = 0.25;
|
||||
times[1] = 0.25;
|
||||
times[2] = 0.25;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_B_MIS4_PE2):Mpm_B_MIS_PE1
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 100;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 0;
|
||||
thetaMin = 0.0;
|
||||
thetaMax = 0.0;
|
||||
phiReferenceVel = "0";
|
||||
phiVariance = "0";
|
||||
|
||||
orientParticles = false;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_B_MIS4_P2";
|
||||
};
|
||||
|
||||
datablock SeekerProjectileData(Mpm_B_MIS4):MpmMissile1
|
||||
{
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "turret_muzzlePoint.dts";
|
||||
|
||||
|
||||
explosion = "GrenadeExplosion";
|
||||
splash = MissileSplash;
|
||||
|
||||
baseEmitter = Mpm_B_MIS4_PE1;
|
||||
delayEmitter = Mpm_B_MIS4_PE2;
|
||||
puffEmitter = MissilePuffEmitter;
|
||||
bubbleEmitter = GrenadeBubbleEmitter;
|
||||
bubbleEmitTime = 1.0;
|
||||
|
||||
exhaustEmitter = MissileLauncherExhaustEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
lifetimeMS = -1;
|
||||
muzzleVelocity = 0.1;
|
||||
maxVelocity = 80000;
|
||||
turningSpeed = 0.0;
|
||||
acceleration = 1;
|
||||
scale = "1 1 1";
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 0;
|
||||
flareAngle = 0;
|
||||
|
||||
sound = HAPCFlyerThrustSound;
|
||||
//BomberFlyerThrustSound;
|
||||
explodeOnDeath = "1";
|
||||
hasLight = true;
|
||||
lightRadius = 10.0;
|
||||
lightColor = "0 0 1";
|
||||
|
||||
useFlechette = false;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = true;
|
||||
};
|
||||
|
||||
|
||||
193
scripts/MPM/Mpm_TE.cs
Normal file
193
scripts/MPM/Mpm_TE.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
if ($mpm_TE != 1)
|
||||
{
|
||||
$mpm_load[$mpm_loads] = Mpm_TE_Load;
|
||||
$mpm_loads++;
|
||||
$mpm_TE = 1;
|
||||
}
|
||||
|
||||
|
||||
datablock ItemData(Mpm_TE_Load)
|
||||
{
|
||||
cost = 10;
|
||||
missile = Mpm_B_MIS;
|
||||
name = "MPB Telleporter";
|
||||
friendly = 1;
|
||||
slot = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
datablock ParticleData(Mpm_TE_P)
|
||||
{
|
||||
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(Mpm_TE_PE)
|
||||
{
|
||||
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 = "Mpm_TE_P";
|
||||
};
|
||||
|
||||
|
||||
function Mpm_TE_Load::Explode(%data,%p,%pos)
|
||||
{
|
||||
//echo("explode");
|
||||
if (IsObject(%p))
|
||||
{
|
||||
//if(VectorDist(%p.targetlocation,%pos)<50)
|
||||
%p.load.AtTarget(%p);
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_TE_Load::AtTarget(%data,%p)
|
||||
{
|
||||
//echo("attar");
|
||||
if (IsObject(%p))
|
||||
{
|
||||
%p.source.mpb.MPM_TelleportMpb(VectorAdd(%p.getTransform(),"0 0 10"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Mpb_undeploy(%obj)
|
||||
{
|
||||
if (%obj.deploySchedule)
|
||||
{
|
||||
%obj.deploySchedule.clear();
|
||||
%obj.deploySchedule = "";
|
||||
}
|
||||
|
||||
if (%obj.deployed !$= "" && %obj.deployed == 1)
|
||||
{
|
||||
%obj.setThreadDir($DeployThread, false);
|
||||
%obj.playThread($DeployThread,"deploy");
|
||||
%obj.playAudio($DeploySound, MobileBaseUndeploySound);
|
||||
%obj.station.setThreadDir($DeployThread, false);
|
||||
%obj.station.getDataBlock().onLosePowerDisabled(%obj.station);
|
||||
%obj.station.clearSelfPowered();
|
||||
%obj.station.goingOut=false;
|
||||
%obj.station.notDeployed = 1;
|
||||
%obj.station.playAudio($DeploySound, MobileBaseStationUndeploySound);
|
||||
|
||||
if (isObject(%obj.turret) && isObject(%turretClient = %obj.turret.getControllingClient()) !$= "")
|
||||
{
|
||||
CommandToServer( 'resetControlObject', %turretClient );
|
||||
}
|
||||
if (isObject(%obj.turret))
|
||||
%obj.turret.setThreadDir($DeployThread, false);
|
||||
//[most]
|
||||
if (isObject(%obj.nuke))
|
||||
%obj.nuke.mpm_all_off(0);
|
||||
//[most]
|
||||
%obj.turret.clearTarget();
|
||||
%obj.turret.setTargetObject(-1);
|
||||
|
||||
%obj.turret.playAudio($DeploySound, MobileBaseTurretUndeploySound);
|
||||
%obj.shield.open();
|
||||
%obj.shield.schedule(1000,"delete");
|
||||
%obj.deploySchedule = "";
|
||||
|
||||
%obj.fullyDeployed = 0;
|
||||
|
||||
%obj.noEnemyControl = 0;
|
||||
}
|
||||
%obj.deployed = 0;
|
||||
|
||||
}
|
||||
|
||||
function GameBase::MPM_TelleportMpb(%mpb,%target)
|
||||
{
|
||||
%p1 = CreateEmitter(%mpb.getTransform(),Mpm_TE_PE);
|
||||
%p2 = CreateEmitter(%mpb.getTransform(),Mpm_TE_PE);
|
||||
%p2.setRotation("1 0 0 3.14");
|
||||
%p3 = CreateEmitter(%target,Mpm_TE_PE);
|
||||
%p4 = CreateEmitter(%target,Mpm_TE_PE);
|
||||
%p4.setRotation("1 0 0 3.14");
|
||||
if (%mpb.deployed)
|
||||
{
|
||||
if (IsObject(%mpb.nuke.leftpad.getMountedObject(0)))
|
||||
%mpb.mountObject(%mpb.nuke.leftpad.getMountedObject(0),0);
|
||||
else if (IsObject(%mpb.nuke.rightpad.getMountedObject(0)))
|
||||
%mpb.mountObject(%mpb.nuke.rightpad.getMountedObject(0),0);
|
||||
|
||||
%mpb.schedule(7000,"telleport",%target);
|
||||
Schedule(7000,%mpb,"RadiusTelleport",%mpb,%mpb.getTransform(),%target);
|
||||
%p1.schedule(11000,"delete");
|
||||
%p2.schedule(11000,"delete");
|
||||
%p3.schedule(11000,"delete");
|
||||
%p4.schedule(11000,"delete");
|
||||
mpb_undeploy(%mpb);
|
||||
}
|
||||
else
|
||||
{
|
||||
%mpb.schedule(1500,"telleport",%target);
|
||||
Schedule(1500,%mpb,"RadiusTelleport",%mpb,%mpb.getTransform(),%target);
|
||||
%p1.schedule(5500,"delete");
|
||||
%p2.schedule(5500,"delete");
|
||||
%p3.schedule(5500,"delete");
|
||||
%p4.schedule(5500,"delete");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function RadiusTelleport(%obj,%pos,%target)
|
||||
{
|
||||
%mask = $TypeMasks::PlayerObjectType | $TypeMasks::ItemObjectType;
|
||||
InitContainerRadiusSearch(%pos, 8, %mask);
|
||||
while ((%test = containerSearchNext()) != 0)
|
||||
{
|
||||
if (%test != %obj && %test != %obj.getMountedObject(0))
|
||||
{
|
||||
%offset = VectorSub(%test.getTransform(),%pos);
|
||||
%test.telleport(VectorAdd(%target,%offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::telleport(%obj,%pos)
|
||||
{
|
||||
teleportStartFX(%obj);
|
||||
schedule(500,0,"teleportEndFX",%obj);
|
||||
%obj.schedule(500,"SetTransform",%pos SPC rot(%obj));
|
||||
}
|
||||
|
||||
205
scripts/MPM/Mpm_VE.cs
Normal file
205
scripts/MPM/Mpm_VE.cs
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
if ($mpm_VE!=1)
|
||||
{
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load0;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load1;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load2;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load3;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load4;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load5;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load6;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load7;
|
||||
$mpm_loads++;
|
||||
$mpm_load[$mpm_loads] = Mpm_VE_Load8;
|
||||
$mpm_loads++;
|
||||
$mpm_VE = 1;
|
||||
}
|
||||
|
||||
datablock ParticleData(Mpm_VE_P1)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 2500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "special/GameGrid";
|
||||
|
||||
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.1;
|
||||
times[1] = 0.5;
|
||||
times[2] = 0.9;
|
||||
times[3] = 1;
|
||||
|
||||
};
|
||||
|
||||
|
||||
datablock ParticleData(Mpm_VE_P2)
|
||||
{
|
||||
dragCoeffiecient = 0.0;
|
||||
gravityCoefficient = 0.0;
|
||||
inheritedVelFactor = 0.0;
|
||||
|
||||
lifetimeMS = 2500;
|
||||
lifetimeVarianceMS = 0;
|
||||
|
||||
spinRandomMin = 0.0;
|
||||
spinRandomMax = 0.0;
|
||||
windcoefficient = 0;
|
||||
textureName = "special/GameGrid";
|
||||
|
||||
|
||||
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.1;
|
||||
times[1] = 0.5;
|
||||
times[2] = 0.9;
|
||||
times[3] = 1;
|
||||
|
||||
|
||||
};
|
||||
|
||||
datablock ParticleEmitterData(Mpm_VE_PE1)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 15;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.1;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 8;
|
||||
thetaMin = 70.0;
|
||||
thetaMax = 70.0;
|
||||
|
||||
phiReferenceVel = "180";
|
||||
phiVariance = "5";
|
||||
orientParticles = true;
|
||||
orientOnVelocity = false;
|
||||
|
||||
particles = "Mpm_VE_P1";
|
||||
};
|
||||
|
||||
|
||||
datablock ParticleEmitterData(Mpm_VE_PE2)
|
||||
{
|
||||
lifetimeMS = 10;
|
||||
ejectionPeriodMS = 15;
|
||||
periodVarianceMS = 0;
|
||||
|
||||
ejectionVelocity = 0.01;
|
||||
velocityVariance = 0.0;
|
||||
ejectionoffset = 8;
|
||||
thetaMin = 30.0;
|
||||
thetaMax = 30.0;
|
||||
|
||||
phiReferenceVel = "180";
|
||||
phiVariance = "5";
|
||||
orientParticles = true;
|
||||
orientOnVelocity = false;
|
||||
|
||||
|
||||
particles = "Mpm_VE_P2";
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_VE_Load0)
|
||||
{
|
||||
cost = 20;
|
||||
missile = Mpm_B_MIS3;
|
||||
name = "[Vehicle] Grav Cycle Missile";
|
||||
friendly = 1;
|
||||
vehicle = ScoutVehicle;
|
||||
slot = 0;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_VE_Load1):Mpm_VE_Load0
|
||||
{
|
||||
cost = 40;
|
||||
name = "[Vehicle] Tank Missile";
|
||||
vehicle = AssaultVehicle;
|
||||
};
|
||||
datablock ItemData(Mpm_VE_Load2):Mpm_VE_Load0
|
||||
{
|
||||
cost = 100;
|
||||
name = "[Vehicle] Mpb Missile";
|
||||
vehicle = MobileBaseVehicle;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_VE_Load3):Mpm_VE_Load0
|
||||
{
|
||||
cost = 25;
|
||||
name = "[Vehicle] Shrike Missile";
|
||||
vehicle = ScoutFlyer;
|
||||
};
|
||||
datablock ItemData(Mpm_VE_Load4):Mpm_VE_Load0
|
||||
{
|
||||
cost = 50;
|
||||
name = "[Vehicle] Bomber Missile";
|
||||
vehicle = BomberFlyer;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_VE_Load5):Mpm_VE_Load0
|
||||
{
|
||||
cost = 80;
|
||||
name = "[Vehicle] Havoc Missile";
|
||||
vehicle = HAPCFlyer;
|
||||
};
|
||||
datablock ItemData(Mpm_VE_Load6):Mpm_VE_Load0
|
||||
{
|
||||
cost = 800;
|
||||
name = "[Vehicle] Super Grav Cycle Missile";
|
||||
vehicle = SuperScoutVehicle;
|
||||
};
|
||||
|
||||
datablock ItemData(Mpm_VE_Load7):Mpm_VE_Load0
|
||||
{
|
||||
cost = 800;
|
||||
name = "[Vehicle] Super Havoc Missile";
|
||||
vehicle = SuperHAPCFlyer;
|
||||
};
|
||||
datablock ItemData(Mpm_VE_Load8):Mpm_VE_Load0
|
||||
{
|
||||
cost = 700;
|
||||
name = "[Vehicle] Artillery Missile";
|
||||
vehicle = Artillery;
|
||||
};
|
||||
|
||||
function Mpm_VE_Load0::AtTarget(%data,%p)
|
||||
{
|
||||
if (IsObject(%p) && vehicleCheck(%p.load.vehicle, %p.source.team))
|
||||
{
|
||||
%p1 = CreateEmitter(%p.getTransform(),Mpm_VE_PE1);
|
||||
%p2 = CreateEmitter(%p.getTransform(),Mpm_VE_PE2);
|
||||
$VehicleTotalCount[%p.source.team, %p.load.vehicle]++;
|
||||
%vehicle = %p.load.vehicle.create(%p.source.team);
|
||||
%vehicle.telleport(VectorAdd(%p.getTransform(),"0 0 10"));
|
||||
%p1.schedule(8000,"delete");
|
||||
%p2.schedule(8000,"delete");
|
||||
}
|
||||
}
|
||||
1356
scripts/MPM/Nuclear_blast.cs
Normal file
1356
scripts/MPM/Nuclear_blast.cs
Normal file
File diff suppressed because it is too large
Load diff
2585
scripts/MPM/Nuke_Cannon.cs
Normal file
2585
scripts/MPM/Nuke_Cannon.cs
Normal file
File diff suppressed because it is too large
Load diff
1227
scripts/MTC_ai.cs
Normal file
1227
scripts/MTC_ai.cs
Normal file
File diff suppressed because it is too large
Load diff
1482
scripts/MTC_core.cs
Normal file
1482
scripts/MTC_core.cs
Normal file
File diff suppressed because it is too large
Load diff
531
scripts/MTC_eWeap.cs
Normal file
531
scripts/MTC_eWeap.cs
Normal file
|
|
@ -0,0 +1,531 @@
|
|||
///Using new weapon mode switching logic :D :D
|
||||
|
||||
$WeaponSettings1[TractorGunImage] = "7 -1 TractorGun:[Power]";
|
||||
$WeaponSetting1[TractorGunImage,0] = "Grapling Power 1";
|
||||
$WeaponSetting1[TractorGunImage,1] = "Grapling Power 2";
|
||||
$WeaponSetting1[TractorGunImage,2] = "Grapling Power 3";
|
||||
$WeaponSetting1[TractorGunImage,3] = "Grapling Power 4";
|
||||
$WeaponSetting1[TractorGunImage,4] = "Grapling Power 5";
|
||||
$WeaponSetting1[TractorGunImage,5] = "Grapling Power 10";
|
||||
$WeaponSetting1[TractorGunImage,6] = "Grapling Power 125";
|
||||
$WeaponSetting1[TractorGunImage,7] = "Grapling Power 256";
|
||||
|
||||
|
||||
$WeaponSettings2[TractorGunImage] = "5 -1 TractorGun:[Direction]";
|
||||
$WeaponSetting2[TractorGunImage,0] = "Pull target";
|
||||
$WeaponSetting2[TractorGunImage,1] = "Push target";
|
||||
$WeaponSetting2[TractorGunImage,2] = "Keep target at 10 meters distance";
|
||||
$WeaponSetting2[TractorGunImage,3] = "Pull user";
|
||||
$WeaponSetting2[TractorGunImage,4] = "Push user";
|
||||
$WeaponSetting2[TractorGunImage,5] = "Keep user at 10 meters distance";
|
||||
|
||||
|
||||
datablock ItemData(TractorGun)
|
||||
{
|
||||
className = Weapon;
|
||||
catagory = "Spawn Items";
|
||||
shapeFile = "weapon_elf.dts";
|
||||
image = TractorGunImage;
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
pickUpName = "an Tractor gun";
|
||||
|
||||
computeCRC = true;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
////////////////Tractor Beam///////////////////////
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
datablock ELFProjectileData(TractorBeam)
|
||||
{
|
||||
beamRange = 150;
|
||||
numControlPoints = 8;
|
||||
restorativeFactor = 3.75;
|
||||
dragFactor = 4.5;
|
||||
endFactor = 2.25;
|
||||
randForceFactor = 2;
|
||||
randForceTime = 0.125;
|
||||
drainEnergy = 0.0;
|
||||
drainHealth = 0.0;
|
||||
directDamageType = $DamageType::ELF;
|
||||
mainBeamWidth = 0.1; // width of blue wave beam
|
||||
mainBeamSpeed = 9.0; // speed that the beam travels forward
|
||||
mainBeamRepeat = 0.25; // number of times the texture repeats
|
||||
lightningWidth = 0.5;
|
||||
lightningDist = 0.5; // distance of lightning from main beam
|
||||
|
||||
fireSound = ElfGunFireSound;
|
||||
wetFireSound = ElfFireWetSound;
|
||||
|
||||
textures[0] = "special/Sniper";
|
||||
textures[1] = "special/FlareSpark";
|
||||
textures[2] = "special/Redflare";
|
||||
|
||||
emitter = FlareEmitter;
|
||||
};
|
||||
|
||||
|
||||
datablock ShapeBaseImageData(TractorGunImage)
|
||||
{
|
||||
className = WeaponImage;
|
||||
|
||||
shapeFile = "weapon_elf.dts";
|
||||
item = TractorGun;
|
||||
offset = "0 0 0";
|
||||
|
||||
projectile = TractorBeam;
|
||||
projectileType = ELFProjectile;
|
||||
deleteLastProjectile = true;
|
||||
emap = true;
|
||||
|
||||
|
||||
usesEnergy = true;
|
||||
minEnergy = 3;
|
||||
|
||||
stateName[0] = "Activate";
|
||||
stateSequence[0] = "Activate";
|
||||
stateSound[0] = ELFGunSwitchSound;
|
||||
stateTimeoutValue[0] = 0.5;
|
||||
stateTransitionOnTimeout[0] = "ActivateReady";
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateTransitionOnAmmo[1] = "Ready";
|
||||
stateTransitionOnNoAmmo[1] = "NoAmmo";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateTransitionOnNoAmmo[2] = "NoAmmo";
|
||||
stateTransitionOnTriggerDown[2] = "CheckWet";
|
||||
|
||||
stateName[3] = "Fire";
|
||||
stateEnergyDrain[3] = 5;
|
||||
stateFire[3] = true;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateScript[3] = "onFire";
|
||||
stateTransitionOnTriggerUp[3] = "Deconstruction";
|
||||
stateTransitionOnNoAmmo[3] = "Deconstruction";
|
||||
//stateSound[3] = ElfFireWetSound;
|
||||
|
||||
stateName[4] = "NoAmmo";
|
||||
stateTransitionOnAmmo[4] = "Ready";
|
||||
|
||||
stateName[5] = "Deconstruction";
|
||||
stateScript[5] = "deconstruct";
|
||||
stateTransitionOnTimeout[5] = "Ready";
|
||||
stateTransitionOnNoAmmo[6] = "NoAmmo";
|
||||
|
||||
stateName[6] = "DryFire";
|
||||
stateSound[6] = ElfFireWetSound;
|
||||
stateTimeoutValue[6] = 0.5;
|
||||
stateTransitionOnTimeout[6] = "Ready";
|
||||
|
||||
stateName[7] = "CheckWet";
|
||||
stateTransitionOnWet[7] = "DryFire";
|
||||
stateTransitionOnNotWet[7] = "Fire";
|
||||
};
|
||||
|
||||
datablock TurretImageData(TractorTurretBarrel)
|
||||
{
|
||||
|
||||
|
||||
shapeFile = "turret_Elf_large.dts";//"weapon_elf.dts";//
|
||||
item = ELFGun;
|
||||
|
||||
projectile = TractorBeam;
|
||||
projectileType = ELFProjectile;
|
||||
|
||||
deleteLastProjectile = true;
|
||||
emap = true;
|
||||
|
||||
|
||||
UsesEnergy = true;
|
||||
minEnergy = 0.1;
|
||||
fireEnergy = 0.1;
|
||||
|
||||
rotation = "0 1 0 90";
|
||||
offset = "0 -0.5 0";
|
||||
|
||||
yawVariance = 30.0; // these will smooth out the elf tracking code.
|
||||
pitchVariance = 30.0; // more or less just tolerances
|
||||
// Turret parameters
|
||||
activationMS = 500;
|
||||
deactivateDelayMS = 100;
|
||||
thinkTimeMS = 100;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 960;
|
||||
attackRadius = 500;
|
||||
|
||||
|
||||
yawVariance = 60.0; // these will smooth out the elf tracking code.
|
||||
pitchVariance = 60.0; // more or less just tolerances
|
||||
|
||||
|
||||
// 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";
|
||||
stateFire[3] = true;
|
||||
stateRecoil[3] = LightRecoil;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateSound[3] = EBLFireSound;
|
||||
stateScript[3] = "onFire";
|
||||
stateTransitionOnTriggerUp[3] = "Deconstruction";
|
||||
stateTransitionOnNoAmmo[3] = "Deconstruction";
|
||||
|
||||
stateName[4] = "Reload";
|
||||
stateTimeoutValue[4] = 0.01;
|
||||
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";
|
||||
|
||||
stateName[8] = "Deconstruction";
|
||||
stateScript[8] = "deconstruct";
|
||||
stateTransitionOnNoAmmo[8] = "NoAmmo";
|
||||
stateTransitionOnTimeout[8] = "Reload";
|
||||
stateTimeoutValue[8] = 0.1;
|
||||
};
|
||||
|
||||
function TractorBeam::zapTarget(%data, %projectile, %target, %targeter)
|
||||
{
|
||||
%projectile.checkTractorStatus(%data, %target, %targeter);
|
||||
}
|
||||
|
||||
function TractorTurretBarrel::onFire(%data, %obj, %slot)
|
||||
{
|
||||
//if (getSimTime()-%target.swingend > 5000)
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function ELFProjectile::checkTractorStatus(%this, %data, %target, %targeter)
|
||||
{
|
||||
%obj = %this.sourceObject;
|
||||
if((isObject(%target)) && (isObject(%obj)))
|
||||
{
|
||||
if(%target.getDamageState() $= "Destroyed")
|
||||
{
|
||||
cancel(%this.Tractorrecur);
|
||||
%this.delete();
|
||||
%targeter.base.resetorders();
|
||||
return;
|
||||
}
|
||||
|
||||
%data = %target.getDataBlock();
|
||||
%data2 = %targeter.getDataBlock();
|
||||
%pos = %target.getWorldBoxCenter();
|
||||
%pos2 = %targeter.getWorldBoxCenter();
|
||||
if (%targeter.IsMtc())
|
||||
%pos2= VectorAdd(%pos2,"0 0 15");
|
||||
%vec = VectorSub(%pos2,%pos);
|
||||
%dist = VectorLen(%vec);
|
||||
%dir = VectorNormalize(%vec);
|
||||
%set = %targeter.weaponSet1;
|
||||
if (%set !$="")
|
||||
%speed = getWord($WeaponSetting1[TractorGunImage,%targeter.weaponSet1],2);
|
||||
else
|
||||
%speed = 5;
|
||||
|
||||
%dspeed = Limit((%dist-10)/10,-1,1);
|
||||
if (%targeter.weaponSet2 == 2 || %targeter.weaponSet2 == 5)
|
||||
{
|
||||
%speed = %dspeed*%dspeed*%speed;
|
||||
%dir = VectorScale(%dir,Lev(%dspeed));
|
||||
}
|
||||
|
||||
if (%targeter.weaponSet2 == 1 || %targeter.weaponSet2 == 4)
|
||||
%dir = VectorScale(%dir,-1);
|
||||
//%amount = VectorScale(%dir, Limit((10000/%dist),0,10000));
|
||||
if (%client = %targeter.client)
|
||||
%admin = (%client.isAdmin || %client.isSuperAdmin);
|
||||
|
||||
%wantuser = (%targeter.weaponSet2 > 2);
|
||||
%tisplayer = (%target.getType() & $TypeMasks::PlayerObjectType);
|
||||
%tisgveh = (%target.getType() & $TypeMasks::VehicleObjectType && !%obj.disableMove);
|
||||
%allowed = ((%target.team != %obj.team) || ($teamDamage || %admin));
|
||||
|
||||
if (%allowed && (%tisplayer || %tisgveh) && !%wantuser)
|
||||
{
|
||||
if(%obj.getObjectMount() != %target && %this.hasTarget())
|
||||
{
|
||||
%limit = (%target.getType() & $TypeMasks::VehicleObjectType);
|
||||
%size = Limit(3*%data.mass*%speed,0,10000*(1+9*%limit));
|
||||
%amount = VectorScale(%dir, %size);
|
||||
%target.applyImpulse(%pos, %amount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%obj.getObjectMount() != %target && %this.hasTarget())
|
||||
{
|
||||
%size = Limit(3*%data2.mass*%speed,0,10000);
|
||||
%amount = VectorScale(%dir, %size);
|
||||
%targeter.applyImpulse(%pos2, VectorScale(%amount,-1));
|
||||
}
|
||||
}
|
||||
%this.TractorRecur = %this.schedule(70, checkTractorStatus, %data, %target, %targeter);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////SwarmDisc////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
datablock SeekerProjectileData(SeekingDisc)
|
||||
{
|
||||
projectileShapeName = "disc.dts";
|
||||
emitterDelay = -1;
|
||||
directDamage = 0.0;
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 0.10;
|
||||
damageRadius = 7.5;
|
||||
radiusDamageType = $DamageType::Disc;
|
||||
kickBackStrength = 1750;
|
||||
|
||||
sound = discProjectileSound;
|
||||
explosion = "DiscExplosion";
|
||||
underwaterExplosion = "UnderwaterDiscExplosion";
|
||||
splash = DiscSplash;
|
||||
|
||||
|
||||
velInheritFactor = 0.5;
|
||||
fizzleTimeMS = 50000;
|
||||
lifetimeMS = 50000;
|
||||
explodeOnDeath = true;
|
||||
reflectOnWaterImpactAngle = 15.0;
|
||||
explodeOnWaterImpact = true;
|
||||
deflectionOnWaterImpact = 0.0;
|
||||
fizzleUnderwaterMS = 5000;
|
||||
|
||||
|
||||
baseEmitter = HumanArmorJetEmitter;
|
||||
delayEmitter = HumanArmorJetEmitter;
|
||||
|
||||
exhaustEmitter = DiscMistEmitter;
|
||||
exhaustTimeMs = 300;
|
||||
exhaustNodeName = "muzzlePoint1";
|
||||
|
||||
|
||||
muzzleVelocity = 10.0;
|
||||
maxVelocity = 30.0;
|
||||
turningSpeed = 110.0;
|
||||
acceleration = 5;
|
||||
|
||||
proximityRadius = 0;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
|
||||
activateDelayMS = 200;
|
||||
|
||||
hasLight = true;
|
||||
lightRadius = 6.0;
|
||||
lightColor = "0.175 0.175 0.5";
|
||||
|
||||
};
|
||||
|
||||
|
||||
datablock TurretImageData(SwarmDiscTurretBarrel)
|
||||
{
|
||||
|
||||
shapeFile = "turret_AA_large.dts";//weapon_missile.dts";
|
||||
item = MissileLauncher;
|
||||
//ammo = MissileLauncherAmmo;
|
||||
armThread = lookms;
|
||||
emap = true;
|
||||
|
||||
projectile= SeekingDisc;
|
||||
projectileType= SeekerProjectile;
|
||||
|
||||
isSeeker = true;
|
||||
seekRadius = 900;
|
||||
maxSeekAngle = 90;
|
||||
seekTime = 5.0;
|
||||
minSeekHeat = 0.0; // the heat that must be present on a target to lock it.
|
||||
yawVariance = 30.0; // these will smooth out the elf tracking code.
|
||||
pitchVariance = 30.0; // more or less just tolerances
|
||||
|
||||
usesEnergy = true;
|
||||
fireEnergy = 5;
|
||||
minEnergy = 5;
|
||||
projectileSpread = 0.01;
|
||||
|
||||
|
||||
offset = "0.7 -0.04 -0.45";
|
||||
rotation = "0 1 0 -90";
|
||||
|
||||
// only target objects outside this range
|
||||
minTargetingDistance = 4;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 250;
|
||||
deactivateDelayMS = 500;
|
||||
thinkTimeMS = 200;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 1080;
|
||||
attackRadius = 500;
|
||||
|
||||
// State transitions
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnNotLoaded[0] = "Dead";
|
||||
stateTransitionOnLoaded[0] = "ActivateReady";
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateSequence[1] = "Activate";
|
||||
stateSound[1] = MBLSwitchSound;
|
||||
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] = MBLFireSound;
|
||||
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";
|
||||
};
|
||||
|
||||
datablock TurretImageData(SwarmDiscTurretBarrel1):SwarmDiscTurretBarrel
|
||||
{
|
||||
shapeFile = "turret_AA_large.dts";//weapon_mortar.dts";
|
||||
item = Mortar;
|
||||
offset = "-0.7 -0.04 -0.45";
|
||||
rotation = "0 1 0 -90";
|
||||
};
|
||||
|
||||
|
||||
function SwarmDiscTurretBarrel::onMount(%this, %obj, %slot)
|
||||
{
|
||||
%mount1 = "SwarmDiscTurretBarrel1";
|
||||
%mount2 = "MtcTurretCore";
|
||||
%obj.schedule(2000,"mountImage",%mount1,1,true);
|
||||
%obj.mountImage(%mount2,2,true);
|
||||
}
|
||||
|
||||
|
||||
function SwarmDiscTurretBarrel::onFire(%data,%obj,%slot)
|
||||
{
|
||||
for (%i = 0; %i < 5;%i++)
|
||||
{
|
||||
%obj.currentbarrel = !%obj.currentbarrel;
|
||||
%slot = %obj.currentbarrel;
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
if (%p)
|
||||
{
|
||||
MissileSet.add(%p);
|
||||
|
||||
if (%obj.base.target)
|
||||
{
|
||||
%target = %obj.base.target;
|
||||
}
|
||||
else
|
||||
%target = %obj.getLockedTarget();
|
||||
|
||||
%sign = GiveSign(%target);
|
||||
if(%target)
|
||||
{
|
||||
%p.setObjectTarget(%sign);
|
||||
}
|
||||
else if(%obj.isLocked())
|
||||
%p.setPositionTarget(%obj.getLockedPosition());
|
||||
else
|
||||
%p.setNoTarget();
|
||||
discoff(%p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function SwarmDiscTurretBarrel1::onFire(%data,%obj,%slot)
|
||||
{
|
||||
//Do nothing;
|
||||
}
|
||||
|
||||
function discoff(%p)
|
||||
{
|
||||
if (!IsObject(%p))
|
||||
return "";
|
||||
if (!IsObject(%p.getTargetObject()) && IsObject(%p.disctarget))
|
||||
{
|
||||
%p.setObjectTarget(%p.disctarget);
|
||||
}
|
||||
else if (IsObject(%p.getTargetObject()))
|
||||
{
|
||||
%p.disctarget = %p.getTargetObject();
|
||||
%p.setNoTarget();
|
||||
}
|
||||
else
|
||||
return "";
|
||||
schedule(getRandom()*1000+500,0,"discoff",%p);
|
||||
}
|
||||
|
||||
41
scripts/MTC_level.cs
Normal file
41
scripts/MTC_level.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
//Basic Levels;
|
||||
|
||||
//These make up the spawning behaviour of the mtc weapon types
|
||||
//Only starting ideas for now
|
||||
//Changes are culmative
|
||||
|
||||
//Only targeting lasers
|
||||
function MTCLevel0()
|
||||
{
|
||||
$MTCCHANGE::weapon[0] = "target";
|
||||
$MTCCHANGE::change[0] = 1;
|
||||
$MTCCHANGE::totchange = 1;
|
||||
$MTCCHANGE::count = 1;
|
||||
}
|
||||
|
||||
//9 targeting lasers
|
||||
//1 blaster
|
||||
function MTCLevel1()
|
||||
{
|
||||
$MTCCHANGE::weapon[0] = "target";
|
||||
$MTCCHANGE::change[0] = 9;
|
||||
$MTCCHANGE::weapon[0] = "blaster";
|
||||
$MTCCHANGE::change[0] = 10;
|
||||
$MTCCHANGE::totchange = 10;
|
||||
$MTCCHANGE::count = 2;
|
||||
}
|
||||
|
||||
//8 targeting lasers
|
||||
//2 blasters
|
||||
//1 grenades
|
||||
function MTCLevel2()
|
||||
{
|
||||
$MTCCHANGE::weapon[0] = "target";
|
||||
$MTCCHANGE::change[0] = 8;
|
||||
$MTCCHANGE::weapon[0] = "blaster";
|
||||
$MTCCHANGE::change[0] = 10;
|
||||
$MTCCHANGE::weapon[0] = "grenade";
|
||||
$MTCCHANGE::change[0] = 11;
|
||||
$MTCCHANGE::totchange = 11;
|
||||
$MTCCHANGE::count = 3;
|
||||
}
|
||||
1334
scripts/MTC_weap.cs
Normal file
1334
scripts/MTC_weap.cs
Normal file
File diff suppressed because it is too large
Load diff
2763
scripts/OptionsDlg.cs
Normal file
2763
scripts/OptionsDlg.cs
Normal file
File diff suppressed because it is too large
Load diff
31
scripts/TR2Game.cs
Normal file
31
scripts/TR2Game.cs
Normal 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");
|
||||
612
scripts/admin.cs
Normal file
612
scripts/admin.cs
Normal file
|
|
@ -0,0 +1,612 @@
|
|||
// These have been secured against all those wanna-be-hackers.
|
||||
$VoteMessage["VoteAdminPlayer"] = "Admin Player";
|
||||
$VoteMessage["VoteKickPlayer"] = "Kick Player";
|
||||
$VoteMessage["BanPlayer"] = "Ban Player";
|
||||
$VoteMessage["VoteChangeMission"] = "change the mission to";
|
||||
$VoteMessage["VoteTeamDamage", 0] = "enable team damage";
|
||||
$VoteMessage["VoteTeamDamage", 1] = "disable team damage";
|
||||
$VoteMessage["VoteTournamentMode"] = "change the server to";
|
||||
$VoteMessage["VoteFFAMode"] = "change the server to";
|
||||
$VoteMessage["VoteChangeTimeLimit"] = "change the time limit to";
|
||||
$VoteMessage["VoteMatchStart"] = "start the match";
|
||||
$VoteMessage["VoteGreedMode", 0] = "enable Hoard Mode";
|
||||
$VoteMessage["VoteGreedMode", 1] = "disable Hoard Mode";
|
||||
$VoteMessage["VoteHoardMode", 0] = "enable Greed Mode";
|
||||
$VoteMessage["VoteHoardMode", 1] = "disable Greed Mode";
|
||||
// JTL
|
||||
$VoteMessage["VotePurebuild", 0] = "enable pure building";
|
||||
$VoteMessage["VotePurebuild", 1] = "disable pure building";
|
||||
$VoteMessage["VoteCascadeMode", 0] = "enable cascade mode";
|
||||
$VoteMessage["VoteCascadeMode", 1] = "disable cascade mode";
|
||||
$VoteMessage["VoteExpertMode", 0] = "enable expert mode";
|
||||
$VoteMessage["VoteExpertMode", 1] = "disable expert mode";
|
||||
$VoteMessage["VoteVehicles", 0] = "enable vehicles";
|
||||
$VoteMessage["VoteVehicles", 1] = "disable vehicles";
|
||||
$VoteMessage["VoteSatchelCharge", 0] = "enable satchel charges";
|
||||
$VoteMessage["VoteSatchelCharge", 1] = "disable satchel charges";
|
||||
$VoteMessage["VoteOnlyOwnerDeconstruct", 0] = "enable only owner deconstruct";
|
||||
$VoteMessage["VoteOnlyOwnerDeconstruct", 1] = "disable only owner deconstruct";
|
||||
$VoteMessage["VoteOnlyOwnerCascade", 0] = "enable only owner cascade";
|
||||
$VoteMessage["VoteOnlyOwnerCascade", 1] = "disable only owner cascade";
|
||||
$VoteMessage["VoteOnlyOwnerRotate", 0] = "enable only owner rotate";
|
||||
$VoteMessage["VoteOnlyOwnerRotate", 1] = "disable only owner rotate";
|
||||
$VoteMessage["VoteOnlyOwnerCubicReplace", 0] = "enable only owner cubic-replace";
|
||||
$VoteMessage["VoteOnlyOwnerCubicReplace", 1] = "disable only owner cubic-replace";
|
||||
$VoteMessage["VoteInvincibleArmors", 0] = "enable invincible armors";
|
||||
$VoteMessage["VoteInvincibleArmors", 1] = "disable invincible armors";
|
||||
$VoteMessage["VoteInvincibleDeployables", 0] = "enable invincible deployables";
|
||||
$VoteMessage["VoteInvincibleDeployables", 1] = "disable invincible deployables";
|
||||
$VoteMessage["VoteUndergroundMode", 0] = "enable underground mode";
|
||||
$VoteMessage["VoteUndergroundMode", 1] = "disable underground mode";
|
||||
$VoteMessage["VoteHazardMode", 0] = "enable hazard mode";
|
||||
$VoteMessage["VoteHazardMode", 1] = "disable hazard mode";
|
||||
$VoteMessage["VoteMTCMode", 0] = "enable MTC mode";
|
||||
$VoteMessage["VoteMTCMode", 1] = "disable MTC mode";
|
||||
$VoteMessage["VoteRemoveDeployables"] = "remove all deployables in mission";
|
||||
$VoteMessage["VoteGlobalPowerCheck"] = "remove all duplicate deployables";
|
||||
$VoteMessage["VoteRemoveDupDeployables"] = "remove all duplicate deployables";
|
||||
$VoteMessage["VoteRemoveNonPoweredDeployables"] = "remove all deployables without power";
|
||||
$VoteMessage["VoteRemoveOrphanedDeployables"] = "remove all orphaned deployables";
|
||||
$VoteMessage["VotePrison", 0] = "enable prison";
|
||||
$VoteMessage["VotePrison", 1] = "disable prison";
|
||||
$VoteMessage["VotePrisonKilling", 0] = "enable jailing killers";
|
||||
$VoteMessage["VotePrisonKilling", 1] = "disable jailing killers";
|
||||
$VoteMessage["VotePrisonTeamKilling", 0] = "enable jailing team killers";
|
||||
$VoteMessage["VotePrisonTeamKilling", 1] = "disable jailing team killers";
|
||||
$VoteMessage["VotePrisonDeploySpam", 0] = "enable jailing deploy spammers";
|
||||
$VoteMessage["VotePrisonDeploySpam", 1] = "disable jailing deploy spammers";
|
||||
$VoteMessage["VoteNerfWeapons", 0] = "enable nerf weapons";
|
||||
$VoteMessage["VoteNerfWeapons", 1] = "disable nerf weapons";
|
||||
$VoteMessage["VoteNerfDance", 0] = "enable nerf dance mode";
|
||||
$VoteMessage["VoteNerfDance", 1] = "disable nerf dance mode";
|
||||
$VoteMessage["VotenerfDeath", 0] = "enable nerf death mode";
|
||||
$VoteMessage["VotenerfDeath", 1] = "disable nerf death mode";
|
||||
$VoteMessage["VoteNerfPrison", 0] = "enable nerf prison mode";
|
||||
$VoteMessage["VoteNerfPrison", 1] = "disable nerf prison mode";
|
||||
// End JTL
|
||||
|
||||
function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote)
|
||||
{
|
||||
//DEMO VERSION - only voteKickPlayer is allowed
|
||||
if ((isDemo()) && %typeName !$= "VoteKickPlayer")
|
||||
{
|
||||
messageClient(%client, '', "All voting options except to kick a player are disabled in the DEMO VERSION.");
|
||||
return;
|
||||
}
|
||||
|
||||
// haha - who gets the last laugh... No admin for you!
|
||||
if( %typeName $= "VoteAdminPlayer" && (!$Host::allowAdminPlayerVotes && !%client.isSuperAdmin))
|
||||
return;
|
||||
|
||||
%typePass = true;
|
||||
|
||||
// if not a valid vote, turn back.
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteTeamDamage" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteHoardMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteGreedMode" )
|
||||
// JTL
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VotePurebuild" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteCascadeMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteExpertMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteVehicles" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteSatchelCharge" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteOnlyOwnerDeconstruct" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteOnlyOwnerCascade" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteOnlyOwnerRotate" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteOnlyOwnerCubicReplace" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteRemoveDeployables" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteGlobalPowerCheck" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteRemoveDupDeployables" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteRemoveNonPoweredDeployables" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteRemoveOrphanedDeployables" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteInvincibleArmors" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteInvincibleDeployables" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteUndergroundMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteHazardMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteMTCMode" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VotePrison" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VotePrisonKilling" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VotePrisonTeamKilling" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VotePrisonDeploySpam" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteNerfWeapons" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteNerfDance" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteNerfDeath" )
|
||||
if( $VoteMessage[ %typeName ] $= "" && %typeName !$= "VoteNerfPrison" )
|
||||
%typePass = false;
|
||||
// End JTL
|
||||
|
||||
if(( $VoteMessage[ %typeName, $TeamDamage ] $= "" && %typeName $= "VoteTeamDamage" ))
|
||||
%typePass = false;
|
||||
// JTL
|
||||
if(( $VoteMessage[ %typeName, $Host::Purebuild ] $= "" && %typeName $= "VotePurebuild" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Cascade ] $= "" && %typeName $= "VoteCascadeMode" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::ExpertMode ] $= "" && %typeName $= "VoteExpertMode" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Vehicles ] $= "" && %typeName $= "VoteVehicles" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::SatchelChargeEnabled ] $= "" && %typeName $= "VoteSatchelCharge" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::OnlyOwnerDeconstruct ] $= "" && %typeName $= "VoteOnlyOwnerDeconstruct" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::OnlyOwnerCascade ] $= "" && %typeName $= "VoteOnlyOwnerCascade" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::OnlyOwnerRotate ] $= "" && %typeName $= "VoteOnlyOwnerRotate" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::OnlyOwnerCubicReplace ] $= "" && %typeName $= "VoteOnlyOwnerCubicReplace" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::InvincibleArmors ] $= "" && %typeName $= "VoteInvincibleArmors" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::InvincibleDeployables ] $= "" && %typeName $= "VoteInvincibleDeployables" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::AllowUnderground ] $= "" && %typeName $= "VoteUndergroundMode" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Hazard::Enabled ] $= "" && %typeName $= "VoteHazardMode" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::MTC::Enabled ] $= "" && %typeName $= "VoteMTCMode" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Prison::Enabled ] $= "" && %typeName $= "VotePrison" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Prison::Kill ] $= "" && %typeName $= "VotePrisonKilling" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Prison::TeamKill ] $= "" && %typeName $= "VotePrisonTeamKilling" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Prison::DeploySpam ] $= "" && %typeName $= "VotePrisonDeploySpam" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Nerf::Enabled ] $= "" && %typeName $= "VoteNerfWeapons" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Nerf::DanceAnim ] $= "" && %typeName $= "VoteNerfDance" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Nerf::DeathAnim ] $= "" && %typeName $= "VoteNerfDeath" ))
|
||||
%typePass = false;
|
||||
if(( $VoteMessage[ %typeName, $Host::Nerf::Prison ] $= "" && %typeName $= "VoteNerfPrison" ))
|
||||
%typePass = false;
|
||||
// End JTL
|
||||
|
||||
if( !%typePass )
|
||||
return; // -> bye ;)
|
||||
|
||||
// z0dd - ZOD, 10/03/02. This was busted, BanPlayer was never delt with.
|
||||
if( %typeName $= "BanPlayer" )
|
||||
{
|
||||
if( !%client.isSuperAdmin || %arg1.isAdmin )
|
||||
{
|
||||
return; // -> bye ;)
|
||||
}
|
||||
else
|
||||
{
|
||||
ban( %arg1, %client );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%isAdmin = ( %client.isAdmin || %client.isSuperAdmin );
|
||||
|
||||
// JTL
|
||||
if(%typeName $= "VoteVehicles" && !%isAdmin)
|
||||
if(%typeName $= "VoteVehicles" && !%isAdmin)
|
||||
if(%typeName $= "VoteSatchelCharge" && !%isAdmin)
|
||||
if(%typeName $= "VoteOnlyOwnerDeconstruct" && !%isAdmin)
|
||||
if(%typeName $= "VoteOnlyOwnerCascade" && !%isAdmin)
|
||||
if(%typeName $= "VoteOnlyOwnerRotate" && !%isAdmin)
|
||||
if(%typeName $= "VoteOnlyOwnerCubicReplace" && !%isAdmin)
|
||||
if(%typeName $= "VoteRemoveDeployables" && !%isAdmin)
|
||||
if(%typeName $= "VoteGlobalPowerCheck" && !%isAdmin)
|
||||
if(%typeName $= "VoteRemoveDupDeployables" && !%isAdmin)
|
||||
if(%typeName $= "VoteRemoveNonPoweredDeployables" && !%isAdmin)
|
||||
if(%typeName $= "VoteRemoveOrphanedDeployables" && !%isAdmin)
|
||||
if(%typeName $= "VoteInvincibleArmors" && !%isAdmin)
|
||||
if(%typeName $= "VoteInvincibleDeployables" && !%isAdmin)
|
||||
if(%typeName $= "VoteUndergroundMode" && !%isAdmin)
|
||||
if(%typeName $= "VoteHazardMode" && !%isAdmin)
|
||||
if(%typeName $= "VoteMTCMode" && !%isAdmin)
|
||||
if(%typeName $= "VotePrison" && !%isAdmin)
|
||||
if(%typeName $= "VotePrisonKilling" && !%isAdmin)
|
||||
if(%typeName $= "VotePrisonTeamKilling" && !%isAdmin)
|
||||
if(%typeName $= "VotePrisonDeploySpam" && !%isAdmin)
|
||||
if(%typeName $= "VoteNerfWeapons" && !%isAdmin)
|
||||
if(%typeName $= "VoteNerfDance" && !%isAdmin)
|
||||
if(%typeName $= "VoteNerfDeath" && !%isAdmin)
|
||||
if(%typeName $= "VoteNerfPrison" && !%isAdmin)
|
||||
%typePass = false;
|
||||
|
||||
if( !%typePass )
|
||||
return; // -> bye ;)
|
||||
// End JTL
|
||||
|
||||
// keep these under the server's control. I win.
|
||||
if( !%playerVote )
|
||||
%actionMsg = $VoteMessage[ %typeName ];
|
||||
else if( %typeName $= "VoteTeamDamage" || %typeName $= "VoteGreedMode" || %typeName $= "VoteHoardMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $TeamDamage ];
|
||||
// JTL
|
||||
else if( %typeName $= "VotePurebuild" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Purebuild ];
|
||||
else if( %typeName $= "VoteCascadeMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Cascade ];
|
||||
else if( %typeName $= "VoteExpertMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::ExpertMode ];
|
||||
else if( %typeName $= "VoteVehicles" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Vehicles ];
|
||||
else if( %typeName $= "VoteSatchelCharge" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::SatchelChargeEnabled ];
|
||||
else if( %typeName $= "VoteOnlyOwnerDeconstruct" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::OnlyOwnerDeconstruct ];
|
||||
else if( %typeName $= "VoteOnlyOwnerCascade" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::OnlyOwnerCascade ];
|
||||
else if( %typeName $= "VoteOnlyOwnerRotate" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::OnlyOwnerRotate ];
|
||||
else if( %typeName $= "VoteOnlyOwnerCubicReplace" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::OnlyOwnerCubicReplace ];
|
||||
else if( %typeName $= "VoteInvincibleArmors" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::InvincibleArmors ];
|
||||
else if( %typeName $= "VoteInvincibleDeployables" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::InvincibleDeployables ];
|
||||
else if( %typeName $= "VoteUndergroundMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::AllowUnderground ];
|
||||
else if( %typeName $= "VoteHazardMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Hazard::Enabled ];
|
||||
else if( %typeName $= "VoteMTCMode" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::MTC::Enabled ];
|
||||
else if( %typeName $= "VotePrison" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Prison::Enabled ];
|
||||
else if( %typeName $= "VotePrisonKilling" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Prison::Kill ];
|
||||
else if( %typeName $= "VotePrisonTeamKilling" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Prison::TeamKill ];
|
||||
else if( %typeName $= "VotePrisonDeploySpam" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Prison::DeploySpam ];
|
||||
else if( %typeName $= "VoteNerfWeapons" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Nerf::Enabled ];
|
||||
else if( %typeName $= "VoteNerfDance" )
|
||||
%actionMsg = $VoteMessage[ %typeName, ($Host::Nerf::DanceAnim && !$Host::Nerf::DeathAnim) ];
|
||||
else if( %typeName $= "VoteNerfDeath" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Nerf::DeathAnim ];
|
||||
else if( %typeName $= "VoteNerfPrison" )
|
||||
%actionMsg = $VoteMessage[ %typeName, $Host::Nerf::Prison ];
|
||||
// End JTL
|
||||
else
|
||||
%actionMsg = $VoteMessage[ %typeName ];
|
||||
|
||||
if( !%client.canVote && !%isAdmin )
|
||||
return;
|
||||
|
||||
if ( ( !%isAdmin || ( %arg1.isAdmin && ( %client != %arg1 ) ) ) && // z0dd - ToS 4/2/02: Allow SuperAdmins to kick Admins
|
||||
!( ( %typeName $= "VoteKickPlayer" ) && %client.isSuperAdmin ) ) // z0dd - ToS 4/2/02: Allow SuperAdmins to kick Admins
|
||||
{
|
||||
%teamSpecific = false;
|
||||
%gender = (%client.sex $= "Male" ? 'he' : 'she');
|
||||
if ( Game.scheduleVote $= "" )
|
||||
{
|
||||
%clientsVoting = 0;
|
||||
|
||||
//send a message to everyone about the vote...
|
||||
if ( %playerVote )
|
||||
{
|
||||
%teamSpecific = ( %typeName $= "VoteKickPlayer" ) && ( Game.numTeams > 1 );
|
||||
%kickerIsObs = %client.team == 0;
|
||||
%kickeeIsObs = %arg1.team == 0;
|
||||
%sameTeam = %client.team == %arg1.team;
|
||||
|
||||
if( %kickeeIsObs )
|
||||
{
|
||||
%teamSpecific = false;
|
||||
%sameTeam = false;
|
||||
}
|
||||
|
||||
if(( !%sameTeam && %teamSpecific) && %typeName !$= "VoteAdminPlayer")
|
||||
{
|
||||
messageClient(%client, '', "\c2Player votes must be team based.");
|
||||
return;
|
||||
}
|
||||
|
||||
// kicking is team specific
|
||||
if( %typeName $= "VoteKickPlayer" )
|
||||
{
|
||||
if(%arg1.isSuperAdmin)
|
||||
{
|
||||
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
|
||||
return;
|
||||
}
|
||||
|
||||
Game.kickClient = %arg1;
|
||||
Game.kickClientName = %arg1.name;
|
||||
Game.kickGuid = %arg1.guid;
|
||||
Game.kickTeam = %arg1.team;
|
||||
|
||||
if(%teamSpecific)
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
|
||||
if (%cl.team == %client.team && !%cl.isAIControlled())
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1.name);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( %typeName $= "VoteChangeMission" )
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, %actionMsg, %arg1, %arg2 );
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (%arg1 !$= 0)
|
||||
{
|
||||
if (%arg2 !$= 0)
|
||||
{
|
||||
if(%typeName $= "VoteTournamentMode")
|
||||
{
|
||||
%admin = getAdmin();
|
||||
if(%admin > 0)
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, %actionMsg, %arg1);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient( %client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 %4.', %client.name, %actionMsg, %arg1, %arg2);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %actionMsg, %arg1);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %idx );
|
||||
if ( !%cl.isAIControlled() )
|
||||
{
|
||||
messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// open the vote hud for all clients that will participate in this vote
|
||||
if(%teamSpecific)
|
||||
{
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
|
||||
if(%cl.team == %client.team && !%cl.isAIControlled())
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
if ( !%cl.isAIControlled() )
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
}
|
||||
}
|
||||
|
||||
clearVotes();
|
||||
Game.voteType = %typeName;
|
||||
Game.scheduleVote = schedule( ($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4 );
|
||||
%client.vote = true;
|
||||
messageAll('addYesVote', "");
|
||||
|
||||
if(!%client.team == 0)
|
||||
clearBottomPrint(%client);
|
||||
}
|
||||
else
|
||||
messageClient( %client, 'voteAlreadyRunning', '\c2A vote is already in progress.' );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName )
|
||||
{
|
||||
messageAll('closeVoteHud', "");
|
||||
cancel(Game.scheduleVote);
|
||||
Game.scheduleVote = "";
|
||||
}
|
||||
|
||||
// if this is a superAdmin, don't kick or ban
|
||||
if(%arg1 != %client)
|
||||
{
|
||||
if(!%arg1.isSuperAdmin)
|
||||
{
|
||||
// Set up kick/ban values:
|
||||
if ( %typeName $= "VoteBanPlayer" || %typeName $= "VoteKickPlayer" )
|
||||
{
|
||||
Game.kickClient = %arg1;
|
||||
Game.kickClientName = %arg1.name;
|
||||
Game.kickGuid = %arg1.guid;
|
||||
Game.kickTeam = %arg1.team;
|
||||
}
|
||||
|
||||
//Tinman - PURE servers can't call "eval"
|
||||
//Mark - True, but neither SHOULD a normal server
|
||||
// - thanks Ian Hardingham
|
||||
Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4);
|
||||
}
|
||||
else
|
||||
messageClient(%client, '', '\c2You can not %1 %2, %3 is a Super Admin!', %actionMsg, %arg1.name, %gender);
|
||||
}
|
||||
}
|
||||
|
||||
%client.canVote = false;
|
||||
%client.rescheduleVote = schedule( ($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client );
|
||||
}
|
||||
|
||||
function resetVotePrivs( %client )
|
||||
{
|
||||
//messageClient( %client, '', 'You may now start a new vote.');
|
||||
%client.canVote = true;
|
||||
%client.rescheduleVote = "";
|
||||
}
|
||||
|
||||
function serverCmdSetPlayerVote(%client, %vote)
|
||||
{
|
||||
// players can only vote once
|
||||
if( %client.vote $= "" )
|
||||
{
|
||||
%client.vote = %vote;
|
||||
if(%client.vote == 1)
|
||||
messageAll('addYesVote', "");
|
||||
else
|
||||
messageAll('addNoVote', "");
|
||||
|
||||
commandToClient(%client, 'voteSubmitted', %vote);
|
||||
}
|
||||
}
|
||||
|
||||
function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4)
|
||||
{
|
||||
if(%typeName $= "voteMatchStart")
|
||||
if($MatchStarted || $countdownStarted)
|
||||
return;
|
||||
|
||||
for ( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
|
||||
{
|
||||
%cl = ClientGroup.getObject( %clientIndex );
|
||||
messageClient(%cl, 'closeVoteHud', "");
|
||||
|
||||
if ( %cl.vote !$= "" )
|
||||
{
|
||||
if ( %cl.vote )
|
||||
{
|
||||
Game.votesFor[%cl.team]++;
|
||||
Game.totalVotesFor++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.votesAgainst[%cl.team]++;
|
||||
Game.totalVotesAgainst++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Game.votesNone[%cl.team]++;
|
||||
Game.totalVotesNone++;
|
||||
}
|
||||
}
|
||||
//Tinman - PURE servers can't call "eval"
|
||||
//Mark - True, but neither SHOULD a normal server
|
||||
// - thanks Ian Hardingham
|
||||
Game.evalVote(%typeName, false, %arg1, %arg2, %arg3, %arg4);
|
||||
Game.scheduleVote = "";
|
||||
Game.kickClient = "";
|
||||
clearVotes();
|
||||
}
|
||||
|
||||
function clearVotes()
|
||||
{
|
||||
for(%clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%clientIndex);
|
||||
%client.vote = "";
|
||||
messageClient(%client, 'clearVoteHud', "");
|
||||
}
|
||||
|
||||
for(%team = 1; %team < 5; %team++)
|
||||
{
|
||||
Game.votesFor[%team] = 0;
|
||||
Game.votesAgainst[%team] = 0;
|
||||
Game.votesNone[%team] = 0;
|
||||
Game.totalVotesFor = 0;
|
||||
Game.totalVotesAgainst = 0;
|
||||
Game.totalVotesNone = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Tournament mode Stuff-----------------------------------
|
||||
|
||||
function setModeFFA( %mission, %missionType )
|
||||
{
|
||||
if( $Host::TournamentMode )
|
||||
{
|
||||
$Host::TournamentMode = false;
|
||||
|
||||
if( isObject( Game ) )
|
||||
Game.gameOver();
|
||||
|
||||
loadMission(%mission, %missionType, false);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
function setModeTournament( %mission, %missionType )
|
||||
{
|
||||
if( !$Host::TournamentMode )
|
||||
{
|
||||
$Host::TournamentMode = true;
|
||||
|
||||
if( isObject( Game ) )
|
||||
Game.gameOver();
|
||||
|
||||
loadMission(%mission, %missionType, false);
|
||||
}
|
||||
}
|
||||
86
scripts/chatCommands.cs
Normal file
86
scripts/chatCommands.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
function chatcommands(%sender, %message) {
|
||||
%cmd=getWord(%message,0);
|
||||
%cmd=stripChars(%cmd,"/");
|
||||
%count=getWordCount(%message);
|
||||
%args=getwords(%message,1);
|
||||
%cmd="cc" @ %cmd;
|
||||
if (%cmd $="ccopen") //so u can call //open instead of //opendoor
|
||||
%cmd="ccopendoor";
|
||||
call(%cmd,%sender,%args);
|
||||
}
|
||||
|
||||
function ccopendoor(%sender,%args) {
|
||||
%pos = %sender.player.getMuzzlePoint($WeaponSlot);
|
||||
%vec = %sender.player.getMuzzleVector($WeaponSlot);
|
||||
%targetpos = vectoradd(%pos,vectorscale(%vec,100));
|
||||
%obj = containerraycast(%pos,%targetpos,$typemasks::staticshapeobjecttype,%sender.player);
|
||||
%obj = getword(%obj,0);
|
||||
%dataBlock = %obj.getDataBlock();
|
||||
%className = %dataBlock.className;
|
||||
%cash = %obj.amount;
|
||||
%owner = %obj.owner;
|
||||
%obj.issliding = 0;
|
||||
if (%obj.Collision == true) //if is a colition door
|
||||
return; //stop here
|
||||
if (%obj.canmove == false) //if it cant move
|
||||
return; //stop here
|
||||
if (%obj.isdoor != 1 && %hitobj.getdatablock().getname() !$="DeployedTdoor"){
|
||||
messageclient(%sender, 'MsgClient', '\c5No door in range.');
|
||||
return;
|
||||
}
|
||||
if (!isobject(%obj)) {
|
||||
messageclient(%sender, 'MsgClient', '\c5No door in range.');
|
||||
return;
|
||||
}
|
||||
if (%obj.powercontrol == 1) {
|
||||
messageclient(%sender, 'MsgClient', '\c5This door is controlled by a power supply.');
|
||||
return;
|
||||
}
|
||||
%pass = %args;
|
||||
if (%obj.pw $= %pass) {
|
||||
if (%obj.toggletype ==1){
|
||||
if (%obj.moving $="close" || %obj.moving $="" || %going $="opening"){
|
||||
schedule(10,0,"open",%obj);
|
||||
}
|
||||
else if (%obj.moving $="open" || %going $="closeing"){
|
||||
schedule(10,0,"close",%obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
schedule(10,0,"open",%obj);
|
||||
}
|
||||
if (%obj.pw !$= %pass)
|
||||
messageclient(%sender,'MsgClient',"\c2Password Denied.");
|
||||
|
||||
}
|
||||
|
||||
function ccsetdoorpass(%sender,%args){
|
||||
%pos=%sender.player.getMuzzlePoint($WeaponSlot);
|
||||
%vec = %sender.player.getMuzzleVector($WeaponSlot);
|
||||
%targetpos=vectoradd(%pos,vectorscale(%vec,100));
|
||||
%obj=containerraycast(%pos,%targetpos,$typemasks::staticshapeobjecttype,%sender.player);
|
||||
%obj=getword(%obj,0);
|
||||
%dataBlock = %obj.getDataBlock();
|
||||
%className = %dataBlock.className;
|
||||
if (%classname !$= "door") {
|
||||
messageclient(%sender, 'MsgClient', '\c2No door in range.');
|
||||
return;
|
||||
}
|
||||
if (%obj.owner!=%sender && %obj.owner !$="")
|
||||
messageclient(%sender, 'MsgClient', '\c2You do not own this door.');
|
||||
if (!isobject(%obj))
|
||||
messageclient(%sender, 'MsgClient', '\c2No door in range.');
|
||||
if (%obj.Collision $= true) {
|
||||
messageclient(%sender, 'MsgClient', '\c2Collision doors can not have passwords.');
|
||||
return;
|
||||
}
|
||||
if(isobject(%obj) && %obj.owner==%sender) {
|
||||
%pw=getword(%args,0);
|
||||
%obj.pw=%pw;
|
||||
messageclient(%sender, 'MsgClient', '\c2Password set, password is %1.',%pw);
|
||||
}
|
||||
}
|
||||
|
||||
function ccbf(%sender,%args) {
|
||||
buyFavorites(%sender);
|
||||
}
|
||||
2132
scripts/client.cs
Normal file
2132
scripts/client.cs
Normal file
File diff suppressed because it is too large
Load diff
1606
scripts/controlDefaults.cs
Normal file
1606
scripts/controlDefaults.cs
Normal file
File diff suppressed because it is too large
Load diff
284
scripts/dEffects.cs
Normal file
284
scripts/dEffects.cs
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
// Deploy effects
|
||||
|
||||
datablock AudioProfile(DrillLinkSound)
|
||||
{
|
||||
filename = "fx/misc/mine.deploy.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SingeLinkSound)
|
||||
{
|
||||
filename = "fx/weapons/chaingun_off.wav"; // "fx/weapons/grenade_camera_activate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
|
||||
datablock AudioProfile(BoltLinkSound)
|
||||
{
|
||||
filename = "fx/misc/health_patch.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(ClickLinkSound)
|
||||
{
|
||||
filename = "fx/misc/health_patch.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(SingeSound)
|
||||
{
|
||||
filename = "fx/weapons/ElF_hit.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(LargeLinkeSound)
|
||||
{
|
||||
filename = "fx/weapons/grenade_explode_UW.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
|
||||
datablock LinearProjectileData(FastSingeProjectile) {
|
||||
className = "LinearProjectileData";
|
||||
projectileShapeName = "turret_muzzlepoint.dts";
|
||||
emitterDelay = "-1";
|
||||
velInheritFactor = "0";
|
||||
directDamage = "0";
|
||||
hasDamageRadius = "0";
|
||||
indirectDamage = "0";
|
||||
damageRadius = "0";
|
||||
radiusDamageType = "0";
|
||||
kickBackStrength = "0";
|
||||
baseEmitter = "ELFSparksEmitter";
|
||||
hasLight = "0";
|
||||
lightRadius = "20";
|
||||
lightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
hasLightUnderwaterColor = "0";
|
||||
underWaterLightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
explodeOnWaterImpact = "0";
|
||||
depthTolerance = "5";
|
||||
bubbleEmitTime = "0.5";
|
||||
faceViewer = "0";
|
||||
scale = "1 1 1";
|
||||
dryVelocity = "5";
|
||||
wetVelocity = "5";
|
||||
fizzleTimeMS = "60000";
|
||||
lifetimeMS = "60000";
|
||||
explodeOnDeath = "0";
|
||||
reflectOnWaterImpactAngle = "0";
|
||||
deflectionOnWaterImpact = "0";
|
||||
fizzleUnderwaterMS = "-1";
|
||||
activateDelayMS = "-1";
|
||||
doDynamicClientHits = "0";
|
||||
sound = "ELFHitTargetSound";
|
||||
explosion = "BlasterExplosion";
|
||||
};
|
||||
|
||||
datablock LinearProjectileData(SlowSingeProjectile) {
|
||||
className = "LinearProjectileData";
|
||||
projectileShapeName = "turret_muzzlepoint.dts";
|
||||
emitterDelay = "-1";
|
||||
velInheritFactor = "0";
|
||||
directDamage = "0";
|
||||
hasDamageRadius = "0";
|
||||
indirectDamage = "0";
|
||||
damageRadius = "0";
|
||||
radiusDamageType = "0";
|
||||
kickBackStrength = "0";
|
||||
baseEmitter = "ElfSparksEmitter";
|
||||
hasLight = "0";
|
||||
lightRadius = "20";
|
||||
lightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
hasLightUnderwaterColor = "0";
|
||||
underWaterLightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
explodeOnWaterImpact = "0";
|
||||
depthTolerance = "5";
|
||||
bubbleEmitTime = "0.5";
|
||||
faceViewer = "0";
|
||||
scale = "1 1 1";
|
||||
dryVelocity = "1";
|
||||
wetVelocity = "1";
|
||||
fizzleTimeMS = "60000";
|
||||
lifetimeMS = "60000";
|
||||
explodeOnDeath = "0";
|
||||
reflectOnWaterImpactAngle = "0";
|
||||
deflectionOnWaterImpact = "0";
|
||||
fizzleUnderwaterMS = "-1";
|
||||
activateDelayMS = "-1";
|
||||
doDynamicClientHits = "0";
|
||||
sound = "ELFHitTargetSound";
|
||||
explosion = "BlasterExplosion";
|
||||
};
|
||||
|
||||
|
||||
function singe(%pos,%dir,%size,%type) {
|
||||
%p = new LinearProjectile() {
|
||||
dataBlock = %type @"SingeProjectile";
|
||||
initialDirection = %dir;
|
||||
initialPosition = %pos;
|
||||
};
|
||||
|
||||
if (%type $= "fast")
|
||||
%p.schedule((%size/5)*1000,"delete");
|
||||
else
|
||||
%p.schedule((%size)*1000,"delete");
|
||||
}
|
||||
|
||||
function edgesinge(%obj)
|
||||
{
|
||||
%objsize = VectorSub(getWords(%obj.getObjectBox(),3,5),getWords(%obj.getObjectBox(),0,2));
|
||||
%realsize = realSize(%obj);//VectorMultiply(VectorMultiply(%objsize,%obj.getScale()),"1 1 0");
|
||||
|
||||
%offset = VectorScale(Realvec(%obj,%realsize),0.49);
|
||||
%offset2 = VectorScale(VectorCross(VectorNormalize(%offset),realvec(%obj,"0 0 1")),VectorLen(%offset));
|
||||
%pos1 = VectorAdd(%obj.getWorldBoxCenter(),%offset);
|
||||
%pos2 = VectorAdd(%obj.getWorldBoxCenter(),VectorScale(%offset,-1));
|
||||
singe(%pos1,Realvec(%obj,"-1 0 0"),GetWord(%realsize,0),"fast");
|
||||
singe(%pos1,Realvec(%obj,"0 -1 0"),GetWord(%realsize,1),"fast");
|
||||
singe(%pos2,Realvec(%obj,"1 0 0"),GetWord(%realsize,0),"fast");
|
||||
singe(%pos2,Realvec(%obj,"0 1 0"),GetWord(%realsize,1),"fast");
|
||||
}
|
||||
|
||||
function linksinge(%obj,%pt,%nrm)
|
||||
{
|
||||
if (%nrm !$= "")
|
||||
{
|
||||
%nrm = VectorNormalize(%nrm);
|
||||
%dir = VectorNormalize(VectorCross(%nrm,Realvec(%obj,"0 0 1")));
|
||||
%objsize = VectorSub(getWords(%obj.getObjectBox(),3,5),getWords(%obj.getObjectBox(),0,2));
|
||||
%realsize = VectorScale(VectorMultiply(%objsize,%obj.getScale()),0.49);
|
||||
%side = VirVec(%obj,%nrm);
|
||||
%oside = VectorCross("0 0 1",%side);
|
||||
|
||||
%forward = Realvec(%obj,VectorMultiply(%realsize,%side));
|
||||
%left = Realvec(%obj,VectorMultiply(%realsize,%oside));
|
||||
%len = Vectorlen(%left);
|
||||
%pos1 = VectorAdd(%obj.getWorldBoxCenter(),VectorAdd(%forward,%left));
|
||||
%pos2 = VectorAdd(%obj.getWorldBoxCenter(),VectorAdd(%forward,VectorScale(%left,-1)));
|
||||
singe(%pos1,%dir,%len,"fast");
|
||||
singe(%pos2,VectorScale(%dir,-1),%len,"fast");
|
||||
}
|
||||
}
|
||||
|
||||
function floordrill(%obj)
|
||||
{
|
||||
%objsize = VectorSub(getWords(%obj.getObjectBox(),3,5),getWords(%obj.getObjectBox(),0,2));
|
||||
%realsize = VectorMultiply(VectorMultiply(%objsize,%obj.getScale()),"0.5 0.5 0.5");
|
||||
%forward = VectorScale(realvec(%obj,"1 0 0"),GetWord(%realsize,0));
|
||||
%left = VectorScale(realvec(%obj,"0 1 0"),GetWord(%realsize,1));
|
||||
%up = VectorScale(realvec(%obj,"0 0 1"),GetWord(%realsize,2));
|
||||
%p1 = VectorAdd(VectorAdd(%forward,%left),%up);
|
||||
%p2 = VectorAdd(VectorAdd(VectorScale(%forward,-1),%left),%up);
|
||||
%p3 = VectorAdd(VectorAdd(%forward,VectorScale(%left,-1)),%up);
|
||||
%p4 = VectorAdd(VectorAdd(VectorScale(%forward,-1),VectorScale(%left,-1)),%up);
|
||||
schedule(0,%obj,"llink",VectorAdd(%p1,%obj.getWorldBoxCenter()));
|
||||
schedule(500,%obj,"llink",VectorAdd(%p2,%obj.getWorldBoxCenter()));
|
||||
schedule(1000,%obj,"llink",VectorAdd(%p4,%obj.getWorldBoxCenter()));
|
||||
schedule(1500,%obj,"llink",VectorAdd(%p3,%obj.getWorldBoxCenter()));
|
||||
}
|
||||
|
||||
function MSinge(%obj)
|
||||
{
|
||||
%objsize = VectorSub(getWords(%obj.getObjectBox(),3,5),getWords(%obj.getObjectBox(),0,2));
|
||||
%realsize = VectorMultiply(VectorMultiply(%objsize,%obj.getScale()),"0.5 0.5 0.5");
|
||||
%forward = VectorScale(realvec(%obj,"1 0 0"),GetWord(%realsize,0));
|
||||
%left = VectorScale(realvec(%obj,"0 1 0"),GetWord(%realsize,1));
|
||||
%up = VectorScale(realvec(%obj,"0 0 -1"),GetWord(%realsize,2));
|
||||
%p1 = VectorAdd(VectorAdd(%forward,%left),%up);
|
||||
%p2 = VectorAdd(VectorAdd(VectorScale(%forward,-1),%left),%up);
|
||||
%p3 = VectorAdd(VectorAdd(%forward,VectorScale(%left,-1)),%up);
|
||||
%p4 = VectorAdd(VectorAdd(VectorScale(%forward,-1),VectorScale(%left,-1)),%up);
|
||||
schedule(0,%obj,"mlink",VectorAdd(%p1,%obj.getWorldBoxCenter()));
|
||||
schedule(250,%obj,"mlink",VectorAdd(%p2,%obj.getWorldBoxCenter()));
|
||||
schedule(500,%obj,"mlink",VectorAdd(%p4,%obj.getWorldBoxCenter()));
|
||||
schedule(750,%obj,"mlink",VectorAdd(%p3,%obj.getWorldBoxCenter()));
|
||||
}
|
||||
|
||||
function MSinge2(%obj)
|
||||
{
|
||||
%objsize = VectorSub(getWords(%obj.getObjectBox(),3,5),getWords(%obj.getObjectBox(),0,2));
|
||||
%realsize = VectorMultiply(VectorMultiply(%objsize,%obj.getScale()),"0.5 0.5 0.5");
|
||||
%forward = VectorScale(realvec(%obj,"1 0 0"),GetWord(%realsize,0));
|
||||
%left = VectorScale(realvec(%obj,"0 1 0"),GetWord(%realsize,1));
|
||||
%up = VectorScale(realvec(%obj,"0 0 1"),GetWord(%realsize,2));
|
||||
%p1 = VectorAdd(VectorAdd(%forward,%left),%up);
|
||||
%p2 = VectorAdd(VectorAdd(VectorScale(%forward,-1),%left),%up);
|
||||
%p3 = VectorAdd(VectorAdd(%forward,VectorScale(%left,-1)),%up);
|
||||
%p4 = VectorAdd(VectorAdd(VectorScale(%forward,-1),VectorScale(%left,-1)),%up);
|
||||
schedule(0,%obj,"mlink",VectorAdd(%p1,%obj.getWorldBoxCenter()));
|
||||
schedule(250,%obj,"mlink",VectorAdd(%p2,%obj.getWorldBoxCenter()));
|
||||
schedule(500,%obj,"mlink",VectorAdd(%p4,%obj.getWorldBoxCenter()));
|
||||
schedule(750,%obj,"mlink",VectorAdd(%p3,%obj.getWorldBoxCenter()));
|
||||
}
|
||||
|
||||
|
||||
function floorlink(%obj,%pt,%nrm) {
|
||||
%fstat = aboveground(%obj.getworldboxcenter(),1,%obj);
|
||||
%stat = GetWord(%fstat,0);
|
||||
//warn(%stat);
|
||||
if(%stat $= "open" || %stat $= "roof" || %stat $= "shadow")
|
||||
linksinge(%obj,%pt,%nrm);
|
||||
else
|
||||
floordrill(%obj);
|
||||
}
|
||||
|
||||
function slink(%pt)
|
||||
{
|
||||
createLifeEmitter(%pt, ELFSparksEmitter, 200);
|
||||
Serverplay3D(SingeLinkSound,%pt);
|
||||
}
|
||||
|
||||
function mlink(%pt)
|
||||
{
|
||||
createLifeEmitter(%pt, ELFSparksEmitter, 200);
|
||||
Serverplay3D(SingeLinkSound,%pt);
|
||||
}
|
||||
|
||||
function llink(%pt)
|
||||
{
|
||||
createLifeEmitter(%pt, SmallLightDamageSmoke, 500);
|
||||
Serverplay3D(LargeLinkeSound,%pt);
|
||||
}
|
||||
|
||||
function deployEffect(%obj,%pt,%nrm,%type)
|
||||
{
|
||||
if ($Host::NoDeployEffects)
|
||||
return "";
|
||||
if (%type $= "pad")
|
||||
{
|
||||
edgesinge(%obj);
|
||||
}
|
||||
else if (%type $= "walk")
|
||||
{
|
||||
linksinge(%obj,%pt,%nrm);
|
||||
}
|
||||
else if (%type $= "spine")
|
||||
{
|
||||
slink(%pt);
|
||||
}
|
||||
else if (%type $= "spine1")
|
||||
{
|
||||
slink(%pt);
|
||||
%p2 = VectorAdd( pos( %obj ),realvec( %obj,VectorMultiply("0 0 0.5",%obj.getScale()) ) );
|
||||
schedule(500,%obj,"slink",%p2);
|
||||
}
|
||||
else if (%type $= "mspine")
|
||||
{
|
||||
msinge(%obj);
|
||||
}
|
||||
else if (%type $= "mspine1")
|
||||
{
|
||||
msinge(%obj);
|
||||
schedule(1000,%obj,"msinge2",%obj);
|
||||
}
|
||||
else if (%type $= "floor")
|
||||
{
|
||||
floorlink(%obj,%pt,%nrm);
|
||||
}
|
||||
}
|
||||
754
scripts/damageTypes.cs
Normal file
754
scripts/damageTypes.cs
Normal file
|
|
@ -0,0 +1,754 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// TYPES OF ALLOWED DAMAGE
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
$DamageType::Default = 0;
|
||||
$DamageType::Blaster = 1;
|
||||
$DamageType::Plasma = 2;
|
||||
$DamageType::Bullet = 3;
|
||||
$DamageType::Disc = 4;
|
||||
$DamageType::Grenade = 5;
|
||||
$DamageType::Laser = 6; // NOTE: This value is referenced directly in code. DO NOT CHANGE!
|
||||
$DamageType::ELF = 7;
|
||||
$DamageType::Mortar = 8;
|
||||
$DamageType::Missile = 9;
|
||||
$DamageType::ShockLance = 10;
|
||||
$DamageType::Mine = 11;
|
||||
$DamageType::Explosion = 12;
|
||||
$DamageType::Impact = 13; // Object to object collisions
|
||||
$DamageType::Ground = 14; // Object to ground collisions
|
||||
$DamageType::Turret = 15;
|
||||
|
||||
$DamageType::PlasmaTurret = 16;
|
||||
$DamageType::AATurret = 17;
|
||||
$DamageType::ElfTurret = 18;
|
||||
$DamageType::MortarTurret = 19;
|
||||
$DamageType::MissileTurret = 20;
|
||||
$DamageType::IndoorDepTurret = 21;
|
||||
$DamageType::OutdoorDepTurret = 22;
|
||||
$DamageType::SentryTurret = 23;
|
||||
|
||||
$DamageType::OutOfBounds = 24;
|
||||
$DamageType::Lava = 25;
|
||||
|
||||
$DamageType::ShrikeBlaster = 26;
|
||||
$DamageType::BellyTurret = 27;
|
||||
$DamageType::BomberBombs = 28;
|
||||
$DamageType::TankChaingun = 29;
|
||||
$DamageType::TankMortar = 30;
|
||||
$DamageType::SatchelCharge = 31;
|
||||
$DamageType::MPBMissile = 32;
|
||||
$DamageType::Lightning = 33;
|
||||
$DamageType::VehicleSpawn = 34;
|
||||
$DamageType::ForceFieldPowerup = 35;
|
||||
$DamageType::Crash = 36;
|
||||
$DamageType::Debris = 37;
|
||||
|
||||
$DamageType::Meteor = 50;
|
||||
$DamageType::Cursing = 51;
|
||||
$DamageType::Idiocy = 52;
|
||||
$DamageType::SuperChaingun = 53;
|
||||
$DamageType::KillerFog = 54;
|
||||
|
||||
// DMM -- added so MPBs that blow up under water get a message
|
||||
$DamageType::Water = 97;
|
||||
|
||||
//Tinman - used in Hunters for cheap bastards ;)
|
||||
$DamageType::NexusCamping = 98;
|
||||
|
||||
// MES -- added so CTRL-K can get a distinctive message
|
||||
$DamageType::Suicide = 99;
|
||||
|
||||
// Etc, etc.
|
||||
|
||||
$DamageTypeText[0] = 'default';
|
||||
$DamageTypeText[1] = 'blaster';
|
||||
$DamageTypeText[2] = 'plasma';
|
||||
$DamageTypeText[3] = 'chaingun';
|
||||
$DamageTypeText[4] = 'disc';
|
||||
$DamageTypeText[5] = 'grenade';
|
||||
$DamageTypeText[6] = 'laser';
|
||||
$DamageTypeText[7] = 'ELF';
|
||||
$DamageTypeText[8] = 'mortar';
|
||||
$DamageTypeText[9] = 'missile';
|
||||
$DamageTypeText[10] = 'shocklance';
|
||||
$DamageTypeText[11] = 'mine';
|
||||
$DamageTypeText[12] = 'explosion';
|
||||
$DamageTypeText[13] = 'impact';
|
||||
$DamageTypeText[14] = 'ground';
|
||||
$DamageTypeText[15] = 'turret';
|
||||
$DamageTypeText[16] = 'plasma turret';
|
||||
$DamageTypeText[17] = 'AA turret';
|
||||
$DamageTypeText[18] = 'ELF turret';
|
||||
$DamageTypeText[19] = 'mortar turret';
|
||||
$DamageTypeText[20] = 'missile turret';
|
||||
$DamageTypeText[21] = 'clamp turret';
|
||||
$DamageTypeText[22] = 'spike turret';
|
||||
$DamageTypeText[23] = 'sentry turret';
|
||||
$DamageTypeText[24] = 'out of bounds';
|
||||
$DamageTypeText[25] = 'lava';
|
||||
$DamageTypeText[26] = 'shrike blaster';
|
||||
$DamageTypeText[27] = 'belly turret';
|
||||
$DamageTypeText[28] = 'bomber bomb';
|
||||
$DamageTypeText[29] = 'tank chaingun';
|
||||
$DamageTypeText[30] = 'tank mortar';
|
||||
$DamageTypeText[31] = 'satchel charge';
|
||||
$DamageTypeText[32] = 'MPB missile';
|
||||
$DamageTypeText[33] = 'lighting';
|
||||
$DamageTypeText[35] = 'ForceField';
|
||||
$DamageTypeText[36] = 'Crash';
|
||||
|
||||
$DamageTypeText[50] = 'Meteor';
|
||||
$DamageTypeText[51] = 'Cursing';
|
||||
$DamageTypeText[52] = 'Idiocy';
|
||||
$DamageTypeText[53] = 'SuperChaingun';
|
||||
$DamageTypeText[54] = 'KillerFog';
|
||||
|
||||
$DamageTypeText[98] = 'nexus camping';
|
||||
$DamageTypeText[99] = 'suicide';
|
||||
|
||||
|
||||
// ##### PLEASE DO NOT REORDER THE DAMAGE PROFILE TABLES BELOW #####
|
||||
// (They are set up in the same order as the "Weapons Matrix.xls" sheet for ease of reference when balancing)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// VEHICLE DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//**** SHRIKE SCOUT FIGHTER ****
|
||||
datablock SimDataBlock(ShrikeDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ElfTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 4.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.5;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.1;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
shieldDamageScale[$DamageType::Debris] = 1.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ElfTurret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.5;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.5;
|
||||
damageScale[$DamageType::SentryTurret] = 1.5;
|
||||
damageScale[$DamageType::Disc] = 1.25;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 2.0;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.1;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
damageScale[$DamageType::Debris] = 0.75;
|
||||
};
|
||||
|
||||
//**** THUNDERSWORD BOMBER ****
|
||||
datablock SimDataBlock(BomberDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.8;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::SentryTurret] = 1.25;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.5;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.8;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** HAVOC TRANSPORT ****
|
||||
datablock SimDataBlock(HavocDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 1.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.5;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 2.25;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.5;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 3.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.5;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.5;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.25;
|
||||
damageScale[$DamageType::SentryTurret] = 1.25;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 0.75;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.5;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.5;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.5;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 2.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** WILDCAT GRAV CYCLE ****
|
||||
datablock SimDataBlock(WildcatDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 2.0;
|
||||
shieldDamageScale[$DamageType::Bullet] = 2.5;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 1.0;
|
||||
shieldDamageScale[$DamageType::Laser] = 4.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 6.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 2.5;
|
||||
shieldDamageScale[$DamageType::Disc] = 2.5;
|
||||
shieldDamageScale[$DamageType::Grenade] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mine] = 4.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 4.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 2.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 3.0;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 2.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 4.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.25;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.5;
|
||||
damageScale[$DamageType::Bullet] = 1.2;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 2.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 4.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.5;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.25;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 4.0;
|
||||
damageScale[$DamageType::Missile] = 1.2;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 1.5;
|
||||
damageScale[$DamageType::BomberBombs] = 2.0;
|
||||
damageScale[$DamageType::TankChaingun] = 2.0;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.2;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.2;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.25;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//**** BEOWULF TANK ****
|
||||
datablock SimDataBlock(TankDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.6;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::AATurret] = 0.8;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 0.8;
|
||||
shieldDamageScale[$DamageType::Grenade] = 0.8;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.25;
|
||||
shieldDamageScale[$DamageType::Missile] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 1.7;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 1.8;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.75;
|
||||
shieldDamageScale[$DamageType::Ground] = 0.75;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] =1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 2.25;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.4;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 0.75;
|
||||
damageScale[$DamageType::TankMortar] = 1.6;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.75;
|
||||
damageScale[$DamageType::Ground] = 0.75;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//**** JERICHO MPB ****
|
||||
datablock SimDataBlock(MPBDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.6;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.75;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 1.75;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::AATurret] = 0.8;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 0.8;
|
||||
shieldDamageScale[$DamageType::Grenade] = 0.8;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.25;
|
||||
shieldDamageScale[$DamageType::Missile] = 2.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 0.8;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 1.4;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 0.5;
|
||||
shieldDamageScale[$DamageType::Ground] = 0.5;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 10.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.75;
|
||||
damageScale[$DamageType::Bullet] = 0.75;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 0.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 2.25;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 0.5;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 0.75;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 2.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.5;
|
||||
damageScale[$DamageType::Ground] = 0.5;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 10.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// TURRET DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(TurretDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.8;
|
||||
shieldDamageScale[$DamageType::Bullet] = 0.8;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 0.5;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 3.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::AATurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.5;
|
||||
shieldDamageScale[$DamageType::Mine] = 3.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.0;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 4.5;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.0;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 0.8;
|
||||
damageScale[$DamageType::Bullet] = 0.9;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 0.50;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.0;
|
||||
damageScale[$DamageType::BellyTurret] = 0.6;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.1;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 1.5;
|
||||
damageScale[$DamageType::Missile] = 1.25;
|
||||
damageScale[$DamageType::Mortar] = 1.25;
|
||||
damageScale[$DamageType::Plasma] = 0.75;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.25;
|
||||
damageScale[$DamageType::TankMortar] = 1.25;
|
||||
damageScale[$DamageType::MissileTurret] = 1.25;
|
||||
damageScale[$DamageType::MortarTurret] = 1.25;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.25;
|
||||
damageScale[$DamageType::SatchelCharge] = 1.5;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.0;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// STATIC SHAPE DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(StaticShapeDamageProfile)
|
||||
{
|
||||
shieldDamageScale[$DamageType::Blaster] = 0.8;
|
||||
shieldDamageScale[$DamageType::Bullet] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELF] = 1.0;
|
||||
shieldDamageScale[$DamageType::ELFturret] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShockLance] = 1.0;
|
||||
shieldDamageScale[$DamageType::Laser] = 1.0;
|
||||
shieldDamageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
shieldDamageScale[$DamageType::BellyTurret] = 1.5;
|
||||
shieldDamageScale[$DamageType::AATurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Turret] = 1.0;
|
||||
shieldDamageScale[$DamageType::SentryTurret] = 1.0;
|
||||
shieldDamageScale[$DamageType::Disc] = 1.0;
|
||||
shieldDamageScale[$DamageType::Grenade] = 1.2;
|
||||
shieldDamageScale[$DamageType::Mine] = 2.0;
|
||||
shieldDamageScale[$DamageType::Missile] = 3.0;
|
||||
shieldDamageScale[$DamageType::Mortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::Plasma] = 1.5;
|
||||
shieldDamageScale[$DamageType::BomberBombs] = 2.0;
|
||||
shieldDamageScale[$DamageType::TankChaingun] = 1.5;
|
||||
shieldDamageScale[$DamageType::TankMortar] = 3.0;
|
||||
shieldDamageScale[$DamageType::MissileTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::MortarTurret] = 3.0;
|
||||
shieldDamageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
shieldDamageScale[$DamageType::SatchelCharge] = 6.0;
|
||||
shieldDamageScale[$DamageType::Default] = 1.0;
|
||||
shieldDamageScale[$DamageType::Impact] = 1.25;
|
||||
shieldDamageScale[$DamageType::Ground] = 1.0;
|
||||
shieldDamageScale[$DamageType::Explosion] = 2.0;
|
||||
shieldDamageScale[$DamageType::Lightning] = 5.0;
|
||||
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.0;
|
||||
damageScale[$DamageType::ELFturret] = 1.0;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.0;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 2.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.2;
|
||||
damageScale[$DamageType::AATurret] = 1.0;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.15;
|
||||
damageScale[$DamageType::Grenade] = 1.2;
|
||||
damageScale[$DamageType::Mine] = 2.0;
|
||||
damageScale[$DamageType::Missile] = 2.0;
|
||||
damageScale[$DamageType::Mortar] = 2.0;
|
||||
damageScale[$DamageType::Plasma] = 1.25;
|
||||
damageScale[$DamageType::BomberBombs] = 1.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.0;
|
||||
damageScale[$DamageType::TankMortar] = 2.0;
|
||||
damageScale[$DamageType::MissileTurret] = 2.0;
|
||||
damageScale[$DamageType::MortarTurret] = 2.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 2.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 4.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.25;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 5.0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// PLAYER DAMAGE PROFILES
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock SimDataBlock(LightPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 1.3;
|
||||
damageScale[$DamageType::Bullet] = 1.2;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ELFturret] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.12;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.10;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 0.7;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.3;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.3;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 1.0;
|
||||
damageScale[$DamageType::Grenade] = 1.2;
|
||||
damageScale[$DamageType::Mine] = 1.0;
|
||||
damageScale[$DamageType::Missile] = 1.0;
|
||||
damageScale[$DamageType::Mortar] = 1.3;
|
||||
damageScale[$DamageType::Plasma] = 1.0;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.7;
|
||||
damageScale[$DamageType::TankMortar] = 1.0;
|
||||
damageScale[$DamageType::MissileTurret] = 1.0;
|
||||
damageScale[$DamageType::MortarTurret] = 1.3;
|
||||
damageScale[$DamageType::PlasmaTurret] = 1.0;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.2;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 1.0;
|
||||
damageScale[$DamageType::Lightning] = 1.0;
|
||||
};
|
||||
|
||||
datablock SimDataBlock(MediumPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 1.0;
|
||||
damageScale[$DamageType::Bullet] = 1.0;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ELFturret] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 1.1;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 1.0;
|
||||
damageScale[$DamageType::BellyTurret] = 1.0;
|
||||
damageScale[$DamageType::AATurret] = 0.7;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 1.0;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 0.8;
|
||||
damageScale[$DamageType::Grenade] = 1.0;
|
||||
damageScale[$DamageType::Mine] = 0.9;
|
||||
damageScale[$DamageType::Missile] = 0.8;
|
||||
damageScale[$DamageType::Mortar] = 1.0;
|
||||
damageScale[$DamageType::Plasma] = 0.65;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.5;
|
||||
damageScale[$DamageType::TankMortar] = 0.85;
|
||||
damageScale[$DamageType::MissileTurret] = 0.8;
|
||||
damageScale[$DamageType::MortarTurret] = 1.0;
|
||||
damageScale[$DamageType::PlasmaTurret] = 0.65;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 1.0;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 0.8;
|
||||
damageScale[$DamageType::Lightning] = 1.2;
|
||||
};
|
||||
|
||||
datablock SimDataBlock(HeavyPlayerDamageProfile)
|
||||
{
|
||||
damageScale[$DamageType::Blaster] = 0.7;
|
||||
damageScale[$DamageType::Bullet] = 0.6;
|
||||
damageScale[$DamageType::ELF] = 0.75;
|
||||
damageScale[$DamageType::ELFturret] = 0.75;
|
||||
damageScale[$DamageType::ShockLance] = 1.0;
|
||||
damageScale[$DamageType::Laser] = 0.67;
|
||||
damageScale[$DamageType::ShrikeBlaster] = 0.8;
|
||||
damageScale[$DamageType::BellyTurret] = 0.8;
|
||||
damageScale[$DamageType::AATurret] = 0.6;
|
||||
damageScale[$DamageType::IndoorDepTurret] = 0.7;
|
||||
damageScale[$DamageType::OutdoorDepTurret] = 0.7;
|
||||
damageScale[$DamageType::SentryTurret] = 1.0;
|
||||
damageScale[$DamageType::Disc] = 0.6;
|
||||
damageScale[$DamageType::Grenade] = 0.8;
|
||||
damageScale[$DamageType::Mine] = 0.8;
|
||||
damageScale[$DamageType::Missile] = 0.6;
|
||||
damageScale[$DamageType::Mortar] = 0.7;
|
||||
damageScale[$DamageType::Plasma] = 0.4;
|
||||
damageScale[$DamageType::BomberBombs] = 3.0;
|
||||
damageScale[$DamageType::TankChaingun] = 1.3;
|
||||
damageScale[$DamageType::TankMortar] = 0.7;
|
||||
damageScale[$DamageType::MissileTurret] = 0.6;
|
||||
damageScale[$DamageType::MortarTurret] = 0.6;
|
||||
damageScale[$DamageType::PlasmaTurret] = 0.4;
|
||||
damageScale[$DamageType::SatchelCharge] = 3.0;
|
||||
damageScale[$DamageType::Default] = 1.0;
|
||||
damageScale[$DamageType::Impact] = 0.8;
|
||||
damageScale[$DamageType::Ground] = 1.0;
|
||||
damageScale[$DamageType::Explosion] = 0.6;
|
||||
damageScale[$DamageType::Lightning] = 1.4;
|
||||
};
|
||||
420
scripts/deathMessages.cs
Normal file
420
scripts/deathMessages.cs
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// %1 = Victim's name //
|
||||
// %2 = Victim's gender (value will be either "him" or "her") //
|
||||
// %3 = Victim's possessive gender (value will be either "his" or "her") //
|
||||
// %4 = Killer's name //
|
||||
// %5 = Killer's gender (value will be either "him" or "her") //
|
||||
// %6 = Killer's possessive gender (value will be either "his" or "her") //
|
||||
// %7 = implement that killed the victim (value is the object number of the bullet, disc, etc) //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$DeathMessageCampingCount = 1;
|
||||
$DeathMessageCamping[0] = '\c0%1 was killed for camping near the Nexus.';
|
||||
|
||||
//Out of Bounds deaths
|
||||
$DeathMessageOOBCount = 1;
|
||||
$DeathMessageOOB[0] = '\c0%1 was killed for loitering outside the mission area.';
|
||||
|
||||
$DeathMessageLavaCount = 4;
|
||||
$DeathMessageLava[0] = '\c0%1\'s last thought before falling into the lava : \'Oops\'.';
|
||||
$DeathMessageLava[1] = '\c0%1 makes the supreme sacrifice to the lava gods.';
|
||||
$DeathMessageLava[2] = '\c0%1 looks surprised by the lava - but only briefly.';
|
||||
$DeathMessageLava[3] = '\c0%1 wimps out by jumping into the lava and trying to make it look like an accident.';
|
||||
|
||||
$DeathMessageLightningCount = 3;
|
||||
$DeathMessageLightning[0] = '\c0%1 was killed by lightning!';
|
||||
$DeathMessageLightning[1] = '\c0%1 caught a lightning bolt!';
|
||||
$DeathMessageLightning[2] = '\c0%1 stuck %3 finger in Mother Nature\'s light socket.';
|
||||
|
||||
//these used when a player presses ctrl-k
|
||||
$DeathMessageSuicideCount = 5;
|
||||
$DeathMessageSuicide[0] = '\c0%1 blows %3 own head off!';
|
||||
$DeathMessageSuicide[1] = '\c0%1 ends it all. Cue violin music.';
|
||||
$DeathMessageSuicide[2] = '\c0%1 kills %2self.';
|
||||
$DeathMessageSuicide[3] = '\c0%1 goes for the quick and dirty respawn.';
|
||||
$DeathMessageSuicide[4] = '\c0%1 self-destructs in a fit of ennui.';
|
||||
|
||||
$DeathMessageVehPadCount = 1;
|
||||
$DeathMessageVehPad[0] = '\c0%1 got caught in a vehicle\'s spawn field.';
|
||||
|
||||
$DeathMessageFFPowerupCount = 3;
|
||||
$DeathMessageFFPowerup[0] = '\c0%1 got caught up in a forcefield during power up.';
|
||||
$DeathMessageFFPowerup[1] = '\c0%1 finds %2self in a forcefield powering up.';
|
||||
$DeathMessageFFPowerup[2] = '\c0%1 gets %2self fried in a forcefield.';
|
||||
|
||||
$DeathMessageRogueMineCount = 1;
|
||||
$DeathMessageRogueMine[$DamageType::Mine, 0] = '\c0%1 is all mine.';
|
||||
|
||||
//these used when a player kills himself (other than by using ctrl - k)
|
||||
$DeathMessageSelfKillCount = 5;
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 0] = '\c0%1 kills %2self with a blaster.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 1] = '\c0%1 makes a note to watch out for blaster ricochets.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 2] = '\c0%1\'s blaster kills its hapless owner.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 3] = '\c0%1 deftly guns %2self down with %3 own blaster.';
|
||||
$DeathMessageSelfKill[$DamageType::Blaster, 4] = '\c0%1 has a fatal encounter with %3 own blaster.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 0] = '\c0%1 kills %2self with plasma.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 1] = '\c0%1 turns %2self into plasma-charred briquettes.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 2] = '\c0%1 swallows a white-hot mouthful of %3 own plasma.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 3] = '\c0%1 immolates %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Plasma, 4] = '\c0%1 experiences the joy of cooking %2self.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 0] = '\c0%1 kills %2self with a disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 1] = '\c0%1 catches %3 own spinfusor disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 2] = '\c0%1 heroically falls on %3 own disc.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 3] = '\c0%1 helpfully jumps into %3 own disc\'s explosion.';
|
||||
$DeathMessageSelfKill[$DamageType::Disc, 4] = '\c0%1 plays Russian roulette with %3 spinfusor.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 0] = '\c0%1 destroys %2self with a grenade!'; //applies to hand grenades *and* grenade launcher grenades
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 1] = '\c0%1 took a bad bounce from %3 own grenade!';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 2] = '\c0%1 pulled the pin a shade early.';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 3] = '\c0%1\'s own grenade turns on %2.';
|
||||
$DeathMessageSelfKill[$DamageType::Grenade, 4] = '\c0%1 blows %2self up real good.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 0] = '\c0%1 kills %2self with a mortar!';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 1] = '\c0%1 hugs %3 own big green boomie.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 2] = '\c0%1 mortars %2self all over the map.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 3] = '\c0%1 experiences %3 mortar\'s payload up close.';
|
||||
$DeathMessageSelfKill[$DamageType::Mortar, 4] = '\c0%1 suffered the wrath of %3 own mortar.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 0] = '\c0%1 kills %2self with a missile!';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 1] = '\c0%1 runs a missile up %3 own tailpipe.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 2] = '\c0%1 tests the missile\'s shaped charge on %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 3] = '\c0%1 achieved missile lock on %2self.';
|
||||
$DeathMessageSelfKill[$DamageType::Missile, 4] = '\c0%1 gracefully smoked %2self with a missile!';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 0] = '\c0%1 kills %2self with a mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 1] = '\c0%1\'s mine violently reminds %2 of its existence.';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 2] = '\c0%1 plants a decisive foot on %3 own mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 3] = '\c0%1 fatally trips on %3 own mine!';
|
||||
$DeathMessageSelfKill[$DamageType::Mine, 4] = '\c0%1 makes a note not to run over %3 own mines.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 0] = '\c0%1 goes out with a bang!'; //applies to most explosion types
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 1] = '\c0%1 fall down...go boom.';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 2] = '\c0%1 explodes in that fatal kind of way.';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 3] = '\c0%1 experiences explosive decompression!';
|
||||
$DeathMessageSelfKill[$DamageType::SatchelCharge, 4] = '\c0%1 splashes all over the map.';
|
||||
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 0] = '\c0%1 lands too hard.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 1] = '\c0%1 finds gravity unforgiving.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 2] = '\c0%1 craters on impact.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 3] = '\c0%1 pancakes upon landing.';
|
||||
$DeathMessageSelfKill[$DamageType::Ground, 4] = '\c0%1 loses a game of chicken with the ground.';
|
||||
|
||||
|
||||
//used when a player is killed by a teammate
|
||||
$DeathMessageTeamKillCount = 1;
|
||||
$DeathMessageTeamKill[$DamageType::Blaster, 0] = '\c0%4 TEAMKILLED %1 with a blaster!';
|
||||
$DeathMessageTeamKill[$DamageType::Plasma, 0] = '\c0%4 TEAMKILLED %1 with a plasma rifle!';
|
||||
$DeathMessageTeamKill[$DamageType::Bullet, 0] = '\c0%4 TEAMKILLED %1 with a chaingun!';
|
||||
$DeathMessageTeamKill[$DamageType::Disc, 0] = '\c0%4 TEAMKILLED %1 with a spinfusor!';
|
||||
$DeathMessageTeamKill[$DamageType::Grenade, 0] = '\c0%4 TEAMKILLED %1 with a grenade!';
|
||||
$DeathMessageTeamKill[$DamageType::Laser, 0] = '\c0%4 TEAMKILLED %1 with a laser rifle!';
|
||||
$DeathMessageTeamKill[$DamageType::Elf, 0] = '\c0%4 TEAMKILLED %1 with an ELF projector!';
|
||||
$DeathMessageTeamKill[$DamageType::Mortar, 0] = '\c0%4 TEAMKILLED %1 with a mortar!';
|
||||
$DeathMessageTeamKill[$DamageType::Missile, 0] = '\c0%4 TEAMKILLED %1 with a missile!';
|
||||
$DeathMessageTeamKill[$DamageType::Shocklance, 0] = '\c0%4 TEAMKILLED %1 with a shocklance!';
|
||||
$DeathMessageTeamKill[$DamageType::Mine, 0] = '\c0%4 TEAMKILLED %1 with a mine!';
|
||||
$DeathMessageTeamKill[$DamageType::SatchelCharge, 0] = '\c0%4 blew up TEAMMATE %1!';
|
||||
$DeathMessageTeamKill[$DamageType::Impact, 0] = '\c0%4 runs down TEAMMATE %1!';
|
||||
$DeathMessageTeamKill[$DamageType::SuperChaingun, 0] = '\c0%4 TEAMKILLED %1 with a super chaingun!';
|
||||
|
||||
|
||||
|
||||
//these used when a player is killed by an enemy
|
||||
$DeathMessageCount = 5;
|
||||
$DeathMessage[$DamageType::Blaster, 0] = '\c0%4 kills %1 with a blaster.';
|
||||
$DeathMessage[$DamageType::Blaster, 1] = '\c0%4 pings %1 to death.';
|
||||
$DeathMessage[$DamageType::Blaster, 2] = '\c0%1 gets a pointer in blaster use from %4.';
|
||||
$DeathMessage[$DamageType::Blaster, 3] = '\c0%4 fatally embarrasses %1 with %6 pea shooter.';
|
||||
$DeathMessage[$DamageType::Blaster, 4] = '\c0%4 unleashes a terminal blaster barrage into %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Plasma, 0] = '\c0%4 roasts %1 with the plasma rifle.';
|
||||
$DeathMessage[$DamageType::Plasma, 1] = '\c0%4 gooses %1 with an extra-friendly burst of plasma.';
|
||||
$DeathMessage[$DamageType::Plasma, 2] = '\c0%4 entices %1 to try a faceful of plasma.';
|
||||
$DeathMessage[$DamageType::Plasma, 3] = '\c0%4 introduces %1 to the plasma immolation dance.';
|
||||
$DeathMessage[$DamageType::Plasma, 4] = '\c0%4 slaps The Hot Kiss of Death on %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Bullet, 0] = '\c0%4 rips %1 up with the chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 1] = '\c0%4 happily chews %1 into pieces with %6 chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 2] = '\c0%4 administers a dose of Vitamin Lead to %1.';
|
||||
$DeathMessage[$DamageType::Bullet, 3] = '\c0%1 suffers a serious hosing from %4\'s chaingun.';
|
||||
$DeathMessage[$DamageType::Bullet, 4] = '\c0%4 bestows the blessings of %6 chaingun on %1.';
|
||||
|
||||
$DeathMessage[$DamageType::Disc, 0] = '\c0%4 demolishes %1 with the spinfusor.';
|
||||
$DeathMessage[$DamageType::Disc, 1] = '\c0%4 serves %1 a blue plate special.';
|
||||
$DeathMessage[$DamageType::Disc, 2] = '\c0%4 shares a little blue friend with %1.';
|
||||
$DeathMessage[$DamageType::Disc, 3] = '\c0%4 puts a little spin into %1.';
|
||||
$DeathMessage[$DamageType::Disc, 4] = '\c0%1 becomes one of %4\'s greatest hits.';
|
||||
|
||||
$DeathMessage[$DamageType::Grenade, 0] = '\c0%4 eliminates %1 with a grenade.'; //applies to hand grenades *and* grenade launcher grenades
|
||||
$DeathMessage[$DamageType::Grenade, 1] = '\c0%4 blows up %1 real good!';
|
||||
$DeathMessage[$DamageType::Grenade, 2] = '\c0%1 gets annihilated by %4\'s grenade.';
|
||||
$DeathMessage[$DamageType::Grenade, 3] = '\c0%1 receives a kaboom lesson from %4.';
|
||||
$DeathMessage[$DamageType::Grenade, 4] = '\c0%4 turns %1 into grenade salad.';
|
||||
|
||||
$DeathMessage[$DamageType::Laser, 0] = '\c0%1 becomes %4\'s latest pincushion.';
|
||||
$DeathMessage[$DamageType::Laser, 1] = '\c0%4 picks off %1 with %6 laser rifle.';
|
||||
$DeathMessage[$DamageType::Laser, 2] = '\c0%4 uses %1 as the targeting dummy in a sniping demonstration.';
|
||||
$DeathMessage[$DamageType::Laser, 3] = '\c0%4 pokes a shiny new hole in %1 with %6 laser rifle.';
|
||||
$DeathMessage[$DamageType::Laser, 4] = '\c0%4 caresses %1 with a couple hundred megajoules of laser.';
|
||||
|
||||
$DeathMessage[$DamageType::Elf, 0] = '\c0%4 fries %1 with the ELF projector.';
|
||||
$DeathMessage[$DamageType::Elf, 1] = '\c0%4 bug zaps %1 with %6 ELF.';
|
||||
$DeathMessage[$DamageType::Elf, 2] = '\c0%1 learns the shocking truth about %4\'s ELF skills.';
|
||||
$DeathMessage[$DamageType::Elf, 3] = '\c0%4 electrocutes %1 without a sponge.';
|
||||
$DeathMessage[$DamageType::Elf, 4] = '\c0%4\'s ELF projector leaves %1 a crispy critter.';
|
||||
|
||||
$DeathMessage[$DamageType::Mortar, 0] = '\c0%4 obliterates %1 with the mortar.';
|
||||
$DeathMessage[$DamageType::Mortar, 1] = '\c0%4 drops a mortar round right in %1\'s lap.';
|
||||
$DeathMessage[$DamageType::Mortar, 2] = '\c0%4 delivers a mortar payload straight to %1.';
|
||||
$DeathMessage[$DamageType::Mortar, 3] = '\c0%4 offers a little "heavy love" to %1.';
|
||||
$DeathMessage[$DamageType::Mortar, 4] = '\c0%1 stumbles into %4\'s mortar reticle.';
|
||||
|
||||
$DeathMessage[$DamageType::Missile, 0] = '\c0%4 intercepts %1 with a missile.';
|
||||
$DeathMessage[$DamageType::Missile, 1] = '\c0%4 watches %6 missile touch %1 and go boom.';
|
||||
$DeathMessage[$DamageType::Missile, 2] = '\c0%4 got sweet tone on %1.';
|
||||
$DeathMessage[$DamageType::Missile, 3] = '\c0By now, %1 has realized %4\'s missile killed %2.';
|
||||
$DeathMessage[$DamageType::Missile, 4] = '\c0%4\'s missile rains little pieces of %1 all over the ground.';
|
||||
|
||||
$DeathMessage[$DamageType::Shocklance, 0] = '\c0%4 reaps a harvest of %1 with the shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 1] = '\c0%4 feeds %1 the business end of %6 shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 2] = '\c0%4 stops %1 dead with the shocklance.';
|
||||
$DeathMessage[$DamageType::Shocklance, 3] = '\c0%4 eliminates %1 in close combat.';
|
||||
$DeathMessage[$DamageType::Shocklance, 4] = '\c0%4 ruins %1\'s day with one zap of a shocklance.';
|
||||
|
||||
$DeathMessage[$DamageType::Mine, 0] = '\c0%4 kills %1 with a mine.';
|
||||
$DeathMessage[$DamageType::Mine, 1] = '\c0%1 doesn\'t see %4\'s mine in time.';
|
||||
$DeathMessage[$DamageType::Mine, 2] = '\c0%4 gets a sapper kill on %1.';
|
||||
$DeathMessage[$DamageType::Mine, 3] = '\c0%1 puts his foot on %4\'s mine.';
|
||||
$DeathMessage[$DamageType::Mine, 4] = '\c0One small step for %1, one giant mine kill for %4.';
|
||||
|
||||
$DeathMessage[$DamageType::SatchelCharge, 0] = '\c0%4 buys %1 a ticket to the moon.'; //satchel charge only
|
||||
$DeathMessage[$DamageType::SatchelCharge, 1] = '\c0%4 blows %1 into low orbit.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 2] = '\c0%4 makes %1 a hugely explosive offer.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 3] = '\c0%4 turns %1 into a cloud of satchel-vaporized armor.';
|
||||
$DeathMessage[$DamageType::SatchelCharge, 4] = '\c0%4\'s satchel charge leaves %1 nothin\' but smokin\' boots.';
|
||||
|
||||
$DeathMessageHeadshotCount = 3;
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 0] = '\c0%4 drills right through %1\'s braincase with %6 laser.';
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 1] = '\c0%4 pops %1\'s head like a cheap balloon.';
|
||||
$DeathMessageHeadshot[$DamageType::Laser, 2] = '\c0%1 loses %3 head over %4\'s laser skill.';
|
||||
|
||||
|
||||
//These used when a player is run over by a vehicle
|
||||
$DeathMessageVehicleCount = 5;
|
||||
$DeathMessageVehicle[0] = '\c0%4 runs down %1.';
|
||||
$DeathMessageVehicle[1] = '\c0%1 acquires that run-down feeling from %4.';
|
||||
$DeathMessageVehicle[2] = '\c0%4 transforms %1 into tribal roadkill.';
|
||||
$DeathMessageVehicle[3] = '\c0%1 makes a painfully close examination of %4\'s front bumper.';
|
||||
$DeathMessageVehicle[4] = '\c0%1\'s messy death leaves a mark on %4\'s vehicle finish.';
|
||||
|
||||
$DeathMessageVehicleCrashCount = 5;
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 0 ] = '\c0%1 fails to eject in time.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 1 ] = '\c0%1 becomes one with his vehicle dashboard.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 2 ] = '\c0%1 drives under the influence of death.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 3 ] = '\c0%1 makes a perfect three hundred point landing.';
|
||||
$DeathMessageVehicleCrash[ $DamageType::Crash, 4 ] = '\c0%1 heroically pilots his vehicle into something really, really hard.';
|
||||
|
||||
$DeathMessageVehicleFriendlyCount = 3;
|
||||
$DeathMessageVehicleFriendly[0] = '\c0%1 gets in the way of a friendly vehicle.';
|
||||
$DeathMessageVehicleFriendly[1] = '\c0Sadly, a friendly vehicle turns %1 into roadkill.';
|
||||
$DeathMessageVehicleFriendly[2] = '\c0%1 becomes an unsightly ornament on a team vehicle\'s hood.';
|
||||
|
||||
$DeathMessageVehicleUnmannedCount = 3;
|
||||
$DeathMessageVehicleUnmanned[0] = '\c0%1 gets in the way of a runaway vehicle.';
|
||||
$DeathMessageVehicleUnmanned[1] = '\c0An unmanned vehicle kills the pathetic %1.';
|
||||
$DeathMessageVehicleUnmanned[2] = '\c0%1 is struck down by an empty vehicle.';
|
||||
|
||||
//These used when a player is killed by a nearby equipment explosion
|
||||
$DeathMessageExplosionCount = 3;
|
||||
$DeathMessageExplosion[0] = '\c0%1 was killed by exploding equipment!';
|
||||
$DeathMessageExplosion[1] = '\c0%1 stood a little too close to the action!';
|
||||
$DeathMessageExplosion[2] = '\c0%1 learns how to be collateral damage.';
|
||||
|
||||
//These used when an automated turret kills an enemy player
|
||||
$DeathMessageTurretKillCount = 3;
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%1 is killed by a plasma turret.';
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%1\'s body now marks the location of a plasma turret.';
|
||||
$DeathMessageTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%1 is fried by a plasma turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 0] = '\c0%1 is killed by an AA turret.';
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 1] = '\c0%1 is shot down by an AA turret.';
|
||||
$DeathMessageTurretKill[$DamageType::AATurret, 2] = '\c0%1 takes fatal flak from an AA turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 is killed by an ELF turret.';
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 is zapped by an ELF turret.';
|
||||
$DeathMessageTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 is short-circuited by an ELF turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is killed by a mortar turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 enjoys a mortar turret\'s attention.';
|
||||
$DeathMessageTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is blown to kibble by a mortar turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 0] = '\c0%1 is killed by a missile turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 1] = '\c0%1 is shot down by a missile turret.';
|
||||
$DeathMessageTurretKill[$DamageType::MissileTurret, 2] = '\c0%1 is blown away by a missile turret.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is killed by a clamp turret.';
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 gets burned by a clamp turret.';
|
||||
$DeathMessageTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0A clamp turret eliminates %1.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0A spike turret neatly drills %1.';
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 gets taken out by a spike turret.';
|
||||
$DeathMessageTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 dies under a spike turret\'s love.';
|
||||
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 0] = '\c0%1 didn\'t see that Sentry turret, but it saw %2...';
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 1] = '\c0%1 needs to watch for Sentry turrets.';
|
||||
$DeathMessageTurretKill[$DamageType::SentryTurret, 2] = '\c0%1 now understands how Sentry turrets work.';
|
||||
|
||||
|
||||
//used when a player is killed by a teammate controlling a turret
|
||||
$DeathMessageCTurretTeamKillCount = 1;
|
||||
$DeathMessageCTurretTeamKill[$DamageType::PlasmaTurret, 0] = '\c0%4 TEAMKILLED %1 with a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::AATurret, 0] = '\c0%4 TEAMKILLED %1 with an AA turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::ELFTurret, 0] = '\c0%4 TEAMKILLED %1 with an ELF turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MortarTurret, 0] = '\c0%4 TEAMKILLED %1 with a mortar turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MissileTurret, 0] = '\c0%4 TEAMKILLED %1 with a missile turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::IndoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a clamp turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::OutdoorDepTurret, 0] = '\c0%4 TEAMKILLED %1 with a spike turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::SentryTurret, 0] = '\c0%4 TEAMKILLED %1 with a sentry turret!';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::BomberBombs, 0] = '\c0%4 TEAMKILLED %1 in a bombastic explosion of raining death.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::BellyTurret, 0] = '\c0%4 TEAMKILLED %1 by annihilating him from a belly turret.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::TankChainGun, 0] = '\c0%4 TEAMKILLED %1 with his tank\'s chaingun.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::TankMortar, 0] = '\c0%4 TEAMKILLED %1 by lobbing the BIG green death from a tank.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::ShrikeBlaster, 0] = '\c0%4 TEAMKILLED %1 by strafing from a Shrike.';
|
||||
|
||||
$DeathMessageCTurretTeamKill[$DamageType::MPBMissile, 0] = '\c0%4 TEAMKILLED %1 when the MPB locked onto him.';
|
||||
|
||||
|
||||
|
||||
//used when a player is killed by an uncontrolled, friendly turret
|
||||
$DeathMessageCTurretAccdtlKillCount = 1;
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::PlasmaTurret, 0] = '\c0%1 got in the way of a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::AATurret, 0] = '\c0%1 got in the way of an AA turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::ELFTurret, 0] = '\c0%1 got in the way of an ELF turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::MortarTurret, 0] = '\c0%1 got in the way of a mortar turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::MissileTurret, 0] = '\c0%1 got in the way of a missile turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 got in the way of a clamp turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 got in the way of a spike turret!';
|
||||
|
||||
$DeathMessageCTurretAccdtlKill[$DamageType::SentryTurret, 0] = '\c0%1 got in the way of a Sentry turret!';
|
||||
|
||||
|
||||
//these messages for owned or controlled turrets
|
||||
$DeathMessageCTurretKillCount = 3;
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 0] = '\c0%4 torches %1 with a plasma turret!';
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 1] = '\c0%4 fries %1 with a plasma turret!';
|
||||
$DeathMessageCTurretKill[$DamageType::PlasmaTurret, 2] = '\c0%4 lights up %1 with a plasma turret!';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 0] = '\c0%4 shoots down %1 with an AA turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 1] = '\c0%1 gets shot down by %1\'s AA turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::AATurret, 2] = '\c0%4 takes out %1 with an AA turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 0] = '\c0%1 gets zapped by ELF gunner %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 1] = '\c0%1 gets barbecued by ELF gunner %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ElfTurret, 2] = '\c0%1 gets shocked by ELF gunner %4.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 0] = '\c0%1 is annihilated by %4\'s mortar turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 1] = '\c0%1 is blown away by %4\'s mortar turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MortarTurret, 2] = '\c0%1 is pureed by %4\'s mortar turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 0] = '\c0%4 shows %1 a new world of pain with a missile turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 1] = '\c0%4 pops %1 with a missile turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::MissileTurret, 2] = '\c0%4\'s missile turret lights up %1\'s, uh, ex-life.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 0] = '\c0%1 is chewed up and spat out by %4\'s clamp turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 1] = '\c0%1 is knocked out by %4\'s clamp turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::IndoorDepTurret, 2] = '\c0%4\'s clamp turret drills %1 nicely.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 0] = '\c0%1 is chewed up by %4\'s spike turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 1] = '\c0%1 feels the burn from %4\'s spike turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::OutdoorDepTurret, 2] = '\c0%1 is nailed by %4\'s spike turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 0] = '\c0%4 caught %1 by surprise with a turret.';
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 1] = '\c0%4\'s turret took out %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::SentryTurret, 2] = '\c0%4 blasted %1 with a turret.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 0] = '\c0%1 catches %4\'s bomb in both teeth.';
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 1] = '\c0%4 leaves %1 a smoking bomb crater.';
|
||||
$DeathMessageCTurretKill[$DamageType::BomberBombs, 2] = '\c0%4 bombs %1 back to the 20th century.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 0] = '\c0%1 eats a big helping of %4\'s belly turret bolt.';
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 1] = '\c0%4 plants a belly turret bolt in %1\'s belly.';
|
||||
$DeathMessageCTurretKill[$DamageType::BellyTurret, 2] = '\c0%1 fails to evade %4\'s deft bomber strafing.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 0] = '\c0%1 enjoys the rich, metallic taste of %4\'s tank slug.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 1] = '\c0%4\'s tank chaingun plays sweet music all over %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankChainGun, 2] = '\c0%1 receives a stellar exit wound from %4\'s tank slug.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 0] = '\c0Whoops! %1 + %4\'s tank mortar = Dead %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 1] = '\c0%1 learns the happy explosion dance from %4\'s tank mortar.';
|
||||
$DeathMessageCTurretKill[$DamageType::TankMortar, 2] = '\c0%4\'s tank mortar has a blast with %1.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 0] = '\c0%1 dines on a Shrike blaster sandwich, courtesy of %4.';
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 1] = '\c0The blaster of %4\'s Shrike turns %1 into finely shredded meat.';
|
||||
$DeathMessageCTurretKill[$DamageType::ShrikeBlaster, 2] = '\c0%1 gets drilled big-time by the blaster of %4\'s Shrike.';
|
||||
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 0] = '\c0%1 intersects nicely with %4\'s MPB Missile.';
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 1] = '\c0%4\'s MPB Missile makes armored chowder out of %1.';
|
||||
$DeathMessageCTurretKill[$DamageType::MPBMissile, 2] = '\c0%1 has a brief, explosive fling with %4\'s MPB Missile.';
|
||||
|
||||
$DeathMessageTurretSelfKillCount = 3;
|
||||
$DeathMessageTurretSelfKill[0] = '\c0%1 somehow kills %2self with a turret.';
|
||||
$DeathMessageTurretSelfKill[1] = '\c0%1 apparently didn\'t know the turret was loaded.';
|
||||
$DeathMessageTurretSelfKill[2] = '\c0%1 helps his team by killing himself with a turret.';
|
||||
|
||||
$DeathMessageMeteorCount = 6;
|
||||
$DeathMessageMeteor[0] = '\c0%1 was killed by a meteor!';
|
||||
$DeathMessageMeteor[1] = '\c0%1 caught a meteor!';
|
||||
$DeathMessageMeteor[2] = '\c0%1 gets a facefull of molten meteor.';
|
||||
$DeathMessageMeteor[3] = '\c0%1 gets smeared by a red hot meteor.';
|
||||
$DeathMessageMeteor[4] = '\c0%1 is left a smoking crater by a meteor.';
|
||||
$DeathMessageMeteor[5] = '\c0%1 learns to seek shelter when there\'s hot rock falling from the sky.';
|
||||
|
||||
$DeathMessageCursingCount = 2;
|
||||
$DeathMessageCursing[0] = '\c0%1 was killed for cursing.';
|
||||
$DeathMessageCursing[1] = '\c0%1\'s mouth gets %2 killed again.';
|
||||
|
||||
$DeathMessageIdiocyCount = 2;
|
||||
$DeathMessageIdiocy[0] = '\c0%1 was killed for being dumb.';
|
||||
$DeathMessageIdiocy[1] = '\c0%1\'s own stupidity stops %2 cold in %3 tracks.';
|
||||
|
||||
$DeathMessageKillerFogCount = 4;
|
||||
$DeathMessageKillerFog[0] = '\c0%1 got lost in the great beyond.';
|
||||
$DeathMessageKillerFog[1] = '\c0%1 slipped and fell, never to be seen again.';
|
||||
$DeathMessageKillerFog[2] = '\c0The fog of death engulfs %1.';
|
||||
$DeathMessageKillerFog[3] = '\c0%1 got lost in the fog.';
|
||||
|
||||
|
||||
$DeathMessage[$DamageType::SuperChaingun, 0] = '\c0%4 rips %1 up with the super chaingun.';
|
||||
$DeathMessage[$DamageType::SuperChaingun, 1] = '\c0%4 happily chews %1 into pieces with %6 super chaingun.';
|
||||
$DeathMessage[$DamageType::SuperChaingun, 2] = '\c0%4 administers a dose of Admin Lead to %1.';
|
||||
$DeathMessage[$DamageType::SuperChaingun, 3] = '\c0%1 suffers a serious hosing from %4\'s super chaingun.';
|
||||
$DeathMessage[$DamageType::SuperChaingun, 4] = '\c0%4 bestows the blessings of %6 super chaingun on %1.';
|
||||
|
||||
// TODO - create these
|
||||
$DeathMessageSelfKill[$DamageType::SuperChaingun, 0] = '\c0%1 kills %2self with a super chaingun.';
|
||||
$DeathMessageSelfKill[$DamageType::SuperChaingun, 1] = '\c0%1 catches the blast of %3 own super chaingun bullet.';
|
||||
$DeathMessageSelfKill[$DamageType::SuperChaingun, 2] = '\c0%1 kills %2self with a super chaingun.';
|
||||
$DeathMessageSelfKill[$DamageType::SuperChaingun, 3] = '\c0%1 catches the blast of %3 own super chaingun bullet.';
|
||||
$DeathMessageSelfKill[$DamageType::SuperChaingun, 4] = '\c0%1 plays Russian roulette with %3 super chaingun.';
|
||||
5080
scripts/defaultGame.cs
Normal file
5080
scripts/defaultGame.cs
Normal file
File diff suppressed because it is too large
Load diff
2075
scripts/deployables.cs
Normal file
2075
scripts/deployables.cs
Normal file
File diff suppressed because it is too large
Load diff
1431
scripts/do_not_delete/Dfunctions.cs
Normal file
1431
scripts/do_not_delete/Dfunctions.cs
Normal file
File diff suppressed because it is too large
Load diff
BIN
scripts/do_not_delete/loadscreen.cs.dso
Normal file
BIN
scripts/do_not_delete/loadscreen.cs.dso
Normal file
Binary file not shown.
113
scripts/editor.cs
Normal file
113
scripts/editor.cs
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Hard coded images referenced from C++ code
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// editor/SelectHandle.png
|
||||
// editor/DefaultHandle.png
|
||||
// editor/LockedHandle.png
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mission Editor
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function Editor::create()
|
||||
{
|
||||
// Not much to do here, build it and they will come...
|
||||
// Only one thing... the editor is a gui control which
|
||||
// expect the Canvas to exist, so it must be constructed
|
||||
// before the editor.
|
||||
new EditManager(Editor)
|
||||
{
|
||||
profile = "GuiContentProfile";
|
||||
horizSizing = "right";
|
||||
vertSizing = "top";
|
||||
position = "0 0";
|
||||
extent = "640 480";
|
||||
minExtent = "8 8";
|
||||
visible = "1";
|
||||
setFirstResponder = "0";
|
||||
modal = "1";
|
||||
helpTag = "0";
|
||||
open = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function Editor::onAdd(%this)
|
||||
{
|
||||
// Basic stuff
|
||||
exec("scripts/cursors.cs");
|
||||
exec("scripts/EditorProfiles.cs");
|
||||
|
||||
// Tools
|
||||
exec("scripts/editor.bind.cs");
|
||||
exec("gui/ObjectBuilderGui.gui");
|
||||
|
||||
// New World Editor
|
||||
exec("gui/EditorGui.gui");
|
||||
exec("scripts/EditorGui.cs");
|
||||
exec("gui/AIEWorkingDlg.gui");
|
||||
|
||||
// World Editor
|
||||
exec("gui/WorldEditorSettingsDlg.gui");
|
||||
|
||||
// Terrain Editor
|
||||
exec("gui/TerrainEditorVSettingsGui.gui");
|
||||
exec("gui/HelpDlg.gui");
|
||||
exec("scripts/help.cs");
|
||||
|
||||
// do gui initialization...
|
||||
EditorGui.init();
|
||||
|
||||
//
|
||||
exec("scripts/editorRender.cs");
|
||||
}
|
||||
|
||||
function Editor::checkActiveLoadDone()
|
||||
{
|
||||
if(isObject(EditorGui) && EditorGui.loadingMission)
|
||||
{
|
||||
Canvas.setContent(EditorGui);
|
||||
EditorGui.loadingMission = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function toggleEditor(%make)
|
||||
{
|
||||
if (%make)
|
||||
{
|
||||
if (!$missionRunning)
|
||||
{
|
||||
MessageBoxOK("Mission Required", "You must load a mission before starting the Mission Editor.", "");
|
||||
return;
|
||||
}
|
||||
|
||||
// $testcheats = 1;
|
||||
if (!isObject(Editor))
|
||||
{
|
||||
Editor::create();
|
||||
MissionCleanup.add(Editor);
|
||||
}
|
||||
if (Canvas.getContent() == EditorGui.getId())
|
||||
Editor.close();
|
||||
else
|
||||
Editor.open();
|
||||
}
|
||||
}
|
||||
|
||||
148
scripts/expertLibraries.cs
Normal file
148
scripts/expertLibraries.cs
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
//Contain basic data libraries.
|
||||
//Soon to be updated with more usefull stuff.
|
||||
|
||||
// NOTE - any changes here must be considered in libraries.cs !!!
|
||||
|
||||
//** New format of information **
|
||||
|
||||
$packSettings["spine"] = 18;
|
||||
$packSetting["spine",0] = "0.5 0.5 0.1 10 cm in height";
|
||||
$packSetting["spine",1] = "0.5 0.5 0.25 25 cm in height";
|
||||
$packSetting["spine",2] = "0.5 0.5 0.5 50 cm in height";
|
||||
$packSetting["spine",3] = "0.5 0.5 1 1 meter in height";
|
||||
$packSetting["spine",4] = "0.5 0.5 1.5 1.5 meters in height";
|
||||
$packSetting["spine",5] = "0.5 6 160 auto adjusting";
|
||||
$packSetting["spine",6] = "0.5 8 160 pad";
|
||||
$packSetting["spine",7] = "0.5 8 160 wooden pad";
|
||||
$packSetting["spine",8] = "0.5 0.5 4 4 meters in height";
|
||||
$packSetting["spine",9] = "0.5 0.5 8 8 meters in height";
|
||||
$packSetting["spine",10] = "0.5 0.5 20 20 meters in height";
|
||||
$packSetting["spine",11] = "0.5 0.5 40 40 meters in height";
|
||||
$packSetting["spine",12] = "0.5 0.5 80 80 meters in height";
|
||||
$packSetting["spine",13] = "0.5 0.5 100 100 meters in height";
|
||||
$packSetting["spine",14] = "0.5 0.5 160 160 meters in height";
|
||||
$packSetting["spine",15] = "0.5 0.5 400 400 meters in height";
|
||||
$packSetting["spine",16] = "0.5 0.5 1000 1k meters in height";
|
||||
$packSetting["spine",17] = "0.5 0.5 2000 2k meters in height";
|
||||
$packSetting["spine",18] = "0.5 0.5 4000 4k meters in height";
|
||||
|
||||
$packSettings["mspine"] = 18;
|
||||
$packSetting["mspine",0] = "1 1 0.1 2 2 0.5 10 cm in height";
|
||||
$packSetting["mspine",1] = "1 1 0.25 2 2 0.5 25 cm in height";
|
||||
$packSetting["mspine",2] = "1 1 0.5 2 2 0.5 50 cm in height";
|
||||
$packSetting["mspine",3] = "1 1 1 2 2 0.5 1 meters in height";
|
||||
$packSetting["mspine",4] = "1 1 1.5 2 2 0.5 1.5 meters in height";
|
||||
$packSetting["mspine",5] = "1 8 160 2 2 0.5 auto adjusting";
|
||||
$packSetting["mspine",6] = "1 8 160 2 2 0.5 normal rings";
|
||||
$packSetting["mspine",7] = "1 8 160 8 8 0.5 platform rings";
|
||||
$packSetting["mspine",8] = "1 1 4 2 2 0.5 4 meters in height";
|
||||
$packSetting["mspine",9] = "1 1 8 2 2 0.5 8 meters in height";
|
||||
$packSetting["mspine",10] = "1 1 20 2 2 0.5 20 meters in height";
|
||||
$packSetting["mspine",11] = "1 1 40 2 2 0.5 40 meters in height";
|
||||
$packSetting["mspine",12] = "1 1 80 2 2 0.5 80 meters in height";
|
||||
$packSetting["mspine",13] = "1 1 100 2 2 0.5 100 meters in height";
|
||||
$packSetting["mspine",14] = "1 1 160 2 2 0.5 160 meters in height";
|
||||
$packSetting["mspine",15] = "1 1 400 2 2 0.5 400 meters in height";
|
||||
$packSetting["mspine",16] = "1 1 1000 2 2 0.5 1k meters in height";
|
||||
$packSetting["mspine",17] = "1 1 2000 2 2 0.5 2k meters in height";
|
||||
$packSetting["mspine",18] = "1 1 4000 2 2 0.5 4k meters in height";
|
||||
|
||||
$packSettings["floor"] = 11;
|
||||
$packSetting["floor",0] = "0.1 0.1 40 0.1 0.1 0.1 10 cm wide";
|
||||
$packSetting["floor",1] = "1 1 40 1 1 1 1 meter wide";
|
||||
$packSetting["floor",2] = "4 4 40 4 4 4 4 meters wide";
|
||||
$packSetting["floor",3] = "10 10 20 10 10 10 10 meters wide";
|
||||
$packSetting["floor",4] = "20 20 20 20 20 20 20 meters wide";
|
||||
$packSetting["floor",5] = "30 30 20 30 30 30 30 meters wide";
|
||||
$packSetting["floor",6] = "40 40 20 40 40 40 40 meters wide";
|
||||
$packSetting["floor",7] = "50 50 20 50 50 50 50 meters wide";
|
||||
$packSetting["floor",8] = "60 60 20 60 60 60 60 meters wide";
|
||||
$packSetting["floor",9] = "100 100 40 100 100 100 100 meters wide";
|
||||
$packSetting["floor",10] = "400 400 40 400 400 400 400 meters wide";
|
||||
$packSetting["floor",11] = "1000 1000 40 1000 1000 1000 1k meters wide";
|
||||
|
||||
$packSettings["walk"] = 74;
|
||||
$packSetting["walk",0] = "0 flat";
|
||||
$packSetting["walk",1] = "1 Sloped 1 degrees up";
|
||||
$packSetting["walk",2] = "-1 Sloped 1 degrees down";
|
||||
$packSetting["walk",3] = "5 Sloped 5 degrees up";
|
||||
$packSetting["walk",4] = "-5 Sloped 5 degrees down";
|
||||
$packSetting["walk",5] = "10 Sloped 10 degrees up";
|
||||
$packSetting["walk",6] = "-10 Sloped 10 degrees down";
|
||||
$packSetting["walk",7] = "15 Sloped 15 degrees up";
|
||||
$packSetting["walk",8] = "-15 Sloped 15 degrees down";
|
||||
$packSetting["walk",9] = "20 Sloped 20 degrees up";
|
||||
$packSetting["walk",10] = "-20 Sloped 20 degrees down";
|
||||
$packSetting["walk",11] = "25 Sloped 25 degrees up";
|
||||
$packSetting["walk",12] = "-25 Sloped 25 degrees down";
|
||||
$packSetting["walk",13] = "30 Sloped 30 degrees up";
|
||||
$packSetting["walk",14] = "-30 Sloped 30 degrees down";
|
||||
$packSetting["walk",15] = "35 Sloped 35 degrees up";
|
||||
$packSetting["walk",16] = "-35 Sloped 35 degrees down";
|
||||
$packSetting["walk",17] = "40 Sloped 40 degrees up";
|
||||
$packSetting["walk",18] = "-40 Sloped 40 degrees down";
|
||||
$packSetting["walk",19] = "45 Sloped 45 degrees up";
|
||||
$packSetting["walk",20] = "-45 Sloped 45 degrees down";
|
||||
$packSetting["walk",21] = "50 Sloped 50 degrees up";
|
||||
$packSetting["walk",22] = "-50 Sloped 50 degrees down";
|
||||
$packSetting["walk",23] = "55 Sloped 55 degrees up";
|
||||
$packSetting["walk",24] = "-55 Sloped 55 degrees down";
|
||||
$packSetting["walk",25] = "60 Sloped 60 degrees up";
|
||||
$packSetting["walk",26] = "-60 Sloped 60 degrees down";
|
||||
$packSetting["walk",27] = "65 Sloped 65 degrees up";
|
||||
$packSetting["walk",28] = "-65 Sloped 65 degrees down";
|
||||
$packSetting["walk",29] = "70 Sloped 70 degrees up";
|
||||
$packSetting["walk",30] = "-70 Sloped 70 degrees down";
|
||||
$packSetting["walk",31] = "75 Sloped 75 degrees up";
|
||||
$packSetting["walk",32] = "-75 Sloped 75 degrees down";
|
||||
$packSetting["walk",33] = "80 Sloped 80 degrees up";
|
||||
$packSetting["walk",34] = "-80 Sloped 80 degrees down";
|
||||
$packSetting["walk",35] = "85 Sloped 85 degrees up";
|
||||
$packSetting["walk",36] = "-85 Sloped 85 degrees down";
|
||||
$packSetting["walk",37] = "90 Sloped 90 degrees up";
|
||||
$packSetting["walk",38] = "-90 Sloped 90 degrees down";
|
||||
$packSetting["walk",39] = "95 Sloped 95 degrees up";
|
||||
$packSetting["walk",40] = "-95 Sloped 95 degrees down";
|
||||
$packSetting["walk",41] = "100 Sloped 100 degrees up";
|
||||
$packSetting["walk",42] = "-100 Sloped 100 degrees down";
|
||||
$packSetting["walk",43] = "105 Sloped 105 degrees up";
|
||||
$packSetting["walk",44] = "-105 Sloped 105 degrees down";
|
||||
$packSetting["walk",45] = "110 Sloped 110 degrees up";
|
||||
$packSetting["walk",46] = "-110 Sloped 110 degrees down";
|
||||
$packSetting["walk",47] = "115 Sloped 115 degrees up";
|
||||
$packSetting["walk",48] = "-115 Sloped 115 degrees down";
|
||||
$packSetting["walk",49] = "120 Sloped 120 degrees up";
|
||||
$packSetting["walk",50] = "-120 Sloped 120 degrees down";
|
||||
$packSetting["walk",51] = "125 Sloped 125 degrees up";
|
||||
$packSetting["walk",52] = "-125 Sloped 125 degrees down";
|
||||
$packSetting["walk",53] = "130 Sloped 130 degrees up";
|
||||
$packSetting["walk",54] = "-130 Sloped 130 degrees down";
|
||||
$packSetting["walk",55] = "135 Sloped 135 degrees up";
|
||||
$packSetting["walk",56] = "-135 Sloped 135 degrees down";
|
||||
$packSetting["walk",57] = "140 Sloped 140 degrees up";
|
||||
$packSetting["walk",58] = "-140 Sloped 140 degrees down";
|
||||
$packSetting["walk",59] = "145 Sloped 145 degrees up";
|
||||
$packSetting["walk",60] = "-145 Sloped 145 degrees down";
|
||||
$packSetting["walk",61] = "150 Sloped 150 degrees up";
|
||||
$packSetting["walk",62] = "-150 Sloped 150 degrees down";
|
||||
$packSetting["walk",63] = "155 Sloped 155 degrees up";
|
||||
$packSetting["walk",64] = "-155 Sloped 155 degrees down";
|
||||
$packSetting["walk",65] = "160 Sloped 160 degrees up";
|
||||
$packSetting["walk",66] = "-160 Sloped 160 degrees down";
|
||||
$packSetting["walk",67] = "165 Sloped 165 degrees up";
|
||||
$packSetting["walk",68] = "-165 Sloped 165 degrees down";
|
||||
$packSetting["walk",69] = "170 Sloped 170 degrees up";
|
||||
$packSetting["walk",70] = "-170 Sloped 170 degrees down";
|
||||
$packSetting["walk",71] = "175 Sloped 175 degrees up";
|
||||
$packSetting["walk",72] = "-175 Sloped 175 degrees down";
|
||||
$packSetting["walk",73] = "180 Sloped 180 degrees up";
|
||||
$packSetting["walk",74] = "-180 Sloped 180 degrees down";
|
||||
|
||||
$packSettings["jumpad"] = 6;
|
||||
$packSetting["jumpad",0] = "500 5 boost";
|
||||
$packSetting["jumpad",1] = "1000 10 boost";
|
||||
$packSetting["jumpad",2] = "1500 15 boost";
|
||||
$packSetting["jumpad",3] = "2500 25 boost";
|
||||
$packSetting["jumpad",4] = "5000 50 boost";
|
||||
$packSetting["jumpad",5] = "7500 75 boost";
|
||||
$packSetting["jumpad",6] = "10000 100 boost";
|
||||
290
scripts/forceField.cs
Normal file
290
scripts/forceField.cs
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Force fields:
|
||||
//
|
||||
// accept the following commands:
|
||||
// open()
|
||||
// close()
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
datablock ForceFieldBareData(defaultForceFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = "0.0 0.55 0.99";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetNameTag = 'Force Field';
|
||||
targetTypeTag = 'ForceField';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
datablock ForceFieldBareData(defaultTeamSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.3;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = "0.28 0.89 0.31";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'ForceField';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultAllSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = "1.0 0.4 0.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'ForceField';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultNoTeamSlowFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = true;
|
||||
color = "1.0 0.0 0.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'ForceField';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(defaultSolidFieldBare)
|
||||
{
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = 0.30;
|
||||
powerOffTranslucency = 0.0;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = "1.0 0.0 0.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'ForceField';
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
function ForceFieldBare::onTrigger(%this, %triggerId, %on)
|
||||
{
|
||||
// Default behavior for a field:
|
||||
// if triggered: go to open state (last waypoint)
|
||||
// if untriggered: go to closed state (first waypoint)
|
||||
|
||||
if (%on == 1) {
|
||||
%this.triggerCount++;
|
||||
} else {
|
||||
if (%this.triggerCount > 0)
|
||||
%this.triggerCount--;
|
||||
}
|
||||
|
||||
if (%this.triggerCount > 0) {
|
||||
%this.open();
|
||||
} else {
|
||||
%this.close();
|
||||
}
|
||||
}
|
||||
|
||||
function ForceFieldBareData::gainPower(%data, %obj) {
|
||||
Parent::gainPower(%data, %obj);
|
||||
if (!shouldChangePowerState(%obj,true))
|
||||
return;
|
||||
%obj.lastState = true;
|
||||
if (%obj.realScale) {
|
||||
%obj.setScale(%obj.realScale);
|
||||
%obj.realScale = "";
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.setTransform(%obj.getTransform());
|
||||
}
|
||||
%obj.close();
|
||||
// activate the field's physical zone
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.activate();
|
||||
// %pzGroup = nameToID("MissionCleanup/PZones");
|
||||
// if(%pzGroup > 0) {
|
||||
// %ffp = -1;
|
||||
// for(%i = 0; %i < %pzGroup.getCount(); %i++) {
|
||||
// %pz = %pzGroup.getObject(%i);
|
||||
// if(%pz.ffield == %obj) {
|
||||
// %ffp = %pz;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(%ffp > 0) {
|
||||
// %ffp.activate();
|
||||
if( %data.getName() $= "defaultForceFieldBare" )
|
||||
killAllPlayersWithinZone( %data, %obj );
|
||||
else if( %data.getName() $= "defaultTeamSlowFieldBare" ) {
|
||||
%team = %obj.team;
|
||||
killAllPlayersWithinZone( %data, %obj, %team );
|
||||
}
|
||||
else if (getSubStr(%data.getName(),0,18) $= "DeployedForceField") {
|
||||
if (!%obj.notFirstPwr) {
|
||||
%obj.notFirstPwr = true;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%team = %obj.team;
|
||||
killAllPlayersWithinZone( %data, %obj, %team );
|
||||
}
|
||||
}
|
||||
// }
|
||||
//else
|
||||
// error("No PZones group to search!");
|
||||
}
|
||||
|
||||
function killAllPlayersWithinZone( %data, %obj, %team ) {
|
||||
%count = ClientGroup.getCount();
|
||||
for( %c = 0; %c < %count; %c++ ) {
|
||||
%client = ClientGroup.getObject(%c);
|
||||
if( isObject( %client.player ) ) {
|
||||
if( %forceField = %client.player.isInForceField() ) { // isInForceField() will return the id of the ff or zero
|
||||
if( %forceField == %obj ) {
|
||||
%client.player.FFZapped = true;
|
||||
%client.player.disableMove(true);
|
||||
for( %i = 0; %i < 10; %i++ ) {
|
||||
%client.player.schedule(%i * 200,play3d,ShockLanceHitSound);
|
||||
schedule(%i * 200,0,playPain,%client.player);
|
||||
%client.player.schedule(%i * 200,setActionThread,"Death" @ getRandom(10)+1);
|
||||
}
|
||||
%client.player.schedule(2000,blowup); // chunkOrama!
|
||||
%client.player.schedule(2000,scriptkill,$DamageType::ForceFieldPowerup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ForceFieldBareData::losePower(%data, %obj) {
|
||||
Parent::losePower(%data, %obj);
|
||||
if (!shouldChangePowerState(%obj,false))
|
||||
return;
|
||||
%obj.lastState = false;
|
||||
if (!%obj.realScale) {
|
||||
%obj.realScale = %obj.getScale();
|
||||
%obj.setScale("0.01 0.01 0.01");
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.setTransform(%obj.getTransform());
|
||||
}
|
||||
%obj.open();
|
||||
// deactivate the field's physical zone
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.deactivate();
|
||||
// %pzGroup = nameToID("MissionCleanup/PZones");
|
||||
// if(%pzGroup > 0) {
|
||||
// %ffp = -1;
|
||||
// for(%i = 0; %i < %pzGroup.getCount(); %i++) {
|
||||
// %pz = %pzGroup.getObject(%i);
|
||||
// if(%pz.ffield == %obj) {
|
||||
// %ffp = %pz;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if(%ffp > 0) {
|
||||
// %ffp.deactivate();
|
||||
// }
|
||||
// }
|
||||
//else
|
||||
// error("<No PZones group to search!>");
|
||||
}
|
||||
|
||||
function ForceFieldBareData::onAdd(%data, %obj) {
|
||||
Parent::onAdd(%data, %obj);
|
||||
|
||||
%velocityMod = 0.1;
|
||||
%gravityMod = 1.0;
|
||||
%appliedForce = "0 0 0";
|
||||
|
||||
if (%obj.velocityMod !$= "")
|
||||
%velocityMod = %obj.velocityMod;
|
||||
if (%obj.gravityMod !$= "")
|
||||
%gravityMod = %obj.gravityMod;
|
||||
if (%obj.appliedForce !$= "")
|
||||
%appliedForce = %obj.appliedForce;
|
||||
|
||||
%pz = new PhysicalZone() {
|
||||
position = %obj.position;
|
||||
rotation = %obj.rotation;
|
||||
scale = %obj.scale;
|
||||
polyhedron = "0.000000 1.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
velocityMod = %velocityMod;
|
||||
gravityMod = %gravityMod;
|
||||
appliedForce = %appliedForce;
|
||||
ffield = %obj;
|
||||
};
|
||||
|
||||
%obj.pzone = %pz;
|
||||
|
||||
%pzGroup = nameToID("MissionCleanup/PZones");
|
||||
if(%pzGroup <= 0) {
|
||||
%pzGroup = new SimGroup("PZones");
|
||||
MissionCleanup.add(%pzGroup);
|
||||
}
|
||||
%pzGroup.add(%pz);
|
||||
}
|
||||
1034
scripts/functions.cs
Normal file
1034
scripts/functions.cs
Normal file
File diff suppressed because it is too large
Load diff
147
scripts/gameBase.cs
Normal file
147
scripts/gameBase.cs
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
|
||||
function GameBaseData::onAdd(%data, %obj)
|
||||
{
|
||||
if(%data.targetTypeTag !$= "")
|
||||
{
|
||||
// use the name given to the object in the mission file
|
||||
if(%obj.nameTag !$= "")
|
||||
{
|
||||
%obj.nameTag = addTaggedString(%obj.nameTag);
|
||||
%nameTag = %obj.nameTag;
|
||||
}
|
||||
else
|
||||
%nameTag = %data.targetNameTag;
|
||||
|
||||
%obj.target = createTarget(%obj, %nameTag, "", "", %data.targetTypeTag, 0, 0);
|
||||
}
|
||||
else
|
||||
%obj.target = -1;
|
||||
}
|
||||
|
||||
function GameBaseData::onRemove(%data, %obj)
|
||||
{
|
||||
%target = %obj.getTarget();
|
||||
|
||||
// first 32 targets are team targets
|
||||
if(%target >= 32)
|
||||
{
|
||||
if(%obj.nameTag !$= "")
|
||||
removeTaggedString(%obj.nameTag);
|
||||
freeTarget(%target);
|
||||
}
|
||||
}
|
||||
|
||||
function InteriorInstance::damage()
|
||||
{
|
||||
}
|
||||
|
||||
function TerrainBlock::damage()
|
||||
{
|
||||
}
|
||||
|
||||
function WaterBlock::damage() {
|
||||
}
|
||||
|
||||
function ForceFieldBare::damage(%this, %sourceObject, %position, %amount, %damageType) {
|
||||
%this.getDataBlock().damageObject(%this, %sourceObject, %position, %amount, %damageType);
|
||||
}
|
||||
|
||||
function ForceFieldBareData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) {
|
||||
StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
|
||||
}
|
||||
|
||||
function ForceFieldBare::applyDamage(%obj,%amount,%sourceObject,%position,%damageType) {
|
||||
%dataBlockName = %obj.getDataBlock().getName();
|
||||
if (getSubStr(%dataBlockName,0,18) $= "DeployedForceField" || getSubStr(%dataBlockName,0,20) $= "DeployedGravityField") {
|
||||
%count = getWordCount($PowerList);
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord($PowerList,%i);
|
||||
if (genPoweringObj(%powerObj,%obj))
|
||||
%powerList = %powerList SPC %powerObj;
|
||||
}
|
||||
%powerList = trim(%powerList);
|
||||
%genDamage = (%amount * 1) / getWordCount(%powerList);
|
||||
%count = getWordCount(%powerList);
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord(%powerList,%i);
|
||||
%mult = (1 - 0.05) + (getRandom() * 0.10);
|
||||
%powerObj.damage(%sourceObject,%position,%genDamage * %mult,%damageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ForceFieldBare::isEnabled() {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function GameBaseData::shouldApplyImpulse(%data, %obj)
|
||||
{
|
||||
return %data.shouldApplyImpulse;
|
||||
}
|
||||
|
||||
|
||||
function ShapeBaseData::onAdd(%data, %obj)
|
||||
{
|
||||
Parent::onAdd(%data, %obj);
|
||||
// if it's a deployed object, schedule the ambient thread to play in a little while
|
||||
if(%data.deployAmbientThread)
|
||||
%obj.schedule(750, "playThread", $AmbientThread, "ambient");
|
||||
// check for ambient animation that should always be played
|
||||
if(%data.alwaysAmbient)
|
||||
%obj.playThread($AmbientThread, "ambient");
|
||||
}
|
||||
|
||||
function SimObject::setOwnerClient(%obj, %cl)
|
||||
{
|
||||
%obj.client = %cl;
|
||||
}
|
||||
|
||||
function SimObject::getOwnerClient(%obj)
|
||||
{
|
||||
if(isObject(%obj))
|
||||
return %obj.client;
|
||||
return 0;
|
||||
}
|
||||
// recursive objective init functions for mission group
|
||||
|
||||
function SimGroup::objectiveInit(%this)
|
||||
{
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
%this.getObject(%i).objectiveInit();
|
||||
}
|
||||
|
||||
function SimObject::objectiveInit(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function GameBase::objectiveInit(%this)
|
||||
{
|
||||
//error("Initializing object " @ %this @ ", " @ %this.getDataBlock().getName());
|
||||
%this.getDataBlock().objectiveInit(%this);
|
||||
}
|
||||
|
||||
// tag strings are ignored if they start with an underscore
|
||||
function GameBase::getGameName(%this)
|
||||
{
|
||||
%name = "";
|
||||
|
||||
if(%this.nameTag !$= "")
|
||||
%name = %this.nameTag;
|
||||
else
|
||||
{
|
||||
%name = getTaggedString(%this.getDataBlock().targetNameTag);
|
||||
if((%name !$= "") && (getSubStr(%name, 0, 1) $= "_"))
|
||||
%name = "";
|
||||
}
|
||||
|
||||
%type = getTaggedString(%this.getDataBlock().targetTypeTag);
|
||||
if((%type !$= "") && (getSubStr(%type, 0, 1) !$= "_"))
|
||||
{
|
||||
if(%name !$= "")
|
||||
return(%name @ " " @ %type);
|
||||
else
|
||||
return(%type);
|
||||
}
|
||||
|
||||
return(%name);
|
||||
}
|
||||
134
scripts/hazard.cs
Normal file
134
scripts/hazard.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
// hazard.cs
|
||||
|
||||
if ($Host::Hazard::Enabled $= "")
|
||||
$Host::Hazard::Enabled = 0; // Disable as default
|
||||
if ($Hazard::HazardTimer < 500)
|
||||
$Hazard::HazardTimer = 2500; // Hazard loop timer
|
||||
if ($Hazard::StormTimer < 100)
|
||||
$Hazard::StormTimer = 500; // Hazard "storm" loop timer
|
||||
if ($Hazard::HazardStormDurationMin $= "")
|
||||
$Hazard::HazardStormDurationMin = 20000; // Storm duration min
|
||||
if ($Hazard::HazardStormDurationMax $= "")
|
||||
$Hazard::HazardStormDurationMax = 60000; // Storm duration max
|
||||
if ($Hazard::StormRandom $= "")
|
||||
$Hazard::StormRandom = 120; // Storm random chance
|
||||
if ($Hazard::MeteorMax < 1)
|
||||
$Hazard::MeteorMax = 1; // Max meteors per run
|
||||
if ($Hazard::MeteorMin $= "" || $Hazard::MeteorMin > $Hazard::MeteorMax)
|
||||
$Hazard::MeteorMin = 0; // Min meteors per run
|
||||
if ($Hazard::MeteorRad $= "")
|
||||
$Hazard::MeteorRad = 100; // Meteor drop radius
|
||||
|
||||
if ($Hazard::MaxSlant < 0 || $Hazard::MaxSlant $= "")
|
||||
$Hazard::MaxSlant = 0.4;
|
||||
if ($Hazard::BDropAddX $= "")
|
||||
$Hazard::BDropAddX = 0.00153;
|
||||
if ($Hazard::BDropAddY $= "")
|
||||
$Hazard::BDropAddY = 0.00956;
|
||||
if ($Hazard::DropAddVariation $= "")
|
||||
$Hazard::DropAddVariation = 0.0010; // divided by two = +/- 0.0005
|
||||
if ($Hazard::DropAddVariationTime < 1)
|
||||
$Hazard::DropAddVariationTime = 1000 * 60 * 10; // 10 minutes
|
||||
|
||||
if ($Hazard::DropX $= "" || mAbs($Hazard::DropX) > 1)
|
||||
$Hazard::DropX = (getRandom() * 2) - 1;
|
||||
if ($Hazard::DropY $= "" || mAbs($Hazard::DropY) > 1)
|
||||
$Hazard::DropY = 0;
|
||||
|
||||
|
||||
function hazardOn() {
|
||||
$Host::Hazard::Enabled = 1;
|
||||
hazardThread($Hazard::HazardThread++);
|
||||
}
|
||||
|
||||
function hazardOff() {
|
||||
$Host::Hazard::Enabled = 0;
|
||||
}
|
||||
|
||||
function hazardThread(%thread) {
|
||||
if (%thread != $Hazard::HazardThread || $Host::Hazard::Enabled != 1 || !isObject(MissionCleanup)) {
|
||||
warn("HazardThread #" @ mAbs(%thread) @ " stopped. Last started thread: " @ $Hazard::HazardThread);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($Hazard::StormTime $= "") {
|
||||
%rnd = getRandom(0,$Hazard::StormRandom);
|
||||
if (%rnd == 1) {
|
||||
// With default values, warning is 10 to 40 sec prior to storm
|
||||
$Hazard::StormTime = getSimTime() + ($Hazard::HazardTimer * 4) + ($Hazard::HazardTimer * getRandom(0,12));
|
||||
$Hazard::HazardStormDuration = getRandom($Hazard::HazardStormDurationMin,$Hazard::HazardStormDurationMax);
|
||||
messageAll('msgClient','\c2Warning: Meteor storm expected in %1 seconds!~wfx/misc/warning_beep.wav',mFloor(($Hazard::StormTime - getSimTime()) / 1000));
|
||||
$Hazard::StormTime = $Hazard::StormTime - 10; // fix
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($Hazard::StormTime < getSimTime() && $Hazard::StormActive != true) {
|
||||
$Hazard::StormTime = getSimTime();
|
||||
$Hazard::StormActive = true;
|
||||
messageAll('msgClient','\c2Warning: Meteor storm imminent!~wfx/misc/red_alert.wav');
|
||||
messageAll('msgClient','~wvoice/Training/Any/ANY.prompt0%1.WAV',getRandom(1,7));
|
||||
}
|
||||
if ($Hazard::StormTime + $Hazard::HazardStormDuration < getSimTime()) {
|
||||
$Hazard::StormActive = false;
|
||||
$Hazard::StormTime = "";
|
||||
messageAll('msgClient','\c2Meteor storm passing.');
|
||||
}
|
||||
}
|
||||
|
||||
if ($Hazard::DropAddX $= "")
|
||||
$Hazard::DropAddX = $Hazard::BDropAddX;
|
||||
if ($Hazard::DropAddY $= "")
|
||||
$Hazard::DropAddY = $Hazard::BDropAddY;
|
||||
if ($Hazard::DropAddVariationLastTime $= "") // Don't randomize on first run
|
||||
$Hazard::DropAddVariationLastTime = getSimTime();
|
||||
|
||||
if ($Hazard::DropAddVariationLastTime + $Hazard::DropAddVariationTime < getSimTime()) {
|
||||
$Hazard::DropAddVariationLastTime = getSimTime();
|
||||
$Hazard::DropAddX = $Hazard::BDropAddX + ((getRandom() * $Hazard::DropAddVariation) - ($Hazard::DropAddVariation / 2));
|
||||
$Hazard::DropAddY = $Hazard::BDropAddY + ((getRandom() * $Hazard::DropAddVariation) - ($Hazard::DropAddVariation / 2));
|
||||
}
|
||||
|
||||
$Hazard::DropX = $Hazard::DropX + $Hazard::DropAddX;
|
||||
$Hazard::DropY = $Hazard::DropY + $Hazard::DropAddY;
|
||||
|
||||
if (mAbs($Hazard::DropX) > 1) {
|
||||
$Hazard::DropX = 1 * lev($Hazard::DropX);
|
||||
$Hazard::DropAddX = -$Hazard::DropAddX;
|
||||
}
|
||||
|
||||
if (mAbs($Hazard::DropY) > 1) {
|
||||
$Hazard::DropY = 1 * lev($Hazard::DropY);
|
||||
$Hazard::DropAddY = -$Hazard::DropAddY;
|
||||
}
|
||||
|
||||
%x = mCos(($Hazard::DropX * $Pi) + $Pi) * mSin(($Hazard::DropY * ($Pi / 2) + ($Pi / 2)) * $Hazard::MaxSlant);
|
||||
%y = mSin(($Hazard::DropX * $Pi) + $Pi) * mSin(($Hazard::DropY * ($Pi / 2) + ($Pi / 2)) * $Hazard::MaxSlant);
|
||||
%z = mCos(($Hazard::DropY * ($Pi / 2) + ($Pi / 2)) * $Hazard::MaxSlant);
|
||||
%dropVec = vectorScale(%x SPC %y SPC -%z,5);
|
||||
|
||||
// Meteors
|
||||
// Players
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++) {
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (isObject(%cl.player) && !%cl.isJailed) {
|
||||
%num = getRandom($Hazard::MeteorMin,$Hazard::MeteorMax);
|
||||
if (%num > 0)
|
||||
JTLMeteorStorm(%cl,0,$Hazard::MeteorRad,%num,400,600,0,0,0,0,0,0,vectorScale(%dropVec,0.975 + (getRandom() * 0.05)),1);
|
||||
}
|
||||
}
|
||||
// Generators
|
||||
%count = getWordCount($PowerList);
|
||||
for(%i = 0; %i < %count; %i++) {
|
||||
%obj = getWord($PowerList,%i);
|
||||
if (isObject(%obj)) {
|
||||
%num = getRandom($Hazard::MeteorMin,$Hazard::MeteorMax);
|
||||
if (%num > 0)
|
||||
JTLMeteorStorm(%obj,0,$Hazard::MeteorRad,%num,400,600,0,0,0,0,0,0,vectorScale(%dropVec,0.975 + (getRandom() * 0.05)),1);
|
||||
}
|
||||
}
|
||||
if ($Hazard::StormActive == true)
|
||||
schedule($Hazard::StormTimer,0,HazardThread,%thread);
|
||||
else
|
||||
schedule($Hazard::HazardTimer,0,HazardThread,%thread);
|
||||
}
|
||||
106
scripts/hfunctions.cs
Normal file
106
scripts/hfunctions.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
function LightningStrike(%client,%delay) {
|
||||
if (%client.player)
|
||||
%pos = %client.player.getTransform();
|
||||
%one = getword(%pos, 0) SPC getword(%pos, 1) SPC getword(%pos, 2);
|
||||
%player = %client.player;
|
||||
%b = new StaticShape() {
|
||||
position = %pos;
|
||||
datablock = "LightningTarget";
|
||||
};
|
||||
schedule(%delay, 0, "actualstrike", %b);
|
||||
}
|
||||
|
||||
function actualstrike(%obj) {
|
||||
%posr = %obj.getTransform();
|
||||
%pos = VectorAdd(%posr, "0 0 -20");
|
||||
%pos2 = VectorAdd(%posr, "0 0 -20");
|
||||
for (%i=0;%i<10;%i++) {
|
||||
%pos = VectorAdd(%pos, "0 0 20");
|
||||
%p[%i] = new Lightning() {
|
||||
scale = "1 1 1";
|
||||
position = %pos;
|
||||
rotation = "1 0 0 0";
|
||||
dataBlock = "DefaultStorm";
|
||||
strikesPerMinute = "120";
|
||||
strikeWidth = "1.0";
|
||||
chanceToHitTarget = "1.0";
|
||||
strikeRadius = "1";
|
||||
boltStartRadius = "10";
|
||||
color = "1.000000 1.000000 1.000000 1.000000";
|
||||
fadeColor = "0.300000 0.300000 1.000000 1.000000";
|
||||
useFog = "1";
|
||||
};
|
||||
%p[%i].schedule(1500, "delete");
|
||||
%p[%i].strikeObject(%player);
|
||||
}
|
||||
schedule(1000, 0, "LightningApplyDamage", %p, %pos, %pos2);
|
||||
if (%obj)
|
||||
%obj.schedule(1500, "delete");
|
||||
}
|
||||
|
||||
function LightningWeaponImage::onFire(%data, %obj, %slot) {
|
||||
%range = 1000;
|
||||
%rot = getWords(%obj.getTransform(), 3, 6);
|
||||
%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::TerrainObjectType; //|$TypeMasks::InteriorObjectType;
|
||||
%hit = ContainerRayCast(%muzzlePos, %endPos, %damageMasks, %obj);
|
||||
if (%hit) {
|
||||
%posr = getWords(%hit, 1, 3);
|
||||
%pos = VectorAdd(%posr, "0 0 300");
|
||||
%pos2 = VectorAdd(%posr, "0 0 -20");
|
||||
%b = new StaticShape() {
|
||||
position = %pos2;
|
||||
datablock = "LightningTarget";
|
||||
};
|
||||
%p = new Lightning() {
|
||||
scale = "1 1 1";
|
||||
position = %pos;
|
||||
rotation = "1 0 0 0";
|
||||
dataBlock = "DefaultStorm";
|
||||
strikesPerMinute = "120";
|
||||
strikeWidth = "10.0";
|
||||
chanceToHitTarget = "1";
|
||||
strikeRadius = "10";
|
||||
boltStartRadius = "15";
|
||||
color = "1.000000 1.000000 1.000000 1.000000";
|
||||
fadeColor = "0.300000 0.300000 1.000000 1.000000";
|
||||
useFog = "1";
|
||||
sourceObject = %obj;
|
||||
sourceSlot = %slot;
|
||||
vehicleObject = 0;
|
||||
};
|
||||
%p.strikeObject(%b);
|
||||
schedule(1000, 0, "LightningApplyDamage", %p, %pos, %pos2);
|
||||
%p.schedule(1500, "delete");
|
||||
%b.schedule(1500, "delete");
|
||||
}
|
||||
}
|
||||
|
||||
function LightningApplyDamage(%p, %pos, %pos2) {
|
||||
%damageMasks = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType;
|
||||
%hit = ContainerRayCast(%pos, %pos2, %damageMasks, 1);
|
||||
if (%hit)
|
||||
%pos2 = getWords(%hit, 1, 3);
|
||||
%xy = getWords(%pos, 0, 1);
|
||||
%z1 = getWord(%pos, 2) - 5;
|
||||
%z2 = getWord(%pos2, 2) + 5;
|
||||
while (%z1 > %z2) {
|
||||
%pos = %xy SPC %z1;
|
||||
RadiusExplosion(%p, %pos, 40, 0.4, 0, %p.sourceObject, $DamageType::Lightning);
|
||||
%z1 -= 19;
|
||||
}
|
||||
%pos = %xy SPC %z1;
|
||||
RadiusExplosion(%p, %pos, 40, 0.4, 0, %p.sourceObject, $DamageType::Lightning);
|
||||
}
|
||||
|
||||
datablock StaticShapeData(LightningTarget) {
|
||||
shapeFile = "turret_muzzlepoint.dts";
|
||||
targetNameTag = 'beacon';
|
||||
isInvincible = true;
|
||||
dynamicType = $TypeMasks::StaticObjectType;
|
||||
};
|
||||
1929
scripts/hud.cs
Normal file
1929
scripts/hud.cs
Normal file
File diff suppressed because it is too large
Load diff
922
scripts/inventory.cs
Normal file
922
scripts/inventory.cs
Normal file
|
|
@ -0,0 +1,922 @@
|
|||
|
||||
$host::nopulseSCG = 1; ///No super pulse powers for admins.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Item Datablocks
|
||||
// image = Name of mounted image datablock
|
||||
// onUse(%this,%object)
|
||||
|
||||
// Item Image Datablocks
|
||||
// item = Name of item inventory datablock
|
||||
|
||||
// ShapeBase Datablocks
|
||||
// max[Item] = Maximum amount that can be caried
|
||||
|
||||
// ShapeBase Objects
|
||||
// inv[Item] = Count of item in inventory
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
$TestCheats = 0;
|
||||
|
||||
function serverCmdUse(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
|
||||
%client.getControlObject().use(%data);
|
||||
}
|
||||
|
||||
function serverCmdThrow(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
%client.getControlObject().throw(%data);
|
||||
}
|
||||
|
||||
function serverCmdThrowWeapon(%client,%data)
|
||||
{
|
||||
// Item names from the client must converted
|
||||
// into DataBlocks
|
||||
// %data = ItemDataBlock[%item];
|
||||
%client.getControlObject().throwWeapon();
|
||||
}
|
||||
|
||||
function serverCmdThrowPack(%client,%data)
|
||||
{
|
||||
%client.getControlObject().throwPack();
|
||||
}
|
||||
|
||||
function serverCmdTogglePack(%client,%data)
|
||||
{
|
||||
// this function is apparently never called
|
||||
%client.getControlObject().togglePack();
|
||||
}
|
||||
|
||||
function serverCmdThrowFlag(%client)
|
||||
{
|
||||
//Game.playerDroppedFlag(%client.player);
|
||||
Game.dropFlag(%client.player);
|
||||
}
|
||||
|
||||
function serverCmdSelectWeaponSlot( %client, %data ) {
|
||||
%client.getControlObject().selectWeaponSlot( %data );
|
||||
if (%client.player)
|
||||
if (%client.player.getObjectMount())
|
||||
callEject(%client.player, %data);
|
||||
}
|
||||
|
||||
function callEject(%player, %num) {
|
||||
%veh = %player.getObjectMount();
|
||||
if (!(%veh.getType() & $TypeMasks::VehicleObjectType))
|
||||
return;
|
||||
if (%veh.getMountNodeObject(0) == %player) {
|
||||
%obj = %veh.getMountNodeObject(%num);
|
||||
if(%obj) {
|
||||
if (%obj.getType() & $TypeMasks::PlayerObjectType) {
|
||||
%obj.getDataBlock().doDismount(%obj, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%num == 5)
|
||||
%player.getDataBlock().doDismount(%player, 0, 1);
|
||||
}
|
||||
|
||||
function serverCmdCycleWeapon( %client, %data ) {
|
||||
%veh = 0;
|
||||
if (%client.player.station) {
|
||||
if (%client.player.station.getDataBlock().getName() $= "StationVehicle")
|
||||
%veh = 1;
|
||||
}
|
||||
if (%veh)
|
||||
cycleVehicleHud(%client.player,%client,%data);
|
||||
else
|
||||
%client.getControlObject().cycleWeapon( %data );
|
||||
}
|
||||
|
||||
function serverCmdStartThrowCount(%client, %data)
|
||||
{
|
||||
%client.player.throwStart = getSimTime();
|
||||
}
|
||||
|
||||
function serverCmdEndThrowCount(%client, %data)
|
||||
{
|
||||
if(%client.player.throwStart == 0)
|
||||
return;
|
||||
|
||||
// throwStrength will be how many seconds the key was held
|
||||
%throwStrength = (getSimTime() - %client.player.throwStart) / 150;
|
||||
// trim the time to fit between 0.5 and 1.5
|
||||
if(%throwStrength > 1.5)
|
||||
%throwStrength = 1.5;
|
||||
else if(%throwStrength < 0.5)
|
||||
%throwStrength = 0.5;
|
||||
|
||||
%throwScale = %throwStrength / 2;
|
||||
%client.player.throwStrength = %throwScale;
|
||||
|
||||
%client.player.throwStart = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function ShapeBase::throwWeapon(%this)
|
||||
{
|
||||
if(Game.shapeThrowWeapon(%this)) {
|
||||
%image = %this.getMountedImage($WeaponSlot);
|
||||
%this.throw(%image.item);
|
||||
%this.client.setWeaponsHudItem(%image.item, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function ShapeBase::throwPack(%this)
|
||||
{
|
||||
%image = %this.getMountedImage($BackpackSlot);
|
||||
%this.throw(%image.item);
|
||||
%this.client.setBackpackHudItem(%image.item, 0);
|
||||
}
|
||||
|
||||
function ShapeBase::throw(%this,%data)
|
||||
{
|
||||
if(!isObject(%data))
|
||||
return false;
|
||||
|
||||
if (%this.inv[%data.getName()] > 0) {
|
||||
|
||||
// save off the ammo count on this item
|
||||
if( %this.getInventory( %data ) < $AmmoIncrement[%data.getName()] )
|
||||
%data.ammoStore = %this.getInventory( %data );
|
||||
else
|
||||
%data.ammoStore = $AmmoIncrement[%data.getName()];
|
||||
|
||||
// Throw item first...
|
||||
%this.throwItem(%data);
|
||||
if($AmmoIncrement[%data.getName()] !$= "")
|
||||
%this.decInventory(%data,$AmmoIncrement[%data.getName()]);
|
||||
else
|
||||
%this.decInventory(%data,1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ShapeBase::use(%this, %data) {
|
||||
// if(%data.class $= "Weapon")
|
||||
// error("ShapeBase::use " @ %data);
|
||||
if(%data $= Grenade) {
|
||||
// Weapon modes
|
||||
|
||||
//[most] 'ey lets do some unification here.. :D
|
||||
if(%this.getMountedImage(0) && GetWord($weaponSettings1[%this.getMountedImage(0).getName()],0)) {
|
||||
if (!(GetSimTime() > (%this.grenadeModeTime + 100)))
|
||||
return;
|
||||
%this.grenadeModeTime = getSimTime(); //not 'that' unified.. ;)
|
||||
|
||||
return %this.getMountedImage(0).ChangeMode(%this,1,2); //looksie.. 2 stands for weapons (level 1)
|
||||
|
||||
}
|
||||
|
||||
//[most]
|
||||
|
||||
//start of modifier code
|
||||
if (%this.usingmodifier == 1 && getSimTime() > (%this.grenadeModeTime + 100) && %this.performing == 0) {
|
||||
%this.grenadeModeTime = getSimTime();
|
||||
%this.modifierMode2++;
|
||||
if (%this.modifierMode2 > getword($WeaponSetting2["modifier",%this.modifierMode],0))
|
||||
%this.modifierMode2 = 0;
|
||||
if (%this.modifierMode ==2)
|
||||
%line2 = getwords($packSetting["forcefield",%this.modifierMode2],5,19);
|
||||
else if (%this.modifierMode ==1)
|
||||
%line2 = getwords($WeaponSetting["modifier1",%this.modifierMode2],1,19);
|
||||
else if (%this.modifierMode ==3)
|
||||
%line2 = $WeaponSetting["modifier2",%this.modifierMode2];
|
||||
else if (%this.modifierMode ==4)
|
||||
%line2 = $WeaponSetting["modifier3",%this.modifierMode2];
|
||||
else if (%this.modifierMode ==5)
|
||||
%line2 = $WeaponSetting["modifier4",%this.modifierMode2];
|
||||
else
|
||||
%line2 = $WeaponSetting["modifier0",%this.modifierMode2];
|
||||
%line1 = $WeaponSetting2["modifier",%this.modifierMode];
|
||||
bottomPrint(%this.client,"Modifier Tool ["@ %line1 @" ] set to" SPC %line2,2,1);
|
||||
return;
|
||||
}
|
||||
//end of modifier modes
|
||||
|
||||
if (%this.usingConstructionTool == 1 && getSimTime() > (%this.grenadeModeTime + 100) && %this.performing == 0) {
|
||||
%this.grenadeModeTime = getSimTime();
|
||||
if (%this.constructionToolMode == 0) {
|
||||
if (%this.constructionToolMode2 == 1) {
|
||||
%this.constructionToolMode2 = 0;
|
||||
bottomPrint(%this.client,"Normal deconstruction",2,1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%this.constructionToolMode2 = 1;
|
||||
bottomPrint(%this.client,"Cascading deconstruction",2,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (%this.constructionToolMode == 1) {
|
||||
if (%this.constructionToolMode2 == 1) {
|
||||
%this.constructionToolMode2 = 0;
|
||||
bottomPrint(%this.client,"Rotate push",2,1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%this.constructionToolMode2 = 1;
|
||||
bottomPrint(%this.client,"Rotate pull",2,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (%this.constructionToolMode == 2) {
|
||||
if (%this.constructionToolMode2 == 5) {
|
||||
%this.constructionToolMode2 = 0;
|
||||
bottomPrint(%this.client,"Select target as center of rotation",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 0) {
|
||||
%this.constructionToolMode2 = 1;
|
||||
bottomPrint(%this.client,"Select objects to rotate",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 1) {
|
||||
%this.constructionToolMode2 = 2;
|
||||
bottomPrint(%this.client,"Select rotation speed",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 2) {
|
||||
%this.constructionToolMode2 = 3;
|
||||
bottomPrint(%this.client,"Apply rotation",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 3) {
|
||||
%this.constructionToolMode2 = 4;
|
||||
bottomPrint(%this.client,"Display selection",2,1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%this.constructionToolMode2 = 5;
|
||||
bottomPrint(%this.client,"Clear list",2,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (%this.constructionToolMode2 == 3) {
|
||||
%this.constructionToolMode2 = 0;
|
||||
bottomPrint(%this.client,"Toggle generator power state",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 0) {
|
||||
%this.constructionToolMode2 = 1;
|
||||
bottomPrint(%this.client,"Increase current frequency",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.constructionToolMode2 == 1) {
|
||||
%this.constructionToolMode2 = 2;
|
||||
bottomPrint(%this.client,"Decrease current frequency",2,1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%this.constructionToolMode2 = 3;
|
||||
bottomPrint(%this.client,"Read power state",2,1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%this.usingSuperChaingun == 1) {
|
||||
if (!(getSimTime() > (%this.grenadeModeTime + 100)))
|
||||
return;
|
||||
%this.grenadeModeTime = getSimTime();
|
||||
if (%this.superChaingunMode == 1) {
|
||||
if ($Ion::StopIon == 1) {
|
||||
$Ion::StopIon = 0;
|
||||
displaySCGStatus(%this);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$Ion::StopIon = 1;
|
||||
displaySCGStatus(%this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// figure out which grenade type you're using
|
||||
for(%x = 0; $InvGrenade[%x] !$= ""; %x++) {
|
||||
if(%this.inv[$NameToInv[$InvGrenade[%x]]] > 0) {
|
||||
%data = $NameToInv[$InvGrenade[%x]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%data $= "Backpack") {
|
||||
%pack = %this.getMountedImage($BackpackSlot);
|
||||
// if you don't have a pack but have placed a satchel charge, detonate it
|
||||
if(!%pack && (%this.thrownChargeId > 0) && %this.thrownChargeId.armed ) {
|
||||
if (!$Host::SatchelChargeEnabled) {
|
||||
if (isObject(%this.client)) {
|
||||
if ($Host::Purebuild == 1)
|
||||
messageAll('msgClient','\c2%1 just tried to detonate a Satchel Charge!',%this.client.name);
|
||||
else
|
||||
messageTeam(%this.client.team,'msgClient','\c2%1 just tried to detonate a Satchel Charge!',%this.client.name);
|
||||
%this.client.clearBackPackIcon();
|
||||
}
|
||||
%this.thrownChargeId.delete();
|
||||
%this.thrownChargeId = "0";
|
||||
return;
|
||||
}
|
||||
else {
|
||||
%this.playAudio( 0, SatchelChargeExplosionSound );
|
||||
schedule( 800, %this, "detonateSatchelCharge", %this );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(%data $= Beacon) {
|
||||
%data.onUse(%this);
|
||||
if (%this.inv[%data.getName()] > 0)
|
||||
return true;
|
||||
}
|
||||
// Pack modes
|
||||
if (%data $= "RepairKit") {
|
||||
if ($Host::ExpertMode == 1) { // Only use in Expert Mode
|
||||
if (%this.hasForceField) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["forcefield"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["forcefield",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
//[most] Again using the unified plugin code. See item.cs for reference.
|
||||
else if(%this.getMountedImage(2) && GetWord($packSettings[%this.getMountedImage(2).getName()],0)) {
|
||||
%changed = %this.getMountedImage(2).ChangeMode(%this,1,1);
|
||||
return "";
|
||||
}
|
||||
//[most]
|
||||
else if (%this.hasGravField) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["gravfield"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["gravfield",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasFloor) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["floor"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["floor",%this.expertSet];
|
||||
bottomPrint(%this.client,"Floor set to" SPC %line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasBlast) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["blast"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["blast",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasWalk) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["walk"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["walk",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasMSpine) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["mspine"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["mspine",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasSwitch) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["switch"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["switch",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasTripwire) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["tripwire"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["tripwire",%this.expertSet];
|
||||
bottomPrint(%this.client,%line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasTree) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["tree"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["tree",%this.expertSet];
|
||||
bottomPrint(%this.client,"Tree set to " @ %line * 100 @ "% scale",2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasTele) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["telepad"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["telepad",%this.expertSet];
|
||||
bottomPrint(%this.client,"Telepad set to " @ %line,2,1);
|
||||
return;
|
||||
}
|
||||
else if (%this.hasDoor) {
|
||||
%this.expertSet++;
|
||||
if (%this.expertSet > $expertSettings["Door"])
|
||||
%this.expertSet = 0;
|
||||
%line = $expertSetting["Door",%this.expertSet];
|
||||
bottomPrint(%this.client,"Door close timeout:" SPC %line,2,1);
|
||||
return;
|
||||
}
|
||||
if (%this.getDamageLevel() != 0 && $Host::Purebuild == 1) {
|
||||
%this.applyRepair(0.2);
|
||||
messageClient(%this.client, 'MsgRepairKitUsed', '\c2Repair Kit Used.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Weapon modes
|
||||
if (%data $= "Mine") {
|
||||
|
||||
//[most] 'ey lets do some more unification here.. :D
|
||||
if(%this.getMountedImage(0) && GetWord($weaponSettings2[%this.getMountedImage(0).getName()],0)) {
|
||||
if(!GetSimTime() > (%this.grenadeModeTime + 100))
|
||||
return;
|
||||
%this.grenadeModeTime = getSimTime(); //not 'that' unified.. ;)
|
||||
|
||||
return %this.getMountedImage(0).ChangeMode(%this,1,3); //looksie.. 3 stands for weapons (level 2)
|
||||
}
|
||||
|
||||
//[most]
|
||||
//modifier tool
|
||||
if (%this.usingmodifier == 1 && getSimTime() > (%this.grenadeModeTime + 100) && %this.performing == 0) {
|
||||
%this.grenadeModeTime = getSimTime();
|
||||
%this.modifierMode++;
|
||||
if (%this.modifierMode > $WeaponSettings2["modifier"])
|
||||
%this.modifierMode = 0;
|
||||
%line = $WeaponSetting2["modifier",%this.modifierMode];
|
||||
//if (%this.modifierMode==5)
|
||||
// %line = $WeaponSetting2["modifier",%this.modifierMode];
|
||||
bottomPrint(%this.client,"Modifier tool " SPC getWords(%line,1,getWordCount(%line)) SPC "\nUse the Modifier Scaler options to change the Nudge/Scale rate.",10,3);
|
||||
return; //return to the top
|
||||
}
|
||||
//end modifier tool
|
||||
if (%this.usingConstructionTool == 1 && getSimTime() > (%this.mineModeTime + 100) && %this.performing == 0) {
|
||||
%this.mineModeTime = getSimTime();
|
||||
if (%this.constructionToolMode == 3) {
|
||||
%this.constructionToolMode = 0;
|
||||
bottomPrint(%this.client,"Construction Tool mode set to deconstruct",2,1);
|
||||
}
|
||||
else if (%this.constructionToolMode == 0 && $Host::Purebuild == 1) {
|
||||
%this.constructionToolMode = 1;
|
||||
bottomPrint(%this.client,"Construction Tool mode set to rotate",2,1);
|
||||
}
|
||||
else if (%this.constructionToolMode == 1 && $Host::Purebuild == 1) {
|
||||
%this.constructionToolMode = 2;
|
||||
bottomPrint(%this.client,"Construction Tool mode set to advanced rotate",2,1);
|
||||
}
|
||||
else {
|
||||
%powerFreq = %this.powerFreq;
|
||||
if (%powerFreq < 1 || %powerFreq > upperPowerFreq(%this) || !%powerFreq)
|
||||
%powerFreq = 1;
|
||||
%this.powerFreq = %powerFreq;
|
||||
%this.constructionToolMode = 3;
|
||||
bottomPrint(%this.client,"Construction Tool mode set to power management\nPower frequency currently set to: " @ %this.powerFreq,2,2);
|
||||
}
|
||||
%this.constructionToolMode2 = 0;
|
||||
return;
|
||||
}
|
||||
if (%this.usingSuperChaingun == 1) {
|
||||
if (!(getSimTime() > (%this.mineModeTime + 100)))
|
||||
return;
|
||||
%this.mineModeTime = getSimTime();
|
||||
%this.superChaingunMode++;
|
||||
if (%this.superChaingunMode > 6 - (5 * $host::nopulseSCG)) {
|
||||
%this.superChaingunMode = 0;
|
||||
}
|
||||
displaySCGStatus(%this);
|
||||
%this.superChaingunMode2 = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// default case
|
||||
if (isObject(%data)) {
|
||||
if (%this.inv[%data.getName()] > 0) {
|
||||
%data.onUse(%this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ShapeBase::pickup(%this,%obj,%amount) {
|
||||
%data = %obj.getDatablock();
|
||||
%delta = %this.incInventory(%data,%amount);
|
||||
|
||||
if (%delta)
|
||||
%data.onPickup(%obj,%this,%delta);
|
||||
return %delta;
|
||||
}
|
||||
|
||||
function ShapeBase::hasInventory(%this, %data)
|
||||
{
|
||||
// changed because it was preventing weapons cycling correctly (MES)
|
||||
return (%this.inv[%data] > 0);
|
||||
}
|
||||
|
||||
function ShapeBase::maxInventory(%this,%data) {
|
||||
if($TestCheats && %this.getDatablock().max[%data.getName()] !$= "")
|
||||
return 999;
|
||||
else
|
||||
return %this.getDatablock().max[%data.getName()];
|
||||
}
|
||||
|
||||
function ShapeBase::incInventory(%this,%data,%amount) {
|
||||
%max = %this.maxInventory(%data);
|
||||
%cv = %this.inv[%data.getName()];
|
||||
if (%cv < %max) {
|
||||
if (%cv + %amount > %max)
|
||||
%amount = %max - %cv;
|
||||
%this.setInventory(%data,%cv + %amount);
|
||||
%data.incCatagory(%this); // Inc the players weapon count
|
||||
return %amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function ShapeBase::decInventory(%this,%data,%amount)
|
||||
{
|
||||
%name = %data.getName();
|
||||
%cv = %this.inv[%name];
|
||||
if (%cv > 0) {
|
||||
if (%cv < %amount)
|
||||
%amount = %cv;
|
||||
%this.setInventory(%data,%cv - %amount, true);
|
||||
%data.decCatagory(%this); // Dec the players weapon count
|
||||
return %amount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function SimObject::decCatagory(%this)
|
||||
{
|
||||
//function was added to reduce console err msg spam
|
||||
}
|
||||
|
||||
function SimObject::incCatagory(%this)
|
||||
{
|
||||
//function was added to reduce console err msg spam
|
||||
}
|
||||
|
||||
function ShapeBase::setInventory(%this,%data,%value,%force)
|
||||
{
|
||||
if (!isObject(%data))
|
||||
return;
|
||||
|
||||
%name = %data.getName();
|
||||
if (%value < 0)
|
||||
%value = 0;
|
||||
else
|
||||
{
|
||||
if (!%force)
|
||||
{
|
||||
// Impose inventory limits
|
||||
%max = %this.maxInventory(%data);
|
||||
if (%value > %max)
|
||||
%value = %max;
|
||||
}
|
||||
}
|
||||
if (%this.inv[%name] != %value)
|
||||
{
|
||||
%this.inv[%name] = %value;
|
||||
%data.onInventory(%this,%value);
|
||||
|
||||
if ( %data.className $= "Weapon" )
|
||||
{
|
||||
if ( %this.weaponSlotCount $= "" )
|
||||
%this.weaponSlotCount = 0;
|
||||
|
||||
%cur = -1;
|
||||
for ( %slot = 0; %slot < %this.weaponSlotCount; %slot++ )
|
||||
{
|
||||
if ( %this.weaponSlot[%slot] $= %name )
|
||||
{
|
||||
%cur = %slot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %cur == -1 )
|
||||
{
|
||||
// Put this weapon in the next weapon slot:
|
||||
if ( %this.weaponSlot[%this.weaponSlotCount - 1] $= "TargetingLaser" )
|
||||
{
|
||||
%this.weaponSlot[%this.weaponSlotCount - 1] = %name;
|
||||
%this.weaponSlot[%this.weaponSlotCount] = "TargetingLaser";
|
||||
}
|
||||
else
|
||||
%this.weaponSlot[%this.weaponSlotCount] = %name;
|
||||
%this.weaponSlotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the weapon from the weapon slot:
|
||||
for ( %i = %cur; %i < %this.weaponSlotCount - 1; %i++ )
|
||||
%this.weaponSlot[%i] = %this.weaponSlot[%i + 1];
|
||||
%this.weaponSlot[%i] = "";
|
||||
%this.weaponSlotCount--;
|
||||
}
|
||||
}
|
||||
|
||||
%this.getDataBlock().onInventory(%data,%value);
|
||||
}
|
||||
return %value;
|
||||
}
|
||||
|
||||
function ShapeBase::getInventory(%this,%data)
|
||||
{
|
||||
if ( isObject( %data ) )
|
||||
return( %this.inv[%data.getName()] );
|
||||
else
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
// z0dd - ZOD, 9/13/02. Streamlined.
|
||||
function ShapeBase::hasAmmo( %this, %weapon )
|
||||
{
|
||||
if(%weapon $= LaserRifle)
|
||||
return( %this.getInventory( EnergyPack ) );
|
||||
|
||||
if (%weapon.image.ammo $= "")
|
||||
{
|
||||
if (%weapon $= TargetingLaser)
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return( %this.getInventory( %weapon.image.ammo ) > 0 );
|
||||
}
|
||||
}
|
||||
|
||||
function SimObject::onInventory(%this, %obj)
|
||||
{
|
||||
//function was added to reduce console error msg spam
|
||||
}
|
||||
|
||||
function ShapeBase::throwItem(%this,%data)
|
||||
{
|
||||
%item = new Item() {
|
||||
dataBlock = %data;
|
||||
rotation = "0 0 1 " @ (getRandom() * 360);
|
||||
};
|
||||
|
||||
%item.ammoStore = %data.ammoStore;
|
||||
MissionCleanup.add(%item);
|
||||
%this.throwObject(%item);
|
||||
}
|
||||
|
||||
function ShapeBase::throwObject(%this,%obj)
|
||||
{
|
||||
//-------------------------------------------
|
||||
// z0dd - ZOD, 5/27/02. Fixes flags hovering
|
||||
// over friendly player when collision occurs
|
||||
if(%obj.getDataBlock().getName() $= "Flag")
|
||||
%obj.static = false;
|
||||
//-------------------------------------------
|
||||
|
||||
//if the object is being thrown by a corpse, use a random vector
|
||||
if (%this.getState() $= "Dead")
|
||||
{
|
||||
%vec = (-1.0 + getRandom() * 2.0) SPC (-1.0 + getRandom() * 2.0) SPC getRandom();
|
||||
%vec = vectorScale(%vec, 10);
|
||||
}
|
||||
|
||||
// else Initial vel based on the dir the player is looking
|
||||
else
|
||||
{
|
||||
%eye = %this.getEyeVector();
|
||||
%vec = vectorScale(%eye, 20);
|
||||
}
|
||||
|
||||
// Add a vertical component to give the item a better arc
|
||||
%dot = vectorDot("0 0 1",%eye);
|
||||
if (%dot < 0)
|
||||
%dot = -%dot;
|
||||
%vec = vectorAdd(%vec,vectorScale("0 0 8",1 - %dot));
|
||||
|
||||
// Add player's velocity
|
||||
%vec = vectorAdd(%vec,%this.getVelocity());
|
||||
%pos = getBoxCenter(%this.getWorldBox());
|
||||
|
||||
//since flags have a huge mass (so when you shoot them, they don't bounce too far)
|
||||
//we need to up the %vec so that you can still throw them...
|
||||
if (%obj.getDataBlock().getName() $= "Flag")
|
||||
%vec = vectorScale(%vec, 40);
|
||||
|
||||
//
|
||||
%obj.setTransform(%pos);
|
||||
%obj.applyImpulse(%pos,%vec);
|
||||
%obj.setCollisionTimeout(%this);
|
||||
%data = %obj.getDatablock();
|
||||
%data.onThrow(%obj,%this);
|
||||
|
||||
//call the AI hook
|
||||
AIThrowObject(%obj);
|
||||
}
|
||||
|
||||
function ShapeBase::clearInventory(%this)
|
||||
{
|
||||
%this.setInventory(RepairKit,0);
|
||||
|
||||
%this.setInventory(Mine,0);
|
||||
//%this.setInventory(MineAir,0);
|
||||
//%this.setInventory(MineLand,0);
|
||||
//%this.setInventory(MineSticky,0);
|
||||
%this.setInventory(ConstructionTool,0);
|
||||
%this.setInventory(Grenade,0);
|
||||
%this.setInventory(FlashGrenade,0);
|
||||
%this.setInventory(ConcussionGrenade,0);
|
||||
%this.setInventory(FlareGrenade,0);
|
||||
%this.setInventory(CameraGrenade, 0);
|
||||
|
||||
%this.setInventory(Blaster,0);
|
||||
%this.setInventory(Plasma,0);
|
||||
%this.setInventory(Disc,0);
|
||||
%this.setInventory(Chaingun, 0);
|
||||
%this.setInventory(Mortar, 0);
|
||||
%this.setInventory(GrenadeLauncher, 0);
|
||||
%this.setInventory(MissileLauncher, 0);
|
||||
%this.setInventory(SniperRifle, 0);
|
||||
%this.setInventory(TargetingLaser, 0);
|
||||
%this.setInventory(ELFGun, 0);
|
||||
%this.setInventory(ShockLance, 0);
|
||||
|
||||
%this.setInventory(PlasmaAmmo,0);
|
||||
%this.setInventory(ChaingunAmmo, 0);
|
||||
%this.setInventory(DiscAmmo, 0);
|
||||
%this.setInventory(GrenadeLauncherAmmo, 0);
|
||||
%this.setInventory(MissileLauncherAmmo, 0);
|
||||
%this.setInventory(MortarAmmo, 0);
|
||||
%this.setInventory(Beacon, 0);
|
||||
|
||||
%this.setInventory(NerfGun, 0);
|
||||
%this.setInventory(NerfBallLauncher, 0);
|
||||
%this.setInventory(NerfBallLauncherAmmo, 0);
|
||||
%this.setInventory(SuperChaingun, 0);
|
||||
%this.setInventory(SuperChaingunAmmo, 0);
|
||||
%this.setInventory(MergeTool,0);
|
||||
|
||||
%this.setInventory(TractorGun, 0);
|
||||
%this.setInventory(TransGun, 0);
|
||||
|
||||
// take away any pack the player has
|
||||
%curPack = %this.getMountedImage($BackpackSlot);
|
||||
if(%curPack > 0)
|
||||
%this.setInventory(%curPack.item, 0);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function ShapeBase::cycleWeapon( %this, %data )
|
||||
{
|
||||
if ( %this.weaponSlotCount == 0 )
|
||||
return;
|
||||
|
||||
%slot = -1;
|
||||
if ( %this.getMountedImage($WeaponSlot) != 0 )
|
||||
{
|
||||
%curWeapon = %this.getMountedImage($WeaponSlot).item.getName();
|
||||
for ( %i = 0; %i < %this.weaponSlotCount; %i++ )
|
||||
{
|
||||
//error("curWeaponName == " @ %curWeaponName);
|
||||
if ( %curWeapon $= %this.weaponSlot[%i] )
|
||||
{
|
||||
%slot = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( %data $= "prev" )
|
||||
{
|
||||
// Previous weapon...
|
||||
if ( %slot == 0 || %slot == -1 )
|
||||
{
|
||||
%i = %this.weaponSlotCount - 1;
|
||||
%slot = 0;
|
||||
}
|
||||
else
|
||||
%i = %slot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Next weapon...
|
||||
if ( %slot == ( %this.weaponSlotCount - 1 ) || %slot == -1 )
|
||||
{
|
||||
%i = 0;
|
||||
%slot = ( %this.weaponSlotCount - 1 );
|
||||
}
|
||||
else
|
||||
%i = %slot + 1;
|
||||
}
|
||||
|
||||
%newSlot = -1;
|
||||
while ( %i != %slot )
|
||||
{
|
||||
if ( %this.weaponSlot[%i] !$= ""
|
||||
&& %this.hasInventory( %this.weaponSlot[%i] )
|
||||
&& %this.hasAmmo( %this.weaponSlot[%i] ) )
|
||||
{
|
||||
// player has this weapon and it has ammo or doesn't need ammo
|
||||
%newSlot = %i;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( %data $= "prev" )
|
||||
{
|
||||
if ( %i == 0 )
|
||||
%i = %this.weaponSlotCount - 1;
|
||||
else
|
||||
%i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( %i == ( %this.weaponSlotCount - 1 ) )
|
||||
%i = 0;
|
||||
else
|
||||
%i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( %newSlot != -1 )
|
||||
%this.use( %this.weaponSlot[%newSlot] );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
function ShapeBase::selectWeaponSlot( %this, %data )
|
||||
{
|
||||
if ( %data < 0 || %data > %this.weaponSlotCount
|
||||
|| %this.weaponSlot[%data] $= "" || %this.weaponSlot[%data] $= "TargetingLaser" )
|
||||
return;
|
||||
|
||||
%this.use( %this.weaponSlot[%data] );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function serverCmdGiveAll(%client)
|
||||
{
|
||||
if($TestCheats)
|
||||
{
|
||||
%player = %client.player;
|
||||
%player.setInventory(RepairKit,999);
|
||||
%player.setInventory(Mine,999);
|
||||
//%player.setInventory(MineAir,999);
|
||||
//%player.setInventory(MineLand,999);
|
||||
//%player.setInventory(MineSticky,999);
|
||||
%player.setInventory(Grenade,999);
|
||||
%player.setInventory(FlashGrenade,999);
|
||||
%player.setInventory(FlareGrenade,999);
|
||||
%player.setInventory(ConcussionGrenade,999);
|
||||
%player.setInventory(CameraGrenade, 999);
|
||||
%player.setInventory(Blaster,1);
|
||||
%player.setInventory(Plasma,1);
|
||||
%player.setInventory(Chaingun, 1);
|
||||
%player.setInventory(Disc,1);
|
||||
%player.setInventory(GrenadeLauncher, 1);
|
||||
%player.setInventory(SniperRifle, 1);
|
||||
%player.setInventory(ELFGun, 1);
|
||||
%player.setInventory(Mortar, 1);
|
||||
%player.setInventory(MissileLauncher, 1);
|
||||
%player.setInventory(ShockLance, 1);
|
||||
%player.setInventory(TargetingLaser, 1);
|
||||
%player.setInventory(MissileLauncherAmmo, 999);
|
||||
%player.setInventory(GrenadeLauncherAmmo, 999);
|
||||
%player.setInventory(MortarAmmo, 999);
|
||||
%player.setInventory(PlasmaAmmo,999);
|
||||
%player.setInventory(ChaingunAmmo, 999);
|
||||
%player.setInventory(DiscAmmo, 999);
|
||||
%player.setInventory(Beacon, 999);
|
||||
|
||||
%player.setInventory(NerfGun,1);
|
||||
%player.setInventory(NerfBallLauncher,1);
|
||||
%player.setInventory(NerfBallLauncherAmmo,999);
|
||||
%player.setInventory(MergeTool,1);
|
||||
|
||||
%player.setInventory(TractorGun, 1);
|
||||
%player.setInventory(TransGun, 1);
|
||||
}
|
||||
}
|
||||
1503
scripts/inventoryHud.cs
Normal file
1503
scripts/inventoryHud.cs
Normal file
File diff suppressed because it is too large
Load diff
1012
scripts/ion.cs
Normal file
1012
scripts/ion.cs
Normal file
File diff suppressed because it is too large
Load diff
1086
scripts/item.cs
Normal file
1086
scripts/item.cs
Normal file
File diff suppressed because it is too large
Load diff
362
scripts/libraries.cs
Normal file
362
scripts/libraries.cs
Normal file
|
|
@ -0,0 +1,362 @@
|
|||
//Contain basic data libraries.
|
||||
//Soon to be updated with more usefull stuff.
|
||||
|
||||
// NOTE - any changes here must be considered in expertlibraries.cs !!!
|
||||
|
||||
//** New format of information **
|
||||
|
||||
$packSettings["spine"] = 7;
|
||||
$packSetting["spine",0] = "0.5 0.5 1.5 1.5 meters in height";
|
||||
$packSetting["spine",1] = "0.5 0.5 4 4 meters in height";
|
||||
$packSetting["spine",2] = "0.5 0.5 8 8 meters in height";
|
||||
$packSetting["spine",3] = "0.5 0.5 40 40 meters in height";
|
||||
$packSetting["spine",4] = "0.5 0.5 160 160 meters in height";
|
||||
$packSetting["spine",5] = "0.5 6 160 auto adjusting";
|
||||
$packSetting["spine",6] = "0.5 8 160 pad";
|
||||
$packSetting["spine",7] = "0.5 8 160 wooden pad";
|
||||
|
||||
$packSettings["mspine"] = 7;
|
||||
$packSetting["mspine",0] = "1 1 1 2 2 0.5 1 meters in height";
|
||||
$packSetting["mspine",1] = "1 1 4 2 2 0.5 4 meters in height";
|
||||
$packSetting["mspine",2] = "1 1 8 2 2 0.5 8 meters in height";
|
||||
$packSetting["mspine",3] = "1 1 40 2 2 0.5 40 meters in height";
|
||||
$packSetting["mspine",4] = "1 1 160 2 2 0.5 160 meters in height";
|
||||
$packSetting["mspine",5] = "1 8 160 2 2 0.5 auto adjusting";
|
||||
$packSetting["mspine",6] = "1 6 160 2 2 0.5 normal rings";
|
||||
$packSetting["mspine",7] = "1 8 160 8 8 0.5 platform rings";
|
||||
|
||||
$expertSettings["mspine"] = 1;
|
||||
$expertSetting["mspine",0] = "Rings disabled";
|
||||
$expertSetting["mspine",1] = "Rings enabled";
|
||||
|
||||
$packSettings["floor"] = 5;
|
||||
$packSetting["floor",0] = "10 10 20 10 10 10 10 meters wide";
|
||||
$packSetting["floor",1] = "20 20 20 20 20 20 20 meters wide";
|
||||
$packSetting["floor",2] = "30 30 20 30 30 30 30 meters wide";
|
||||
$packSetting["floor",3] = "40 40 20 40 40 40 40 meters wide";
|
||||
$packSetting["floor",4] = "50 50 20 50 50 50 50 meters wide";
|
||||
$packSetting["floor",5] = "60 60 20 60 60 60 60 meters wide";
|
||||
|
||||
$expertSettings["floor"] = 4;
|
||||
$expertSetting["floor",0] = "1.5 meters in height";
|
||||
$expertSetting["floor",1] = "5 meters in height";
|
||||
$expertSetting["floor",2] = "10 meters in height";
|
||||
$expertSetting["floor",3] = "20 meters in height";
|
||||
$expertSetting["floor",4] = "40 meters in height";
|
||||
|
||||
$packSettings["walk"] = 12;
|
||||
$packSetting["walk",0] = "0 flat";
|
||||
$packSetting["walk",1] = "5 Sloped 5 degrees up";
|
||||
$packSetting["walk",2] = "10 Sloped 10 degrees up";
|
||||
$packSetting["walk",3] = "20 Sloped 20 degrees up";
|
||||
$packSetting["walk",4] = "45 Sloped 45 degrees up";
|
||||
$packSetting["walk",5] = "60 Sloped 60 degrees up";
|
||||
$packSetting["walk",6] = "90 Sloped 90 degrees up";
|
||||
$packSetting["walk",7] = "-5 Sloped 5 degrees down";
|
||||
$packSetting["walk",8] = "-10 Sloped 10 degrees down";
|
||||
$packSetting["walk",9] = "-20 Sloped 20 degrees down";
|
||||
$packSetting["walk",10] = "-45 Sloped 45 degrees down";
|
||||
$packSetting["walk",11] = "-60 Sloped 60 degrees down";
|
||||
$packSetting["walk",12] = "-90 Sloped 90 degrees down";
|
||||
|
||||
$expertSettings["walk"] = 3;
|
||||
$expertSetting["walk",0] = "Normal walkway";
|
||||
$expertSetting["walk",1] = "No-flicker walkway";
|
||||
$expertSetting["walk",2] = "Double width walkway";
|
||||
$expertSetting["walk",3] = "Double height walkway";
|
||||
|
||||
$packSettings["blast"] = 3;
|
||||
$packSetting["blast",0] = "deploy from inside";
|
||||
$packSetting["blast",1] = "deploy in frame";
|
||||
$packSetting["blast",2] = "deploy from outside";
|
||||
$packSetting["blast",3] = "deploy full thickness";
|
||||
|
||||
$expertSettings["blast"] = 1;
|
||||
$expertSetting["blast",0] = "Normal Blast Wall";
|
||||
$expertSetting["blast",1] = "Multiple Blast Walls";
|
||||
|
||||
$packSettings["forcefield"] = 20;
|
||||
$packSetting["forcefield",0] = "0.5 8 160 (7) Force field set to <color:ffffff>solid <color:ffffff>white";
|
||||
$packSetting["forcefield",1] = "0.5 8 160 (6) Force field set to <color:ffffff>solid <color:ff4444> red";
|
||||
$packSetting["forcefield",2] = "0.5 8 160 (5) Force field set to <color:ffffff>solid <color:44ff44> green";
|
||||
$packSetting["forcefield",3] = "0.5 8 160 (4) Force field set to <color:ffffff>solid <color:4444ff> blue";
|
||||
$packSetting["forcefield",4] = "0.5 8 160 (3) Force field set to <color:ffffff>solid <color:44ffff> cyan";
|
||||
$packSetting["forcefield",5] = "0.5 8 160 (2) Force field set to <color:ffffff>solid <color:ff44ff> magenta";
|
||||
$packSetting["forcefield",6] = "0.5 8 160 (1) Force field set to <color:ffffff>solid <color:ffff44> yellow";
|
||||
$packSetting["forcefield",7] = "0.5 8 160 (7) Force field set to <color:44ff44>team-pass <color:ffffff>white";
|
||||
$packSetting["forcefield",8] = "0.5 8 160 (6) Force field set to <color:44ff44>team-pass <color:ff4444> red";
|
||||
$packSetting["forcefield",9] = "0.5 8 160 (5) Force field set to <color:44ff44>team-pass <color:44ff44> green";
|
||||
$packSetting["forcefield",10] = "0.5 8 160 (4) Force field set to <color:44ff44>team-pass <color:4444ff> blue";
|
||||
$packSetting["forcefield",11] = "0.5 8 160 (3) Force field set to <color:44ff44>team-pass <color:44ffff> cyan";
|
||||
$packSetting["forcefield",12] = "0.5 8 160 (2) Force field set to <color:44ff44>team-pass <color:ff44ff> magenta";
|
||||
$packSetting["forcefield",13] = "0.5 8 160 (1) Force field set to <color:44ff44>team-pass <color:ffff44> yellow";
|
||||
$packSetting["forcefield",14] = "0.5 8 160 (7) Force field set to <color:ff4444>all-pass <color:ffffff>white";
|
||||
$packSetting["forcefield",15] = "0.5 8 160 (6) Force field set to <color:ff4444>all-pass <color:ff4444> red";
|
||||
$packSetting["forcefield",16] = "0.5 8 160 (5) Force field set to <color:ff4444>all-pass <color:44ff44> green";
|
||||
$packSetting["forcefield",17] = "0.5 8 160 (4) Force field set to <color:ff4444>all-pass <color:4444ff> blue";
|
||||
$packSetting["forcefield",18] = "0.5 8 160 (3) Force field set to <color:ff4444>all-pass <color:44ffff> cyan";
|
||||
$packSetting["forcefield",19] = "0.5 8 160 (2) Force field set to <color:ff4444>all-pass <color:ff44ff> magenta";
|
||||
$packSetting["forcefield",20] = "0.5 8 160 (1) Force field set to <color:ff4444>all-pass <color:ffff44> yellow";
|
||||
|
||||
$expertSettings["forcefield"] = 3;
|
||||
$expertSetting["forcefield",0] = "Normal force field";
|
||||
$expertSetting["forcefield",1] = "Cubic-replace force field";
|
||||
$expertSetting["forcefield",2] = "Normal force field - no slowdown";
|
||||
$expertSetting["forcefield",3] = "Cubic-replace force field - no slowdown";
|
||||
|
||||
$packSettings["gravfield"] = 4;
|
||||
$packSetting["gravfield",0] = "4.25 8 500 normal slow";
|
||||
$packSetting["gravfield",1] = "4.25 8 500 normal fast";
|
||||
$packSetting["gravfield",2] = "4.25 8 500 reverse slow";
|
||||
$packSetting["gravfield",3] = "4.25 8 500 reverse fast";
|
||||
$packSetting["gravfield",4] = "4.25 8 500 zero gravity";
|
||||
//
|
||||
$packSetting["gravfield",5] = "4.25 8 500 fastfield";
|
||||
$packSetting["gravfield",6] = "4.25 8 500 super fastfield";
|
||||
|
||||
$expertSettings["gravfield"] = 2;
|
||||
$expertSetting["gravfield",0] = "Normal gravity field";
|
||||
$expertSetting["gravfield",1] = "Cubic-replace gravity field (player's orientation)";
|
||||
$expertSetting["gravfield",2] = "Cubic-replace gravity field (object's orientation)";
|
||||
|
||||
$packSettings["jumpad"] = 3;
|
||||
$packSetting["jumpad",0] = "1000 10 boost";
|
||||
$packSetting["jumpad",1] = "2500 25 boost";
|
||||
$packSetting["jumpad",2] = "5000 50 boost";
|
||||
$packSetting["jumpad",3] = "10000 100 boost";
|
||||
|
||||
$packSettings["tree"] = 13;
|
||||
$packSetting["tree",0] = "normal 1";
|
||||
$packSetting["tree",1] = "normal 2";
|
||||
$packSetting["tree",2] = "normal 3";
|
||||
$packSetting["tree",3] = "normal 4";
|
||||
$packSetting["tree",4] = "greywood 1";
|
||||
$packSetting["tree",5] = "greywood 2";
|
||||
$packSetting["tree",6] = "greywood 3";
|
||||
$packSetting["tree",7] = "greywood 4";
|
||||
$packSetting["tree",8] = "greywood 5";
|
||||
$packSetting["tree",9] = "cactus 1";
|
||||
$packSetting["tree",10] = "cactus 2";
|
||||
$packSetting["tree",11] = "misc 1";
|
||||
$packSetting["tree",12] = "misc 2";
|
||||
$packSetting["tree",13] = "pod 1";
|
||||
|
||||
$expertSettings["tree"] = 14;
|
||||
$expertSetting["tree",0] = "0.0625";
|
||||
$expertSetting["tree",1] = "0.125";
|
||||
$expertSetting["tree",2] = "0.25";
|
||||
$expertSetting["tree",3] = "0.5";
|
||||
$expertSetting["tree",4] = "0.75";
|
||||
$expertSetting["tree",5] = "1";
|
||||
$expertSetting["tree",6] = "2";
|
||||
$expertSetting["tree",7] = "3";
|
||||
$expertSetting["tree",8] = "4";
|
||||
$expertSetting["tree",9] = "5";
|
||||
$expertSetting["tree",10] = "6";
|
||||
$expertSetting["tree",11] = "7";
|
||||
$expertSetting["tree",12] = "8";
|
||||
$expertSetting["tree",13] = "9";
|
||||
$expertSetting["tree",14] = "10";
|
||||
|
||||
$packSettings["crate"] = 12;
|
||||
$packSetting["crate",0] = "(1) back pack";
|
||||
$packSetting["crate",1] = "(2) small containment";
|
||||
$packSetting["crate",2] = "(3) large containment";
|
||||
$packSetting["crate",3] = "(4) compressor";
|
||||
$packSetting["crate",4] = "(5) tubes";
|
||||
$packSetting["crate",5] = "(6) quantum battery";
|
||||
$packSetting["crate",6] = "(7) proton accelerator";
|
||||
$packSetting["crate",7] = "(8) cargo crate";
|
||||
$packSetting["crate",8] = "(9) magnetic cooler";
|
||||
$packSetting["crate",9] = "(10) recycle unit";
|
||||
$packSetting["crate",10] = "(11) fuel cannister";
|
||||
$packSetting["crate",11] = "(12) wooden T2 box";
|
||||
$packSetting["crate",12] = "(13) plasma router";
|
||||
|
||||
$packSettings["decoration"] = 15;
|
||||
$packSetting["decoration",0] = "(1) banner unity";
|
||||
$packSetting["decoration",1] = "(2) banner strength";
|
||||
$packSetting["decoration",2] = "(3) banner honor";
|
||||
$packSetting["decoration",3] = "(4) dead light armor";
|
||||
$packSetting["decoration",4] = "(5) dead medium armor";
|
||||
$packSetting["decoration",5] = "(6) dead heavy armor";
|
||||
$packSetting["decoration",6] = "(7) statue base";
|
||||
$packSetting["decoration",7] = "(8) light male statue";
|
||||
$packSetting["decoration",8] = "(9) light female statue";
|
||||
$packSetting["decoration",9] = "(10) heavy male statue";
|
||||
$packSetting["decoration",10] = "(11) beowulf wreck";
|
||||
$packSetting["decoration",11] = "(12) shrike wreck";
|
||||
$packSetting["decoration",12] = "(13) billboard 1";
|
||||
$packSetting["decoration",13] = "(14) billboard 2";
|
||||
$packSetting["decoration",14] = "(15) billboard 3";
|
||||
$packSetting["decoration",15] = "(16) billboard 4";
|
||||
|
||||
$packSettings["logoprojector"] = 7;
|
||||
$packSetting["logoprojector",0] = "your teams logo";
|
||||
$packSetting["logoprojector",1] = "Storm";
|
||||
$packSetting["logoprojector",2] = "Inferno";
|
||||
$packSetting["logoprojector",3] = "Starwolf";
|
||||
$packSetting["logoprojector",4] = "Diamond Sword";
|
||||
$packSetting["logoprojector",5] = "Blood Eagle";
|
||||
$packSetting["logoprojector",6] = "Phoenix";
|
||||
$packSetting["logoprojector",7] = "Bioderm";
|
||||
|
||||
$packSettings["switch"] = 6;
|
||||
$packSetting["switch",0] = "5";
|
||||
$packSetting["switch",1] = "10";
|
||||
$packSetting["switch",2] = "25";
|
||||
$packSetting["switch",3] = "50";
|
||||
$packSetting["switch",4] = "100";
|
||||
$packSetting["switch",5] = "150";
|
||||
$packSetting["switch",6] = "200";
|
||||
|
||||
$expertSettings["switch"] = 2;
|
||||
$expertSetting["switch",0] = "Normal switch";
|
||||
$expertSetting["switch",1] = "Timed switch on";
|
||||
$expertSetting["switch",2] = "Timed switch off";
|
||||
|
||||
$packSettings["light"] = 13;
|
||||
$packSetting["light",0] = "(7) <color:ffffff>white";
|
||||
$packSetting["light",1] = "(6) <color:ff4444>red";
|
||||
$packSetting["light",2] = "(5) <color:44ff44>green";
|
||||
$packSetting["light",3] = "(4) <color:4444ff>blue";
|
||||
$packSetting["light",4] = "(3) <color:44ffff>cyan";
|
||||
$packSetting["light",5] = "(2) <color:ff44ff>magenta";
|
||||
$packSetting["light",6] = "(1) <color:ffff44>yellow";
|
||||
$packSetting["light",7] = "(7) strobe <color:ffffff>white";
|
||||
$packSetting["light",8] = "(6) strobe <color:ff4444>red";
|
||||
$packSetting["light",9] = "(5) strobe <color:44ff44>green";
|
||||
$packSetting["light",10] = "(4) strobe <color:4444ff>blue";
|
||||
$packSetting["light",11] = "(3) strobe <color:44ffff>cyan";
|
||||
$packSetting["light",12] = "(2) strobe <color:ff44ff>magenta";
|
||||
$packSetting["light",13] = "(1) strobe <color:ffff44>yellow";
|
||||
|
||||
$packSettings["Door"] = 7;
|
||||
$packSetting["Door",0] = "Normal Door";
|
||||
$packSetting["Door",1] = "Toggle Door";
|
||||
$packSetting["Door",2] = "Power Change Normal Door";
|
||||
$packSetting["Door",3] = "Power Change Toggle Door";
|
||||
$packSetting["Door",4] = "contact door";
|
||||
$packSetting["Door",5] = "contact door owner door";
|
||||
$packSetting["Door",6] = "contact door admin door";
|
||||
$packSetting["Door",7] = "contact door if powered will be locked";
|
||||
|
||||
$expertSettings["Door"] = 5;
|
||||
$expertSetting["Door",0] = "0 Seconds";
|
||||
$expertSetting["Door",1] = "0.5 Seconds";
|
||||
$expertSetting["Door",2] = "1 Second";
|
||||
$expertSetting["Door",3] = "2 Seconds";
|
||||
$expertSetting["Door",4] = "3 Seconds";
|
||||
$expertSetting["Door",5] = "4 Seconds";
|
||||
|
||||
$packSettings["tripwire"] = 13;
|
||||
$packSetting["tripwire",0] = "5 0";
|
||||
$packSetting["tripwire",1] = "10 0";
|
||||
$packSetting["tripwire",2] = "25 0";
|
||||
$packSetting["tripwire",3] = "50 0";
|
||||
$packSetting["tripwire",4] = "100 0";
|
||||
$packSetting["tripwire",5] = "150 0";
|
||||
$packSetting["tripwire",6] = "200 0";
|
||||
$packSetting["tripwire",7] = "5 1";
|
||||
$packSetting["tripwire",8] = "10 1";
|
||||
$packSetting["tripwire",9] = "25 1";
|
||||
$packSetting["tripwire",10] = "50 1";
|
||||
$packSetting["tripwire",11] = "100 1";
|
||||
$packSetting["tripwire",12] = "150 1";
|
||||
$packSetting["tripwire",13] = "200 1";
|
||||
|
||||
$expertSettings["tripwire"] = 5;
|
||||
$expertSetting["tripwire",0] = "Normal toggle on";
|
||||
$expertSetting["tripwire",1] = "Normal toggle off";
|
||||
$expertSetting["tripwire",2] = "Only turn on";
|
||||
$expertSetting["tripwire",3] = "Only turn off";
|
||||
$expertSetting["tripwire",4] = "Timed turn off";
|
||||
$expertSetting["tripwire",5] = "Timed turn on";
|
||||
|
||||
$packSettings["escapepod"] = 7;
|
||||
$packSetting["escapepod",0] = "1875"; // 12.25%
|
||||
$packSetting["escapepod",1] = "3750"; // 25%
|
||||
$packSetting["escapepod",2] = "5625"; // 37.5%
|
||||
$packSetting["escapepod",3] = "7500"; // 50%
|
||||
$packSetting["escapepod",4] = "9375"; // 62.5%
|
||||
$packSetting["escapepod",5] = "11250"; // 75%
|
||||
$packSetting["escapepod",6] = "13125"; // 87.5%
|
||||
$packSetting["escapepod",7] = "15000"; // 100%
|
||||
|
||||
$expertSettings["telepad"] = 3;
|
||||
$expertSetting["telepad",0] = "team only";
|
||||
$expertSetting["telepad",1] = "any team";
|
||||
$expertSetting["telepad",2] = "only transmit";
|
||||
$expertSetting["telepad",3] = "only receive";
|
||||
|
||||
$packSettings["missilerack"] = 1;
|
||||
$packSetting["missilerack",0] = "dumbfire missiles";
|
||||
$packSetting["missilerack",1] = "seeking missiles";
|
||||
|
||||
$packSettings["VehiclePadPack"] = 2;
|
||||
$packSetting["VehiclePadPack",0] = "Regular Vehicle Pad";
|
||||
$packSetting["VehiclePadPack",1] = "Modern Vehicle Pad";
|
||||
$packSetting["VehiclePadPack",2] = "Zigma's Smoke Shack";
|
||||
|
||||
|
||||
//i modified the weapon mode change to work more like the pack settings
|
||||
//easyer to edit and work whit
|
||||
$WeaponSettings["modifier0"] = 0;
|
||||
$WeaponSetting["modifier0",0] = "merge pieces";
|
||||
|
||||
$WeaponSettings["modifier1"] = 18;
|
||||
$WeaponSetting["modifier1",0] = "DeployedSpine lsb";//0.125 0.166666 1
|
||||
$WeaponSetting["modifier1",1] = "DeployedMSpine msb";//0.125 0.166666 1
|
||||
$WeaponSetting["modifier1",2] = "DeployedwWall WalkWay";//0.125 0.166666 1
|
||||
$WeaponSetting["modifier1",3] = "DeployedWall Bwall";//0.125 0.166666 1
|
||||
$WeaponSetting["modifier1",4] = "DeployedSpine2 Dark Pad";//0.125 0.166666 1
|
||||
$WeaponSetting["modifier1",5] = "DeployedCrate0 (crate1) back pack";//0.5 1 0.925
|
||||
$WeaponSetting["modifier1",6] = "DeployedCrate1 (crate2) small containment";//0.16 0.5 0.488
|
||||
$WeaponSetting["modifier1",7] = "DeployedCrate2 (crate3) large containment";//0.1 0.25 0.25
|
||||
$WeaponSetting["modifier1",8] = "DeployedCrate3 (crate4) compressor";//1 1 1
|
||||
$WeaponSetting["modifier1",9] = "DeployedCrate4 (crate5) tubes";//0.5 0.5 0.48
|
||||
$WeaponSetting["modifier1",10] = "DeployedCrate5 (crate6) quantum battery";//0.25 0.25 0.25
|
||||
$WeaponSetting["modifier1",11] = "DeployedCrate6 (crate7) proton accelerator";//0.25 0.5 0.5
|
||||
$WeaponSetting["modifier1",12] = "DeployedCrate7 (crate8) cargo crate";//0.1255 0.249 0.246
|
||||
$WeaponSetting["modifier1",13] = "DeployedCrate8 (crate9) magnetic cooler";//0.0835 0.167 0.1666
|
||||
$WeaponSetting["modifier1",14] = "DeployedCrate9 (crate10) recycle unit";//1.25 1.25 0.48;
|
||||
$WeaponSetting["modifier1",15] = "DeployedCrate10 (crate11) fuel cannister";//0.834 0.834 0.336
|
||||
$WeaponSetting["modifier1",16] = "DeployedCrate11 (crate12) wooden T2 box";
|
||||
$WeaponSetting["modifier1",17] = "DeployedCrate12 (crate13) plasma router";
|
||||
$WeaponSetting["modifier1",18] = "DeployedDecoration6 (deco1) statue base";
|
||||
|
||||
$WeaponSettings["modifier2"] = 7;
|
||||
$WeaponSetting["modifier2",0] = "+whole scale";
|
||||
$WeaponSetting["modifier2",1] = "+x axis scale";
|
||||
$WeaponSetting["modifier2",2] = "+y axis scale";
|
||||
$WeaponSetting["modifier2",3] = "+z axis scale";
|
||||
$WeaponSetting["modifier2",4] = "-whole scale";
|
||||
$WeaponSetting["modifier2",5] = "-x axis scale";
|
||||
$WeaponSetting["modifier2",6] = "-y axis scale";
|
||||
$WeaponSetting["modifier2",7] = "-z axis scale";
|
||||
|
||||
$WeaponSettings["modifier3"] = 7;
|
||||
$WeaponSetting["modifier3",0] = "move up";
|
||||
$WeaponSetting["modifier3",1] = "move down";
|
||||
$WeaponSetting["modifier3",2] = "+x axis move";
|
||||
$WeaponSetting["modifier3",3] = "-x axis move";
|
||||
$WeaponSetting["modifier3",4] = "+y axis move";
|
||||
$WeaponSetting["modifier3",5] = "-y axis move";
|
||||
$WeaponSetting["modifier3",6] = "+z axis move";
|
||||
$WeaponSetting["modifier3",7] = "-z axis move";
|
||||
|
||||
$WeaponSettings["modifier4"] = 3;
|
||||
$WeaponSetting["modifier4",0] = "0.1";
|
||||
$WeaponSetting["modifier4",1] = "0.01";
|
||||
$WeaponSetting["modifier4",2] = "0.001";
|
||||
$WeaponSetting["modifier4",3] = "1";
|
||||
|
||||
//list of smaller list
|
||||
$WeaponSettings2["modifier"] = 5;//format :max mode
|
||||
$WeaponSetting2["modifier",0] = $WeaponSettings["modifier0"] SPC"Merge Pieces";
|
||||
$WeaponSetting2["modifier",1] = $WeaponSettings["modifier1"] SPC"Swap Pad Texture";
|
||||
$WeaponSetting2["modifier",2] = $packSettings["forcefield"] SPC"Swap Force Field Texture";
|
||||
$WeaponSetting2["modifier",3] = $WeaponSettings["modifier2"] SPC"Scale Pieces";
|
||||
$WeaponSetting2["modifier",4] = $WeaponSettings["modifier3"] SPC"Nudge Pieces";
|
||||
$WeaponSetting2["modifier",5] = $WeaponSettings["modifier4"] SPC"Modifier Scaler";
|
||||
|
||||
422
scripts/message.cs
Normal file
422
scripts/message.cs
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
$MaxMessageWavLength = 5200;
|
||||
|
||||
function addMessageCallback(%msgType, %func)
|
||||
{
|
||||
for(%i = 0; (%afunc = $MSGCB[%msgType, %i]) !$= ""; %i++)
|
||||
{
|
||||
// only add each callback once
|
||||
if(%afunc $= %func)
|
||||
return;
|
||||
}
|
||||
$MSGCB[%msgType, %i] = %func;
|
||||
}
|
||||
|
||||
function messagePump(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7 ,%a8, %a9, %a10)
|
||||
{
|
||||
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
|
||||
}
|
||||
|
||||
function clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
%tag = getWord(%msgType, 0);
|
||||
for(%i = 0; (%func = $MSGCB["", %i]) !$= ""; %i++)
|
||||
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
|
||||
|
||||
if(%tag !$= "")
|
||||
for(%i = 0; (%func = $MSGCB[%tag, %i]) !$= ""; %i++)
|
||||
call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
|
||||
}
|
||||
|
||||
function defaultMessageCallback(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
if ( %msgString $= "" )
|
||||
return;
|
||||
|
||||
%message = detag( %msgString );
|
||||
// search for wav tag marker
|
||||
%wavStart = strstr( %message, "~w" );
|
||||
if ( %wavStart != -1 )
|
||||
{
|
||||
%wav = getSubStr( %message, %wavStart + 2, 1000 );
|
||||
%wavLengthMS = alxGetWaveLen( %wav );
|
||||
if ( %wavLengthMS <= $MaxMessageWavLength )
|
||||
{
|
||||
%handle = alxCreateSource( AudioChat, %wav );
|
||||
alxPlay( %handle );
|
||||
}
|
||||
else
|
||||
error( "WAV file \"" @ %wav @ "\" is too long! **" );
|
||||
|
||||
%message = getSubStr( %message, 0, %wavStart );
|
||||
if ( %message !$= "" )
|
||||
addMessageHudLine( %message );
|
||||
}
|
||||
else
|
||||
addMessageHudLine( %message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %targetId, %isAI, %isAdmin, %isSuperAdmin, %isSmurf, %guid)
|
||||
{
|
||||
logEcho("got client join: " @ detag(%clientName) @ " : " @ %clientId);
|
||||
|
||||
//create the player list group, and add it to the ClientConnectionGroup...
|
||||
if(!isObject("PlayerListGroup"))
|
||||
{
|
||||
%newGroup = new SimGroup("PlayerListGroup");
|
||||
ClientConnectionGroup.add(%newGroup);
|
||||
}
|
||||
|
||||
%player = new ScriptObject()
|
||||
{
|
||||
className = "PlayerRep";
|
||||
name = detag(%clientName);
|
||||
guid = %guid;
|
||||
clientId = %clientId;
|
||||
targetId = %targetId;
|
||||
teamId = 0; // start unassigned
|
||||
score = 0;
|
||||
ping = 0;
|
||||
packetLoss = 0;
|
||||
chatMuted = false;
|
||||
canListen = false;
|
||||
voiceEnabled = false;
|
||||
isListening = false;
|
||||
isBot = %isAI;
|
||||
isAdmin = %isAdmin;
|
||||
isSuperAdmin = %isSuperAdmin;
|
||||
isSmurf = %isSmurf;
|
||||
};
|
||||
PlayerListGroup.add(%player);
|
||||
$PlayerList[%clientId] = %player;
|
||||
|
||||
if ( !%isAI )
|
||||
getPlayerPrefs(%player);
|
||||
lobbyUpdatePlayer( %clientId );
|
||||
}
|
||||
|
||||
function handleClientDrop( %msgType, %msgString, %clientName, %clientId )
|
||||
{
|
||||
logEcho("got client drop: " @ detag(%clientName) @ " : " @ %clientId);
|
||||
|
||||
%player = $PlayerList[%clientId];
|
||||
if( %player )
|
||||
{
|
||||
%player.delete();
|
||||
$PlayerList[%clientId] = "";
|
||||
lobbyRemovePlayer( %clientId );
|
||||
}
|
||||
}
|
||||
|
||||
function handleClientJoinTeam( %msgType, %msgString, %clientName, %teamName, %clientId, %teamId )
|
||||
{
|
||||
%player = $PlayerList[%clientId];
|
||||
if( %player )
|
||||
{
|
||||
%player.teamId = %teamId;
|
||||
lobbyUpdatePlayer( %clientId );
|
||||
}
|
||||
}
|
||||
|
||||
function handleClientNameChanged( %msgType, %msgString, %oldName, %newName, %clientId )
|
||||
{
|
||||
%player = $PlayerList[%clientId];
|
||||
if( %player )
|
||||
{
|
||||
%player.name = detag( %newName );
|
||||
lobbyUpdatePlayer( %clientId );
|
||||
}
|
||||
}
|
||||
|
||||
addMessageCallback("", defaultMessageCallback);
|
||||
addMessageCallback('MsgClientJoin', handleClientJoin);
|
||||
addMessageCallback('MsgClientDrop', handleClientDrop);
|
||||
addMessageCallback('MsgClientJoinTeam', handleClientJoinTeam);
|
||||
addMessageCallback('MsgClientNameChanged', handleClientNameChanged);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Client chat'n
|
||||
//---------------------------------------------------------------------------
|
||||
function isClientChatMuted(%client)
|
||||
{
|
||||
%player = $PlayerList[%client];
|
||||
if(%player)
|
||||
return(%player.chatMuted ? true : false);
|
||||
return(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
|
||||
{
|
||||
%message = detag( %msgString );
|
||||
%voice = detag( %voice );
|
||||
|
||||
if ( ( %message $= "" ) || isClientChatMuted( %sender ) )
|
||||
return;
|
||||
|
||||
// search for wav tag marker
|
||||
%wavStart = strstr( %message, "~w" );
|
||||
if ( %wavStart == -1 )
|
||||
addMessageHudLine( %message );
|
||||
else
|
||||
{
|
||||
%wav = getSubStr(%message, %wavStart + 2, 1000);
|
||||
if (%voice !$= "")
|
||||
%wavFile = "voice/" @ %voice @ "/" @ %wav @ ".wav";
|
||||
else
|
||||
%wavFile = %wav;
|
||||
|
||||
//only play voice files that are < 5000ms in length
|
||||
if (%pitch < 0.5 || %pitch > 2.0)
|
||||
%pitch = 1.0;
|
||||
%wavLengthMS = alxGetWaveLen(%wavFile) * %pitch;
|
||||
if (%wavLengthMS < $MaxMessageWavLength )
|
||||
{
|
||||
if ( $ClientChatHandle[%sender] != 0 )
|
||||
alxStop( $ClientChatHandle[%sender] );
|
||||
$ClientChatHandle[%sender] = alxCreateSource( AudioChat, %wavFile );
|
||||
|
||||
//pitch the handle
|
||||
if (%pitch != 1.0)
|
||||
alxSourcef($ClientChatHandle[%sender], "AL_PITCH", %pitch);
|
||||
alxPlay( $ClientChatHandle[%sender] );
|
||||
}
|
||||
else
|
||||
error( "** WAV file \"" @ %wavFile @ "\" is too long! **" );
|
||||
|
||||
%message = getSubStr(%message, 0, %wavStart);
|
||||
addMessageHudLine(%message);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
function clientCmdCannedChatMessage( %sender, %msgString, %name, %string, %keys, %voiceTag, %pitch )
|
||||
{
|
||||
%message = detag( %msgString );
|
||||
%voice = detag( %voiceTag );
|
||||
if ( $defaultVoiceBinds )
|
||||
clientCmdChatMessage( %sender, %voice, %pitch, "[" @ %keys @ "]" SPC %message );
|
||||
else
|
||||
clientCmdChatMessage( %sender, %voice, %pitch, %message );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// silly spam protection...
|
||||
$SPAM_PROTECTION_PERIOD = 10000;
|
||||
$SPAM_MESSAGE_THRESHOLD = 4;
|
||||
$SPAM_PENALTY_PERIOD = 10000;
|
||||
$SPAM_MESSAGE = '\c3FLOOD PROTECTION:\cr You must wait another %1 seconds.';
|
||||
|
||||
function GameConnection::spamMessageTimeout(%this)
|
||||
{
|
||||
if(%this.spamMessageCount > 0)
|
||||
%this.spamMessageCount--;
|
||||
}
|
||||
|
||||
function GameConnection::spamReset(%this)
|
||||
{
|
||||
%this.isSpamming = false;
|
||||
}
|
||||
|
||||
function spamAlert(%client)
|
||||
{
|
||||
if($Host::FloodProtectionEnabled != true)
|
||||
return(false);
|
||||
|
||||
if(!%client.isSpamming && (%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD))
|
||||
{
|
||||
%client.spamProtectStart = getSimTime();
|
||||
%client.isSpamming = true;
|
||||
%client.schedule($SPAM_PENALTY_PERIOD, spamReset);
|
||||
}
|
||||
|
||||
if(%client.isSpamming)
|
||||
{
|
||||
%wait = mFloor(($SPAM_PENALTY_PERIOD - (getSimTime() - %client.spamProtectStart)) / 1000);
|
||||
messageClient(%client, "", $SPAM_MESSAGE, %wait);
|
||||
return(true);
|
||||
}
|
||||
|
||||
%client.spamMessageCount++;
|
||||
%client.schedule($SPAM_PROTECTION_PERIOD, spamMessageTimeout);
|
||||
return(false);
|
||||
}
|
||||
|
||||
function chatMessageClient( %client, %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
//see if the client has muted the sender
|
||||
if ( !%client.muted[%sender] )
|
||||
commandToClient( %client, 'ChatMessage', %sender, %voiceTag, %voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
|
||||
function cannedChatMessageClient( %client, %sender, %msgString, %name, %string, %keys )
|
||||
{
|
||||
if ( !%client.muted[%sender] )
|
||||
commandToClient( %client, 'CannedChatMessage', %sender, %msgString, %name, %string, %keys, %sender.voiceTag, %sender.voicePitch );
|
||||
}
|
||||
|
||||
function chatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
//chat Echoing and logging
|
||||
%echoStr = %a2;
|
||||
%echoStr=strreplace(%echoStr,"\c5","");
|
||||
%echoStr=strreplace(%echoStr,"\c4","");
|
||||
%echoStr=strreplace(%echoStr,"\c3","");
|
||||
%echoStr=strreplace(%echoStr,"\c2","");
|
||||
%echoStr=strreplace(%echoStr,"\c1","");
|
||||
if ($Construction::Logging::EchoChat)
|
||||
echo(getTaggedString(%sender.name) @ ":" SPC %echoStr);
|
||||
if ($Construction::Logging::LogChat)
|
||||
serverChatLog(%sender, %echoStr);
|
||||
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
%count = ClientGroup.getCount();
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = ClientGroup.getObject( %i );
|
||||
if ( %obj.team == %sender.team )
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
}
|
||||
|
||||
function cannedChatMessageTeam( %sender, %team, %msgString, %name, %string, %keys )
|
||||
{
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = ClientGroup.getObject( %i );
|
||||
if ( %obj.team == %sender.team )
|
||||
cannedChatMessageClient( %obj, %sender, %msgString, %name, %string, %keys );
|
||||
}
|
||||
}
|
||||
|
||||
function chatMessageAll( %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 )
|
||||
{
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
%count = ClientGroup.getCount();
|
||||
|
||||
if (getSubStr(%a2, 0, 1) !$= "/") {
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
{
|
||||
%obj = ClientGroup.getObject( %i );
|
||||
if(%sender.team != 0)
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
else
|
||||
{
|
||||
// message sender is an observer -- only send message to other observers
|
||||
if(%obj.team == %sender.team || %obj.isAdmin || %obj.isSuperAdmin)
|
||||
chatMessageClient( %obj, %sender, %sender.voiceTag, %sender.voicePitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 );
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getSubStr(%a2, 0, 1) $= "/")
|
||||
chatcommands(%sender,%a2);
|
||||
}
|
||||
|
||||
function cannedChatMessageAll( %sender, %msgString, %name, %string, %keys )
|
||||
{
|
||||
if ( ( %msgString $= "" ) || spamAlert( %sender ) )
|
||||
return;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for ( %i = 0; %i < %count; %i++ )
|
||||
cannedChatMessageClient( ClientGroup.getObject(%i), %sender, %msgString, %name, %string, %keys );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
function messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
commandToClient(%client, 'ServerMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
|
||||
function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if(%recipient.team == %team)
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageTeamExcept(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%team = %client.team;
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if((%recipient.team == %team) && (%recipient != %client))
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageAll(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl = 0; %cl < %count; %cl++)
|
||||
{
|
||||
%client = ClientGroup.getObject(%cl);
|
||||
messageClient(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
function messageAllExcept(%client, %team, %msgtype, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
|
||||
{
|
||||
//can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
|
||||
//messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
|
||||
%count = ClientGroup.getCount();
|
||||
for(%cl= 0; %cl < %count; %cl++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if((%recipient != %client) && (%recipient.team != %team))
|
||||
messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// functions to support repair messaging
|
||||
//---------------------------------------------------------------------------
|
||||
function clientCmdTeamRepairMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
|
||||
{
|
||||
if(!$pref::ignoreTeamRepairMessages)
|
||||
clientCmdServerMessage(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
|
||||
}
|
||||
|
||||
function teamRepairMessage(%client, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6)
|
||||
{
|
||||
%team = %client.team;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%recipient = ClientGroup.getObject(%cl);
|
||||
if((%recipient.team == %team) && (%recipient != %client))
|
||||
commandToClient(%recipient, 'TeamRepairMessage', %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------
|
||||
//Chat Logging: Electricutioner
|
||||
|
||||
|
||||
function serverChatLog(%sender, %message)
|
||||
{
|
||||
%logname = getTaggedString(%sender.name);
|
||||
%logname = strreplace(%logname,"\x10","");
|
||||
%logname = strreplace(%logname,"\x11","");
|
||||
%logname = strreplace(%logname,"\c8","");
|
||||
%logname = strreplace(%logname,"\c7","");
|
||||
%logname = strreplace(%logname,"\c6","");
|
||||
|
||||
%logExport = formatTimeString(yy) @ "/" @ formatTimeString(mm) @ "/" @ formatTimeString(dd);
|
||||
%logExport = %logExport SPC formatTimeString(h) @ ":" @ formatTimeString(n) @ "." @ formatTimeString(s) SPC formatTimeString(a);
|
||||
%logExport = %logExport SPC %logname @ ":" SPC %message;
|
||||
exportToLog(%logexport, "Logs/Chat/" @ formatTimeString(yy) @ "-" @ formatTimeString(mm) @ "-" @ formatTimeString(dd) @ ".log");
|
||||
}
|
||||
121
scripts/nerf.cs
Normal file
121
scripts/nerf.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// Nerf
|
||||
|
||||
// Original anim idea from Bones' Dance Inducer gun
|
||||
|
||||
// Set up defaults for nonexisting vars
|
||||
|
||||
// Init handled by server.cs
|
||||
//if ($Host::Nerf::Enabled $= "")
|
||||
// $Host::Nerf::Enabled = "1"; // Enable nerf weapons
|
||||
|
||||
if ($Host::Nerf::DanceAnim $= "")
|
||||
$Host::Nerf::DanceAnim = "1"; // Enable dance anim for nerf weapons
|
||||
if ($Host::Nerf::DeathAnim $= "")
|
||||
$Host::Nerf::DeathAnim = "0"; // Enable death anim for nerf weapons
|
||||
if ($Host::Nerf::Prison $= "")
|
||||
$Host::Nerf::Prison = "0"; // Enable prison for nerf weapons
|
||||
if ($Host::Nerf::PrisonTime $= "")
|
||||
$Host::Nerf::PrisonTime = "10"; // Time to jail players with nerf weapons
|
||||
|
||||
function applyNerf(%targetObject,%sourceObject,%position) {
|
||||
if (%targetObject.getClassName() $= "Player") {
|
||||
serverPlay3D(blasterExpSound,%position);
|
||||
if ($Host::Nerf::DanceAnim == true && !$Host::Nerf::DeathAnim == true)
|
||||
%targetObject.setActionThread("Cel" @ getRandom(8)+1,true);
|
||||
if ($Host::Nerf::DeathAnim == true)
|
||||
%targetObject.setActionThread("Death" @ getRandom(10)+1,true);
|
||||
if ($Host::Prison::Enabled == true && $Host::Nerf::Prison == true && $Host::Nerf::PrisonTime > 0
|
||||
&& isObject(%targetObject.client) // && isObject(%sourceObject)
|
||||
&& !%targetObject.client.isJailed) {
|
||||
%emitter = new ParticleEmissionDummy(NerfJailEmitter) {
|
||||
position = %position;
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "defaultEmissionDummy";
|
||||
emitter = "PlasmaBarrelCrescentEmitter";
|
||||
velocity = "1";
|
||||
};
|
||||
MissionCleanup.add(%emitter); // Well..
|
||||
%emitter.schedule(500,"delete");
|
||||
jailPlayer(%targetObject.client,false,$Host::Nerf::PrisonTime);
|
||||
messageAll('msgClient','\c2%1 put %2 in jail for %3 seconds.',%sourceObject.client.name,%targetObject.client.name,$Host::Nerf::PrisonTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function nerfEnable () {
|
||||
$Host::Nerf::Enabled = 1;
|
||||
|
||||
LightMaleHumanArmor.maxNerfGun = 1;
|
||||
LightMaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
LightFemaleHumanArmor.maxNerfGun = 1;
|
||||
LightFemaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
LightMaleBiodermArmor.maxNerfGun = 1;
|
||||
LightMaleBiodermArmor.maxNerfBallLauncher = 1;
|
||||
|
||||
MediumMaleHumanArmor.maxNerfGun = 1;
|
||||
MediumMaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
MediumFemaleHumanArmor.maxNerfGun = 1;
|
||||
MediumFemaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
MediumMaleBiodermArmor.maxNerfGun = 1;
|
||||
MediumMaleBiodermArmor.maxNerfBallLauncher = 1;
|
||||
|
||||
HeavyMaleHumanArmor.maxNerfGun = 1;
|
||||
HeavyMaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
HeavyFemaleHumanArmor.maxNerfGun = 1;
|
||||
HeavyFemaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
HeavyMaleBiodermArmor.maxNerfGun = 1;
|
||||
HeavyMaleBiodermArmor.maxNerfBallLauncher = 1;
|
||||
|
||||
PureMaleHumanArmor.maxNerfGun = 1;
|
||||
PureMaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
PureFemaleHumanArmor.maxNerfGun = 1;
|
||||
PureFemaleHumanArmor.maxNerfBallLauncher = 1;
|
||||
PureMaleBiodermArmor.maxNerfGun = 1;
|
||||
PureMaleBiodermArmor.maxNerfBallLauncher = 1;
|
||||
}
|
||||
|
||||
function nerfDisable () {
|
||||
$Host::Nerf::Enabled = 0;
|
||||
|
||||
LightMaleHumanArmor.maxNerfGun = 0;
|
||||
LightMaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
LightFemaleHumanArmor.maxNerfGun = 0;
|
||||
LightFemaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
LightMaleBiodermArmor.maxNerfGun = 0;
|
||||
LightMaleBiodermArmor.maxNerfBallLauncher = 0;
|
||||
|
||||
MediumMaleHumanArmor.maxNerfGun = 0;
|
||||
MediumMaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
MediumFemaleHumanArmor.maxNerfGun = 0;
|
||||
MediumFemaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
MediumMaleBiodermArmor.maxNerfGun = 0;
|
||||
MediumMaleBiodermArmor.maxNerfBallLauncher = 0;
|
||||
|
||||
HeavyMaleHumanArmor.maxNerfGun = 0;
|
||||
HeavyMaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
HeavyFemaleHumanArmor.maxNerfGun = 0;
|
||||
HeavyFemaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
HeavyMaleBiodermArmor.maxNerfGun = 0;
|
||||
HeavyMaleBiodermArmor.maxNerfBallLauncher = 0;
|
||||
|
||||
PureMaleHumanArmor.maxNerfGun = 0;
|
||||
PureMaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
PureFemaleHumanArmor.maxNerfGun = 0;
|
||||
PureFemaleHumanArmor.maxNerfBallLauncher = 0;
|
||||
PureMaleBiodermArmor.maxNerfGun = 0;
|
||||
PureMaleBiodermArmor.maxNerfBallLauncher = 0;
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for (%i=0;%i<%count;%i++) {
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%player = %client.player;
|
||||
if (isObject(%player)) {
|
||||
%player.setInventory(NerfGun,0,true);
|
||||
%client.setWeaponsHudItem(NerfGun,0,0);
|
||||
%player.setInventory(NerfBallLauncher,0,true);
|
||||
%player.setInventory(NerfBallLauncherAmmo,0,true);
|
||||
%client.setWeaponsHudItem(NerfBallLauncher,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
scripts/pack.cs
Normal file
122
scripts/pack.cs
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
datablock EffectProfile(TurretPackActivateEffect)
|
||||
{
|
||||
effectname = "packs/generic_deploy";
|
||||
minDistance = 2.5;
|
||||
maxDistance = 2.5;
|
||||
};
|
||||
|
||||
datablock AudioProfile(TurretPackActivateSound)
|
||||
{
|
||||
filename = "fx/packs/turret_place.wav";
|
||||
description = AudioClose3D;
|
||||
preload = true;
|
||||
effect = TurretPackActivateEffect;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
function Pack::onCollision(%data, %obj, %col)
|
||||
{
|
||||
// Don't pick up a new pack if you have a satchel charge deployed:
|
||||
if ( %col.thrownChargeId > 0 )
|
||||
return;
|
||||
|
||||
ItemData::onCollision(%data, %obj, %col);
|
||||
}
|
||||
|
||||
function Pack::onUse(%data,%obj)
|
||||
{
|
||||
if (%obj.getMountedImage($BackpackSlot) != %data.image.getId())
|
||||
%obj.mountImage(%data.image,$BackpackSlot);
|
||||
else
|
||||
{
|
||||
// Toggle the image trigger.
|
||||
%obj.setImageTrigger($BackpackSlot,
|
||||
!%obj.getImageTrigger($BackpackSlot));
|
||||
}
|
||||
}
|
||||
|
||||
function Pack::onInventory(%data,%obj,%amount)
|
||||
{
|
||||
//only do this for players
|
||||
if(%obj.getClassName() !$= "Player")
|
||||
return;
|
||||
|
||||
// Auto-mount the packs on players
|
||||
if((%oldPack = %obj.getMountedImage($BackpackSlot)) != 0)
|
||||
%obj.setInventory(%oldPack.item, 0);
|
||||
if (%amount && %obj.getDatablock().className $= Armor)
|
||||
{
|
||||
// if you picked up another pack after you placed a satchel charge but
|
||||
// before you detonated it, delete the charge
|
||||
if(%obj.thrownChargeId > 0)
|
||||
{
|
||||
%obj.thrownChargeId.delete();
|
||||
%obj.thrownChargeId = 0;
|
||||
}
|
||||
%obj.mountImage(%data.image,$BackpackSlot);
|
||||
%obj.client.setBackpackHudItem(%data.getName(), 1);
|
||||
}
|
||||
if(%amount == 0 )
|
||||
{
|
||||
if ( %data.getName() $= "SatchelCharge" )
|
||||
%obj.client.setBackpackHudItem( "SatchelUnarmed", 1 );
|
||||
else
|
||||
%obj.client.setBackpackHudItem(%data.getName(), 0);
|
||||
}
|
||||
ItemData::onInventory(%data,%obj,%amount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// --- Upgrade packs
|
||||
exec("scripts/packs/ammopack.cs");
|
||||
exec("scripts/packs/cloakingpack.cs");
|
||||
exec("scripts/packs/energypack.cs");
|
||||
exec("scripts/packs/repairpack.cs");
|
||||
exec("scripts/packs/shieldpack.cs");
|
||||
exec("scripts/packs/satchelCharge.cs");
|
||||
exec("scripts/packs/sensorjammerpack.cs");
|
||||
|
||||
exec("scripts/packs/largeInventory.cs");
|
||||
exec("scripts/packs/spine.cs");
|
||||
exec("scripts/packs/blastwall.cs");
|
||||
exec("scripts/packs/blastfloor.cs");
|
||||
exec("scripts/packs/blastwwall.cs");
|
||||
exec("scripts/packs/jumpad.cs");
|
||||
exec("scripts/packs/energizer.cs");
|
||||
exec("scripts/packs/mspine.cs");
|
||||
exec("scripts/packs/treepack.cs");
|
||||
exec("scripts/packs/cratepack.cs");
|
||||
exec("scripts/packs/decorationpack.cs");
|
||||
exec("scripts/packs/logoprojectorpack.cs");
|
||||
exec("scripts/packs/lightpack.cs");
|
||||
exec("scripts/packs/forcefieldpack.cs");
|
||||
exec("scripts/packs/gravityfieldpack.cs");
|
||||
exec("scripts/packs/telepadpack.cs");
|
||||
exec("scripts/packs/turretpack.cs");
|
||||
exec("scripts/packs/discturret.cs");
|
||||
exec("scripts/packs/laserturret.cs");
|
||||
exec("scripts/packs/missilerackturret.cs");
|
||||
exec("scripts/packs/mediumSensor.cs");
|
||||
exec("scripts/packs/largeSensor.cs");
|
||||
exec("scripts/packs/tripwire.cs");
|
||||
exec("scripts/packs/escapePodPack.cs");
|
||||
exec("scripts/packs/vehiclepad.cs");
|
||||
exec("scripts/packs/Effectpacks.cs");
|
||||
exec("scripts/packs/door.cs");
|
||||
|
||||
// --- Turret barrel packs
|
||||
exec("scripts/packs/aabarrelpack.cs");
|
||||
exec("scripts/packs/missilebarrelpack.cs");
|
||||
exec("scripts/packs/mortarbarrelpack.cs");
|
||||
exec("scripts/packs/plasmabarrelpack.cs");
|
||||
exec("scripts/packs/ELFbarrelpack.cs");
|
||||
|
||||
// --- power
|
||||
exec("scripts/packs/generator.cs");
|
||||
exec("scripts/packs/solarpanel.cs");
|
||||
exec("scripts/packs/switch.cs");
|
||||
724
scripts/packs/AntiNuketurret.cs
Normal file
724
scripts/packs/AntiNuketurret.cs
Normal file
|
|
@ -0,0 +1,724 @@
|
|||
datablock TracerProjectileData(Mpm_Aexp1) {
|
||||
className = "TracerProjectileData";
|
||||
emitterDelay = "-1";
|
||||
velInheritFactor = "0";
|
||||
directDamage = "0";
|
||||
hasDamageRadius = "0";
|
||||
indirectDamage = "0";
|
||||
damageRadius = "0";
|
||||
radiusDamageType = "0";
|
||||
kickBackStrength = "0";
|
||||
Explosion = "VehicleExplosion";
|
||||
hasLight = "0";
|
||||
lightRadius = "1";
|
||||
lightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
hasLightUnderwaterColor = "0";
|
||||
underWaterLightColor = "1.000000 1.000000 1.000000 1.000000";
|
||||
explodeOnWaterImpact = "0";
|
||||
depthTolerance = "5";
|
||||
bubbleEmitTime = "0.5";
|
||||
faceViewer = "0";
|
||||
scale = "1 1 1";
|
||||
dryVelocity = "0.1";
|
||||
wetVelocity = "0.1";
|
||||
fizzleTimeMS = "32";
|
||||
lifetimeMS = "32";
|
||||
explodeOnDeath = "1";
|
||||
reflectOnWaterImpactAngle = "0";
|
||||
deflectionOnWaterImpact = "0";
|
||||
fizzleUnderwaterMS = "-1";
|
||||
activateDelayMS = "-1";
|
||||
doDynamicClientHits = "0";
|
||||
tracerLength = "1";
|
||||
tracerMinPixels = "1";
|
||||
tracerAlpha = "0";
|
||||
tracerColor = "0.000000 0.000000 0.000000 0.000000";
|
||||
tracerTex[0] = "special/tracer00";
|
||||
tracerTex[1] = "special/tracercross";
|
||||
tracerWidth = "0.1";
|
||||
crossViewAng = "0.99";
|
||||
crossSize = "0.1";
|
||||
renderCross = "0";
|
||||
isFXUnit = "1";
|
||||
};
|
||||
|
||||
datablock TracerProjectileData(Mpm_Aexp2) : Mpm_Aexp1{
|
||||
Explosion = "TurretExplosion";
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Explosions
|
||||
//---------------------------------------------------------------------------
|
||||
datablock ExplosionData(Mpm_Anti_MissileExplosion) {
|
||||
explosionShape = "effect_plasma_explosion.dts";
|
||||
playSpeed = 1.5;
|
||||
soundProfile = GrenadeExplosionSound;
|
||||
faceViewer = true;
|
||||
|
||||
sizes[0] = "0.5 0.5 0.5";
|
||||
sizes[1] = "0.5 0.5 0.5";
|
||||
sizes[2] = "0.5 0.5 0.5";
|
||||
|
||||
emitter[0] = MissileExplosionSmokeEmitter;
|
||||
|
||||
debris = MissileSpikeDebris;
|
||||
debrisThetaMin = 10;
|
||||
debrisThetaMax = 170;
|
||||
debrisNum = 8;
|
||||
debrisNumVariance = 6;
|
||||
debrisVelocity = 15.0;
|
||||
debrisVelocityVariance = 2.0;
|
||||
|
||||
shakeCamera = true;
|
||||
camShakeFreq = "6.0 7.0 7.0";
|
||||
camShakeAmp = "70.0 70.0 70.0";
|
||||
camShakeDuration = 1.0;
|
||||
camShakeRadius = 7.0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
//--------------------------------------
|
||||
datablock SeekerProjectileData(Mpm_Anti_Missile) {
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "weapon_missile_projectile.dts";
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 0.2;
|
||||
damageRadius = 4.0;
|
||||
radiusDamageType = $DamageType::MissileTurret;
|
||||
kickBackStrength = 1000;
|
||||
|
||||
explosion = "Mpm_Anti_MissileExplosion";
|
||||
splash = MissileSplash;
|
||||
velInheritFactor = 0.2; // 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 = -1;
|
||||
muzzleVelocity = 20.0;
|
||||
maxVelocity = 20.0;
|
||||
turningSpeed = 110.0;
|
||||
acceleration = 0.0;
|
||||
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 200;
|
||||
flareAngle = 30;
|
||||
|
||||
sound = MissileProjectileSound;
|
||||
|
||||
hasLight = true;
|
||||
lightRadius = 5.0;
|
||||
lightColor = "0.2 0.05 0";
|
||||
|
||||
useFlechette = true;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = false;
|
||||
};
|
||||
|
||||
datablock TurretData(Mpm_Anti_TurretDeployed) : TurretDamageProfile {
|
||||
className = DeployedTurret;
|
||||
shapeFile = "turret_outdoor_deploy.dts";
|
||||
|
||||
rechargeRate = 0.15;
|
||||
|
||||
mass = 1;
|
||||
maxDamage = 0.80;
|
||||
destroyedLevel = 0.80;
|
||||
disabledLevel = 0.35;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 5.0;
|
||||
expDamage = 0.5;
|
||||
expImpulse = 500.0;
|
||||
|
||||
repairRate = 0;
|
||||
deployedObject = true;
|
||||
|
||||
thetaMin = 0;
|
||||
thetaMax = 145;
|
||||
thetaNull = 90;
|
||||
primaryAxis = zaxis;
|
||||
|
||||
yawVariance = 30.0; // these will smooth out the elf tracking code.
|
||||
pitchVariance = 30.0; // more or less just tolerances
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 110;
|
||||
maxEnergy = 80;
|
||||
renderWhenDestroyed = true;
|
||||
barrel = DeployableMpm_Anti_TurretBarrel;
|
||||
heatSignature = 0.0;
|
||||
|
||||
//canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Anti Missile';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = Mpm_Anti_TurretSensor;
|
||||
sensorRadius = Mpm_Anti_TurretSensor.detectRadius;
|
||||
sensorColor = "191 0 226";
|
||||
|
||||
firstPersonOnly = true;
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = TurretDebrisSmall;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMpm_Anti_TurretBarrel) {
|
||||
shapeFile = "stackable1s.dts";
|
||||
rotation = "-0.57735 0.57735 0.57735 120";
|
||||
offset = "0 -0.3 0";
|
||||
projectile = Mpm_Anti_Missile;
|
||||
projectileType = SeekerProjectile;
|
||||
|
||||
usesEnergy = true;
|
||||
fireEnergy = 7.0;
|
||||
minEnergy = 7.0 * 2;
|
||||
|
||||
isSeeker = true;
|
||||
seekRadius = 300;
|
||||
maxSeekAngle = 30;
|
||||
seekTime = 1.0;
|
||||
minSeekHeat = 0.6;
|
||||
emap = true;
|
||||
minTargetingDistance = 15;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 250;
|
||||
deactivateDelayMS = 500;
|
||||
thinkTimeMS = 200;
|
||||
degPerSecTheta = 50;
|
||||
degPerSecPhi = 50;
|
||||
attackRadius = 250;
|
||||
|
||||
// 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.3;
|
||||
stateFire[3] = true;
|
||||
stateShockwave[3] = true;
|
||||
stateRecoil[3] = LightRecoil;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateSound[3] = MissileRackTurretFireSound;
|
||||
stateScript[3] = "onFire";
|
||||
|
||||
stateName[4] ="Reload";
|
||||
stateTimeoutValue[4] = 0.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";
|
||||
|
||||
muzzleSlots = 12;
|
||||
muzzleSlotOffset[0] = "0.65 0.5 0.4";
|
||||
muzzleSlotOffset[1] = "0.35 0.5 0.4";
|
||||
muzzleSlotOffset[2] = "0.15 0.5 0.4";
|
||||
muzzleSlotOffset[3] = "-0.15 0.5 0.4";
|
||||
muzzleSlotOffset[4] = "-0.35 0.5 0.4";
|
||||
muzzleSlotOffset[5] = "-0.65 0.5 0.4";
|
||||
muzzleSlotOffset[6] = "0.65 0.5 0.1";
|
||||
muzzleSlotOffset[7] = "0.35 0.5 0.1";
|
||||
muzzleSlotOffset[8] = "0.15 0.5 0.1";
|
||||
muzzleSlotOffset[9] = "-0.15 0.5 0.1";
|
||||
muzzleSlotOffset[10] = "-0.35 0.5 0.1";
|
||||
muzzleSlotOffset[11] = "-0.65 0.5 0.1";
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMpm_Anti_TurretBarrel1) {
|
||||
shapeFile = "weapon_missile_projectile.dts";
|
||||
rotation = "1 0 0 0";
|
||||
offset = "-0.14 0.15 0.13";
|
||||
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMpm_Anti_TurretBarrel2) {
|
||||
shapeFile = "weapon_missile_projectile.dts";
|
||||
rotation = "1 0 0 0";
|
||||
offset = "-0.14 0.15 -0.13";
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMpm_Anti_TurretBarrel3) {
|
||||
shapeFile = "weapon_missile_projectile.dts";
|
||||
rotation = "1 0 0 0";
|
||||
offset = "-0.43 0.15 0.13";
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMpm_Anti_TurretBarrel4) {
|
||||
shapeFile = "weapon_missile_projectile.dts";
|
||||
rotation = "1 0 0 0";
|
||||
offset = "-0.43 0.15 -0.13";
|
||||
};
|
||||
|
||||
function DeployableMpm_Anti_TurretBarrel::onMount(%this,%obj,%slot) {
|
||||
%obj.currentMuzzleSlot = 0;
|
||||
%obj.schedule(1000,"mountImage",DeployableMpm_Anti_TurretBarrel1,1,true);
|
||||
%obj.schedule(1000,"mountImage",DeployableMpm_Anti_TurretBarrel2,2,true);
|
||||
%obj.schedule(1000,"mountImage",DeployableMpm_Anti_TurretBarrel3,3,true);
|
||||
%obj.schedule(1000,"mountImage",DeployableMpm_Anti_TurretBarrel4,4,true);
|
||||
}
|
||||
|
||||
// TODO - handle unmount
|
||||
|
||||
datablock ShapeBaseImageData(TurretMpm_Anti_DeployableImage) {
|
||||
mass = 1;
|
||||
shapeFile = "pack_deploy_turreto.dts";
|
||||
item = TurretMpm_Anti_Deployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = Mpm_Anti_TurretDeployed;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
emap = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = TurretDeploySound;
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(TurretMpm_Anti_Deployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = TurretMpm_Anti_DeployableImage;
|
||||
pickUpName = "an anti missile turret pack";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Functions
|
||||
//--------------------------------------
|
||||
|
||||
function TurretMpm_Anti_DeployableImage::TestNoTerrainFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretMpm_Anti_DeployableImage::TestNoInteriorFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretMpm_Anti_Deployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
//created to prevent console errors
|
||||
}
|
||||
|
||||
|
||||
function TurretMpm_Anti_DeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "Turret";
|
||||
if (IsObject(%item.surface))
|
||||
if (%item.surface.getDatablock().getName() $= Mpm_Anti_TurretDeployed)
|
||||
{
|
||||
for (%i=1;%i<5;%i++)
|
||||
{
|
||||
if (!%item.surface.getMountedImage(%i))
|
||||
{
|
||||
%item.surface.schedule(%i*100,"mountImage","DeployableMpm_Anti_TurretBarrel"@ %i,%i,true);
|
||||
%item.surface.schedule(%i*100,"play3d",NerfGunDryFireSound);
|
||||
%c++;
|
||||
}
|
||||
if (%c)
|
||||
bottomPrint( %plyr.client, "Reloaded anti-mpm Turret with" SPC %c SPC "Missiles", 5,1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
%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 = %item.deployed;
|
||||
};
|
||||
|
||||
if (%plyr.packSet == 1)
|
||||
%deplObj.isSeeker = 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;
|
||||
|
||||
// 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);
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
bottomPrint( %plyr.client, "Deployed anti-mpm Turret with 4 missiles ammo.\n deploy another anti-mpm turret ontop to resuply.", 5,2);
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function Mpm_Anti_TurretDeployed::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team, TurretMpm_Anti_Deployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, delete);
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function DeployableMpm_Anti_TurretBarrel::onFire(%data,%obj,%slot) {
|
||||
%targetObj = %obj.getTargetObject();
|
||||
if (%targetObj) {
|
||||
if (!%obj.getDataBlock().hasLOS(%obj,%slot,%targetObj) && %obj.aquireTime + 2000 < getSimTime()) {
|
||||
%obj.clearTarget();
|
||||
return;
|
||||
}
|
||||
if (%obj.aquireTime + 10000 + getRandom(0,1000) < getSimTime()) {
|
||||
%obj.clearTarget();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%p = Parent::onFire(%data,%obj,%slot);
|
||||
serverPlay3D(MissileRackTurretFireSound2,%obj.getTransform());
|
||||
|
||||
if (%obj.isSeeker) {
|
||||
if (%obj.getControllingClient())
|
||||
// a player is controlling the turret
|
||||
%target = %obj.getLockedTarget();
|
||||
else
|
||||
// The ai is controlling the turret
|
||||
%target = %obj.getTargetObject();
|
||||
|
||||
if(%target)
|
||||
%p.setObjectTarget(%target);
|
||||
else if(%obj.isLocked())
|
||||
%p.setPositionTarget(%obj.getLockedPosition());
|
||||
else
|
||||
%p.setNoTarget(); // set as unguided. Only happens when itchy trigger can't wait for lock tone.
|
||||
%obj.setEnergyLevel(%obj.getEnergyLevel() - (%data.fireEnergy));
|
||||
}
|
||||
}
|
||||
|
||||
function Mpm_Anti_TurretDeployed::hasLOS(%data,%obj,%slot,%targetObj) {
|
||||
%start = %obj.getMuzzlePoint(%slot);
|
||||
%end = %targetObj.getWorldBoxCenter();
|
||||
%res = containerRayCast(%start,%end,-1,%obj);
|
||||
return firstWord(%res) == %targetObj;
|
||||
}
|
||||
|
||||
function TurretMpm_Anti_DeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasMpm_Anti= true; // set for Mpm_Anti_check
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TurretMpm_Anti_DeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasMpm_Anti= "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
|
||||
function Mpm_Anti_TurretDeployed::selectTarget(%this, %turret)
|
||||
{
|
||||
%turretTarg = %turret.getTarget();
|
||||
if(%turretTarg == -1)
|
||||
return;
|
||||
if (Isobject(%turret.aimtarget))
|
||||
{
|
||||
%turret.setTargetObject(%turret.aimtarget);
|
||||
}
|
||||
%target = %turret.get_ampm_target();
|
||||
if (Isobject(%target))
|
||||
{
|
||||
%turret.Lock_ampm_target(%target);
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::Get_ampm_target(%obj)
|
||||
{
|
||||
%location = %obj.getTransform();
|
||||
if (!Isobject(mpm_missiles))
|
||||
return "";
|
||||
if (!mpm_missiles.getCount())
|
||||
return "";
|
||||
|
||||
%tmissile = "";
|
||||
for( %c = 0; %c < mpm_missiles.getCount(); %c++ )
|
||||
{
|
||||
%missile = mpm_missiles.getObject(%c);
|
||||
if (%missile.load.Hazard(%missile,%obj,200) && !Isobject(%obj.tagged[%missile]) && !%missile.tagged && (!isObject(%missile.tracking) || %obj == %missile.tracking))
|
||||
{
|
||||
%pos = pos(%missile);
|
||||
%dist = vectorDist(%location,%pos);
|
||||
if (!%dis || %dist < %dis)
|
||||
{
|
||||
%tmissile = %missile;
|
||||
%dis = %dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
return %tmissile SPC %dist;
|
||||
}
|
||||
|
||||
function GameBase::Lock_ampm_target(%obj,%target)
|
||||
{
|
||||
if (IsObject(%target)) //Is the target still there?
|
||||
{
|
||||
%predict= %target.predict();
|
||||
%loc = getWords(%predict,0,2);
|
||||
%speed = getWords(%predict,3,5);
|
||||
%pos = %obj.getTransform();
|
||||
%dist = VectorDist(%pos,%loc);
|
||||
//%dir = VectorSub(%pos,%loc);
|
||||
//%gendir = VectorDot(VectorNormalize(%dir),VectorNormalize(%speed));
|
||||
%time = 15;//Limit(%dist/20+5-10,5,50); //%target.radiustime(%pos,100);
|
||||
if (%time > 5 && getSimTime()+ %time*1000 < %target.dietime) //Can we get to the target in time?
|
||||
{
|
||||
%loc = getWords(%target.predict((%time)*1000),0,2);
|
||||
%dist = VectorDist(%pos,%loc);
|
||||
%ttime = %dist / 20; //travel time
|
||||
%ltime = %time - %ttime; //launch time
|
||||
%atime = %ltime - 3; //activate time
|
||||
if (%dist > 10 && %dist < 500 && %atime > 0) //Will it within our limits?
|
||||
{
|
||||
%res = containerRayCast(%obj.getTransform(),%loc, -1,%obj);
|
||||
if (!%res) //Can we hit it from here?
|
||||
{
|
||||
if ((%obj.atime-getSimTime())/1000 > %atime || (%obj.ltime-getSimTime())/1000 < 0) //Is it a better option?
|
||||
{
|
||||
Cancel(%obj.activate);
|
||||
Cancel(%obj.launch);
|
||||
%obj.needtime = getSimTime()+(%time*1000);
|
||||
%obj.atime = getSimTime()+(%atime*1000);
|
||||
%obj.ltime = getSimTime()+(%ltime*1000);
|
||||
%obj.set_ampm_target(%loc);
|
||||
%target.tracking = %obj;
|
||||
%obj.activate = %obj.schedule(%atime*1000,"set_ampm_target",%target,%loc);
|
||||
%obj.launch = %obj.schedule(%ltime*1000,"fire_ampm_now");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::set_ampm_target(%obj,%target,%location)
|
||||
{
|
||||
if (!Isobject(%obj.aimtarget))
|
||||
{
|
||||
//SIGN
|
||||
%sign = new StaticShape(){
|
||||
dataBlock = MpmTurretTarg;
|
||||
};
|
||||
%sign.team = 3;
|
||||
%sign.setHeat(1);
|
||||
setTargetSensorGroup(%sign.getTarget(),3);
|
||||
%sign.owner = %obj;
|
||||
%obj.aimtarget = %sign;
|
||||
}
|
||||
if (%location $= "" || !Isobject(%target) || IsObject(%obj.tagged[%target]) || !%obj.get_ampm_missile())
|
||||
{
|
||||
Cancel(%obj.launch);
|
||||
%pos = VectorAdd(%obj.getMuzzlePoint(0),realvec(%obj,"0 10 0"));
|
||||
%obj.aimtarget.setTransform(%pos SPC "1 0 0 0");
|
||||
%obj.canfire = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
%obj.aimtarget.setTransform(%location SPC "1 0 0 0");
|
||||
%obj.target = %target;
|
||||
%obj.canfire = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::Fire_ampm_now(%obj)
|
||||
{
|
||||
|
||||
%target = %obj.target;
|
||||
if (IsObject(%target) && %obj.canfire && IsObject(%obj.aimtarget))
|
||||
{
|
||||
%slot = %obj.get_ampm_missile();
|
||||
%from = %obj.getMuzzlePoint(%slot);
|
||||
%pos = %obj.aimtarget.getTransform();
|
||||
%vec = VectorSub(%pos,%from);
|
||||
%tdir = VectorNormalize(VectorSub(%pos,%from));
|
||||
%tvec = "0 1 0";
|
||||
%rot = %obj.getSlotRotation(0);
|
||||
%dir = validateVal(MatrixMulVector("0 0 0" SPC %rot ,%tvec));
|
||||
%diff = vectorDot(%tdir,%dir);
|
||||
%time = (%obj.needtime-getSimTime())/1000;
|
||||
%speed = (VectorLen(%vec)/%time)/MpmMissile3.muzzleVelocity;
|
||||
|
||||
if (%diff > 0.9 && %slot)
|
||||
{
|
||||
%p1 = new SeekerProjectile()
|
||||
{
|
||||
datablock = Mpm_B_MIS2;
|
||||
initialDirection = VectorScale(%tdir,%speed);
|
||||
initialPosition = %from;
|
||||
};
|
||||
%p1.schedule(%time*1000+500,"delete");
|
||||
schedule(%time*1000,0,"range",%target,%p1);
|
||||
%p1.getDatablock().schedule(%time*1000,"onExplode",%p1,%pos, 1);
|
||||
%obj.tagged[%target] = %p1;
|
||||
%target.tagged = 1;
|
||||
%obj.set_ampm_target(0);
|
||||
%obj.unMountImage(%slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function range(%p1,%p2)
|
||||
{
|
||||
if (IsObject(%p1) && IsObject(%p2))
|
||||
{
|
||||
%dist = VectorDist(%p1.getTransform(),%p2.getTransform());
|
||||
PlayExplosion(%p1.getTransform(),Mpm_Aexp1);
|
||||
|
||||
if (%dist < 10)
|
||||
{
|
||||
//createLifeEmitter(%p1.getTransform(), MpmJetEmitter3, 5000,"1 0 0 0");
|
||||
PlayExplosion(%p1.getTransform(),Mpm_Aexp2);
|
||||
%p1.load.InterCept(%p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::get_ampm_missile(%obj)
|
||||
{
|
||||
for (%i=1;%i<5; %i++)
|
||||
{
|
||||
if (%obj.getMountedImage(%i)!=0)
|
||||
return %i;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//Not used.. ha
|
||||
function inrange(%p,%loc,%range)
|
||||
{
|
||||
if (!Isobject(%p))
|
||||
return "";
|
||||
%c = VectorSub(%p.getTransform(),%loc);
|
||||
%speed = GetWords(%p.predict(),3,5);
|
||||
%r = VectorNormalize(%speed);
|
||||
%v = VectorLen(%speed);
|
||||
%a = %p.getDatablock().Acceleration;
|
||||
|
||||
if (%a != 0)
|
||||
{
|
||||
%root1 = mPow(VectorDot(%r,%c),2) * VectorDot(%r,%r) * (mPow(%g,2)-VectorDot(%c,%c));
|
||||
if (%root1 < 0) //Will never be in range.
|
||||
return "";
|
||||
%root2 = VectorDot(%r,%r)*(VectorDot(%r,%r)*mPow(%v,2)-2*%a*(VectorDot(%r,%c)+mSqrt(%root)));
|
||||
if (%root2 < 0) //Will never be in range.
|
||||
return "";
|
||||
%time = (-1*%v + mSqrt(%root2)/VectorDot(%r,%r))/%a;
|
||||
if (%time < 0) //'was'in range.
|
||||
return "";
|
||||
return %time; //Note this is seconds not ms.
|
||||
}
|
||||
else
|
||||
{
|
||||
%root = mPow(%v)*(4*VectorDot(%r,%c) - 4*VectorDot(%r,%r)*(VectorDot(%c,%c)-mPow(%g,2)));
|
||||
if (%root < 0) //Will never be in range.
|
||||
return "";
|
||||
%time = (-2*%v*VectorDot(%r,%c) + mSqrt(%root)) / (2*VectorDot(%r,%r) * mPow(%v,2));
|
||||
if (%time < 0) //'was'in range.
|
||||
return "";
|
||||
return %time; //Note this is seconds not ms.
|
||||
}
|
||||
}
|
||||
|
||||
1806
scripts/packs/Effectpacks.cs
Normal file
1806
scripts/packs/Effectpacks.cs
Normal file
File diff suppressed because it is too large
Load diff
242
scripts/packs/blastfloor.cs
Normal file
242
scripts/packs/blastfloor.cs
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
//---------------------------------------------------------
|
||||
// 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 = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"floor");
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedFloor::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, FloorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function FloorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasFloor = true; // set for floorcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function FloorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasFloor = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
271
scripts/packs/blastwall.cs
Normal file
271
scripts/packs/blastwall.cs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable wall, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedWall) : StaticShapeDamageProfile {
|
||||
className = "wall";
|
||||
shapeFile = "Bmiscf.dts"; // dmiscf.dts, alternate
|
||||
|
||||
maxDamage = 2;
|
||||
destroyedLevel = 2;
|
||||
disabledLevel = 1.5;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 60;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Blast Wall';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(WallDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "WallDeployableImage";
|
||||
pickUpName = "a light blast wall pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function WallDeployableImage::testObjectTooClose(%item) {
|
||||
return "";
|
||||
}
|
||||
|
||||
function WallDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function WallDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function WallDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
//Object
|
||||
%className = "StaticShape";
|
||||
|
||||
%grounded = 0;
|
||||
if (%item.surface.getClassName() $= TerrainBlock)
|
||||
%grounded = 1;
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (%item.surfaceinher == 0) {
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
}
|
||||
|
||||
%scale = "0.5 8 40"; // Search range for total blast wall size.
|
||||
|
||||
%mCenter = "0 0 -0.5";
|
||||
%pad = pad(%item.surfacePt SPC %item.surfaceNrm SPC %item.surfaceNrm2,%scale,%mCenter);
|
||||
%scale = getWords(%pad,0,2);
|
||||
|
||||
%item.surfacePt = getWords(%pad,3,5);
|
||||
%rot = getWords(%pad,6,9);
|
||||
%offset = %plyr.packSet - 1;
|
||||
if (%plyr.packSet == 3) {
|
||||
%double = 1;
|
||||
%offset = 1;
|
||||
}
|
||||
|
||||
%scale = vectorAdd(%scale,vectorScale("1.01 1.01" SPC %double,mAbs(%offset)));
|
||||
|
||||
%pup = mCeil(getWord(%scale,0)/4); //4 = Avarage blast wall height.
|
||||
%pside = mCeil(getWord(%scale,1)/4); //4 = Avarage blast wall width.
|
||||
%upiece = getWord(%scale,0)/%pup;
|
||||
%spiece = getWord(%scale,1)/%pside;
|
||||
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
%dir = VectorNormalize(vectorSub(%item.surfacePt,%plyr.getposition()));
|
||||
%adjust = vectorNormalize(vectorProject(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
|
||||
// %adjust = vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2));
|
||||
|
||||
if (%plyr.packSet == 3)
|
||||
%offset = Lev(vectorCouple(%dir,vectorCross(%item.surfaceNrm,%item.surfaceNrm2)));
|
||||
|
||||
%adjust = vectorScale(%adjust,-0.5 * %offset);
|
||||
|
||||
if ($Host::ExpertMode == 1 && %plyr.expertSet == 1) {
|
||||
for (%x = 0;%x < %pup;%x++){
|
||||
for (%y = 0;%y < %pside;%y++){
|
||||
%scale = %upiece SPC %spiece SPC 0.5 + %double;
|
||||
%scale = vectorMultiply(%scale,1/4 SPC 1/3 SPC 2);
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
%up = vectorScale(%item.surfaceNrm,%upiece * (%x - (%pup / 2) + 0.5));
|
||||
%side = vectorScale(%item.surfaceNrm2,%spiece * (%y - (%pside / 2) + 0.5));
|
||||
%tadjust = vectorAdd(%up,vectorAdd(%side,%adjust));
|
||||
%deplObj.setTransform(vectorAdd(%item.surfacePt,%tadjust) SPC %rot);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.Needsfit = 1;
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
// let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
%deplObj.setTransform(vectorAdd(%item.surfacePt,%adjust) SPC %rot);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.Needsfit = 1;
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [Normal Stuff]]:
|
||||
|
||||
// if(%deplObj.getDatablock().rechargeRate)
|
||||
// %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
}
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedWall::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, WallDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
cascade(%obj);
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function WallDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasBlast = true; // set for blastcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function WallDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasBlast = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function doorfunction(%player,%door)
|
||||
{
|
||||
%vec = VectorSub(%door,%player);
|
||||
%dir = VectorNormalize(%vec);
|
||||
%nrm = topVec(VirVec(%door,%dir));
|
||||
}
|
||||
225
scripts/packs/blastwwall.cs
Normal file
225
scripts/packs/blastwwall.cs
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable wall, Code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedwWall) : StaticShapeDamageProfile {
|
||||
className = "wwall";
|
||||
shapeFile = "smiscf.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 240;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.25;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 3.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Light Walk Way';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(wWallDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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 = "";
|
||||
}
|
||||
248
scripts/packs/cratepack.cs
Normal file
248
scripts/packs/cratepack.cs
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Crates
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedCrate) : StaticShapeDamageProfile {
|
||||
className = "crate";
|
||||
shapeFile = "stackable3s.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 Crate';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
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 = 1;
|
||||
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 = 1;
|
||||
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) {
|
||||
DeployedCrate::onDestroyed(%this,%obj,%prevState);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
51
scripts/packs/deconExamples.cs
Normal file
51
scripts/packs/deconExamples.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//------------------------------------------------
|
||||
// Examples of item specific disassemble.
|
||||
//================================================
|
||||
// ----------------
|
||||
// 1. ONE
|
||||
// ================
|
||||
function TelePadDeployedBase::disassemble(%data, %plyr, %hTgt)
|
||||
{
|
||||
%teleteam = %hTgt.team;
|
||||
if(%obj.Hacked) // is it hacked currently?
|
||||
{
|
||||
%teleteam = %hTgt.OldTeam;
|
||||
echo("hacked!");
|
||||
}
|
||||
|
||||
// dising a telepad makes it yours, remove from the other teams list
|
||||
if($TeamDeployedCount[%teleteam, TelePadPack] > 0) // this wasnt the last
|
||||
{
|
||||
if($firstPad[%teleteam] == %hTgt) // the first was disassembled
|
||||
{
|
||||
echo("first pad disassembled");
|
||||
$firstPad[%teleteam] = %ohTgtbj.nextPad; // make the second one the first
|
||||
%hTgt.prevPad = -1;
|
||||
%hTgt.nextPad = %obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
%lastPad = $firstPad[%teleteam];
|
||||
%hTgt.prevPad.nextPad = %hTgt.nextPad;
|
||||
%hTgt.nextPad.prevPad = %hTgt.prevPad;
|
||||
}
|
||||
|
||||
}
|
||||
else // last one
|
||||
{
|
||||
$firstPad[%teleteam] = ""; // remove it
|
||||
}
|
||||
|
||||
%hTgt.shield.delete();
|
||||
}
|
||||
|
||||
// --------------
|
||||
// 2. Two
|
||||
// ==============
|
||||
|
||||
function MobileBaseVehicle::disassemble(%data, %plyr, %hTgt)
|
||||
{
|
||||
%mpbpos = %hTgt.gettransform();
|
||||
%hTgt.delete();
|
||||
teleporteffect(posfromtransform(%mpbpos));
|
||||
}
|
||||
376
scripts/packs/decorationpack.cs
Normal file
376
scripts/packs/decorationpack.cs
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
//---------------------------------------------------------
|
||||
// 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 ShapeBaseImageData(DecorationDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
}
|
||||
257
scripts/packs/discturret.cs
Normal file
257
scripts/packs/discturret.cs
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Datablocks Disc turret
|
||||
//--------------------------------------
|
||||
|
||||
datablock SensorData(DiscTurretSensor)
|
||||
{
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = false;
|
||||
detectsActiveJammed = false;
|
||||
detectsCloaked = false;
|
||||
detectionPings = true;
|
||||
detectRadius = 60;
|
||||
};
|
||||
|
||||
datablock TurretData(DiscTurretDeployed) : TurretDamageProfile
|
||||
{
|
||||
className = DeployedTurret;
|
||||
shapeFile = "turret_outdoor_deploy.dts";
|
||||
mass = 1;
|
||||
maxDamage = 1.5; //was 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.21;
|
||||
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 = 30;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.20; //was 0.10;
|
||||
barrel = DeployableDiscTurretBarrel;
|
||||
canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Disc';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = DiscTurretSensor;
|
||||
sensorRadius = DiscTurretSensor.detectRadius;
|
||||
sensorColor = "191 0 226";
|
||||
firstPersonOnly = true;
|
||||
renderWhenDestroyed = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = TurretDebrisSmall;
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableDiscTurretBarrel)
|
||||
{
|
||||
shapeFile = "weapon_disc.dts";
|
||||
item = DiscTurretBarrel;
|
||||
rotation = "0 1 0 90";
|
||||
//rotation = "0 0 0 0";
|
||||
offset = "0 0 0";
|
||||
projectile = DiscProjectile;
|
||||
projectileType = LinearProjectile;
|
||||
usesEnergy = true;
|
||||
fireEnergy = 10; ///was 20
|
||||
minEnergy = 10; ///was 20
|
||||
lightType = "WeaponFireLight";
|
||||
lightColor = "0.25 0.15 0.15 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "2";
|
||||
muzzleFlash = IndoorTurretMuzzleFlash;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 150;
|
||||
deactivateDelayMS = 300;
|
||||
thinkTimeMS = 150;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 960;
|
||||
attackRadius = 150; //100
|
||||
|
||||
// State Data
|
||||
stateName[0] = "Preactivate";
|
||||
stateTransitionOnLoaded[0] = "Activate";
|
||||
stateTransitionOnNoAmmo[0] = "NoAmmo";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateTransitionOnTimeout[1] = "Ready";
|
||||
stateTimeoutValue[1] = 0.05;
|
||||
stateSequence[1] = "Activated";
|
||||
stateSound[1] = DiscSwitchSound;
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateTransitionOnNoAmmo[2] = "NoAmmo";
|
||||
stateTransitionOnTriggerDown[2] = "Fire";
|
||||
stateSequence[2] = "DiscSpin";
|
||||
stateSound[2] = DiscLoopSound;
|
||||
|
||||
stateName[3] = "Fire";
|
||||
stateTransitionOnTimeout[3] = "Reload";
|
||||
stateTimeoutValue[3] = 0.025;
|
||||
stateFire[3] = true;
|
||||
stateRecoil[3] = LightRecoil;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateScript[3] = "onFire";
|
||||
stateSound[3] = DiscFireSound;
|
||||
|
||||
stateName[4] = "Reload";
|
||||
stateTransitionOnNoAmmo[4] = "NoAmmo";
|
||||
stateTransitionOnTimeout[4] = "Ready";
|
||||
stateTimeoutValue[4] = 0.1; // 0.25 load, 0.25 spinup
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "Reload";
|
||||
stateSound[4] = DiscReloadSound;
|
||||
|
||||
stateName[5] = "NoAmmo";
|
||||
stateTransitionOnAmmo[5] = "Reload";
|
||||
stateSequence[5] = "NoAmmo";
|
||||
stateTransitionOnTriggerDown[5] = "DryFire";
|
||||
|
||||
stateName[6] = "DryFire";
|
||||
//stateSound[6] = DiscDryFireSound;
|
||||
stateTimeoutValue[6] = 0.1;
|
||||
stateTransitionOnTimeout[6] = "NoAmmo";
|
||||
|
||||
};
|
||||
datablock ShapeBaseImageData(DiscTurretDeployableImage)
|
||||
{
|
||||
mass = 1;
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
item = DiscTurretDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DiscTurretDeployed;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
emap = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = TurretDeploySound;
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(DiscTurretDeployable)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "DiscTurretDeployableImage";
|
||||
pickUpName = "a disc turret pack";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Functions
|
||||
//--------------------------------------
|
||||
|
||||
function DiscTurretDeployableImage::testNoTerrainFound(%item)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function DiscTurretDeployableImage::testNoInteriorFound(%item)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function DiscTurretDeployableImage::onDeploy(%item, %plyr, %slot)
|
||||
{
|
||||
%searchRange = 5.0;
|
||||
%mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType;
|
||||
%eyeVec = %plyr.getEyeVector();
|
||||
%eyeTrans = %plyr.getEyeTransform();
|
||||
%eyePos = posFromTransform(%eyeTrans);
|
||||
%nEyeVec = VectorNormalize(%eyeVec);
|
||||
%scEyeVec = VectorScale(%nEyeVec, %searchRange);
|
||||
%eyeEnd = VectorAdd(%eyePos, %scEyeVec);
|
||||
//%searchResult = containerRayCast(%eyePos, %eyeEnd, %mask, 0);
|
||||
//if(!%searchResult ) {
|
||||
//messageClient(%plyr.client, 'MsgBeaconNoSurface', 'c2Cannot place turret. You are too far from surface.');
|
||||
//return 0;
|
||||
//}
|
||||
%terrPt = %item.surfacept;
|
||||
%terrNrm = %item.surfacenrm;
|
||||
%intAngle = getTerrainAngle(%terrNrm);
|
||||
%rotAxis = vectorNormalize(vectorCross(%terrNrm, "0 0 1"));
|
||||
if ((getWord(%terrNrm, 2) == 1) || (getWord(%terrNrm, 2) == -1))
|
||||
%rotAxis = vectorNormalize(vectorCross(%terrNrm, "0 1 0"));
|
||||
%rotation = %rotAxis @ " " @ %intAngle;
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
%deplObj = new Turret() {
|
||||
dataBlock = %item.deployed;
|
||||
position = VectorAdd(%terrPt, VectorScale(%terrNrm, 0.03));
|
||||
rotation = %rotation;
|
||||
};
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.setOwnerClient(%plyr.client);
|
||||
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]++;
|
||||
%deplObj.deploy();
|
||||
%deplObj.playThread($AmbientThread, "ambient");
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DiscTurretDeployable::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function DeployableDiscTurretBarrel::onFire( %data, %obj, %slot ) {
|
||||
%energy = %obj.getEnergyLevel();
|
||||
%p = new (LinearProjectile)() {
|
||||
dataBlock = DiscProjectile;
|
||||
initialDirection = %obj.getMuzzleVector(%slot);
|
||||
initialPosition = %obj.getMuzzlePoint(%slot);
|
||||
sourceObject = %obj;
|
||||
damageFactor = 1;
|
||||
sourceSlot = %slot;
|
||||
};
|
||||
%obj.lastProjectile = %p;
|
||||
MissionCleanup.add(%p);
|
||||
%obj.setEnergyLevel(%energy - %data.fireEnergy);
|
||||
}
|
||||
|
||||
function DiscTurretDeployed::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team, DiscTurretDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
330
scripts/packs/door.cs
Normal file
330
scripts/packs/door.cs
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
//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 = 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 = '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 made by Linker";
|
||||
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();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
%deplobj.timeout=getWord($expertSetting["Door",%plyr.expertSet],0);
|
||||
%deplobj.hasslided=0;
|
||||
|
||||
if (%plyr.packset==0)
|
||||
%deplobj.toggletype=0;
|
||||
|
||||
if (%plyr.packset==1)
|
||||
%deplobj.toggletype=1;
|
||||
|
||||
if (%plyr.packset==2) {
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.powercontrol=1; //staticshape.cs function StaticShapeData::onGainPowerEnabled |and| function StaticShapeData::onLosePowerDisabled
|
||||
} //for power togle code
|
||||
|
||||
if (%plyr.packset==3) {
|
||||
%deplobj.toggletype=1;
|
||||
%deplobj.powercontrol=1;
|
||||
}
|
||||
//collision door
|
||||
if (%plyr.packset==4){
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.Collision = true;
|
||||
%deplobj.lv =0;
|
||||
}
|
||||
//owner door
|
||||
if (%plyr.packset==5){
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.Collision = true;
|
||||
%deplobj.lv =1;
|
||||
}
|
||||
//admin door
|
||||
if (%plyr.packset==6){
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.Collision = true;
|
||||
%deplobj.lv =2;
|
||||
}
|
||||
if (%plyr.packset==7){
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.Collision = true;
|
||||
%deplobj.lv =0;
|
||||
%deplobj.canlock = true;
|
||||
}
|
||||
%deplobj.canmove = true;
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function Deployeddoor::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, TdoorDeployable]--;
|
||||
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 open(%obj){
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
if (%obj.canmove == true){
|
||||
%obj.moving = "open"; //wat direction its moving
|
||||
%obj.prevscale =%obj.scale; //scale befor this change
|
||||
%obj.closedscale=%obj.scale;//scale it is while fully closed
|
||||
%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"; //last state used for savebuilding
|
||||
%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"; //wat direction its moving
|
||||
%obj.prevscale =%obj.scale; //scale befor this change
|
||||
%obj.openedscale=%obj.scale;//scale it is while fully opened
|
||||
%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"; //last state used for savebuilding
|
||||
%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);
|
||||
}
|
||||
322
scripts/packs/doorbu.cs
Normal file
322
scripts/packs/doorbu.cs
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable door, Code by Linker
|
||||
// Modified by Electricutioner/Thyth to prevent server crash exploit.
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock EffectProfile(DoorCloseEffect)
|
||||
{
|
||||
effectname = "weapons/missile_fire";
|
||||
minDistance = 0.5;
|
||||
maxDistance = 20.0;
|
||||
};
|
||||
|
||||
datablock AudioProfile(DoorCloseSound)
|
||||
{
|
||||
filename = "fx/vehicles/tank_mortar_fire.wav";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
effect = DoorCloseEffect;
|
||||
};
|
||||
|
||||
|
||||
datablock StaticShapeData(DeployedDoor) : StaticShapeDamageProfile {
|
||||
className = "door";
|
||||
shapeFile = "Pmiscf.dts"; // b or 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 = '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 made by Linker";
|
||||
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::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();
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
%deplobj.slidevec=%deplobj.dsurface.getedge("0 0 0");
|
||||
|
||||
%deplobj.timeout=getWord($expertSetting["Door",%plyr.expertSet],0);
|
||||
%deplobj.initialtransform=%deplobj.gettransform();
|
||||
%deplobj.hasslided=0;
|
||||
|
||||
if (%plyr.packset==1)
|
||||
%deplobj.toggletype=1;
|
||||
|
||||
if (%plyr.packset==2) {
|
||||
%deplobj.toggletype=0;
|
||||
%deplobj.powercontrol=1;
|
||||
}
|
||||
|
||||
if (%plyr.packset==3) {
|
||||
%deplobj.toggletype=1;
|
||||
%deplobj.powercontrol=1;
|
||||
}
|
||||
|
||||
if (%plyr.packset==0)
|
||||
%deplobj.toggletype=0;
|
||||
|
||||
if (%pad)
|
||||
deployEffect(%deplObj,%item.surfacePt,%item.surfaceNrm,"pad");
|
||||
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 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 open(%obj){
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
if (%obj.issliding !=1 && %obj.canmove == true){
|
||||
%obj.issliding = 1;
|
||||
%obj.moving = "open";
|
||||
%obj.dist = getWord(%obj.scale,2);
|
||||
%amount1 = %obj.dist*100;
|
||||
%amount2 = mfloor(%amount1);
|
||||
%obj.amount = %amount2/5;
|
||||
%obj.oldscale = %obj.scale;
|
||||
%obj.prevscale=%obj.scale;
|
||||
%obj.canmove = false;
|
||||
}
|
||||
|
||||
if (getWord(%obj.scale,2)<0.4){
|
||||
%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.issliding !=1){
|
||||
%obj.issliding = 1;
|
||||
%obj.moving = "close";
|
||||
%obj.dist = getWord(%obj.oldscale,2);
|
||||
%amount1 = %obj.dist*100;
|
||||
%amount2 = mfloor(%amount1);
|
||||
%obj.amount = %amount2/10;
|
||||
%obj.prevscale=%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);
|
||||
}
|
||||
|
||||
|
||||
385
scripts/packs/energizer.cs
Normal file
385
scripts/packs/energizer.cs
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Energizer
|
||||
//--------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedEnergizer) : StaticShapeDamageProfile {
|
||||
className = "energizer";
|
||||
shapeFile = "deploy_sensor_motion.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 30;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.05;
|
||||
|
||||
explosion = SatchelMainExplosion;
|
||||
underwaterExplosion = UnderwaterSatchelMainExplosion;
|
||||
|
||||
expDmgRadius = 20.0;
|
||||
expDamage = 1.25;
|
||||
expImpulse = 1500.0;
|
||||
|
||||
dynamicType = $TypeMasks::StationObjectType;
|
||||
renderWhenDestroyed = false;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.1 0.8 1.0";
|
||||
lightTime = "100";
|
||||
lightRadius = "3";
|
||||
|
||||
humSound = GeneratorHumSound;
|
||||
|
||||
EnergizeOthers = true;
|
||||
EnergizeRadius = 35;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSwitchIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Energizer';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock ItemData(EnergizerLight) : StaticShapeDamageProfile {
|
||||
className = "energizerlight";
|
||||
shapeFile = "beacon.dts";
|
||||
|
||||
maxDamage = 2.0;
|
||||
destroyedLevel = 2.0;
|
||||
disabledLevel = 2.0;
|
||||
|
||||
mass = 1;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
|
||||
collideable = 1;
|
||||
pickupRadius = 1;
|
||||
sticky = false;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.1;
|
||||
expImpulse = 200.0;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.8 0.1 0.1 1.0";
|
||||
lightTime = "100";
|
||||
lightRadius = "1";
|
||||
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(EnergizerDeployableImage) {
|
||||
mass = 1;
|
||||
shapeFile = "deploy_sensor_motion.dts";
|
||||
scale = 2.5 / 3.85 @ " " @ 2.5 / 3.1 @ " " @ 5 / 3.1;
|
||||
item = EnergizerDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = EnergizerDeployed;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.1 0.8 1.0";
|
||||
lightTime = "100";
|
||||
lightRadius = "3";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
emap = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = TurretDeploySound;
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(EnergizerDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "deploy_sensor_motion.dts";
|
||||
scale = 2.5 / 3.85 @ " " @ 2.5 / 3.1 @ " " @ 5 / 3.1;
|
||||
mass = 1;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.1 0.8 1.0";
|
||||
lightTime = "500";
|
||||
lightRadius = "3";
|
||||
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = "EnergizerDeployableImage";
|
||||
pickUpName = "an energizer pack";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Functions
|
||||
//--------------------------------------
|
||||
|
||||
function EnergizerDeployableImage::testObjectTooClose(%item,%surfacePt,%plyr) {
|
||||
%mask = ($TypeMasks::VehicleObjectType | $TypeMasks::MoveableObjectType |
|
||||
$TypeMasks::StaticShapeObjectType |
|
||||
$TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType |
|
||||
$TypeMasks::PlayerObjectType | $TypeMasks::TurretObjectType);
|
||||
|
||||
InitContainerRadiusSearch(%item.surfacePt,30,%mask);
|
||||
|
||||
while ((%test = containerSearchNext()) != 0) {
|
||||
if (%test.team !$= "" && %test.team != %plyr.team)
|
||||
return %test;
|
||||
}
|
||||
Parent::testObjectTooClose(%item,%surfacePt,%plyr);
|
||||
}
|
||||
|
||||
function DeployedEnergizer::disassemble(%data,%plyr,%hTgt) {
|
||||
%hTgt.l1.schedule(500, "delete");
|
||||
%hTgt.l2.schedule(500, "delete");
|
||||
%hTgt.l3.schedule(500, "delete");
|
||||
%hTgt.l4.schedule(500, "delete");
|
||||
disassemble(%data,%plyr,%hTgt);
|
||||
}
|
||||
|
||||
function DeployedEnergizer::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, EnergizerDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
%obj.l1.schedule(500, "delete");
|
||||
%obj.l2.schedule(500, "delete");
|
||||
%obj.l3.schedule(500, "delete");
|
||||
%obj.l4.schedule(500, "delete");
|
||||
|
||||
RadiusExplosion(%obj, %obj.getWorldBoxCenter(), %obj.expDmgRadius, %obj.expDamage, %obj.expImpulse, %obj, $DamageType::Explosion);
|
||||
fireBallExplode(%obj,10);
|
||||
}
|
||||
|
||||
function EnergizerDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
//Object
|
||||
%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);
|
||||
%scale = "5 5 5";
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = "DeployedEnergizer";
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
//Object
|
||||
%className = "Item";
|
||||
%deplObj.l1 = new (%className)() {
|
||||
dataBlock = "EnergizerLight";
|
||||
position = vectorAdd(%item.surfacePt, "2 0 1");
|
||||
rotation = %rot;
|
||||
scale = "1 1 1";
|
||||
};
|
||||
|
||||
%deplObj.l2 = new (%className)() {
|
||||
dataBlock = "EnergizerLight";
|
||||
position = vectorAdd(%item.surfacePt, "0 2 1");
|
||||
rotation = %rot;
|
||||
scale = "1 1 1";
|
||||
};
|
||||
|
||||
%deplObj.l3 = new (%className)() {
|
||||
dataBlock = "EnergizerLight";
|
||||
position = vectorAdd(%item.surfacePt, "-2 0 1");
|
||||
rotation = %rot;
|
||||
scale = "1 1 1";
|
||||
};
|
||||
|
||||
%deplObj.l4 = new (%className)() {
|
||||
dataBlock = "EnergizerLight";
|
||||
position = vectorAdd(%item.surfacePt, "0 -2 1");
|
||||
rotation = %rot;
|
||||
scale = "1 1 1";
|
||||
};
|
||||
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
%deplObj.l1.team = %plyr.client.team;
|
||||
%deplObj.l1.setOwner(%plyr);
|
||||
%deplObj.l2.team = %plyr.client.team;
|
||||
%deplObj.l2.setOwner(%plyr);
|
||||
%deplObj.l3.team = %plyr.client.team;
|
||||
%deplObj.l3.setOwner(%plyr);
|
||||
%deplObj.l4.team = %plyr.client.team;
|
||||
%deplObj.l4.setOwner(%plyr);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
if (%deplObj.l1.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.l1.getTarget(), %plyr.client.team);
|
||||
if (%deplObj.l2.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.l1.getTarget(), %plyr.client.team);
|
||||
if (%deplObj.l3.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.l1.getTarget(), %plyr.client.team);
|
||||
if (%deplObj.l4.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.l1.getTarget(), %plyr.client.team);
|
||||
|
||||
addToDeployGroup(%deplObj);
|
||||
addToDeployGroup(%deplObj.l1);
|
||||
addToDeployGroup(%deplObj.l2);
|
||||
addToDeployGroup(%deplObj.l3);
|
||||
addToDeployGroup(%deplObj.l4);
|
||||
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
AIDeployObject(%plyr.client, %deplObj.l1);
|
||||
AIDeployObject(%plyr.client, %deplObj.l2);
|
||||
AIDeployObject(%plyr.client, %deplObj.l3);
|
||||
AIDeployObject(%plyr.client, %deplObj.l4);
|
||||
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
%deplObj.deploy();
|
||||
|
||||
%deplObj.playThread($AmbientThread, "ambient");
|
||||
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function EnergizerDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function EnergizeLoop() {
|
||||
if (!isObject(MissionCleanup)) {
|
||||
schedule(10000, 0, "StartEnergizeLoop");
|
||||
return;
|
||||
}
|
||||
|
||||
%dep = nameToID("MissionCleanup/Deployables");
|
||||
%clCount = ClientGroup.getCount();
|
||||
%depCount = %dep.getCount();
|
||||
for (%i=0;%i<%clCount;%i++) {
|
||||
ClientGroup.getObject(%i).shouldEnergize = 0;
|
||||
}
|
||||
for (%i=0;%i<%depCount;%i++) {
|
||||
%obj = %dep.getObject(%i);
|
||||
if (isObject(%obj)) {
|
||||
%data = %obj.getDataBlock();
|
||||
if (%data) {
|
||||
if (%data.energizeOthers && %obj.isEnabled()) {
|
||||
%pos = posFromTransform(%obj.getTransform());
|
||||
for(%i2=0;%i2<%clCount;%i2++) {
|
||||
%obj2 = ClientGroup.getObject(%i2).player;
|
||||
if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) {
|
||||
%pos2 = %obj2.getPosition();
|
||||
if (vectorDist(%pos, %pos2) < %data.EnergizeRadius && %obj2.getArmorSize() $= "Heavy")
|
||||
%obj2.client.shouldEnergize = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (%i=0;%i<%clCount;%i++) {
|
||||
%client = ClientGroup.getObject(%i);
|
||||
%obj = %client.player;
|
||||
if (isObject(%obj)) {
|
||||
if ((%client.shouldEnergize) && (!%obj.energized)) {
|
||||
%obj.energized = 1;
|
||||
if (!%obj.hasEnergizer)
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() + 0.5);
|
||||
messageClient(%obj.client, 'msgClient', '\c2Entering energizer coverage.');
|
||||
}
|
||||
else if (!%client.shouldEnergize && %obj.energized) {
|
||||
%obj.energized = "";
|
||||
if (%obj.hasEnergizer)
|
||||
messageClient(%obj.client, 'msgClient', '\c2Leaving energizer coverage, switching to energizer pack.');
|
||||
else {
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() - 0.5);
|
||||
messageClient(%obj.client, 'msgClient', '\c2Leaving energizer coverage, switching to armor power.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (%i=0;%i<%depCount;%i++) {
|
||||
%obj = %dep.getObject(%i);
|
||||
if (isObject(%obj)) {
|
||||
%data = %obj.getDataBlock();
|
||||
if (%data.energizeOthers) {
|
||||
if (%obj.energized)
|
||||
%obj.energized = "";
|
||||
}
|
||||
else if ((%obj.shouldEnergize) && (!%obj.energized)) {
|
||||
%obj.energized = 1;
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() + 0.5);
|
||||
}
|
||||
else if ((!%obj.shouldEnergize) && (%obj.energized)) {
|
||||
%obj.energized = "";
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() - 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
schedule(1000, 0, "EnergizeLoop");
|
||||
}
|
||||
|
||||
function StartEnergizeLoop() {
|
||||
$EnergizeLoop = 1;
|
||||
if (!isObject(MissionCleanup)) {
|
||||
schedule(10000, 0, "StartEnergizeLoop");
|
||||
return;
|
||||
}
|
||||
%depGroup = nameToID("MissionCleanup/Deployables");
|
||||
if (%depGroup <= 0) {
|
||||
%depGroup = new SimGroup("Deployables");
|
||||
MissionCleanup.add(%depGroup);
|
||||
}
|
||||
EnergizeLoop();
|
||||
}
|
||||
|
||||
function EnergizerDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasEnergizer = true;
|
||||
if (!%obj.energized)
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() + 0.5);
|
||||
}
|
||||
|
||||
function EnergizerDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasEnergizer = "";
|
||||
if (!%obj.energized)
|
||||
%obj.setRechargeRate(%obj.getRechargeRate() - 0.5);
|
||||
}
|
||||
393
scripts/packs/escapepodpack.cs
Normal file
393
scripts/packs/escapepodpack.cs
Normal file
|
|
@ -0,0 +1,393 @@
|
|||
// Escape Pod Pack
|
||||
|
||||
datablock AudioProfile(EscapePodChargeSound) {
|
||||
filename = "fx/misc/cannonstart.wav";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(EscapePodBeepSound) {
|
||||
filename = "fx/misc/warning_beep.wav";
|
||||
description = AudioClosest3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(EscapePodLaunchSound) {
|
||||
filename = "fx/Bonuses/high-level4-blazing.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(EscapePodLaunchSound2) {
|
||||
filename = "fx/Bonuses/down_passback3_rocket.wav";
|
||||
description = AudioBIGExplosion3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(EscapePodReloadSound) {
|
||||
filename = "fx/powered/turret_heavy_reload.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(EscapePodFadeSound) {
|
||||
filename = "fx/Bonuses/upward_perppass2_quark.wav";
|
||||
description = AudioClose3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedEscapePod) : StaticShapeDamageProfile {
|
||||
className = "escapepod";
|
||||
shapeFile = "TR2weapon_mortar.dts";
|
||||
|
||||
maxDamage = 1;
|
||||
destroyedLevel = 1;
|
||||
disabledLevel = 1;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 75;
|
||||
maxEnergy = 50;
|
||||
rechargeRate = 0.35;
|
||||
|
||||
explosion = ShapeExplosion;
|
||||
expDmgRadius = 8.0;
|
||||
expDamage = 0.4;
|
||||
expImpulse = 1500;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Escape Pod';
|
||||
deployAmbientThread = false;
|
||||
debrisShapeName = "debris_generic.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 1;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(EscapePodDeployableImage) {
|
||||
mass = 1;
|
||||
emap = true;
|
||||
shapeFile = "stackable1s.dts";
|
||||
item = EscapePodDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = DeployedEscapePod;
|
||||
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.25;
|
||||
maxDeployDis = 5;
|
||||
};
|
||||
|
||||
datablock ItemData(EscapePodDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "EscapePodDeployableImage";
|
||||
pickUpName = "an escape pod pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function EscapePodDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function EscapePodDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function EscapePodDeployableImage::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 = DeployedEscapePod;
|
||||
scale = "4 2 4";
|
||||
impulse = $packSetting["escapepod",%plyr.packSet];
|
||||
};
|
||||
|
||||
%deplObj.lTarget = new StaticShape () {
|
||||
datablock = DeployedLTarget;
|
||||
scale = vectorMultiply("1 3 0.25",1/4 SPC 1/3 SPC 2);
|
||||
};
|
||||
|
||||
%deplObj.lTarget.lMain = %deplObj;
|
||||
|
||||
// set orientation
|
||||
%deplObj.lTarget.setTransform(%item.surfacePt SPC %rot);
|
||||
adjustEscapePod(%deplObj);
|
||||
escapePodLoop(%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);
|
||||
if (%deplObj.lTarget) {
|
||||
%deplObj.lTarget.team = %plyr.client.Team;
|
||||
%deplObj.lTarget.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);
|
||||
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]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
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 DeployedEscapePod::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this,%obj,%prevState);
|
||||
$TeamDeployedCount[%obj.team, EscapePodDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
if (isObject(%obj.lTarget))
|
||||
%obj.lTarget.schedule(500, "delete");
|
||||
if (isObject(%obj.podVehicle))
|
||||
%obj.podVehicle.schedule(500,setDamageState,Destroyed);
|
||||
}
|
||||
|
||||
function DeployedEscapePod::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.podVehicle))
|
||||
%obj.podVehicle.startFade(500,0,1);
|
||||
%obj.podVehicle.schedule(500,delete);
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function adjustEscapePod(%obj) {
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
%lTarget = %obj.lTarget;
|
||||
%pos = %lTarget.getPosition();
|
||||
%rot = %lTarget.getRotation();
|
||||
%nrm = realVec(%lTarget,"0 0 1");
|
||||
%obj.setTransform(vectorAdd(%pos,vectorScale(%nrm,1.25)) SPC %rot);
|
||||
}
|
||||
|
||||
function escapePodLoop(%obj) {
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
if (%obj.getDamageState() !$= "Enabled")
|
||||
return;
|
||||
cancel(%obj.escapePodLoop);
|
||||
%lTarget = %obj.lTarget;
|
||||
%pos = %lTarget.getPosition();
|
||||
%nrm = realVec(%lTarget,"0 0 1");
|
||||
%nrm2 = realVec(%lTarget,"1 0 0");
|
||||
%epod = %obj.podVehicle;
|
||||
if (isObject(%epod)) {
|
||||
if (%epod.player) {
|
||||
%player = %epod.getMountedObject(0);
|
||||
if (isObject(%player)) {
|
||||
if (%player.getState() $= "Dead") {
|
||||
%remove = true;
|
||||
if (!%player.podFaded) {
|
||||
%player.startFade(2000,0,1);
|
||||
%player.podFaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
%remove = true;
|
||||
}
|
||||
else {
|
||||
// Remove when launched manually (no player)
|
||||
if (%epod.launched)
|
||||
%remove = true;
|
||||
}
|
||||
if (%remove == true)
|
||||
%epod.getDataBlock().fadeOutVehicle(%epod);
|
||||
}
|
||||
else {
|
||||
%epod = new HoverVehicle() {
|
||||
dataBlock = "EscapePodVehicle";
|
||||
scale = "1 1 1";
|
||||
team = %obj.team;
|
||||
mountable = "1";
|
||||
selfpower = "1";
|
||||
};
|
||||
%obj.podVehicle = %epod;
|
||||
setTargetSensorGroup(%epod.getTarget(),%epod.team);
|
||||
%epod.launcher = %obj;
|
||||
%epod.setFrozenState(true);
|
||||
%epod.setTransform(vectorAdd(%pos,vectorScale(%nrm,1)) SPC fullRot(%nrm,vectorScale(%nrm2,-1)));
|
||||
%obj.play3D(EscapePodReloadSound);
|
||||
%obj.stopThread($AmbientThread);
|
||||
%obj.setThreadDir($AmbientThread,0);
|
||||
%obj.playThread($AmbientThread,"recoil");
|
||||
%obj.schedule(1000,stopThread,$AmbientThread);
|
||||
}
|
||||
%obj.escapePodLoop = schedule(1000,0,escapePodLoop,%obj);
|
||||
}
|
||||
|
||||
function EscapePodDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasEscapePod = true; // set for podcheck
|
||||
%obj.packSet = 7;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function EscapePodDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
%obj.hasEscapePod = "";
|
||||
}
|
||||
|
||||
function EscapePodVehicle::isBlocked(%data,%obj,%player) {
|
||||
%pos = %obj.getPosition();
|
||||
%startPos = vectorAdd(%pos,vectorScale(realVec(%obj,"0 -1 0"),2));
|
||||
%endPos = vectorAdd(%pos,vectorScale(realVec(%obj,"0 1 0"),2));
|
||||
%mask = $TypeMasks::VehicleObjectType | $TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType | $TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::StaticObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::DamagableItemObjectType;
|
||||
%res = containerRayCast(%startPos,%endPos,%mask,%obj);
|
||||
if (%res)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function EscapePodVehicle::playerMounted(%data, %obj, %player, %node) {
|
||||
if (%obj.player)
|
||||
return;
|
||||
%obj.player = %player;
|
||||
%obj.playerMountedTime = getSimTime();
|
||||
// commandToClient(%player.client, 'setHudMode', 'Pilot', "Hoverbike", %node);
|
||||
|
||||
// update observers who are following this guy...
|
||||
if ( %player.client.observeCount > 0 )
|
||||
resetObserveFollow( %player.client, false );
|
||||
|
||||
%obj.play3D(EscapePodBeepSound);
|
||||
%data.schedule(1000,actionThreadPlayer,%player,"scoutRoot");
|
||||
%obj.schedule(1500,play3D,EscapePodChargeSound);
|
||||
%data.schedule(3000,launchPod,%obj,%player,%node);
|
||||
}
|
||||
|
||||
function EscapePodVehicle::actionThreadPlayer(%data,%player,%thread) {
|
||||
if (!isObject(%player))
|
||||
return;
|
||||
if (%player.getState() $= "Dead") {
|
||||
%player.startFade(2000,0,1);
|
||||
%player.podFaded = true;
|
||||
}
|
||||
else
|
||||
%player.setActionThread(%thread,true);
|
||||
}
|
||||
|
||||
function EscapePodVehicle::launchPod(%data,%obj,%player,%node) {
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
%obj.launched = true;
|
||||
%obj.play3D(EscapePodLaunchSound);
|
||||
%obj.play3D(EscapePodLaunchSound2);
|
||||
%launcher = %obj.launcher;
|
||||
if (isObject(%launcher)) {
|
||||
%launcher.stopThread($AmbientThread);
|
||||
%launcher.setThreadDir($AmbientThread,1);
|
||||
%launcher.playThread($AmbientThread,"recoil");
|
||||
%launcher.schedule(1000,stopThread,$AmbientThread);
|
||||
}
|
||||
%obj.setFrozenState(false);
|
||||
%obj.applyImpulse(%obj.getPosition(),vectorScale(realVec(%obj,"0 1 0"),%launcher.impulse));
|
||||
for(%i = 0; %i < 10; %i++)
|
||||
%data.schedule((%i * %i) * 10,emitLaunchPuff,%obj);
|
||||
}
|
||||
|
||||
function EscapePodVehicle::emitLaunchPuff(%data,%obj) {
|
||||
if (!isObject(%obj))
|
||||
return;
|
||||
%em = new ParticleEmissionDummy() {
|
||||
dataBlock = "defaultEmissionDummy";
|
||||
emitter = "VehicleLGESmokeEMitter";
|
||||
position = %obj.getPosition();
|
||||
scale = "1 1 1";
|
||||
velocity = "1";
|
||||
};
|
||||
MissionCleanup.add(%em);
|
||||
%em.schedule(1000,"delete");
|
||||
}
|
||||
|
||||
//function EscapePodVehicle::onDestroyed(%data, %obj, %prevState) {
|
||||
// Parent::onDestroyed(%data, %obj, %prevState);
|
||||
//}
|
||||
|
||||
|
||||
//function EscapePodVehicle::playerDismounted(%data, %obj, %player) {
|
||||
// Parent::playerDismounted(%data, %obj, %player);
|
||||
//}
|
||||
|
||||
function EscapePodVehicle::fadeOutVehicle(%data,%obj) {
|
||||
if (%obj.faded)
|
||||
return;
|
||||
%obj.faded = true;
|
||||
%obj.startFade(1000,4000,1);
|
||||
%obj.schedule(5000,delete);
|
||||
%obj.schedule(4000,play3D,EscapePodFadeSound);
|
||||
}
|
||||
|
||||
function EscapePodVehicle::onAdd(%this, %obj) {
|
||||
Parent::onAdd(%this, %obj);
|
||||
setTargetSensorGroup(%obj.getTarget(),%obj.team);
|
||||
}
|
||||
|
||||
function displayEscapePodBoostPower(%plyr) {
|
||||
%line = $packSetting["escapepod",%plyr.packSet];
|
||||
%max = $packSetting["escapepod",$packSettings["escapepod"]];
|
||||
%power = mAbs(mFloatLength(100 / %max * %line,1));
|
||||
bottomPrint(%plyr.client,"Escape Pod booster set to " @ %power @ "% power" ,2,1);
|
||||
}
|
||||
518
scripts/packs/forcefieldpack.cs
Normal file
518
scripts/packs/forcefieldpack.cs
Normal file
|
|
@ -0,0 +1,518 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Force Field
|
||||
//---------------------------------------------------------
|
||||
|
||||
// Translucencies
|
||||
%noPassTrans = 1.0;
|
||||
%teamPassTrans = 0.6;
|
||||
%allPassTrans = 0.2;
|
||||
|
||||
%dimDiv = 4;
|
||||
|
||||
// RGB
|
||||
%colourOn = 0.3;
|
||||
%colourOff = 0.0;
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField) {
|
||||
className = "forcefield";
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = "1.0 1.0 1.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetNameTag = 'Force Field';
|
||||
targetTypeTag = 'ForceField';
|
||||
texture[0] = "skins/forcef1";
|
||||
texture[1] = "skins/forcef2";
|
||||
texture[2] = "skins/forcef3";
|
||||
texture[3] = "skins/forcef4";
|
||||
texture[4] = "skins/forcef5";
|
||||
framesPerSec = 1; // 10
|
||||
numFrames = 5;
|
||||
scrollSpeed = 15;
|
||||
umapping = 0.01; // 1.0
|
||||
vmapping = 0.01; // 0.15
|
||||
deployedFrom = ForceFieldDeployable;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
// No pass
|
||||
datablock ForceFieldBareData(DeployedForceField0) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField1) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOff SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField2) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField3) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField4) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField5) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField6) : DeployedForceField {
|
||||
baseTranslucency = %noPassTrans;
|
||||
powerOffTranslucency = %noPassTrans / %dimDiv;
|
||||
teamPermiable = false;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
// Team pass
|
||||
datablock ForceFieldBareData(DeployedForceField7) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField8) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOff SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField9) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField10) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField11) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOff SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField12) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField13) : DeployedForceField {
|
||||
baseTranslucency = %teamPassTrans;
|
||||
powerOffTranslucency = %teamPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = false;
|
||||
color = %colourOn SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
// All pass
|
||||
datablock ForceFieldBareData(DeployedForceField14) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField15) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOff SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField16) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField17) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField18) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff SPC %colourOn SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField19) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ForceFieldBareData(DeployedForceField20) : DeployedForceField {
|
||||
baseTranslucency = %allPassTrans;
|
||||
powerOffTranslucency = %allPassTrans / %dimDiv;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(ForceFieldDeployableImage) {
|
||||
mass = 1;
|
||||
emap = true;
|
||||
shapeFile = "ammo_chaingun.dts";
|
||||
item = ForceFieldDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "-0.2 -0.125 0";
|
||||
rotation = "0 -1 0 90";
|
||||
deployed = DeployedForceField;
|
||||
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(ForceFieldDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "stackable1s.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "ForceFieldDeployableImage";
|
||||
pickUpName = "a force field pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function ForceFieldDeployableImage::testObjectTooClose(%item) {
|
||||
return;
|
||||
}
|
||||
|
||||
function ForceFieldDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function ForceFieldDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function ForceFieldDeployableImage::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["forcefield",%plyr.packSet],0,2);
|
||||
%mCenter = "-0.5 -0.5 -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);
|
||||
|
||||
// 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));
|
||||
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (isCubic(%item.surface) && (%plyr.expertSet == 1 || %plyr.expertSet == 3) && %plyr.team == %item.surface.team
|
||||
&& %item.surface.getType() & $TypeMasks::StaticShapeObjectType
|
||||
&& (($Host::OnlyOwnerCubicReplace == 0) || (%plyr.client == %item.surface.getOwner()))) {
|
||||
%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);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - temporary test fix - remove?
|
||||
%scale = vectorAdd(%scale,"0 0 0");
|
||||
%x = getWord(%scale,0);
|
||||
%y = getWord(%scale,1);
|
||||
%z = getWord(%scale,2);
|
||||
if (%x <= 0)
|
||||
%x = 0.001;
|
||||
if (%y <= 0)
|
||||
%y = 0.001;
|
||||
if (%z <= 0)
|
||||
%z = 0.001;
|
||||
%scale = %x SPC %y SPC %z;
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed @ %plyr.packSet;
|
||||
scale = %scale;
|
||||
};
|
||||
|
||||
// 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);
|
||||
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (%plyr.expertSet == 2 || %plyr.expertSet == 3) {
|
||||
%deplObj.noSlow = true;
|
||||
%deplObj.pzone.delete();
|
||||
%deplObj.pzone = "";
|
||||
}
|
||||
}
|
||||
|
||||
// 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','\c2Force field lost - no power source found!%1','~wfx/misc/misc.error.wav');
|
||||
}
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
function ForceFieldDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasForceField = true; // set for forcefieldcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function ForceFieldDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasForceField = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function DeployedForceField::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField0::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField1::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField2::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField3::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField4::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField5::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField6::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField7::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField8::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField9::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField10::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField11::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField12::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField13::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField14::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField15::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField16::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField17::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField18::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField19::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedForceField20::disassemble(%data,%plyr,%obj) {
|
||||
DeployedForceField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
145
scripts/packs/generator.cs
Normal file
145
scripts/packs/generator.cs
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Generator
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(GeneratorDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
|
||||
hasLight = true;
|
||||
lightType = "PulsingLight";
|
||||
lightColor = "0.1 0.8 0.8 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "3";
|
||||
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 3;
|
||||
rotate = true;
|
||||
image = "GeneratorDeployableImage";
|
||||
pickUpName = "a generator pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function GeneratorDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function GeneratorDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(getWord(%plyr.getEyeVector(),1) SPC -1 * getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),2));
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = GeneratorLarge;
|
||||
deployed = true;
|
||||
};
|
||||
|
||||
// set orientation
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
setTargetName(%deplObj.target,addTaggedString("Frequency" SPC %deplObj.powerFreq));
|
||||
|
||||
// set power
|
||||
%deplObj.setSelfPowered();
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
%deplObj.playThread($PowerThread,"Power");
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
// add to power list
|
||||
$PowerList = listAdd($PowerList,%deplObj,-1);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function GeneratorLarge::onDestroyed(%this,%obj,%prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if (%obj.deployed && ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon)) {
|
||||
%obj.isRemoved = true;
|
||||
%loc = findWord($PowerList,%obj);
|
||||
if (%loc !$= "")
|
||||
$PowerList = listDel($PowerList,%loc);
|
||||
$TeamDeployedCount[%obj.team,GeneratorDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500,"delete");
|
||||
}
|
||||
Parent::onDestroyed(%data,%obj,%prevState);
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasGen = true; // set for gencheck
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function GeneratorDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasGen = "";
|
||||
}
|
||||
344
scripts/packs/gravityfieldpack.cs
Normal file
344
scripts/packs/gravityfieldpack.cs
Normal file
|
|
@ -0,0 +1,344 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Gravity Field
|
||||
//---------------------------------------------------------
|
||||
|
||||
// Translucencies
|
||||
%fieldTrans = 1.0;
|
||||
%powerOffTrans = 0.25;
|
||||
|
||||
// RGB
|
||||
%colourOn = 0.6;
|
||||
%colourOff = 0.15;
|
||||
%dimDiv = 3;
|
||||
|
||||
datablock ForceFieldBareData(DeployedGravityField) {
|
||||
className = "gravityfield";
|
||||
fadeMS = 1000;
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = "1.0 1.0 1.0";
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
targetTypeTag = 'GravityField';
|
||||
texture[0] = "skins/forcef1";
|
||||
texture[1] = "skins/forcef2";
|
||||
texture[2] = "skins/forcef3";
|
||||
texture[3] = "skins/forcef4";
|
||||
texture[4] = "skins/forcef5";
|
||||
framesPerSec = 10;
|
||||
numFrames = 5;
|
||||
scrollSpeed = 15;
|
||||
umapping = 1.0;
|
||||
vmapping = 0.15;
|
||||
deployedFrom = GravityFieldDeployable;
|
||||
velocityMod = 1;
|
||||
gravityMod = 1;
|
||||
appliedForce = "0 0 0";
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
// slow
|
||||
datablock ForceFieldBareData(DeployedGravityField0) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff/%dimDiv SPC %colourOn/%dimDiv SPC %colourOff/%dimDiv;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// fast
|
||||
datablock ForceFieldBareData(DeployedGravityField1) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOff SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// zero gravity
|
||||
datablock ForceFieldBareData(DeployedGravityField2) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOn SPC %colourOff;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// fastfield
|
||||
datablock ForceFieldBareData(DeployedGravityField3) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn/%dimDiv SPC %colourOff/%dimDiv SPC %colourOn/%dimDiv;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1.5;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
// super fastfield
|
||||
datablock ForceFieldBareData(DeployedGravityField4) : DeployedGravityField {
|
||||
baseTranslucency = %fieldTrans;
|
||||
powerOffTranslucency = %powerOffTrans;
|
||||
teamPermiable = true;
|
||||
otherPermiable = true;
|
||||
color = %colourOn SPC %colourOff SPC %colourOn;
|
||||
powerOffColor = "0.0 0.0 0.0";
|
||||
velocityMod = 1.7;
|
||||
gravityMod = 0;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(GravityFieldDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
joint = "4.75 4.75 4.75";
|
||||
rotate = true;
|
||||
image = "GravityFieldDeployableImage";
|
||||
pickUpName = "a gravity field pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function GravityFieldDeployableImage::testObjectTooClose(%item) {
|
||||
return;
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function GravityFieldDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
//Object
|
||||
%className = "ForceFieldBare";
|
||||
|
||||
%grounded = 0;
|
||||
if (%item.surface.getClassName() $= TerrainBlock)
|
||||
%grounded = 1;
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (%item.surfaceinher == 0) {
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
}
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
%scale = getWords($packSetting["gravfield",%plyr.packSet],0,2);
|
||||
|
||||
%space = rayDist(%item.surfacePt SPC %item.surfaceNrm,%scale);
|
||||
%scale = getWord(%scale,0) SPC getWord(%scale,0) SPC %space;
|
||||
|
||||
// Shift field position since field handle is not field center
|
||||
%mod = firstWord($packSetting["gravfield",%plyr.packSet]) / 2;
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%mod));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%mod));
|
||||
|
||||
// Add padding
|
||||
%padSize = 0.01;
|
||||
%scale = vectorAdd(%scale,%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm),%padSize));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(%item.surfaceNrm2),%padSize));
|
||||
%item.surfacePt = vectorSub(%item.surfacePt,vectorScale(vectorNormalize(vectorCross(%item.surfaceNrm,%item.surfaceNrm2)),%padSize));
|
||||
|
||||
// Set datablock
|
||||
if (%plyr.packSet == 0)
|
||||
%dataBlock = nameToID(%item.deployed @ 0);
|
||||
else if (%plyr.packSet == 1)
|
||||
%dataBlock = nameToID(%item.deployed @ 1);
|
||||
else if (%plyr.packSet == 2)
|
||||
%dataBlock = nameToID(%item.deployed @ 0);
|
||||
else if (%plyr.packSet == 3)
|
||||
%dataBlock = nameToID(%item.deployed @ 1);
|
||||
else if (%plyr.packSet == 4)
|
||||
%dataBlock = nameToID(%item.deployed @ 2);
|
||||
else if (%plyr.packSet == 5)
|
||||
%dataBlock = nameToID(%item.deployed @ 3);
|
||||
else if (%plyr.packSet == 6)
|
||||
%dataBlock = nameToID(%item.deployed @ 4);
|
||||
|
||||
%appliedForceVec = vectorNormalize(%item.surfaceNrm);
|
||||
|
||||
if ($Host::ExpertMode == 1) {
|
||||
if (isCubic(%item.surface) && (%plyr.expertSet == 1 || %plyr.expertSet == 2) && %plyr.team == %item.surface.team
|
||||
&& %item.surface.getType() & $TypeMasks::StaticShapeObjectType
|
||||
&& (($Host::OnlyOwnerCubicReplace == 0) || (%plyr.client == %item.surface.getOwner()))) {
|
||||
if (%plyr.expertSet == 2)
|
||||
%appliedForceVec = vectorNormalize(realVec(%item.surface,"0 0 1"));
|
||||
%scale = vectorAdd(realSize(%item.surface),%padSize * 2 SPC %padSize * 2 SPC %padSize * 2);
|
||||
%center = realVec(%item.surface,vectorScale(getWords(%scale,0,1) SPC "0",-0.5));
|
||||
%item.surfacePt = vectorAdd(pos(%item.surface),%center);
|
||||
%rot = rot(%item.surface);
|
||||
%mod = vectorScale(matrixMulVector("0 0 0" SPC %rot ,"0 0 1"),-%padSize);
|
||||
%item.surfacePt = vectorAdd(%item.surfacePt,%mod);
|
||||
%item.surface.getDataBlock().disassemble(%plyr, %item.surface);
|
||||
}
|
||||
}
|
||||
|
||||
%velocityMod = %dataBlock.velocityMod;
|
||||
%gravityMod = %dataBlock.gravityMod;
|
||||
%appliedForce = %dataBlock.appliedForce;
|
||||
|
||||
%slowForce = 500;
|
||||
%fastForce = 1000;
|
||||
|
||||
if (%plyr.packSet == 0)
|
||||
%appliedForce = vectorScale(%appliedForceVec,%slowForce);
|
||||
else if (%plyr.packSet == 1)
|
||||
%appliedForce = vectorScale(%appliedForceVec,%fastForce);
|
||||
else if (%plyr.packSet == 2)
|
||||
%appliedForce = vectorScale(%appliedForceVec,-%slowForce);
|
||||
else if (%plyr.packSet == 3)
|
||||
%appliedForce = vectorScale(%appliedForceVec,-%fastForce);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %dataBlock;
|
||||
scale = %scale;
|
||||
velocityMod = %velocityMod;
|
||||
gravityMod = %gravityMod;
|
||||
appliedForce = %appliedForce;
|
||||
};
|
||||
|
||||
// Take the deployable off the player's back and out of inventory
|
||||
if ($Host::ExpertMode == 0) {
|
||||
%plyr.unMountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
}
|
||||
|
||||
////////////////////////Apply settings//////////////////////////////
|
||||
|
||||
// [[Location]]:
|
||||
|
||||
// exact:
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
%deplObj.pzone.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
// misc info
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// [[Settings]]:
|
||||
|
||||
%deplObj.grounded = %grounded;
|
||||
%deplObj.needsFit = 1;
|
||||
|
||||
// [[Normal Stuff]]:
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
// set the sensor group if it needs one
|
||||
if (%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
if (!%deplObj.powerCount > 0) {
|
||||
%deplObj.getDataBlock().disassemble(0,%deplObj); // Run Item Specific code.
|
||||
messageClient(%plyr.client,'MsgDeployFailed','\c2Gravity field lost - no power source found!%1','~wfx/misc/misc.error.wav');
|
||||
}
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
function GravityFieldDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasGravField = true; // set for gravfieldcheck
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function GravityFieldDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasGravField = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
|
||||
function DeployedGravityField::disassemble(%data,%plyr,%obj) {
|
||||
if (isObject(%obj.pzone))
|
||||
%obj.pzone.delete();
|
||||
disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField0::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField1::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField2::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField3::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
|
||||
function DeployedGravityField4::disassemble(%data,%plyr,%obj) {
|
||||
DeployedGravityField::disassemble(%data,%plyr,%obj);
|
||||
}
|
||||
176
scripts/packs/jumpad.cs
Normal file
176
scripts/packs/jumpad.cs
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Jumpad
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedJumpad) : StaticShapeDamageProfile {
|
||||
className = "jumpad";
|
||||
shapeFile = "nexusbase.dts"; // dmiscf.dts, alternate
|
||||
maxDamage = 2.0;
|
||||
destroyedLevel = 2.0;
|
||||
disabledLevel = 2.0;
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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 = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "JumpadDeployableImage";
|
||||
pickUpName = "a jump pad pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function JumpadDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = %playerVector;
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1"));
|
||||
|
||||
%impulse = firstWord($packSetting["jumpad",%plyr.packSet]);
|
||||
|
||||
%deplObj = new (%className)() {
|
||||
dataBlock = %item.deployed;
|
||||
scale = "1 1 2";
|
||||
};
|
||||
|
||||
// set impulse (jump pad strength)
|
||||
%deplObj.impulse = %impulse;
|
||||
|
||||
// set orientation
|
||||
%deplObj.setDeployRotation(getWords(%item.surfacePt, 0, 1) SPC getWord(%item.surfacePt, 2) + 0.1, %item.surfaceNrm);
|
||||
|
||||
// set the recharge rate right away
|
||||
if (%deplObj.getDatablock().rechargeRate)
|
||||
%deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate);
|
||||
|
||||
// set team, owner, and handle
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
|
||||
// take the deployable off the player's back and out of inventory
|
||||
%plyr.unmountImage(%slot);
|
||||
%plyr.decInventory(%item.item, 1);
|
||||
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function DeployedJumpad::onCollision(%data,%obj,%col) {
|
||||
// TODO - update escape pod
|
||||
if (%col.getClassName() !$= "Player" && %col.getDataBlock().getName() !$= "EscapePodVehicle")
|
||||
return; // Only boost players
|
||||
if (%obj.team == %col.team) {
|
||||
%vel = %col.getVelocity();
|
||||
%vec = realVec(%obj,"0 0 1");
|
||||
%position = getWords(%col.getTransform(), 0, 2);
|
||||
// %impulseVec = vectorScale(%vec,1000); // Jump clear of the pad
|
||||
// %col.applyImpulse(%position, %impulseVec);
|
||||
%col.playAudio(0, MortarFireSound);
|
||||
%impulseVec = vectorScale(%vec,%obj.impulse);
|
||||
// %col.schedule(50, "applyImpulse", %position, %impulseVec);
|
||||
%col.applyImpulse(%position, %impulseVec);
|
||||
}
|
||||
}
|
||||
|
||||
function DeployedJumpad::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
%obj.isRemoved = true;
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
$TeamDeployedCount[%obj.team, JumpadDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, "delete");
|
||||
fireBallExplode(%obj,1);
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasJumpad = true; // set for jumpadcheck
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
|
||||
function JumpadDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasJumpad = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
123
scripts/packs/largeInventory.cs
Normal file
123
scripts/packs/largeInventory.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Large Inventory Station
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(LargeInventoryDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = true;
|
||||
image = "LargeInventoryDeployableImage";
|
||||
joint = "4.5 4.5 4.5";
|
||||
pickUpName = "a large inventory station pack";
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
function LargeInventoryDeployable::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "StaticShape";
|
||||
%plyr.unMountImage(%slot);
|
||||
%plyr.decInventory(%item.item,1);
|
||||
%grounded = 0;
|
||||
if (%item.surface.getClassName() $= TerrainBlock)
|
||||
%grounded = 1;
|
||||
|
||||
%playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0");
|
||||
|
||||
if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1")
|
||||
%item.surfaceNrm2 = vectorScale(%playerVector,-1);
|
||||
else
|
||||
%item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1"));
|
||||
|
||||
%rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2);
|
||||
|
||||
%deplObj = new (%className)() //Inventory Station
|
||||
{
|
||||
dataBlock = StationInventory;
|
||||
position = %surfacePt;
|
||||
rotation = %rot;
|
||||
deployed = true;
|
||||
};
|
||||
%deplObj.setTransform(%item.surfacePt SPC %rot);
|
||||
|
||||
%deplObj.team = %plyr.client.Team;
|
||||
%deplObj.setOwner(%plyr);
|
||||
addDSurface(%item.surface,%deplObj);
|
||||
|
||||
// set power frequency
|
||||
%deplObj.powerFreq = %plyr.powerFreq;
|
||||
|
||||
if(%deplObj.getTarget() != -1)
|
||||
setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team);
|
||||
|
||||
// place the deployable in the MissionCleanup/Deployables group (AI reasons)
|
||||
|
||||
addToDeployGroup(%deplObj);
|
||||
|
||||
//let the AI know as well...
|
||||
|
||||
AIDeployObject(%plyr.client, %deplObj);
|
||||
|
||||
// play the deploy sound
|
||||
serverPlay3D(%item.deploySound, %deplObj.getTransform());
|
||||
|
||||
// increment the team count for this deployed object
|
||||
|
||||
$TeamDeployedCount[%plyr.team, %item.item]++;
|
||||
|
||||
%deplObj.deploy();
|
||||
|
||||
// Adjust the trigger object
|
||||
adjustTrigger(%deplObj);
|
||||
|
||||
// Power object
|
||||
checkPowerObject(%deplObj);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::testNoTerrainFound(%item)
|
||||
{
|
||||
//return %item.surface.getClassName() !$= TerrainBlock;
|
||||
}
|
||||
|
||||
function LargeInventoryDeployableImage::onMount(%data, %obj, %node) {
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
127
scripts/packs/largeSensor.cs
Normal file
127
scripts/packs/largeSensor.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Large Pulse Sensor
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(LargeSensorDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
}
|
||||
193
scripts/packs/laserturret.cs
Normal file
193
scripts/packs/laserturret.cs
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Datablocks
|
||||
//--------------------------------------
|
||||
|
||||
datablock SensorData(LaserTurretSensor) {
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = false;
|
||||
detectsActiveJammed = false;
|
||||
detectsCloaked = false;
|
||||
detectionPings = true;
|
||||
detectRadius = 100;
|
||||
};
|
||||
|
||||
datablock TurretData(LaserDeployed) : TurretDamageProfile {
|
||||
className = DeployedTurret;
|
||||
shapeFile = "camera.dts";
|
||||
mass = 1;
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.21;
|
||||
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 = 30;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.15;
|
||||
barrel = DeployableLaserBarrel;
|
||||
canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Laser';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = LaserTurretSensor;
|
||||
sensorRadius = LaserTurretSensor.detectRadius;
|
||||
sensorColor = "191 0 226";
|
||||
firstPersonOnly = true;
|
||||
renderWhenDestroyed = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = TurretDebrisSmall;
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableLaserBarrel) {
|
||||
shapeFile = "turret_muzzlepoint.dts";
|
||||
item = LaserTurretBarrel;
|
||||
//rotation = "0 0 0 0";
|
||||
offset = "0 0 0";
|
||||
projectile = NerfBolt;
|
||||
//projectileType = TargetProjectile;
|
||||
projectileType = LinearFlareProjectile;
|
||||
usesEnergy = true;
|
||||
fireEnergy = 2;
|
||||
minEnergy = 8;
|
||||
lightType = "WeaponFireLight";
|
||||
lightColor = "0.25 0.15 0.15 1.0";
|
||||
lightTime = "1000";
|
||||
lightRadius = "2";
|
||||
muzzleFlash = IndoorTurretMuzzleFlash;
|
||||
//deleteLastProjectile = true;
|
||||
// Turret parameters
|
||||
activationMS = 150;
|
||||
deactivateDelayMS = 300;
|
||||
thinkTimeMS = 150;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 960;
|
||||
attackRadius = 100;
|
||||
|
||||
// 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.1;
|
||||
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.05;
|
||||
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] = 0.1;
|
||||
stateTransitionOnLoaded[5] = "ActivateReady";
|
||||
stateTransitionOnTimeout[5] = "Dead";
|
||||
|
||||
stateName[6] = "Dead";
|
||||
stateTransitionOnLoaded[6] = "ActivateReady";
|
||||
|
||||
stateName[7] = "NoAmmo";
|
||||
stateTransitionOnAmmo[7] = "Reload";
|
||||
stateSequence[7] = "NoAmmo";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(TurretLaserDeployableImage) {
|
||||
mass = 1;
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
item = TurretLaserDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = LaserDeployed;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
emap = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = TurretDeploySound;
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(TurretLaserDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = TurretLaserDeployableImage;
|
||||
pickUpName = "a laser turret pack";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Functions
|
||||
//--------------------------------------
|
||||
|
||||
function TurretLaserDeployableImage::TestNoTerrainFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretLaserDeployableImage::TestNoInteriorFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretLaserDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
//created to prevent console errors
|
||||
}
|
||||
|
||||
function LaserDeployed::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team, TurretLaserDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, delete);
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
|
||||
}
|
||||
273
scripts/packs/lightpack.cs
Normal file
273
scripts/packs/lightpack.cs
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
//---------------------------------------------------------
|
||||
// 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;
|
||||
};
|
||||
|
||||
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 = 1;
|
||||
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 = 1;
|
||||
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.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;
|
||||
|
||||
// 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);
|
||||
|
||||
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;
|
||||
}
|
||||
238
scripts/packs/logoprojectorpack.cs
Normal file
238
scripts/packs/logoprojectorpack.cs
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
//---------------------------------------------------------
|
||||
// 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 = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
%obj.holo.setScale(%obj.getScale());
|
||||
}
|
||||
Parent::onGainPowerEnabled(%data,%obj);
|
||||
}
|
||||
|
||||
function DeployedLogoProjector::onLosePowerDisabled(%data,%obj) {
|
||||
if (shouldChangePowerState(%obj,false)) {
|
||||
if (isObject(%obj.holo))
|
||||
%obj.holo.delete();
|
||||
}
|
||||
Parent::onLosePowerDisabled(%data,%obj);
|
||||
}
|
||||
|
||||
function adjustHolo(%obj) {
|
||||
%obj.holo.setTransform(vectorAdd(%obj.getPosition(),vectorScale(realVec(%obj,"0 0 1"),10)) SPC %obj.getRotation());
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasProjector = true; // set for projectorcheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function LogoProjectorDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasProjector = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
127
scripts/packs/mediumSensor.cs
Normal file
127
scripts/packs/mediumSensor.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Medium Pulse Sensor
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(MediumSensorDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
}
|
||||
455
scripts/packs/missilerackturret.cs
Normal file
455
scripts/packs/missilerackturret.cs
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Datablocks
|
||||
//--------------------------------------
|
||||
|
||||
datablock AudioProfile(MissileRackTurretFireSound) {
|
||||
filename = "";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
effect = MissileFireEffect;
|
||||
};
|
||||
|
||||
datablock AudioProfile(MissileRackTurretFireSound2) {
|
||||
filename = "fx/weapons/sniper_miss.wav";
|
||||
description = AudioDefault3d;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock SensorData(MissileRackTurretSensor) {
|
||||
detects = true;
|
||||
detectsUsingLOS = true;
|
||||
detectsPassiveJammed = false;
|
||||
detectsActiveJammed = false;
|
||||
detectsCloaked = false;
|
||||
detectionPings = true;
|
||||
detectRadius = 100;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Explosions
|
||||
//---------------------------------------------------------------------------
|
||||
datablock ExplosionData(MissileRackMissileExplosion) {
|
||||
explosionShape = "effect_plasma_explosion.dts";
|
||||
playSpeed = 1.5;
|
||||
soundProfile = GrenadeExplosionSound;
|
||||
faceViewer = true;
|
||||
|
||||
sizes[0] = "0.5 0.5 0.5";
|
||||
sizes[1] = "0.5 0.5 0.5";
|
||||
sizes[2] = "0.5 0.5 0.5";
|
||||
|
||||
emitter[0] = MissileExplosionSmokeEmitter;
|
||||
|
||||
debris = MissileSpikeDebris;
|
||||
debrisThetaMin = 10;
|
||||
debrisThetaMax = 170;
|
||||
debrisNum = 8;
|
||||
debrisNumVariance = 6;
|
||||
debrisVelocity = 15.0;
|
||||
debrisVelocityVariance = 2.0;
|
||||
|
||||
shakeCamera = true;
|
||||
camShakeFreq = "6.0 7.0 7.0";
|
||||
camShakeAmp = "70.0 70.0 70.0";
|
||||
camShakeDuration = 1.0;
|
||||
camShakeRadius = 7.0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Projectile
|
||||
//--------------------------------------
|
||||
datablock SeekerProjectileData(MissileRackMissile) {
|
||||
casingShapeName = "weapon_missile_casement.dts";
|
||||
projectileShapeName = "weapon_missile_projectile.dts";
|
||||
hasDamageRadius = true;
|
||||
indirectDamage = 0.2;
|
||||
damageRadius = 4.0;
|
||||
radiusDamageType = $DamageType::MissileTurret;
|
||||
kickBackStrength = 1000;
|
||||
|
||||
explosion = "MissileRackMissileExplosion";
|
||||
splash = MissileSplash;
|
||||
velInheritFactor = 0.2; // 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 = 6000;
|
||||
muzzleVelocity = 10.0;
|
||||
maxVelocity = 80.0;
|
||||
turningSpeed = 110.0;
|
||||
acceleration = 200.0;
|
||||
|
||||
proximityRadius = 3;
|
||||
|
||||
terrainAvoidanceSpeed = 180;
|
||||
terrainScanAhead = 25;
|
||||
terrainHeightFail = 12;
|
||||
terrainAvoidanceRadius = 100;
|
||||
|
||||
flareDistance = 200;
|
||||
flareAngle = 30;
|
||||
|
||||
sound = MissileProjectileSound;
|
||||
|
||||
hasLight = true;
|
||||
lightRadius = 5.0;
|
||||
lightColor = "0.2 0.05 0";
|
||||
|
||||
useFlechette = true;
|
||||
flechetteDelayMs = 550;
|
||||
casingDeb = FlechetteDebris;
|
||||
|
||||
explodeOnWaterImpact = false;
|
||||
};
|
||||
|
||||
datablock TurretData(MissileRackTurretDeployed) : TurretDamageProfile {
|
||||
className = DeployedTurret;
|
||||
shapeFile = "turret_outdoor_deploy.dts";
|
||||
|
||||
rechargeRate = 0.15;
|
||||
|
||||
mass = 1;
|
||||
maxDamage = 0.80;
|
||||
destroyedLevel = 0.80;
|
||||
disabledLevel = 0.35;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 5.0;
|
||||
expDamage = 0.5;
|
||||
expImpulse = 500.0;
|
||||
|
||||
repairRate = 0;
|
||||
deployedObject = true;
|
||||
|
||||
thetaMin = 0;
|
||||
thetaMax = 145;
|
||||
thetaNull = 90;
|
||||
primaryAxis = zaxis;
|
||||
|
||||
yawVariance = 30.0; // these will smooth out the elf tracking code.
|
||||
pitchVariance = 30.0; // more or less just tolerances
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 110;
|
||||
maxEnergy = 80;
|
||||
renderWhenDestroyed = true;
|
||||
barrel = DeployableMissileRackTurretBarrel;
|
||||
heatSignature = 0.0;
|
||||
|
||||
canControl = true;
|
||||
cmdCategory = "DTactical";
|
||||
cmdIcon = CMDTurretIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_turret_grey";
|
||||
targetNameTag = 'Missile Rack';
|
||||
targetTypeTag = 'Turret';
|
||||
sensorData = MissileRackTurretSensor;
|
||||
sensorRadius = MissileRackTurretSensor.detectRadius;
|
||||
sensorColor = "191 0 226";
|
||||
|
||||
firstPersonOnly = true;
|
||||
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = TurretDebrisSmall;
|
||||
needsPower = true;
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMissileRackTurretBarrel) {
|
||||
shapeFile = "stackable1s.dts";
|
||||
rotation = "-0.57735 0.57735 0.57735 120";
|
||||
offset = "0 -0.3 0";
|
||||
projectile = MissileRackMissile;
|
||||
projectileType = SeekerProjectile;
|
||||
|
||||
usesEnergy = true;
|
||||
fireEnergy = 7.0;
|
||||
minEnergy = 7.0 * 2;
|
||||
|
||||
isSeeker = true;
|
||||
seekRadius = 300;
|
||||
maxSeekAngle = 30;
|
||||
seekTime = 1.0;
|
||||
minSeekHeat = 0.6;
|
||||
emap = true;
|
||||
minTargetingDistance = 15;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 250;
|
||||
deactivateDelayMS = 500;
|
||||
thinkTimeMS = 200;
|
||||
degPerSecTheta = 580;
|
||||
degPerSecPhi = 1080;
|
||||
attackRadius = 250;
|
||||
|
||||
// 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.3;
|
||||
stateFire[3] = true;
|
||||
stateShockwave[3] = true;
|
||||
stateRecoil[3] = LightRecoil;
|
||||
stateAllowImageChange[3] = false;
|
||||
stateSequence[3] = "Fire";
|
||||
stateSound[3] = MissileRackTurretFireSound;
|
||||
stateScript[3] = "onFire";
|
||||
|
||||
stateName[4] ="Reload";
|
||||
stateTimeoutValue[4] = 0.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";
|
||||
|
||||
muzzleSlots = 12;
|
||||
muzzleSlotOffset[0] = "0.65 0.5 0.4";
|
||||
muzzleSlotOffset[1] = "0.35 0.5 0.4";
|
||||
muzzleSlotOffset[2] = "0.15 0.5 0.4";
|
||||
muzzleSlotOffset[3] = "-0.15 0.5 0.4";
|
||||
muzzleSlotOffset[4] = "-0.35 0.5 0.4";
|
||||
muzzleSlotOffset[5] = "-0.65 0.5 0.4";
|
||||
muzzleSlotOffset[6] = "0.65 0.5 0.1";
|
||||
muzzleSlotOffset[7] = "0.35 0.5 0.1";
|
||||
muzzleSlotOffset[8] = "0.15 0.5 0.1";
|
||||
muzzleSlotOffset[9] = "-0.15 0.5 0.1";
|
||||
muzzleSlotOffset[10] = "-0.35 0.5 0.1";
|
||||
muzzleSlotOffset[11] = "-0.65 0.5 0.1";
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMissileRackTurretBarrelR) {
|
||||
shapeFile = "stackable1s.dts";
|
||||
rotation = "-0.57735 0.57735 0.57735 120";
|
||||
offset = "0 -0.3 0.5";
|
||||
|
||||
};
|
||||
|
||||
datablock TurretImageData(DeployableMissileRackTurretBarrelL) {
|
||||
shapeFile = "stackable1s.dts";
|
||||
rotation = "-0.57735 0.57735 0.57735 120";
|
||||
offset = "0 -0.3 -0.5";
|
||||
};
|
||||
|
||||
function DeployableMissileRackTurretBarrel::onMount(%this,%obj,%slot) {
|
||||
%obj.currentMuzzleSlot = 0;
|
||||
%obj.schedule(1000,"mountImage",DeployableMissileRackTurretBarrelR,1,true);
|
||||
%obj.schedule(1000,"mountImage",DeployableMissileRackTurretBarrelL,2,true);
|
||||
}
|
||||
|
||||
// TODO - handle unmount
|
||||
|
||||
datablock ShapeBaseImageData(TurretMissileRackDeployableImage) {
|
||||
mass = 1;
|
||||
shapeFile = "pack_deploy_turreto.dts";
|
||||
item = TurretMissileRackDeployable;
|
||||
mountPoint = 1;
|
||||
offset = "0 0 0";
|
||||
deployed = MissileRackTurretDeployed;
|
||||
stateName[0] = "Idle";
|
||||
stateTransitionOnTriggerDown[0] = "Activate";
|
||||
|
||||
stateName[1] = "Activate";
|
||||
stateScript[1] = "onActivate";
|
||||
stateTransitionOnTriggerUp[1] = "Idle";
|
||||
|
||||
isLarge = true;
|
||||
emap = true;
|
||||
maxDepSlope = 360;
|
||||
deploySound = TurretDeploySound;
|
||||
minDeployDis = 0.5;
|
||||
maxDeployDis = 5.0;
|
||||
};
|
||||
|
||||
datablock ItemData(TurretMissileRackDeployable) {
|
||||
className = Pack;
|
||||
catagory = "Deployables";
|
||||
shapeFile = "pack_deploy_turreti.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 1;
|
||||
rotate = false;
|
||||
image = TurretMissileRackDeployableImage;
|
||||
pickUpName = "a missile rack turret pack";
|
||||
emap = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Functions
|
||||
//--------------------------------------
|
||||
|
||||
function TurretMissileRackDeployableImage::TestNoTerrainFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretMissileRackDeployableImage::TestNoInteriorFound(%item) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretMissileRackDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
//created to prevent console errors
|
||||
}
|
||||
|
||||
function TurretMissileRackDeployableImage::onDeploy(%item, %plyr, %slot) {
|
||||
%className = "Turret";
|
||||
|
||||
%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 = %item.deployed;
|
||||
};
|
||||
|
||||
if (%plyr.packSet == 1)
|
||||
%deplObj.isSeeker = 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;
|
||||
|
||||
// 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);
|
||||
|
||||
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 MissileRackTurretDeployed::onDestroyed(%this, %obj, %prevState) {
|
||||
if (%obj.isRemoved)
|
||||
return;
|
||||
if ($Host::InvincibleDeployables != 1 || %obj.damageFailedDecon) {
|
||||
%obj.isRemoved = true;
|
||||
$TeamDeployedCount[%obj.team, TurretMissileRackDeployable]--;
|
||||
remDSurface(%obj);
|
||||
%obj.schedule(500, delete);
|
||||
}
|
||||
Parent::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function DeployableMissileRackTurretBarrel::onFire(%data,%obj,%slot) {
|
||||
%targetObj = %obj.getTargetObject();
|
||||
if (%targetObj) {
|
||||
if (!%obj.getDataBlock().hasLOS(%obj,%slot,%targetObj) && %obj.aquireTime + 2000 < getSimTime()) {
|
||||
%obj.clearTarget();
|
||||
return;
|
||||
}
|
||||
if (%obj.aquireTime + 10000 + getRandom(0,1000) < getSimTime()) {
|
||||
%obj.clearTarget();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%p = Parent::onFire(%data,%obj,%slot);
|
||||
serverPlay3D(MissileRackTurretFireSound2,%obj.getTransform());
|
||||
|
||||
if (%obj.isSeeker) {
|
||||
if (%obj.getControllingClient())
|
||||
// a player is controlling the turret
|
||||
%target = %obj.getLockedTarget();
|
||||
else
|
||||
// The ai is controlling the turret
|
||||
%target = %obj.getTargetObject();
|
||||
|
||||
if(%target)
|
||||
%p.setObjectTarget(%target);
|
||||
else if(%obj.isLocked())
|
||||
%p.setPositionTarget(%obj.getLockedPosition());
|
||||
else
|
||||
%p.setNoTarget(); // set as unguided. Only happens when itchy trigger can't wait for lock tone.
|
||||
%obj.setEnergyLevel(%obj.getEnergyLevel() - (%data.fireEnergy));
|
||||
}
|
||||
}
|
||||
|
||||
function MissileRackTurretDeployed::hasLOS(%data,%obj,%slot,%targetObj) {
|
||||
%start = %obj.getMuzzlePoint(%slot);
|
||||
%end = %targetObj.getWorldBoxCenter();
|
||||
%res = containerRayCast(%start,%end,-1,%obj);
|
||||
return firstWord(%res) == %targetObj;
|
||||
}
|
||||
|
||||
function TurretMissileRackDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasMissileRack = true; // set for missilerackcheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TurretMissileRackDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasMissileRack = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
282
scripts/packs/mspine.cs
Normal file
282
scripts/packs/mspine.cs
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
//---------------------------------------------------------
|
||||
// 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 = 1;
|
||||
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 = 1;
|
||||
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::testNoTerrainFound(%item) {
|
||||
// don't check this for non-Landspike turret deployables
|
||||
}
|
||||
|
||||
function mspineDeployable::onPickup(%this, %obj, %shape, %amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
657
scripts/packs/repairpack.cs
Normal file
657
scripts/packs/repairpack.cs
Normal file
|
|
@ -0,0 +1,657 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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 = 250; //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 = 3;
|
||||
cutOffEnergy = 3.1;
|
||||
emap = true;
|
||||
|
||||
repairFactorPlayer = 0.002; // <--- attention DaveG!
|
||||
repairFactorObject = 0.004; // <--- attention DaveG!
|
||||
|
||||
stateName[0] = "Activate";
|
||||
stateTransitionOnTimeout[0] = "ActivateReady";
|
||||
stateTimeoutValue[0] = 0.25;
|
||||
|
||||
stateName[1] = "ActivateReady";
|
||||
stateScript[1] = "onActivateReady";
|
||||
stateSpinThread[1] = Stop;
|
||||
stateTransitionOnAmmo[1] = "Ready";
|
||||
stateTransitionOnNoAmmo[1] = "ActivateReady";
|
||||
|
||||
stateName[2] = "Ready";
|
||||
stateSpinThread[2] = Stop;
|
||||
stateTransitionOnNoAmmo[2] = "Deactivate";
|
||||
stateTransitionOnTriggerDown[2] = "Validate";
|
||||
|
||||
stateName[3] = "Validate";
|
||||
stateTransitionOnTimeout[3] = "Validate";
|
||||
stateTimeoutValue[3] = 0.2;
|
||||
stateEnergyDrain[3] = 3;
|
||||
stateSpinThread[3] = SpinUp;
|
||||
stateScript[3] = "onValidate";
|
||||
stateIgnoreLoadedForReady[3] = true;
|
||||
stateTransitionOnLoaded[3] = "Repair";
|
||||
stateTransitionOnNoAmmo[3] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[3] = "Deactivate";
|
||||
|
||||
stateName[4] = "Repair";
|
||||
stateSound[4] = RepairPackFireSound;
|
||||
stateScript[4] = "onRepair";
|
||||
stateSpinThread[4] = FullSpeed;
|
||||
stateAllowImageChange[4] = false;
|
||||
stateSequence[4] = "activate";
|
||||
stateFire[4] = true;
|
||||
stateEnergyDrain[4] = 9;
|
||||
stateTimeoutValue[4] = 0.2;
|
||||
stateTransitionOnTimeOut[4] = "Repair";
|
||||
stateTransitionOnNoAmmo[4] = "Deactivate";
|
||||
stateTransitionOnTriggerUp[4] = "Deactivate";
|
||||
stateTransitionOnNotLoaded[4] = "Validate";
|
||||
|
||||
stateName[5] = "Deactivate";
|
||||
stateScript[5] = "onDeactivate";
|
||||
stateSpinThread[5] = SpinDown;
|
||||
stateSequence[5] = "activate";
|
||||
stateDirection[5] = false;
|
||||
stateTimeoutValue[5] = 0.2;
|
||||
stateTransitionOnTimeout[5] = "ActivateReady";
|
||||
};
|
||||
|
||||
function RepairPackImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
// dismount the repair gun if the player had it mounted
|
||||
// need the extra "if" statement to avoid a console error message
|
||||
if(%obj.getMountedImage($WeaponSlot))
|
||||
if(%obj.getMountedImage($WeaponSlot).getName() $= "RepairGunImage")
|
||||
%obj.unmountImage($WeaponSlot);
|
||||
// if the player was repairing something when the pack was thrown, stop repairing it
|
||||
if(%obj.repairing != 0)
|
||||
stopRepairing(%obj);
|
||||
}
|
||||
|
||||
function RepairPackImage::onActivate(%data, %obj, %slot)
|
||||
{
|
||||
// don't activate the pack if player is piloting a vehicle
|
||||
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::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType | $TypeMasks::InteriorObjectType;
|
||||
// search for objects within the beam's range that fit the masks above
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
// screen out interiors
|
||||
if(%scanTarg && !(%scanTarg.getType() & $TypeMasks::InteriorObjectType))
|
||||
{
|
||||
// a target in range was found
|
||||
%repTgt = firstWord(%scanTarg);
|
||||
// is the prospective target damaged?
|
||||
if(%repTgt.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::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StaticShapeObjectType | $TypeMasks::TurretObjectType;
|
||||
|
||||
//AI hack to help "fudge" the repairing stuff...
|
||||
if (%obj.client.isAIControlled() && isObject(%obj.client.repairObject) && %obj.client.repairObject == %obj.repairing)
|
||||
{
|
||||
%repTgt = %obj.client.repairObject;
|
||||
%repPoint = %repTgt.getAIRepairPoint();
|
||||
if (%repPoint $= "0 0 0")
|
||||
%repPoint = %repTgt.getWorldBoxCenter();
|
||||
%repTgtVector = VectorNormalize(VectorSub(%muzPoint, %repPoint));
|
||||
%aimVector = VectorNormalize(VectorSub(%muzPoint, %rangeEnd));
|
||||
|
||||
//if the dot product is very close (ie. we're aiming in the right direction)
|
||||
if (VectorDot(%repTgtVector, %aimVector) > 0.85)
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %repPoint, %searchMasks, %obj);
|
||||
}
|
||||
else
|
||||
%scanTarg = ContainerRayCast(%muzPoint, %rangeEnd, %searchMasks, %obj);
|
||||
|
||||
if (%scanTarg)
|
||||
{
|
||||
%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);
|
||||
}
|
||||
}
|
||||
|
||||
function RepairPack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
758
scripts/packs/satchelCharge.cs
Normal file
758
scripts/packs/satchelCharge.cs
Normal file
|
|
@ -0,0 +1,758 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// 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;
|
||||
};
|
||||
|
||||
datablock ItemData(SatchelCharge)
|
||||
{
|
||||
className = Pack;
|
||||
catagory = "Packs";
|
||||
image = SatchelChargeImage;
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
mass = 1;
|
||||
elasticity = 0.2;
|
||||
friction = 0.6;
|
||||
pickupRadius = 2;
|
||||
rotate = true;
|
||||
pickUpName = "a satchel charge pack";
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
datablock ItemData(SatchelChargeThrown)
|
||||
{
|
||||
shapeFile = "pack_upgrade_satchel.dts";
|
||||
explosion = SatchelMainExplosion;
|
||||
underwaterExplosion = UnderwaterSatchelMainExplosion;
|
||||
mass = 1;
|
||||
elasticity = 0.1;
|
||||
friction = 0.9;
|
||||
rotate = false;
|
||||
pickupRadius = 0;
|
||||
noTimeout = true;
|
||||
armDelay = 3000;
|
||||
maxDamage = 0.6;
|
||||
|
||||
kickBackStrength = 4000;
|
||||
|
||||
computeCRC = true;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function SatchelCharge::onUse(%this, %obj)
|
||||
{
|
||||
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;
|
||||
};
|
||||
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 SatchelChargeImage::onUnmount(%data, %obj, %node)
|
||||
{
|
||||
}
|
||||
|
||||
function SatchelChargeThrown::onDestroyed(%this, %object, %lastState)
|
||||
{
|
||||
if(%object.kaboom)
|
||||
return;
|
||||
else
|
||||
{
|
||||
%object.kaboom = true;
|
||||
|
||||
// the "thwart" flag is set if the charge is destroyed with weapons rather
|
||||
// than detonated. A less damaging explosion, but visually the same scale.
|
||||
if(%object.thwart)
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge destroyed.");
|
||||
%dmgRadius = 10 * $SatchelChargeMultiplier;
|
||||
%dmgMod = 0.3 * $SatchelChargeMultiplier;
|
||||
%expImpulse = limitSatchelImpulse(1000 * $SatchelChargeMultiplier);
|
||||
%dmgType = $DamageType::Explosion;
|
||||
}
|
||||
else
|
||||
{
|
||||
messageClient(%object.sourceObject.client, 'msgSatchelChargeDetonate', "\c2Satchel charge detonated!");
|
||||
%dmgRadius = 20 * $SatchelChargeMultiplier;
|
||||
%dmgMod = 1.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::onCollision(%data,%obj,%col)
|
||||
{
|
||||
// Do nothing...
|
||||
}
|
||||
|
||||
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 SatchelCharge::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
function limitSatchelImpulse(%val) {
|
||||
if (%val > 50000)
|
||||
%val = 50000;
|
||||
return %val;
|
||||
}
|
||||
143
scripts/packs/solarpanel.cs
Normal file
143
scripts/packs/solarpanel.cs
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Solar Panel
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(SolarPanelDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
|
||||
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 = "";
|
||||
}
|
||||
285
scripts/packs/spine.cs
Normal file
285
scripts/packs/spine.cs
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
//---------------------------------------------------------
|
||||
// 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 = 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(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 = 1;
|
||||
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 = 1;
|
||||
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,$AllObjMask);
|
||||
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 DeployedWoodSpine::onDestroyed(%this, %obj, %prevState) {
|
||||
DeployedSpine::onDestroyed(%this, %obj, %prevState);
|
||||
}
|
||||
|
||||
function spineDeployableImage::onMount(%data, %obj, %node) {
|
||||
%obj.hasSpine = true; // set for spinecheck
|
||||
%obj.packSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function spineDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.hasSpine = "";
|
||||
%obj.packSet = 0;
|
||||
}
|
||||
273
scripts/packs/switch.cs
Normal file
273
scripts/packs/switch.cs
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Deployable Switch
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedSwitch) : StaticShapeDamageProfile {
|
||||
className = "switch";
|
||||
shapeFile = "switch.dts";
|
||||
|
||||
maxDamage = 1.00;
|
||||
destroyedLevel = 1.00;
|
||||
disabledLevel = 0.75;
|
||||
|
||||
isShielded = true;
|
||||
energyPerDamagePoint = 30;
|
||||
maxEnergy = 100;
|
||||
rechargeRate = 0.05;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.3;
|
||||
expImpulse = 500;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_switch_grey";
|
||||
targetNameTag = 'Deployed';
|
||||
targetTypeTag = 'Switch';
|
||||
// deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
emap = true;
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(SwitchDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
|
||||
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;
|
||||
}
|
||||
564
scripts/packs/telepadpack.cs
Normal file
564
scripts/packs/telepadpack.cs
Normal file
|
|
@ -0,0 +1,564 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Telepad
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock ShapeBaseImageData(TelePadDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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.play3D(TelePadAccessDeniedSound);
|
||||
messageClient(%col.client,'msgClient','\c2Access Denied -- Wrong team.');
|
||||
%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 TelePadPack::onPickup(%this,%obj,%shape,%amount) {
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return %deplObj;
|
||||
}
|
||||
|
||||
function TelePadDeployableImage::onMount(%data,%obj,%node) {
|
||||
%obj.hasTele = true; // set for telecheck
|
||||
%obj.packSet = 1;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TelePadDeployableImage::onUnmount(%data,%obj,%node) {
|
||||
%obj.hasTele = "";
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
}
|
||||
258
scripts/packs/treepack.cs
Normal file
258
scripts/packs/treepack.cs
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
//---------------------------------------------------------
|
||||
// Deployable Tree, original code by Parousia
|
||||
//---------------------------------------------------------
|
||||
|
||||
datablock StaticShapeData(DeployedTree) : StaticShapeDamageProfile {
|
||||
className = "tree";
|
||||
shapeFile = "borg19.dts";
|
||||
|
||||
maxDamage = 0.5;
|
||||
destroyedLevel = 0.5;
|
||||
disabledLevel = 0.3;
|
||||
|
||||
explosion = HandGrenadeExplosion;
|
||||
expDmgRadius = 1.0;
|
||||
expDamage = 0.05;
|
||||
expImpulse = 200;
|
||||
|
||||
dynamicType = $TypeMasks::StaticShapeObjectType;
|
||||
deployedObject = true;
|
||||
cmdCategory = "DSupport";
|
||||
cmdIcon = CMDSensorIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor";
|
||||
targetNameTag = 'Deployed Tree';
|
||||
deployAmbientThread = true;
|
||||
debrisShapeName = "debris_generic_small.dts";
|
||||
debris = DeployableDebris;
|
||||
heatSignature = 0;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree0) : DeployedTree {
|
||||
shapeFile = "borg16.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree1) : DeployedTree {
|
||||
shapeFile = "borg17.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree2) : DeployedTree {
|
||||
shapeFile = "borg18.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree3) : DeployedTree {
|
||||
shapeFile = "borg19.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree4) : DeployedTree {
|
||||
shapeFile = "dorg15.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree5) : DeployedTree {
|
||||
shapeFile = "dorg16.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree6) : DeployedTree {
|
||||
shapeFile = "dorg17.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree7) : DeployedTree {
|
||||
shapeFile = "dorg18.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree8) : DeployedTree {
|
||||
shapeFile = "dorg19.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree9) : DeployedTree {
|
||||
shapeFile = "porg3.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree10) : DeployedTree {
|
||||
shapeFile = "porg6.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree11) : DeployedTree {
|
||||
shapeFile = "sorg20.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree12) : DeployedTree {
|
||||
shapeFile = "sorg22.dts";
|
||||
};
|
||||
|
||||
datablock StaticShapeData(DeployedTree13) : DeployedTree {
|
||||
shapeFile = "xorg3.dts";
|
||||
};
|
||||
|
||||
datablock ShapeBaseImageData(TreeDeployableImage) {
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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);
|
||||
}
|
||||
393
scripts/packs/tripwire.cs
Normal file
393
scripts/packs/tripwire.cs
Normal file
|
|
@ -0,0 +1,393 @@
|
|||
// 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 = 1;
|
||||
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 = 1;
|
||||
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["tripwire",%plyr.packSet],0);
|
||||
%deplObj.fieldMode = getWord($packSetting["tripwire",%plyr.packSet],1);
|
||||
%deplObj.tripMode = %plyr.expertSet;
|
||||
if (%deplObj.fieldMode == 1)
|
||||
%deplObj.beamRange = 160;
|
||||
else
|
||||
%deplObj.beamRange = 30;
|
||||
|
||||
%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 = 2;
|
||||
%obj.expertSet = 0;
|
||||
displayPowerFreq(%obj);
|
||||
}
|
||||
|
||||
function TripwireDeployableImage::onUnmount(%data, %obj, %node) {
|
||||
%obj.packSet = 0;
|
||||
%obj.expertSet = 0;
|
||||
%obj.hasTripwire = "";
|
||||
}
|
||||
141
scripts/packs/turretpack.cs
Normal file
141
scripts/packs/turretpack.cs
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
// turretpack.cs - turret pack
|
||||
//
|
||||
|
||||
datablock ShapeBaseImageData(TurretDeployableImage)
|
||||
{
|
||||
mass = 1;
|
||||
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 = 1;
|
||||
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 = 1;
|
||||
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 = true;
|
||||
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 TurretBasePack::onPickup(%this, %obj, %shape, %amount)
|
||||
{
|
||||
// created to prevent console errors
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
764
scripts/packs/vehiclepad.cs
Normal file
764
scripts/packs/vehiclepad.cs
Normal file
|
|
@ -0,0 +1,764 @@
|
|||
//======================================
|
||||
// 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);
|
||||
|
||||
//Remove unwanted vehicles
|
||||
if(%obj.scoutVehicle !$= "Removed")
|
||||
%sv.vehicle[scoutvehicle] = true;
|
||||
if(%obj.assaultVehicle !$= "Removed")
|
||||
%sv.vehicle[assaultVehicle] = true;
|
||||
if(%obj.AlternateMobileBase !$= "Removed")
|
||||
%sv.vehicle[AlternateMobileBase] = true;
|
||||
if(%obj.mobileBaseVehicle !$= "Removed") // TeleToMPB();
|
||||
%sv.vehicle[mobileBasevehicle] = true;
|
||||
if(%obj.PyroXL !$= "Removed")
|
||||
%sv.vehicle[PyroXL] = true;
|
||||
if(%obj.scoutFlyer !$= "Removed")
|
||||
%sv.vehicle[scoutFlyer] = true;
|
||||
if(%obj.bomberFlyer !$= "Removed")
|
||||
%sv.vehicle[bomberFlyer] = true;
|
||||
if(%obj.hapcFlyer !$= "Removed")
|
||||
%sv.vehicle[hapcFlyer] = true;
|
||||
if(%obj.hoverBike !$= "Removed")
|
||||
%sv.vehicle[hoverBike] = true;
|
||||
return %sv;
|
||||
}
|
||||
|
||||
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 = 1;
|
||||
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 = 1;
|
||||
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;
|
||||
%deplObj = GiveStation(%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);
|
||||
}
|
||||
3693
scripts/player.cs
Normal file
3693
scripts/player.cs
Normal file
File diff suppressed because it is too large
Load diff
358
scripts/power.cs
Normal file
358
scripts/power.cs
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
$PowerThread = 0;
|
||||
$AmbientThread = 1;
|
||||
$ActivateThread = 2;
|
||||
$DeployThread = 3;
|
||||
|
||||
$HumSound = 0;
|
||||
$ActivateSound = 1;
|
||||
$DeploySound = 2;
|
||||
$PlaySound = 3;
|
||||
|
||||
//******************************************************************************
|
||||
//* Power -Audio- Data Blocks *
|
||||
//******************************************************************************
|
||||
|
||||
datablock AudioProfile(BasePowerOn)
|
||||
{
|
||||
filename = "fx/powered/base_power_on.wav";
|
||||
description = Audio2D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(BasePowerOff)
|
||||
{
|
||||
filename = "fx/powered/base_power_off.wav";
|
||||
description = Audio2D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
datablock AudioProfile(BasePowerHum)
|
||||
{
|
||||
filename = "fx/powered/base_power_loop.wav";
|
||||
description = AudioLooping2D;
|
||||
preload = true;
|
||||
};
|
||||
|
||||
//******************************************************************************
|
||||
//* Power - Functions *
|
||||
//******************************************************************************
|
||||
|
||||
function GameBase::clearPower(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function SimGroup::clearPower(%this)
|
||||
{
|
||||
%this.powerCount = 0;
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
{
|
||||
%obj = %this.getObject(%i);
|
||||
if(%obj.getType() & $TypeMasks::GameBaseObjectType)
|
||||
%obj.clearPower();
|
||||
}
|
||||
}
|
||||
|
||||
function SimObject::powerInit(%this, %powerCount)
|
||||
{
|
||||
//function declared to reduce console error msg spam
|
||||
}
|
||||
|
||||
function SimGroup::powerInit(%this, %powerCount)
|
||||
{
|
||||
if(%this.providesPower)
|
||||
%powerCount++;
|
||||
|
||||
%count = %this.getCount();
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%obj = %this.getObject(%i);
|
||||
if(%obj.getType() & $TypeMasks::GameBaseObjectType)
|
||||
{
|
||||
if(%obj.getDatablock().isPowering(%obj))
|
||||
%powerCount++;
|
||||
}
|
||||
}
|
||||
%this.powerCount = %powerCount;
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
{
|
||||
%obj = %this.getObject(%i);
|
||||
%obj.powerInit(%powerCount);
|
||||
}
|
||||
}
|
||||
|
||||
function GameBase::powerInit(%this, %powerCount)
|
||||
{
|
||||
if(%powerCount)
|
||||
%this.getDatablock().gainPower(%this);
|
||||
else
|
||||
%this.getDataBlock().losePower(%this);
|
||||
}
|
||||
|
||||
function SimObject::isPowering(%data, %obj)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
function Generator::isPowering(%data, %obj)
|
||||
{
|
||||
return !%obj.isDisabled();
|
||||
}
|
||||
|
||||
function SimObject::updatePowerCount()
|
||||
{
|
||||
}
|
||||
|
||||
function SimObject::powerCheck()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
function SimGroup::updatePowerCount(%this, %value)
|
||||
{
|
||||
if(%this.powerCount > 0 || %value > 0)
|
||||
%this.powerCount += %value;
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
{
|
||||
%this.getObject(%i).updatePowerCount(%value);
|
||||
}
|
||||
for (%i = 0; %i < %this.getCount(); %i++)
|
||||
%this.getObject(%i).powerCheck(%this.powerCount);
|
||||
}
|
||||
|
||||
function GameBaseData::gainPower(%data, %obj)
|
||||
{
|
||||
}
|
||||
|
||||
function GameBaseData::losePower(%data, %obj)
|
||||
{
|
||||
}
|
||||
|
||||
function InteriorInstance::powerCheck(%this, %powerCount)
|
||||
{
|
||||
if(%powerCount > 0)
|
||||
%mode = "Off";
|
||||
else
|
||||
%mode = "On";
|
||||
%this.setAlarmMode(%mode);
|
||||
}
|
||||
|
||||
function GameBase::powerCheck(%this, %powerCount)
|
||||
{
|
||||
if(%powerCount || %this.selfPower)
|
||||
%this.getDatablock().gainPower(%this);
|
||||
else
|
||||
%this.getDatablock().losePower(%this);
|
||||
}
|
||||
|
||||
function GameBase::incPowerCount(%this) {
|
||||
%group = %this.getGroup();
|
||||
if (%group != nameToID("MissionCleanup/Deployables"))
|
||||
%group.updatePowerCount(1);
|
||||
}
|
||||
|
||||
function GameBase::decPowerCount(%this) {
|
||||
%group = %this.getGroup();
|
||||
if (%group != nameToID("MissionCleanup/Deployables"))
|
||||
%group.updatePowerCount(-1);
|
||||
}
|
||||
|
||||
function GameBase::setSelfPowered(%this) {
|
||||
if(!%this.isPowered()) {
|
||||
%this.selfPower = true;
|
||||
if(%this.getDatablock().deployedObject)
|
||||
%this.initDeploy = true;
|
||||
%this.getDataBlock().gainPower(%this);
|
||||
}
|
||||
else
|
||||
%this.selfPower = true;
|
||||
}
|
||||
|
||||
function GameBase::clearSelfPowered(%this)
|
||||
{
|
||||
%this.selfPower = "";
|
||||
if(!%this.isPowered())
|
||||
%this.getDataBlock().losePower(%this);
|
||||
}
|
||||
|
||||
function GameBase::isPowered(%this) {
|
||||
return ((%this.selfPower && %this.isEnabled()) || %this.getGroup().powerCount > 0 || %this.powerCount > 0) && !%this.isSwitchedOff;
|
||||
}
|
||||
|
||||
function buildPowerList() {
|
||||
$PowerList = "";
|
||||
%group = nameToID("MissionCleanup/Deployables");
|
||||
%count = %group.getCount();
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%obj = %group.getObject(%i);
|
||||
if (isObject(%obj)) {
|
||||
if (%obj.getDataBlock().className $= "Generator" && %obj.deployed && !%obj.isRemoved) {
|
||||
// Not using listAdd() here, for speed
|
||||
$PowerList = $PowerList SPC %obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
$PowerList = trim($PowerList);
|
||||
}
|
||||
|
||||
function globalPowerCheck() {
|
||||
buildPowerList();
|
||||
%group = nameToID("MissionCleanup/Deployables");
|
||||
%count = %group.getCount();
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%obj = %group.getObject(%i);
|
||||
%obj.powerCount = "";
|
||||
if (%obj.getDataBlock().needsPower)
|
||||
%obj.getDataBlock().losePower(%obj);
|
||||
checkPowerObject(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
function checkPowerGenerator(%powerObj,%stateChange) {
|
||||
%group = nameToID("MissionCleanup/Deployables");
|
||||
%count = %group.getCount();
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%obj = %group.getObject(%i);
|
||||
if (%obj.getDataBlock().needsPower) {
|
||||
if (genLinkedObj(%powerObj,%obj)) {
|
||||
%obj.powerCount = %obj.powerCount + %stateChange;
|
||||
checkPowerObject(%obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkPowerObject(%obj) {
|
||||
if (%obj.getDataBlock().needsPower) {
|
||||
%powerCount = %obj.powerCount;
|
||||
if (%powerCount $= "") {
|
||||
%count = getWordCount($PowerList);
|
||||
%powerCount = 0;
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%powerObj = getWord($PowerList,%i);
|
||||
if (genPoweringObj(%powerObj,%obj))
|
||||
%powerCount++;
|
||||
}
|
||||
}
|
||||
%obj.powerCount = %powerCount;
|
||||
doObjectPower(%obj);
|
||||
}
|
||||
}
|
||||
|
||||
function genPoweringObj(%powerObj,%obj) {
|
||||
%isPowering = false;
|
||||
if (isObject(%powerObj)){
|
||||
if (%powerObj.isEnabled() && %powerObj.isPowered()) {
|
||||
if (genLinkedObj(%powerObj,%obj))
|
||||
%isPowering = true;
|
||||
}
|
||||
}
|
||||
return %isPowering;
|
||||
}
|
||||
|
||||
function genLinkedObj(%powerObj,%obj) {
|
||||
if (%obj.powerFreq == %powerObj.powerFreq) {
|
||||
if (vectorDist(%obj.getPosition(),%powerObj.getPosition()) < %powerObj.getDataBlock().powerRadius
|
||||
&& (%obj.team == %powerObj.team || %powerObj.team == 0)
|
||||
&& !%obj.isRemoved && !%powerObj.isRemoved) {
|
||||
%lsLinked = true;
|
||||
}
|
||||
}
|
||||
return %lsLinked;
|
||||
}
|
||||
|
||||
function doObjectPower(%obj) {
|
||||
if (%obj.powerCount > 0)
|
||||
%obj.getDataBlock().gainPower(%obj);
|
||||
else
|
||||
%obj.getDataBlock().losePower(%obj);
|
||||
}
|
||||
|
||||
function delNonPoweredPieces(%quiet) {
|
||||
%randomTime = 10000;
|
||||
%group = nameToID("MissionCleanup/Deployables");
|
||||
%count = %group.getCount();
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%obj = %group.getObject(%i);
|
||||
if (%obj.getDataBlock().className !$= "Generator") {
|
||||
%hasPower = "";
|
||||
%count2 = getWordCount($PowerList);
|
||||
for(%i2=0;%i2<%count2;%i2++) {
|
||||
%powerObj = getWord($PowerList,%i2);
|
||||
if (vectorDist(%obj.getPosition(),%powerObj.getPosition()) < %powerObj.getDataBlock().powerRadius) {
|
||||
%hasPower = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!%hasPower) {
|
||||
if (!%quiet)
|
||||
warn("Deleting: " @ %obj @ " Name: " @ %obj.getDataBlock().getName());
|
||||
%random = getRandom() * %randomTime;
|
||||
%obj.getDataBlock().schedule(%random,"disassemble",%plyr,%obj); // Run Item Specific code.
|
||||
%deleted++;
|
||||
}
|
||||
else
|
||||
%checked++;
|
||||
}
|
||||
}
|
||||
if (!%quiet) {
|
||||
warn("Checked pieces: " @ %checked);
|
||||
warn("Deleted pieces: " @ %deleted);
|
||||
}
|
||||
return %randomTime;
|
||||
}
|
||||
|
||||
function displayPowerFreq(%obj) {
|
||||
%powerFreq = %obj.powerFreq;
|
||||
if (%powerFreq < 1 || %powerFreq > upperPowerFreq(%obj) || !%powerFreq)
|
||||
%powerFreq = 1;
|
||||
%obj.powerFreq = %powerFreq;
|
||||
bottomPrint(%obj.client,"Your power frequency is set to: " @ %obj.powerFreq,2,1);
|
||||
}
|
||||
|
||||
function toggleGenerator(%obj,%state) {
|
||||
if (!isObject(%obj))
|
||||
return -1;
|
||||
%dataBlockName = %obj.getDataBlock().getName();
|
||||
if (%dataBlockName $= "GeneratorLarge") {
|
||||
%switchDelay = 5000;
|
||||
%displayName = "Generator";
|
||||
%powerOnSound = BasePowerOn;
|
||||
%powerOffSound = BasePowerOff;
|
||||
}
|
||||
else if (%dataBlockName $= "SolarPanel") {
|
||||
%switchDelay = 1000;
|
||||
%displayName = "Solar Panel";
|
||||
%powerOnSound = PlasmaSwitchSound;
|
||||
%powerOffSound = PlasmaReloadSound;
|
||||
}
|
||||
%taggedDisplayName = addTaggedString(%displayName);
|
||||
if (!%obj.isEnabled())
|
||||
return -2 SPC %taggedDisplayName;
|
||||
if (!(%obj.switchTime + %switchDelay < getSimTime()))
|
||||
return -3 SPC %taggedDisplayName SPC %obj.switchTime + %switchDelay - getSimTime();
|
||||
if (%obj.isSwitchedOff && (%state != false || %state $= "")) {
|
||||
%obj.isSwitchedOff = "";
|
||||
%obj.getDataBlock().gainPower(%obj);
|
||||
%obj.play3D(%powerOnSound);
|
||||
setTargetName(%obj.target,addTaggedString("Frequency" SPC %obj.powerFreq));
|
||||
%obj.switchTime = getSimTime();
|
||||
return 2 SPC %taggedDisplayName;
|
||||
}
|
||||
else if (!%obj.isSwitchedOff && (%state != true || %state $= "")) {
|
||||
%obj.getDataBlock().losePower(%obj);
|
||||
%obj.isSwitchedOff = 1;
|
||||
%obj.play3D(%powerOffSound);
|
||||
setTargetName(%obj.target,addTaggedString("Disabled Frequency" SPC %obj.powerFreq));
|
||||
%obj.switchTime = getSimTime();
|
||||
return 1 SPC %taggedDisplayName;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function upperPowerFreq(%plyr) {
|
||||
if (%plyr.client.isAdmin || %plyr.client.isSuperAdmin)
|
||||
return 50;
|
||||
else
|
||||
return 40;
|
||||
}
|
||||
310
scripts/prison.cs
Normal file
310
scripts/prison.cs
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
// prison.cs
|
||||
|
||||
// Set up defaults for nonexisting vars
|
||||
if ($Host::Prison::Enabled $= "")
|
||||
$Host::Prison::Enabled = 1; // Enable prison system
|
||||
if ($Host::Prison::JailMode $= "")
|
||||
$Host::Prison::JailMode = 0; // Jailing mode
|
||||
// 0 = prison building
|
||||
// 1 = spawnsphere
|
||||
// 2 = players current/last position (prison only affects use of items)
|
||||
if ($Host::Prison::ReleaseMode $= "")
|
||||
$Host::Prison::ReleaseMode = 1; // Release mode - same as above
|
||||
|
||||
// Killing
|
||||
if ($Host::Prison::Kill $= "")
|
||||
$Host::Prison::Kill = 0; // Enable killing punishment
|
||||
if ($Host::Prison::TeamKill $= "")
|
||||
$Host::Prison::TeamKill = 1; // Enable teamkill punishment
|
||||
if ($Host::Prison::KillTime $= "")
|
||||
$Host::Prison::KillTime = 2 * 60; // Time to punish for killing/teamkilling
|
||||
|
||||
// Deployables spamming
|
||||
if ($Host::Prison::DeploySpam $= "")
|
||||
$Host::Prison::DeploySpam = 1; // Enable deployables spam punishment
|
||||
if ($Host::Prison::DeploySpamTime $= "")
|
||||
$Host::Prison::DeploySpamTime = 60; // Time to punish for deployables spamming
|
||||
if ($Host::Prison::DeploySpamMultiply $= "")
|
||||
$Host::Prison::DeploySpamMultiply = 1; // Enable punishment multiplier for repeat offenders
|
||||
if ($Host::Prison::DeploySpamMaxTime $= "")
|
||||
$Host::Prison::DeploySpamMaxTime = 5 * 60; // Max time, if applying multiplier, to jail a player
|
||||
if ($Host::Prison::DeploySpamCheckTimeMS $= "")
|
||||
$Host::Prison::DeploySpamCheckTimeMS = 1000; // Time in MS between deploying that is considered spam
|
||||
if ($Host::Prison::DeploySpamWarnings $= "")
|
||||
$Host::Prison::DeploySpamWarnings = 10; // Number of warnings before punishment
|
||||
// This is a bit misleading. It is actually the number of spams
|
||||
// allowed before punishment. Warnings will be given for the last
|
||||
// half of them
|
||||
if ($Host::Prison::DeploySpamResetWarnCountTime $= "")
|
||||
$Host::Prison::DeploySpamResetWarnCountTime = 30; // Reset warn counter after this many seconds of not deploying
|
||||
if ($Host::Prison::DeploySpamRemoveRecentMS $= "")
|
||||
$Host::Prison::DeploySpamRemoveRecentMS = 1000 * 15; // Remove pieces deployed by offender within the last 15 seconds
|
||||
|
||||
if ($Prison::RemoveSpamTimer < 10000) // Remove spam around prison every 30 seconds, 10 seconds minimum
|
||||
$Prison::RemoveSpamTimer = 30000;
|
||||
|
||||
function jailPlayer(%cl,%release,%prisonTimeInSeconds,%jailThread) {
|
||||
%cl.jailThread++;
|
||||
if (!isObject(%cl)) {
|
||||
warn("-jailPlayer- no client: " @ %cl @ " (" @ (%release ? "release" : "jail") @ ")");
|
||||
return;
|
||||
}
|
||||
if (%release) {
|
||||
if (%jailThread == 0 || %cl.jailThread - 1 == %jailThread) {
|
||||
%cl.isJailed = false;
|
||||
if (($Host::Prison::ReleaseMode $= "0" || $Host::Prison::ReleaseMode $= "")
|
||||
&& $Prison::ReleasePos !$= "0" && $Prison::ReleasePos !$= "") {
|
||||
%cl.player.setVelocity("0 0 0");
|
||||
if ($Prison::ReleaseRad > 0) {
|
||||
%pi = 3.1415926535897932384626433832795; // Whoa..
|
||||
%vec = getRandom() * %pi * 2;
|
||||
%rad = getRandom() * $Prison::ReleaseRad;
|
||||
%x = %x + (mSin(%vec) * %rad);
|
||||
%y = %y + (mCos(%vec) * %rad);
|
||||
%cl.player.setPosition(VectorAdd(%x SPC %y SPC 0,$Prison::ReleasePos));
|
||||
}
|
||||
else
|
||||
%cl.player.setPosition($Prison::ReleasePos);
|
||||
}
|
||||
else if ($Host::Prison::ReleaseMode == 1) {
|
||||
%cl.player.setVelocity("0 0 0");
|
||||
%cl.player.setPosition(Game.pickPlayerSpawn(%cl,false));
|
||||
}
|
||||
else {
|
||||
// Make sure they still get released from prison building
|
||||
if (($Host::Prison::JailMode $= "0" || $Host::Prison::JailMode $= "")
|
||||
&& $Prison::JailPos !$= "0" && $Prison::JailPos !$= "") { // This could be handled nicer..
|
||||
%cl.player.setVelocity("0 0 0");
|
||||
%cl.player.setPosition(%cl.preJailPos);
|
||||
// %cl.player.setVelocity(%cl.preJailVel);
|
||||
}
|
||||
// Else, do nothing. Leave player at current position.
|
||||
}
|
||||
buyFavorites(%cl);
|
||||
if (%cl.player.weaponCount > 0)
|
||||
%cl.player.selectWeaponSlot(0);
|
||||
if (%jailThread) // Only show for timed releases
|
||||
messageAll('msgClient','\c2%1 has been released from jail.',%cl.name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ($Host::Prison::Enabled != true) {
|
||||
warn("-jailPlayer- prison system is disabled.");
|
||||
return;
|
||||
}
|
||||
%cl.isJailed = true;
|
||||
%cl.jailTime = %prisonTimeInSeconds;
|
||||
if (isObject(%cl.player)) {
|
||||
if (%cl.player.getState() !$="Dead") {
|
||||
if(%cl.player.isMounted()) {
|
||||
if(%cl.player.vehicleTurret)
|
||||
%cl.player.vehicleTurret.getDataBlock().playerDismount(%cl.player.vehicleTurret);
|
||||
else {
|
||||
%cl.player.getDataBlock().doDismount(%cl.player,true);
|
||||
%cl.player.mountVehicle = false;
|
||||
}
|
||||
}
|
||||
serverCmdResetControlObject(%cl);
|
||||
%cl.player.setInventory(EnergyPack,1,1); // Fix Satchel Charge
|
||||
%cl.player.clearInventory();
|
||||
%cl.setWeaponsHudClearAll();
|
||||
%cl.player.setArmor("Light");
|
||||
Game.dropFlag(%cl.player);
|
||||
%cl.preJailVel = %cl.player.getVelocity();
|
||||
%cl.preJailPos = %cl.player.getPosition();
|
||||
// If we have no prison to put them in, we'll let them run around without any weapons..
|
||||
if (($Host::Prison::JailMode $= "0" || $Host::Prison::JailMode $= "")
|
||||
&& $Prison::JailPos !$= "0" && $Prison::JailPos !$= "") {
|
||||
%cl.player.setVelocity("0 0 0");
|
||||
if ($Prison::JailRad > 0) {
|
||||
%pi = 3.1415926535897932384626433832795; // Whoa..
|
||||
%vec = getRandom() * %pi * 2;
|
||||
%rad = getRandom() * $Prison::JailRad;
|
||||
%x = %x + (mSin(%vec) * %rad);
|
||||
%y = %y + (mCos(%vec) * %rad);
|
||||
%cl.player.setPosition(VectorAdd(%x SPC %y SPC 0,$Prison::JailPos));
|
||||
}
|
||||
else
|
||||
%cl.player.setPosition($Prison::JailPos);
|
||||
}
|
||||
else if ($Host::Prison::JailMode == 1) {
|
||||
%cl.player.setVelocity("0 0 0");
|
||||
%cl.player.setPosition(Game.pickPlayerSpawn(%cl,false));
|
||||
}
|
||||
else {
|
||||
// Do nothing, leave player's current position
|
||||
}
|
||||
cancel(%cl.prisonReleaseSched);
|
||||
if (%prisonTimeInSeconds > 0)
|
||||
%cl.prisonReleaseSched = schedule(%prisonTimeInSeconds * 1000,0,jailPlayer,%cl,true,0,%cl.jailThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function prisonCreate() {
|
||||
%prisonBasePos = "0 0 -10000";
|
||||
if (isObject(nameToID(PrisonGroup)))
|
||||
// Note, this does not handle removal of the PhysicalZones
|
||||
PrisonGroup.delete();
|
||||
%group = nameToID(MissionCleanup);
|
||||
if(%group == -1)
|
||||
return;
|
||||
%p = new SimGroup(PrisonGroup) {
|
||||
providesPower = true;
|
||||
new InteriorInstance(PrisonMain) {
|
||||
position = %prisonBasePos;
|
||||
rotation = "-1 0 0 90";
|
||||
scale = "1 1 1";
|
||||
interiorFile = "btowra.dif";
|
||||
};
|
||||
new ForceFieldBare(PrisonFF1) {
|
||||
position = VectorAdd("-6.3 -22.5 -2.25",%prisonBasePos);
|
||||
rotation = "1 0 0 0";
|
||||
scale = "12.9 0.18 8.5";
|
||||
dataBlock = "defaultSolidFieldBare";
|
||||
};
|
||||
new ForceFieldBare(PrisonFF2) {
|
||||
position = VectorAdd("-2.25 -2.25 6.2",%prisonBasePos);
|
||||
rotation = "1 0 0 0";
|
||||
scale = "4.5 4.5 0.18";
|
||||
dataBlock = "defaultSolidFieldBare";
|
||||
};
|
||||
};
|
||||
%group.add(%p);
|
||||
PrisonGroup.powerInit(0);
|
||||
addPrisonCamera(VectorAdd("0 2 0.5",%prisonBasePos),getWords(MatrixCreateFromEuler(mDegToRad(90)) SPC "0 0",3,6),0);
|
||||
addPrisonCamera(VectorAdd("1 2 0.5",%prisonBasePos),getWords(MatrixCreateFromEuler(mDegToRad(90)) SPC "0 0",3,6),1);
|
||||
addPrisonCamera(VectorAdd("-1 2 0.5",%prisonBasePos),getWords(MatrixCreateFromEuler(mDegToRad(90)) SPC "0 0",3,6),2);
|
||||
$Prison::JailRad = 3;
|
||||
$Prison::JailPos = VectorAdd("0 -8.5 0",%prisonBasePos);
|
||||
$Prison::ReleaseRad = 4;
|
||||
$Prison::ReleasePos = VectorAdd("0 -14.25 6.75",%prisonBasePos); // Release player on top of prison
|
||||
$Prison::NoBuildRadius = 50;
|
||||
}
|
||||
|
||||
// Prevent spam in prison. If called outside prisonCreate(), needs to be passed $Prison::RemoveSpamThread++ as arg
|
||||
function prisonRemoveSpamThread(%thread) {
|
||||
// Re-evaluate here, in case user has set it to an "illegal" value
|
||||
if ($Prison::RemoveSpamTimer < 10000) // 10 seconds
|
||||
$Prison::RemoveSpamTimer = 10000;
|
||||
// Thread cancels if prison is re-created, if PrisonGroup ceases to exist, or if prison system is disabled
|
||||
if (%thread != $Prison::RemoveSpamThread || !isObject(nameToID(PrisonGroup)) || $Host::Prison::Enabled != 1) {
|
||||
warn("prisonRemoveSpamThread #" @ mAbs(%thread) @ " stopped. Last started thread: " @ $Prison::RemoveSpamThread);
|
||||
return;
|
||||
}
|
||||
InitContainerRadiusSearch($Prison::JailPos,$Prison::NoBuildRadius,$TypeMasks::StaticShapeObjectType | $TypeMasks::ItemObjectType | $TypeMasks::ForceFieldObjectType);
|
||||
while((%obj = ContainerSearchNext()) != 0) {
|
||||
// Extra safety
|
||||
if (VectorDist($Prison::JailPos,%obj.getPosition()) < $Prison::NoBuildRadius) {
|
||||
%dataBlockName = %obj.getDataBlock().getName();
|
||||
if (saveBuildingCheck(%obj)) { // If it's handled by saveBuilding(), it must be a deployable
|
||||
%random = getRandom() * $Prison::RemoveSpamTimer-2000; // prevent duplicate disassemblies
|
||||
%obj.getDataBlock().schedule(%random,"disassemble",0,%obj); // Run Item Specific code.
|
||||
}
|
||||
}
|
||||
}
|
||||
schedule($Prison::RemoveSpamTimer,0,prisonRemoveSpamThread,%thread);
|
||||
}
|
||||
|
||||
function prisonEnable() {
|
||||
$Host::Prison::Enabled = 1;
|
||||
%pgroup = nameToID(PrisonGroup);
|
||||
if(isObject(%pgroup)) {
|
||||
%pgroup.providesPower = true;
|
||||
%pgroup.powerInit(0);
|
||||
}
|
||||
else
|
||||
prisonCreate();
|
||||
prisonRemoveSpamThread($Prison::RemoveSpamThread++);
|
||||
}
|
||||
|
||||
function prisonDisable() {
|
||||
$Host::Prison::Enabled = 0;
|
||||
%pgroup = nameToID(PrisonGroup);
|
||||
if(isObject(%pgroup)) {
|
||||
%pgroup.providesPower = false;
|
||||
%pgroup.powerInit(0);
|
||||
}
|
||||
// Release jailed players
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++) {
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isJailed)
|
||||
jailPlayer(%cl,true);
|
||||
}
|
||||
}
|
||||
|
||||
datablock SensorData(PrisonCameraSensorObject) {
|
||||
detects = false;
|
||||
};
|
||||
|
||||
datablock TurretData(TurretPrisonCamera) {
|
||||
className = PrisonCameraTurret;
|
||||
shapeFile = "camera.dts";
|
||||
|
||||
thetaMin = 50;
|
||||
thetaMax = 130;
|
||||
// thetaNull = 90;
|
||||
|
||||
cameraDefaultFov = 120;
|
||||
cameraMinFov = 120;
|
||||
cameraMaxFov = 120;
|
||||
|
||||
neverUpdateControl = false;
|
||||
|
||||
canControl = true;
|
||||
canObserve = true;
|
||||
observeThroughObject = true;
|
||||
cmdCategory = "Support";
|
||||
cmdIcon = CMDCameraIcon;
|
||||
cmdMiniIconName = "commander/MiniIcons/com_camera_grey";
|
||||
targetNameTag = 'Prison';
|
||||
targetTypeTag = 'Camera';
|
||||
sensorData = PrisonCameraSensorObject;
|
||||
sensorRadius = PrisonCameraSensorObject.detectRadius;
|
||||
|
||||
firstPersonOnly = true;
|
||||
observeParameters = "0.5 4.5 4.5";
|
||||
};
|
||||
|
||||
datablock TurretImageData(PrisonCameraBarrel) {
|
||||
shapeFile = "turret_muzzlepoint.dts";
|
||||
usesEnergy = false;
|
||||
|
||||
// Turret parameters
|
||||
activationMS = 100;
|
||||
deactivateDelayMS = 100;
|
||||
thinkTimeMS = 100;
|
||||
degPerSecTheta = 180;
|
||||
degPerSecPhi = 360;
|
||||
};
|
||||
|
||||
function addPrisonCamera(%pos,%rot,%team) {
|
||||
%group = nameToID(PrisonGroup);
|
||||
if (!isObject(%group))
|
||||
return;
|
||||
%pCam = new Turret(PrisonCamera) {
|
||||
dataBlock = "TurretPrisonCamera";
|
||||
position = %pos;
|
||||
rotation = %rot;
|
||||
team = %team;
|
||||
needsNoPower = true;
|
||||
};
|
||||
%pCam.setRotation(%rot); // Gah!
|
||||
%group.add(%pCam);
|
||||
|
||||
if(%pCam.getTarget() != -1)
|
||||
setTargetSensorGroup(%pCam.getTarget(),%team);
|
||||
%pCam.deploy();
|
||||
}
|
||||
|
||||
function TurretPrisonCamera::damageObject(%data,%targetObject,%sourceObject,%position,%amount,%damageType,%momVec,%mineSC) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
function TurretPrisonCamera::onAdd(%this, %obj) {
|
||||
Parent::onAdd(%this, %obj);
|
||||
%obj.mountImage(PrisonCameraBarrel, 0, true);
|
||||
%obj.setRechargeRate(%this.rechargeRate);
|
||||
%obj.setAutoFire(false); // z0ddm0d: Server crash fix related to controlable cameras
|
||||
}
|
||||
683
scripts/projectiles.cs
Normal file
683
scripts/projectiles.cs
Normal file
|
|
@ -0,0 +1,683 @@
|
|||
//--------------------------------------------------------------------------
|
||||
// Projectiles.cs: Note that the actual projectile blocks are stored with
|
||||
// with weapon that uses them in base/scripts/weapons/*.cs,
|
||||
// the blocks below are only to illustrate the default values
|
||||
// for each block type. Also, ProjectileData cannot be used
|
||||
// as a concrete datablock type.
|
||||
// Inheritance:
|
||||
// ProjectileData : GameBaseData
|
||||
// LinearProjectileData : ProjectileData
|
||||
// LinearFlareProjectileData : LinearProjectileData
|
||||
// GrenadeProjectileData : ProjectileData
|
||||
// SeekerProjectileData : ProjectileData
|
||||
// SniperProjectileData : ProjectileData
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//-------------------------------------- Default functions
|
||||
//
|
||||
function ProjectileData::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
|
||||
{
|
||||
if(isObject(%targetObject)) // Console spam fix - ToS. z0ddm0d
|
||||
{
|
||||
%targetObject.damage(%projectile.sourceObject, %position, %data.directDamage * %modifier, %data.directDamageType);
|
||||
}
|
||||
}
|
||||
|
||||
function SniperProjectileData::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
|
||||
{
|
||||
%damageAmount = %data.directDamage * %projectile.damageFactor;
|
||||
|
||||
if(isObject(%targetObject)) // Console spam fix - ToS. z0ddm0d
|
||||
{
|
||||
if(%targetObject.getDataBlock().getClassName() $= "PlayerData")
|
||||
{
|
||||
%damLoc = firstWord(%targetObject.getDamageLocation(%position));
|
||||
if(%damLoc $= "head")
|
||||
{
|
||||
%targetObject.getOwnerClient().headShot = 1;
|
||||
%modifier = %data.rifleHeadMultiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
%modifier = 1;
|
||||
%targetObject.getOwnerClient().headShot = 0;
|
||||
}
|
||||
}
|
||||
%targetObject.damage(%projectile.sourceObject, %position, %modifier * %damageAmount, %data.directDamageType);
|
||||
}
|
||||
}
|
||||
|
||||
function ShapeBaseImageData::onFire(%data, %obj, %slot)
|
||||
{
|
||||
%data.lightStart = getSimTime();
|
||||
|
||||
if( %obj.station $= "" && %obj.isCloaked() )
|
||||
{
|
||||
if( %obj.respawnCloakThread !$= "" )
|
||||
{
|
||||
Cancel(%obj.respawnCloakThread);
|
||||
%obj.setCloaked( false );
|
||||
%obj.respawnCloakThread = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if( %obj.getEnergyLevel() > 20 )
|
||||
{
|
||||
%obj.setCloaked( false );
|
||||
%obj.reCloak = %obj.schedule( 500, "setCloaked", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( %obj.client > 0 )
|
||||
{
|
||||
%obj.setInvincibleMode(0 ,0.00);
|
||||
%obj.setInvincible( false ); // fire your weapon and your invincibility goes away.
|
||||
}
|
||||
|
||||
%vehicle = 0;
|
||||
if(%data.usesEnergy)
|
||||
{
|
||||
if(%data.useMountEnergy)
|
||||
{
|
||||
%useEnergyObj = %obj.getObjectMount();
|
||||
if(!%useEnergyObj)
|
||||
%useEnergyObj = %obj;
|
||||
%energy = %useEnergyObj.getEnergyLevel();
|
||||
%vehicle = %useEnergyObj;
|
||||
}
|
||||
else
|
||||
%energy = %obj.getEnergyLevel();
|
||||
|
||||
if(%data.useCapacitor && %data.usesEnergy)
|
||||
{
|
||||
if( %useEnergyObj.turretObject.getCapacitorLevel() < %data.minEnergy )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(%energy < %data.minEnergy)
|
||||
return;
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Code streamlining - ToS. z0ddm0d
|
||||
if(%data.projectileSpread)
|
||||
{
|
||||
%vec = %obj.getMuzzleVector(%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);
|
||||
}
|
||||
else
|
||||
{
|
||||
%vector = %obj.getMuzzleVector(%slot);
|
||||
}
|
||||
%initialPos = %obj.getMuzzlePoint(%slot);
|
||||
if (%data.muzzleSlots) {
|
||||
%nrm = %vector;
|
||||
%nrm2 = vectorNormalize(vectorCross("0 0 -1",%nrm));
|
||||
%nrm3 = vectorNormalize(vectorCross(%nrm2,%nrm));
|
||||
%offsetVec = %data.muzzleSlotOffset[%obj.currentMuzzleSlot];
|
||||
|
||||
%initialPos = vectorAdd(%initialPos,vectorScale(%nrm2,getWord(%offsetVec,0)));
|
||||
%initialPos = vectorAdd(%initialPos,vectorScale(%nrm,getWord(%offsetVec,1)));
|
||||
%initialPos = vectorAdd(%initialPos,vectorScale(%nrm3,getWord(%offsetVec,2)));
|
||||
%obj.currentMuzzleSlot++;
|
||||
if (%obj.currentMuzzleSlot > %data.muzzleSlots - 1)
|
||||
%obj.currentMuzzleSlot = 0;
|
||||
}
|
||||
|
||||
%p = new (%data.projectileType)() {
|
||||
dataBlock = %data.projectile;
|
||||
initialDirection = %vector;
|
||||
initialPosition = %initialPos;
|
||||
sourceObject = %obj;
|
||||
sourceSlot = %slot;
|
||||
vehicleObject = %vehicle;
|
||||
};
|
||||
// End streamlining
|
||||
// ---------------------------------------------------------------------
|
||||
if (isObject(%obj.lastProjectile) && %obj.deleteLastProjectile)
|
||||
%obj.lastProjectile.delete();
|
||||
|
||||
%obj.lastProjectile = %p;
|
||||
%obj.deleteLastProjectile = %data.deleteLastProjectile;
|
||||
MissionCleanup.add(%p);
|
||||
|
||||
// AI hook
|
||||
if(%obj.client)
|
||||
%obj.client.projectile = %p;
|
||||
|
||||
if(%data.usesEnergy)
|
||||
{
|
||||
if(%data.useMountEnergy)
|
||||
{
|
||||
if( %data.useCapacitor )
|
||||
{
|
||||
%vehicle.turretObject.setCapacitorLevel( %vehicle.turretObject.getCapacitorLevel() - %data.fireEnergy );
|
||||
}
|
||||
else
|
||||
%useEnergyObj.setEnergyLevel(%energy - %data.fireEnergy);
|
||||
}
|
||||
else
|
||||
%obj.setEnergyLevel(%energy - %data.fireEnergy);
|
||||
}
|
||||
else
|
||||
%obj.decInventory(%data.ammo,1);
|
||||
return %p;
|
||||
}
|
||||
|
||||
function ShapeBaseImageData::onUnmount(%data, %obj, %slot)
|
||||
{
|
||||
if (%data.deleteLastProjectile && isObject(%obj.lastProjectile))
|
||||
{
|
||||
%obj.lastProjectile.delete();
|
||||
%obj.lastProjectile = "";
|
||||
}
|
||||
}
|
||||
|
||||
function TurretImageData::deconstruct(%data, %obj, %slot)
|
||||
{
|
||||
if (%data.deleteLastProjectile && isObject(%obj.lastProjectile))
|
||||
{
|
||||
%obj.lastProjectile.delete();
|
||||
%obj.lastProjectile = "";
|
||||
}
|
||||
}
|
||||
|
||||
function ShapeBaseImageData::deconstruct(%data, %obj, %slot)
|
||||
{
|
||||
if (%data.deleteLastProjectile && isObject(%obj.lastProjectile))
|
||||
{
|
||||
%obj.lastProjectile.delete();
|
||||
%obj.lastProjectile = "";
|
||||
}
|
||||
}
|
||||
|
||||
function MissileLauncherImage::onFire(%data,%obj,%slot)
|
||||
{
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
MissileSet.add(%p);
|
||||
|
||||
%target = %obj.getLockedTarget();
|
||||
if(%target)
|
||||
%p.setObjectTarget(%target);
|
||||
else if(%obj.isLocked())
|
||||
%p.setPositionTarget(%obj.getLockedPosition());
|
||||
else
|
||||
%p.setNoTarget();
|
||||
}
|
||||
|
||||
function MissileLauncherImage::onWetFire(%data, %obj, %slot)
|
||||
{
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
MissileSet.add(%p);
|
||||
|
||||
%p.setObjectTarget(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
function MissileBarrelLarge::onFire(%data,%obj,%slot)
|
||||
{
|
||||
%p = Parent::onFire(%data,%obj,%slot);
|
||||
|
||||
if (%obj.getControllingClient())
|
||||
{
|
||||
// a player is controlling the turret
|
||||
%target = %obj.getLockedTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The ai is controlling the turret
|
||||
%target = %obj.getTargetObject();
|
||||
}
|
||||
|
||||
if(%target)
|
||||
%p.setObjectTarget(%target);
|
||||
else if(%obj.isLocked())
|
||||
%p.setPositionTarget(%obj.getLockedPosition());
|
||||
else
|
||||
%p.setNoTarget(); // set as unguided. Only happens when itchy trigger can't wait for lock tone.
|
||||
}
|
||||
|
||||
//add mortars to the "grenade set" so the AI's can avoid them better...
|
||||
function MortarImage::onFire(%data,%obj,%slot)
|
||||
{
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
AIGrenadeThrown(%p);
|
||||
}
|
||||
|
||||
function SniperRifleImage::onFire(%data,%obj,%slot)
|
||||
{
|
||||
if(!%obj.hasEnergyPack)
|
||||
{
|
||||
// siddown Junior, you can't use it
|
||||
serverPlay3D(SniperRifleDryFireSound, %obj.getTransform());
|
||||
return;
|
||||
}
|
||||
|
||||
%pct = %obj.getEnergyLevel() / %obj.getDataBlock().maxEnergy;
|
||||
%p = new (%data.projectileType)() {
|
||||
dataBlock = %data.projectile;
|
||||
initialDirection = %obj.getMuzzleVector(%slot);
|
||||
initialPosition = %obj.getMuzzlePoint(%slot);
|
||||
sourceObject = %obj;
|
||||
damageFactor = %pct * %pct;
|
||||
sourceSlot = %slot;
|
||||
};
|
||||
%p.setEnergyPercentage(%pct);
|
||||
|
||||
%obj.lastProjectile = %p;
|
||||
MissionCleanup.add(%p);
|
||||
serverPlay3D(SniperRifleFireSound, %obj.getTransform());
|
||||
|
||||
// AI hook
|
||||
if(%obj.client)
|
||||
%obj.client.projectile = %p;
|
||||
|
||||
%obj.setEnergyLevel(0);
|
||||
}
|
||||
|
||||
function ElfGunImage::onFire(%data, %obj, %slot)
|
||||
{
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
|
||||
if(!%p.hasTarget())
|
||||
%obj.playAudio(0, ELFFireWetSound);
|
||||
}
|
||||
|
||||
function TargetingLaserImage::onFire(%data,%obj,%slot)
|
||||
{
|
||||
%p = Parent::onFire(%data, %obj, %slot);
|
||||
%p.setTarget(%obj.team);
|
||||
%obj.posLaze = 1;
|
||||
}
|
||||
|
||||
function TargetingLaserImage::deconstruct(%data, %obj, %slot)
|
||||
{
|
||||
%obj.posLaze = 0;
|
||||
Parent::deconstruct(%data, %obj, %slot);
|
||||
}
|
||||
|
||||
function ShockLanceImage::onFire(%this, %obj, %slot)
|
||||
{
|
||||
if( %obj.isCloaked() )
|
||||
{
|
||||
if( %obj.respawnCloakThread !$= "" )
|
||||
{
|
||||
Cancel(%obj.respawnCloakThread);
|
||||
%obj.setCloaked( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( %obj.getEnergyLevel() > 20 )
|
||||
{
|
||||
%obj.setCloaked( false );
|
||||
%obj.reCloak = %obj.schedule( 500, "setCloaked", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%muzzlePos = %obj.getMuzzlePoint(%slot);
|
||||
%muzzleVec = %obj.getMuzzleVector(%slot);
|
||||
|
||||
%endPos = VectorAdd(%muzzlePos, VectorScale(%muzzleVec, %this.projectile.extension));
|
||||
|
||||
%damageMasks = $TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StationObjectType | $TypeMasks::GeneratorObjectType |
|
||||
$TypeMasks::SensorObjectType | $TypeMasks::TurretObjectType;
|
||||
|
||||
%everythingElseMask = $TypeMasks::TerrainObjectType |
|
||||
$TypeMasks::InteriorObjectType |
|
||||
$TypeMasks::ForceFieldObjectType |
|
||||
$TypeMasks::StaticObjectType |
|
||||
$TypeMasks::MoveableObjectType |
|
||||
$TypeMasks::DamagableItemObjectType;
|
||||
|
||||
// did I miss anything? players, vehicles, stations, gens, sensors, turrets
|
||||
%hit = ContainerRayCast(%muzzlePos, %endPos, %damageMasks | %everythingElseMask, %obj);
|
||||
|
||||
%noDisplay = true;
|
||||
|
||||
if (%hit !$= "0")
|
||||
{
|
||||
%obj.setEnergyLevel(%obj.getEnergyLevel() - %this.hitEnergy);
|
||||
|
||||
%hitobj = getWord(%hit, 0);
|
||||
%hitpos = getWord(%hit, 1) @ " " @ getWord(%hit, 2) @ " " @ getWord(%hit, 3);
|
||||
|
||||
if ( %hitObj.getType() & %damageMasks )
|
||||
{
|
||||
%hitobj.applyImpulse(%hitpos, VectorScale(%muzzleVec, %this.projectile.impulse));
|
||||
%obj.playAudio(0, ShockLanceHitSound);
|
||||
|
||||
// This is truly lame, but we need the sourceobject property present...
|
||||
%p = new ShockLanceProjectile() {
|
||||
dataBlock = %this.projectile;
|
||||
initialDirection = %obj.getMuzzleVector(%slot);
|
||||
initialPosition = %obj.getMuzzlePoint(%slot);
|
||||
sourceObject = %obj;
|
||||
sourceSlot = %slot;
|
||||
targetId = %hit;
|
||||
};
|
||||
MissionCleanup.add(%p);
|
||||
|
||||
%damageMultiplier = 1.0;
|
||||
|
||||
if(%hitObj.getDataBlock().getClassName() $= "PlayerData")
|
||||
{
|
||||
// Now we see if we hit from behind...
|
||||
%forwardVec = %hitobj.getForwardVector();
|
||||
%objDir2D = getWord(%forwardVec, 0) @ " " @ getWord(%forwardVec,1) @ " " @ "0.0";
|
||||
%objPos = %hitObj.getPosition();
|
||||
%dif = VectorSub(%objPos, %muzzlePos);
|
||||
%dif = getWord(%dif, 0) @ " " @ getWord(%dif, 1) @ " 0";
|
||||
%dif = VectorNormalize(%dif);
|
||||
%dot = VectorDot(%dif, %objDir2D);
|
||||
|
||||
// 120 Deg angle test...
|
||||
// 1.05 == 60 degrees in radians
|
||||
if (%dot >= mCos(1.05)) {
|
||||
// Rear hit
|
||||
%damageMultiplier = 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
%totalDamage = %this.Projectile.DirectDamage * %damageMultiplier;
|
||||
%hitObj.getDataBlock().damageObject(%hitobj, %p.sourceObject, %hitpos, %totalDamage, $DamageType::ShockLance);
|
||||
|
||||
%noDisplay = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( %noDisplay )
|
||||
{
|
||||
// Miss
|
||||
%obj.setEnergyLevel(%obj.getEnergyLevel() - %this.missEnergy);
|
||||
%obj.playAudio(0, ShockLanceMissSound);
|
||||
|
||||
%p = new ShockLanceProjectile() {
|
||||
dataBlock = %this.projectile;
|
||||
initialDirection = %obj.getMuzzleVector(%slot);
|
||||
initialPosition = %obj.getMuzzlePoint(%slot);
|
||||
sourceObject = %obj;
|
||||
sourceSlot = %slot;
|
||||
};
|
||||
MissionCleanup.add(%p);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$ELFZapSound = 2;
|
||||
$ELFFireSound = 3;
|
||||
|
||||
function ELFProjectileData::zapTarget(%data, %projectile, %target, %targeter)
|
||||
{
|
||||
%oldERate = %target.getRechargeRate();
|
||||
%target.teamDamageStateOnZap = $teamDamage;
|
||||
%teammates = %target.client.team == %targeter.client.team;
|
||||
|
||||
if( %target.teamDamageStateOnZap || !%teammates )
|
||||
%target.setRechargeRate(%oldERate - %data.drainEnergy);
|
||||
else
|
||||
%target.setRechargeRate(%oldERate);
|
||||
|
||||
%projectile.checkELFStatus(%data, %target, %targeter);
|
||||
}
|
||||
|
||||
function ELFProjectileData::unzapTarget(%data, %projectile, %target, %targeter)
|
||||
{
|
||||
cancel(%projectile.ELFrecur);
|
||||
%target.stopAudio($ELFZapSound);
|
||||
%targeter.stopAudio($ELFFireSound);
|
||||
%target.zapSound = false;
|
||||
%targeter.zappingSound = false;
|
||||
%teammates = %target.client.team == %targeter.client.team;
|
||||
|
||||
if(!%target.isDestroyed())
|
||||
{
|
||||
%oldERate = %target.getRechargeRate();
|
||||
if( %target.teamDamageStateOnZap || !%teammates )
|
||||
%target.setRechargeRate(%oldERate + %data.drainEnergy);
|
||||
else
|
||||
%target.setRechargeRate(%oldERate);
|
||||
}
|
||||
}
|
||||
|
||||
function ELFProjectileData::targetDestroyedCancel(%data, %projectile, %target, %targeter)
|
||||
{
|
||||
cancel(%projectile.ELFrecur);
|
||||
%target.stopAudio($ELFZapSound);
|
||||
%targeter.stopAudio($ELFFireSound);
|
||||
%target.zapSound = false;
|
||||
%targeter.zappingSound = false;
|
||||
%projectile.delete();
|
||||
}
|
||||
|
||||
function ELFProjectile::checkELFStatus(%this, %data, %target, %targeter)
|
||||
{
|
||||
if(isObject(%target))
|
||||
{
|
||||
if(%target.getDamageState() $= "Destroyed")
|
||||
{
|
||||
%data.targetDestroyedCancel(%this, %target, %targeter);
|
||||
return;
|
||||
}
|
||||
|
||||
%enLevel = %target.getEnergyLevel();
|
||||
if(%enLevel < 1.0)
|
||||
{
|
||||
%dataBlock = %target.getDataBlock();
|
||||
%dataBlock.damageObject(%target, %this.sourceObject, %target.getPosition(), %data.drainHealth, %data.directDamageType);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
%normal = "0.0 0.0 1.0";
|
||||
%target.playShieldEffect( %normal );
|
||||
}
|
||||
%this.ELFrecur = %this.schedule(32, checkELFStatus, %data, %target, %targeter);
|
||||
|
||||
%targeter.playAudio($ELFFireSound, ELFGunFireSound);
|
||||
if(!%target.zapSound)
|
||||
{
|
||||
%target.playAudio($ELFZapSound, ELFHitTargetSound);
|
||||
%target.zapSound = true;
|
||||
%targeter.zappingSound = true;
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
// z0dd - ZOD, 5/27/02. Stop firing if there is no target,
|
||||
// fixes continuous fire bug.
|
||||
//else if(%targeter.zappingSound)
|
||||
//{
|
||||
// %targeter.stopAudio($ELFFireSound);
|
||||
// %targeter.zappingSound = false;
|
||||
//}
|
||||
else
|
||||
{
|
||||
if(%targeter.zappingSound)
|
||||
{
|
||||
%targeter.stopAudio($ELFFireSound);
|
||||
%targeter.zappingSound = false;
|
||||
}
|
||||
%data.targetDestroyedCancel(%this, %target, %targeter);
|
||||
return;
|
||||
}
|
||||
// End z0dd - ZOD
|
||||
// -------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse, %sourceObject, %damageType)
|
||||
{
|
||||
InitContainerRadiusSearch(%position, %radius, $TypeMasks::PlayerObjectType |
|
||||
$TypeMasks::VehicleObjectType |
|
||||
$TypeMasks::StaticShapeObjectType |
|
||||
$TypeMasks::TurretObjectType |
|
||||
$TypeMasks::ForceFieldObjectType |
|
||||
$TypeMasks::ItemObjectType);
|
||||
|
||||
%numTargets = 0;
|
||||
while ((%targetObject = containerSearchNext()) != 0)
|
||||
{
|
||||
|
||||
if (%targetObject.isRemoved)
|
||||
continue;
|
||||
|
||||
%dist = containerSearchCurrRadDamageDist();
|
||||
|
||||
if (%dist > %radius)
|
||||
continue;
|
||||
|
||||
if (!(%targetObject.getType() & $TypeMasks::ForceFieldObjectType)) {
|
||||
if (%targetObject.isMounted()) {
|
||||
%mount = %targetObject.getObjectMount();
|
||||
%found = -1;
|
||||
for (%i = 0; %i < %mount.getDataBlock().numMountPoints; %i++) {
|
||||
if (%mount.getMountNodeObject(%i) == %targetObject) {
|
||||
%found = %i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (%found != -1) {
|
||||
if (%mount.getDataBlock().isProtectedMountPoint[%found]) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%targets[%numTargets] = %targetObject;
|
||||
%targetDists[%numTargets] = %dist;
|
||||
%numTargets++;
|
||||
}
|
||||
|
||||
for (%i = 0; %i < %numTargets; %i++)
|
||||
{
|
||||
%targetObject = %targets[%i];
|
||||
%dist = %targetDists[%i];
|
||||
|
||||
%coverage = calcExplosionCoverage(%position, %targetObject,
|
||||
($TypeMasks::InteriorObjectType |
|
||||
$TypeMasks::TerrainObjectType |
|
||||
$TypeMasks::ForceFieldObjectType |
|
||||
$TypeMasks::VehicleObjectType));
|
||||
if (%coverage == 1)
|
||||
%coverage = calcBuildingInWay(%position, %targetObject);
|
||||
if (%coverage == 0)
|
||||
continue;
|
||||
|
||||
//if ( $splashTest )
|
||||
%amount = (1.0 - ((%dist / %radius) * 0.88)) * %coverage * %damage;
|
||||
//else
|
||||
//%amount = (1.0 - (%dist / %radius)) * %coverage * %damage;
|
||||
|
||||
//error( "damage: " @ %amount @ " at distance: " @ %dist @ " radius: " @ %radius @ " maxDamage: " @ %damage );
|
||||
|
||||
%data = %targetObject.getDataBlock();
|
||||
%className = %data.className;
|
||||
|
||||
if (%impulse && %data.shouldApplyImpulse(%targetObject))
|
||||
{
|
||||
%p = %targetObject.getWorldBoxCenter();
|
||||
%momVec = VectorSub(%p, %position);
|
||||
%momVec = VectorNormalize(%momVec);
|
||||
%impulseVec = VectorScale(%momVec, %impulse * (1.0 - (%dist / %radius)));
|
||||
%doImpulse = true;
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// z0dd - ZOD, 5/8/02. Removed Wheeled Vehicle to eliminate the flying MPB bug
|
||||
// caused by tossing concussion grenades under a deployed MPB.
|
||||
//else if( %className $= WheeledVehicleData || %className $= FlyingVehicleData || %className $= HoverVehicleData )
|
||||
else if( %className $= FlyingVehicleData || %className $= HoverVehicleData )
|
||||
{
|
||||
%p = %targetObject.getWorldBoxCenter();
|
||||
%momVec = VectorSub(%p, %position);
|
||||
%momVec = VectorNormalize(%momVec);
|
||||
|
||||
%impulseVec = VectorScale(%momVec, %impulse * (1.0 - (%dist / %radius)));
|
||||
|
||||
if( getWord( %momVec, 2 ) < -0.5 )
|
||||
%momVec = "0 0 1";
|
||||
|
||||
// Add obj's velocity into the momentum vector
|
||||
%velocity = %targetObject.getVelocity();
|
||||
//%momVec = VectorNormalize( vectorAdd( %momVec, %velocity) );
|
||||
%doImpulse = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
%momVec = "0 0 1";
|
||||
%doImpulse = false;
|
||||
}
|
||||
|
||||
if(%amount > 0)
|
||||
%data.damageObject(%targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %explosionSource.theClient, %explosionSource);
|
||||
else if( %explosionSource.getDataBlock().getName() $= "ConcussionGrenadeThrown" && %data.getClassName() $= "PlayerData" ) {
|
||||
%data.applyConcussion( %dist, %radius, %sourceObject, %targetObject );
|
||||
if(!$teamDamage && %sourceObject != %targetObject && %sourceObject.client.team == %targetObject.client.team)
|
||||
messageClient(%targetObject.client, 'msgTeamConcussionGrenade', '\c1You were hit by %1\'s concussion grenade.', getTaggedString(%sourceObject.client.name));
|
||||
}
|
||||
|
||||
if(%doImpulse)
|
||||
%targetObject.applyImpulse(%position, %impulseVec);
|
||||
}
|
||||
}
|
||||
|
||||
function ProjectileData::onExplode(%data, %proj, %pos, %mod)
|
||||
{
|
||||
if (%data.hasDamageRadius)
|
||||
RadiusExplosion(%proj, %pos, %data.damageRadius, %data.indirectDamage, %data.kickBackStrength, %proj.sourceObject, %data.radiusDamageType);
|
||||
}
|
||||
|
||||
function Flag::shouldApplyImpulse(%data, %obj)
|
||||
{
|
||||
if(%obj.isHome)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO - update
|
||||
function calcBuildingInWay(%position, %targetObject) {
|
||||
%targetPos = posFromTransform(%targetObject.getWorldBoxCenter());
|
||||
// %vec = vectorNormalize(vectorSub(%position,%targetPos));
|
||||
// %sourcePos = vectorAdd(%position,vectorScale(%vec,0.125));
|
||||
%sourcePos = %position;
|
||||
%mask = $TypeMasks::StaticObjectType;
|
||||
%found = containerRayCast(%sourcePos, %targetPos, %mask);
|
||||
if (%found) {
|
||||
if ((%found.getClassName() $= InteriorInstance) || (%found.getClassName() $= TerrainBlock) || (%found.getClassName() $= TSStatic))
|
||||
return 1;
|
||||
if (%found == %targetObject)
|
||||
return 1;
|
||||
if (%found.getDataBlock().className $= "wall"
|
||||
|| %found.getDataBlock().className $= "wWall"
|
||||
|| %found.getDataBlock().className $= "spine"
|
||||
|| %found.getDataBlock().className $= "mSpine"
|
||||
|| %found.getDataBlock().className $= "floor"
|
||||
|| %found.getDataBlock().className $= "forcefield")
|
||||
return 0;
|
||||
else {
|
||||
%found = containerRayCast(%sourcePos, %targetPos, %mask, %found);
|
||||
if (%found) {
|
||||
if ((%found.getClassName() $= InteriorInstance) || (%found.getClassName() $= TerrainBlock) || (%found.getClassName() $= TSStatic))
|
||||
return 1;
|
||||
if (%found == %targetObject)
|
||||
return 1;
|
||||
if (%found.getDataBlock().className $= "wall"
|
||||
|| %found.getDataBlock().className $= "wWall"
|
||||
|| %found.getDataBlock().className $= "spine"
|
||||
|| %found.getDataBlock().className $= "mSpine"
|
||||
|| %found.getDataBlock().className $= "floor"
|
||||
|| %found.getDataBlock().className $= "forcefield")
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
841
scripts/saveBuilding.cs
Normal file
841
scripts/saveBuilding.cs
Normal file
|
|
@ -0,0 +1,841 @@
|
|||
// SaveBuilding.cs
|
||||
//
|
||||
// This script made possible by a joint effort of DynaBlade and JackTL
|
||||
//
|
||||
// Functions:
|
||||
//
|
||||
// saveBuilding(clientId,radius,file[$],quiet[1/0])
|
||||
// saveBuildingCentered(clientId,radius,file[$],quiet[1/0],centerAtMinZ[1/0])
|
||||
// delBuildingWaypoint()
|
||||
// loadBuilding(file[$])
|
||||
// saveBuildingTimer(time in seconds,globalEcho[1/0],file[$],useMultipleFiles[1/0]) // No limit on multiple files yet. Beware
|
||||
// saveBuildingTimerOn() // <-- for restarting timed saves, does not initialize like saveBuildingTimer()
|
||||
// saveBuildingTimerOff()
|
||||
// delDupPieces(clientId,radius,quiet[1/0]) // NOTE: There are issues with calling this function a second time before the previous call's deconstruction has finished
|
||||
//
|
||||
// See functions for (some) comments
|
||||
|
||||
if ($SaveBuilding::SaveFolder $= "")
|
||||
$SaveBuilding::SaveFolder = "Buildings/";
|
||||
if ($SaveBuilding::AutoSaveFolder $= "")
|
||||
$SaveBuilding::AutoSaveFolder = "Buildings/AutoSave/";
|
||||
if ($SaveBuilding::TimerDefaultTime $= "")
|
||||
$SaveBuilding::TimerDefaultTime = 5 * 60 * 1000; // 5 minutes. Saving may cause stutter on low-end servers with high number of pieces
|
||||
if ($SaveBuilding::QuickDelete $= "")
|
||||
$SaveBuilding::QuickDelete = 1;
|
||||
|
||||
|
||||
// See if we want to save the piece
|
||||
function saveBuildingCheck(%obj) {
|
||||
%save = false;
|
||||
%dataBlockName = %obj.getDatablock().getName();
|
||||
switch$ (%dataBlockName) {
|
||||
case "DeployedSpine":
|
||||
%save = true;
|
||||
case "DeployedWoodSpine":
|
||||
%save = true;
|
||||
case "DeployedMSpine":
|
||||
%save = true;
|
||||
case "DeployedMSpineRing":
|
||||
%save = true;
|
||||
case "DeployedFloor":
|
||||
%save = true;
|
||||
case "DeployedWall":
|
||||
%save = true;
|
||||
case "DeployedwWall":
|
||||
%save = true;
|
||||
case "DeployedEnergizer":
|
||||
%save = true;
|
||||
case "DeployedStationInventory":
|
||||
%save = true;
|
||||
case "DeployedJumpad":
|
||||
%save = true;
|
||||
case "DeployedEscapePod":
|
||||
%save = true;
|
||||
case "TelePadDeployedBase":
|
||||
%save = true;
|
||||
case "TelePadBeam":
|
||||
%save = true;
|
||||
case "DeployedLTarget":
|
||||
%save = true;
|
||||
case "DeployedLogoProjector":
|
||||
%save = true;
|
||||
case "DeployedSwitch":
|
||||
%save = true;
|
||||
case "DeployedPulseSensor":
|
||||
%save = true;
|
||||
case "DeployedMotionSensor":
|
||||
%save = true;
|
||||
case "TurretDeployedBase":
|
||||
%save = true;
|
||||
case "TurretDeployedFloorIndoor":
|
||||
%save = true;
|
||||
case "TurretDeployedWallIndoor":
|
||||
%save = true;
|
||||
case "TurretDeployedCeilingIndoor":
|
||||
%save = true;
|
||||
case "TurretDeployedOutdoor":
|
||||
%save = true;
|
||||
case "LaserDeployed":
|
||||
%save = true;
|
||||
case "MissileRackTurretDeployed":
|
||||
%save = true;
|
||||
case "DiscTurretDeployed":
|
||||
%save = true;
|
||||
case "TurretDeployedCamera":
|
||||
%save = true;
|
||||
case "DeployedLightBase":
|
||||
%save = true;
|
||||
case "DeployedTripwire":
|
||||
%save = true;
|
||||
case "DispenserDep":
|
||||
%save = true;
|
||||
case "AudioDep":
|
||||
%save = true;
|
||||
case "EmitterDep":
|
||||
%save = true;
|
||||
}
|
||||
if (%dataBlockName $= "StationInventory" && %obj.deployed == true)
|
||||
%save = true;
|
||||
if (%dataBlockName $= "GeneratorLarge" && %obj.deployed == true)
|
||||
%save = true;
|
||||
if (%dataBlockName $= "SolarPanel" && %obj.deployed == true)
|
||||
%save = true;
|
||||
if (%dataBlockName $= "SensorMediumPulse" && %obj.deployed == true)
|
||||
%save = true;
|
||||
if (%dataBlockName $= "SensorLargePulse" && %obj.deployed == true)
|
||||
%save = true;
|
||||
if (getSubStr(%dataBlockName,0,18) $= "DeployedForceField")
|
||||
%save = true;
|
||||
if (getSubStr(%dataBlockName,0,20) $= "DeployedGravityField")
|
||||
%save = true;
|
||||
if (getSubStr(%dataBlockName,0,12) $= "DeployedTree")
|
||||
%save = true;
|
||||
if (getSubStr(%dataBlockName,0,13) $= "DeployedCrate")
|
||||
%save = true;
|
||||
if (getSubStr(%dataBlockName,0,18) $= "DeployedDecoration")
|
||||
%save = true;
|
||||
return %save;
|
||||
}
|
||||
|
||||
// This function saves a building and its position in the map
|
||||
function saveBuilding(%cl,%rad,%file,%quiet,%isAutoSave) {
|
||||
if (%quiet == true) {
|
||||
$SaveBuilding::Quiet = true;
|
||||
}
|
||||
else {
|
||||
$SaveBuilding::Quiet = false; // Overwrite
|
||||
}
|
||||
%origCl = %cl;
|
||||
if (!isObject(%cl)) {
|
||||
if (isObject(nameToID(LocalClientConnection))) {
|
||||
%cl = nameToID(LocalClientConnection);
|
||||
}
|
||||
else {
|
||||
if ($CurrentClientId) {
|
||||
%cl = $CurrentClientId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%rad < 1) {
|
||||
%rad = 100000;
|
||||
}
|
||||
%buildingCount = 0;
|
||||
if (%file $= "" || %file $= "0") {
|
||||
for(%found = true; %found; %buildingCount++ ) {
|
||||
%suffix = %buildingCount;
|
||||
while (strLen(%suffix) < 5) %suffix = "0" @ %suffix;
|
||||
if (%isAutoSave)
|
||||
%file = $SaveBuilding::AutoSaveFolder @ $MissionName @ "-" @ %suffix @ ".cs";
|
||||
else
|
||||
%file = $SaveBuilding::SaveFolder @ %cl.nameBase @ "-" @ $MissionName @ "-" @ %suffix @ ".cs";
|
||||
%found = isFile(%file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (%isAutoSave)
|
||||
%file = $SaveBuilding::AutoSaveFolder @ %file;
|
||||
else
|
||||
%file = $SaveBuilding::SaveFolder @ %file;
|
||||
}
|
||||
if (isObject(%cl.getControlObject())) {
|
||||
%pos = %cl.getControlObject().getPosition();
|
||||
}
|
||||
if (!%pos) {
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
if (%isAutoSave && (%origCl $= "" || %origCl $= "0"))
|
||||
%pos = "0 0 0";
|
||||
new fileObject("Building");
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
warn("Saving to file: \"" @ %file @ "\"");
|
||||
}
|
||||
Building.openForWrite(%file);
|
||||
Building.writeLine("// CONSTRUCTION MOD SAVE FILE");
|
||||
Building.writeLine("// Saved by \"" @ getField(%cl.nameBase,0) @ "\"");
|
||||
Building.writeLine("// Created in mission \"" @ $MissionName @ "\"");
|
||||
Building.writeLine("// Construction " @ $ModVersion);
|
||||
Building.writeLine("");
|
||||
|
||||
$SaveBuilding::Saved = 0;
|
||||
$SaveBuilding::Skipped = 0;
|
||||
initContainerRadiusSearch(%pos,%rad,$TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType);
|
||||
while((%obj = containerSearchNext()) != 0) {
|
||||
%cmp = writeBuildingComponent(%obj);
|
||||
if (%cmp !$= "") {
|
||||
Building.writeLine(%cmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
warn("Saved to file: \"" @ %file @ "\"");
|
||||
warn("Saved pieces: " @ $SaveBuilding::Saved);
|
||||
warn("Skipped pieces: " @ $SaveBuilding::Skipped);
|
||||
}
|
||||
|
||||
$SaveBuilding::LastFile = %file;
|
||||
|
||||
Building.close();
|
||||
Building.delete();
|
||||
return %file;
|
||||
}
|
||||
|
||||
function writeBuildingComponent(%obj) {
|
||||
%dataBlockName = %obj.getDatablock().getName();
|
||||
%save = false;
|
||||
%save = saveBuildingCheck(%obj);
|
||||
if (%save == true) {
|
||||
if (%dataBlockName $= "DeployedMSpineRing") // Handled by DeployedMSpine
|
||||
return;
|
||||
if (%dataBlockName $= "TelePadBeam") // Handled by TelePadDeployedBase
|
||||
return;
|
||||
if (%dataBlockName $= "DeployedLTarget") // Handled by parent object
|
||||
return;
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
%buildingPiece = "%building = new (" @ %obj.getClassName() @ ") () {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %dataBlockName @ "\";";
|
||||
if (%obj.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %obj.position @ "\";";
|
||||
if (%obj.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %obj.rotation @ "\";";
|
||||
if (%obj.realScale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %obj.realScale @ "\";";
|
||||
else {if (%obj.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %obj.scale @ "\";";}
|
||||
if (%obj.team !$= "") %buildingPiece = %buildingPiece @ "team = \"" @ %obj.team @ "\";";
|
||||
if (%obj.ownerGUID !$= "") %buildingPiece = %buildingPiece @ "ownerGUID = \"" @ %obj.ownerGUID @ "\";";
|
||||
if (%obj.needsFit) %buildingPiece = %buildingPiece @ "needsfit = \"" @ %obj.needsFit @ "\";";
|
||||
if (%obj.grounded) %buildingPiece = %buildingPiece @ "grounded = \"" @ %obj.grounded @ "\";";
|
||||
if (%obj.deployed !$= "") %buildingPiece = %buildingPiece @ "deployed = \"" @ %obj.deployed @ "\";";
|
||||
if (%obj.impulse !$= "") %buildingPiece = %buildingPiece @ "impulse = \"" @ %obj.impulse @ "\";";
|
||||
if (%obj.velocityMod !$= "") %buildingPiece = %buildingPiece @ "velocityMod = \"" @ %obj.velocityMod @ "\";";
|
||||
if (%obj.gravityMod !$= "") %buildingPiece = %buildingPiece @ "gravityMod = \"" @ %obj.gravityMod @ "\";";
|
||||
if (%obj.appliedForce !$= "") %buildingPiece = %buildingPiece @ "appliedForce = \"" @ %obj.appliedForce @ "\";";
|
||||
if (%obj.powerFreq !$= "") %buildingPiece = %buildingPiece @ "powerFreq = \"" @ %obj.powerFreq @ "\";";
|
||||
if (%obj.isSwitchedOff !$= "") %buildingPiece = %buildingPiece @ "isSwitchedOff = \"" @ %obj.isSwitchedOff @ "\";";
|
||||
if (%obj.switchRadius !$= "") %buildingPiece = %buildingPiece @ "switchRadius = \"" @ %obj.switchRadius @ "\";";
|
||||
if (%obj.holoBlock !$= "") %buildingPiece = %buildingPiece @ "holoBlock = \"" @ %obj.holoBlock @ "\";";
|
||||
if (%obj.noSlow !$= "") %buildingPiece = %buildingPiece @ "noSlow = \"" @ %obj.noSlow @ "\";";
|
||||
if (%obj.static !$= "") %buildingPiece = %buildingPiece @ "static = \"" @ %obj.static @ "\";";
|
||||
if (%obj.timed !$= "") %buildingPiece = %buildingPiece @ "timed = \"" @ %obj.timed @ "\";";
|
||||
if (%obj.beamRange !$= "") %buildingPiece = %buildingPiece @ "beamRange = \"" @ %obj.beamRange @ "\";";
|
||||
if (%obj.tripMode !$= "") %buildingPiece = %buildingPiece @ "tripMode = \"" @ %obj.tripMode @ "\";";
|
||||
if (%obj.fieldMode !$= "") %buildingPiece = %buildingPiece @ "fieldMode = \"" @ %obj.fieldMode @ "\";";
|
||||
if (%dataBlockName $= "TelePadDeployedBase") {
|
||||
if (%obj.frequency !$= "") %buildingPiece = %buildingPiece @ "frequency = \"" @ %obj.frequency @ "\";";
|
||||
if (%obj.teleMode !$= "") %buildingPiece = %buildingPiece @ "teleMode = \"" @ %obj.teleMode @ "\";";
|
||||
}
|
||||
if (%obj.getType() & $TypeMasks::TurretObjectType) {
|
||||
if (%obj.isSeeker !$= "") %buildingPiece = %buildingPiece @ "isSeeker = \"" @ %obj.isSeeker @ "\";";
|
||||
%barrel = %obj.getMountedImage(0);
|
||||
if (%barrel > 0)
|
||||
%buildingPiece = %buildingPiece @ "initialBarrel = \"" @ %barrel.getName() @ "\";";
|
||||
}
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
if (%obj.getTarget() != -1) %buildingPiece = %buildingPiece @ "setTargetSensorGroup(%building.getTarget()," @ mAbs(%obj.team) @ ");";
|
||||
%buildingPiece = %buildingPiece @ "addToDeployGroup(%building);";
|
||||
if (%obj.noSlow !$= "") %buildingPiece = %buildingPiece @ "%building.pzone.delete();%building.pzone = \"\";";
|
||||
if (%dataBlockName $= "DeployedEnergizer" || %dataBlockName $= "DeployedStationInventory" || %dataBlockName $= "StationInventory"
|
||||
|| %dataBlockName $= "TurretDeployedFloorIndoor" || %dataBlockName $= "TurretDeployedWallIndoor" || %dataBlockName $= "TurretDeployedCeilingIndoor"
|
||||
|| %dataBlockName $= "TurretDeployedOutdoor" || %dataBlockName $= "DeployedPulseSensor"
|
||||
|| %dataBlockName $= "LaserDeployed" || %dataBlockName $= "MissileRackTurretDeployed" || %dataBlockName $= "DiscTurretDeployed") {
|
||||
%buildingPiece = %buildingPiece @ "%building.deploy();";
|
||||
if (%dataBlockName $= "StationInventory")
|
||||
%buildingPiece = %buildingPiece @ "adjustTrigger(%building);";
|
||||
}
|
||||
if (%obj.getDatablock().rechargeRate > 0 && !%obj.getDatablock().needsPower) %buildingPiece = %buildingPiece @ "%building.setSelfPowered();";
|
||||
if (%obj.getType() & $TypeMasks::TurretObjectType)
|
||||
%buildingPiece = %buildingPiece @ "%building.setRechargeRate(%building.getDatablock().rechargeRate);";
|
||||
if (%obj.getDataBlock().className $= "Generator" || %obj.getDataBlock().className $= "Switch") {
|
||||
if (%obj.isSwitchedOff)
|
||||
%buildingPiece = %buildingPiece @ "setTargetName(%building.target,addTaggedString(\"Disabled Frequency\" SPC %building.powerFreq));";
|
||||
else
|
||||
%buildingPiece = %buildingPiece @ "setTargetName(%building.target,addTaggedString(\"Frequency\" SPC %building.powerFreq));";
|
||||
if (%dataBlockName $= "DeployedSwitch")
|
||||
%buildingPiece = %buildingPiece @ "setTargetSkin(%building.target,'" @ getTaggedString(getTargetSkin(%obj.target)) @ "');";
|
||||
if (!%obj.isSwitchedOff)
|
||||
%buildingPiece = %buildingPiece @ "%building.playThread($AmbientThread,\"ambient\");";
|
||||
else {
|
||||
if (%obj.isSwitchedOff)
|
||||
// nb: doubles no. of power switches done, when loading switched off gens
|
||||
%buildingPiece = %buildingPiece @ "%building.lastState = \"\";%building.getDataBlock().losePower(%building);";
|
||||
}
|
||||
}
|
||||
$SaveBuilding::Saved++;
|
||||
// Ugly, but it works. May be cleaned up later.
|
||||
if (isObject(%obj.lTarget)) { // We assume none of the later saved sub-objects need decon targets, could make this a subroutine
|
||||
%target = %obj.lTarget;
|
||||
%targetDataBlock = %target.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %target @ " Name: " @ %targetDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%target = new StaticShape() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %targetDataBlock @ "\";";
|
||||
if (%target.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %target.position @ "\";";
|
||||
if (%target.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %target.rotation @ "\";";
|
||||
if (%target.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %target.scale @ "\";";
|
||||
if (%target.team) %buildingPiece = %buildingPiece @ "team = \"" @ %target.team @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "lMain = %building;";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.lTarget = %target;";
|
||||
%buildingPiece = %buildingPiece @ "addToDeployGroup(%target);";
|
||||
if (%target.getDatablock().rechargeRate > 0 && !%target.getDatablock().needsPower) %buildingPiece = %buildingPiece @ "%building.setSelfPowered();";
|
||||
}
|
||||
if (%dataBlockName $= "DeployedMSpine") {
|
||||
%left = %obj.left;
|
||||
%right = %obj.right;
|
||||
if (isObject(%left)) {
|
||||
%leftDataBlock = %left.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %left @ " Name: " @ %leftDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%left = new StaticShape() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %leftDataBlock @ "\";";
|
||||
if (%left.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %left.position @ "\";";
|
||||
if (%left.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %left.rotation @ "\";";
|
||||
if (%left.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %left.scale @ "\";";
|
||||
if (%left.team) %buildingPiece = %buildingPiece @ "team = \"" @ %left.team @ "\";";
|
||||
if (%left.needsFit) %buildingPiece = %buildingPiece @ "needsfit = \"" @ %left.needsFit @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.left = %left;";
|
||||
%buildingPiece = %buildingPiece @ "addToDeployGroup(%left);";
|
||||
if (%left.getDatablock().rechargeRate > 0 && !%left.getDatablock().needsPower) %buildingPiece = %buildingPiece @ "%building.setSelfPowered();";
|
||||
$SaveBuilding::Saved++;
|
||||
}
|
||||
if (isObject(%right)) {
|
||||
%rightDataBlock = %right.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %right @ " Name: " @ %rightDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%right = new StaticShape() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %rightDataBlock @ "\";";
|
||||
if (%right.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %right.position @ "\";";
|
||||
if (%right.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %right.rotation @ "\";";
|
||||
if (%right.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %right.scale @ "\";";
|
||||
if (%right.team) %buildingPiece = %buildingPiece @ "team = \"" @ %right.team @ "\";";
|
||||
if (%right.needsFit) %buildingPiece = %buildingPiece @ "needsfit = \"" @ %right.needsFit @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.right = %right;";
|
||||
%buildingPiece = %buildingPiece @ "addToDeployGroup(%right);";
|
||||
if (%right.getDatablock().rechargeRate > 0 && !%right.getDatablock().needsPower) %buildingPiece = %buildingPiece @ "%building.setSelfPowered();";
|
||||
$SaveBuilding::Saved++;
|
||||
}
|
||||
}
|
||||
else if (%dataBlockName $= "TelePadDeployedBase") {
|
||||
%beam = %obj.beam;
|
||||
if (isObject(%beam)) {
|
||||
%beamDataBlock = %beam.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %beam @ " Name: " @ %beamDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%beam = new StaticShape() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %beamDataBlock @ "\";";
|
||||
if (%beam.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %beam.position @ "\";";
|
||||
if (%beam.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %beam.rotation @ "\";";
|
||||
if (%beam.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %beam.scale @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.beam = %beam;";
|
||||
%buildingPiece = %buildingPiece @ "%beam.playThread(0,\"ambient\");";
|
||||
%buildingPiece = %buildingPiece @ "%beam.setThreadDir(0,true);";
|
||||
%buildingPiece = %buildingPiece @ "%beam.flashThreadDir = true;";
|
||||
%buildingPiece = %buildingPiece @ "setTargetName(%building.target,addTaggedString(\"Frequency\" SPC %building.frequency));";
|
||||
}
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedLogoProjector") {
|
||||
%holo = %obj.holo;
|
||||
if (isObject(%holo)) {
|
||||
%holoDataBlock = %holo.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %holo @ " Name: " @ %holoDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%holo = new StaticShape() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %holoDataBlock @ "\";";
|
||||
if (%holo.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %holo.position @ "\";";
|
||||
if (%holo.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %holo.rotation @ "\";";
|
||||
if (%holo.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %holo.scale @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.holo = %holo;";
|
||||
%buildingPiece = %buildingPiece @ "%holo.projector = %building;";
|
||||
}
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedLightBase") {
|
||||
%light = %obj.light;
|
||||
if (isObject(%light)) {
|
||||
%lightDataBlock = %light.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %light @ " Name: " @ %lightDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%light = new Item() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %lightDataBlock @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "static = true;";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.light = %light;";
|
||||
%buildingPiece = %buildingPiece @ "%light.lightBase = %building;";
|
||||
%buildingPiece = %buildingPiece @ "adjustLight(%building);";
|
||||
}
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedTripwire") {
|
||||
%tripField = %obj.tripField;
|
||||
if (isObject(%tripField)) {
|
||||
%tripFieldDataBlock = %tripField.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %tripField @ " Name: " @ %tripFieldDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%tripField = new ForceFieldBare() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %tripFieldDataBlock @ "\";";
|
||||
if (%tripField.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %tripField.scale @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.tripField = %tripField;";
|
||||
%buildingPiece = %buildingPiece @ "%tripField.pzone.delete();%building.pzone = \"\";";
|
||||
}
|
||||
%tripTrigger = %obj.tripTrigger;
|
||||
if (isObject(%tripTrigger)) {
|
||||
%tripTriggerDataBlock = %tripTrigger.getDatablock().getName();
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %tripTrigger @ " Name: " @ %tripTriggerDataBlock);
|
||||
%buildingPiece = %buildingPiece @ "%tripTrigger = new Trigger() {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %tripTriggerDataBlock @ "\";";
|
||||
if (%tripTrigger.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %tripTrigger.scale @ "\";";
|
||||
if (%tripTrigger.polyhedron !$= "") %buildingPiece = %buildingPiece @ "polyhedron = \"" @ %tripTrigger.polyhedron @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
%buildingPiece = %buildingPiece @ "%building.tripTrigger = %tripTrigger;";
|
||||
%buildingPiece = %buildingPiece @ "%tripTrigger.baseObj = %building;";
|
||||
}
|
||||
%buildingPiece = %buildingPiece @ "setTargetName(%building.target,addTaggedString(\"Frequency\" SPC %building.powerFreq));";
|
||||
%buildingPiece = %buildingPiece @ "%building.deploy();";
|
||||
%buildingPiece = %buildingPiece @ "adjustTripwire(%building);";
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedEscapePod") {
|
||||
%buildingPiece = %buildingPiece @ "adjustEscapePod(%building);";
|
||||
%buildingPiece = %buildingPiece @ "escapePodLoop(%building);";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
// warn("Skipping: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
}
|
||||
%buildingPiece = "";
|
||||
$SaveBuilding::Skipped++;
|
||||
}
|
||||
|
||||
return %buildingPiece;
|
||||
}
|
||||
|
||||
// This function saves a building and relocates it to the center of the 'map'
|
||||
// Optional switch to put center at lowest part of building
|
||||
//
|
||||
// NB: Position of objects (such as support beams) is their attachment point,
|
||||
// not their actual center. This may give some 'strange' results when centering
|
||||
// small buildings
|
||||
|
||||
function saveBuildingCentered(%cl,%rad,%file,%quiet,%centerAtMinZ) {
|
||||
if (%quiet == true) {
|
||||
$SaveBuilding::Quiet = true;
|
||||
}
|
||||
else {
|
||||
$SaveBuilding::Quiet = false; // Overwrite
|
||||
}
|
||||
if (!isObject(%cl)) {
|
||||
if (isObject(nameToID(LocalClientConnection))) {
|
||||
%cl = nameToID(LocalClientConnection);
|
||||
}
|
||||
else {
|
||||
if ($CurrentClientId) {
|
||||
%cl = $CurrentClientId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%rad < 1) {
|
||||
%rad = 100000;
|
||||
}
|
||||
%buildingCount = 0;
|
||||
if (%file $= "") {
|
||||
for(%found = true; %found; %buildingCount++ ) {
|
||||
%suffix = %buildingCount;
|
||||
while (strLen(%suffix) < 5) %suffix = "0" @ %suffix;
|
||||
%file = $SaveBuilding::SaveFolder @ %cl.nameBase @ "-" @ $MissionName @ "-" @ %suffix @ ".cs";
|
||||
%found = isFile(%file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
%file = $SaveBuilding::SaveFolder @ %file;
|
||||
}
|
||||
|
||||
if (isObject(%cl.getControlObject())) {
|
||||
%pos = %cl.getControlObject().getPosition();
|
||||
}
|
||||
if (!%pos) {
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
new fileObject("Building");
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
warn("Saving to file: \"" @ %file @ "\"");
|
||||
}
|
||||
Building.openForWrite(%file);
|
||||
Building.writeLine("// CONSTRUCTION MOD SAVE FILE");
|
||||
Building.writeLine("// This building was saved by \"" @ getField(%cl.nameBase,0) @ "\"");
|
||||
Building.writeLine("// This building was created in mission \"" @ $MissionName @ "\"");
|
||||
Building.writeLine("");
|
||||
|
||||
$SaveBuilding::Saved = 0;
|
||||
$SaveBuilding::Skipped = 0;
|
||||
$SaveBuilding::MaxX = 0;
|
||||
$SaveBuilding::MaxY = 0;
|
||||
$SaveBuilding::MaxZ = 0;
|
||||
$SaveBuilding::MinX = 0;
|
||||
$SaveBuilding::MinY = 0;
|
||||
$SaveBuilding::MinZ = 0;
|
||||
|
||||
%firstObj = true;
|
||||
initContainerRadiusSearch(%pos,%rad,$TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType);
|
||||
while((%obj = containerSearchNext()) != 0) {
|
||||
%compPos = checkBuildingComponentCentered(%obj);
|
||||
if (%compPos) {
|
||||
%x = getWord(%compPos,0);
|
||||
%y = getWord(%compPos,1);
|
||||
%z = getWord(%compPos,2);
|
||||
if (%x > $SaveBuilding::MaxX || %firstObj) {$SaveBuilding::MaxX = %x;}
|
||||
if (%y > $SaveBuilding::MaxY || %firstObj) {$SaveBuilding::MaxY = %y;}
|
||||
if (%z > $SaveBuilding::MaxZ || %firstObj) {$SaveBuilding::MaxZ = %z;}
|
||||
if (%x < $SaveBuilding::MinX || %firstObj) {$SaveBuilding::MinX = %x;}
|
||||
if (%y < $SaveBuilding::MinY || %firstObj) {$SaveBuilding::MinY = %y;}
|
||||
if (%z < $SaveBuilding::MinZ || %firstObj) {$SaveBuilding::MinZ = %z;}
|
||||
%firstObj = false;
|
||||
}
|
||||
}
|
||||
|
||||
$SaveBuilding::SizeX = $SaveBuilding::MaxX - $SaveBuilding::MinX;
|
||||
$SaveBuilding::SizeY = $SaveBuilding::MaxY - $SaveBuilding::MinY;
|
||||
$SaveBuilding::SizeZ = $SaveBuilding::MaxZ - $SaveBuilding::MinZ;
|
||||
|
||||
$SaveBuilding::CenterX = $SaveBuilding::MinX + ($SaveBuilding::SizeX / 2);
|
||||
$SaveBuilding::CenterY = $SaveBuilding::MinY + ($SaveBuilding::SizeY / 2);
|
||||
if (!%centerAtMinZ) {$SaveBuilding::CenterZ = $SaveBuilding::MinZ + ($SaveBuilding::SizeZ / 2);}
|
||||
else {$SaveBuilding::CenterZ = $SaveBuilding::MinZ;}
|
||||
|
||||
if (isObject($SaveBuilding::TestWaypoint))
|
||||
$SaveBuilding::TestWaypoint.delete();
|
||||
$SaveBuilding::TestWaypoint = new WayPoint(SaveBuildingWaypoint) {
|
||||
position = $SaveBuilding::CenterX SPC $SaveBuilding::CenterY SPC $SaveBuilding::CenterZ;
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
dataBlock = "WayPointMarker";
|
||||
team = 0;
|
||||
name = "Saved Building Center";
|
||||
};
|
||||
MissionCleanup.add($SaveBuilding::TestWaypoint);
|
||||
|
||||
initContainerRadiusSearch(%pos,%rad,$TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType);
|
||||
while((%obj = containerSearchNext()) != 0) {
|
||||
%cmp = writeBuildingComponentCentered(%obj);
|
||||
if (%cmp !$= "") {
|
||||
Building.writeLine(%cmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
warn("Saved to file: \"" @ %file @ "\"");
|
||||
warn("Saved pieces: " @ $SaveBuilding::Saved);
|
||||
warn("Skipped pieces: " @ $SaveBuilding::Skipped);
|
||||
}
|
||||
|
||||
$SaveBuilding::LastFile = %file;
|
||||
|
||||
Building.close();
|
||||
Building.delete();
|
||||
return %file;
|
||||
}
|
||||
|
||||
function checkBuildingComponentCentered(%obj) {
|
||||
%save = false;
|
||||
%save = saveBuildingCheck(%obj);
|
||||
if (%save == true) {
|
||||
%pos = %obj.position;
|
||||
%x = getWord(%pos,0);
|
||||
%y = getWord(%pos,1);
|
||||
%z = getWord(%pos,2);
|
||||
%obj.saveBuilding = true;
|
||||
return %x SPC %y SPC %z;
|
||||
}
|
||||
else {
|
||||
%obj.saveBuilding = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function writeBuildingComponentCentered(%obj) {
|
||||
%dataBlockName = %obj.getDatablock().getName();
|
||||
%save = false;
|
||||
%save = saveBuildingCheck(%obj);
|
||||
if (%save == true) {
|
||||
if (!$SaveBuilding::Quiet)
|
||||
echo("Saving: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
%buildingPiece = "%building = new (" @ %obj.getClassName() @ ") () {";
|
||||
%buildingPiece = %buildingPiece @ "datablock = \"" @ %dataBlockName @ "\";";
|
||||
%pos = %obj.position;
|
||||
%x = getWord(%pos,0)-$SaveBuilding::CenterX;
|
||||
%y = getWord(%pos,1)-$SaveBuilding::CenterY;
|
||||
%z = getWord(%pos,2)-$SaveBuilding::CenterZ;
|
||||
%savePos = %x SPC %y SPC %z;
|
||||
if (%obj.position !$= "") %buildingPiece = %buildingPiece @ "position = \"" @ %savePos @ "\";";
|
||||
if (%obj.rotation !$= "") %buildingPiece = %buildingPiece @ "rotation = \"" @ %obj.rotation @ "\";";
|
||||
if (%obj.realScale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %obj.realScale @ "\";";
|
||||
else {if (%obj.scale !$= "") %buildingPiece = %buildingPiece @ "scale = \"" @ %obj.scale @ "\";";}
|
||||
if (%obj.impulse !$= "") %buildingPiece = %buildingPiece @ "impulse = \"" @ %obj.impulse @ "\";";
|
||||
if (%obj.frequency !$= "") %buildingPiece = %buildingPiece @ "frequency = \"" @ %obj.frequency @ "\";";
|
||||
%buildingPiece = %buildingPiece @ "};";
|
||||
$SaveBuilding::Saved++;
|
||||
}
|
||||
else {
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
// warn("Skipping: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
}
|
||||
%buildingPiece = "";
|
||||
$SaveBuilding::Skipped++;
|
||||
}
|
||||
|
||||
return %buildingPiece;
|
||||
}
|
||||
|
||||
function delBuildingWaypoint() {
|
||||
if (isObject($SaveBuilding::TestWaypoint))
|
||||
$SaveBuilding::TestWaypoint.delete();
|
||||
}
|
||||
|
||||
function loadBuilding(%file) {
|
||||
compile($SaveBuilding::SaveFolder @ %file); // Just in case it bombs out
|
||||
exec($SaveBuilding::SaveFolder @ %file);
|
||||
}
|
||||
|
||||
function saveBuildingTimer(%timeInSeconds,%globalEcho,%file,%useMultipleFiles,%isScheduled,%threadCount) {
|
||||
if (!%isScheduled) {
|
||||
$SaveBuilding::TimerCount++;
|
||||
$SaveBuilding::TimerTime = %timeInSeconds * 1000;
|
||||
if ($SaveBuilding::TimerTime < 1)
|
||||
$SaveBuilding::TimerTime = $SaveBuilding::TimerDefaultTime;
|
||||
$SaveBuilding::TimerFile = %file;
|
||||
if ($SaveBuilding::TimerFile $= "" || $SaveBuilding::TimerFile $= "0")
|
||||
$SaveBuilding::TimerFile = "SaveBuildingTimer.cs";
|
||||
if (%useMultipleFiles)
|
||||
$SaveBuilding::TimerFile = "";
|
||||
$SaveBuilding::TimerGlobalChatEcho = %globalEcho;
|
||||
$SaveBuilding::TimerEnabled = true;
|
||||
%threadCount = $SaveBuilding::TimerCount;
|
||||
}
|
||||
if ($SaveBuilding::TimerEnabled == true && $SaveBuilding::TimerCount == %threadCount && isObject("MissionCleanup/Deployables")) {
|
||||
%file = saveBuilding(0,0,$SaveBuilding::TimerFile,true,true);
|
||||
%timeToNextSave = mFloatLength($SaveBuilding::TimerTime / 60 / 1000,2);
|
||||
%timeToNextSaveMinutes = mFloor(%timeToNextSave);
|
||||
%timeToNextSaveSeconds = mFloor((%timeToNextSave - %timeToNextSaveMinutes) * 60);
|
||||
%timeToNextSave = %timeToNextSaveMinutes @ "m, " @ %timeToNextSaveSeconds @ "s";
|
||||
%filespec = "\"" @ %file @ "\"";
|
||||
if ($SaveBuilding::TimerFile $= "")
|
||||
%filespec = %filespec @ " (using multiple files)";
|
||||
warn("-SaveBuildingTimer- Saved to: " @ %filespec @ " - Timer: " @ %timeToNextSave);
|
||||
if ($SaveBuilding::TimerGlobalChatEcho)
|
||||
MessageAll('msgClient',"\c2Buildings saved. Next save in " @ %timeToNextSave);
|
||||
if ($SaveBuilding::TimerTime > 0) // Extra safety
|
||||
schedule($SaveBuilding::TimerTime,0,saveBuildingTimer,0,0,0,0,true,%threadCount);
|
||||
}
|
||||
else {
|
||||
warn("-SaveBuildingTimer- Thread " @ %threadCount @ " disabled. Last active thread: " @ $SaveBuilding::TimerCount);
|
||||
}
|
||||
}
|
||||
|
||||
// NB: This function does not setup default parameters
|
||||
function saveBuildingTimerOn() {
|
||||
if ($SaveBuilding::TimerTime < 1) {
|
||||
$SaveBuilding::TimerTime = $SaveBuilding::TimerDefaultTime;
|
||||
}
|
||||
$SaveBuilding::TimerCount++;
|
||||
$SaveBuilding::TimerEnabled = true;
|
||||
saveBuildingTimer(0,0,0,0,true,$SaveBuilding::TimerCount);
|
||||
}
|
||||
|
||||
function saveBuildingTimerOff() {
|
||||
$SaveBuilding::TimerEnabled = false;
|
||||
}
|
||||
|
||||
function delDupPieces(%cl,%rad,%quiet) {
|
||||
%randomTime = 10000;
|
||||
if (%quiet == true) {
|
||||
$SaveBuilding::Quiet = true;
|
||||
}
|
||||
else {
|
||||
$SaveBuilding::Quiet = false; // Overwrite
|
||||
}
|
||||
if (!isObject(%cl)) {
|
||||
if (isObject(nameToID(LocalClientConnection))) {
|
||||
%cl = nameToID(LocalClientConnection);
|
||||
}
|
||||
else {
|
||||
if ($CurrentClientId) {
|
||||
%cl = $CurrentClientId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%rad < 1) {
|
||||
%rad = 100000;
|
||||
}
|
||||
if (isObject(%cl.getControlObject())) {
|
||||
%pos = %cl.getControlObject().getPosition();
|
||||
}
|
||||
if (!%pos) {
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
%oldChk = "";
|
||||
initContainerRadiusSearch(%pos,%rad,$TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::ItemObjectType);
|
||||
while((%obj = containerSearchNext()) != 0) {
|
||||
%dataBlockName = %obj.getDatablock().getName();
|
||||
%save = saveBuildingCheck(%obj);
|
||||
if (%save) {
|
||||
// Round down a bit
|
||||
%objPos = mFloatLength(getWord(%obj.getPosition(),0),2) SPC mFloatLength(getWord(%obj.getPosition(),1),2) SPC mFloatLength(getWord(%obj.getPosition(),2),2);
|
||||
%objRot = mFloatLength(getWord(%obj.rotation,0),2) SPC mFloatLength(getWord(%obj.rotation,1),2) SPC mFloatLength(getWord(%obj.rotation,2),2) SPC mFloatLength(getWord(%obj.rotation,3),2);
|
||||
if (%obj.realScale)
|
||||
%objScale = %obj.realScale;
|
||||
else
|
||||
%objScale = %obj.scale;
|
||||
if (%dataBlockName $= "DeployedFloor" || %dataBlockName $= "DeployedwWall")
|
||||
// This doesn't handle all wWalls, but it helps
|
||||
%chk = %dataBlockName SPC %objPos SPC %objScale;
|
||||
else
|
||||
%chk = %dataBlockName SPC %objPos SPC %objRot SPC %objScale;
|
||||
if (%chk $= %oldChk) {
|
||||
%deleted++;
|
||||
if (!$SaveBuilding::Quiet && %dataBlockName !$= "DeployedMSpineRing")
|
||||
warn("Deleting: " @ %oldObj @ " Name: " @ %dataBlockName);
|
||||
// from inventoryHud.cs, modified
|
||||
%random = getRandom() * %randomTime;
|
||||
// Not the best way of doing this..
|
||||
if ($SaveBuilding::QuickDelete == true) {
|
||||
// Handle special cases
|
||||
if (%dataBlockName $= "DeployedMSpine") {
|
||||
if (isObject(%oldObj.left)) {
|
||||
if (!$SaveBuilding::Quiet)
|
||||
warn("Deleting: " @ %oldObj.left @ " Name: " @ %oldObj.left.getDatablock().getName());
|
||||
%deleted++;
|
||||
remDSurface(%oldObj.left);
|
||||
%oldObj.left.delete();
|
||||
}
|
||||
if (isObject(%oldObj.right)) {
|
||||
if (!$SaveBuilding::Quiet)
|
||||
warn("Deleting: " @ %oldObj.right @ " Name: " @ %oldObj.right.getDatablock().getName());
|
||||
%deleted++;
|
||||
remDSurface(%oldObj.right);
|
||||
%oldObj.right.delete();
|
||||
}
|
||||
remDSurface(%oldObj);
|
||||
%oldObj.delete();
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedEscapePod") {
|
||||
if (isObject(%oldObj.lTarget)) {
|
||||
if (!$SaveBuilding::Quiet)
|
||||
warn("Deleting: " @ %oldObj.lTarget @ " Name: " @ %oldObj.lTarget.getDatablock().getName());
|
||||
%deleted++;
|
||||
remDSurface(%oldObj.lTarget);
|
||||
%oldObj.lTarget.delete();
|
||||
}
|
||||
if (isObject(%oldObj.podVehicle)) {
|
||||
if (!$SaveBuilding::Quiet)
|
||||
warn("Deleting: " @ %oldObj.podVehicle @ " Name: " @ %oldObj.podVehicle.getDatablock().getName());
|
||||
%deleted++;
|
||||
%oldObj.podVehicle.delete();
|
||||
}
|
||||
%oldObj.delete();
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedMSpineRing") {
|
||||
// Nil. Handled by DeployedMSpine
|
||||
%deleted--;
|
||||
}
|
||||
else if (%dataBlockName $= "TelePadBeam") {
|
||||
// Nil. Handled by TelePadDeployedBase
|
||||
%deleted--;
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedLTarget") {
|
||||
// Nil. Handled by parent object
|
||||
%deleted--;
|
||||
}
|
||||
else {
|
||||
if (%oldObj.beam)
|
||||
%oldObj.beam.delete();
|
||||
if (%oldObj.pzone)
|
||||
%oldObj.pzone.delete();
|
||||
if (%oldObj.trigger)
|
||||
%oldObj.trigger.delete();
|
||||
if (%oldObj.lTarget)
|
||||
%oldObj.lTarget.delete();
|
||||
if (%oldObj.holo)
|
||||
%oldObj.holo.delete();
|
||||
if (%oldObj.light)
|
||||
%oldObj.light.delete();
|
||||
if (%oldObj.tripField)
|
||||
%oldObj.tripField.delete();
|
||||
if (%oldObj.tripTrigger)
|
||||
%oldObj.tripTrigger.delete();
|
||||
remDSurface(%oldObj);
|
||||
%oldObj.delete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Handle special cases
|
||||
if (%dataBlockName $= "DeployedMSpineRing") {
|
||||
// Nil. Handled by DeployedMSpine
|
||||
}
|
||||
else if (%dataBlockName $= "TelePadBeam") {
|
||||
// Nil. Handled by TelePadDeployedBase
|
||||
}
|
||||
else if (%dataBlockName $= "DeployedLTarget") {
|
||||
// Nil. Handled by parent object
|
||||
}
|
||||
else {
|
||||
%oldObj.getDataBlock().schedule(%random,"disassemble",0, %oldObj); // Run Item Specific code.
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
%checked++;
|
||||
// if (!$SaveBuilding::Quiet)
|
||||
// echo("Checking: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
}
|
||||
%oldChk = %chk;
|
||||
%oldObj = %obj;
|
||||
}
|
||||
else {
|
||||
%skipped++;
|
||||
// if (!$SaveBuilding::Quiet)
|
||||
// warn("Skipping: " @ %obj @ " Name: " @ %dataBlockName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$SaveBuilding::Quiet) {
|
||||
warn("Checked pieces: " @ %checked);
|
||||
warn("Skipped pieces: " @ %skipped);
|
||||
warn("Deleted pieces: " @ %deleted);
|
||||
}
|
||||
return %randomTime;
|
||||
}
|
||||
|
||||
function updateDeployedCount() {
|
||||
Game.clearDeployableMaxes();
|
||||
%group = nameToID("MissionCleanup/Deployables");
|
||||
%count = %group.getCount();
|
||||
for(%i=0;%i<%count;%i++) {
|
||||
%obj = %group.getObject(%i);
|
||||
%revItem = $ReverseDeployItem[%obj.getDataBlock().getName()];
|
||||
if (getWord(%revItem,0) $= "poof")
|
||||
%revItem = getWord(%revItem,1);
|
||||
if (%revItem !$= "")
|
||||
$TeamDeployedCount[%obj.team,%revItem]++;
|
||||
}
|
||||
}
|
||||
2797
scripts/server.cs
Normal file
2797
scripts/server.cs
Normal file
File diff suppressed because it is too large
Load diff
373
scripts/serverCommanderMap.cs
Normal file
373
scripts/serverCommanderMap.cs
Normal file
|
|
@ -0,0 +1,373 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Object control
|
||||
//------------------------------------------------------------------------------
|
||||
function getControlObjectType(%obj,%user)
|
||||
{
|
||||
// turrets (camera is a turret)
|
||||
if (%obj.getType() & $TypeMasks::TurretObjectType)
|
||||
{
|
||||
%barrel = %obj.getMountedImage(0);
|
||||
if (isObject(%barrel))
|
||||
return(addTaggedString(%barrel.getName()));
|
||||
}
|
||||
|
||||
// unknown
|
||||
return('Unknown');
|
||||
}
|
||||
|
||||
function serverCmdControlObject(%client, %targetId)
|
||||
{
|
||||
// match started:
|
||||
if (!$MatchStarted)
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "mission has not started.");
|
||||
return;
|
||||
}
|
||||
|
||||
// object:
|
||||
%obj = getTargetObject(%targetId);
|
||||
if (%obj == -1)
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "failed to find target object.");
|
||||
return;
|
||||
}
|
||||
|
||||
// shapebase:
|
||||
if (!(%obj.getType() & $TypeMasks::ShapeBaseObjectType))
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "object cannot be controlled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// can control:
|
||||
if (!%obj.getDataBlock().canControl)
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "object cannot be controlled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// check damage:
|
||||
if (%obj.getDamageState() !$= "Enabled")
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "object is " @ %obj.getDamageState());
|
||||
return;
|
||||
}
|
||||
|
||||
// powered:
|
||||
if (!%obj.isPowered())
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "object is not powered.");
|
||||
return;
|
||||
}
|
||||
|
||||
// controlled already:
|
||||
%control = %obj.getControllingClient();
|
||||
if (%control)
|
||||
{
|
||||
if (%control == %client)
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "you are already controlling that object.");
|
||||
else
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "someone is already controlling that object.");
|
||||
return;
|
||||
}
|
||||
|
||||
// same team?
|
||||
if (getTargetSensorGroup(%targetId) != %client.getSensorGroup())
|
||||
{
|
||||
commandToClient(%client, 'ControlObjectResonse', false, "cannot control enemy objects.");
|
||||
return;
|
||||
}
|
||||
|
||||
// dead?
|
||||
if (%client.player == 0 && getTargetDataBlock(%targetId).getName() !$= "TurretPrisonCamera") {
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "dead people cannot control objects.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (%client.isJailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// turret in purebuild mode?
|
||||
if ((%obj.getType() & $TypeMasks::TurretObjectType)
|
||||
&& $Host::Purebuild == 1
|
||||
&& !(%client.isAdmin || %client.isSuperAdmin)
|
||||
&& %obj.getDataBlock().getName() !$= "TurretDeployedCamera"
|
||||
&& %obj.getDataBlock().getName() !$= "TurretPrisonCamera") {
|
||||
commandToClient(%client, 'ControlObjectResponse', false, "cannot control turrets in purebuild mode.");
|
||||
return;
|
||||
}
|
||||
|
||||
//[[CHANGE]]Make sure you can command a bomber... and ride it the same time ;)
|
||||
|
||||
//mounted in a vehicle?
|
||||
//if (%client.player.isMounted())
|
||||
//{
|
||||
// commandToClient(%client, 'ControlObjectResponse', false, "can't control objects while mounted in a vehicle.");
|
||||
// return;
|
||||
//}
|
||||
|
||||
%client.setControlObject(%obj);
|
||||
commandToClient(%client, 'ControlObjectResponse', true, getControlObjectType(%obj,%client.player));
|
||||
%objName = getTaggedString(getTargetName(%obj.target)) SPC getTaggedString(getTargetType(%obj.target));
|
||||
if (%obj $= "")
|
||||
%objName = %obj.getDataBlock().getName();
|
||||
if ($Host::Purebuild == 1)
|
||||
messageAll('msgClient','\c2%1 is now controlling %2.',%client.name,%objName);
|
||||
else
|
||||
messageTeam(%client.team,'msgClient','\c2%1 is now controlling %2.',%client.name,%objName);
|
||||
|
||||
//[[CHANGE]] Make sure the controlled object knows how is controlling it.
|
||||
%obj.clientControl = %client;
|
||||
|
||||
///[[CHANGE]] Includes the remote station functionality.
|
||||
|
||||
if (%obj.getType() & $TypeMasks::StationObjectType)
|
||||
{
|
||||
//Lost of commented stuff... should not be nessesary.
|
||||
%colObj = %client.player;
|
||||
//%colObj.inStation = true;
|
||||
|
||||
//commandToClient(%colObj.client,'setStationKeys', true);
|
||||
messageClient(%colObj.client, 'CloseHud', "", 'inventoryScreen');
|
||||
//commandToClient(%colObj.client, 'TogglePlayHuds', true);
|
||||
%obj.triggeredBy = %colObj;
|
||||
//%obj.getDataBlock().stationTriggered(%obj, 1);
|
||||
%colObj.station = %obj;
|
||||
//%colObj.lastWeapon = ( %colObj.getMountedImage($WeaponSlot) == 0 ) ? "" : %colObj.getMountedImage($WeaponSlot).getName().item;
|
||||
//%colObj.unmountImage($WeaponSlot);
|
||||
// Make sure none of the other popup huds are active:
|
||||
//messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'scoreScreen' );
|
||||
//messageClient( %obj.triggeredBy.client, 'CloseHud', "", 'inventoryScreen' );
|
||||
//Make sure the client doesn't transport.. but does get command.
|
||||
%client.telebuy = 1;
|
||||
|
||||
|
||||
//Stuff from observing
|
||||
%data = %obj.getDataBlock();
|
||||
|
||||
%obsData = %data.observeParameters;
|
||||
%obsX = firstWord(%obsData);
|
||||
%obsY = getWord(%obsData, 1);
|
||||
%obsZ = getWord(%obsData, 2);
|
||||
|
||||
// don't set the camera mode so that it does not interfere with spawning
|
||||
%transform = %obj.getTransform();
|
||||
|
||||
// create a fresh camera to observe through... (could add to a list on
|
||||
// the observed camera to be removed when that object dies/...)
|
||||
|
||||
if ( !isObject( %client.comCam ) )
|
||||
{
|
||||
%client.comCam = new Camera()
|
||||
{
|
||||
dataBlock = CommanderCamera;
|
||||
};
|
||||
MissionCleanup.add(%client.comCam);
|
||||
}
|
||||
|
||||
%client.comCam.setTransform(%transform);
|
||||
%client.comCam.setOrbitMode(%obj, %transform, %obsX, %obsY, %obsZ);
|
||||
|
||||
%client.setControlObject(%client.comCam);
|
||||
commandToClient(%client, 'CameraAttachResponse', true);
|
||||
|
||||
//Display the Vehicle Station GUI
|
||||
//%client.player.AttachBeacon();
|
||||
//%client.player.schedule(20000,"RemoveBeacon");
|
||||
//%client.player.scheduel(1000,RemoveBeacon());
|
||||
|
||||
commandToClient(%obj.triggeredBy.client, 'StationVehicleShowHud');
|
||||
}
|
||||
if (isObject(%client.player)) {
|
||||
%client.player.RemoveBeacon();
|
||||
%client.player.AttachBeacon();
|
||||
}
|
||||
//[[End CHANGE]]
|
||||
}
|
||||
|
||||
//[[CHANGE]] Pretty straigh forward functions.
|
||||
function Player::AttachBeacon(%obj)
|
||||
{
|
||||
%beacon = new BeaconObject(){
|
||||
datablock = BomberBeacon;
|
||||
};
|
||||
if (%obj.team == 1)
|
||||
%team = 2;
|
||||
else
|
||||
%team = 1;
|
||||
%beacon.team = %team;
|
||||
%beacon.owner = %obj;
|
||||
%beacon.setTarget(%team);
|
||||
%obj.mountObject(%beacon, 4);
|
||||
%obj.enemyBeacon = %beacon;
|
||||
MissionCleanup.add(%beacon);
|
||||
%beacon.setBeaconType(enemy);
|
||||
}
|
||||
function Player::RemoveBeacon(%obj)
|
||||
{
|
||||
if (%obj.enemybeacon)
|
||||
%obj.enemyBeacon.delete();
|
||||
%obj.enemyBeacon = "";
|
||||
}
|
||||
//[[End CHANGE]]
|
||||
//------------------------------------------------------------------------------
|
||||
// TV Functions
|
||||
//------------------------------------------------------------------------------
|
||||
function resetControlObject(%client) {
|
||||
if ( isObject( %client.comCam ) )
|
||||
%client.comCam.delete();
|
||||
if (isObject(%client.player) && !%client.player.isDestroyed() && $MatchStarted)
|
||||
%client.setControlObject(%client.player);
|
||||
else
|
||||
%client.setControlObject(%client.camera);
|
||||
|
||||
// [[CHANGE]] make sure all is reset.
|
||||
if (isObject(%client.player)) {
|
||||
%client.player.station.triggeredBy = "";
|
||||
%client.player.station = "";
|
||||
%client.player.RemoveBeacon();
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdResetControlObject(%client) {
|
||||
resetControlObject(%client);
|
||||
commandToClient(%client, 'ControlObjectReset');
|
||||
// --------------------------------------------------------
|
||||
// z0dd - ZOD 4/18/02. Vehicle reticle disappearance fix.
|
||||
// commandToClient(%client, 'RemoveReticle');
|
||||
//if(isObject(%client.player))
|
||||
//{
|
||||
// %weapon = %client.player.getMountedImage($WeaponSlot);
|
||||
// %client.setWeaponsHudActive(%weapon.item);
|
||||
//}
|
||||
if(isObject(%client.player))
|
||||
{
|
||||
if(%client.player.isPilot() || %client.player.isWeaponOperator())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
commandToClient(%client, 'RemoveReticle');
|
||||
%weapon = %client.player.getMountedImage($WeaponSlot);
|
||||
%client.setWeaponsHudActive(%weapon.item);
|
||||
}
|
||||
}
|
||||
// End z0dd - ZOD
|
||||
// --------------------------------------------------------
|
||||
|
||||
// [[CHANGE]] make sure all is reset.
|
||||
if (isObject(%client.player)) {
|
||||
%client.player.station.triggeredBy = "";
|
||||
%client.player.station = "";
|
||||
%client.player.RemoveBeacon();
|
||||
}
|
||||
}
|
||||
|
||||
function serverCmdAttachCommanderCamera(%client, %target)
|
||||
{
|
||||
// dont allow observing until match has started
|
||||
if (!$MatchStarted)
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
%obj = getTargetObject(%target);
|
||||
if ((%obj == -1) || (%target == -1))
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// shape base object?
|
||||
if (!(%obj.getType() & $TypeMasks::ShapeBaseObjectType))
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// can be observed?
|
||||
if (!%obj.getDataBlock() || !%obj.getDataBlock().canObserve)
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// same team?
|
||||
if (getTargetSensorGroup(%target) != %client.getSensorGroup())
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// powered?
|
||||
if (!%obj.isPowered())
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
// client connection?
|
||||
if (%obj.getClassName() $= "GameConnection")
|
||||
{
|
||||
%player = %obj.player;
|
||||
if (%obj == %client)
|
||||
{
|
||||
if (isObject(%player) && !%player.isDestroyed())
|
||||
{
|
||||
|
||||
%client.setControlObject(%player);
|
||||
commandToClient(%client, 'CameraAttachResponse', true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
%obj = %player;
|
||||
}
|
||||
|
||||
if (!isObject(%obj) || %obj.isDestroyed())
|
||||
{
|
||||
commandToClient(%client, 'CameraAttachResponse', false);
|
||||
return;
|
||||
}
|
||||
|
||||
%data = %obj.getDataBlock();
|
||||
|
||||
%obsData = %data.observeParameters;
|
||||
%obsX = firstWord(%obsData);
|
||||
%obsY = getWord(%obsData, 1);
|
||||
%obsZ = getWord(%obsData, 2);
|
||||
|
||||
// don't set the camera mode so that it does not interfere with spawning
|
||||
%transform = %obj.getTransform();
|
||||
|
||||
// create a fresh camera to observe through... (could add to a list on
|
||||
// the observed camera to be removed when that object dies/...)
|
||||
if ( !isObject( %client.comCam ) )
|
||||
{
|
||||
%client.comCam = new Camera()
|
||||
{
|
||||
dataBlock = CommanderCamera;
|
||||
};
|
||||
MissionCleanup.add(%client.comCam);
|
||||
}
|
||||
|
||||
%client.comCam.setTransform(%transform);
|
||||
%client.comCam.setOrbitMode(%obj, %transform, %obsX, %obsY, %obsZ);
|
||||
|
||||
%client.setControlObject(%client.comCam);
|
||||
commandToClient(%client, 'CameraAttachResponse', true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Scoping
|
||||
function serverCmdScopeCommanderMap(%client, %scope)
|
||||
{
|
||||
if (%scope)
|
||||
resetControlObject(%client);
|
||||
%client.scopeCommanderMap(%scope);
|
||||
|
||||
commandToClient(%client, 'ScopeCommanderMap', %scope);
|
||||
}
|
||||
606
scripts/skywrite.cs
Normal file
606
scripts/skywrite.cs
Normal file
|
|
@ -0,0 +1,606 @@
|
|||
//A nice collection of characters.
|
||||
//
|
||||
|
||||
//Normal
|
||||
//"a b c d e f g h i j k l m n o p q r s t u v w x y z"
|
||||
|
||||
//a
|
||||
$SW::Info["a"] = "5 0.85"; //Pieces,Space
|
||||
$SW::Sizes["a",0] = "0.3 0.50 0.55 0.50 0.3 0.60";
|
||||
$SW::Sizes["a",1] = "0.55 0.2 0.65 0.2 0.55 0.55";
|
||||
$SW::Sizes["a",2] = "0.3 0.1 0.75 0.1 0.3 0.2";
|
||||
$SW::Sizes["a",3] = "0.2 0.15 0.3 0.15 0.2 0.35";
|
||||
$SW::Sizes["a",4] = "0.3 0.3 0.55 0.3 0.3 0.4";
|
||||
|
||||
//b
|
||||
$SW::Info["b"] = "4 0.7"; //Pieces,Space
|
||||
$SW::Sizes["b",0] = "0.2 0.1 0.3 0.1 0.2 0.8";
|
||||
$SW::Sizes["b",1] = "0.3 0.40 0.60 0.40 0.3 0.50";
|
||||
$SW::Sizes["b",2] = "0.3 0.10 0.60 0.10 0.3 0.20";
|
||||
$SW::Sizes["b",3] = "0.60 0.15 0.70 0.15 0.60 0.45";
|
||||
|
||||
//c
|
||||
$SW::Info["c"] = "3 0.75"; //Pieces,Space
|
||||
$SW::Sizes["c",0] = "0.2 0.15 0.3 0.15 0.2 0.50";
|
||||
$SW::Sizes["c",1] = "0.3 0.45 0.65 0.45 0.3 0.55";
|
||||
$SW::Sizes["c",2] = "0.3 0.10 0.65 0.10 0.3 0.20";
|
||||
|
||||
//d
|
||||
$SW::Info["d"] = "4 0.8"; //Pieces,Space
|
||||
$SW::Sizes["d",0] = "0.2 0.15 0.3 0.15 0.2 0.45";
|
||||
$SW::Sizes["d",1] = "0.3 0.40 0.60 0.40 0.3 0.50";
|
||||
$SW::Sizes["d",2] = "0.3 0.10 0.60 0.10 0.3 0.20";
|
||||
$SW::Sizes["d",3] = "0.60 0.1 0.70 0.1 0.60 0.8";
|
||||
|
||||
//e
|
||||
$SW::Info["e"] = "5 0.75"; //Pieces,Space
|
||||
$SW::Sizes["e",0] = "0.2 0.15 0.3 0.15 0.2 0.50";
|
||||
$SW::Sizes["e",1] = "0.3 0.45 0.55 0.45 0.3 0.55";
|
||||
$SW::Sizes["e",2] = "0.3 0.10 0.65 0.10 0.3 0.20";
|
||||
$SW::Sizes["e",3] = "0.55 0.35 0.65 0.35 0.55 0.50";
|
||||
$SW::Sizes["e",4] = "0.3 0.25 0.65 0.25 0.3 0.35";
|
||||
|
||||
//f
|
||||
$SW::Info["f"] = "3 0.8"; //Pieces,Space
|
||||
$SW::Sizes["f",0] = "0.30 0.5 0.70 0.5 0.30 0.60";
|
||||
$SW::Sizes["f",1] = "0.45 0.1 0.55 0.1 0.45 0.7";
|
||||
$SW::Sizes["f",2] = "0.50 0.65 0.70 0.65 0.50 0.75";
|
||||
|
||||
//g
|
||||
$SW::Info["g"] = "5 0.75"; //Pieces,Space
|
||||
$SW::Sizes["g",0] = "0.3 0.50 0.55 0.50 0.3 0.60";
|
||||
$SW::Sizes["g",1] = "0.55 0.05 0.65 0.05 0.55 0.60";
|
||||
$SW::Sizes["g",2] = "0.3 0.0 0.60 0.0 0.3 0.1";
|
||||
$SW::Sizes["g",3] = "0.25 0.30 0.35 0.30 0.25 0.55";
|
||||
$SW::Sizes["g",4] = "0.3 0.25 0.55 0.25 0.3 0.35";
|
||||
|
||||
//h
|
||||
$SW::Info["h"] = "3 0.7"; //Pieces,Space
|
||||
$SW::Sizes["h",0] = "0.2 0.1 0.3 0.1 0.2 0.8";
|
||||
$SW::Sizes["h",1] = "0.3 0.40 0.60 0.40 0.3 0.50";
|
||||
$SW::Sizes["h",2] = "0.55 0.1 0.65 0.1 0.55 0.45";
|
||||
|
||||
//i
|
||||
$SW::Info["i"] = "2 0.35"; //Pieces,Space
|
||||
$SW::Sizes["i",0] = "0.15 0.1 0.25 0.1 0.15 0.5";
|
||||
$SW::Sizes["i",1] = "0.15 0.6 0.25 0.6 0.15 0.7";
|
||||
|
||||
//j
|
||||
$SW::Info["j"] = "3 0.45"; //Pieces,Space
|
||||
$SW::Sizes["j",0] = "0.25 0.05 0.35 0.05 0.25 0.6";
|
||||
$SW::Sizes["j",1] = "0.25 0.7 0.35 0.7 0.25 0.8";
|
||||
$SW::Sizes["j",2] = "0.10 0.0 0.30 0.0 0.10 0.1";
|
||||
|
||||
//k
|
||||
$SW::Info["k"] = "3 0.6"; //Pieces,Space
|
||||
$SW::Sizes["k",0] = "0.2 0.1 0.3 0.1 0.2 0.7";
|
||||
$SW::Sizes["k",1] = "0.3 0.25 0.50 0.45 0.23 0.32";
|
||||
$SW::Sizes["k",2] = "0.3 0.25 0.45 0.1 0.37 0.32";
|
||||
|
||||
//l
|
||||
$SW::Info["l"] = "1 0.4"; //Pieces,Space
|
||||
$SW::Sizes["l",0] = "0.2 0.1 0.3 0.1 0.2 0.8";
|
||||
|
||||
//m
|
||||
$SW::Info["m"] = "5 0.9"; //Pieces,Space
|
||||
$SW::Sizes["m",0] = "0.2 0.1 0.3 0.1 0.2 0.55";
|
||||
$SW::Sizes["m",1] = "0.3 0.40 0.50 0.40 0.3 0.50";
|
||||
$SW::Sizes["m",2] = "0.45 0.1 0.55 0.1 0.45 0.45";
|
||||
$SW::Sizes["m",3] = "0.55 0.40 0.75 0.40 0.55 0.50";
|
||||
$SW::Sizes["m",4] = "0.70 0.1 0.80 0.1 0.70 0.45";
|
||||
|
||||
//n
|
||||
$SW::Info["n"] = "3 0.65"; //Pieces,Space
|
||||
$SW::Sizes["n",0] = "0.2 0.1 0.3 0.1 0.2 0.55";
|
||||
$SW::Sizes["n",1] = "0.3 0.40 0.50 0.40 0.3 0.50";
|
||||
$SW::Sizes["n",2] = "0.45 0.1 0.55 0.1 0.45 0.45";
|
||||
|
||||
//o
|
||||
$SW::Info["o"] = "4 0.65"; //Pieces,Space
|
||||
$SW::Sizes["o",0] = "0.2 0.15 0.3 0.15 0.2 0.45";
|
||||
$SW::Sizes["o",1] = "0.25 0.40 0.50 0.40 0.3 0.50";
|
||||
$SW::Sizes["o",2] = "0.45 0.15 0.55 0.15 0.45 0.45";
|
||||
$SW::Sizes["o",3] = "0.25 0.1 0.50 0.1 0.25 0.2";
|
||||
|
||||
//p
|
||||
$SW::Info["p"] = "4 0.8"; //Pieces,Space
|
||||
$SW::Sizes["p",0] = "0.3 0.50 0.55 0.50 0.3 0.60";
|
||||
$SW::Sizes["p",1] = "0.5 0.30 0.6 0.30 0.5 0.55";
|
||||
$SW::Sizes["p",2] = "0.2 0.0 0.3 0.00 0.2 0.60";
|
||||
$SW::Sizes["p",3] = "0.3 0.25 0.55 0.25 0.3 0.35";
|
||||
|
||||
//q
|
||||
$SW::Info["q"] = "4 0.75"; //Pieces,Space
|
||||
$SW::Sizes["q",0] = "0.3 0.50 0.55 0.50 0.3 0.60";
|
||||
$SW::Sizes["q",1] = "0.55 0.0 0.65 0.0 0.55 0.60";
|
||||
$SW::Sizes["q",2] = "0.25 0.30 0.35 0.30 0.25 0.55";
|
||||
$SW::Sizes["q",3] = "0.3 0.25 0.55 0.25 0.3 0.35";
|
||||
|
||||
//r
|
||||
$SW::Info["r"] = "4 0.6"; //Pieces,Space
|
||||
$SW::Sizes["r",0] = "0.2 0.1 0.3 0.1 0.2 0.55";
|
||||
$SW::Sizes["r",1] = "0.3 0.38 0.35 0.38 0.3 0.48";
|
||||
$SW::Sizes["r",2] = "0.3 0.40 0.50 0.40 0.3 0.50";
|
||||
$SW::Sizes["r",3] = "0.45 0.38 0.50 0.38 0.45 0.48";
|
||||
|
||||
//s
|
||||
$SW::Info["s"] = "7 0.6"; //Pieces,Space
|
||||
$SW::Sizes["s",0] = "0.2 0.40 0.3 0.40 0.2 0.50";
|
||||
$SW::Sizes["s",1] = "0.25 0.45 0.45 0.45 0.3 0.55";
|
||||
$SW::Sizes["s",2] = "0.2 0.40 0.40 0.2 0.25 0.50";
|
||||
$SW::Sizes["s",3] = "0.40 0.15 0.5 0.15 0.4 0.25";
|
||||
$SW::Sizes["s",4] = "0.25 0.1 0.45 0.1 0.2 0.2";
|
||||
$SW::Sizes["s",5] = "0.40 0.40 0.5 0.40 0.4 0.5";
|
||||
$SW::Sizes["s",6] = "0.2 0.15 0.3 0.15 0.2 0.25";
|
||||
|
||||
//t
|
||||
$SW::Info["t"] = "3 0.75"; //Pieces,Space
|
||||
$SW::Sizes["t",0] = "0.35 0.5 0.65 0.5 0.35 0.60";
|
||||
$SW::Sizes["t",1] = "0.45 0.1 0.55 0.1 0.45 0.7";
|
||||
$SW::Sizes["t",2] = "0.55 0.1 0.65 0.1 0.55 0.2";
|
||||
|
||||
//u
|
||||
$SW::Info["u"] = "3 0.60"; //Pieces,Space
|
||||
$SW::Sizes["u",0] = "0.2 0.1 0.3 0.1 0.2 0.50";
|
||||
$SW::Sizes["u",1] = "0.25 0.05 0.50 0.05 0.3 0.15";
|
||||
$SW::Sizes["u",2] = "0.45 0.1 0.55 0.1 0.45 0.50";
|
||||
|
||||
//v
|
||||
$SW::Info["v"] = "2 0.60"; //Pieces,Space
|
||||
$SW::Sizes["v",0] = "0.1 0.5 0.3 0.1 0.15 0.55";
|
||||
$SW::Sizes["v",1] = "0.3 0.1 0.5 0.5 0.25 0.15";
|
||||
|
||||
//w
|
||||
$SW::Info["w"] = "4 0.9"; //Pieces,Space
|
||||
$SW::Sizes["w",0] = "0.1 0.5 0.3 0.1 0.15 0.55";
|
||||
$SW::Sizes["w",1] = "0.3 0.1 0.5 0.5 0.25 0.15";
|
||||
$SW::Sizes["w",2] = "0.4 0.5 0.6 0.1 0.45 0.55";
|
||||
$SW::Sizes["w",3] = "0.6 0.1 0.8 0.5 0.55 0.15";
|
||||
|
||||
//x
|
||||
$SW::Info["x"] = "2 0.5"; //Pieces,Space
|
||||
$SW::Sizes["x",0] = "0.1 0.4 0.38 0.1 0.15 0.45";
|
||||
$SW::Sizes["x",1] = "0.12 0.1 0.4 0.4 0.07 0.15";
|
||||
|
||||
//y
|
||||
$SW::Info["y"] = "3 0.60"; //Pieces,Space
|
||||
$SW::Sizes["y",0] = "0.1 0.5 0.25 0.25 0.15 0.55";
|
||||
$SW::Sizes["y",1] = "0.3 0.15 0.5 0.5 0.25 0.2";
|
||||
$SW::Sizes["y",2] = "0.15 0.10 0.3 0.1 0.2 0.18";
|
||||
|
||||
//z
|
||||
$SW::Info["z"] = "3 0.6"; //Pieces,Space
|
||||
$SW::Sizes["z",0] = "0.1 0.40 0.4 0.40 0.1 0.50";
|
||||
$SW::Sizes["z",1] = "0.15 0.1 0.4 0.4 0.1 0.15";
|
||||
$SW::Sizes["z",2] = "0.1 0.1 0.4 0.1 0.1 0.2";
|
||||
|
||||
//Numbers
|
||||
//"1 2 3 4 5 6 7 8 9 0"
|
||||
|
||||
//1
|
||||
$SW::Info["1"] = "3 0.65"; //Pieces,Space
|
||||
$SW::Sizes["1",0] = "0.3 0.1 0.4 0.1 0.3 0.8";
|
||||
$SW::Sizes["1",1] = "0.2 0.6 0.4 0.75 0.17 0.67";
|
||||
$SW::Sizes["1",2] = "0.15 0.0 0.55 0.0 0.1 0.1";
|
||||
|
||||
//2
|
||||
$SW::Info["2"] = "4 0.65"; //Pieces,Space
|
||||
$SW::Sizes["2",0] = "0.1 0.7 0.5 0.7 0.1 0.8";
|
||||
$SW::Sizes["2",1] = "0.45 0.5 0.55 0.5 0.45 0.75";
|
||||
$SW::Sizes["2",2] = "0.15 0.0 0.55 0.5 0.08 0.07";
|
||||
$SW::Sizes["2",3] = "0.07 0.0 0.55 0.0 0.07 0.1";
|
||||
|
||||
//3
|
||||
$SW::Info["3"] = "5 0.65"; //Pieces,Space
|
||||
$SW::Sizes["3",0] = "0.1 0.7 0.5 0.7 0.1 0.8";
|
||||
$SW::Sizes["3",1] = "0.45 0.45 0.55 0.45 0.45 0.75";
|
||||
$SW::Sizes["3",2] = "0.1 0.35 0.5 0.35 0.1 0.45";
|
||||
$SW::Sizes["3",3] = "0.45 0.05 0.55 0.05 0.45 0.35";
|
||||
$SW::Sizes["3",4] = "0.1 0.0 0.5 0.0 0.1 0.1";
|
||||
|
||||
//4
|
||||
|
||||
$SW::Info["4"] = "3 0.75"; //Pieces,Space
|
||||
$SW::Sizes["4",0] = "0.4 0.0 0.5 0.0 0.4 0.8";
|
||||
$SW::Sizes["4",1] = "0.1 0.25 0.5 0.75 0.17 0.32";
|
||||
$SW::Sizes["4",2] = "0.1 0.25 0.65 0.25 0.1 0.35";
|
||||
|
||||
//5
|
||||
$SW::Info["5"] = "5 0.7"; //Pieces,Space
|
||||
$SW::Sizes["5",0] = "0.1 0.35 0.2 0.35 0.1 0.8";
|
||||
$SW::Sizes["5",1] = "0.2 0.35 0.55 0.35 0.2 0.45";
|
||||
$SW::Sizes["5",2] = "0.1 0.0 0.55 0.00 0.1 0.10";
|
||||
$SW::Sizes["5",3] = "0.5 0.05 0.60 0.05 0.50 0.40";
|
||||
$SW::Sizes["5",4] = "0.2 0.70 0.60 0.70 0.2 0.8";
|
||||
|
||||
//6
|
||||
$SW::Info["6"] = "6 0.7"; //Pieces,Space
|
||||
$SW::Sizes["6",0] = "0.1 0.05 0.2 0.05 0.1 0.7";
|
||||
$SW::Sizes["6",1] = "0.2 0.35 0.55 0.35 0.2 0.45";
|
||||
$SW::Sizes["6",2] = "0.15 0.0 0.55 0.00 0.15 0.10";
|
||||
$SW::Sizes["6",3] = "0.50 0.05 0.60 0.05 0.50 0.40";
|
||||
$SW::Sizes["6",4] = "0.15 0.65 0.60 0.70 0.08 0.72";
|
||||
|
||||
//7
|
||||
$SW::Info["7"] = "2 0.6"; //Pieces,Space
|
||||
$SW::Sizes["7",0] = "0.1 0.7 0.5 0.7 0.1 0.8";
|
||||
$SW::Sizes["7",1] = "0.2 0.0 0.5 0.7 0.13 0.07";
|
||||
|
||||
//8
|
||||
$SW::Info["8"] = "7 0.7"; //Pieces,Space
|
||||
$SW::Sizes["8",0] = "0.1 0.05 0.2 0.05 0.1 0.43";
|
||||
$SW::Sizes["8",1] = "0.1 0.45 0.58 0.35 0.17 0.52";
|
||||
$SW::Sizes["8",2] = "0.15 0.00 0.55 0.00 0.15 0.15";
|
||||
$SW::Sizes["8",3] = "0.50 0.05 0.60 0.05 0.50 0.45";
|
||||
$SW::Sizes["8",4] = "0.15 0.70 0.55 0.70 0.15 0.80";
|
||||
$SW::Sizes["8",5] = "0.1 0.45 0.2 0.45 0.1 0.75";
|
||||
$SW::Sizes["8",6] = "0.50 0.47 0.60 0.47 0.50 0.75";
|
||||
|
||||
//9
|
||||
$SW::Info["9"] = "6 0.7"; //Pieces,Space
|
||||
$SW::Sizes["9",0] = "0.1 0.45 0.58 0.35 0.17 0.52";
|
||||
$SW::Sizes["9",1] = "0.15 0.00 0.55 0.00 0.15 0.15";
|
||||
$SW::Sizes["9",2] = "0.50 0.05 0.60 0.05 0.50 0.45";
|
||||
$SW::Sizes["9",3] = "0.15 0.70 0.55 0.70 0.15 0.80";
|
||||
$SW::Sizes["9",4] = "0.1 0.45 0.2 0.45 0.1 0.75";
|
||||
$SW::Sizes["9",5] = "0.50 0.47 0.60 0.47 0.50 0.75";
|
||||
|
||||
//0
|
||||
$SW::Info["0"] = "4 0.7"; //Pieces,Space
|
||||
$SW::Sizes["0",0] = "0.1 0.05 0.2 0.05 0.1 0.75";
|
||||
$SW::Sizes["0",1] = "0.15 0.00 0.55 0.00 0.15 0.15";
|
||||
$SW::Sizes["0",2] = "0.50 0.05 0.60 0.05 0.50 0.75";
|
||||
$SW::Sizes["0",3] = "0.15 0.70 0.55 0.70 0.15 0.80";
|
||||
|
||||
//Tribes2 String Chars
|
||||
// " ' \
|
||||
|
||||
//"
|
||||
$SW::Info["\""] = "2 0.40"; //Pieces,Space
|
||||
$SW::Sizes["\"",0] = "0.15 0.65 0.20 0.65 0.15 0.8";
|
||||
$SW::Sizes["\"",1] = "0.25 0.65 0.30 0.65 0.25 0.8";
|
||||
|
||||
//'
|
||||
$SW::Info["\'"] = "1 0.30"; //Pieces,Space
|
||||
$SW::Sizes["\'",0] = "0.15 0.65 0.20 0.65 0.15 0.8";
|
||||
|
||||
// \
|
||||
$SW::Info["\\"] = "1 0.70"; //Pieces,Space
|
||||
$SW::Sizes["\\",0] = "0.1 0.75 0.6 0.1 0.15 0.8";
|
||||
|
||||
|
||||
//Skywrite string Chars
|
||||
//+ /
|
||||
|
||||
$SW::Info["/+"] = "2 0.70"; //Pieces,Space
|
||||
$SW::Sizes["/+",0] = "0.1 0.35 0.6 0.35 0.1 0.45";
|
||||
$SW::Sizes["/+",1] = "0.3 0.1 0.4 0.1 0.3 0.7";
|
||||
|
||||
// /
|
||||
$SW::Info["//"] = "1 0.70"; //Pieces,Space
|
||||
$SW::Sizes["//",0] = "0.1 0.1 0.6 0.8 0.05 0.15";
|
||||
|
||||
|
||||
//Sentance builders
|
||||
//. , : ; ! ?
|
||||
|
||||
//.
|
||||
$SW::Info["."] = "1 0.30"; //Pieces,Space
|
||||
$SW::Sizes[".",0] = "0.1 0.1 0.20 0.1 0.1 0.2";
|
||||
|
||||
//,
|
||||
$SW::Info[","] = "2 0.30"; //Pieces,Space
|
||||
$SW::Sizes[",",0] = "0.1 0.1 0.20 0.1 0.1 0.2";
|
||||
$SW::Sizes[",",1] = "0.1 0.0 0.2 0.1 0.05 0.05";
|
||||
|
||||
//:
|
||||
$SW::Info[":"] = "2 0.30"; //Pieces,Space
|
||||
$SW::Sizes[":",0] = "0.1 0.2 0.20 0.2 0.1 0.3";
|
||||
$SW::Sizes[":",1] = "0.1 0.5 0.20 0.5 0.1 0.6";
|
||||
|
||||
//;
|
||||
$SW::Info[";"] = "3 0.30"; //Pieces,Space
|
||||
$SW::Sizes[";",0] = "0.1 0.2 0.20 0.2 0.1 0.3";
|
||||
$SW::Sizes[";",1] = "0.1 0.1 0.2 0.2 0.05 0.15";
|
||||
$SW::Sizes[";",2] = "0.1 0.5 0.20 0.5 0.1 0.6";
|
||||
|
||||
//!
|
||||
$SW::Info["!"] = "2 0.35"; //Pieces,Space
|
||||
$SW::Sizes["!",0] = "0.15 0.2 0.25 0.2 0.15 0.8";
|
||||
$SW::Sizes["!",1] = "0.15 0.0 0.25 0.0 0.15 0.1";
|
||||
|
||||
//?
|
||||
$SW::Info["?"] = "6 0.65"; //Pieces,Space
|
||||
$SW::Sizes["?",0] = "0.2 0.7 0.5 0.7 0.2 0.8";
|
||||
$SW::Sizes["?",1] = "0.15 0.65 0.25 0.65 0.15 0.75";
|
||||
$SW::Sizes["?",2] = "0.45 0.5 0.55 0.5 0.45 0.75";
|
||||
$SW::Sizes["?",3] = "0.35 0.25 0.55 0.5 0.27 0.33";
|
||||
$SW::Sizes["?",4] = "0.25 0.2 0.35 0.2 0.25 0.3";
|
||||
$SW::Sizes["?",5] = "0.25 0.0 0.35 0.0 0.25 0.1";
|
||||
|
||||
|
||||
|
||||
//#
|
||||
$SW::Info["#"] = "4 0.55"; //Pieces,Space
|
||||
$SW::Sizes["#",0] = "0.15 0.15 0.20 0.15 0.15 0.7";
|
||||
$SW::Sizes["#",1] = "0.25 0.15 0.30 0.15 0.25 0.7";
|
||||
$SW::Sizes["#",2] = "0.05 0.30 0.40 0.30 0.05 0.35";
|
||||
$SW::Sizes["#",3] = "0.05 0.50 0.40 0.50 0.05 0.55";
|
||||
|
||||
//$
|
||||
$SW::Info["$"] = "6 0.7"; //Pieces,Space
|
||||
$SW::Sizes["$",0] = "0.2 0.65 0.55 0.65 0.2 0.75";
|
||||
$SW::Sizes["$",1] = "0.15 0.40 0.25 0.40 0.15 0.7";
|
||||
$SW::Sizes["$",2] = "0.2 0.40 0.55 0.30 0.27 0.47";
|
||||
$SW::Sizes["$",3] = "0.5 0.10 0.60 0.1 0.50 0.40";
|
||||
$SW::Sizes["$",4] = "0.2 0.05 0.55 0.05 0.25 0.15";
|
||||
$SW::Sizes["$",5] = "0.325 0.0 0.425 0.0 0.325 0.80";
|
||||
|
||||
//%
|
||||
$SW::Info["%"] = "3 0.6"; //Pieces,Space
|
||||
$SW::Sizes["%",0] = "0.4 0.1 0.5 0.0 0.5 0.2";
|
||||
$SW::Sizes["%",1] = "0.1 0.0 0.6 0.8 0.03 0.07";
|
||||
$SW::Sizes["%",2] = "0.0 0.75 0.1 0.65 0.1 0.85";
|
||||
|
||||
//&
|
||||
$SW::Info["&"] = "6 0.7"; //Pieces,Space
|
||||
$SW::Sizes["&",0] = "0.5 0.0 0.6 0.5 0.48 0.05";
|
||||
$SW::Sizes["&",1] = "0.1 0.0 0.5 0.0 0.1 0.1";
|
||||
$SW::Sizes["&",2] = "0.05 0.05 0.15 0.05 0.05 0.25";
|
||||
$SW::Sizes["&",3] = "0.1 0.20 0.55 0.65 0.05 0.25";
|
||||
$SW::Sizes["&",4] = "0.45 0.75 0.55 0.65 0.50 0.80";
|
||||
$SW::Sizes["&",5] = "0.25 0.55 0.60 0.60 0.20 0.70";
|
||||
|
||||
|
||||
//Hooks
|
||||
//( ) [ ] { } < >
|
||||
|
||||
//(
|
||||
$SW::Info["("] = "3 0.45"; //Pieces,Space
|
||||
$SW::Sizes["(",0] = "0.155 0.45 0.4 0.75 0.105 0.50";
|
||||
$SW::Sizes["(",1] = "0.1 0.3 0.2 0.3 0.1 0.5";
|
||||
$SW::Sizes["(",2] = "0.1 0.3 0.35 0.0 0.15 0.35";
|
||||
|
||||
//)
|
||||
$SW::Info[")"] = "3 0.4"; //Pieces,Space
|
||||
$SW::Sizes[")",0] = "0.0 0.75 0.24 0.46 0.05 0.8";
|
||||
$SW::Sizes[")",1] = "0.2 0.3 0.3 0.3 0.2 0.5";
|
||||
$SW::Sizes[")",2] = "0.05 0.0 0.3 0.3 0.0 0.05";
|
||||
|
||||
//[
|
||||
$SW::Info["["] = "3 0.4"; //Pieces,Space
|
||||
$SW::Sizes["[",0] = "0.0 0.7 0.3 0.7 0.0 0.8";
|
||||
$SW::Sizes["[",1] = "0.0 0.1 0.1 0.1 0.0 0.7";
|
||||
$SW::Sizes["[",2] = "0.0 0.0 0.3 0.0 0.0 0.1";
|
||||
|
||||
//]
|
||||
$SW::Info["]"] = "3 0.4"; //Pieces,Space
|
||||
$SW::Sizes["]",0] = "0.0 0.7 0.3 0.7 0.0 0.8";
|
||||
$SW::Sizes["]",1] = "0.2 0.1 0.3 0.1 0.2 0.7";
|
||||
$SW::Sizes["]",2] = "0.0 0.0 0.3 0.0 0.0 0.1";
|
||||
|
||||
//{
|
||||
$SW::Info["{"] = "4 0.4"; //Pieces,Space
|
||||
$SW::Sizes["{",0] = "0.15 0.7 0.4 0.7 0.15 0.8";
|
||||
$SW::Sizes["{",1] = "0.1 0.1 0.2 0.1 0.1 0.7";
|
||||
$SW::Sizes["{",2] = "0.15 0.0 0.4 0.0 0.15 0.1";
|
||||
$SW::Sizes["{",3] = "0.0 0.35 0.1 0.35 0.0 0.45";
|
||||
|
||||
//}
|
||||
$SW::Info["}"] = "4 0.4"; //Pieces,Space
|
||||
$SW::Sizes["}",0] = "0.0 0.7 0.25 0.7 0.0 0.8";
|
||||
$SW::Sizes["}",1] = "0.2 0.1 0.3 0.1 0.2 0.7";
|
||||
$SW::Sizes["}",2] = "0.0 0.0 0.25 0.0 0.0 0.1";
|
||||
$SW::Sizes["}",3] = "0.3 0.35 0.4 0.35 0.3 0.45";
|
||||
|
||||
//<
|
||||
$SW::Info["<"] = "2 0.45"; //Pieces,Space
|
||||
$SW::Sizes["<",0] = "0.155 0.35 0.4 0.65 0.105 0.40";
|
||||
$SW::Sizes["<",1] = "0.1 0.4 0.35 0.1 0.15 0.45";
|
||||
|
||||
//>
|
||||
$SW::Info[">"] = "2 0.6"; //Pieces,Space
|
||||
$SW::Sizes[">",0] = "0.0 0.65 0.24 0.36 0.05 0.7";
|
||||
$SW::Sizes[">",1] = "0.05 0.1 0.3 0.4 0.0 0.15";
|
||||
|
||||
|
||||
//Lines
|
||||
// = _ - |
|
||||
|
||||
//=
|
||||
$SW::Info["="] = "2 0.45"; //Pieces,Space
|
||||
$SW::Sizes["=",0] = "0.05 0.25 0.40 0.25 0.05 0.35";
|
||||
$SW::Sizes["=",1] = "0.05 0.50 0.40 0.50 0.05 0.60";
|
||||
|
||||
//-
|
||||
$SW::Info["-"] = "1 0.45"; //Pieces,Space
|
||||
$SW::Sizes["-",0] = "0.05 0.35 0.40 0.35 0.05 0.45";
|
||||
|
||||
//_
|
||||
$SW::Info["_"] = "1 0.45"; //Pieces,Space
|
||||
$SW::Sizes["_",0] = "0.05 0.05 0.40 0.05 0.05 0.15";
|
||||
|
||||
//|
|
||||
$SW::Info["|"] = "1 0.40"; //Pieces,Space
|
||||
$SW::Sizes["|",0] = "0.15 0.0 0.25 0.0 0.15 0.8";
|
||||
|
||||
|
||||
//Space
|
||||
$SW::Info["sp"] = "0 0.5"; //Pieces,Space
|
||||
|
||||
|
||||
//Capital Letters
|
||||
|
||||
//T
|
||||
$SW::Info["+t"] = "2 1"; //Pieces,Space
|
||||
$SW::Sizes["+t",0] = "0 0.8 1 0.8 0 1";
|
||||
$SW::Sizes["+t",1] = "0.4 0 0.6 0 0.4 0.8";
|
||||
|
||||
$SW::Thickness = 0.1;
|
||||
|
||||
function GameConnection::skyWrite(%cl,%word,%dist,%scale,%center,%upright,%angle,%mirror) {
|
||||
if (%word $= "")
|
||||
return;
|
||||
if (%dist $= "" || %dist == 0)
|
||||
%dist = 50;
|
||||
if (%scale $= "" || %scale == 0)
|
||||
%scale = 5;
|
||||
%word = SW_goodWord(%word);
|
||||
%obj = %cl.player;
|
||||
%pos = %obj.getEyepoint();
|
||||
%dir = %obj.getEyeVector();
|
||||
%location = vectorAdd(%pos,vectorScale(%dir,%dist));
|
||||
if (%upright)
|
||||
%dir = vectorNormalize(getWords(%dir,0,1));
|
||||
if (%mirror)
|
||||
%dir = vectorScale(%dir,-1);
|
||||
SW_word(%word,%location,%dir,%scale,%center,%cl,%angle);
|
||||
}
|
||||
|
||||
function SW_word(%word,%pos,%nrm,%scale,%center,%cl,%angle) {
|
||||
%cl.lastword++;
|
||||
%z = vectorNormalize(%nrm);
|
||||
%tx = vectorCross(%nrm,"0 0 1");
|
||||
%up = vectorAdd(vectorScale("0 0 1",mCos(mDegToRad(%angle))),vectorScale(%tx,mSin(mDegToRad(%angle))));
|
||||
%x = vectorCross(%nrm,%up);
|
||||
|
||||
if (%center) {
|
||||
for (%td = 0; %td < getWordCount(%word);%td++) {
|
||||
%letter = getWord(%word,%td);
|
||||
%space = %space + getWord($SW::Info[%letter],1) * %scale;
|
||||
}
|
||||
%space = %space * -0.5;
|
||||
%pos = vectorAdd(%pos,vectorScale(%up,-0.5 * %scale));
|
||||
}
|
||||
|
||||
for (%td = 0; %td < getWordCount(%word);%td++) {
|
||||
%letter = getWord(%word,%td);
|
||||
SW_letter(%letter,vectorAdd(%pos,vectorScale(%x,%space)),%nrm,%scale,%cl,%angle);
|
||||
%space = %space + getWord($SW::Info[%letter],1) * %scale;
|
||||
}
|
||||
}
|
||||
|
||||
function SW_letter(%letter,%pos,%nrm,%scale,%cl,%angle) {
|
||||
%z = vectorNormalize(%nrm);
|
||||
%tx = vectorCross(%nrm,"0 0 1");
|
||||
%up = vectorAdd(vectorScale("0 0 1",mCos(mDegToRad(%angle))),vectorScale(%tx,mSin(mDegToRad(%angle))));
|
||||
%x = vectorCross(%nrm,%up);
|
||||
%y = vectorCross(%x,%nrm);
|
||||
|
||||
%matrix = %x SPC %y SPC %z;
|
||||
%pieces = getWord($SW::Info[%letter],0);
|
||||
for (%td = 0; %td < %pieces;%td++) {
|
||||
%obj = SW_letterPart(%letter,%td,%pos,%matrix,%scale);
|
||||
%obj.textGroup(%cl,%cl.lastword);
|
||||
%obj.team = %cl.team;
|
||||
%obj.needsFit = 1;
|
||||
// commented out. Can easily remove writing with "remove orphaned pieces", even if client is no longer in game
|
||||
// %obj.setOwner(0,%cl);
|
||||
}
|
||||
}
|
||||
|
||||
function SW_letterPart(%letter,%part,%pos,%matrix,%scale) {
|
||||
%partInfo = $SW::Sizes[%letter,%part];
|
||||
%p1 = SW_goodSquare(%partInfo);
|
||||
%pos1 = vectorScale(matrixMult(getWords(%p1,0,1) SPC "0",%matrix),%scale);
|
||||
%vecx1 = vectorScale(matrixMult(getWords(%p1,2,3) SPC "0",%matrix),%scale);
|
||||
%vecy1 = vectorScale(matrixMult(getWords(%p1,4,5) SPC "0",%matrix),%scale);
|
||||
%vecz1 = vectorScale(getWords(%matrix,6,8),%scale * $SW::Thickness);
|
||||
%obj = SW_bar(vectorAdd(%pos,%pos1),%vecx1,%vecy1,%vecz1);
|
||||
return %obj;
|
||||
}
|
||||
|
||||
function SW_goodSquare(%p) {
|
||||
%pos = getWords(%p,0,1);
|
||||
%x = getWords(%p,2,3);
|
||||
%y = getWords(%p,4,5);
|
||||
return %pos SPC getWords(VectorSub(%x,%pos),0,1) SPC getWords(VectorSub(%y,%pos),0,1);
|
||||
}
|
||||
|
||||
function SW_goodWord(%word) {
|
||||
%id = 0;
|
||||
while (%id < strLen(%word)) {
|
||||
%letter = getSubStr(%word,%id,1);
|
||||
if (%letter $= "" || %letter $= "/" || %letter $= "+") {
|
||||
%letter = getSubStr(%word,%id,2);
|
||||
%id++;
|
||||
}
|
||||
if (%letter $= " ")
|
||||
%letter = "sp";
|
||||
%id++;
|
||||
if (%goodWord !$= "")
|
||||
%goodWord = %goodWord SPC %letter;
|
||||
else
|
||||
%goodWord = %letter;
|
||||
}
|
||||
return %goodWord;
|
||||
}
|
||||
|
||||
//Creates the actual beam
|
||||
function SW_bar(%pos,%fo,%ri,%up) {
|
||||
%size = vectorLen(%fo) SPC vectorLen(%ri) SPC vectorLen(%up);
|
||||
%rot = fullRot(%up,%fo);
|
||||
|
||||
%obj = new StaticShape() {
|
||||
dataBlock = DeployedSpine;
|
||||
};
|
||||
|
||||
// %obj = new ForceFieldBare() {
|
||||
// datablock = DeployedForceField1;
|
||||
// };
|
||||
|
||||
%obj.setRealSize(%size);
|
||||
%obj.setRotation(%rot);
|
||||
%pos = microAdjust(%pos);
|
||||
%obj.setEdge(%pos,"-1 1 -1");
|
||||
return %obj;
|
||||
}
|
||||
|
||||
|
||||
///Grouping
|
||||
|
||||
function GameBase::textGroup(%obj,%cl,%word) {
|
||||
%subGroup = %cl @ "/" @ %word;
|
||||
%group = nameToID("MissionCleanup/textGroup/" @ %subgroup);
|
||||
if (%group <= 0) {
|
||||
%group = new SimGroup(%word);
|
||||
addToClientTextGroup(%group,%cl);
|
||||
}
|
||||
%group.add(%obj);
|
||||
}
|
||||
|
||||
function addToClientTextGroup(%obj,%cl) {
|
||||
%group = nameToID("MissionCleanup/textGroup/"@ %cl);
|
||||
if (%group <= 0) {
|
||||
%group = new SimGroup(%cl);
|
||||
addToTextGroup(%group);
|
||||
}
|
||||
%group.add(%obj);
|
||||
}
|
||||
|
||||
function addToTextGroup(%obj) {
|
||||
%group = nameToID("MissionCleanup/textGroup");
|
||||
if (%group <= 0) {
|
||||
%group = new SimGroup("textGroup");
|
||||
MissionCleanup.add(%group);
|
||||
}
|
||||
%group.add(%obj);
|
||||
}
|
||||
|
||||
function getLatestGroup(%group) {
|
||||
%count = %group.getCount();
|
||||
return %group.getObject(%count - 1);
|
||||
}
|
||||
|
||||
function GameConnection::removeLastWord(%cl) {
|
||||
%group = nameToID("MissionCleanup/textGroup/" @ %cl);
|
||||
%lastWord = getLatestGroup(%group);
|
||||
if (isObject(%lastWord))
|
||||
%lastWord.delete();
|
||||
}
|
||||
|
||||
function GameConnection::removeWords(%cl) {
|
||||
%group = nameToID("MissionCleanup/textGroup/" @ %cl);
|
||||
if (isObject(%group))
|
||||
%group.delete();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue