mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add "Move Your Car" for antigrief
This commit is contained in:
parent
39b5a8ac2f
commit
92bbd82c73
7 changed files with 31 additions and 0 deletions
|
|
@ -3068,6 +3068,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
kickreason = KR_LEAVE;
|
||||
break;
|
||||
case KICK_MSG_GRIEF:
|
||||
S_StartSound(NULL, sfx_cftbl1);
|
||||
HU_AddChatText(va("\x82*%s has been kicked (Automatic grief detection)", player_names[pnum]), false);
|
||||
kickreason = KR_KICK;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -923,6 +923,7 @@ struct player_t
|
|||
|
||||
UINT32 griefValue;
|
||||
UINT8 griefStrikes;
|
||||
boolean griefWarned;
|
||||
|
||||
UINT8 typing_timer; // Counts down while keystrokes are not emitted
|
||||
UINT8 typing_duration; // How long since resumed timer
|
||||
|
|
|
|||
|
|
@ -641,6 +641,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->griefValue);
|
||||
else if (fastcmp(field,"griefStrikes"))
|
||||
lua_pushinteger(L, plr->griefStrikes);
|
||||
else if (fastcmp(field,"griefWarned"))
|
||||
lua_pushinteger(L, plr->griefWarned);
|
||||
else if (fastcmp(field,"splitscreenindex"))
|
||||
lua_pushinteger(L, plr->splitscreenindex);
|
||||
#ifdef HWRENDER
|
||||
|
|
@ -1160,6 +1162,8 @@ static int player_set(lua_State *L)
|
|||
plr->griefValue = (UINT32)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"griefStrikes"))
|
||||
plr->griefStrikes = (UINT8)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"griefWarned"))
|
||||
plr->griefWarned = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"splitscreenindex"))
|
||||
return NOSET;
|
||||
#ifdef HWRENDER
|
||||
|
|
|
|||
|
|
@ -296,6 +296,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT32(save->p, players[i].spectatorReentry);
|
||||
WRITEUINT32(save->p, players[i].griefValue);
|
||||
WRITEUINT8(save->p, players[i].griefStrikes);
|
||||
WRITEUINT8(save->p, players[i].griefWarned);
|
||||
|
||||
WRITEUINT8(save->p, players[i].splitscreenindex);
|
||||
|
||||
|
|
@ -914,6 +915,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].spectatorReentry = READUINT32(save->p);
|
||||
players[i].griefValue = READUINT32(save->p);
|
||||
players[i].griefStrikes = READUINT8(save->p);
|
||||
players[i].griefWarned = READUINT8(save->p);
|
||||
|
||||
players[i].splitscreenindex = READUINT8(save->p);
|
||||
|
||||
|
|
|
|||
13
src/p_user.c
13
src/p_user.c
|
|
@ -69,6 +69,7 @@
|
|||
#include "k_objects.h"
|
||||
#include "k_endcam.h"
|
||||
#include "k_credits.h"
|
||||
#include "k_hud.h" // K_AddMessage
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_light.h"
|
||||
|
|
@ -4633,6 +4634,9 @@ void P_IncrementGriefValue(player_t *player, UINT32 *grief, const UINT32 griefMa
|
|||
{
|
||||
// Playing normally.
|
||||
*grief = *grief - 1;
|
||||
|
||||
if (*grief == 0)
|
||||
player->griefWarned = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4650,6 +4654,14 @@ void P_CheckRaceGriefing(player_t *player, boolean dopunishment)
|
|||
|
||||
P_IncrementGriefValue(player, &player->griefValue, griefMax);
|
||||
|
||||
if (dopunishment && !player->griefWarned && player->griefValue >= (griefMax/2))
|
||||
{
|
||||
K_AddMessageForPlayer(player, "Get moving!", true, false);
|
||||
if (P_IsLocalPlayer(player))
|
||||
S_StartSound(NULL, sfx_cftbl0);
|
||||
player->griefWarned = true;
|
||||
}
|
||||
|
||||
if (dopunishment && player->griefValue >= griefMax)
|
||||
{
|
||||
if (player->griefStrikes < 3)
|
||||
|
|
@ -4658,6 +4670,7 @@ void P_CheckRaceGriefing(player_t *player, boolean dopunishment)
|
|||
}
|
||||
|
||||
player->griefValue = 0;
|
||||
player->griefWarned = false;
|
||||
|
||||
if (server)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1492,6 +1492,11 @@ sfxinfo_t S_sfx[NUMSFX] =
|
|||
{"gshf0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||
{"gshf1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||
|
||||
// Pinball
|
||||
{"cftbl0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||
{"cftbl1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||
{"cftbl2", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||
|
||||
// SRB2kart - Skin sounds
|
||||
{"kwin", false, 64, 96, -1, NULL, 0, SKSKWIN, -1, LUMPERROR, ""},
|
||||
{"klose", false, 64, 96, -1, NULL, 0, SKSKLOSE, -1, LUMPERROR, ""},
|
||||
|
|
|
|||
|
|
@ -1566,6 +1566,11 @@ typedef enum
|
|||
sfx_gshf0,
|
||||
sfx_gshf1,
|
||||
|
||||
// Pinball
|
||||
sfx_cftbl0,
|
||||
sfx_cftbl1,
|
||||
sfx_cftbl2,
|
||||
|
||||
// And LASTLY, Kart's skin sounds.
|
||||
sfx_kwin,
|
||||
sfx_klose,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue