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
10 changes: 9 additions & 1 deletion Game.Shared/GarrysMod/LuaEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ static int Entity__IsMarkedForDeletion(ILuaInterface lua) {
return 1;
}

[LuaMethod]
static int Entity__MuzzleFlash(ILuaInterface lua) {
BaseEntity ent = Get_Entity(1, false)!;
ent.GetBaseAnimating()?.DoMuzzleFlash();
return 0;
}

[LuaMethod]
static int Entity__Remove(ILuaInterface lua) {
if (LuaEnts.IsRendering()) {
Expand Down Expand Up @@ -1049,7 +1056,8 @@ static int Entity__IsPlayer(ILuaInterface lua) {

[LuaMethod]
static int Entity__IsNPC(ILuaInterface lua) {
lua.PushBool(false);
BaseEntity? ent = Get_Entity(1, true);
lua.PushBool(ent != null && ent.IsNPC());
return 1;
}

Expand Down
26 changes: 26 additions & 0 deletions Game.Shared/GarrysMod/LuaPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;
using Source;

#if CLIENT_DLL || GAME_DLL
Expand Down Expand Up @@ -601,6 +602,24 @@ static int Player__GetInfo(ILuaInterface lua) {
#endif
}

[LuaMethod]
static int Player__LagCompensation(ILuaInterface lua) {
#if GAME_DLL
BasePlayer player = Get_Player(1, false)!;
bool start = lua.GetBool(2);

// Only meaningful while a user command is being processed (predicted hooks)
if (Unsafe.IsNullRef(ref player.GetCurrentUserCommand()))
return 0;

if (start)
lagcompensation.StartLagCompensation(player);
else
lagcompensation.FinishLagCompensation(player);
#endif
return 0;
}

[LuaMethod]
static int Player__GetInfoNum(ILuaInterface lua) {
if (!LuaConVar.IsAllowedToGetConvarInfo(lua.GetString(2)))
Expand Down Expand Up @@ -631,6 +650,13 @@ static int Player__RemoveAllAmmo(ILuaInterface lua) {
return 0;
}

[LuaMethod]
static int Player__StripWeapons(ILuaInterface lua) {
BasePlayer player = Get_Player(1, false)!;
player.RemoveAllWeapons();
return 0;
}

[LuaMethod]
static int Player__SelectWeapon(ILuaInterface lua) {
BasePlayer player = Get_Player(1, false)!;
Expand Down
Loading