mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'pit-blame' into 'master'
Credit players for deathpits that result from their hits ("pit blame")
Closes #1040
See merge request KartKrew/Kart!1920
This commit is contained in:
commit
524b63ad8f
6 changed files with 34 additions and 1 deletions
|
|
@ -965,6 +965,8 @@ struct player_t
|
|||
mobj_t *hand;
|
||||
mobj_t *flickyAttacker;
|
||||
|
||||
SINT8 pitblame; // Index of last player that hit you, resets after being in control for a bit. If you deathpit, credit the old attacker!
|
||||
|
||||
UINT8 instaWhipCharge;
|
||||
UINT8 defenseLockout; // Committed to universal attack/defense, make 'em vulnerable! No whip/guard.
|
||||
UINT8 instaWhipChargeLockout; // Input safety
|
||||
|
|
|
|||
|
|
@ -2389,6 +2389,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
p->ringvolume = 255;
|
||||
p->ringtransparency = 255;
|
||||
|
||||
p->pitblame = -1;
|
||||
|
||||
p->topAccel = MAXTOPACCEL;
|
||||
|
||||
p->botvars.rubberband = FRACUNIT;
|
||||
|
|
|
|||
|
|
@ -8914,6 +8914,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->incontrol = min(player->incontrol, 5*TICRATE);
|
||||
player->incontrol = max(player->incontrol, -5*TICRATE);
|
||||
|
||||
if (player->incontrol == 3*TICRATE)
|
||||
player->pitblame = -1;
|
||||
|
||||
if (P_PlayerInPain(player) || player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
player->lastpickuptype = -1; // got your ass beat, go grab anything
|
||||
|
|
|
|||
|
|
@ -351,6 +351,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->topAccel);
|
||||
else if (fastcmp(field,"instaWhipCharge"))
|
||||
lua_pushinteger(L, plr->instaWhipCharge);
|
||||
else if (fastcmp(field,"pitblame"))
|
||||
lua_pushinteger(L, plr->pitblame);
|
||||
else if (fastcmp(field,"defenseLockout"))
|
||||
lua_pushinteger(L, plr->defenseLockout);
|
||||
else if (fastcmp(field,"oldGuard"))
|
||||
|
|
@ -877,6 +879,8 @@ static int player_set(lua_State *L)
|
|||
plr->topAccel = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"instaWhipCharge"))
|
||||
plr->instaWhipCharge = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"pitblame"))
|
||||
plr->pitblame = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"defenseLockout"))
|
||||
plr->defenseLockout = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"oldGuard"))
|
||||
|
|
|
|||
|
|
@ -2502,7 +2502,17 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
|
|||
|
||||
if (gametyperules & (GTR_BUMPERS|GTR_CHECKPOINTS))
|
||||
{
|
||||
player->mo->health--;
|
||||
if ((player->pitblame > -1) && (player->pitblame < MAXPLAYERS)
|
||||
&& (playeringame[player->pitblame]) && (!players[player->pitblame].spectator)
|
||||
&& (players[player->pitblame].mo) && (!P_MobjWasRemoved(players[player->pitblame].mo)))
|
||||
{
|
||||
P_DamageMobj(player->mo, players[player->pitblame].mo, players[player->pitblame].mo, 1, DMG_KARMA);
|
||||
player->pitblame = -1;
|
||||
}
|
||||
else if (player->mo->health > 1 || battleprisons)
|
||||
{
|
||||
player->mo->health--;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->mo->health <= 0)
|
||||
|
|
@ -3134,6 +3144,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
}
|
||||
}
|
||||
|
||||
if (source && source != player->mo && source->player)
|
||||
{
|
||||
if (damagetype != DMG_DEATHPIT)
|
||||
{
|
||||
player->pitblame = source->player - players;
|
||||
}
|
||||
}
|
||||
|
||||
player->sneakertimer = player->numsneakers = 0;
|
||||
player->driftboost = player->strongdriftboost = 0;
|
||||
player->gateBoost = 0;
|
||||
|
|
|
|||
|
|
@ -578,6 +578,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
|
||||
WRITEMEM(save->p, players[i].public_key, PUBKEYLENGTH);
|
||||
|
||||
WRITESINT8(save->p, players[i].pitblame);
|
||||
|
||||
WRITEUINT8(save->p, players[i].instaWhipCharge);
|
||||
WRITEUINT8(save->p, players[i].defenseLockout);
|
||||
WRITEUINT8(save->p, players[i].oldGuard);
|
||||
|
|
@ -1153,6 +1155,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
|
||||
READMEM(save->p, players[i].public_key, PUBKEYLENGTH);
|
||||
|
||||
players[i].pitblame = READSINT8(save->p);
|
||||
|
||||
players[i].instaWhipCharge = READUINT8(save->p);
|
||||
players[i].defenseLockout = READUINT8(save->p);
|
||||
players[i].oldGuard = READUINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue