Skip to content

Commit

Permalink
GAME: CATCH: fixed missing lastWarningMessageTime for #283
Browse files Browse the repository at this point in the history
also tweaked the numbers for the timing. Even though these were not really defined in the ticket.
  • Loading branch information
mgerhardy committed Oct 26, 2024
1 parent 1700db4 commit 7faa6c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions code/game/g_catch.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ gentity_t *G_DropKillerDucks(gentity_t *ent) {
Com_Error(ERR_DROP, "Failed to drop the KillerDuck");
}

// wait a bit before we send a warning for not being able to pick up
// the killerducks that fast again - see PICKUP_KILLERDUCKS_NOT_YET_AGAIN
// and the handling in Touch_Item()
client->lastWarningMessageTime = level.time;
// don't allow to re-collect for 5 seconds
// see BG_CanItemBeGrabbed()
killerDucks->s.otherEntityNum = ent->s.number;
Expand Down
4 changes: 2 additions & 2 deletions code/game/g_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ void Touch_Item(gentity_t *ent, gentity_t *other, trace_t *trace) {
result = BG_CanItemBeGrabbed(g_gametype.integer, &ent->s, &other->client->ps, level.time);
if (result != PICKUP_OK) {
if (result == PICKUP_KILLERDUCKS_NOT_YET_AGAIN) {
if ((level.time - other->client->lastWarningMessageTime) > 5000) {
if ((level.time - other->client->lastWarningMessageTime) > 2000) {
trap_SendServerCommand(other->s.clientNum, "cp \"You can't pick up the KillerDuck for a while!\n\"");
other->client->lastWarningMessageTime = level.time;
other->client->lastWarningMessageTime = level.time + 2000;
}
}
return;
Expand Down

0 comments on commit 7faa6c3

Please sign in to comment.