From 6a0df9a8c096a80c76260324ccbfda456c2042c2 Mon Sep 17 00:00:00 2001 From: drjaska Date: Wed, 24 Nov 2021 16:55:45 +0200 Subject: [PATCH] fixes and development stuff added collision ignore, made players respawn despite being alive on round end to fix stuff and more I forgot every thing I did --- gamemodes-server.cfg | 6 ++- qcsrc/common/gamemodes/gamemode/mh/TODO.txt | 14 ++--- qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc | 59 +++++++++++---------- qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh | 7 ++- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 5249c10e0..4165e17eb 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -576,6 +576,10 @@ set g_mh 0 "Manhunt: Hunters go in search of the runners" set g_mh_not_dm_maps 0 "when this is set, DM maps will NOT be listed in MH" set g_mh_team_spawns 0 "when 1, players spawn from the team spawnpoints of the map, if any" set g_mh_point_limit -1 "MH point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)" -set g_mh_warmup 1 //10 "time players get to run around before the round starts" +set g_mh_warmup 10 //10 "time players get to run around before the round starts" set g_mh_round_timelimit 60 //180 "round time limit in seconds" +set g_mh_how_many_rounds_before_shuffle 1 "how many rounds are played before teams are shuffled automatically" +set g_mh_enable_tagging_on_touch 1 "are runners killed when touching hunters?" +set g_mh_player_waypoints 1 "0: no waypoints, 1: waypoints on runners, 2: waypoints on everyone" set g_mh_weaponarena " " "starting weapons - takes the same options as g_weaponarena" +set g_mh_unlimited_ammunition 0 "do players consume ammunition when firing" diff --git a/qcsrc/common/gamemodes/gamemode/mh/TODO.txt b/qcsrc/common/gamemodes/gamemode/mh/TODO.txt index 13f5615ad..de096c1d9 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/TODO.txt +++ b/qcsrc/common/gamemodes/gamemode/mh/TODO.txt @@ -1,17 +1,13 @@ -fix broken hunters and players not resetting - -decide names for teams, runners and hunters? - add g_mh_startitem cvars to the balance files add waypoints on runners -count dead players to be in a team +rename teams as far as possible -avoid players bumping into each other and losing speed regardless of team without affecting ^ +count dead players to be in a team -more dynamic, offswitch for shuffle +more dynamic -on-screen notification (and sound?) for getting tagged +on-screen notification for getting tagged -add more TODO: notes +add more TODO: notes \ No newline at end of file diff --git a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc index dac768d40..7df3a0b7f 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc @@ -5,7 +5,6 @@ .vector taggedplayervelocity; .vector taggedplayerviewangles; - MUTATOR_HOOKFUNCTION(mh, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE) { M_ARGV(1, string) = "mh_team"; @@ -26,7 +25,7 @@ MUTATOR_HOOKFUNCTION(mh, PlayerPreThink) { entity player = M_ARGV(0, entity); - if(player.team == Team_IndexToTeam(1) && !game_stopped && !IS_DEAD(player) && IS_PLAYER(player) && !IS_INDEPENDENT_PLAYER(player)) + if(autocvar_g_mh_enable_tagging_on_touch && round_handler_IsRoundStarted() && player.team == Team_IndexToTeam(1) && !game_stopped && !IS_DEAD(player) && IS_PLAYER(player) && !IS_INDEPENDENT_PLAYER(player)) { FOREACH_CLIENT(IS_PLAYER(it) && it != player && it.team == Team_IndexToTeam(2), { if(!IS_DEAD(it) && !IS_INDEPENDENT_PLAYER(it)) @@ -36,7 +35,7 @@ MUTATOR_HOOKFUNCTION(mh, PlayerPreThink) float armor = GetResource(it, RES_ARMOR); float max_dmg; if(autocvar_g_balance_armor_blockpercent == 1){ - max_dmg = health + armor; //skip handling (1 - autocvar_g_balance_armor_blockpercent) in case of value of 1 as it leads to divide by 0 + max_dmg = health + armor; //skip handling (1 - autocvar_g_balance_armor_blockpercent) in case of cvar value of 1 as it leads to divide by 0 } else { max_dmg = health + bound(0, armor, ((health / (1 - autocvar_g_balance_armor_blockpercent))- health)); } @@ -112,10 +111,10 @@ MUTATOR_HOOKFUNCTION(mh, GiveFragsForKill, CBC_ORDER_FIRST) // mh_LastPlayerForTeam y y // mh_LastPlayerForTeam_Notify y y -// PlayerDies add tp y +// PlayerDies y y // ClientDisconnect y y // HideTeamNagger y y -// PlayerSpawn add tp y +// PlayerSpawn y y // PutClientInServer y y // MH_count_alive_players y y // MH_GetWinnerTeam y y @@ -334,9 +333,9 @@ float MH_CheckWinner() game_stopped = true; round_handler_Init(5, autocvar_g_mh_warmup, autocvar_g_mh_round_timelimit); - //if(pymod(round_counter_for_teamchanging, 2)) - // shuffleteams_on_reset_map = !allowed_to_spawn_untagged; //only shuffle every other round - //++round_counter_for_teamchanging; + if(pymod(round_counter_for_teamchanging, autocvar_g_mh_how_many_rounds_before_shuffle) || autocvar_g_mh_how_many_rounds_before_shuffle == 1) + shuffleteams_on_reset_map = !allowed_to_spawn_untagged; + ++round_counter_for_teamchanging; //FOREACH_CLIENT(IS_PLAYER(it), { CS(it).killcount = 0; nades_Clear(it); }); //hopefully "{ CS(it).killcount = 0; nades_Clear(it); }" works and doesn't cut off nades_Clear, untested FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); }); //hopefully "{ CS(it).killcount = 0; nades_Clear(it); }" works and doesn't cut off nades_Clear, untested @@ -419,7 +418,7 @@ MUTATOR_HOOKFUNCTION(mh, PutClientInServer) { entity player = M_ARGV(0, entity); - if (!allowed_to_spawn_untagged && IS_PLAYER(player)){ // this is true even when player is trying to join + if (!allowed_to_spawn_untagged && IS_PLAYER(player) && round_handler_IsRoundStarted()){ // this can be true even when player is trying to join if (CS(player).jointime != time){ // not when connecting Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_MH_JOIN_LATE); } @@ -468,24 +467,6 @@ MUTATOR_HOOKFUNCTION(mh, PlayerDies) return true; } - - -// =========== -// to change -// =========== - -MUTATOR_HOOKFUNCTION(mh, reset_map_players) -{ - FOREACH_CLIENT(true, { - CS(it).killcount = 0; - TRANSMUTE(Player, it); - } - ); - return true; -} - -// Maybe add player teleporting to where they died if they just got tagged? - // Function: // PlayerSpawn // Purpose in CA: @@ -501,6 +482,7 @@ MUTATOR_HOOKFUNCTION(mh, reset_map_players) MUTATOR_HOOKFUNCTION(mh, PlayerSpawn) { entity player = M_ARGV(0, entity); + player.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP; MH_count_alive_players(); if(player.team == Team_IndexToTeam(2) && !allowed_to_spawn_untagged && Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(2)) > 1 && round_handler_IsActive() && round_handler_IsRoundStarted()){ player.deadflag = 1; // avoid a crash when a spectator joins runners mid-round and gets sent to hunters @@ -514,3 +496,26 @@ MUTATOR_HOOKFUNCTION(mh, PlayerSpawn) player.angles = player.taggedplayerviewangles; } } + +//reset kill streaks and respawn players on round reset +MUTATOR_HOOKFUNCTION(mh, reset_map_players) +{ + FOREACH_CLIENT(true, { + CS(it).killcount = 0; + PutClientInServer(it); + } + ); + return true; +} + +// =========== +// to change +// =========== + + + +//idk if this function is needed +MUTATOR_HOOKFUNCTION(mh, reset_map_global) +{ + return true; +} \ No newline at end of file diff --git a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh index fb47a8c4c..d9b11be88 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh @@ -15,7 +15,12 @@ string autocvar_g_mh_weaponarena; int mh_teams; bool allowed_to_spawn_untagged = 1; -//int round_counter_for_teamchanging = 1; +//every round needs a shuffle with >2 players unless something else is added to reset the teams +int round_counter_for_teamchanging = 1; +int autocvar_g_mh_how_many_rounds_before_shuffle; + +bool autocvar_g_mh_enable_tagging_on_touch; +//float autocvar_g_mh_player_waypoints; const int ST_MH_ROUNDS = 1; -- 2.39.2