diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-07-10 17:04:29 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-07-10 17:04:29 -0400 |
| commit | 1de5f9ac6f038bfed2230cc1272b253794b2f41a (patch) | |
| tree | 15bc9d515f1f48c036522afb7cc71f60243849a9 /entities/weapons/hands.lua | |
| download | artery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.tar.gz artery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.tar.bz2 artery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.zip | |
Initial commit
Diffstat (limited to 'entities/weapons/hands.lua')
| -rw-r--r-- | entities/weapons/hands.lua | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/entities/weapons/hands.lua b/entities/weapons/hands.lua new file mode 100644 index 0000000..3d74aa3 --- /dev/null +++ b/entities/weapons/hands.lua @@ -0,0 +1,142 @@ +AddCSLuaFile("hands.lua") + +SWEP.ViewModel = ""--"models/error.mdl" +SWEP.WorldModel = ""--"models/error.mdl" + +SWEP.HoldType = "normal" + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = true +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.Clipsize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.DrawAmmo = false +SWEP.DrawCrosshair = false + +function SWEP:Initialize() + self:SetWeaponHoldType(self.HoldType) + self:DrawShadow(false) + self:SetNoDraw(true) + + --[[ + if (CLIENT) then + self.MOB = ClientsideModel("error.mdl") + self.MOB:SetNoDraw(true) + self.MOB:DrawShadow(false) + end + ]] +end + +function SWEP:ShouldDropOnDie() + return false +end + +function SWEP:Think() +end + +function SWEP:Reload() +end + +local Box = Vector(8,8,8) + +function SWEP:PrimaryAttack() + local rightitem = self.Owner.Inventory.Equiped["Left"] + if rightitem ~= false and rightitem.onClick ~= nil then + rightitem:onClick(self.Owner) + end + --[[ + if (CLIENT and !IsFirstTimePredicted()) then return end + if (!self.Owner.Weapons or !self.Owner.Weapons[self.Owner.Select]) then return end + if (self.Owner.CD and self.Owner.CD > CurTime()) then return end + + local item = self.Owner.Weapons[self.Owner.Select].Item + + if (!item or !item.OnPrimary) then return end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + local Trace = { + start = self.Owner:GetShootPos(), + endpos = self.Owner:GetShootPos()+self.Owner:GetAimVector()*item.Range, + filter = self.Owner, + mins = Box*-1, + maxs = Box, + } + + local Tr = util.TraceHull(Trace) + + item:OnPrimary(self.Owner,Tr) + + self.Owner.CD = CurTime()+item.CD + ]] +end + +function SWEP:SecondaryAttack() + --[[ + if (CLIENT and !IsFirstTimePredicted()) then return end + if (!self.Owner.Weapons or !self.Owner.Weapons[self.Owner.Select]) then return end + if (self.Owner.CD and self.Owner.CD > CurTime()) then return end + + local item = self.Owner.Weapons[self.Owner.Select].Item + + if (!item or !item.OnSecondary) then return end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + local Trace = { + start = self.Owner:GetShootPos(), + endpos = self.Owner:GetShootPos()+self.Owner:GetAimVector()*item.Range, + filter = self.Owner, + mins = Box*-1, + maxs = Box, + } + + local Tr = util.TraceHull(Trace) + + item:OnSecondary(self.Owner,Tr) + + self.Owner.CD = CurTime()+item.CD + ]] +end + +if (CLIENT) then + local Zero = Vector(1,1,1) + --[[ + function SWEP:DrawWorldModel() + if (!self.Owner.Weapons or !self.Owner.Weapons[self.Owner.Select]) then return end + + local item = self.Owner.Weapons[self.Owner.Select].Item + + for k,v in pairs(item.Structure) do + local ID = self.Owner:LookupBone(v.Bone) + local Pos,Ang = self.Owner:GetBonePosition(ID) + + local Offset = v.Pos*1 + Offset:Rotate(Ang) + Pos = Pos + Offset + + local Dang = Ang*1 + + Ang:RotateAroundAxis(Dang:Right(),v.Ang.p) + Ang:RotateAroundAxis(Dang:Up(),v.Ang.y) + Ang:RotateAroundAxis(Dang:Forward(),v.Ang.r) + + self.MOB:SetModel(v.Model) + self.MOB:SetRenderOrigin(Pos) + self.MOB:SetRenderAngles(Ang) + + local mat = Matrix() + mat:Scale( v.Size or Zero ) + + self.MOB:EnableMatrix( "RenderMultiply", mat ) + self.MOB:SetupBones() + self.MOB:DrawModel() + end + end + ]] +end |
