Skip to content

Commit

Permalink
Corpse: On Fire Feedback (#1551)
Browse files Browse the repository at this point in the history
- added "corpse on fire" to targetID when looking at a corpse
- moved the warning message when trying to inspect from chat to mstack
- allow spectators to look at burning corpses
- cleanup of missing `IsPlayerRagdoll` calls
  • Loading branch information
TimGoll authored Jun 3, 2024
1 parent 08e1e58 commit b03a912
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- The level time now starts with the first preparing phase, meaning that idle on connect doesn't decrease the map time (by @TimGoll)
- Minor cleanup and optimizations in weapon code (by @TW1STaL1CKY)
- Now always properly checks if an entity is a true ragdoll to make sure no other props get ragdoll handling (by @TimGoll)
- Spectators are now able to look at corpses on fire (by @TimGoll)
- Corpses on fire display that information in targetID and MStack (by @TimGoll)

### Fixed

Expand Down
10 changes: 10 additions & 0 deletions gamemodes/terrortown/content/materials/vgui/ttt/tid/tid_onfire.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"UnlitGeneric"
{
"$basetexture" "vgui/ttt/tid/tid_onfire"
"$nocull" 1
"$nodecal" 1
"$nolod" 1
"$translucent" 1
"$vertexalpha" 1
"$vertexcolor" 1
}
Binary file not shown.
2 changes: 1 addition & 1 deletion gamemodes/terrortown/gamemode/client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function GM:CleanUpMap()
for i = 1, #ragdolls do
local ent = ragdolls[i]

if not IsValid(ent) or CORPSE.GetPlayerNick(ent, "") == "" then
if not IsValid(ent) or not ent:IsPlayerRagdoll() then
continue
end

Expand Down
4 changes: 2 additions & 2 deletions gamemodes/terrortown/gamemode/server/sv_corpse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ function CORPSE.ShowSearch(ply, rag, isCovert, isLongRange)
end

-- prevent search for anyone if the body is burning
if rag:IsOnFire() then
LANG.Msg(ply, "body_burning", nil, MSG_CHAT_WARN)
if rag:IsOnFire() and ply:IsTerror() then
LANG.Msg(ply, "body_burning", nil, MSG_MSTACK_WARN)

return
end
Expand Down
10 changes: 5 additions & 5 deletions lua/ttt2/libraries/targetid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ local materialAutoClose = Material("vgui/ttt/tid/tid_auto_close")
local materialDoor = Material("vgui/ttt/tid/tid_big_door")
local materialDestructible = Material("vgui/ttt/tid/tid_destructible")
local materialDNATargetID = Material("vgui/ttt/dnascanner/dna_hud")
local materialFire = Material("vgui/ttt/tid/tid_onfire")

---
-- This function makes sure local variables, which use other libraries that are not yet initialized, are initialized later.
Expand Down Expand Up @@ -514,11 +515,6 @@ function targetid.HUDDrawTargetIDRagdolls(tData)
return
end

-- only show this if the ragdoll has a nick, else it could be a mattress
if not CORPSE.GetPlayerNick(ent, false) then
return
end

local corpse_found = CORPSE.GetFound(ent, false) or not gameloop.IsDetectiveMode()
local corpse_ply = corpse_found and CORPSE.GetPlayer(ent) or false
local binoculars_useable = IsValid(c_wep) and c_wep:GetClass() == "weapon_ttt_binoculars"
Expand Down Expand Up @@ -563,6 +559,10 @@ function targetid.HUDDrawTargetIDRagdolls(tData)
else
tData:SetSubtitle(ParT("corpse_hint", key_params))
end

if ent:IsOnFire() then
tData:AddDescriptionLine(TryT("body_burning"), COLOR_ORANGE, { materialFire })
end
elseif binoculars_useable then
tData:SetSubtitle(ParT("corpse_binoculars", { key = Key("+attack", "ATTACK") }))
else
Expand Down

0 comments on commit b03a912

Please sign in to comment.