Skip to content

Add missing Player/Entity Lua methods and fix Entity:IsNPC - #285

Merged
marchc1 merged 2 commits into
SourceDotNET:mainfrom
Yahzy:fix/lua-player-methods
Nov 19, 2026
Merged

marchc1 merged 2 commits into
SourceDotNET:mainfrom
Yahzy:fix/lua-player-methods

Conversation

@Yahzy

@Yahzy Yahzy commented Nov 18, 2026

Copy link
Copy Markdown
Contributor
  • Player:StripWeapons() (server): removes every weapon with RemoveAllWeapons. Used by the base gamemode (PlayerSpawnAsSpectator) and TTT.
  • Player:LagCompensation(bool): starts or finishes lag compensation on the server. It does nothing on the client, and also when there is no current user command (for example when called from a timer), instead of reaching the NULL CUserCmd error. Used by weapon_fists, weapon_medkit and TTT weapons.
  • Entity:MuzzleFlash(): calls DoMuzzleFlash on animating entities. Used by weapon_base.
  • Entity:IsNPC() always returned false, it now returns the entity's IsNPC() on both realms.

Tested: all four configurations build and Source.Common.Tests pass. On gm_construct, before: attempt to call method 'StripWeapons'/'LagCompensation'/'MuzzleFlash' (a nil value) and IsNPC() false for a npc_citizen on server and client. After: all four behave as expected on both realms.

Used by weapon_base, weapon_medkit and the sandbox weapons, which
errored with 'attempt to call method ... (a nil value)'.
It always returned false, breaking addons and gamemodes that filter NPCs.
@marchc1
marchc1 merged commit 3b3c04d into SourceDotNET:main Nov 19, 2026
16 checks passed
@Yahzy
Yahzy deleted the fix/lua-player-methods branch November 21, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants