From: LegendaryGuard Date: Wed, 8 Dec 2021 16:01:29 +0000 (+0100) Subject: Add autotaunt runner feature and fix hunter eyes black screen time when round is... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=19e059abcf9cf7b89e40ee47d2c5d3492b88ff59;p=xonotic%2Fxonotic-data.pk3dir.git Add autotaunt runner feature and fix hunter eyes black screen time when round is started --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index d6716f7fc..fa42fcc2a 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -585,4 +585,6 @@ set g_mh_weaponarena " " "starting weapons - takes the same options as g_weapona set g_mh_weapons_damage 0 "0: no damage, 1: only self-damage for runners, 2: only damage opposing team, 3: only allow hunters to damage runners, 4: self-damage and opposing team damage" set g_mh_weapons_force 1 "0: no force, 1: only self-force, 2: self-force and opposing team force" set g_mh_limited_ammunition 0 "do players consume ammunition when firing" -set g_mh_hunterblind 1 "when this is set, hunters can't see anything until the round starts" \ No newline at end of file +set g_mh_hunterblind 1 "when this is set, hunters can't see anything until the round starts" +set g_mh_autotaunt_runner 1 "when this is set, runners play automatically a sound being noticed by everyone" +set g_mh_autotaunt_runner_time 35 "runner automatic taunt time, plays a sound automatically when time is over, and restarts taunt time" \ No newline at end of file diff --git a/qcsrc/common/gamemodes/gamemode/mh/TODO.txt b/qcsrc/common/gamemodes/gamemode/mh/TODO.txt index 2ef7f5cc6..a3192b817 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/TODO.txt +++ b/qcsrc/common/gamemodes/gamemode/mh/TODO.txt @@ -2,7 +2,6 @@ add g_mh_startitem cvars to the balance files +2 waypoint modes, waypoints for runners on round start always and waypoints for hunters when there are 3 or more hunters -only runners can see other runners but hunters don't see others rename teams as far as possible @@ -16,7 +15,6 @@ more dynamicity for the code :) add more TODO: notes -it might need to improve something in Hunter black screen in mh.qh, sv_mh.qc uses HunterEyesStart function to execute black screen -g_mh_hunterblind 1 // to activate hunter black screen +if player(runner) taunts, his autotaunt time is restarted. something similar to "voice taunt" fix waypoint visibility, currently they are always visible to everyone. Fix them to not be visible for spectators of that player. \ No newline at end of file diff --git a/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc b/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc index 3e60dce67..bb814acd7 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc +++ b/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc @@ -45,6 +45,27 @@ void HUD_Mod_MH(vector pos, vector mySize) timer_color = '1 0 0'; //red } + // Autotaunt feature + string timerrunnertaunt_text = string_null; + vector timerrunnertaunt_color = '1 1 1'; + if(!STAT(GAME_STOPPED) && !warmup_stage && STAT(MH_ROUNDTIMER) > 0) + { + float timeleft_runnertaunt = max(0, STAT(MH_RUNNER_TAUNTTIMER) - time); + timeleft_runnertaunt = ceil(timeleft_runnertaunt); + timerrunnertaunt_text = strcat("Taunt: ", seconds_tostring(timeleft_runnertaunt)); + float secondsLeft = timeleft_runnertaunt; + if(intermission_time || secondsLeft >= 20 || warmup_stage || STAT(MH_RUNNER_TAUNTTIMER) == 0) + timerrunnertaunt_color = '1 1 1'; //white + else if(secondsLeft >= 10) + timerrunnertaunt_color = '1 1 0'; //yellow + else + timerrunnertaunt_color = '1 0 0'; //red + } + + // Autotaunt feature + if(mystatus == MH_STATUS_RUNNER) + drawstring_aspect(pos + eX * (0.3 * mySize.x) + eY * (0.7 * mySize.y), timerrunnertaunt_text, vec2(0.3 * mySize.x, mySize.y), timerrunnertaunt_color, panel_fg_alpha, DRAWFLAG_NORMAL); + //drawpic_aspect_skin(pos, player_icon, vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); if(!time_text) drawstring_aspect(pos, player_text, vec2(mySize.x, mySize.y), player_color, panel_fg_alpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/common/gamemodes/gamemode/mh/mh.qh b/qcsrc/common/gamemodes/gamemode/mh/mh.qh index 7f1b0a34a..d6a18985a 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/mh.qh +++ b/qcsrc/common/gamemodes/gamemode/mh/mh.qh @@ -103,6 +103,9 @@ MUTATOR_HOOKFUNCTION(cl_hunteryes, HUD_Draw_overlay) if(!eyesblinded) return false; + if(!STAT(GAME_STOPPED) && !warmup_stage && STAT(MH_ROUNDTIMER) > 0) + eyesblinded = false; + if(time <= huntereyes_fadetime) { HUD_HunterEyes(); @@ -123,22 +126,6 @@ NET_HANDLE(TE_CSQC_HUNTEREYES, bool isNew) eyesblinded = true; huntereyes_appeartime = time; - float time_mh_roundstart = (time * 2 + cvar("g_mh_warmup")) / 1.655; - if(time <= cvar("g_mh_warmup")) // if it's the first time round starts - { - huntereyes_fadetime = time_mh_roundstart; - // LOG_INFOF("if ENTERED time: %f", time); - } - else - { - huntereyes_fadetime = time + cvar("g_mh_warmup"); - // LOG_INFOF("else ENTERED time: %f", time); - } - - // just another test - // if(huntereyes_fadetime > time) - // huntereyes_fadetime = time; LOG_INFOF("time: %f", time); - - // LOG_INFOF("huntereyes_fadetime: %f", huntereyes_fadetime); + huntereyes_fadetime = time + cvar("g_mh_warmup"); } #endif \ 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 2ab7bac54..71e563897 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc @@ -4,6 +4,7 @@ .vector taggedplayerlocation; .vector taggedplayervelocity; .vector taggedplayerviewangles; +.float RunnerSoundTaunt_time; void MH_FakeTimeLimit(entity e, float t) { @@ -69,6 +70,30 @@ MUTATOR_HOOKFUNCTION(mh, PlayerPreThink) player.mh_status = MH_STATUS_HUNTER; else if(player.team == Team_IndexToTeam(2)) player.mh_status = MH_STATUS_RUNNER; + + // Autotaunt feature + if(autocvar_g_mh_autotaunt_runner) + { + if(!game_stopped && !warmup_stage && round_handler_IsActive() && round_handler_IsRoundStarted()) + { + if(time > player.RunnerSoundTaunt_time) + { + if(player.team == Team_IndexToTeam(2)) + { + // play sound to make hunter notice + sound(player, CH_SHOTS, SND_RUNNER_TAUNT_RANDOM(), VOL_BASEVOICE, ATTEN_NORM); + player.RunnerSoundTaunt_time = time + autocvar_g_mh_autotaunt_runner_time; + STAT(MH_RUNNER_TAUNTTIMER, player) = player.RunnerSoundTaunt_time; + } + } + } + else + { + // LOG_INFOF("^2RESTARTED RUNNER TAUNT TIMER!"); + player.RunnerSoundTaunt_time = time + autocvar_g_mh_autotaunt_runner_time; + STAT(MH_RUNNER_TAUNTTIMER, player) = player.RunnerSoundTaunt_time; + } + } } MUTATOR_HOOKFUNCTION(mh, Damage_Calculate) @@ -84,7 +109,7 @@ MUTATOR_HOOKFUNCTION(mh, Damage_Calculate) return; } - if(frag_deathtype==DEATH_CAMP.m_id || !IS_PLAYER(frag_attacker)) return; + if(frag_deathtype == DEATH_CAMP.m_id || !IS_PLAYER(frag_attacker)) return; if(IS_PLAYER(frag_target) && !IS_DEAD(frag_target)){ //check that the target is a player and not dead, allows anyone to knock around corpses for funsies diff --git a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh index e8e43a206..ffa24e6d0 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh @@ -15,6 +15,8 @@ int autocvar_g_mh_weapons_damage; int autocvar_g_mh_weapons_force; bool autocvar_g_mh_limited_ammunition; bool autocvar_g_mh_hunterblind; +bool autocvar_g_mh_autotaunt_runner; +float autocvar_g_mh_autotaunt_runner_time; int mh_teams; bool allowed_to_spawn_untagged = 1; @@ -28,6 +30,21 @@ float autocvar_g_mh_player_waypoints; const int ST_MH_ROUNDS = 1; +// Autotaunt feature +SOUND(RUNNER_TAUNT1, "sound/mh/taunt1"); +SOUND(RUNNER_TAUNT2, "sound/mh/taunt2"); +SOUND(RUNNER_TAUNT3, "sound/mh/taunt3"); +SOUND(RUNNER_TAUNT4, "sound/mh/taunt4"); +SOUND(RUNNER_TAUNT5, "sound/mh/taunt5"); +SOUND(RUNNER_TAUNT6, "sound/mh/taunt6"); +SOUND(RUNNER_TAUNT7, "sound/mh/taunt7"); +SOUND(RUNNER_TAUNT8, "sound/mh/taunt8"); +SOUND(RUNNER_TAUNT9, "sound/mh/taunt9"); +SOUND(RUNNER_TAUNT10, "sound/mh/taunt10"); +Sound SND_RUNNER_TAUNT_RANDOM() { + return REGISTRY_GET(Sounds, SND_RUNNER_TAUNT1.m_id + floor(prandom() * 10)); +} + bool MH_CheckTeams(); bool MH_CheckWinner(); void MH_RoundStart(); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 7e260ec23..ba7534381 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -340,6 +340,7 @@ REGISTER_STAT(DOM_PPS_PINK, float) // man hunt REGISTER_STAT(MH_ROUNDTIMER, float) +REGISTER_STAT(MH_RUNNER_TAUNTTIMER, float) #ifdef SVQC float autocvar_g_teleport_maxspeed; diff --git a/sound/mh/taunt1.ogg b/sound/mh/taunt1.ogg new file mode 100644 index 000000000..0f002785c Binary files /dev/null and b/sound/mh/taunt1.ogg differ diff --git a/sound/mh/taunt10.ogg b/sound/mh/taunt10.ogg new file mode 100644 index 000000000..27e43f236 Binary files /dev/null and b/sound/mh/taunt10.ogg differ diff --git a/sound/mh/taunt2.ogg b/sound/mh/taunt2.ogg new file mode 100644 index 000000000..05c7e2d55 Binary files /dev/null and b/sound/mh/taunt2.ogg differ diff --git a/sound/mh/taunt3.ogg b/sound/mh/taunt3.ogg new file mode 100644 index 000000000..1722627ae Binary files /dev/null and b/sound/mh/taunt3.ogg differ diff --git a/sound/mh/taunt4.ogg b/sound/mh/taunt4.ogg new file mode 100644 index 000000000..16f779969 Binary files /dev/null and b/sound/mh/taunt4.ogg differ diff --git a/sound/mh/taunt5.ogg b/sound/mh/taunt5.ogg new file mode 100644 index 000000000..fca4ecff0 Binary files /dev/null and b/sound/mh/taunt5.ogg differ diff --git a/sound/mh/taunt6.ogg b/sound/mh/taunt6.ogg new file mode 100644 index 000000000..41d91d2fb Binary files /dev/null and b/sound/mh/taunt6.ogg differ diff --git a/sound/mh/taunt7.ogg b/sound/mh/taunt7.ogg new file mode 100644 index 000000000..bb2b03125 Binary files /dev/null and b/sound/mh/taunt7.ogg differ diff --git a/sound/mh/taunt8.ogg b/sound/mh/taunt8.ogg new file mode 100644 index 000000000..a3128dfd3 Binary files /dev/null and b/sound/mh/taunt8.ogg differ diff --git a/sound/mh/taunt9.ogg b/sound/mh/taunt9.ogg new file mode 100644 index 000000000..a3600e9a5 Binary files /dev/null and b/sound/mh/taunt9.ogg differ