Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Game.Client/C_BasePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,11 @@ public C_CommandContext GetCommandContext() {
return CommandContext;
}

public override void Dispose() {
base.Dispose();
public override void Term() {
if (this == localPlayer) {
localPlayer = null;
}
base.Term();
}

public float GetStepSize() => Local.StepSize;
Expand Down
18 changes: 3 additions & 15 deletions Game.Client/GarrysMod/GModBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,16 @@ public class GModBase : Panel
static void DestroyPanel(ref Panel? panel) {
if (panel == null)
return;
panel.SetParent(null);
panel.SetVisible(false);
panel.MarkForDeletion();
panel.DeletePanel();
panel = null;
}

public static void Shutdown() {
Panel clientDll = (Panel)enginevgui.GetPanel(VGuiPanelType.ClientDll);
for (int i = 0; i < clientDll.GetChildCount(); i++)
clientDll.GetChild(i).ClearLuaReferencesRecursive();

if (HudGMod.g_HudGMod != null) {
for (int i = 0; i < HudGMod.g_HudGMod.GetChildCount(); i++) {
HudGMod.g_HudGMod.GetChild(i).MarkForDeletion();
HudGMod.g_HudGMod.GetChild(i).ClearLuaReferencesRecursive();
}
while (HudGMod.g_HudGMod.GetChildCount() > 0)
HudGMod.g_HudGMod.GetChild(0).DeletePanel();
}

MouseInput?.ClearLuaReferencesRecursive();
BasePanel?.ClearLuaReferencesRecursive();
ParentToHUDPanel?.ClearLuaReferencesRecursive();

DestroyPanel(ref MouseInput);
DestroyPanel(ref BasePanel);
DestroyPanel(ref ParentToHUDPanel);
Expand Down
6 changes: 4 additions & 2 deletions Game.Client/HLClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,11 @@ public void LevelShutdown() {

// StopAllRumbleEffects();

// gHUD.LevelShutdown();
gHUD.LevelShutdown();

// todo
#if GMOD_DLL
Game.Client.GarrysMod.GarrysMod.Lua.Kill();
#endif
}

public LookupProxyInterfaceFn GetMaterialProxyInterfaceFn() {
Expand Down
5 changes: 5 additions & 0 deletions Game.Client/HUD/Hud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ public void VidInit() {
ResetHUD();
}

public void LevelShutdown() {
foreach (var element in HudList)
element.LevelShutdown();
}

public void InitColors(IScheme scheme) {
ClrNormal = scheme.GetColor("Normal", new(255, 208, 64, 255));
ClrCaution = scheme.GetColor("Caution", new(255, 48, 0, 255));
Expand Down
9 changes: 6 additions & 3 deletions Game.MenuSystem/MenuSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public int Init(IServiceProvider services, IGet get, IGarrysMod gmod, GlobalVars

public void Shutdown() {
filesystem.Addons().SetDownloadNotify(null);
CloseLua();
DestroyLoadingPanel();
DestroyMenuPanels();
CloseLua();
}

public void SetupNetworkString(INetworkStringTableContainer networkStringTableContainer) => networkstringtable = networkStringTableContainer;
Expand Down Expand Up @@ -108,12 +108,15 @@ void CloseLua() {
return;

LuaStarts++;
g_LuaID++;
get.LuaShared()!.UnMountLua("LuaMenu");
get.LuaShared()!.CloseLuaInterface(g_Lua);
g_Lua = null;
}

public void StartLua() {
DestroyLoadingPanel();
DestroyMenuPanels();
CloseLua();
MenuPanels.CreateMenuPanels();

Expand Down Expand Up @@ -158,7 +161,7 @@ static void DestroyLoadingPanel() {
return;

MenuPanels.g_hLoadingPanel.SetParent((Panel?)null);
MenuPanels.g_hLoadingPanel.MarkForDeletion();
MenuPanels.g_hLoadingPanel.DeletePanel();
MenuPanels.g_hLoadingPanel = null;
}

Expand All @@ -167,7 +170,7 @@ static void DestroyMenuPanels() {

if (MenuPanels.g_hMenuPanel != null) {
MenuPanels.g_hMenuPanel.SetParent((Panel?)null);
MenuPanels.g_hMenuPanel.MarkForDeletion();
MenuPanels.g_hMenuPanel.DeletePanel();
MenuPanels.g_hMenuPanel = null;
}

Expand Down
2 changes: 2 additions & 0 deletions Source.Engine/Server/SteamAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ public void Shutdown() {
if (!BIsActive())
return;

Steamworks.GameServer.Shutdown();

HasActivePlayers = false;
LogOnResult = false;
SteamIDGS = CSteamID.NotInitYetGS;
Expand Down
4 changes: 2 additions & 2 deletions Source.Filesystem/SearchPathIDCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public bool OpenOrCreateCollection(in ReadOnlySpan<char> pathID, out SearchPathC
return true;
}

public bool Remove(in ReadOnlySpan<char> pathID) {
ulong hashID = pathID.Hash();
public bool Remove(in ReadOnlySpan<char> pathID) => Remove(pathID.Hash());

public new bool Remove(ulong hashID) {
base.Remove(hashID);
searchPathNames.Remove(hashID);
return pathOrder.Remove(hashID);
Expand Down
6 changes: 0 additions & 6 deletions Source.GUI.Controls/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,12 +1526,6 @@ public void ClearLuaReferences() {
LuaObject?.UnReference();
LuaObject = null;
}

public virtual void ClearLuaReferencesRecursive() {
ClearLuaReferences();
for (int i = 0; i < GetChildCount(); i++)
GetChild(i).ClearLuaReferencesRecursive();
}
#endif

public virtual bool HasLuaTable() => LuaTable != null;
Expand Down
Loading