Holster improvements, default bodygroups, debug menu prediction fixes
Print all bones function too
This commit is contained in:
parent
e58125205e
commit
0aac95d5a0
|
@ -226,17 +226,19 @@ function SWEP:Think()
|
||||||
end
|
end
|
||||||
|
|
||||||
if p:KeyPressed(IN_WEAPON1) then
|
if p:KeyPressed(IN_WEAPON1) then
|
||||||
if !self:ItemR() then
|
if self:GetDesireR() == NULL then
|
||||||
if SERVER then
|
if SERVER then
|
||||||
local trace = self:ItemCheckTrace()
|
local trace = self:ItemCheckTrace()
|
||||||
self:EquipItem( trace.Entity )
|
self:EquipItem( trace.Entity )
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ActiveR.Class.Drop( ActiveR.Class, ActiveR, self )
|
if self:GetActiveR() != NULL then
|
||||||
if SERVER then
|
ActiveR.Class.Drop( ActiveR.Class, ActiveR, self )
|
||||||
self:DropItem()
|
if SERVER then
|
||||||
|
self:DropItem()
|
||||||
|
end
|
||||||
|
self:SetActiveR( NULL )
|
||||||
end
|
end
|
||||||
self:SetActiveR( NULL )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if p:KeyPressed(IN_WEAPON2) then
|
if p:KeyPressed(IN_WEAPON2) then
|
||||||
|
|
|
@ -121,9 +121,21 @@ local function OpenDebugMenu()
|
||||||
modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) )
|
modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) )
|
||||||
modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) )
|
modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) )
|
||||||
|
|
||||||
function modeller:Update( mdl )
|
function modeller:Update( idata )
|
||||||
if self.Entity:GetModel() == mdl then return end
|
if self.Entity:GetModel() == idata.Model then return end
|
||||||
self.Entity:SetModel( mdl )
|
self.Entity:SetModel( idata.Model )
|
||||||
|
|
||||||
|
for i=0, self.Entity:GetNumBodyGroups()-1 do
|
||||||
|
self.Entity:SetBodygroup( i, 0 )
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in ipairs(idata.DefaultBodygroups) do
|
||||||
|
if v then
|
||||||
|
self.Entity:SetBodygroup( k-1, v )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
local worked = self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||||
|
|
||||||
if worked then
|
if worked then
|
||||||
|
@ -264,7 +276,7 @@ local function OpenDebugMenu()
|
||||||
function button:Think()
|
function button:Think()
|
||||||
if self:IsHovered() then
|
if self:IsHovered() then
|
||||||
texter:SetText( l8(idata.Description) .. "\n\nClipsize: " .. (idata.ClipSize or "?") )
|
texter:SetText( l8(idata.Description) .. "\n\nClipsize: " .. (idata.ClipSize or "?") )
|
||||||
modeller:Update( idata.Model )
|
modeller:Update( idata )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -308,16 +320,40 @@ function OpenMyTeamMenu()
|
||||||
DebugMenu:Center()
|
DebugMenu:Center()
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
|
hook.Add("PlayerButtonDown", "Benny_PlayerButtonDown_DebugMenu", function( ply, button )
|
||||||
if button == KEY_F1 then
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
OpenDebugMenu()
|
if button == KEY_F1 then
|
||||||
elseif button == KEY_F2 then
|
OpenDebugMenu()
|
||||||
OpenMyTeamMenu()
|
elseif button == KEY_F2 then
|
||||||
|
OpenMyTeamMenu()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("PlayerButtonUp", "PlayerButtonUp_DebugMenu", function( ply, button )
|
local c_id = Color( 255, 200, 200 )
|
||||||
if button == KEY_F1 then
|
local c_name = Color( 200, 255, 255 )
|
||||||
--if IsValid(DebugMenu) then DebugMenu:Remove() end
|
local c_white = Color( 255, 255, 255 )
|
||||||
|
|
||||||
|
local function recursebones( ent, O_id, level )
|
||||||
|
local gap = ""
|
||||||
|
for i=1, level do gap = gap .. " " end
|
||||||
|
for index, id in ipairs( ent:GetChildBones( O_id ) ) do
|
||||||
|
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
|
||||||
|
recursebones( ent, id, level+1 )
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function printallbones( ent )
|
||||||
|
if !ent:IsValid() then print("invalid ent") return end
|
||||||
|
|
||||||
|
for id=0, ent:GetBoneCount()-1 do
|
||||||
|
if ent:GetBoneName(id) == "__INVALIDBONE__" then continue end
|
||||||
|
if ent:GetBoneParent(id) != -1 then continue end
|
||||||
|
chat.AddText( gap, c_id, tostring(id), c_white, " - ", c_name, ent:GetBoneName(id) )
|
||||||
|
recursebones( ent, id, 1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
concommand.Add("b-debug_listbones", function( ply, cmd )
|
||||||
|
printallbones( ply )
|
||||||
end)
|
end)
|
|
@ -47,16 +47,23 @@ AddItem( "base", {
|
||||||
Description = "Beginning item base.",
|
Description = "Beginning item base.",
|
||||||
Category = "base",
|
Category = "base",
|
||||||
|
|
||||||
|
Model = "models/benny/weapons/test_m16a2.mdl",
|
||||||
|
DefaultBodygroups = {},
|
||||||
Vars = {
|
Vars = {
|
||||||
["Float"] = {
|
["Float"] = {
|
||||||
"Acquisition",
|
"Acquisition",
|
||||||
"HolsterIn",
|
"HolsterIn",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
HoldType = "slam",
|
|
||||||
|
|
||||||
["Initialize"] = function( class, ent, handler )
|
["Initialize"] = function( class, ent, handler )
|
||||||
print( class, "Initialized base initialization" )
|
print( class, "Initialized base initialization" )
|
||||||
|
|
||||||
|
for k, v in ipairs(class.DefaultBodygroups) do
|
||||||
|
if v then
|
||||||
|
ent:SetBodygroup( k-1, v )
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["Deploy"] = function( class, ent, handler )
|
["Deploy"] = function( class, ent, handler )
|
||||||
|
@ -321,7 +328,7 @@ AddItem( "base_firearm", {
|
||||||
handler:EmitSound( "weapons/elite/elite_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
|
handler:EmitSound( "weapons/elite/elite_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
|
||||||
local ply = handler:GetOwner()
|
local ply = handler:GetOwner()
|
||||||
if SERVER or CLIENT and IsFirstTimePredicted() then
|
if SERVER or CLIENT and IsFirstTimePredicted() then
|
||||||
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0, true )
|
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["deploy"][class.HoldType] ), 0.25, true )
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -540,13 +547,14 @@ do -- Handguns
|
||||||
|
|
||||||
Model = "models/benny/weapons/test_mk23.mdl",
|
Model = "models/benny/weapons/test_mk23.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
DefaultBodygroups = { false, false, 1 },
|
||||||
|
|
||||||
ClipSize = 12,
|
ClipSize = 12,
|
||||||
Delay = (60/350),
|
Delay = (60/320),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/usp/01.ogg",
|
"benny/weapons/usp/sup_01.ogg",
|
||||||
"benny/weapons/usp/02.ogg",
|
"benny/weapons/usp/sup_02.ogg",
|
||||||
"benny/weapons/usp/03.ogg",
|
"benny/weapons/usp/sup_03.ogg",
|
||||||
},
|
},
|
||||||
MagOutSound = "benny/weapons/usp/magout.ogg",
|
MagOutSound = "benny/weapons/usp/magout.ogg",
|
||||||
MagInSound = "benny/weapons/usp/magin.ogg",
|
MagInSound = "benny/weapons/usp/magin.ogg",
|
||||||
|
@ -630,7 +638,7 @@ do -- Rifles
|
||||||
HoldType = "rifle",
|
HoldType = "rifle",
|
||||||
|
|
||||||
ClipSize = 30,
|
ClipSize = 30,
|
||||||
Delay = (60/750),
|
Delay = (60/800),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/m16a2/01.ogg",
|
"benny/weapons/m16a2/01.ogg",
|
||||||
"benny/weapons/m16a2/02.ogg",
|
"benny/weapons/m16a2/02.ogg",
|
||||||
|
@ -699,7 +707,7 @@ do -- Rifles
|
||||||
HoldType = "rifle",
|
HoldType = "rifle",
|
||||||
|
|
||||||
ClipSize = 30,
|
ClipSize = 30,
|
||||||
Delay = (60/900),
|
Delay = (60/1050),
|
||||||
BurstCount = 3,
|
BurstCount = 3,
|
||||||
BurstRunaway = true,
|
BurstRunaway = true,
|
||||||
BurstAuto = true,
|
BurstAuto = true,
|
||||||
|
@ -754,7 +762,7 @@ do -- SMGs
|
||||||
Model = "models/benny/weapons/test_tmp.mdl",--"models/weapons/w_rif_ar556.mdl",
|
Model = "models/benny/weapons/test_tmp.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
|
||||||
ClipSize = 20,
|
ClipSize = 25,
|
||||||
Delay = (60/850),
|
Delay = (60/850),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/tmp/01.ogg",
|
"benny/weapons/tmp/01.ogg",
|
||||||
|
@ -790,7 +798,7 @@ do -- SMGs
|
||||||
Model = "models/benny/weapons/test_mp5k.mdl",--"models/weapons/w_rif_ar556.mdl",
|
Model = "models/benny/weapons/test_mp5k.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||||
HoldType = "handgun",
|
HoldType = "handgun",
|
||||||
|
|
||||||
ClipSize = 20,
|
ClipSize = 30,
|
||||||
Delay = (60/750),
|
Delay = (60/750),
|
||||||
FireSound = {
|
FireSound = {
|
||||||
"benny/weapons/mp5k/01.ogg",
|
"benny/weapons/mp5k/01.ogg",
|
||||||
|
|
Loading…
Reference in New Issue