From: LegendaryGuard Date: Mon, 11 Jul 2022 18:31:30 +0000 (+0200) Subject: Undo all prophunt stuff and convert into standarized MH gamemode X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5c8026a9f23c8d05c9833dedaa4e1b204537545f;p=xonotic%2Fxonotic-data.pk3dir.git Undo all prophunt stuff and convert into standarized MH gamemode --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 7937576aa..e853e3be8 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -587,10 +587,3 @@ set g_mh_weapons_damage 3 "0: no damage, 1: only self-damage for runners, 2: onl 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" -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" -set g_mh_propmode 1 "when this is set, runners are spawned as props" -set g_mh_random_props_count 30 "props are spawned randomly around map" -set g_mh_random_props_tries 20 "Try to place a prop this many times before giving up" -set g_mh_random_props_droptofloor 0 "Drop the props instantly so they don't appear to fall from the sky" -set g_mh_random_props_droptofloor_maxdepth -1 "Maximum depth for the trace in props (use negative value for the map size)" \ 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 bb814acd7..3e60dce67 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc +++ b/qcsrc/common/gamemodes/gamemode/mh/cl_mh.qc @@ -45,27 +45,6 @@ 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 d6a18985a..1b320b281 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/mh.qh +++ b/qcsrc/common/gamemodes/gamemode/mh/mh.qh @@ -105,7 +105,7 @@ MUTATOR_HOOKFUNCTION(cl_hunteryes, HUD_Draw_overlay) if(!STAT(GAME_STOPPED) && !warmup_stage && STAT(MH_ROUNDTIMER) > 0) eyesblinded = false; - + if(time <= huntereyes_fadetime) { HUD_HunterEyes(); diff --git a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc index 094897f47..2ab7bac54 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qc @@ -4,11 +4,6 @@ .vector taggedplayerlocation; .vector taggedplayervelocity; .vector taggedplayerviewangles; -.float RunnerSoundTaunt_time; -.entity mh_prop; // TODO: to be checked -.bool modelchecked; - -bool first_time_props_spawn; void MH_FakeTimeLimit(entity e, float t) { @@ -27,70 +22,6 @@ void MH_FakeTimeLimit(entity e, float t) #endif } -void prop_think(entity this) -{ - this.nextthink = time + 0.15; // don't need to update often, very unlikely for these to move - CSQCMODEL_AUTOUPDATE(this); -} - -void PropSetup(entity ent) -{ - setmodel(ent, MDL_RUNNER_PROP_RANDOM()); - setsize(ent, '-16 -16 -16', '16 16 16'); //ent.mins, ent.maxs); - setthink(ent, prop_think); - ent.nextthink = time + 0.25; - CSQCMODEL_AUTOINIT(ent); - - if(!ent.bot_attack) - IL_PUSH(g_bot_targets, ent); - ent.bot_attack = true; - - //ent.pickup_anyway = true; - ent.scale = 1.4; - ent.angles_y = floor(random() * 180); - //ent.takedamage = DAMAGE_AIM; - //SetResourceExplicit(ent, RES_HEALTH, 100); - - ent.solid = SOLID_BBOX; - ent.mass = 5; - ent.bouncefactor = 0.2; - ent.bouncestop = 0.3; - ent.friction = 1; - set_movetype(ent, MOVETYPE_STEP); //test with MOVETYPE_TOSS or MOVETYPE_WALK (it's like sliding object) or MOVETYPE_BOUNCE (maybe not good) - //setorigin(ent, org); - ent.velocity = randomvec() * 150 + '0 0 325'; - ent.reset = SUB_Remove; -} - -void prop_droptofloor(entity e) -{ - float max_depth = ((autocvar_g_mh_random_props_droptofloor_maxdepth < 0) ? max_shot_distance : autocvar_g_mh_random_props_droptofloor_maxdepth); - tracebox(e.origin, e.mins, e.maxs, e.origin - ('0 0 1' * max_depth), MOVE_NORMAL, e); - setorigin(e, trace_endpos); -} - -void SpawnProps(int pcount) -{ - for(int j = 0; j < pcount; ++j) - { - entity e = spawn(); - if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, autocvar_g_mh_random_props_tries, 1024, 256)) - { - if(autocvar_g_mh_random_props_droptofloor) - droptofloor(e); - else - prop_droptofloor(e); - - e.angles = '0 0 0'; - e.gravity = 1; - e.spawnfunc_checked = true; - PropSetup(e); - } - else - delete(e); // removes entity - } -} - MUTATOR_HOOKFUNCTION(mh, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE) { M_ARGV(1, string) = "mh_team"; @@ -102,43 +33,6 @@ MUTATOR_HOOKFUNCTION(mh, Scores_CountFragsRemaining) return true; } -// Prop feature -MUTATOR_HOOKFUNCTION(mh, FixPlayermodel) -{ - entity player = M_ARGV(2, entity); - - if(autocvar_g_mh_propmode) - { - if (player.team == Team_IndexToTeam(2)) - { - //string defaultmodel = M_ARGV(0, string); - // TODO: to be checked - if (!player.mh_prop && !IS_DEAD(player.mh_prop) && !player.mh_prop.modelchecked) // to brake the loop - { - player.mh_prop = spawn(); - - player.mh_prop.model = MDL_RUNNER_PROP_RANDOM().model_str(); - - player.mh_prop.solid = SOLID_BBOX; - setsize(player, '-16 -16 -16', '16 16 16'); - //setsize(player.mh_prop, '-16 -16 -16', '16 16 16'); - - M_ARGV(0, string) = player.mh_prop.model; - M_ARGV(1, int) = player.mh_prop.skin; - - //setmodel(player, MDL_RUNNER_PROP_RANDOM()); - player.playermodel = M_ARGV(0, string); - - player.mh_prop.modelchecked = true; - } - - // is this necessary? I just checked it does nothing or isn't noticeable - /*if(IS_DEAD(player) && player.mh_prop) - player.mh_prop = NULL;*/ - } - } -} - // =================== // weaponarena hooks // =================== @@ -148,7 +42,7 @@ MUTATOR_HOOKFUNCTION(mh, PlayerPreThink) { entity player = M_ARGV(0, entity); - if(!autocvar_g_mh_propmode && 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)) + 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)) @@ -175,41 +69,6 @@ MUTATOR_HOOKFUNCTION(mh, PlayerPreThink) player.mh_status = MH_STATUS_HUNTER; else if(player.team == Team_IndexToTeam(2)) player.mh_status = MH_STATUS_RUNNER; - - // TODO: Runners using prop must select an object in the map - /*if(!IS_DEAD(player) && player.team == Team_IndexToTeam(2)) - traceline_antilag( - player, - CS(player).cursor_trace_start, - CS(player).cursor_trace_start + normalize(CS(player).cursor_trace_endpos - CS(player).cursor_trace_start) * max_shot_distance, - MOVE_NORMAL, - player, - ANTILAG_LATENCY(player) - ); crosshair_trace(player);*/ - - // 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) @@ -225,7 +84,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 @@ -463,7 +322,7 @@ MUTATOR_HOOKFUNCTION(mh, MakePlayerObserver) if (IS_PLAYER(player) && !IS_DEAD(player)) mh_LastPlayerForTeam_Notify(player); - + player.mh_status = 0; MH_FakeTimeLimit(player, -1); // restore original timelimit return false; // allow team reset @@ -606,7 +465,7 @@ float MH_CheckWinner() 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), { delete(it.mh_prop); nades_Clear(it); MH_FakeTimeLimit(it, -1); }); //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); MH_FakeTimeLimit(it, -1); }); //hopefully "{ CS(it).killcount = 0; nades_Clear(it); }" works and doesn't cut off nades_Clear, untested return did_the_round_end; } @@ -714,16 +573,6 @@ MUTATOR_HOOKFUNCTION(mh, PutClientInServer) { entity player = M_ARGV(0, entity); - // if it's the first time that starts the gamemode for the props - if (autocvar_g_mh_propmode) - { - if (!first_time_props_spawn) - { - SpawnProps(autocvar_g_mh_random_props_count); - first_time_props_spawn = true; - } - } - 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 MH_FakeTimeLimit(player, round_handler_GetEndTime() - CS(player).jointime); // set HUD with current round time @@ -769,7 +618,7 @@ MUTATOR_HOOKFUNCTION(mh, PlayerDies) if (!allowed_to_spawn_untagged) { frag_target.respawn_flags = RESPAWN_SILENT; //idk what this exactly does yet, below comment was there for respawn time = time + 2 and this line inside the backets - // prevent unwanted sudden rejoin as spectator and movement of spectator camera + // prevent unwanted sudden rejoin as spectator and movement of spectator camera } frag_target.respawn_time = time; frag_target.respawn_flags |= RESPAWN_FORCE; @@ -806,32 +655,13 @@ MUTATOR_HOOKFUNCTION(mh, PlayerSpawn) entity player = M_ARGV(0, entity); player.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP; MH_count_players(); - + if(autocvar_g_mh_hunterblind) { if(player.team == Team_IndexToTeam(1)) HunterEyesStart(player); // Hunters can't see anything until round starts } - - if(autocvar_g_mh_propmode) - { - if(player.team == Team_IndexToTeam(1)) // Hunter needs weapons - { - //GiveWeapon(player, WEP_BLASTER.m_id, OP_PLUS, 1); - GiveWeapon(player, WEP_SHOTGUN.m_id, OP_PLUS, 1); - GiveWeapon(player, WEP_SHOCKWAVE.m_id, OP_PLUS, 1); - GiveWeapon(player, WEP_MACHINEGUN.m_id, OP_PLUS, 1); - GiveWeapon(player, WEP_MORTAR.m_id, OP_PLUS, 1); - } - - if(player.team == Team_IndexToTeam(2) && !IS_DEAD(player)) - { - LOG_INFOF("Spawned prop"); - if(player.mh_prop.modelchecked) - player.mh_prop.modelchecked = false; - } - } - + if(player.team == Team_IndexToTeam(2) && !allowed_to_spawn_untagged && Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(2)) > 1 && round_handler_IsActive() && round_handler_IsRoundStarted()){ player.mh_status = MH_STATUS_RUNNER; player.deadflag = 1; // avoid a crash when a spectator joins runners mid-round and gets sent to hunters @@ -856,16 +686,13 @@ MUTATOR_HOOKFUNCTION(mh, PlayerSpawn) vector pl_color = colormapPaletteColor(player.clientcolors & 0x0F, false); WaypointSprite_UpdateTeamRadar(player.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, pl_color); WaypointSprite_Ping(player.waypointsprite_attachedforcarrier); - } + }; } } //reset kill streaks and respawn players on round reset MUTATOR_HOOKFUNCTION(mh, reset_map_players) { - if (autocvar_g_mh_propmode) - SpawnProps(autocvar_g_mh_random_props_count); - FOREACH_CLIENT(true, { CS(it).killcount = 0; MH_FakeTimeLimit(it, -1); @@ -887,6 +714,8 @@ MUTATOR_HOOKFUNCTION(mh, reset_map_players) // to change // =========== + + //idk if this function is needed MUTATOR_HOOKFUNCTION(mh, reset_map_global) { diff --git a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh index d7594c560..e8e43a206 100644 --- a/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh +++ b/qcsrc/common/gamemodes/gamemode/mh/sv_mh.qh @@ -15,13 +15,6 @@ 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_propmode; -bool autocvar_g_mh_autotaunt_runner; -float autocvar_g_mh_autotaunt_runner_time; -int autocvar_g_mh_random_props_count; -int autocvar_g_mh_random_props_tries; -bool autocvar_g_mh_random_props_droptofloor; -float autocvar_g_mh_random_props_droptofloor_maxdepth; int mh_teams; bool allowed_to_spawn_untagged = 1; @@ -35,28 +28,6 @@ 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)); -} - -// Prop feature -MODEL(RUNNER_PROP1, "models/props/barrel01.iqm"); -MODEL(RUNNER_PROP2, "models/props/crate01.iqm"); -Model MDL_RUNNER_PROP_RANDOM() { - return REGISTRY_GET(Models, MDL_RUNNER_PROP1.m_id + floor(prandom() * 2)); -} - bool MH_CheckTeams(); bool MH_CheckWinner(); void MH_RoundStart();