mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 11:53:21 +00:00
Cleanup manual turret targets
This commit is contained in:
parent
caa6cd25a5
commit
492d5b79ee
2 changed files with 10 additions and 10 deletions
Binary file not shown.
|
@ -40,6 +40,9 @@ Handle thinkTimer;
|
||||||
ConVar cv_autoBaseDamage;
|
ConVar cv_autoBaseDamage;
|
||||||
ConVar cv_manualBaseDamage;
|
ConVar cv_manualBaseDamage;
|
||||||
|
|
||||||
|
static int COLOR_RED[4] = { 255, 0, 0, 200 };
|
||||||
|
int manualTarget = -1;
|
||||||
|
#define MANUAL_TARGETNAME "turret_target_manual"
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
Entity_ChangeOverTime`
|
Entity_ChangeOverTime`
|
||||||
|
@ -190,7 +193,7 @@ int ClearTurrets(bool fullClear = true) {
|
||||||
entity = INVALID_ENT_REFERENCE;
|
entity = INVALID_ENT_REFERENCE;
|
||||||
while ((entity = FindEntityByClassname(entity, "info_target")) != INVALID_ENT_REFERENCE) {
|
while ((entity = FindEntityByClassname(entity, "info_target")) != INVALID_ENT_REFERENCE) {
|
||||||
GetEntPropString(entity, Prop_Data, "m_iName", targetname, sizeof(targetname));
|
GetEntPropString(entity, Prop_Data, "m_iName", targetname, sizeof(targetname));
|
||||||
if(StrContains(targetname, "turret_target_") > -1) {
|
if(StrContains(targetname, "turret_target_") > -1 || StrEqual(targetname, MANUAL_TARGETNAME)) {
|
||||||
AcceptEntityInput(entity, "Kill");
|
AcceptEntityInput(entity, "Kill");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -592,9 +595,6 @@ static char IGNORE_TRACE[MAX_IGNORE_TRACE][] = {
|
||||||
"env_player_blocker"
|
"env_player_blocker"
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
static int COLOR_RED[4] = { 255, 0, 0, 200 };
|
|
||||||
int manualTarget = -1;
|
|
||||||
#define MANUAL_TARGETNAME "turret_target_manual"
|
|
||||||
|
|
||||||
bool Filter_ManualTarget(int entity, int contentsMask) {
|
bool Filter_ManualTarget(int entity, int contentsMask) {
|
||||||
if(entity == 0) return true;
|
if(entity == 0) return true;
|
||||||
|
@ -626,7 +626,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
||||||
// Run a ray trace to find a suitable position
|
// Run a ray trace to find a suitable position
|
||||||
// TODO: Possibly run per-turret for more accurate preview... but it's already lag fest
|
// TODO: Possibly run per-turret for more accurate preview... but it's already lag fest
|
||||||
TR_TraceRayFilter(orgPos, angles, MASK_SHOT, RayType_Infinite, Filter_ManualTarget);
|
TR_TraceRayFilter(orgPos, angles, MASK_SHOT, RayType_Infinite, Filter_ManualTarget);
|
||||||
if(!IsValidEntity(manualTarget)) manualTarget = CreateTarget(angles, MANUAL_TARGETNAME);
|
if(!IsValidEntity(manualTarget)) manualTarget = CreateTarget(pos, MANUAL_TARGETNAME);
|
||||||
|
|
||||||
// Disable aim snapping if player is holding WALK (which is apparently IN_SPEED)
|
// Disable aim snapping if player is holding WALK (which is apparently IN_SPEED)
|
||||||
bool aimSnapping = ~buttons & IN_SPEED > 0;
|
bool aimSnapping = ~buttons & IN_SPEED > 0;
|
||||||
|
@ -653,19 +653,19 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
||||||
TeleportEntity(manualTarget, pos, NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(manualTarget, pos, NULL_VECTOR, NULL_VECTOR);
|
||||||
|
|
||||||
if(buttons & IN_ATTACK) {
|
if(buttons & IN_ATTACK) {
|
||||||
PhysicsExplode(pos, 10, 20.0, true);
|
PhysicsExplode(pos, 20, 20.0, true);
|
||||||
TE_SetupExplodeForce(pos, 20.0, 10.0);
|
TE_SetupExplodeForce(pos, 20.0, 20.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activate all turrets
|
// Activate all turrets
|
||||||
int entity = INVALID_ENT_REFERENCE;
|
int entity = INVALID_ENT_REFERENCE;
|
||||||
while ((entity = FindEntityByClassname(entity, "info_particle_system")) != INVALID_ENT_REFERENCE) {
|
while ((entity = FindEntityByClassname(entity, "info_particle_system")) != INVALID_ENT_REFERENCE) {
|
||||||
if(view_as<int>(turretState[entity]) > 0) {
|
if(view_as<int>(turretState[entity]) > 0) {
|
||||||
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
|
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", orgPos);
|
||||||
TE_SetupBeamPoints(pos, orgPos, g_iLaserIndex, 0, 0, 1, 0.1, 0.1, 0.1, 0, 0.0, COLOR_RED, 1);
|
TE_SetupBeamPoints(orgPos, pos, g_iLaserIndex, 0, 0, 1, 0.1, 0.1, 0.1, 0, 0.0, COLOR_RED, 1);
|
||||||
TE_SendToAll();
|
TE_SendToAll();
|
||||||
if(buttons & IN_ATTACK) {
|
if(buttons & IN_ATTACK) {
|
||||||
FireTurret(pos, MANUAL_TARGETNAME, cv_manualBaseDamage.FloatValue, tickcount % 10 == 10);
|
FireTurret(pos, MANUAL_TARGETNAME, cv_manualBaseDamage.FloatValue, tickcount % 10 == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue