Skip to content

Commit b3cfb96

Browse files
Add showCol, isShowCollisionsEnabled, showSound, isShowSoundEnabled for devs (#2025)
Co-authored-by: patrikjuvonen <22572159+patrikjuvonen@users.noreply.github.com>
1 parent 4a3f41e commit b3cfb96

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ void CLuaAudioDefs::LoadFunctions()
6565
{"setRadioChannel", SetRadioChannel},
6666
{"getRadioChannel", GetRadioChannel},
6767
{"getRadioChannelName", GetRadioChannelName},
68+
69+
// Dev funcs
70+
{"showSound", ArgumentParser<ShowSound>},
71+
{"isShowSoundEnabled", ArgumentParser<IsShowSoundEnabled>}
6872
};
6973

7074
// Add functions
@@ -1804,3 +1808,17 @@ int CLuaAudioDefs::GetRadioChannelName(lua_State* luaVM)
18041808
lua_pushboolean(luaVM, false);
18051809
return 1;
18061810
}
1811+
1812+
bool CLuaAudioDefs::ShowSound(bool state)
1813+
{
1814+
if (!g_pClientGame->GetDevelopmentMode())
1815+
return false;
1816+
1817+
g_pClientGame->SetShowSound(state);
1818+
return true;
1819+
}
1820+
1821+
bool CLuaAudioDefs::IsShowSoundEnabled()
1822+
{
1823+
return g_pClientGame->GetShowSound();
1824+
}

Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,7 @@ class CLuaAudioDefs : public CLuaDefs
6969
LUA_DECLARE(SetRadioChannel);
7070
LUA_DECLARE(GetRadioChannel);
7171
LUA_DECLARE(GetRadioChannelName);
72+
73+
static bool ShowSound(bool state);
74+
static bool IsShowSoundEnabled();
7275
};

Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ void CLuaColShapeDefs::LoadFunctions()
3636
{"getColShapeType", GetColShapeType},
3737
{"setColPolygonHeight", ArgumentParser<SetColPolygonHeight>},
3838
{"getColPolygonHeight", ArgumentParser<GetColPolygonHeight>},
39+
40+
{"showCol", ArgumentParser<SetShowCollision>},
41+
{"isShowCollisionsEnabled", ArgumentParser<IsShowCollisionsEnabled>}
3942
};
4043

4144
// Add functions
@@ -849,3 +852,17 @@ bool CLuaColShapeDefs::SetColPolygonHeight(CClientColPolygon* pColPolygon, std::
849852

850853
return false;
851854
}
855+
856+
bool CLuaColShapeDefs::SetShowCollision(bool state)
857+
{
858+
if (!g_pClientGame->GetDevelopmentMode())
859+
return false;
860+
861+
g_pClientGame->SetShowCollision(state);
862+
return true;
863+
}
864+
865+
bool CLuaColShapeDefs::IsShowCollisionsEnabled()
866+
{
867+
return g_pClientGame->GetShowCollision();
868+
}

Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class CLuaColShapeDefs : public CLuaDefs
4040
LUA_DECLARE(IsInsideColShape);
4141
LUA_DECLARE(GetColShapeType);
4242

43+
static bool SetShowCollision(bool state);
44+
static bool IsShowCollisionsEnabled();
45+
4346
static CLuaMultiReturn<float, float> GetColPolygonHeight(CClientColPolygon* pColPolygon);
44-
static bool SetColPolygonHeight(CClientColPolygon* pColPolygon, std::variant<bool, float> floor, std::variant<bool, float> ceil);
47+
static bool SetColPolygonHeight(CClientColPolygon* pColPolygon, std::variant<bool, float> floor, std::variant<bool, float> ceil);
4548
};

0 commit comments

Comments
 (0)