Skip to content

Commit f0d26b3

Browse files
authored
Fix some propcore functions can be called only once per tick for no reason (#3475)
* Fix some propcore functions can be called only once per tick for no reason Fixes: https://discord.com/channels/231131817640460288/231581733831704578/1452368914737528874 * Fix
1 parent 20d13dc commit f0d26b3

File tree

1 file changed

+5
-8
lines changed
  • lua/entities/gmod_wire_expression2/core/custom

1 file changed

+5
-8
lines changed

lua/entities/gmod_wire_expression2/core/custom/prop.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,7 @@ end
832832

833833
[nodiscard]
834834
e2function number entity:propCanSetDupeable()
835-
local isOk, Val = pcall(ValidAction, self, this, "noDupe")
836-
if not isOk then return 0 end
837-
835+
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
838836
return canMarkDupeable(this, self.player) and 1 or 0
839837
end
840838

@@ -933,7 +931,7 @@ e2function void entity:propSetFriction(number friction)
933931
end
934932

935933
e2function number entity:propGetFriction()
936-
if not ValidAction(self, this, "friction") then return 0 end
934+
if not IsValid(this) then return self:throw("Invalid entity!", 0) end
937935
return this:GetFriction()
938936
end
939937

@@ -961,10 +959,9 @@ e2function void entity:propPhysicalMaterial(string physprop)
961959
end
962960

963961
e2function string entity:propPhysicalMaterial()
964-
if not ValidAction(self, this, "physprop") then return "" end
962+
if not IsValid(this) then return self:throw("Invalid entity!", "") end
965963
local phys = this:GetPhysicsObject()
966-
if IsValid(phys) then return phys:GetMaterial() or "" end
967-
return ""
964+
return phys:IsValid() and phys:GetMaterial() or ""
968965
end
969966

970967
e2function void entity:propSetVelocity(vector velocity)
@@ -1238,7 +1235,7 @@ e2function void entity:ragdollSetAng(angle rot)
12381235
end
12391236

12401237
e2function table entity:ragdollGetPose()
1241-
if not ValidAction(self, this) then return end
1238+
if not IsValid(this) then return self:throw("Invalid entity!", newE2Table()) end
12421239
local pose = newE2Table()
12431240
local bones = GetBones(this)
12441241
local originPos, originAng = bones[0]:GetPos(), bones[0]:GetAngles()

0 commit comments

Comments
 (0)