Fixed weapons in hands
This commit is contained in:
parent
7de193a68e
commit
bf36cb7d24
|
@ -129,7 +129,8 @@ function SWEP:EquipItem( ent )
|
||||||
print("Pick up", ent)
|
print("Pick up", ent)
|
||||||
|
|
||||||
ent:AddEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
ent:AddEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
||||||
ent:AddEffects( EF_BONEMERGE + EF_BONEMERGE_FASTCULL )
|
ent:AddEffects( EF_BONEMERGE )
|
||||||
|
ent:SetMoveType( MOVETYPE_NONE )
|
||||||
ent:SetParent( p )
|
ent:SetParent( p )
|
||||||
ent:SetOwner( p )
|
ent:SetOwner( p )
|
||||||
ent:SetPos( vector_origin )
|
ent:SetPos( vector_origin )
|
||||||
|
@ -155,16 +156,18 @@ function SWEP:DropItem()
|
||||||
local ent = self:GetActiveR()
|
local ent = self:GetActiveR()
|
||||||
if ent:IsValid() then
|
if ent:IsValid() then
|
||||||
if CLIENT then print("DropItem called on CLIENT but certain things aren't finished yet.") return end
|
if CLIENT then print("DropItem called on CLIENT but certain things aren't finished yet.") return end
|
||||||
|
self:Deactive()
|
||||||
|
|
||||||
ent:SetParent( NULL )
|
ent:SetParent( NULL )
|
||||||
ent:SetOwner( NULL )
|
ent:SetOwner( NULL )
|
||||||
|
|
||||||
ent:RemoveEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
ent:RemoveEFlags( EFL_KEEP_ON_RECREATE_ENTITIES )
|
||||||
ent:RemoveEffects( EF_BONEMERGE + EF_BONEMERGE_FASTCULL )
|
ent:RemoveEffects( EF_BONEMERGE )
|
||||||
|
ent:SetMoveType( MOVETYPE_VPHYSICS )
|
||||||
|
|
||||||
ent:SetPos( p:EyePos() + p:GetAimVector() * 0 )
|
ent:SetPos( p:EyePos() + p:GetAimVector() * 0 )
|
||||||
ent:SetAngles( p:EyeAngles() + Angle( 0, 180, 0 ) )
|
ent:SetAngles( p:EyeAngles() + Angle( 0, 180, 0 ) )
|
||||||
|
|
||||||
self:Deactive()
|
|
||||||
|
|
||||||
local inv = p:GetInventory()
|
local inv = p:GetInventory()
|
||||||
inv[ent] = nil
|
inv[ent] = nil
|
||||||
|
@ -187,7 +190,9 @@ function SWEP:Think()
|
||||||
if p:IsValid() then
|
if p:IsValid() then
|
||||||
if self:ItemR() then
|
if self:ItemR() then
|
||||||
self:ItemR("Think")
|
self:ItemR("Think")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
self:SetHoldType( self:ItemR() and "revolver" or "normal" )
|
||||||
else
|
else
|
||||||
print( self, "Thinking without an owner." )
|
print( self, "Thinking without an owner." )
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- Your Name is Benny
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
util.AddNetworkString( "Benny_DebugMenuSpawn" )
|
||||||
|
net.Receive( "Benny_DebugMenuSpawn", function( len, ply )
|
||||||
|
if !ply:IsAdmin() then return end
|
||||||
|
local ent = ents.Create( "b-item_" .. net.ReadString() )
|
||||||
|
ent:SetPos( ply:GetEyeTrace().HitPos )
|
||||||
|
ent:Spawn()
|
||||||
|
end)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function dospawn( self )
|
||||||
|
net.Start( "Benny_DebugMenuSpawn" )
|
||||||
|
net.WriteString( self.iName )
|
||||||
|
net.SendToServer()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function OpenDebugMenu()
|
||||||
|
if IsValid(DebugMenu) then DebugMenu:Remove() end
|
||||||
|
DebugMenu = vgui.Create("DFrame")
|
||||||
|
DebugMenu:SetSize( 400, 300 )
|
||||||
|
DebugMenu:Center()
|
||||||
|
DebugMenu:MakePopup()
|
||||||
|
|
||||||
|
local opt = DebugMenu:Add("DCollapsibleCategory")
|
||||||
|
opt:Dock( TOP )
|
||||||
|
|
||||||
|
local plist = DebugMenu:Add("DScrollPanel")
|
||||||
|
opt:SetContents( plist )
|
||||||
|
|
||||||
|
for iname, idata in SortedPairs( ITEMS ) do
|
||||||
|
local button = plist:Add("DButton")
|
||||||
|
button:Dock( TOP )
|
||||||
|
button:DockMargin( 4, 4, 4, 0 )
|
||||||
|
button:SetText( l8( idata.PrintName ) )
|
||||||
|
button.iName = iname
|
||||||
|
button.iData = idata
|
||||||
|
button.DoClick = dospawn
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
|
||||||
|
if button == KEY_F1 then
|
||||||
|
OpenDebugMenu()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add("PlayerButtonUp", "PlayerButtonUp_DebugMenu", function( ply, button )
|
||||||
|
if button == KEY_F1 then
|
||||||
|
--if IsValid(DebugMenu) then DebugMenu:Remove() end
|
||||||
|
end
|
||||||
|
end)
|
|
@ -87,6 +87,7 @@ local COLOR_MAIN = Color( 160, 160, 240 )
|
||||||
function GM:HUDPaint()
|
function GM:HUDPaint()
|
||||||
local p = LocalPlayer()
|
local p = LocalPlayer()
|
||||||
local w, h = ScrW(), ScrH()
|
local w, h = ScrW(), ScrH()
|
||||||
|
local handler = p:BennyCheck()
|
||||||
stack = util.Stack()
|
stack = util.Stack()
|
||||||
|
|
||||||
S_Push( 20, 20 )
|
S_Push( 20, 20 )
|
||||||
|
@ -107,10 +108,10 @@ function GM:HUDPaint()
|
||||||
|
|
||||||
S_Push( 20, h - 60 - 20 )
|
S_Push( 20, h - 60 - 20 )
|
||||||
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
|
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
|
||||||
hCol( COLOR_DARK )
|
hCol( v == handler:GetActiveR() and COLOR_BRIGHT or COLOR_DARK )
|
||||||
hRect( 0, 0, 120, 60 )
|
hRect( 0, 0, 120, 60 )
|
||||||
local x, y = hXY( 0, 0 )
|
local x, y = hXY( 0, 0 )
|
||||||
draw.SimpleText( l8( v.Class.PrintName ), "HUD_24", x + 120/2, y + 60/2, COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
draw.SimpleText( l8( v.Class.PrintName ) .. "(" .. v:GetClip() .. "/" .. v.Class.ClipSize .. ")", "HUD_24", x + 120/2, y + 60/2, COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||||
end
|
end
|
||||||
S_Pop()
|
S_Pop()
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,18 @@ AddItem( "base_firearm", {
|
||||||
|
|
||||||
print( class, "Initialized a firearm" )
|
print( class, "Initialized a firearm" )
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
["Attack"] = function( class, ent, handler )
|
||||||
|
if ent:GetClip() <= 0 then return end
|
||||||
|
if ent:GetDelay() > CurTime() then return end
|
||||||
|
|
||||||
|
ent:SetClip( ent:GetClip() - 1 )
|
||||||
|
ent:SetDelay( CurTime() + class.Delay )
|
||||||
|
end,
|
||||||
|
|
||||||
|
["Reload"] = function( class, ent, handler )
|
||||||
|
ent:SetClip( class.ClipSize )
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
AddItem( "mk23", {
|
AddItem( "mk23", {
|
||||||
|
@ -113,7 +125,7 @@ AddItem( "mk23", {
|
||||||
Category = "pistol",
|
Category = "pistol",
|
||||||
Base = "base_firearm",
|
Base = "base_firearm",
|
||||||
|
|
||||||
Model = "models/weapons/w_smg1.mdl",
|
Model = "models/weapons/w_pist_elite_single.mdl",
|
||||||
|
|
||||||
ClipSize = 12,
|
ClipSize = 12,
|
||||||
Delay = (60/300),
|
Delay = (60/300),
|
||||||
|
|
|
@ -8,6 +8,8 @@ BENNY = {}
|
||||||
|
|
||||||
local AC, IN = AddCSLuaFile, include
|
local AC, IN = AddCSLuaFile, include
|
||||||
|
|
||||||
|
local CL = SERVER and AddCSLuaFile or include
|
||||||
|
|
||||||
AC("language.lua")
|
AC("language.lua")
|
||||||
IN("language.lua")
|
IN("language.lua")
|
||||||
AC("camera.lua")
|
AC("camera.lua")
|
||||||
|
@ -21,7 +23,7 @@ IN("player_class.lua")
|
||||||
AC("inventory.lua")
|
AC("inventory.lua")
|
||||||
IN("inventory.lua")
|
IN("inventory.lua")
|
||||||
|
|
||||||
AC("hud.lua")
|
AC("debugmenu.lua")
|
||||||
if CLIENT then
|
IN("debugmenu.lua")
|
||||||
IN("hud.lua")
|
|
||||||
end
|
CL("hud.lua")
|
Loading…
Reference in New Issue