vscripts: update to latest versions
This commit is contained in:
parent
8b42729acb
commit
a5bc964a81
137
VScripts/scripting/include/vscripts.inc
Normal file
137
VScripts/scripting/include/vscripts.inc
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
**
|
||||
*/
|
||||
#if defined _ENT_INDEX_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _ENT_INDEX_included
|
||||
|
||||
|
||||
public int GetEntityIndexByHammerID(int HammerID, const char[] classname) {
|
||||
int i = -1;
|
||||
while((i = FindEntityByClassname(i,classname))!= -1){
|
||||
if(IsValidEntity(i)){
|
||||
if (GetEntProp(i, Prop_Data, "m_iHammerID") == HammerID) return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int GetEntityIndexByName(const char[] name, const char[] classname){
|
||||
int i = -1;
|
||||
char buffer[500];
|
||||
while((i = FindEntityByClassname(i, classname))!= -1){
|
||||
if(IsValidEntity(i)){
|
||||
GetEntPropString(i, Prop_Data, "m_iName", buffer, sizeof(buffer));
|
||||
if (strcmp(name, buffer, false) == 0)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int FindEntityByClassnameWithin(int startEnt, const char[] classname, const float[3] origin, const float radius){ //Tested. Works properly.
|
||||
float torigin[3];
|
||||
while((startEnt = FindEntityByClassname(startEnt,classname))!= -1){
|
||||
GetOrigin(startEnt, torigin);
|
||||
if (GetVectorDistance(torigin, origin) <= radius)return startEnt;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public float TraceLine(const float[3] origin, const float[3] v2, int entity){ //Tested. Works properly
|
||||
Handle trace = TR_TraceRayFilterEx(origin, v2, CONTENTS_SOLID, RayType_EndPoint, TraceEntityFilterSelf, entity);
|
||||
float pos[3], dist = 1.0;
|
||||
if(TR_DidHit(trace)){
|
||||
TR_GetEndPosition(pos, trace);
|
||||
dist = GetVectorDistance(origin, pos)/GetVectorDistance(origin, v2);
|
||||
}
|
||||
CloseHandle(trace);
|
||||
return dist;
|
||||
}
|
||||
|
||||
public bool TraceEntityFilterSelf(int entity, int contentsMask, any data)
|
||||
{
|
||||
return (data != entity && entity > 64);
|
||||
}
|
||||
|
||||
public void GetOrigin(int entity, float[3] buffer){ //Tested. Works properly.
|
||||
if(IsValidEntity(entity))
|
||||
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", buffer);
|
||||
}
|
||||
|
||||
public void GetAngles(int entity, float[3] buffer){ //Gives you wrong values after spawn it via env_entity_maker
|
||||
if(IsValidEntity(entity))
|
||||
GetEntPropVector(entity, Prop_Send, "m_angRotation", buffer);
|
||||
}
|
||||
|
||||
public void SetAngles(int entity, const float[3] buffer){ //Tested. Works properly.
|
||||
if(IsValidEntity(entity))
|
||||
TeleportEntity(entity, NULL_VECTOR, buffer, NULL_VECTOR);
|
||||
}
|
||||
|
||||
public void SetOrigin(int entity, const float[3] buffer){ //Tested. Works properly.
|
||||
if(IsValidEntity(entity))
|
||||
TeleportEntity(entity, buffer, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
public void GetForwardVector(int entity, float[3] buffer) //Tested. Works properly.
|
||||
{
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
float tmp[3];
|
||||
GetAngles(entity, tmp);
|
||||
GetAngleVectors(tmp, buffer, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetForwardVector(int entity, const float[3] buffer) //Tested. Works properly.
|
||||
{
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
float tmp[3];
|
||||
//GetAngles(entity, tmp);
|
||||
//tmp[0] = RadToDeg(-ArcSine(buffer[2]));
|
||||
//tmp[1] = RadToDeg(ArcTangent2(buffer[1], buffer[0]));
|
||||
GetVectorAngles(buffer, tmp);
|
||||
SetAngles(entity, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
public void EntFire(const char[] target, const char[] input, const char[] parametr, const char[] delay, int activator){ //Tested. Works properly.
|
||||
char output[500];
|
||||
int tmp = CreateEntityByName("info_target");
|
||||
Format(output, sizeof(output), "OnUser1 %s:%s:%s:%s", target, input, parametr, delay);
|
||||
SetVariantString(output);
|
||||
AcceptEntityInput(tmp, "AddOutput");
|
||||
AcceptEntityInput(tmp, "FireUser1", activator);
|
||||
AcceptEntityInput(tmp, "Kill");
|
||||
}
|
||||
|
||||
public void EntFireByIndex(int target, const char[] input, const char[] parametr, const char[] delay, int activator){ //Tested. Works properly.
|
||||
if(!IsValidEntity(target))
|
||||
return;
|
||||
float fDelay = StringToFloat(delay);
|
||||
DataPack data = CreateDataPack();
|
||||
data.WriteString(input);
|
||||
data.WriteString(parametr);
|
||||
data.WriteCell(activator);
|
||||
data.WriteCell(EntIndexToEntRef(target));
|
||||
CreateTimer(fDelay, InputDelay, data, TIMER_DATA_HNDL_CLOSE|TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
public Action InputDelay(Handle timer, DataPack data)
|
||||
{
|
||||
char input[250], parametr[250];
|
||||
data.Reset();
|
||||
data.ReadString(input, sizeof(input));
|
||||
data.ReadString(parametr, sizeof(parametr));
|
||||
int activator = data.ReadCell();
|
||||
int target = EntRefToEntIndex(data.ReadCell());
|
||||
data.Reset(true);
|
||||
if(IsValidEntity(target))
|
||||
{
|
||||
SetVariantString(parametr);
|
||||
AcceptEntityInput(target, input, activator);
|
||||
}
|
||||
}
|
568
VScripts/scripting/include/vscripts/Aesthetic.inc
Normal file
568
VScripts/scripting/include/vscripts/Aesthetic.inc
Normal file
@ -0,0 +1,568 @@
|
||||
/*
|
||||
**
|
||||
*/
|
||||
#if defined _AESTHETIC_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _AESTHETIC_included
|
||||
#include <basic>
|
||||
#include <vscripts>
|
||||
#define CELL_SIZE 128.0
|
||||
|
||||
methodmap Chess < Basic
|
||||
{
|
||||
public Chess(int greenStart, int greenEnd, int purpleStart, int purpleEnd)
|
||||
{
|
||||
Basic myclass = new Basic();
|
||||
myclass.SetFloat("fGreenX", 2.0);
|
||||
myclass.SetFloat("fGreenY", 6.0);
|
||||
myclass.SetFloat("fPurpleX", 4.0);
|
||||
myclass.SetFloat("fPurpleY", 1.0);
|
||||
myclass.SetInt("iGreenStart", greenStart);
|
||||
myclass.SetInt("iGreenEnd", greenEnd);
|
||||
myclass.SetInt("iPurpleStart", purpleStart);
|
||||
myclass.SetInt("iPurpleEnd", purpleEnd);
|
||||
myclass.SetBool("bDead", false);
|
||||
return view_as<Chess>(myclass);
|
||||
}
|
||||
|
||||
property bool bDead
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetBool("bDead");
|
||||
}
|
||||
public set(bool val)
|
||||
{
|
||||
this.SetBool("bDead", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float greenX
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fGreenX");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fGreenX", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float greenY
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fGreenY");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fGreenY", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float purpleX
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fPurpleX");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fPurpleX", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float purpleY
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fPurpleY");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fPurpleY", val);
|
||||
}
|
||||
}
|
||||
|
||||
property int greenStart
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iGreenStart");
|
||||
}
|
||||
}
|
||||
|
||||
property int greenEnd
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iGreenEnd");
|
||||
}
|
||||
}
|
||||
|
||||
property int purpleStart
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iPurpleStart");
|
||||
}
|
||||
}
|
||||
|
||||
property int purpleEnd
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iPurpleEnd");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Check(float x, float y)
|
||||
{
|
||||
return (-1.0 < x && x < 8.0 && -1.0 < y && y < 8.0 && !((x == this.greenX && y == this.greenY) || (x == this.purpleX && y == this.purpleY)));
|
||||
}
|
||||
|
||||
public void UpdateGreen(float dx, float dy)
|
||||
{
|
||||
this.greenX += dx;
|
||||
this.greenY += dy;
|
||||
}
|
||||
|
||||
public void UpdateGreenEnd(float dx, float dy)
|
||||
{
|
||||
float currentPos[3];
|
||||
GetOrigin(this.greenEnd, currentPos);
|
||||
float moveVector[3] = { 0.0, ... };
|
||||
moveVector[0] = dx * CELL_SIZE;
|
||||
moveVector[1] = dy * CELL_SIZE;
|
||||
float tmp[3];
|
||||
AddVectors(currentPos, moveVector, tmp);
|
||||
SetOrigin(this.greenEnd, tmp);
|
||||
}
|
||||
|
||||
public void MoveGreen(float dx, float dy)
|
||||
{
|
||||
if (this.Check(this.greenX + dx, this.greenY + dy))
|
||||
{
|
||||
this.UpdateGreen(dx, dy);
|
||||
this.UpdateGreenEnd(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveStartToEnd(int start, int end)
|
||||
{
|
||||
float e_Orig[3];
|
||||
GetOrigin(end, e_Orig);
|
||||
SetOrigin(start, e_Orig);
|
||||
}
|
||||
|
||||
public void UpdatePurple(float dx, float dy)
|
||||
{
|
||||
this.purpleX += dx;
|
||||
this.purpleY += dy;
|
||||
}
|
||||
|
||||
public void UpdatePurpleEnd(float dx, float dy)
|
||||
{
|
||||
float currentPos[3];
|
||||
GetOrigin(this.purpleEnd, currentPos);
|
||||
float moveVector[3] = { 0.0, ... };
|
||||
moveVector[0] = dx * CELL_SIZE;
|
||||
moveVector[1] = dy * CELL_SIZE;
|
||||
float tmp[3];
|
||||
AddVectors(currentPos, moveVector, tmp);
|
||||
SetOrigin(this.purpleEnd, tmp);
|
||||
}
|
||||
|
||||
public void MovePurple(float dx, float dy)
|
||||
{
|
||||
if (this.Check(this.purpleX + dx, this.purpleY + dy))
|
||||
{
|
||||
this.UpdatePurple(dx, dy);
|
||||
this.UpdatePurpleEnd(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckInLove()
|
||||
{
|
||||
if(this.bDead)
|
||||
return;
|
||||
float dx = this.greenX - this.purpleX;
|
||||
float dy = this.greenY - this.purpleY;
|
||||
if (dx < 0.0) dx *= -1.0;
|
||||
if (dy < 0.0) dy *= -1.0;
|
||||
if (dx + dy == 1.0)
|
||||
{
|
||||
this.bDead = true;
|
||||
EntFire("TotalTrigger", "FireUser2", "", "0.0", -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int DEFAULT_RETARGET_TICKS = 200;
|
||||
const float DEFAULT_MAX_VEL = 16.0;
|
||||
const float DEFAULT_MAX_ACC = 0.1;
|
||||
const float DEFAULT_RANGE = 100000.0;
|
||||
const float DEFAULT_PER_FRAME_MAX_VEL_DELTA = 0.0003333; // 2.0 / (120.0 * 50.0);
|
||||
const float DEFAULT_PER_FRAME_MAX_ACC_DELTA = 0.0000125; // 0.075 / (120.0 * 50.0);
|
||||
#define PI 3.14159
|
||||
|
||||
public bool SphereCollideWithWorld(const float[3] orig, const float radius, float degree, float[3] buffer, int entity)
|
||||
{
|
||||
|
||||
float inc = PI / degree;
|
||||
float phiStop = PI - inc;
|
||||
|
||||
float minDist = 1.0;
|
||||
for (float phi = 0.0; phi < PI; phi += inc)
|
||||
{
|
||||
// Avoid computing the full circle on the edge cases
|
||||
float theta = 0.0;
|
||||
if (phi == 0.0 || phi == phiStop)
|
||||
theta = PI - inc;
|
||||
|
||||
float cp = Cosine(phi);
|
||||
float sp = Sine(phi);
|
||||
for (; theta < 2 * PI; theta += inc)
|
||||
{
|
||||
float ct = Cosine(theta);
|
||||
float st = Sine(theta);
|
||||
float vec[3];
|
||||
vec[0] = ct * sp;
|
||||
vec[1] = st * sp;
|
||||
vec[2] = cp;
|
||||
ScaleVector(vec, radius);
|
||||
|
||||
float end[3];
|
||||
AddVectors(orig, vec, end);
|
||||
float dist = TraceLine(orig, end, entity);
|
||||
if ( 0 < dist && dist < minDist)
|
||||
{
|
||||
ScaleVector(vec, dist);
|
||||
AddVectors(orig, vec, buffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
methodmap Eye < Basic
|
||||
{
|
||||
public Eye(int entity)
|
||||
{
|
||||
Basic myclass = new Basic();
|
||||
myclass.SetInt("iEntity", entity);
|
||||
myclass.SetInt("iTarget", -1);
|
||||
myclass.SetFloat("fBossRadius", 72.0);
|
||||
myclass.SetInt("iBossTeamTarget", 3);
|
||||
myclass.SetInt("iRetargetTicks", 0);
|
||||
myclass.SetFloat("fMaxVel", DEFAULT_MAX_VEL);
|
||||
myclass.SetFloat("fMaxAcc", DEFAULT_MAX_ACC);
|
||||
myclass.SetVector("vVec", { 0.0, 0.0, 0.0 } );
|
||||
myclass.SetVector("vAcc", { 0.0, 0.0, 0.0 } );
|
||||
myclass.SetFloat("fSavedVel", 0.0);
|
||||
myclass.SetFloat("fSavedAcc", 0.0);
|
||||
return view_as<Eye>(myclass);
|
||||
}
|
||||
|
||||
property int entity
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iEntity");
|
||||
}
|
||||
}
|
||||
|
||||
property int target
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iTarget");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iTarget", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float bossRadius
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fBossRadius");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fBossRadius", val);
|
||||
}
|
||||
}
|
||||
|
||||
property int bossTeamTarget
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iBossTeamTarget");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iBossTeamTarget", val);
|
||||
}
|
||||
}
|
||||
|
||||
property int retargetTicks
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iRetargetTicks");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iRetargetTicks", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float maxVel
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fMaxVel");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fMaxVel", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float maxAcc
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fMaxAcc");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fMaxAcc", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float savedVel
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fSavedVel");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fSavedVel", val);
|
||||
}
|
||||
}
|
||||
|
||||
property float savedAcc
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fSavedAcc");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fSavedAcc", val);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetVel(float[3] vel)
|
||||
{
|
||||
this.GetVector("vVel", vel);
|
||||
}
|
||||
|
||||
public void SetVel(const float[3] vel)
|
||||
{
|
||||
this.SetVector("vVel", vel);
|
||||
}
|
||||
|
||||
public void GetAcc(float[3] acc)
|
||||
{
|
||||
this.GetVector("vAcc", acc);
|
||||
}
|
||||
|
||||
public void SetAcc(const float[3] acc)
|
||||
{
|
||||
this.SetVector("vAcc", acc);
|
||||
}
|
||||
|
||||
public void Retarget()
|
||||
{
|
||||
|
||||
// Start the gig
|
||||
this.retargetTicks = 0;
|
||||
int tempPlayer = -1;
|
||||
int currentPlayer = -1;
|
||||
int checkedPlayers = 0;
|
||||
float distance = DEFAULT_RANGE;
|
||||
|
||||
// While there is no target or
|
||||
// players found as potential targets aren't humans
|
||||
while (checkedPlayers < MaxClients) {
|
||||
currentPlayer = FindEntityByClassname(currentPlayer, "player");
|
||||
|
||||
// Only humans are valid
|
||||
if(currentPlayer != -1 &&
|
||||
IsPlayerAlive(currentPlayer) &&
|
||||
GetClientTeam(currentPlayer) == this.bossTeamTarget)
|
||||
{
|
||||
float tmp[3], s_orig[3], p_orig[3];
|
||||
GetOrigin(this.entity, s_orig);
|
||||
GetOrigin(currentPlayer, p_orig);
|
||||
SubtractVectors(s_orig, p_orig, tmp);
|
||||
float length = GetVectorLength(tmp);
|
||||
|
||||
// Make sure we're close enough
|
||||
if (length < distance)
|
||||
{
|
||||
tempPlayer = currentPlayer;
|
||||
distance = length;
|
||||
}
|
||||
}
|
||||
// Make sure we don't stay here forever
|
||||
checkedPlayers++;
|
||||
}
|
||||
|
||||
// Try the last bet if no player was found
|
||||
this.target = tempPlayer;
|
||||
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
// Save the values
|
||||
this.savedVel = this.maxVel;
|
||||
this.savedAcc = this.maxAcc;
|
||||
|
||||
// Block movement (with a bit of velocity to avoid spinning)
|
||||
this.maxVel = 0.01;
|
||||
this.maxAcc = 0.0001;
|
||||
}
|
||||
|
||||
public void AllowMovement()
|
||||
{
|
||||
// Set either default or saved vals
|
||||
if (this.savedVel == 0.0) this.maxVel = DEFAULT_MAX_VEL;
|
||||
else this.maxVel = this.savedVel;
|
||||
|
||||
if (this.savedAcc == 0.0) this.maxAcc = DEFAULT_MAX_ACC;
|
||||
else this.maxAcc = this.savedAcc;
|
||||
|
||||
// Reset saved values
|
||||
this.savedVel = 0.0;
|
||||
this.savedAcc = 0.0;
|
||||
}
|
||||
|
||||
public void FakePhysicsMovement()
|
||||
{
|
||||
|
||||
// Get the center and end point
|
||||
float cnt[3];
|
||||
GetOrigin(this.entity, cnt);
|
||||
|
||||
// Make the boss face the target
|
||||
float tmp[3];
|
||||
this.GetVel(tmp);
|
||||
SetForwardVector(this.entity, tmp);
|
||||
|
||||
// If there is an impact, bounce
|
||||
float collPoint[3];
|
||||
if (SphereCollideWithWorld(cnt, this.bossRadius, 5.0, collPoint, this.entity))
|
||||
{
|
||||
|
||||
float vec[3];
|
||||
SubtractVectors(cnt, collPoint, vec);
|
||||
float norm[3], norm_copy[3];
|
||||
NormalizeVector(vec, norm);
|
||||
norm_copy[0] = norm[0];
|
||||
norm_copy[1] = norm[1];
|
||||
norm_copy[2] = norm[2];
|
||||
// Reflect velocity in a hacky way (not plane-accurate)
|
||||
float nn[3];
|
||||
NormalizeVector(norm, nn);
|
||||
this.GetVel(tmp);
|
||||
float dot = GetVectorDotProduct(tmp, nn);
|
||||
ScaleVector(norm_copy, 2 * dot);
|
||||
SubtractVectors(tmp, norm_copy, tmp);
|
||||
this.SetVel(tmp);
|
||||
EntFireByIndex(this.entity, "FireUser1", "", "0.0", this.target);
|
||||
// Move as far as we can
|
||||
ScaleVector(norm, this.bossRadius);
|
||||
AddVectors(cnt, norm, tmp);
|
||||
SetOrigin(this.entity, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
this.GetVel(tmp);
|
||||
AddVectors(cnt, tmp, tmp);
|
||||
SetOrigin(this.entity, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
|
||||
// If there is no target or the target is gone/dead, retarget
|
||||
if (this.target == -1 ||
|
||||
!IsValidEntity(this.target) ||
|
||||
!IsPlayerAlive(this.target) ||
|
||||
this.retargetTicks++ >= DEFAULT_RETARGET_TICKS) this.Retarget();
|
||||
|
||||
// Perform the update with the data from the previous moment
|
||||
float vel[3], tmp[3], acc[3];
|
||||
this.GetVel(vel);
|
||||
this.GetAcc(acc);
|
||||
AddVectors(vel, acc, tmp);
|
||||
this.SetVel(tmp);
|
||||
float length = GetVectorLength(tmp);
|
||||
if (length > this.maxVel)
|
||||
{
|
||||
ScaleVector(tmp, this.maxVel / length);
|
||||
this.SetVel(tmp);
|
||||
}
|
||||
this.SetAcc( { 0.0, 0.0, 0.0 } );
|
||||
|
||||
// Apply the higher accuracy movement deltas
|
||||
this.maxVel += DEFAULT_PER_FRAME_MAX_VEL_DELTA;
|
||||
this.maxAcc += DEFAULT_PER_FRAME_MAX_ACC_DELTA;
|
||||
|
||||
// Try to move, finally
|
||||
this.FakePhysicsMovement();
|
||||
|
||||
// Keep going if no target's there still
|
||||
if (this.target == -1) return;
|
||||
|
||||
// Try moving towards our target if it exists, otherwise don't
|
||||
|
||||
float tgtPos[3];
|
||||
GetOrigin(this.target, tgtPos);
|
||||
float bssPos[3];
|
||||
GetOrigin(this.entity, bssPos);
|
||||
float dir[3];
|
||||
SubtractVectors(tgtPos, bssPos, dir);
|
||||
|
||||
// Compute the length for later and normalize it if needed
|
||||
|
||||
length = GetVectorLength(dir);
|
||||
if (length > this.maxVel)
|
||||
ScaleVector(dir, this.maxVel / length);
|
||||
|
||||
// Compute the acceleration
|
||||
|
||||
this.GetVel(vel);
|
||||
SubtractVectors(dir, vel, acc);
|
||||
length = GetVectorLength(acc);
|
||||
if (length > this.maxAcc)
|
||||
{
|
||||
ScaleVector(acc, this.maxAcc / length);
|
||||
this.SetAcc(acc);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
1330
VScripts/scripting/include/vscripts/Fly.inc
Normal file
1330
VScripts/scripting/include/vscripts/Fly.inc
Normal file
File diff suppressed because it is too large
Load Diff
245
VScripts/scripting/include/vscripts/JJBA.inc
Normal file
245
VScripts/scripting/include/vscripts/JJBA.inc
Normal file
@ -0,0 +1,245 @@
|
||||
#if defined _JJBA_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _JJBA_included
|
||||
#include <basic>
|
||||
#include <vscripts>
|
||||
#include <float>
|
||||
|
||||
#define TICKRATE 0.1
|
||||
#define TARGET_DISTANCE 5000.0
|
||||
#define RETARGET_TIME 7.5
|
||||
#define SPEED_FORWARD 1.0
|
||||
#define SPEED_TURNING 0.5
|
||||
|
||||
stock float FloatMod(float num, float denom)
|
||||
{
|
||||
return num - denom * RoundToFloor(num / denom);
|
||||
}
|
||||
|
||||
stock float operator%(float oper1, float oper2)
|
||||
{
|
||||
return FloatMod(oper1, oper2);
|
||||
}
|
||||
|
||||
public bool IsValidPlayer(int player)
|
||||
{
|
||||
return player >= 1 && player <= 64 && IsValidEntity(player) && IsPlayerAlive(player);
|
||||
}
|
||||
|
||||
public float GetDistance(const float[3] v1, const float[3] v2)
|
||||
{
|
||||
return SquareRoot((v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]) + (v1[2] - v2[2]) * (v1[2] - v2[2]));
|
||||
}
|
||||
|
||||
methodmap MovingNpc < Basic
|
||||
{
|
||||
public MovingNpc(int entity)
|
||||
{
|
||||
Basic myclass = new Basic();
|
||||
myclass.SetInt("iEntity", entity);
|
||||
myclass.SetInt("iTarget", -1);
|
||||
myclass.SetInt("iTf", -1);
|
||||
myclass.SetInt("iTs", -1);
|
||||
myclass.SetFloat("fTtime", 0.0);
|
||||
myclass.SetBool("bTicking", false);
|
||||
return view_as<MovingNpc>(myclass);
|
||||
}
|
||||
property int entity
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iEntity");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iEntity", val);
|
||||
}
|
||||
}
|
||||
property int target
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iTarget");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iTarget", val);
|
||||
}
|
||||
}
|
||||
property int tf
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iTf");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iTf", val);
|
||||
}
|
||||
}
|
||||
property int ts
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetInt("iTs");
|
||||
}
|
||||
public set(int val)
|
||||
{
|
||||
this.SetInt("iTs", val);
|
||||
}
|
||||
}
|
||||
property float ttime
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetFloat("fTtime");
|
||||
}
|
||||
public set(float val)
|
||||
{
|
||||
this.SetFloat("fTtime", val);
|
||||
}
|
||||
}
|
||||
property bool ticking
|
||||
{
|
||||
public get()
|
||||
{
|
||||
return this.GetBool("bTicking");
|
||||
}
|
||||
public set(bool val)
|
||||
{
|
||||
this.SetBool("bTicking", val);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
if(!this.ticking)
|
||||
{
|
||||
this.ticking = true;
|
||||
CreateTimer(TICKRATE, Tick_Cb, this, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if(this.ticking)
|
||||
{
|
||||
this.ticking = false;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetTargetYaw(const float[3] start, const float[3] target)
|
||||
{
|
||||
|
||||
float yaw = 0.00;
|
||||
float v[3];
|
||||
SubtractVectors(start, target, v);
|
||||
float vl = SquareRoot(v[0] * v[0] + v[1] * v[1]);
|
||||
yaw = 180.0 * ArcCosine(v[0] / vl) / 3.14159;
|
||||
if (v[1] < 0.0)
|
||||
yaw = -yaw;
|
||||
|
||||
return yaw;
|
||||
}
|
||||
|
||||
public void SetThruster(bool fwd, int caller)
|
||||
{
|
||||
if(fwd)
|
||||
this.tf = caller;
|
||||
else
|
||||
this.ts = caller;
|
||||
}
|
||||
|
||||
public void SearchTarget()
|
||||
{
|
||||
|
||||
this.ttime = 0.00;
|
||||
this.target = -1;
|
||||
int h = -1;
|
||||
ArrayList candidates = new ArrayList();
|
||||
float orig[3];
|
||||
GetOrigin(this.entity, orig);
|
||||
while (-1 != (h = FindEntityByClassnameWithin(h, "player", orig, TARGET_DISTANCE)))
|
||||
{
|
||||
//check if target is a valid player + CT team(3) + health above 0 (not dead)
|
||||
if (GetClientTeam(h) == 3 && IsPlayerAlive(h))
|
||||
{
|
||||
//check if the target is in sight of the npc (this physbox origin+48 height)
|
||||
float t_orig[3];
|
||||
GetOrigin(this.entity, orig);
|
||||
orig[2] += 40.0;
|
||||
GetOrigin(h, t_orig);
|
||||
t_orig[2] += 48.0;
|
||||
if (TraceLine(orig, t_orig, this.entity) == 1.00)
|
||||
candidates.Push(h); //if everything required is OK, add the target to the list of candidates
|
||||
}
|
||||
}
|
||||
if(candidates.Length == 0)
|
||||
{
|
||||
delete candidates;
|
||||
return;
|
||||
}
|
||||
this.target = candidates.Get(GetRandomInt(0, candidates.Length - 1));
|
||||
|
||||
delete candidates;
|
||||
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
|
||||
EntFireByIndex(this.tf, "Deactivate", "", "0.00", -1);
|
||||
EntFireByIndex(this.ts, "Deactivate", "", "0.00", -1);
|
||||
if (!IsValidPlayer(this.target) || GetClientTeam(this.target) != 3 || this.ttime >= RETARGET_TIME)
|
||||
{
|
||||
this.SearchTarget();
|
||||
}
|
||||
this.ttime+=TICKRATE;
|
||||
EntFireByIndex(this.tf, "Activate", "", "0.02", -1);
|
||||
EntFireByIndex(this.ts, "Activate", "", "0.02", -1);
|
||||
float angl[3], s_orig[3], t_orig[3];
|
||||
GetAngles(this.entity, angl);
|
||||
float sa = angl[1];
|
||||
GetOrigin(this.entity, s_orig);
|
||||
GetOrigin(this.target, t_orig);
|
||||
float ta = this.GetTargetYaw(s_orig, t_orig);
|
||||
float ang = FloatAbs((sa - ta + 360.0) % 360.0);
|
||||
if (ang >= 180.0)
|
||||
EntFireByIndex(this.ts, "AddOutput", "angles 0 270 0", "0.00", -1);
|
||||
else
|
||||
EntFireByIndex(this.ts, "AddOutput", "angles 0 90 0", "0.00", -1);
|
||||
float angdif = (sa - ta - 180.0);
|
||||
while (angdif > 360.0) { angdif -= 180.0; }
|
||||
while (angdif < -180.0) { angdif += 360.0; }
|
||||
angdif = FloatAbs(angdif);
|
||||
GetOrigin(this.entity, s_orig);
|
||||
GetOrigin(this.target, t_orig);
|
||||
//float tdist = GetDistance(s_orig, t_orig);
|
||||
//float tdistz = (t_orig[2] - s_orig[2]);
|
||||
char input[128];
|
||||
Format(input, sizeof(input), "force %.4f", 3000.0 * SPEED_FORWARD);
|
||||
EntFireByIndex(this.tf, "AddOutput", input, "0.00", -1);
|
||||
Format(input, sizeof(input), "force %.4f", (3.0 * SPEED_TURNING) * angdif);
|
||||
EntFireByIndex(this.ts, "AddOutput", input, "0.00", -1);
|
||||
CreateTimer(TICKRATE, Tick_Cb, this, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
public Action Tick_Cb(Handle timer, MovingNpc npc)
|
||||
{
|
||||
KillTimer(timer);
|
||||
if(npc.ticking)
|
||||
{
|
||||
|
||||
npc.Tick();
|
||||
}
|
||||
else
|
||||
{
|
||||
EntFireByIndex(npc.tf, "Deactivate", "", "0.00", -1);
|
||||
EntFireByIndex(npc.ts, "Deactivate", "", "0.00", -1);
|
||||
delete npc;
|
||||
}
|
||||
return Plugin_Stop;
|
||||
}
|
405
VScripts/scripting/vscript_Aesthetic.sp
Normal file
405
VScripts/scripting/vscript_Aesthetic.sp
Normal file
@ -0,0 +1,405 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#define PLUGIN_AUTHOR "Cloud Strife"
|
||||
#define PLUGIN_VERSION "1.00"
|
||||
#define MAP_NAME "ze_a_e_s_t_h_e_t_i_c_v1_1s"
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <vscripts/Aesthetic>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
bool bValidMap = false;
|
||||
Chess g_Chess = null;
|
||||
ArrayList g_aEyes = null;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Aesthetic vscripts",
|
||||
author = PLUGIN_AUTHOR,
|
||||
description = "",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "https://steamcommunity.com/id/cloudstrifeua/"
|
||||
};
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
char sCurMap[256];
|
||||
GetCurrentMap(sCurMap, sizeof(sCurMap));
|
||||
bValidMap = (strcmp(sCurMap, MAP_NAME, false) == 0);
|
||||
if(bValidMap)
|
||||
{
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
|
||||
HookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy);
|
||||
g_aEyes = new ArrayList();
|
||||
}
|
||||
else
|
||||
{
|
||||
char sFilename[256];
|
||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
||||
|
||||
ServerCommand("sm plugins unload %s", sFilename);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRoundStart(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
g_Chess = new Chess(GetEntityIndexByName("GreenStart", "path_track"), GetEntityIndexByName("GreenEnd", "path_track"),
|
||||
GetEntityIndexByName("PurpleStart", "path_track"), GetEntityIndexByName("PurpleEnd", "path_track"));
|
||||
int tmp = GetEntityIndexByName("GreenEnd", "path_track");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPass", OnGreenEndPass);
|
||||
tmp = GetEntityIndexByName("PurpleEnd", "path_track");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPass", OnPurpleEndPass);
|
||||
tmp = GetEntityIndexByHammerID(92835, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton1);
|
||||
tmp = GetEntityIndexByHammerID(92838, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton2);
|
||||
tmp = GetEntityIndexByHammerID(92841, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton3);
|
||||
tmp = GetEntityIndexByHammerID(92844, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton4);
|
||||
tmp = GetEntityIndexByHammerID(92850, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton5);
|
||||
tmp = GetEntityIndexByHammerID(92847, "func_button");
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton6);
|
||||
tmp = GetEntityIndexByHammerID(92853, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton7);
|
||||
tmp = GetEntityIndexByHammerID(92856, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPurpleButton8);
|
||||
tmp = GetEntityIndexByHammerID(92013, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton1);
|
||||
tmp = GetEntityIndexByHammerID(92084, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton2);
|
||||
tmp = GetEntityIndexByHammerID(91906, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton3);
|
||||
tmp = GetEntityIndexByHammerID(92081, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton4);
|
||||
tmp = GetEntityIndexByHammerID(92016, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton5);
|
||||
tmp = GetEntityIndexByHammerID(92075, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton6);
|
||||
tmp = GetEntityIndexByHammerID(89814, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton7);
|
||||
tmp = GetEntityIndexByHammerID(92046, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnGreenButton8);
|
||||
tmp = GetEntityIndexByHammerID(89040, "func_button");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnPressed", OnPressedTrig, true);
|
||||
tmp = GetEntityIndexByHammerID(490936, "trigger_push");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger);
|
||||
tmp = GetEntityIndexByHammerID(445713, "trigger_push");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnStartTouch", OnPushTrigger2);
|
||||
}
|
||||
|
||||
public void OnPushTrigger2(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
|
||||
float tmp[3];
|
||||
GetOrigin(activator, tmp);
|
||||
tmp[2] += 2.0;
|
||||
SetOrigin(activator, tmp);
|
||||
}
|
||||
|
||||
public void OnPushTrigger(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
|
||||
float tmp[3];
|
||||
GetOrigin(activator, tmp);
|
||||
tmp[2] += 4.0;
|
||||
SetOrigin(activator, tmp);
|
||||
}
|
||||
|
||||
public void OnPressedTrig(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
delete g_Chess;
|
||||
}
|
||||
|
||||
public void OnGreenButton8(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(-1.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton7(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(0.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton6(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(1.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton5(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(1.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton4(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton3(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton2(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(-1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenButton1(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveGreen(-1.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton8(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(-1.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton7(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(0.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton6(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(1.0, -1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton5(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(1.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton4(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton3(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton2(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(-1.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleButton1(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MovePurple(-1.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGreenEndPass(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveStartToEnd(g_Chess.greenStart, g_Chess.greenEnd);
|
||||
g_Chess.CheckInLove();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurpleEndPass(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Chess)
|
||||
{
|
||||
|
||||
g_Chess.MoveStartToEnd(g_Chess.purpleStart, g_Chess.purpleEnd);
|
||||
g_Chess.CheckInLove();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntitySpawned(int entity, const char[] classname)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
if(strcmp(classname, "func_breakable") == 0)
|
||||
{
|
||||
char sName[128];
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
|
||||
if(!sName[0])
|
||||
return;
|
||||
int pos = FindCharInString(sName, '&', true);
|
||||
if(pos != -1)
|
||||
{ sName[pos] = 0;
|
||||
if(strcmp(sName, "EyeBoss") == 0)
|
||||
{
|
||||
|
||||
Eye eye = new Eye(entity);
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnEyeMove);
|
||||
g_aEyes.Push(eye);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEyeMove(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
|
||||
for (int i = 0; i < g_aEyes.Length; i++)
|
||||
{
|
||||
Eye tmp = view_as<Eye>(g_aEyes.Get(i));
|
||||
if(tmp.entity == caller)
|
||||
{
|
||||
|
||||
tmp.Move();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityDestroyed(int entity)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
char sClassname[64];
|
||||
GetEntityClassname(entity, sClassname, sizeof(sClassname));
|
||||
if(strcmp(sClassname, "func_breakable") == 0)
|
||||
{
|
||||
char sName[128];
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
|
||||
if(!sName[0])
|
||||
return;
|
||||
if(StrContains(sName, "EyeBoss") != -1)
|
||||
{
|
||||
for (int i = 0; i < g_aEyes.Length; i++)
|
||||
{
|
||||
Eye tmp = view_as<Eye>(g_aEyes.Get(i));
|
||||
if(entity == tmp.entity)
|
||||
{
|
||||
|
||||
delete tmp;
|
||||
g_aEyes.Erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
|
||||
delete g_Chess;
|
||||
for (int i = 0; i < g_aEyes.Length; i++)
|
||||
{
|
||||
Eye tmp = view_as<Eye>(g_aEyes.Get(i));
|
||||
delete tmp;
|
||||
g_aEyes.Erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
public void OnMapEnd()
|
||||
{
|
||||
Cleanup();
|
||||
if(bValidMap)
|
||||
{
|
||||
UnhookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
|
||||
UnhookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy);
|
||||
}
|
||||
bValidMap = false;
|
||||
}
|
138
VScripts/scripting/vscript_JJBA.sp
Normal file
138
VScripts/scripting/vscript_JJBA.sp
Normal file
@ -0,0 +1,138 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#define PLUGIN_AUTHOR "Cloud Strife"
|
||||
#define PLUGIN_VERSION "1.00"
|
||||
#define MAP_NAME "ze_jjba_v5fs"
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <outputinfo>
|
||||
#include <vscripts/JJBA>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
bool bValidMap = false;
|
||||
ArrayList g_aMovingNpc;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "JJBA vscripts",
|
||||
author = PLUGIN_AUTHOR,
|
||||
description = "JJBA vscripts",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "https://steamcommunity.com/id/cloudstrifeua/"
|
||||
};
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
char sCurMap[256];
|
||||
GetCurrentMap(sCurMap, sizeof(sCurMap));
|
||||
bValidMap = (strcmp(MAP_NAME, sCurMap, false) == 0);
|
||||
if(bValidMap)
|
||||
{
|
||||
g_aMovingNpc = new ArrayList();
|
||||
}
|
||||
else
|
||||
{
|
||||
char sFilename[256];
|
||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
||||
|
||||
ServerCommand("sm plugins unload %s", sFilename);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntitySpawned(int entity, const char[] classname)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
if(strcmp(classname, "phys_thruster") == 0)
|
||||
{
|
||||
char sTarget[128];
|
||||
GetOutputTarget(entity, "m_OnUser1", 0, sTarget, sizeof(sTarget));
|
||||
if(!sTarget[0])
|
||||
return;
|
||||
|
||||
if (StrContains(sTarget, "npc_physbox") != -1)
|
||||
{
|
||||
int ent = GetEntityIndexByName(sTarget, "func_physbox");
|
||||
MovingNpc npc = null;
|
||||
bool bAlreadyInList = false;
|
||||
for (int i = 0; i < g_aMovingNpc.Length; i++)
|
||||
{
|
||||
MovingNpc tmp = view_as<MovingNpc>(g_aMovingNpc.Get(i));
|
||||
if(tmp.entity == ent)
|
||||
{
|
||||
npc = tmp;
|
||||
bAlreadyInList = true;
|
||||
}
|
||||
}
|
||||
if(!bAlreadyInList)
|
||||
{
|
||||
npc = new MovingNpc(ent);
|
||||
}
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sTarget, sizeof(sTarget));
|
||||
if(StrContains(sTarget, "npc_thruster_forward") != -1)
|
||||
{
|
||||
npc.SetThruster(true, entity);
|
||||
}
|
||||
else if(StrContains(sTarget, "npc_thruster_side") != -1)
|
||||
{
|
||||
npc.SetThruster(false, entity);
|
||||
}
|
||||
|
||||
if(bAlreadyInList)
|
||||
{
|
||||
npc.Start();
|
||||
|
||||
}
|
||||
else
|
||||
g_aMovingNpc.Push(npc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityDestroyed(int entity)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
char sClassname[128];
|
||||
GetEntityClassname(entity, sClassname, sizeof(sClassname));
|
||||
if(strcmp(sClassname, "func_physbox") == 0)
|
||||
{
|
||||
for (int i = 0; i < g_aMovingNpc.Length; i++)
|
||||
{
|
||||
MovingNpc npc = view_as<MovingNpc>(g_aMovingNpc.Get(i));
|
||||
if(npc.entity == entity)
|
||||
{
|
||||
|
||||
npc.Stop();
|
||||
g_aMovingNpc.Erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnMapEnd()
|
||||
{
|
||||
if(bValidMap)
|
||||
{
|
||||
for (int i = 0; i < g_aMovingNpc.Length; i++)
|
||||
{
|
||||
MovingNpc npc = view_as<MovingNpc>(g_aMovingNpc.Get(i));
|
||||
npc.Stop();
|
||||
g_aMovingNpc.Erase(i);
|
||||
}
|
||||
delete g_aMovingNpc;
|
||||
}
|
||||
bValidMap = false;
|
||||
}
|
455
VScripts/scripting/vscript_Kitchen.sp
Normal file
455
VScripts/scripting/vscript_Kitchen.sp
Normal file
@ -0,0 +1,455 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#define PLUGIN_AUTHOR "Cloud Strife"
|
||||
#define PLUGIN_VERSION "1.00"
|
||||
#define MAP_NAME "ze_Kitchen_v2s"
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <vscripts/Fly>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
bool bValidMap = false;
|
||||
Fly g_Fly = null;
|
||||
Fly_End g_FlyEnd = null;
|
||||
//Fly_End_Hovno g_FlyEndHovno[5] = { null, ... };
|
||||
ArrayList g_aFlySmall = null;
|
||||
Microwave g_Microwave = null;
|
||||
StringMap g_iButton_players = null;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Kitchen vscripts",
|
||||
author = PLUGIN_AUTHOR,
|
||||
description = "",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "https://steamcommunity.com/id/cloudstrifeua/"
|
||||
};
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
|
||||
HookEvent("round_end", OnRoundEnd, EventHookMode_PostNoCopy);
|
||||
}
|
||||
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
|
||||
char sCurMap[256];
|
||||
GetCurrentMap(sCurMap, sizeof(sCurMap));
|
||||
bValidMap = (strcmp(sCurMap, MAP_NAME, false) == 0);
|
||||
if(bValidMap)
|
||||
{
|
||||
g_aFlySmall = new ArrayList();
|
||||
g_iButton_players = new StringMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
char sFilename[256];
|
||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
||||
|
||||
ServerCommand("sm plugins unload %s", sFilename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OnRoundStart(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
int tmp = GetEntityIndexByHammerID(1208341, "trigger_multiple");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnUser1", OnFlyStart, true);
|
||||
HookSingleEntityOutput(tmp, "OnUser2", OnAddFlyHP);
|
||||
HookSingleEntityOutput(tmp, "OnStartTouch", OnFlyInit, true);
|
||||
tmp = GetEntityIndexByHammerID(1564273, "prop_dynamic");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnUser1", OnFlyEndInit, true);
|
||||
tmp = GetEntityIndexByHammerID(1416995, "prop_dynamic");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnUser1", OnFlyDeadTrigger, true);
|
||||
tmp = GetEntityIndexByHammerID(1189814, "logic_relay");
|
||||
|
||||
HookSingleEntityOutput(tmp, "OnTrigger", OnMicrowaveInit, true);
|
||||
}
|
||||
|
||||
public void OnPlayerPickUp(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
char sButtonIndex[64];
|
||||
Format(sButtonIndex, sizeof(sButtonIndex), "%d", caller);
|
||||
g_iButton_players.SetValue(sButtonIndex, activator, true);
|
||||
|
||||
}
|
||||
|
||||
public void OnButtonPressed(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
char sButtonKey[64];
|
||||
Format(sButtonKey, sizeof(sButtonKey), "%d", caller);
|
||||
int val = -1;
|
||||
g_iButton_players.GetValue(sButtonKey, val);
|
||||
if(val == activator)
|
||||
{
|
||||
EntFireByIndex(caller, "FireUser1", "", "0.00", -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnMicrowaveInit(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int entity = GetEntityIndexByHammerID(1684029, "prop_dynamic");
|
||||
|
||||
g_Microwave = new Microwave(entity);
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser1", OnMicrowaveAddHP);
|
||||
HookSingleEntityOutput(entity, "OnTakeDamage", OnMicrowaveTakeDamage);
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnMicrowaveStart, true);
|
||||
HookSingleEntityOutput(entity, "OnUser3", OnMicrowaveLaserHit1);
|
||||
HookSingleEntityOutput(entity, "OnUser4", OnMicrowaveLaserHit2);
|
||||
}
|
||||
|
||||
public void OnMicrowaveLaserHit2(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Microwave)
|
||||
g_Microwave.Hit(80);
|
||||
|
||||
}
|
||||
|
||||
public void OnMicrowaveLaserHit1(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Microwave)
|
||||
{
|
||||
g_Microwave.Hit(70);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMicrowaveStart(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
CreateTimer(1.0, Microwave_StartDelay,_, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
public Action Microwave_StartDelay(Handle timer)
|
||||
{
|
||||
KillTimer(timer);
|
||||
g_Microwave.Start();
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
public void OnMicrowaveTakeDamage(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Microwave)
|
||||
{
|
||||
g_Microwave.Hit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMicrowaveAddHP(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
g_Microwave.AddHealth(200);
|
||||
|
||||
}
|
||||
|
||||
public void OnFlyDeadTrigger(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float orig[3], angles[3];
|
||||
GetOrigin(g_Fly.entity, orig);
|
||||
GetAngles(g_Fly.entity, angles);
|
||||
SetOrigin(caller, orig);
|
||||
SetAngles(caller, angles);
|
||||
g_Fly.KillFly();
|
||||
g_Fly = null;
|
||||
EntFireByIndex(caller, "SetAnimation", "dead", "0.0", -1);
|
||||
EntFireByIndex(caller, "SetAnimation", "dead_loop", "2.0", -1);
|
||||
|
||||
}
|
||||
|
||||
//public void OnFlyEndHovnoInit1(const char[] output, int caller, int activator, float delay)
|
||||
//{
|
||||
//g_FlyEndHovno[0] = new Fly_End_Hovno(caller);
|
||||
//g_FlyEndHovno[0].Start(1, false);
|
||||
//
|
||||
//}
|
||||
|
||||
//public void OnFlyEndHovnoInit2(const char[] output, int caller, int activator, float delay)
|
||||
//{
|
||||
//g_FlyEndHovno[1] = new Fly_End_Hovno(caller);
|
||||
//g_FlyEndHovno[1].Start(1, false);
|
||||
//
|
||||
//}
|
||||
|
||||
//public void OnFlyEndHovnoInit3(const char[] output, int caller, int activator, float delay)
|
||||
//{
|
||||
//g_FlyEndHovno[2] = new Fly_End_Hovno(caller);
|
||||
//g_FlyEndHovno[2].Start(1, false);
|
||||
//
|
||||
//}
|
||||
|
||||
//public void OnFlyEndHovnoInit4(const char[] output, int caller, int activator, float delay)
|
||||
//{
|
||||
//g_FlyEndHovno[3] = new Fly_End_Hovno(caller);
|
||||
//g_FlyEndHovno[3].Start(1, false);
|
||||
//
|
||||
//}
|
||||
|
||||
//public void OnFlyEndHovnoInit5(const char[] output, int caller, int activator, float delay)
|
||||
//{
|
||||
//g_FlyEndHovno[4] = new Fly_End_Hovno(caller);
|
||||
//g_FlyEndHovno[4].Start(1, false);
|
||||
//
|
||||
//}
|
||||
|
||||
public void OnFlyEndInit(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
g_FlyEnd = new Fly_End(caller);
|
||||
g_FlyEnd.Start();
|
||||
|
||||
}
|
||||
|
||||
public void OnFlyInit(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int fly = GetEntityIndexByHammerID(1199348, "prop_dynamic");
|
||||
|
||||
g_Fly = new Fly(fly);
|
||||
|
||||
HookSingleEntityOutput(fly, "OnUser1", OnChangeEggsCount);
|
||||
HookSingleEntityOutput(fly, "OnTakeDamage", OnFlyTakeDamage);
|
||||
}
|
||||
|
||||
public void OnFlyTakeDamage(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Fly)
|
||||
{
|
||||
g_Fly.Hit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnFlyStart(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
g_Fly.Start();
|
||||
|
||||
}
|
||||
|
||||
public void OnAddFlyHP(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
g_Fly.AddHealth(415);
|
||||
|
||||
}
|
||||
|
||||
public void OnChangeEggsCount(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if(g_Fly)
|
||||
{
|
||||
g_Fly.IncrementEggCount(-1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntitySpawned(int entity, const char[] classname)
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
if(IsValidEntity(entity))
|
||||
{
|
||||
if(strcmp(classname, "prop_dynamic") == 0)
|
||||
{
|
||||
char sName[128];
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
|
||||
if(!sName[0])
|
||||
return;
|
||||
if(StrContains(sName, "fly_small_model") != -1)
|
||||
{
|
||||
Fly_Small fly_small = new Fly_Small(entity);
|
||||
g_aFlySmall.Push(fly_small);
|
||||
if(StrContains(sName, "fly_small_model_map") != -1)
|
||||
{
|
||||
|
||||
CreateTimer(5.0, StartDelay, fly_small);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fly_small.Start();
|
||||
}
|
||||
HookSingleEntityOutput(entity, "OnUser1", OnFlySmallDie, true);
|
||||
}
|
||||
//else if(strcmp(sName, "1_fly_hovno") == 0)
|
||||
//{
|
||||
//
|
||||
//HookSingleEntityOutput(entity, "OnUser1", OnFlyEndHovnoInit1, true);
|
||||
//}
|
||||
//else if(strcmp(sName, "2_fly_hovno") == 0)
|
||||
//{
|
||||
//
|
||||
//HookSingleEntityOutput(entity, "OnUser1", OnFlyEndHovnoInit2, true);
|
||||
//}
|
||||
//else if(strcmp(sName, "3_fly_hovno") == 0)
|
||||
//{
|
||||
//
|
||||
//HookSingleEntityOutput(entity, "OnUser1", OnFlyEndHovnoInit3, true);
|
||||
//}
|
||||
//else if(strcmp(sName, "4_fly_hovno") == 0)
|
||||
//{
|
||||
//
|
||||
//HookSingleEntityOutput(entity, "OnUser1", OnFlyEndHovnoInit4, true);
|
||||
//}
|
||||
//else if(strcmp(sName, "5_fly_hovno") == 0)
|
||||
//{
|
||||
//
|
||||
//HookSingleEntityOutput(entity, "OnUser1", OnFlyEndHovnoInit5, true);
|
||||
//}
|
||||
}
|
||||
else if(strcmp(classname, "func_button") == 0)
|
||||
{
|
||||
char sName[128];
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
|
||||
if(!sName[0])
|
||||
return;
|
||||
if(StrContains(sName, "george_cades_syr_button") != -1)
|
||||
{
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnPlayerPickUp);
|
||||
HookSingleEntityOutput(entity, "OnPressed", OnButtonPressed);
|
||||
}
|
||||
else if(StrContains(sName, "george_cades_toast_button") != -1)
|
||||
{
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnPlayerPickUp);
|
||||
HookSingleEntityOutput(entity, "OnPressed", OnButtonPressed);
|
||||
}
|
||||
else if(StrContains(sName, "george_cades_sunka_button") != -1)
|
||||
{
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnPlayerPickUp);
|
||||
HookSingleEntityOutput(entity, "OnPressed", OnButtonPressed);
|
||||
}
|
||||
else if(StrContains(sName, "george_cades_korenka_button") != -1)
|
||||
{
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnPlayerPickUp);
|
||||
HookSingleEntityOutput(entity, "OnPressed", OnButtonPressed);
|
||||
}
|
||||
else if(StrContains(sName, "george_cades_houba_button") != -1)
|
||||
{
|
||||
|
||||
HookSingleEntityOutput(entity, "OnUser2", OnPlayerPickUp);
|
||||
HookSingleEntityOutput(entity, "OnPressed", OnButtonPressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Action StartDelay(Handle timer, Fly_Small fly)
|
||||
{
|
||||
KillTimer(timer);
|
||||
if(fly)
|
||||
{
|
||||
|
||||
fly.Start();
|
||||
}
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
public void OnFlySmallDie(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
for (int i = 0; i < g_aFlySmall.Length; i++)
|
||||
{
|
||||
Fly_Small fly = view_as<Fly_Small>(g_aFlySmall.Get(i));
|
||||
if(fly.entity == caller)
|
||||
{
|
||||
|
||||
fly.Die();
|
||||
g_aFlySmall.Erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityDestroyed(int entity)
|
||||
{
|
||||
if(!IsValidEntity(entity) || !bValidMap)
|
||||
return;
|
||||
char sClassname[64];
|
||||
GetEntityClassname(entity, sClassname, sizeof(sClassname));
|
||||
if(strcmp(sClassname, "prop_dynamic") == 0)
|
||||
{
|
||||
char sName[128];
|
||||
GetEntPropString(entity, Prop_Data, "m_iName", sName, sizeof(sName));
|
||||
if(!sName[0])
|
||||
return;
|
||||
if(StrContains(sName, "fly_small_model") != -1)
|
||||
{
|
||||
for (int i = 0; i < g_aFlySmall.Length; i++)
|
||||
{
|
||||
Fly_Small fly = view_as<Fly_Small>(g_aFlySmall.Get(i));
|
||||
if(fly.entity == entity)
|
||||
{
|
||||
|
||||
fly.doNextTick = false;
|
||||
g_aFlySmall.Erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(strcmp(sName, "mikrovlnka_model") == 0)
|
||||
{
|
||||
if(g_Microwave)
|
||||
{
|
||||
|
||||
delete g_Microwave;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
if(!bValidMap)
|
||||
return;
|
||||
|
||||
if(g_Microwave)
|
||||
delete g_Microwave;
|
||||
|
||||
if(g_Fly)
|
||||
{
|
||||
g_Fly.doNextTick = false;
|
||||
g_Fly = null;
|
||||
}
|
||||
if(g_FlyEnd)
|
||||
{
|
||||
g_FlyEnd.doNextTick = false;
|
||||
g_FlyEnd = null;
|
||||
}
|
||||
//for (int i = 0; i < 5; i++)
|
||||
//{
|
||||
//if(g_FlyEndHovno[i])
|
||||
//{
|
||||
//g_FlyEndHovno[i].doNextTick = false;
|
||||
//g_FlyEndHovno[i] = null;
|
||||
//}
|
||||
//}
|
||||
for (int i = 0; i < g_aFlySmall.Length; i++)
|
||||
{
|
||||
Fly_Small fly = view_as<Fly_Small>(g_aFlySmall.Get(i));
|
||||
fly.doNextTick = false;
|
||||
g_aFlySmall.Erase(i);
|
||||
}
|
||||
g_iButton_players.Clear();
|
||||
}
|
||||
|
||||
public void OnRoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
public void OnMapEnd()
|
||||
{
|
||||
Cleanup();
|
||||
if(bValidMap)
|
||||
{
|
||||
delete g_aFlySmall;
|
||||
delete g_iButton_players;
|
||||
}
|
||||
bValidMap = false;
|
||||
}
|
@ -41,7 +41,7 @@ public void VerifyMap()
|
||||
char sCurrentMap[64];
|
||||
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
|
||||
|
||||
if (strncmp(sCurrentMap, "ze_dreamin_", 11, false) != 0)
|
||||
if (strncmp(sCurrentMap, "ze_dreamin_v2", 13, false) != 0)
|
||||
{
|
||||
char sFilename[256];
|
||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
924
VScripts/scripting/vscript_ze_dreamin_v3.sp
Normal file
924
VScripts/scripting/vscript_ze_dreamin_v3.sp
Normal file
@ -0,0 +1,924 @@
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <multicolors>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "ze_dreamin VScript",
|
||||
author = "Neon",
|
||||
description = "",
|
||||
version = "1.0",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnPluginStart()
|
||||
{
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnMapStart()
|
||||
{
|
||||
VerifyMap();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void VerifyMap()
|
||||
{
|
||||
char sCurrentMap[64];
|
||||
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
|
||||
|
||||
if (strncmp(sCurrentMap, "ze_dreamin_v3", 12, false) != 0)
|
||||
{
|
||||
char sFilename[256];
|
||||
GetPluginFilename(INVALID_HANDLE, sFilename, sizeof(sFilename));
|
||||
|
||||
ServerCommand("sm plugins unload %s", sFilename);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("reflect_logic");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnFalse", st3_hitbox_reflect, false);
|
||||
|
||||
iEntity = FindEntityByTargetName("upline_timer");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnTimer", upline_maker_upline, false);
|
||||
|
||||
iEntity = FindEntityByTargetName("explo_timer");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnTimer", explo_maker_setan, false);
|
||||
|
||||
iEntity = FindEntityByTargetName("rtv_laser_timer");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnTimer", rtv_laser_timer, false);
|
||||
|
||||
iEntity = FindEntityByTargetName("rtv_th_timer");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnTimer", rtv_th_timer, false);
|
||||
|
||||
iEntity = FindEntityByTargetName("linelaser_random");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
HookSingleEntityOutput(iEntity, "OnCase01", linelaser_maker_left, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase02", linelaser_maker_right, false);
|
||||
}
|
||||
|
||||
iEntity = FindEntityByTargetName("case_1");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
HookSingleEntityOutput(iEntity, "OnCase01", sbomb_1_Case01, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase02", sbomb_1_Case02, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase03", sbomb_1_Case03, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase04", sbomb_1_Case04, false);
|
||||
}
|
||||
|
||||
iEntity = FindEntityByTargetName("case_2");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
HookSingleEntityOutput(iEntity, "OnCase01", sbomb_2_Case01, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase02", sbomb_2_Case02, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase03", sbomb_2_Case03, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase04", sbomb_2_Case04, false);
|
||||
}
|
||||
|
||||
iEntity = FindEntityByTargetName("case_3");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
HookSingleEntityOutput(iEntity, "OnCase01", sbomb_3_Case01, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase02", sbomb_3_Case02, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase03", sbomb_3_Case03, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase04", sbomb_3_Case04, false);
|
||||
}
|
||||
|
||||
iEntity = FindEntityByTargetName("totem_random");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
HookSingleEntityOutput(iEntity, "OnCase01", push_maker_setrandom, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase02", heal_maker_setrandom, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase03", stable_maker_setrandom, false);
|
||||
HookSingleEntityOutput(iEntity, "OnCase04", rotate_maker_setrandom, false);
|
||||
}
|
||||
|
||||
iEntity = FindEntityByTargetName("spike_timer");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnTimer", spike_maker_top, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(389450);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_389450_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(385777);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_385777_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(385886);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_385886_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(386004);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_386004_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(381463);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381463_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(381581);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381581_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(381648);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_381648_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(378212);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_378212_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(375007);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_375007_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(241061);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnPressed", func_button_241061_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(213033);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_213033_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(142829);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_142829_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(95608);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95608_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(95733);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95733_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(95823);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_95823_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(77927);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnPressed", func_button_77927_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(23408);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23408_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(23452);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23452_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(23474);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_23474_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(579052);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnStartTouch", trigger_once_579052_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(23551);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnBreak", func_breakable_23551_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(21950);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnPressed", func_button_21950_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(22017);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnPressed", func_button_22017_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(3664);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnBreak", func_breakable_3664_display, false);
|
||||
|
||||
iEntity = FindEntityByHammerID(11288);
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
HookSingleEntityOutput(iEntity, "OnHitMin", math_counter_11288_display, false);
|
||||
|
||||
CreateTimer(12.0, Credits, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Credits(Handle timer)
|
||||
{
|
||||
CPrintToChatAll("{pink}[VScripts] {white}Map using VScripts ported by Neon™");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void st3_hitbox_reflect(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
if (!IsValidClient(activator))
|
||||
return;
|
||||
|
||||
int iHealth = GetClientHealth(activator);
|
||||
|
||||
if(iHealth > 10)
|
||||
{
|
||||
SetEntityHealth(activator, iHealth - 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetEntityHealth(activator, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void upline_maker_upline(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(-1280.0, 1280.0);
|
||||
fOrigin[1] = GetRandomFloat(-1280.0, 1280.0);
|
||||
fOrigin[2] = -2780.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("upline_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void explo_maker_setan(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fAngles[3];
|
||||
fAngles[0] = 0.0;
|
||||
fAngles[1] = GetRandomFloat(0.0, 359.0);
|
||||
fAngles[2] = 0.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("explo_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, NULL_VECTOR, fAngles, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void linelaser_maker_left(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = 0.0;
|
||||
fOrigin[1] = GetRandomFloat(-640.0, 640.0);
|
||||
fOrigin[2] = -1780.0;
|
||||
|
||||
float fAngles[3];
|
||||
fAngles[0] = 0.0;
|
||||
fAngles[1] = 0.0;
|
||||
fAngles[2] = 0.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("linelaser_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void linelaser_maker_right(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = 0.0;
|
||||
fOrigin[1] = GetRandomFloat(-640.0, 640.0);
|
||||
fOrigin[2] = -1820.0;
|
||||
|
||||
float fAngles[3];
|
||||
fAngles[0] = 0.0;
|
||||
fAngles[1] = 90.0;
|
||||
fAngles[2] = 0.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("linelaser_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void push_maker_setrandom(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[1] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[2] = -2720.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("push_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void heal_maker_setrandom(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[1] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[2] = -2720.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("heal_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void stable_maker_setrandom(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[1] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[2] = -2720.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("stable_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void rotate_maker_setrandom(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[1] = GetRandomFloat(-768.0, 768.0);
|
||||
fOrigin[2] = -2720.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("rotate_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void spike_maker_top(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(12090.0, 14363.0);
|
||||
fOrigin[1] = GetRandomFloat(1280.0, 3560.0);
|
||||
fOrigin[2] = 1500.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("spike_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
AcceptEntityInput(iEntity, "ForceSpawn");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void rtv_laser_timer(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(6300.0, 8350.0);
|
||||
fOrigin[1] = GetRandomFloat(-1850.0, 220.0);
|
||||
fOrigin[2] = -610.0;
|
||||
|
||||
float fAngles[3];
|
||||
fAngles[0] = 0.0;
|
||||
fAngles[1] = GetRandomFloat(0.0, 359.0);
|
||||
fAngles[2] = 0.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("rtv_laser_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
TeleportEntity(iEntity, fOrigin, fAngles, NULL_VECTOR);
|
||||
AcceptEntityInput(iEntity, "ForceSpawn");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void rtv_th_timer(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
float fOrigin[3];
|
||||
fOrigin[0] = GetRandomFloat(6300.0, 8350.0);
|
||||
fOrigin[1] = GetRandomFloat(-1850.0, 220.0);
|
||||
fOrigin[2] = -610.0;
|
||||
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
|
||||
iEntity = FindEntityByTargetName("rtv_th_maker");
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
AcceptEntityInput(iEntity, "ForceSpawn");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_1_Case01(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_1");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_1_Case02(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_1");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, -300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_1_Case03(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_1");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, 300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_1_Case04(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_1");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, -300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_2_Case01(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_2");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_2_Case02(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_2");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, -300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_2_Case03(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_2");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, 300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_2_Case04(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_2");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, -300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_3_Case01(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_3");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_3_Case02(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_3");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, -300.0, 0.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_3_Case03(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_3");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, 300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void sbomb_3_Case04(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
iEntity = FindEntityByTargetName("sbomb_3");
|
||||
|
||||
if (iEntity != INVALID_ENT_REFERENCE)
|
||||
run(iEntity, 0.0, -300.0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_389450_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_385777_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_385886_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_386004_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_381463_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_381581_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_381648_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_378212_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_375007_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(15);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_button_241061_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_213033_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_142829_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_95608_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_95733_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_95823_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_button_77927_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_23408_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(35);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_23452_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_23474_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(25);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void trigger_once_579052_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_breakable_23551_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(20);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_button_21950_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(30);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_button_22017_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(10);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void func_breakable_3664_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(45);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void math_counter_11288_display(const char[] output, int caller, int activator, float delay)
|
||||
{
|
||||
Display(51);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void Display(int iTimer)
|
||||
{
|
||||
int iRelay = CreateEntityByName("logic_relay");
|
||||
DispatchKeyFormat(iRelay, "targetname", "vscript_countdown_relay");
|
||||
DispatchKeyFormat(iRelay, "spawnflags", "0");
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message seconds left,0,-1");
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,0,-1", iTimer - 1);
|
||||
|
||||
int iBackup = iTimer;
|
||||
for (int j = 0; j <= iTimer; j++)
|
||||
{
|
||||
iBackup--;
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message %d,%d,-1", iBackup, j);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,Display,,%d,-1", j);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,Display,,%d,-1", j);
|
||||
}
|
||||
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "seconds_left,AddOutput,message ,%d,-1", iTimer + 1);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "text_sec,AddOutput,message ,%d,-1", iTimer + 1);
|
||||
DispatchKeyFormat(iRelay, "OnSpawn", "!self,Kill,,%d,-1", iTimer + 2);
|
||||
SpawnAndActivate(iRelay);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void run(int iEntity, float fX1, float fY1)
|
||||
{
|
||||
float fOrigin[3];
|
||||
GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin);
|
||||
fOrigin[0] += fX1;
|
||||
fOrigin[1] += fY1;
|
||||
|
||||
if (fOrigin[0] > 8300.0 || fOrigin[1] > 150.0 || fOrigin[0] < -1800.0 || fOrigin[1] < -5194.0)
|
||||
{
|
||||
fOrigin[0] = 7312.0;
|
||||
fOrigin[1] = -816.0;
|
||||
fOrigin[2] = -634.0;
|
||||
}
|
||||
|
||||
TeleportEntity(iEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int FindEntityByTargetName(const char[] sTargetnameToFind)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
while((iEntity = FindEntityByClassname(iEntity, "*")) != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
char sTargetname[64];
|
||||
GetEntPropString(iEntity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname));
|
||||
|
||||
if (strcmp(sTargetnameToFind, sTargetname, false) == 0)
|
||||
{
|
||||
return iEntity;
|
||||
}
|
||||
}
|
||||
|
||||
PrintToChatAll("[VScripts] Error! Could not find entity: %s", sTargetnameToFind);
|
||||
return INVALID_ENT_REFERENCE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public int FindEntityByHammerID(int iHammerID)
|
||||
{
|
||||
int iEntity = INVALID_ENT_REFERENCE;
|
||||
while((iEntity = FindEntityByClassname(iEntity, "*")) != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
if(GetEntProp(iEntity, Prop_Data, "m_iHammerID") == iHammerID)
|
||||
{
|
||||
return iEntity;
|
||||
}
|
||||
}
|
||||
|
||||
PrintToChatAll("[VScripts] Error! Could not find entity: #%d", iHammerID);
|
||||
return INVALID_ENT_REFERENCE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock bool DispatchKeyFormat(int entity, const char[] key, const char[] value, any ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
VFormat(buffer, sizeof(buffer), value, 4);
|
||||
|
||||
DispatchKeyValue(entity, key, buffer);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock void SpawnAndActivate(int entity)
|
||||
{
|
||||
DispatchSpawn(entity);
|
||||
ActivateEntity(entity);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock bool IsValidClient(int client)
|
||||
{
|
||||
return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client));
|
||||
}
|
Loading…
Reference in New Issue
Block a user