Skip to content

Commit

Permalink
Reimplement "1% chance of death" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Mar 8, 2024
1 parent 8b19f57 commit 2a9a9e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion GSChaos/CFeatureOnePercentDeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void CFeatureOnePercentDeath::ActivateFeature()
{
CChaosFeature::ActivateFeature();

if (RANDOM_LONG(1, 1000) % 100 == 0)
if (gChaos.GetRandomValue(1, 100) == 1)
{
edict_t* pent = CREATE_NAMED_ENTITY(MAKE_STRING("rpg_rocket"));
if (!pent)
Expand All @@ -24,6 +24,11 @@ void CFeatureOnePercentDeath::ActivateFeature()
pent->v.nextthink = gpGlobals->time + 0.1f;
gEntityInterface->pfnSpawn(pent);
gEntityInterface->pfnThink(pent);
gEntityInterface->pfnTouch((*sv_player), pent);
gEntityInterface->pfnTouch(pent, (*sv_player));

if ((*sv_player)->v.health > 1.0f)
(*sv_player)->v.health = -20.0f;
}
}

Expand Down

0 comments on commit 2a9a9e4

Please sign in to comment.