Merge pull request #253 from julianacat/master

Push misc changes
This commit is contained in:
julianacat 2017-08-03 08:53:56 +00:00 committed by GitHub
commit 1563fd835c
5 changed files with 119 additions and 4 deletions

@ -1 +1 @@
Subproject commit dd569c63b2ca85e8d9d395a586d54464bb0e1916
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839

View File

@ -663,7 +663,7 @@ int BestHitbox(CachedEntity* target) {
// We only want to aim for the head if the ambassador can headshot
headonly = AmbassadorCanHeadshot();
// 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher
if (target->m_iHealth <= 18) headonly = false;
if (target->m_iHealth <= 18 || IsPlayerCritBoosted(g_pLocalPlayer->entity)) headonly = false;
// If player is using a rocket based weapon, prefer the hip
} else if (ci == CL_CLASS(CTFRocketLauncher) ||
ci == CL_CLASS(CTFRocketLauncher_AirStrike) ||

View File

@ -25,7 +25,6 @@ CatVar teamname_spam(CV_SWITCH, "spam_teamname", "0", "Teamname Spam", "Spam cha
std::chrono::time_point<std::chrono::system_clock> last_spam_point {};
bool teamname_swap = false;
int current_index { 0 };
TextFile file {};
@ -185,6 +184,7 @@ void CreateMove() {
IF_GAME (IsTF2()) {
// Spam changes the tournament name in casual and compeditive gamemodes
if (teamname_spam) {
static bool teamname_swap = false;
if (teamname_swap) {
teamname_swap = false;
g_IEngine->ServerCmd("tournament_teamname Cat");

View File

@ -482,7 +482,8 @@ weaponmode GetWeaponMode() {
weapon->m_iClassID == CL_CLASS(CTFFlareGun_Revenge) ||
weapon->m_iClassID == CL_CLASS(CTFSyringeGun) ||
weapon->m_iClassID == CL_CLASS(CTFCrossbow) ||
weapon->m_iClassID == CL_CLASS(CTFShotgunBuildingRescue)) {
weapon->m_iClassID == CL_CLASS(CTFShotgunBuildingRescue) ||
weapon->m_iClassID == CL_CLASS(CTFDRGPomson)) {
return weaponmode::weapon_projectile;
} else if (weapon->m_iClassID == CL_CLASS(CTFJar) ||
weapon->m_iClassID == CL_CLASS(CTFJarMilk)) {
@ -503,6 +504,7 @@ bool LineIntersectsBox(Vector& bmin, Vector& bmax, Vector& lmin, Vector& lmax) {
return true;
}
// TODO add bison and grapple hook
// TODO FIX this function
bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
float rspeed, rgrav;
@ -545,6 +547,8 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
} else if (weapon->m_iClassID == CL_CLASS(CTFShotgunBuildingRescue)) {
rgrav = 0.2f;
rspeed = 2400.0f;
} else if (weapon->m_iClassID == CL_CLASS(CTFDRGPomson)) {
rspeed = 1200.0f;
}
speed = rspeed;
gravity = rgrav;
@ -752,6 +756,26 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
return false;
}
// Used for getting class names
CatCommand print_classnames("debug_print_classnames", "Lists classnames currently available in console", []() {
// Create a tmp ent for the loop
CachedEntity* ent;
// Go through all the entities
for (int i = 0; i < HIGHEST_ENTITY; i++) {
// Get an entity
ent = ENTITY(i);
// Check for null/dormant
if (CE_BAD(ent)) continue;
// Print in console, the class name of the ent
logging::Info(format(RAW_ENT(ent)->GetClientClass()->m_pNetworkName).c_str());
}
});
void PrintChat(const char* fmt, ...) {
#if TEXTMODE
return;

View File

@ -290,3 +290,94 @@ float DistanceToGround(Vector origin) {
g_ITrace->TraceRay(ray, MASK_PLAYERSOLID, &trace::filter_no_player, &ground_trace);
return 8192.0f * ground_trace.fraction;
}
/*
// Set of to be fuctions for preciting players, similear to ncc prediction.
// The way air prediction works is that we use getabsvel to get a baseline position of where the player could be
// next tick. Then we save that into the array for our math next tick.
// After the first tick passed, we check to see how the GetAbsVel function actually performed and we can correct for its
// mistakes by comparing the result from GetAbsVel last tick and where the player currently is this tick and applying an
// offset for predictions.
// With the new offset, you can use GetAbsVel and apply the offset to get 1 tick but for every other time you would need
// to apply the offset due to the way airstrafing works.
// GetAbsVel only works in a strait fassion of what the players current velocity and doesnt factor in what the players
// next velocity could be due to the player having the ability to airstrafe and change that by quite a bit.
// Ground prediction works in the way of it using GetAbsVel to get a baseline direction of where the player is going and
// attempting to predict the players movement from that. The prediction should check its surroundings for corners, walls,
// and the like to determine a path of where the player could potentially go. We would also want to check if players
// collision box would intercept a wall or floor and interpolate even more with that in mind.
// If a player is moving too steeply onto a wall, the prediction should stop there and count that as a place for where the
// player would be for any time after it.
// we can change between the two prediction types based on the ground flag netvar.
// For using the predictions to work as projectile aimbot, we can determine the distance from the player kind of like how
// the current projectile aimbot currently does but we will follow the predicted path instead of just placing a vector in
// a really simple fassion.
// This is based on the estimation that GetAbsVelocity predicts players next position for the next createmove tick
// A set of vectors for every potential player
static Vector last_predicted_vector[32];
// An array to store predictions
static Vector last_predictions[32];
// Vectors to determine whether the player was in the air last tick
static bool last_predicted_inair[32];
// Should be run every createmove to predict playermovement
void RunPredictPlayers() {
// Create a cached ent for use in the for loop
CachedEntity* ent;
// Loop through players
for (int i = 0; i < 32; i++) {
// Get an ent from current loop and check for dormancy/null
ent = ENTITY(i);
if (CE_BAD(ent)) continue;
// Grab netvar for ground to control type of prediction
int flags = CE_INT(g_pLocalPlayer->entity, netvar.iFlags);
bool ground = (flags & (1 << 0));
// For ground prediction, we would just use the old method for now
if (ground) {
// Set our last "in air" state to false
last_predicted_vector_inair[i] = false;
// For air prediction, attempts to exerpolate strafing speed
} else {
// If we were not in the air last tick, we need to create our first prediction
if (!last_predicted_inair[i]) {
// Set "in air" to true to allow air prediction to work next tick
last_predicted_inair[i] = true;
// Get our abs velocity and set it into the array
velocity::EstimateAbsVelocity(RAW_ENT(ent), last_predicted_vector[i]);
// Since we have been in the air last tick, we can create an offset off of prediction errors
} else {
// Create a storage vector and get abs velocity of
Vector current_prediction;
velocity::EstimateAbsVelocity(RAW_ENT(ent), current_prediction);
last_predictions[32];
}
}
}
}
// Draws our predicted player pathing for debug or visual use
void DrawPredictPlayers() {
// TODO
}
*/