From a3a3d8bd0088d622fe2a2be9875b82e614580328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:53:12 +0300 Subject: [PATCH 1/2] Port Entity:IsRagdoll Lua binding --- Game.Client/C_BaseAnimating.cs | 2 +- Game.Server/BaseAnimating.cs | 2 +- Game.Shared/GarrysMod/BaseEntityLua.cs | 1 + Game.Shared/GarrysMod/LuaEntity.cs | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Game.Client/C_BaseAnimating.cs b/Game.Client/C_BaseAnimating.cs index fc66f0dd..e7563b73 100644 --- a/Game.Client/C_BaseAnimating.cs +++ b/Game.Client/C_BaseAnimating.cs @@ -107,7 +107,7 @@ public override void ResetLatched() { base.ResetLatched(); } - public bool IsRagdoll() => Ragdoll != null && RenderFX == (byte)RenderFx.Ragdoll; + public override bool IsRagdoll() => Ragdoll != null && RenderFX == (byte)RenderFx.Ragdoll; public override ShadowType ShadowCastType() { StudioHdr? studioHdr = GetModelPtr(); diff --git a/Game.Server/BaseAnimating.cs b/Game.Server/BaseAnimating.cs index 68e3ee88..ffeeefa6 100644 --- a/Game.Server/BaseAnimating.cs +++ b/Game.Server/BaseAnimating.cs @@ -562,7 +562,7 @@ public virtual bool BecomeRagdollOnClient(in Vector3 force) { return false; } - public bool IsRagdoll() => RenderFX == (byte)RenderFx.Ragdoll; + public override bool IsRagdoll() => RenderFX == (byte)RenderFx.Ragdoll; public override void Teleport(Vector3? newPosition, QAngle? newAngles, Vector3? newVelocity) { base.Teleport(newPosition, newAngles, newVelocity); diff --git a/Game.Shared/GarrysMod/BaseEntityLua.cs b/Game.Shared/GarrysMod/BaseEntityLua.cs index de92c905..dfc35d4c 100644 --- a/Game.Shared/GarrysMod/BaseEntityLua.cs +++ b/Game.Shared/GarrysMod/BaseEntityLua.cs @@ -49,6 +49,7 @@ public static int LuaCallbackIndex(ReadOnlySpan name) { public virtual bool IsWeapon() => false; public virtual bool IsVehicle() => false; public virtual bool IsRagdollProp() => false; + public virtual bool IsRagdoll() => false; public virtual bool IsJeep() => false; public virtual void PostLuaSpawn() { } public virtual ReadOnlySpan GetLuaScriptName() => null; diff --git a/Game.Shared/GarrysMod/LuaEntity.cs b/Game.Shared/GarrysMod/LuaEntity.cs index edde9063..f1c2385b 100644 --- a/Game.Shared/GarrysMod/LuaEntity.cs +++ b/Game.Shared/GarrysMod/LuaEntity.cs @@ -628,6 +628,13 @@ static int Entity__IsNPC(ILuaInterface lua) { return 1; } + [LuaMethod] + static int Entity__IsRagdoll(ILuaInterface lua) { + BaseEntity? ent = Get_Entity(1, true); + lua.PushBool(ent != null && ent.IsRagdoll()); + return 1; + } + [LuaMethod] static int Entity__IsScripted(ILuaInterface lua) { BaseEntity ent = Get_Entity(1, false)!; From 40cf6b2c8dd37dc7dd8a482df1c37a3ee7844711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 22 Oct 2026 00:18:24 +0300 Subject: [PATCH 2/2] Temporarily disable RecacheMaterials, its breaking things --- Game.Shared/GarrysMod/LuaGameSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Game.Shared/GarrysMod/LuaGameSystem.cs b/Game.Shared/GarrysMod/LuaGameSystem.cs index 4b64449c..e7046cdf 100644 --- a/Game.Shared/GarrysMod/LuaGameSystem.cs +++ b/Game.Shared/GarrysMod/LuaGameSystem.cs @@ -1,3 +1,4 @@ + #if CLIENT_DLL || GAME_DLL using Game.Shared; @@ -41,7 +42,8 @@ public override void LevelInitPreEntity() { gGM.LoadGamemode(Gamemode, false); gGM.SetGamemode(Gamemode, true); } - RecacheMaterials(); + // Currently breaking things, uncomment once the path is fully implemented. + // RecacheMaterials(); } static void RecacheMaterials() {