1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-27 07:30:09 -05:00

Health regeneration changes

This commit is contained in:
Jbleezy
2020-03-11 03:43:57 -07:00
parent 6c3eafd063
commit 7a1d96fcb6
2 changed files with 192 additions and 0 deletions

View File

@ -15,7 +15,14 @@
## Players
* Unlimited sprint
* 100% backwards speed, strafe speed, and sprint strafe speed
* Decreased normal health regeneration delay from 2.4 seconds to 2 seconds
* Decreased low health regeneration delay from 5 seconds to 4 seconds
* Normal health regeneration rate is no longer instant
* Changed health regeneration rate to 100 health per second (previously fully restored health in 0.5 seconds)
* Fall damage no longer increases when max health is increased
* Red screens start at 25% health (previously 20% health)
* Red screens go away as soon as the player's health is above 25% (previously went away once the player reached full health)
* Removed blur when getting damaged
* Disabled melee lunging
* Can shoot when looking at other players
* Mantle faster

View File

@ -86,6 +86,8 @@ onplayerspawned()
self setperk( "specialty_fastmantle" );
self tombstone_reset_perks();
self thread playerhealthregen();
}
}
@ -1300,6 +1302,189 @@ get_zone_name()
return name;
}
playerhealthregen()
{
self notify( "noHealthOverlay" );
self notify( "playerHealthRegen" );
self endon( "playerHealthRegen" );
self endon( "death" );
self endon( "disconnect" );
if ( !isDefined( self.flag ) )
{
self.flag = [];
self.flags_lock = [];
}
if ( !isDefined( self.flag[ "player_has_red_flashing_overlay" ] ) )
{
self player_flag_init( "player_has_red_flashing_overlay" );
self player_flag_init( "player_is_invulnerable" );
}
self player_flag_clear( "player_has_red_flashing_overlay" );
self player_flag_clear( "player_is_invulnerable" );
self thread maps/mp/zombies/_zm_playerhealth::healthoverlay();
oldratio = 1;
veryhurt = 0;
playerjustgotredflashing = 0;
invultime = 0;
hurttime = 0;
newhealth = 0;
lastinvulratio = 1;
healthoverlaycutoff = 0.25;
self thread maps/mp/zombies/_zm_playerhealth::playerhurtcheck();
if ( !isDefined( self.veryhurt ) )
{
self.veryhurt = 0;
}
self.bolthit = 0;
if ( getDvar( "scr_playerInvulTimeScale" ) == "" )
{
setdvar( "scr_playerInvulTimeScale", 1 );
}
playerinvultimescale = getDvarFloat( "scr_playerInvulTimeScale" );
for ( ;; )
{
wait 0.05;
waittillframeend;
maxhealthratio = self.maxhealth / 100;
regenrate = 0.05 / maxhealthratio;
health_ratio = self.health / self.maxhealth;
regularregendelay = 2000;
longregendelay = 4000;
if ( health_ratio > healthoverlaycutoff )
{
if ( self player_flag( "player_has_red_flashing_overlay" ) )
{
player_flag_clear( "player_has_red_flashing_overlay" );
}
lastinvulratio = 1;
playerjustgotredflashing = 0;
veryhurt = 0;
if ( self.health == self.maxhealth )
{
continue;
}
}
else if ( self.health <= 0 )
{
return;
}
wasveryhurt = veryhurt;
if ( health_ratio <= healthoverlaycutoff )
{
veryhurt = 1;
if ( !wasveryhurt )
{
hurttime = getTime();
self player_flag_set( "player_has_red_flashing_overlay" );
playerjustgotredflashing = 1;
}
}
if ( self.hurtagain )
{
hurttime = getTime();
self.hurtagain = 0;
}
if ( health_ratio >= oldratio )
{
if ( ( getTime() - hurttime ) < regularregendelay )
{
continue;
}
else
{
self.veryhurt = veryhurt;
newhealth = health_ratio;
if ( veryhurt )
{
if ( ( getTime() - hurttime ) >= longregendelay )
{
newhealth += regenrate;
}
}
else
{
newhealth += regenrate;
}
}
if ( newhealth > 1 )
{
newhealth = 1;
}
if ( newhealth <= 0 )
{
return;
}
self setnormalhealth( newhealth );
oldratio = self.health / self.maxhealth;
continue;
}
else
{
invulworthyhealthdrop = ( lastinvulratio - health_ratio ) > level.worthydamageratio;
}
if ( self.health <= 1 )
{
self setnormalhealth( 1 / self.maxhealth );
invulworthyhealthdrop = 1;
}
oldratio = self.health / self.maxhealth;
self notify( "hit_again" );
hurttime = getTime();
if ( !invulworthyhealthdrop || playerinvultimescale <= 0 )
{
continue;
}
else
{
if ( self player_flag( "player_is_invulnerable" ) )
{
continue;
}
else
{
self player_flag_set( "player_is_invulnerable" );
level notify( "player_becoming_invulnerable" );
if ( playerjustgotredflashing )
{
invultime = level.invultime_onshield;
playerjustgotredflashing = 0;
}
else if ( veryhurt )
{
invultime = level.invultime_postshield;
}
else
{
invultime = level.invultime_preshield;
}
invultime *= playerinvultimescale;
lastinvulratio = self.health / self.maxhealth;
self thread maps/mp/zombies/_zm_playerhealth::playerinvul( invultime );
}
}
}
}
set_player_lethal_grenade_semtex()
{
if (level.script != "zm_transit" && level.script != "zm_nuked" && level.script != "zm_highrise" && level.script != "zm_tomb")