GetMass() ALWAYS Outputting 45678

I’m trying to edit the backpack SEnt (http://www.garrysmod.org/downloads/?a=view&id=12829) so it doesn’t allow really big/heavy objects to be added.

For some reason, every prop I try to touch to the backpack is rejected.

Here’s what I have so far:

[lua]
– other stuff
function ENT:Touch(activator)
if (!self.touched) then
local p = self.Entity:GetNetworkedInt( “number”)
local r = activator:GetClass()
if (activator:IsPlayerHolding( )) and (p < self.max) then
local m = activator:GetModel()
local x = activator.Entity:GetPhysicsObject():GetMass() – always returns as 45678, no matter what prop I touch to it
if (util.IsValidModel(m)) then
if( x >= 30) then – this ALWAYS triggers
PrintMessage(HUD_PRINTTALK, x) return end
local g = {}
g.model = m
g.tab = activator:GetTable()
g.class = r
table.insert(self.contains, g)
activator:Remove()
p = p + 1
self.Entity:SetNetworkedInt( “number”, p )
self.touched = true
timer.Simple(0.3,untouch,self)
else
–stuff below here is irrelevant
[/lua]

I tried looking at WeightStool’s (http://www.garrysmod.org/downloads/?a=view&id=19331) code to see how it checks mass, so I could fix my changes accordingly, but it’s just about the same.

Anybody know what’s up, and what I can do to fix it?

Actually, I just saw this. My GetMass is always returning fucking 45678. This is wrong and bad. It’s fucking up all my ideas.

This usually happens when you pickup stuff with the physgun.

What the ASS; you’re right

I just discovered that anytime you pick up a thing with the physgun, its physobj’s mass gets set to 45678, and anytime you pick up a thing with the gravgun, its physobj’s mass gets set to 1

what the HELL

You would not want to know what happens if the mass is otherwise with the physgun, trust me its for your own good

[editline]22nd March 2011[/editline]

blame the source engine

  • snip -