mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 16:43:21 +00:00
Minor ftt spawn logic changing
This commit is contained in:
parent
29b7d12060
commit
6c63e69abf
13 changed files with 139 additions and 37 deletions
|
@ -32,6 +32,26 @@ stock void GetHorizontalPositionFromClient(int client, float units, float finalP
|
|||
pos[1] += -150 * Sine(theta);
|
||||
finalPosition = pos;
|
||||
}
|
||||
// Gets velocity of an entity (ent) toward new origin with speed (fSpeed) - thanks Ryan
|
||||
stock bool GetVelocityToOrigin(int entity, const float destination[3], const float fSpeed, float outVelocity[3]) {
|
||||
float srcOrigin[3];
|
||||
GetEntPropVector(entity, Prop_Data, "m_vecVelocity", srcOrigin);
|
||||
// Velocity = Distance / Time
|
||||
|
||||
float fDistance[3];
|
||||
fDistance[0] = destination[0] - srcOrigin[0];
|
||||
fDistance[1] = destination[1] - srcOrigin[1];
|
||||
fDistance[2] = destination[2] - srcOrigin[2];
|
||||
|
||||
float fTime = (GetVectorDistance(srcOrigin, destination) / fSpeed);
|
||||
|
||||
outVelocity[0] = (destination[0] - srcOrigin[0]) / fTime;
|
||||
outVelocity[1] = (destination[1] - srcOrigin[1]) / fTime;
|
||||
outVelocity[2] = (destination[2] - srcOrigin[2]) / fTime;
|
||||
|
||||
return (outVelocity[0] && outVelocity[1] && outVelocity[2]);
|
||||
}
|
||||
|
||||
//Credits to Timocop for the stock :D
|
||||
/**
|
||||
* Runs a single line of vscript code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue