update callback

set player color history to the correct darken amount
This commit is contained in:
RaidMax 2019-08-12 19:04:25 -05:00
parent 8fc85ef4c1
commit 4bdd240122
3 changed files with 83 additions and 129 deletions

View File

@ -237,7 +237,7 @@ form *, select {
} }
style { style {
background-color: darken($primary, 20%); background-color: darken($primary, 10%);
} }
.nav-tabs .nav-item { .nav-tabs .nav-item {

View File

@ -5,13 +5,15 @@
init() init()
{ {
/*
SetDvarIfUninitialized("sv_team_balance_assignments", ""); SetDvarIfUninitialized("sv_team_balance_assignments", "");
SetDvarIfUninitialized("sv_iw4madmin_serverid", 0); SetDvarIfUninitialized("sv_iw4madmin_serverid", 0);
SetDvarIfUninitialized("sv_iw4madmin_apiurl", "http://127.0.0.1:1624/api/gsc/"); SetDvarIfUninitialized("sv_iw4madmin_apiurl", "http://127.0.0.1:1624/api/gsc/");
level.apiUrl = GetDvar("sv_iw4madmin_apiurl"); level.apiUrl = GetDvar("sv_iw4madmin_apiurl");
//level thread WaitForCommand(); level thread WaitForCommand();
level thread onPlayerConnect(); level thread onPlayerConnect();
level thread onPlayerDisconnect(); level thread onPlayerDisconnect();
*/
} }
onPlayerConnect() onPlayerConnect()

View File

@ -4,39 +4,27 @@
init() init()
{ {
return;
SetDvarIfUninitialized( "sv_customcallbacks", true ); SetDvarIfUninitialized( "sv_customcallbacks", true );
SetDvarIfUninitialized( "sv_framewaittime", 0.05 ); SetDvarIfUninitialized( "sv_framewaittime", 0.05 );
SetDvarIfUninitialized("sv_additionalwaittime", 0.1); SetDvarIfUninitialized( "sv_additionalwaittime", 0.05 );
SetDvarIfUninitialized( "sv_maxstoredframes", 4 ); SetDvarIfUninitialized( "sv_maxstoredframes", 4 );
SetDvarIfUninitialized( "sv_printradarupdates", false );
SetDvarIfUninitialized( "sv_printradar_updateinterval", 500 );
SetDvarIfUninitialized( "sv_iw4madmin_url", "http://127.0.0.1:1624" );
level thread onPlayerConnect(); level thread onPlayerConnect();
if (getDvarInt("sv_printradarupdates") == 1)
{
level thread runRadarUpdates();
}
level waittill( "prematch_over" ); level waittill( "prematch_over" );
level.callbackPlayerKilled = ::Callback_PlayerKilled; level.callbackPlayerKilled = ::Callback_PlayerKilled;
level.callbackPlayerDamage = ::Callback_PlayerDamage; level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect; level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
level.playerTags = [];
level.playerTags[0] = "j_head";
level.playerTags[1] = "j_neck";
level.playerTags[2] = "j_spineupper";
level.playerTags[3] = "j_spinelower";
level.playerTags[4] = "j_shoulder_ri";
level.playerTags[5] = "j_shoulder_le";
level.playerTags[6] = "j_elbow_ri";
level.playerTags[7] = "j_elbow_le";
level.playerTags[8] = "j_wrist_ri";
level.playerTags[9] = "j_wrist_le";
level.playerTags[10] = "j_hip_ri";
level.playerTags[11] = "j_hip_le";
level.playerTags[12] = "j_knee_ri";
level.playerTags[13] = "j_knee_le";
level.playerTags[14] = "j_ankle_ri";
level.playerTags[15] = "j_ankle_le";
level.playerTags[16] = "j_helmet";
} }
onPlayerConnect( player ) onPlayerConnect( player )
{ {
for( ;; ) for( ;; )
@ -46,56 +34,32 @@ onPlayerConnect(player)
} }
} }
visibilityMultiplierForBone(bone) getHttpString( url )
{ {
multiplier = 0; request = httpGet( url );
request waittill( "done", success, data );
switch (bone) request destroy();
{
case "none":
break;
case "j_helmet":
case "j_head":
multiplier = 0.0216;
break;
case "j_neck":
multiplier = 0.0236;
break;
case "j_spineupper":
multiplier = 0.1977;
break;
case "j_spinelower":
multiplier = 0.2202;
break;
case "j_shoulder_ri":
case "j_shoulder_le":
multiplier = 0.0344;
break;
case "j_elbow_ri":
case "j_elbow_le":
multiplier = 0.03394;
break;
case "j_wrist_ri":
case "j_wrist_le":
multiplier = 0.01296;
break;
case "j_hip_ri":
case "j_hip_le":
multiplier = 0.0860;
break;
case "j_knee_ri":
case "j_knee_le":
multiplier = 0.0782;
break;
case "j_ankle_ri":
case "j_ankle_le":
multiplier = 0.0118;
break;
case "gun":
break;
} }
return multiplier; runRadarUpdates()
{
interval = int(getDvar("sv_printradar_updateinterval"));
for ( ;; )
{
for ( i = 0; i <= 17; i++ )
{
player = level.players[i];
if ( isDefined( player ) )
{
payload = player.guid + ";" + player.origin + ";" + player getPlayerAngles() + ";" + player.team + ";" + player.kills + ";" + player.deaths + ";" + player.score + ";" + player GetCurrentWeapon() + ";" + player.health + ";" + isAlive(player) + ";" + player.timePlayed["total"];
logPrint( "LiveRadar;" + payload + "\n" );
}
}
wait( interval / 1000 );
}
} }
hitLocationToBone( hitloc ) hitLocationToBone( hitloc )
@ -186,21 +150,6 @@ waitForAdditionalAngles(logString)
logPrint( logString + ";" + anglesStr + "\n" ); logPrint( logString + ";" + anglesStr + "\n" );
} }
runVisibilityCheck(attacker, victim)
{
start = attacker getTagOrigin("tag_eye");
traceVisibilityAmount = 0;
for (i = 0; i < 17; i++)
{
if (sightTracePassed(start, victim getTagOrigin(level.playerTags[i]), false, attacker))
{
traceVisibilityAmount += 1.0 * visibilityMultiplierForBone(level.playerTags[i]);
}
}
return traceVisibilityAmount;
}
vectorScale( vector, scale ) vectorScale( vector, scale )
{ {
return ( vector[0] * scale, vector[1] * scale, vector[2] * scale ); return ( vector[0] * scale, vector[1] * scale, vector[2] * scale );
@ -210,33 +159,36 @@ Process_Hit(type, attacker, sHitLoc, sMeansOfDeath, iDamage, sWeapon)
{ {
victim = self; victim = self;
_attacker = attacker; _attacker = attacker;
if ( !isPlayer( attacker ) && isDefined( attacker.owner ) ) if ( !isPlayer( attacker ) && isDefined( attacker.owner ) )
{
_attacker = attacker.owner; _attacker = attacker.owner;
}
else if( !isPlayer( attacker ) && sMeansOfDeath == "MOD_FALLING" ) else if( !isPlayer( attacker ) && sMeansOfDeath == "MOD_FALLING" )
{
_attacker = victim; _attacker = victim;
}
location = victim GetTagOrigin( hitLocationToBone( sHitLoc ) ); location = victim GetTagOrigin( hitLocationToBone( sHitLoc ) );
isKillstreakKill = !isPlayer( attacker ) || isKillstreakWeapon( sWeapon ); isKillstreakKill = !isPlayer( attacker ) || isKillstreakWeapon( sWeapon );
// do the tracing stuff logLine = "Script" + type + ";" + _attacker.guid + ";" + victim.guid + ";" + _attacker GetTagOrigin("tag_eye") + ";" + location + ";" + iDamage + ";" + sWeapon + ";" + sHitLoc + ";" + sMeansOfDeath + ";" + _attacker getPlayerAngles() + ";" + gettime() + ";" + isKillstreakKill + ";" + _attacker playerADS() + ";" + 0 + ";" + 0;
start = _attacker getTagOrigin("tag_eye");
end = location;
trace = bulletTrace(start, end, true, _attacker);
playerVisibilityPercentage = runVisibilityCheck(_attacker, victim);
logLine = "Script" + type + ";" + _attacker.guid + ";" + victim.guid + ";" + _attacker GetTagOrigin("tag_eye") + ";" + location + ";" + iDamage + ";" + sWeapon + ";" + sHitLoc + ";" + sMeansOfDeath + ";" + _attacker getPlayerAngles() + ";" + gettime() + ";" + isKillstreakKill + ";" + _attacker playerADS() + ";" + trace["fraction"] + ";" + playerVisibilityPercentage;
attacker thread waitForAdditionalAngles( logLine ); attacker thread waitForAdditionalAngles( logLine );
} }
Callback_PlayerDamage( eInflictor, attacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime ) Callback_PlayerDamage( eInflictor, attacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
{ {
if ( level.teamBased && isDefined( attacker ) && ( self != attacker ) && isDefined( attacker.team ) && ( self.pers[ "team" ] == attacker.team ) ) if ( level.teamBased && isDefined( attacker ) && ( self != attacker ) && isDefined( attacker.team ) && ( self.pers[ "team" ] == attacker.team ) )
{
return; return;
}
if ( self.health - iDamage > 0 ) if ( self.health - iDamage > 0 )
{ {
self Process_Hit( "Damage", attacker, sHitLoc, sMeansOfDeath, iDamage, sWeapon ); self Process_Hit( "Damage", attacker, sHitLoc, sMeansOfDeath, iDamage, sWeapon );
} }
self maps\mp\gametypes\_damage::Callback_PlayerDamage( eInflictor, attacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime ); self maps\mp\gametypes\_damage::Callback_PlayerDamage( eInflictor, attacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
} }