Skip to content

Commit 4475d44

Browse files
authored
Fixed guns not applying themselves as their damage inflictor for FireBullets (#1819)
I've noticed that guns in TTT2 don't set their Inflictor as themselves for FireBullets ([which is a new-ish addition](https://wiki.facepunch.com/gmod/Structures/Bullet#Inflictor)), so I've fixed that. I'd like to note it seems `util.WeaponFromDamage` was partially used as a workaround for FireBullets not setting an Inflictor, do people think it's still needed?
1 parent 98b0236 commit 4475d44

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
44

55
## Unreleased
66

7+
### Fixed
8+
9+
- Fixed guns not applying themselves as their damage inflictor (by @TW1STaL1CKY)
10+
711
## [v0.14.4b](https://github.com/TTT-2/TTT2/tree/v0.14.4b) (2025-06-15)
812

913
### Fixed

gamemodes/terrortown/entities/weapons/weapon_ttt_flaregun.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ function SWEP:ShootFlare()
197197
local cone = self.Primary.Cone
198198

199199
local bullet = {}
200+
bullet.Inflictor = self
200201
bullet.Num = 1
201202
bullet.Src = owner:GetShootPos()
202203
bullet.Dir = owner:GetAimVector()

gamemodes/terrortown/entities/weapons/weapon_ttt_push.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function SWEP:FirePulse(force_fwd, force_up)
129129
local num = 6
130130

131131
local bullet = {}
132+
bullet.Inflictor = self
132133
bullet.Num = num
133134
bullet.Src = owner:GetShootPos()
134135
bullet.Dir = owner:GetAimVector()

gamemodes/terrortown/entities/weapons/weapon_ttt_stungun.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function SWEP:ShootBullet(dmg, recoil, numbul, cone)
6565
cone = sights and (cone * 0.9) or cone
6666

6767
local bullet = {}
68+
bullet.Inflictor = self
6869
bullet.Num = numbul
6970
bullet.Src = owner:GetShootPos()
7071
bullet.Dir = owner:GetAimVector()

gamemodes/terrortown/entities/weapons/weapon_tttbase.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ function SWEP:ShootBullet(dmg, recoil, numbul, cone)
10771077
cone = cone or 0.02
10781078

10791079
local bullet = {}
1080+
bullet.Inflictor = self
10801081
bullet.Num = numbul
10811082
bullet.Src = owner:GetShootPos()
10821083
bullet.Dir = owner:GetAimVector()

0 commit comments

Comments
 (0)