From 78bb3b9005e8e008cfff6b0158723dd072a957cb Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 4 Nov 2023 16:58:47 +0100 Subject: inventory --- src/players.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/players.c b/src/players.c index 3e657a0..164b2a8 100644 --- a/src/players.c +++ b/src/players.c @@ -253,11 +253,19 @@ void take_player_input(platform_window* window) { add_message_to_outgoing_queuex(message, *global_state.client); } - // throwing - if (is_right_clicked()) { + // grenades + if (keyboard_is_key_pressed(KEY_G) && p->throwables.grenades > 0) { + p->throwables.grenades--; network_message message = create_protocol_user_throw(player_id, dirx, diry, THROWABLE_GRENADE); add_message_to_outgoing_queuex(message, *global_state.client); } + + // molotovs + if (keyboard_is_key_pressed(KEY_F) && p->throwables.molotovs > 0) { + p->throwables.molotovs--; + network_message message = create_protocol_user_throw(player_id, dirx, diry, THROWABLE_MOLOTOV); + add_message_to_outgoing_queuex(message, *global_state.client); + } } } -- cgit v1.2.3-70-g09d2