Skip to content

Commit

Permalink
syringegun poison: Cleanup old code, support crossbow
Browse files Browse the repository at this point in the history
  • Loading branch information
nosoop committed Sep 24, 2023
1 parent 654d8be commit 674aac3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripting/syringegun_poison_on_hit.sp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ public void OnGameFrame() {
}
}

void OnEntitySpawnPost(int entity) {
if (IsMedicWeapon(entity)) {
OnMedicWeaponCreated(entity);
}
}

void OnMedicWeaponCreated(int weapon) {
DHookEntity(g_DHookWeaponSecondaryAttack, true, weapon,
.callback = OnWeaponSecondaryAttack);
Expand Down Expand Up @@ -201,6 +195,10 @@ public Action TF2_OnCalculateMaxSpeed(int client, float &speed) {
}

bool IsMedicWeapon(int entity) {
return TF2Util_IsEntityWeapon(entity)
&& TF2Util_GetWeaponID(entity) == TF_WEAPON_SYRINGEGUN_MEDIC;
if (!TF2Util_IsEntityWeapon(entity)) {
return false;
}

int weaponid = TF2Util_GetWeaponID(entity);
return weaponid == TF_WEAPON_SYRINGEGUN_MEDIC || weaponid == TF_WEAPON_CROSSBOW;
}

0 comments on commit 674aac3

Please sign in to comment.