Added allDamageArmor
This commit is contained in:
parent
e19094ff65
commit
66102c8025
@ -18,6 +18,8 @@ namespace pdHealth
|
|||||||
int armorRegen = 25; //How far to regenerate the armor
|
int armorRegen = 25; //How far to regenerate the armor
|
||||||
int armorRegenSpeed = 1; //How much armor to regenerate per tick
|
int armorRegenSpeed = 1; //How much armor to regenerate per tick
|
||||||
int armorRegenDelay = 5000; //Delay before recharging armor
|
int armorRegenDelay = 5000; //Delay before recharging armor
|
||||||
|
bool allDamageArmor = true; //The armor soaks up all the health, even for fall and explosion-damage.
|
||||||
|
bool ditchDamage = false; //Ditch damage, if hit depletes armor completely
|
||||||
|
|
||||||
//Vars
|
//Vars
|
||||||
int armorVal = -1;
|
int armorVal = -1;
|
||||||
@ -28,9 +30,6 @@ namespace pdHealth
|
|||||||
{
|
{
|
||||||
Ped pl = Player.Character;
|
Ped pl = Player.Character;
|
||||||
|
|
||||||
if (pl.Armor < armorVal) { timeUntilRegen = armorRegenDelay; }
|
|
||||||
if (pl.Health < healthVal) { timeUntilRegen = armorRegenDelay; }
|
|
||||||
|
|
||||||
if (pl.isAlive == false) {
|
if (pl.isAlive == false) {
|
||||||
armorVal = -1;
|
armorVal = -1;
|
||||||
healthVal = -1;
|
healthVal = -1;
|
||||||
@ -38,6 +37,22 @@ namespace pdHealth
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pl.Armor < armorVal) { timeUntilRegen = armorRegenDelay; }
|
||||||
|
if (pl.Health < healthVal) { timeUntilRegen = armorRegenDelay; }
|
||||||
|
|
||||||
|
if (allDamageArmor == true) {
|
||||||
|
if (pl.Health < healthVal) {
|
||||||
|
int damageTaken = healthVal - pl.Health;
|
||||||
|
if (damageTaken < pl.Armor) {
|
||||||
|
pl.Health = pl.Health + damageTaken;
|
||||||
|
pl.Armor = pl.Armor - damageTaken;
|
||||||
|
} else {
|
||||||
|
pl.Health = pl.Health + (damageTaken - pl.Armor);
|
||||||
|
pl.Armor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (timeUntilRegen > 0) {
|
if (timeUntilRegen > 0) {
|
||||||
timeUntilRegen = timeUntilRegen - tickTime;
|
timeUntilRegen = timeUntilRegen - tickTime;
|
||||||
if (timeUntilRegen < 0) { timeUntilRegen = 0; }
|
if (timeUntilRegen < 0) { timeUntilRegen = 0; }
|
||||||
|
Loading…
Reference in New Issue
Block a user