Skip to content

Commit

Permalink
Loadingscreen: Added Screen on Round Restart (#1524)
Browse files Browse the repository at this point in the history
**This PR is not as big as it looks, this is only because I modified the
tips strings in all languages!**

This pullrequests adds a loadingscreen that hides the visible and
audible lag introduced by the map cleanup on round change. This is done
because the lag can hardly be improved since it all takes place in
`game.CleanupMap`. It can be disabled if one dislikes it.

This PR also moves the (in my opinion annoying) tips panel to a more
useful place by displaying those tips on the new loading screen.


https://github.com/TTT-2/TTT2/assets/13639408/239e0441-0d51-4868-834d-ec121443e86b

Settings panel to disable loading screen and tips:


![image](https://github.com/TTT-2/TTT2/assets/13639408/9b25cacf-e325-4700-8606-8e37165b6285)

Note: The tips convar is carried over from the original TTT convar.
  • Loading branch information
TimGoll committed May 25, 2024
1 parent 1b865d3 commit 1b6b779
Show file tree
Hide file tree
Showing 29 changed files with 931 additions and 924 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Added a new admin commands menu (by @TimGoll)
- Added a submenu to change maps
- Added a submenu to issue basic commands
- Added a loadingscreen that hides the visible and audible lag introduced by the map cleanup on round change (by @TimGoll)

### Changed

Expand Down Expand Up @@ -74,11 +75,13 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
### Removed

- Removed radio tab in shop UI
- Removed the old tips panel visible to spectators (moved to the new loading screen) (by @TimGoll)

### Breaking Changes

- Renamed `TTT2ModifyVoiceChatColor(ply, clr)` to `TTT2ModifyVoiceChatMode(ply, mode)`
- Renamed `ply:GetHeightVector()` to `ply:GetHeadPosition()`
- Removed the `TIPS` module and replaced it with a new `tips` module

## [v0.13.1b](https://github.com/TTT-2/TTT2/tree/v0.13.1b) (2024-02-27)

Expand Down
2 changes: 2 additions & 0 deletions gamemodes/terrortown/gamemode/client/cl_hud_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ end
-- @local
function GM:PostDrawHUD()
vguihandler.DrawBackground()

loadingscreen.Handler()
end

---
Expand Down
8 changes: 2 additions & 6 deletions gamemodes/terrortown/gamemode/client/cl_keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ function GM:PlayerBindPress(ply, bindName, pressed)
end

if bindName == "invnext" and pressed then
if ply:IsSpec() then
TIPS.Next()
else
if not ply:IsSpec() then
WSWITCH:SelectNext()
end

return true
elseif bindName == "invprev" and pressed then
if ply:IsSpec() then
TIPS.Prev()
else
if not ply:IsSpec() then
WSWITCH:SelectPrev()
end

Expand Down
36 changes: 6 additions & 30 deletions gamemodes/terrortown/gamemode/client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ ttt_include("cl_marker_vision_data")
ttt_include("cl_search")
ttt_include("cl_tbuttons")
ttt_include("cl_scoreboard")
ttt_include("cl_tips")
ttt_include("cl_msgstack")
ttt_include("cl_eventpopup")
ttt_include("cl_hudpickup")
Expand Down Expand Up @@ -230,6 +229,8 @@ function GM:Initialize()

ShopEditor.BuildValidEquipmentCache()

tips.Initialize()

---
-- @realm shared
-- stylua: ignore
Expand All @@ -248,6 +249,8 @@ end
-- @ref https://wiki.facepunch.com/gmod/GM:PostCleanupMap
-- @local
function GM:PostCleanupMap()
loadingscreen.End()

---
-- @realm client
-- stylua: ignore
Expand Down Expand Up @@ -413,6 +416,8 @@ function GM:OnReloaded()

ShopEditor.BuildValidEquipmentCache()

tips.Initialize()

LocalPlayer():SetSettingOnServer(
"enable_dynamic_fov",
GetConVar("ttt2_enable_dynamic_fov"):GetBool()
Expand Down Expand Up @@ -711,36 +716,7 @@ function GM:CleanUpMap()
-- modify the collision group clientside.
ent.NoTarget = true
end

game.CleanUpMap()
end

-- server tells us to call this when our LocalPlayer has spawned
local function PlayerSpawn()
local as_spec = net.ReadBit() == 1
if as_spec then
TIPS.Show()
else
TIPS.Hide()
end

-- TTT Totem prevention
if LocalPlayer().GetRoleTable then
ErrorNoHaltWithStack(
"[TTT2][ERROR] You have TTT Totem activated! You really should disable it!\n-- Disable it by unsubscribe it! --\nI know, that's not nice, but there's no way. It's an internally problem of GMod..."
)
end
end
net.Receive("TTT_PlayerSpawned", PlayerSpawn)

local function PlayerDeath()
if not TIPS then
return
end

TIPS.Show()
end
net.Receive("TTT_PlayerDied", PlayerDeath)

---
-- Called to determine if the LocalPlayer should be drawn.
Expand Down
8 changes: 8 additions & 0 deletions gamemodes/terrortown/gamemode/client/cl_msgstack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ function MSTACK:AddMessage(text, traitor_only)
end
end

---
-- Clears the whole MStack message buffer and resets the counter to 0.
-- @realm client
function MSTACK:ClearMessages()
MSTACK.msgs = {}
MSTACK.last = 0
end

-- Game state message channel
local function ReceiveGameMsg()
local text = net.ReadString()
Expand Down
Loading

0 comments on commit 1b6b779

Please sign in to comment.