Skip to content

Commit

Permalink
Implemented CVar mp_respawn_immunity_force_unset Closed rehlds#462
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jan 15, 2020
1 parent 6ff75da commit 46f697f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_legacy_bombtarget_touch | 1 | 0 | 1 | Legacy func_bomb_target touch. New one is more strict. <br/>`0` New behavior<br/>`1` Legacy behavior|
| mp_respawn_immunitytime | 0 | 0 | - | Specifies the players defense time after respawn. (in seconds).<br/>`0` disabled<br/>`>0.00001` time delay to remove protection |
| mp_respawn_immunity_effects | 1 | 0 | 1 | Enable effects on player spawn protection.<br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar mp_respawn_immunitytime) |
| mp_respawn_immunity_force_unset | 1 | 0 | 1 | Force unset spawn protection if the player doing any action.<br/>`0` disabled<br/>`1` enabled |
| mp_kill_filled_spawn | 1 | 0 | 1 | Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).<br />Only disable this if you have semiclip or other plugins that prevents stucking.<br/>`0` disabled<br/>`1` enabled |
| mp_allow_point_servercommand | 0 | 0 | 1 | Allow use of point_servercommand entities in map.<br/>`0` disallow<br/>`1` allow<br/>`NOTE`: Potentially dangerous for untrusted maps. |
| mp_hullbounds_sets | 1 | 0 | 1 | Sets mins/maxs hull bounds for the player.<br/>`0` disabled<br/>`1` enabled |
Expand Down
7 changes: 7 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ mp_respawn_immunitytime "0"
// Default value: "1"
mp_respawn_immunity_effects 1

// Force unset spawn protection if the player doing any action.
// 0 - disabled
// 1 - enabled
//
// Default value: "1"
mp_respawn_immunity_force_unset 1

// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other).
// Only disable this if you have semiclip or other plugins that prevents stucking
// 0 - disabled
Expand Down
40 changes: 21 additions & 19 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,26 @@ cvar_t fraglimit = { "mp_fraglimit", "0", FCVAR_SERVER, 0.0f, nullpt
cvar_t round_restart_delay = { "mp_round_restart_delay", "5", FCVAR_SERVER, 0.0f, nullptr };
cvar_t showtriggers = { "showtriggers", "0", 0, 0.0f, nullptr }; // debug cvar shows triggers
// TODO: Maybe it's better to register in the engine?
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr };
cvar_t show_scenarioicon = { "mp_show_scenarioicon", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr };
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t respawn_immunity_effects = { "mp_respawn_immunity_effects", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", 0, 0.0f, nullptr };
cvar_t afk_bomb_drop_time = { "mp_afk_bomb_drop_time", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t buy_anywhere = { "mp_buy_anywhere", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t give_player_c4 = { "mp_give_player_c4", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t weapons_allow_map_placed = { "mp_weapons_allow_map_placed", "1", FCVAR_SERVER, 0.0f, nullptr };

cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr };
cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr };
cvar_t unduck_method = { "mp_unduck_method", "0", 0, 0.0f, nullptr };
cvar_t hostagehurtable = { "mp_hostage_hurtable", "1", FCVAR_SERVER, 1.0f, nullptr };
cvar_t roundover = { "mp_roundover", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t forcerespawn = { "mp_forcerespawn", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t show_radioicon = { "mp_show_radioicon", "1", 0, 1.0f, nullptr };
cvar_t show_scenarioicon = { "mp_show_scenarioicon", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", 0, 1.0f, nullptr };
cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr };
cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", 0, 1.0f, nullptr };
cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t respawn_immunity_effects = { "mp_respawn_immunity_effects", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t respawn_immunity_force_unset = { "mp_respawn_immunity_force_unset", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", 0, 0.0f, nullptr };
cvar_t afk_bomb_drop_time = { "mp_afk_bomb_drop_time", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t buy_anywhere = { "mp_buy_anywhere", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t give_player_c4 = { "mp_give_player_c4", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t weapons_allow_map_placed = { "mp_weapons_allow_map_placed", "1", FCVAR_SERVER, 0.0f, nullptr };

cvar_t allow_point_servercommand = { "mp_allow_point_servercommand", "0", 0, 0.0f, nullptr };
cvar_t hullbounds_sets = { "mp_hullbounds_sets", "1", 0, 0.0f, nullptr };
cvar_t unduck_method = { "mp_unduck_method", "0", 0, 0.0f, nullptr };

cvar_t ff_damage_reduction_bullets = { "ff_damage_reduction_bullets", "0.35", FCVAR_SERVER, 0.0f, nullptr };
cvar_t ff_damage_reduction_grenade = { "ff_damage_reduction_grenade", "0.25", FCVAR_SERVER, 0.0f, nullptr };
Expand Down Expand Up @@ -341,6 +342,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&legacy_bombtarget_touch);
CVAR_REGISTER(&respawn_immunitytime);
CVAR_REGISTER(&respawn_immunity_effects);
CVAR_REGISTER(&respawn_immunity_force_unset);
CVAR_REGISTER(&kill_filled_spawn);
CVAR_REGISTER(&afk_bomb_drop_time);
CVAR_REGISTER(&buy_anywhere);
Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ extern cvar_t item_staytime;
extern cvar_t legacy_bombtarget_touch;
extern cvar_t respawn_immunitytime;
extern cvar_t respawn_immunity_effects;
extern cvar_t respawn_immunity_force_unset;
extern cvar_t kill_filled_spawn;
extern cvar_t afk_bomb_drop_time;
extern cvar_t buy_anywhere;
Expand Down
4 changes: 2 additions & 2 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4504,8 +4504,8 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()

#ifdef REGAMEDLL_ADD
auto protectStateCurrent = CSPlayer()->GetProtectionState();
if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired ||
(protectStateCurrent == CCSPlayer::ProtectionSt_Active && (m_afButtonPressed & IN_ACTIVE)))
if (protectStateCurrent == CCSPlayer::ProtectionSt_Expired || (respawn_immunity_force_unset.value &&
(protectStateCurrent == CCSPlayer::ProtectionSt_Active && (m_afButtonPressed & IN_ACTIVE))))
{
RemoveSpawnProtection();
}
Expand Down

0 comments on commit 46f697f

Please sign in to comment.