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)!; 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() {