Jump to content

Server Crash (Lightsaber related?) 7/26/2015


Crt
 Share

Recommended Posts

function SWEP:GetSaberPosAng( num )
num = num or 1

local c = Color( 255, 128, 0 )
if ( SERVER ) then c = Color( 0, 128, 255 ) end

if ( IsValid( self.Owner ) ) then

	local attachment = self:LookupAttachment( "blade" .. num )
	if ( attachment && attachment > 0 ) then
		local PosAng = self:GetAttachment( attachment )

		/*if ( SERVER ) then
			debugoverlay.Line( PosAng.Pos, PosAng.Pos + PosAng.Ang:Forward() * 50, .1, c, false )
		end*/

		return PosAng.Pos, PosAng.Ang:Forward()
	end

	local attachment = self.Owner:LookupBone( "ValveBiped.Bip01_R_Hand" )
	if ( attachment ) then
		local pos, ang = self.Owner:GetBonePosition( attachment )
		if ( pos == self.Owner:GetPos() ) then
			local matrix = self.Owner:GetBoneMatrix( attachment )
			pos = matrix:GetTranslation()
			ang = matrix:GetAngles()
		end

		ang:RotateAroundAxis( ang:Forward(), 180 )
		ang:RotateAroundAxis( ang:Up(), 30 )
		ang:RotateAroundAxis( ang:Forward(), -5.7 )
		ang:RotateAroundAxis( ang:Right(), 92 )

		pos = pos + ang:Up() * -3.3 + ang:Right() * 0.8 + ang:Forward() * 5.6

		/*if ( SERVER ) then
			debugoverlay.Line( pos, pos + ang:Forward() * 50, .1, c, false )
		end*/

		return pos, ang:Forward()
	end
end

local defAng = self:GetAngles()
defAng:RotateAroundAxis( defAng:Right(), 90 )

ErrorNoHalt( "LIGHTSABERS: THIS SHOULD NEVER HAPPEN!")

return self:GetPos() + defAng:Right() * 0.6 - defAng:Up() * 1 - defAng:Forward() * 0.25, defAng:Forward()
end

 

It relates to attempting to find the ValveBiped.Bip01_R_Hand in the model which does not always exist if some model makers are silly. In theory, the issue should not be fatal but I can always remove them for now.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...