added functionality to check the map on a bunch of map specific plugins. this way we dont have to load/unload plugins that usually causes slow map changes or even causes crashes. momsurffix was compiled with sourcemod 1.11

This commit is contained in:
2024-08-04 16:56:23 +02:00
parent 0e5cc3175c
commit a296dd400c
8 changed files with 1575 additions and 882 deletions
+9 -9
View File
@@ -30,7 +30,7 @@ public int GetEntityIndexByName(const char[] name, const char[] classname){
return -1;
}
public int FindEntityByClassnameWithin(int startEnt, const char[] classname, const float[3] origin, const float radius){ //Tested. Works properly.
public int FindEntityByClassnameWithin(int startEnt, const char[] classname, const float origin[3], const float radius){ //Tested. Works properly.
float torigin[3];
while((startEnt = FindEntityByClassname(startEnt,classname))!= -1){
GetOrigin(startEnt, torigin);
@@ -39,7 +39,7 @@ public int FindEntityByClassnameWithin(int startEnt, const char[] classname, con
return -1;
}
public float TraceLine(const float[3] origin, const float[3] v2, int entity){ //Tested. Works properly
public float TraceLine(const float origin[3], const float v2[3], 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)){
@@ -55,27 +55,27 @@ 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.
public void GetOrigin(int entity, float buffer[3]){ //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
public void GetAngles(int entity, float buffer[3]){ //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.
public void SetAngles(int entity, const float buffer[3]){ //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.
public void SetOrigin(int entity, const float buffer[3]){ //Tested. Works properly.
if(IsValidEntity(entity))
TeleportEntity(entity, buffer, NULL_VECTOR, NULL_VECTOR);
}
public void GetForwardVector(int entity, float[3] buffer) //Tested. Works properly.
public void GetForwardVector(int entity, float buffer[3]) //Tested. Works properly.
{
if(IsValidEntity(entity))
{
@@ -85,7 +85,7 @@ public void GetForwardVector(int entity, float[3] buffer) //Tested. Works proper
}
}
public void SetForwardVector(int entity, const float[3] buffer) //Tested. Works properly.
public void SetForwardVector(int entity, const float buffer[3]) //Tested. Works properly.
{
if(IsValidEntity(entity))
{
@@ -134,4 +134,4 @@ public Action InputDelay(Handle timer, DataPack data)
SetVariantString(parametr);
AcceptEntityInput(target, input, activator);
}
}
}
@@ -208,7 +208,7 @@ 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)
public bool SphereCollideWithWorld(const float orig[3], const float radius, float degree, float buffer[3], int entity)
{
float inc = PI / degree;
@@ -371,22 +371,22 @@ methodmap Eye < Basic
}
}
public void GetVel(float[3] vel)
public void GetVel(float vel[3])
{
this.GetVector("vVel", vel);
}
public void SetVel(const float[3] vel)
public void SetVel(const float vel[3])
{
this.SetVector("vVel", vel);
}
public void GetAcc(float[3] acc)
public void GetAcc(float acc[3])
{
this.GetVector("vAcc", acc);
}
public void SetAcc(const float[3] acc)
public void SetAcc(const float acc[3])
{
this.SetVector("vAcc", acc);
}
@@ -565,4 +565,4 @@ methodmap Eye < Basic
}
}
}
}
+4 -5
View File
@@ -12,14 +12,14 @@
#define SPEED_FORWARD 1.0
#define SPEED_TURNING 0.5
stock float FloatMod(float num, float denom)
stock float FloatMod1(float num, float denom)
{
return num - denom * RoundToFloor(num / denom);
}
stock float operator%(float oper1, float oper2)
{
return FloatMod(oper1, oper2);
return FloatMod1(oper1, oper2);
}
public bool IsValidPlayer(int player)
@@ -27,7 +27,7 @@ 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)
public float GetDistance(const float v1[3], const float v2[3])
{
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]));
}
@@ -130,9 +130,8 @@ methodmap MovingNpc < Basic
}
}
public float GetTargetYaw(const float[3] start, const float[3] target)
public float GetTargetYaw(const float start[3], const float target[3])
{
float yaw = 0.00;
float v[3];
SubtractVectors(start, target, v);