Skip to content

Commit

Permalink
Merge branch 'master' into button-fixes-targetid
Browse files Browse the repository at this point in the history
  • Loading branch information
TimGoll authored Aug 17, 2024
2 parents 8f3373c + 51cfb06 commit ec89916
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Added `admin.IsAdmin(ply)` as a wrapper that automatically calls `GM:TTT2AdminCheck` (by @TimGoll)
- Made sure this new function is used in our whole codebase for all admin checks
- Added `ENTITY:IsPlayerRagdoll` to check if a corpse is a real player ragdoll (by @TimGoll)
- Added improved vFire integration for everything in TTT2 that spawns fire (by @TimGoll and @EntranceJew)
- Added the `SWEP.DryFireSound` field to the weapon base to allow the dryfire sound to be easily changed (by @TW1STaL1CKY)
- Added role derandomization options for perceptually fairer role distribution
- Added targetID to buttons (by @TimGoll)
Expand Down Expand Up @@ -91,10 +92,13 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Fixed weapon dryfire sound interrupting the weapon's gunshot sound (by @TW1STaL1CKY)
- Fixed incendiaries sometimes exploding without fire (by @TimGoll)
- Fixed scoreboard not showing any body search info on players that changed to forced spec during a round (by @TimGoll)
- Fixed vFire explosions killing a player even if they have `NoExplosionDamage` equipped (by @TimGoll)
- Fixed a nil error in the PreDrop function in weapon_ttt_cse (by @mexikoedi)
- Fixed `table.FullCopy(tbl)` behaviour when `tbl` contained a Vector or Angle (by @Histalek)
- Fixed the bodysearch showing a wrong player icon when searching a fake body (by @TimGoll)
- Fixed players respawned with `ply:Revive` sometimes spawning on a fake corpse (by @TimGoll)
- Fixed undefined Keys breaking the gamemode (by @TimGoll)
- Fixed markerVision elements being visible to team mates of unknown teams (such as team Innocent) (by @TimGoll)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ if CLIENT then
-- @ignore
function SWEP:Initialize()
self:AddTTT2HUDHelp("binoc_help_pri", "binoc_help_sec")
self:AddHUDHelpLine("binoc_help_reload", Key("+reload", "R"))
self:AddHUDHelpLine("binoc_help_reload", Key("+reload", "undefined_key"))

BaseClass.Initialize(self)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ if CLIENT then
self.selectedMode = 1

self:AddTTT2HUDHelp("spawneditor_place", "spawneditor_remove")
self:AddHUDHelpLine("spawneditor_change", Key("+reload", "R"))
self:AddHUDHelpLine("spawneditor_ammo_edit", Key("+walk", "WALK"))
self:AddHUDHelpLine("spawneditor_change", Key("+reload", "undefined_key"))
self:AddHUDHelpLine("spawneditor_ammo_edit", Key("+walk", "undefined_key"))

hook.Add("PostDrawTranslucentRenderables", "RenderWeaponSpawnEdit", RenderHook)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ if CLIENT then
self:SetSubMaterial(0, "!scanner_screen_mat")

self:AddTTT2HUDHelp("dna_help_primary", "dna_help_secondary")
self:AddHUDHelpLine("dna_help_reload", Key("+reload", "R"))
self:AddHUDHelpLine("dna_help_reload", Key("+reload", "undefined_key"))

return BaseClass.Initialize(self)
end
Expand Down
11 changes: 7 additions & 4 deletions gamemodes/terrortown/entities/weapons/weapon_tttbase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ if CLIENT then
local isIcon = false

if isstring(binding) then
-- attempt to translate binding in case it can be translated
bindig = TryT(binding)

local wKey, hKey = draw.GetTextSize(binding, "weapon_hud_help_key", scale)

wBinding = wKey + 2 * padXKey * scale
Expand Down Expand Up @@ -710,11 +713,11 @@ if CLIENT then
self:ClearHUDHelp()

if primary then
self:AddHUDHelpLine(primary, Key("+attack", "MOUSE1"))
self:AddHUDHelpLine(primary, Key("+attack", "undefined_key"))
end

if secondary then
self:AddHUDHelpLine(secondary, Key("+attack2", "MOUSE2"))
self:AddHUDHelpLine(secondary, Key("+attack2", "undefined_key"))
end
end

Expand All @@ -727,11 +730,11 @@ if CLIENT then
self:ClearHUDHelp()

if primary then
self:AddHUDHelpLine(primary, Key("+attack", "MOUSE1"))
self:AddHUDHelpLine(primary, Key("+attack", "undefined_key"))
end

if secondary then
self:AddHUDHelpLine(secondary, Key("+attack2", "MOUSE2"))
self:AddHUDHelpLine(secondary, Key("+attack2", "undefined_key"))
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ if SERVER then
end
elseif self.data.visibleFor == VISIBLE_FOR_TEAM then
if IsPlayer(self.data.owner) then
self.receiverList = GetTeamFilter(self.data.owner:GetTeam(), false, true)
local team = self.data.owner:GetTeam()
local subRoleData = self.data.owner:GetSubRoleData()

-- visible for team is restricted when the team is unknown
if subRoleData.unknownTeam or team == TEAM_NONE or TEAMS[team].alone then
self.receiverList = { self.data.owner }
else
self.receiverList = GetTeamFilter(team, false, true)
end
else
-- handle static team
self.receiverList = GetTeamFilter(self.data.owner, false, true)
Expand Down
2 changes: 2 additions & 0 deletions lua/terrortown/lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2348,3 +2348,5 @@ L.name_button_rotating = "Lever"

L.button_default = "Press [{usekey}] to trigger"
L.button_rotating = "Press [{usekey}] to flip"

L.undefined_key = "???"
8 changes: 7 additions & 1 deletion lua/ttt2/extensions/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ local inputLookupBinding = input.LookupBinding
-- @return boolean Returns true if the binding is pressed
-- @realm client
function input.IsBindingDown(binding)
return inputIsButtonDown(inputGetKeyCode(inputLookupBinding(binding)))
local bindingLookup = inputLookupBinding(binding)

if not bindingLookup then
return false
end

return inputIsButtonDown(inputGetKeyCode(bindingLookup))
end
52 changes: 52 additions & 0 deletions lua/ttt2/libraries/game_effects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ function gameEffects.StartFires(
local vstart = pos + tr.HitNormal * 64
local ttl = lifetime + math.Rand(-lifetimeVariance, lifetimeVariance)

if vFireInstalled then
flames[#flames + 1] = CreateVFireBall(
ttl,
0.5 * size,
vstart,
0.5 * ang:Forward() * forceSpread,
dmgowner
)

continue
end

local flame = ents.Create("ttt_flame")
flame:SetPos(vstart)
flame:SetFlameSize(size)
Expand Down Expand Up @@ -135,3 +147,43 @@ function gameEffects.RadiusDamage(dmginfo, pos, radius, inflictor)
end
end
end

-- vFIRE INTEGRATION

if SERVER then
-- This is a replacement hook for the explosion damage hook in vFire. The difference here is
-- that it is only applied if the damage is for non-player entities.
--
-- original doc: Fix fire dependent entities' behaviors, for instance:
-- Explosive barrels rely on being ignited to explode after damaged by an explosion themselves
-- Because vFire removes default fires, we need to encourage more chain explosions
local function vFireTakeDamageReplacement(ent, dmg)
---
-- @realm server
-- stylua: ignore
if hook.Run("vFireSuppressExplosionBehavior") then
return
end

if not IsValid(ent) or not ent:IsPlayer() or not dmg:IsExplosionDamage() then
return
end

local hp = ent:Health()
if hp < dmg:GetDamage() and hp > 0 and math.random(1, 3) == 1 then
ent:SetHealth(0)
end
end

hook.Add("TTT2FinishedLoading", "TTT2TweakvFire", function()
if not vFireInstalled then
return
end

-- increase the think rate of fires to increase the damage dealt by fire
vFireBurnThinkTickRate = 0.75

hook.Remove("EntityTakeDamage", "vFireFixExplosion")
hook.Add("EntityTakeDamage", "vFireFixExplosionReplacement", vFireTakeDamageReplacement)
end)
end

0 comments on commit ec89916

Please sign in to comment.