updated version of SV_instagib.qc to newest version.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Alex 2024-10-06 02:16:24 +02:00
parent 88dd8bff3c
commit edd18cff26

View file

@ -16,6 +16,7 @@ bool autocvar_g_instagib_ammo_convert_cells;
bool autocvar_g_instagib_ammo_convert_rockets; bool autocvar_g_instagib_ammo_convert_rockets;
bool autocvar_g_instagib_ammo_convert_shells; bool autocvar_g_instagib_ammo_convert_shells;
bool autocvar_g_instagib_ammo_convert_bullets; bool autocvar_g_instagib_ammo_convert_bullets;
bool autocvar_g_instagib_allow_jetpacks;
/// \brief Returns a random classname of the instagib item. /// \brief Returns a random classname of the instagib item.
/// \param[in] prefix Prefix of the cvars that hold probabilities. /// \param[in] prefix Prefix of the cvars that hold probabilities.
@ -212,20 +213,17 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER)) if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
{ {
if(frag_deathtype & HITTYPE_SECONDARY) if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
{ {
if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target) frag_damage = 0;
{ if(!autocvar_g_instagib_mirrordamage)
frag_damage = 0; frag_mirrordamage = 0; // never do mirror damage on enemies
if(!autocvar_g_instagib_mirrordamage) }
frag_mirrordamage = 0; // never do mirror damage on enemies
}
if(frag_target != frag_attacker) if(frag_target != frag_attacker)
{ {
if(!autocvar_g_instagib_blaster_keepforce) if(!autocvar_g_instagib_blaster_keepforce)
frag_force = '0 0 0'; frag_force = '0 0 0';
}
} }
} }
} }
@ -326,6 +324,8 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
if(autocvar_g_powerups) if(autocvar_g_powerups)
instagib_replace_item_with_random_powerup(item); instagib_replace_item_with_random_powerup(item);
return true; return true;
case ITEM_Invisibility: case ITEM_ExtraLife: case ITEM_Speed:
return false;
case ITEM_Cells: case ITEM_Cells:
if(autocvar_g_instagib_ammo_convert_cells) if(autocvar_g_instagib_ammo_convert_cells)
instagib_replace_item_with(item, ITEM_VaporizerCells); instagib_replace_item_with(item, ITEM_VaporizerCells);
@ -342,6 +342,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
if(autocvar_g_instagib_ammo_convert_bullets) if(autocvar_g_instagib_ammo_convert_bullets)
instagib_replace_item_with(item, ITEM_VaporizerCells); instagib_replace_item_with(item, ITEM_VaporizerCells);
return true; return true;
case ITEM_Jetpack:
case ITEM_JetpackRegen:
return !autocvar_g_instagib_allow_jetpacks;
} }
switch (item.weapon) switch (item.weapon)
@ -358,9 +361,6 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
return true; return true;
} }
if(item.itemdef.instanceOfPowerup)
return false;
float cells = GetResource(item, RES_CELLS); float cells = GetResource(item, RES_CELLS);
if(cells > autocvar_g_instagib_ammo_drop && item.classname != "item_vaporizer_cells") if(cells > autocvar_g_instagib_ammo_drop && item.classname != "item_vaporizer_cells")
SetResource(item, RES_CELLS, autocvar_g_instagib_ammo_drop); SetResource(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
@ -374,11 +374,13 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies) MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDies)
{ {
float frag_deathtype = M_ARGV(3, float); float frag_deathtype = M_ARGV(3, float);
entity attacker = M_ARGV(1, entity);
entity attacker = M_ARGV(1, entity);
if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER)) if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death M_ARGV(4, float) = 1000; // always gib if it was a vaporizer death
.entity weaponentity = weaponentities[0]; .entity weaponentity = weaponentities[0];
ATTACK_FINISHED(attacker, weaponentity) = time; ATTACK_FINISHED(attacker, weaponentity) = time;
} }
MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch) MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
@ -431,4 +433,4 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, SetModname)
{ {
M_ARGV(0, string) = "InstaGib"; M_ARGV(0, string) = "InstaGib";
return true; return true;
} }