diff --git a/Game.Shared/GarrysMod/LuaEntity.cs b/Game.Shared/GarrysMod/LuaEntity.cs index d0d1b4f0..8f51101e 100644 --- a/Game.Shared/GarrysMod/LuaEntity.cs +++ b/Game.Shared/GarrysMod/LuaEntity.cs @@ -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()) { @@ -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; } diff --git a/Game.Shared/GarrysMod/LuaPlayer.cs b/Game.Shared/GarrysMod/LuaPlayer.cs index fcdfaa26..9a599b55 100644 --- a/Game.Shared/GarrysMod/LuaPlayer.cs +++ b/Game.Shared/GarrysMod/LuaPlayer.cs @@ -1,3 +1,4 @@ +using System.Runtime.CompilerServices; using Source; #if CLIENT_DLL || GAME_DLL @@ -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))) @@ -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)!;