Skip to content

The last round of a clip deals its damage: the Marksman's sniper hits again - #36

Merged
itxtoledo merged 1 commit into
mainfrom
fix/marksman-koth-damage
Nov 28, 2026
Merged

itxtoledo merged 1 commit into
mainfrom
fix/marksman-koth-damage

Conversation

@itxtoledo

Copy link
Copy Markdown
Contributor

Problem

A Marksman's sniper dealt no damage to players (reported on KotH, Villages_1024, but it happens in every mode where classes play).

Emptying the clip sets primary_fire back to 0 (WeaponInput.c, Player.c). The hit of that same round is read after it, and allow_shot refused it as not_firing. The sniper holds one round (BattleSpades' table: clip 1, reserve 7), so every shot was a last round and all were refused. The other guns lost the last round of every clip.

Fix

game_player_hit already tells a last round still in the gun's interval apart from a real empty clip (the empty_clip check). Such a hit now counts as fired, in allow_shot and in _hit_refusal. weapon_pellets still allows one hit a round.

Tested

  • client/tools/sptest/scripts/sniper_retail.txt (KotH, --classes, Creative_Flat, --bots-test): before, hit_refused why=not_firing; after, damage from=p1 amount=72 (50 scaled by the bot class's 70 hp).
  • shot_damage.txt + shot_damage.py (classic rifle, 60 shots): 18 on a player, 14 damaged, 4 spawn_protect, 0 lost.
  • make test: proto10 6331 checks passed, ext075 passed, configs OK.
  • Not covered: Villages_1024 itself. The --bots-test bot spawns behind blocks and the friendly helicopter, so no shot reached it with either server.

… again

Emptying the clip sets primary_fire back to 0 (WeaponInput.c, Player.c), and
the hit of that round, read after it, was refused as not_firing. The sniper
holds one round, so every one of its shots was refused; the other guns lost
the last round of every clip. A hit with an empty clip whose round is still
in the gun's interval (the empty_clip check before it already tells them
apart) now counts as fired. weapon_pellets still allows one hit a round.
@itxtoledo
itxtoledo merged commit b5f5df4 into main Nov 28, 2026
2 checks passed
@itxtoledo
itxtoledo deleted the fix/marksman-koth-damage branch November 28, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant