Compare commits
4 Commits
efb50f2c5e
...
0aac95d5a0
Author | SHA1 | Date |
---|---|---|
Fesiug | 0aac95d5a0 | |
Fesiug | e58125205e | |
Fesiug | dc3d3d815e | |
Fesiug | ae0481e9a3 |
|
@ -226,17 +226,19 @@ function SWEP:Think()
|
|||
end
|
||||
|
||||
if p:KeyPressed(IN_WEAPON1) then
|
||||
if !self:ItemR() then
|
||||
if self:GetDesireR() == NULL then
|
||||
if SERVER then
|
||||
local trace = self:ItemCheckTrace()
|
||||
self:EquipItem( trace.Entity )
|
||||
end
|
||||
else
|
||||
ActiveR.Class.Drop( ActiveR.Class, ActiveR, self )
|
||||
if SERVER then
|
||||
self:DropItem()
|
||||
if self:GetActiveR() != NULL then
|
||||
ActiveR.Class.Drop( ActiveR.Class, ActiveR, self )
|
||||
if SERVER then
|
||||
self:DropItem()
|
||||
end
|
||||
self:SetActiveR( NULL )
|
||||
end
|
||||
self:SetActiveR( NULL )
|
||||
end
|
||||
end
|
||||
if p:KeyPressed(IN_WEAPON2) then
|
||||
|
|
|
@ -88,19 +88,51 @@ function GM:CalcView( ply, pos, ang, fov )
|
|||
local bid = ply:LookupBone("DEF-spine.005")
|
||||
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
|
||||
lastfp = fp
|
||||
print("show")
|
||||
-- print("show")
|
||||
elseif !lastfp and fp then
|
||||
local bid = ply:LookupBone("DEF-spine.006")
|
||||
ply:ManipulateBoneScale( bid, vector_origin )
|
||||
local bid = ply:LookupBone("DEF-spine.005")
|
||||
ply:ManipulateBoneScale( bid, vector_origin )
|
||||
lastfp = fp
|
||||
print("hide")
|
||||
-- print("hide")
|
||||
end
|
||||
|
||||
return view
|
||||
end
|
||||
|
||||
-- During a full update, bone manipulations will be reset to the server's value. Fix that
|
||||
gameevent.Listen( "OnRequestFullUpdate" )
|
||||
hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_CameraFP", function( data )
|
||||
if CLIENT then
|
||||
local ply = LocalPlayer()
|
||||
if !ply:IsValid() then return end
|
||||
local fp = cam_fp:GetBool()
|
||||
if lastfp == nil then lastfp = !fp end
|
||||
timer.Simple( 0, function()
|
||||
if !fp then
|
||||
local bid = ply:LookupBone("DEF-spine.006")
|
||||
if !bid then return end
|
||||
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
|
||||
local bid = ply:LookupBone("DEF-spine.005")
|
||||
if !bid then return end
|
||||
ply:ManipulateBoneScale( bid, Vector(1, 1, 1) )
|
||||
lastfp = fp
|
||||
-- print("fullupdate: show")
|
||||
elseif fp then
|
||||
local bid = ply:LookupBone("DEF-spine.006")
|
||||
if !bid then return end
|
||||
ply:ManipulateBoneScale( bid, vector_origin )
|
||||
local bid = ply:LookupBone("DEF-spine.005")
|
||||
if !bid then return end
|
||||
ply:ManipulateBoneScale( bid, vector_origin )
|
||||
lastfp = fp
|
||||
-- print("fullupdate: hide")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end )
|
||||
|
||||
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
|
||||
local p = LocalPlayer()
|
||||
local w = p:HandlerCheck()
|
||||
|
|
|
@ -121,9 +121,21 @@ local function OpenDebugMenu()
|
|||
modeller:SetDirectionalLight(BOX_LEFT, HSLToColor( 0, 0, 1.00 ) )
|
||||
modeller:SetDirectionalLight(BOX_RIGHT, HSLToColor( 0, 0, 1.00 ) )
|
||||
|
||||
function modeller:Update( mdl )
|
||||
if self.Entity:GetModel() == mdl then return end
|
||||
self.Entity:SetModel( mdl )
|
||||
function modeller:Update( idata )
|
||||
if self.Entity:GetModel() == idata.Model then return end
|
||||
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 )
|
||||
|
||||
if worked then
|
||||
|
@ -264,7 +276,7 @@ local function OpenDebugMenu()
|
|||
function button:Think()
|
||||
if self:IsHovered() then
|
||||
texter:SetText( l8(idata.Description) .. "\n\nClipsize: " .. (idata.ClipSize or "?") )
|
||||
modeller:Update( idata.Model )
|
||||
modeller:Update( idata )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -279,7 +291,7 @@ local function OpenDebugMenu()
|
|||
end
|
||||
end
|
||||
|
||||
local function OpenMyTeamMenu()
|
||||
function OpenMyTeamMenu()
|
||||
if IsValid(DebugMenu) then DebugMenu:Remove() end
|
||||
DebugMenu = vgui.Create("DFrame")
|
||||
DebugMenu:SetSize( 200, 300 )
|
||||
|
@ -308,16 +320,40 @@ local function OpenMyTeamMenu()
|
|||
DebugMenu:Center()
|
||||
end
|
||||
|
||||
hook.Add("PlayerButtonDown", "PlayerButtonDown_DebugMenu", function( ply, button )
|
||||
if button == KEY_F1 then
|
||||
OpenDebugMenu()
|
||||
elseif button == KEY_F2 then
|
||||
OpenMyTeamMenu()
|
||||
hook.Add("PlayerButtonDown", "Benny_PlayerButtonDown_DebugMenu", function( ply, button )
|
||||
if CLIENT and IsFirstTimePredicted() then
|
||||
if button == KEY_F1 then
|
||||
OpenDebugMenu()
|
||||
elseif button == KEY_F2 then
|
||||
OpenMyTeamMenu()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("PlayerButtonUp", "PlayerButtonUp_DebugMenu", function( ply, button )
|
||||
if button == KEY_F1 then
|
||||
--if IsValid(DebugMenu) then DebugMenu:Remove() end
|
||||
local c_id = Color( 255, 200, 200 )
|
||||
local c_name = Color( 200, 255, 255 )
|
||||
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
|
||||
|
||||
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)
|
|
@ -33,6 +33,7 @@ BennyGame.TeamsInPlay = {
|
|||
--5,
|
||||
--6,
|
||||
}
|
||||
BennyGame.RTeamID = table.Flip( BennyGame.TeamsInPlay )
|
||||
BennyGame.TeamCount = #BennyGame.TeamsInPlay
|
||||
|
||||
BennyGame.Gamemodes = {
|
||||
|
|
|
@ -487,7 +487,16 @@ function GM:HUDPaint()
|
|||
|
||||
-- Score
|
||||
local count = 1
|
||||
do -- My team
|
||||
local o = count-1
|
||||
S_Push( count%2==1 and (-BARWIDE - 1 - GAP) or (0 + 1 + GAP), (BARTALL+2+16+2)*math.floor(o/2) )
|
||||
QuickDrawBar( BARWIDE, BARTALL, myteam, BennyGame.RTeamID[myteam], count%2==0 )
|
||||
S_Pop()
|
||||
count = count + 1
|
||||
end
|
||||
-- Every other team
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
local o = count-1
|
||||
S_Push( count%2==1 and (-BARWIDE - 1 - GAP) or (0 + 1 + GAP), (BARTALL+2+16+2)*math.floor(o/2) )
|
||||
QuickDrawBar( BARWIDE, BARTALL, RealTeamID, TeamID, count%2==0 )
|
||||
|
|
|
@ -47,16 +47,23 @@ AddItem( "base", {
|
|||
Description = "Beginning item base.",
|
||||
Category = "base",
|
||||
|
||||
Model = "models/benny/weapons/test_m16a2.mdl",
|
||||
DefaultBodygroups = {},
|
||||
Vars = {
|
||||
["Float"] = {
|
||||
"Acquisition",
|
||||
"HolsterIn",
|
||||
},
|
||||
},
|
||||
HoldType = "slam",
|
||||
|
||||
["Initialize"] = function( class, ent, handler )
|
||||
print( class, "Initialized base initialization" )
|
||||
|
||||
for k, v in ipairs(class.DefaultBodygroups) do
|
||||
if v then
|
||||
ent:SetBodygroup( k-1, v )
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
["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 )
|
||||
local ply = handler:GetOwner()
|
||||
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,
|
||||
})
|
||||
|
@ -540,13 +547,14 @@ do -- Handguns
|
|||
|
||||
Model = "models/benny/weapons/test_mk23.mdl",
|
||||
HoldType = "handgun",
|
||||
DefaultBodygroups = { false, false, 1 },
|
||||
|
||||
ClipSize = 12,
|
||||
Delay = (60/350),
|
||||
Delay = (60/320),
|
||||
FireSound = {
|
||||
"benny/weapons/usp/01.ogg",
|
||||
"benny/weapons/usp/02.ogg",
|
||||
"benny/weapons/usp/03.ogg",
|
||||
"benny/weapons/usp/sup_01.ogg",
|
||||
"benny/weapons/usp/sup_02.ogg",
|
||||
"benny/weapons/usp/sup_03.ogg",
|
||||
},
|
||||
MagOutSound = "benny/weapons/usp/magout.ogg",
|
||||
MagInSound = "benny/weapons/usp/magin.ogg",
|
||||
|
@ -630,7 +638,7 @@ do -- Rifles
|
|||
HoldType = "rifle",
|
||||
|
||||
ClipSize = 30,
|
||||
Delay = (60/750),
|
||||
Delay = (60/800),
|
||||
FireSound = {
|
||||
"benny/weapons/m16a2/01.ogg",
|
||||
"benny/weapons/m16a2/02.ogg",
|
||||
|
@ -699,7 +707,7 @@ do -- Rifles
|
|||
HoldType = "rifle",
|
||||
|
||||
ClipSize = 30,
|
||||
Delay = (60/900),
|
||||
Delay = (60/1050),
|
||||
BurstCount = 3,
|
||||
BurstRunaway = true,
|
||||
BurstAuto = true,
|
||||
|
@ -754,7 +762,7 @@ do -- SMGs
|
|||
Model = "models/benny/weapons/test_tmp.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||
HoldType = "handgun",
|
||||
|
||||
ClipSize = 20,
|
||||
ClipSize = 25,
|
||||
Delay = (60/850),
|
||||
FireSound = {
|
||||
"benny/weapons/tmp/01.ogg",
|
||||
|
@ -790,7 +798,7 @@ do -- SMGs
|
|||
Model = "models/benny/weapons/test_mp5k.mdl",--"models/weapons/w_rif_ar556.mdl",
|
||||
HoldType = "handgun",
|
||||
|
||||
ClipSize = 20,
|
||||
ClipSize = 30,
|
||||
Delay = (60/750),
|
||||
FireSound = {
|
||||
"benny/weapons/mp5k/01.ogg",
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
local COLOR_MAIN
|
||||
local COLOR_DARK
|
||||
|
||||
local function qpaint( self, w, h )
|
||||
surface.SetDrawColor( COLOR_DARK )
|
||||
surface.DrawRect( 0, 0, w, h )
|
||||
surface.SetDrawColor( COLOR_MAIN )
|
||||
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
||||
|
||||
draw.SimpleText( self.text, "HUD_24", w/2, 6, COLOR_MAIN, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
|
||||
local settings = {
|
||||
{
|
||||
name = "Camera",
|
||||
items = {
|
||||
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 1, max = 140, name = "Camera FOV" },
|
||||
}
|
||||
},
|
||||
{
|
||||
name = "Gameplay",
|
||||
items = {
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local entries = {
|
||||
{
|
||||
name = "RESUME",
|
||||
DoClick = function( self )
|
||||
PauseMenu:Remove()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "LOADOUTS",
|
||||
DoClick = function( self )
|
||||
PauseMenu:Remove()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "CHANGE TEAM",
|
||||
DoClick = function( self )
|
||||
PauseMenu:Remove()
|
||||
OpenMyTeamMenu()
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "SETTINGS",
|
||||
DoClick = function( self )
|
||||
if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() return end
|
||||
SettingsMenu = vgui.Create("EditablePanel")
|
||||
SettingsMenu:SetSize( 300, 500 )
|
||||
SettingsMenu:NoClipping( true )
|
||||
|
||||
function SettingsMenu:Paint( w, h )
|
||||
surface.SetDrawColor( COLOR_DARK )
|
||||
surface.DrawRect( 0, 0, w, h )
|
||||
surface.SetDrawColor( COLOR_MAIN )
|
||||
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
||||
end
|
||||
SettingsMenu:DockPadding( 10, 10, 10, 10 )
|
||||
|
||||
function SettingsMenu:PerformLayout( w, h )
|
||||
local x, y, w, h = PauseMenu:GetBounds()
|
||||
self:SetPos( x + w + 10, y )
|
||||
end
|
||||
|
||||
local SP = SettingsMenu:Add("DScrollPanel")
|
||||
SP:Dock(FILL)
|
||||
|
||||
for index, data in ipairs( settings ) do
|
||||
local Cat = SettingsMenu:Add("DCollapsibleCategory")
|
||||
Cat:SetLabel(data.name)
|
||||
Cat:Dock(TOP)
|
||||
SP:AddItem(Cat)
|
||||
|
||||
for index, data in ipairs( data.items ) do
|
||||
if !data.cvarpointer then data.cvarpointer = GetConVar(data.cvar) end
|
||||
if data.type == TYPE_BOOL then
|
||||
local Changer = vgui.Create("DCheckBoxLabel", Cat)
|
||||
Changer:Dock( TOP )
|
||||
Changer:SetConVar( data.cvar )
|
||||
Changer:SetText( data.name )
|
||||
elseif data.type == TYPE_NUMBER then
|
||||
local Changer = vgui.Create("DNumSlider", Cat)
|
||||
Changer:Dock( TOP )
|
||||
Changer:SetConVar( data.cvar )
|
||||
Changer:SetText( data.name )
|
||||
Changer:SetMin( data.min )
|
||||
Changer:SetMax( data.max )
|
||||
Changer:SetDecimals( 0 )
|
||||
Changer:SetDefaultValue( data.cvarpointer:GetDefault() )
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "QUIT",
|
||||
DoClick = function( self )
|
||||
PauseMenu:Remove()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local function StartPauseMenu()
|
||||
if PauseMenu and PauseMenu:IsValid() then PauseMenu:Remove() return end
|
||||
|
||||
PauseMenu = vgui.Create("EditablePanel")
|
||||
PauseMenu:SetSize( 300, 500 )
|
||||
PauseMenu:SetPos( 100, ScrH() - 500 - 100 )
|
||||
PauseMenu:MakePopup()
|
||||
|
||||
local p = LocalPlayer()
|
||||
local myteam = p:Team()
|
||||
local MP = BennyGame:GetType() == BG_GTYPE_MP
|
||||
local CURRCHAR
|
||||
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
|
||||
CURRCHAR = "benny"
|
||||
else
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
end
|
||||
COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
||||
COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
||||
local CHARNAME = FACTIONS[CURRCHAR].CHARNAME
|
||||
|
||||
function PauseMenu:Paint( w, h )
|
||||
surface.SetDrawColor( COLOR_DARK )
|
||||
surface.DrawRect( 0, 0, w, h )
|
||||
surface.SetDrawColor( COLOR_MAIN )
|
||||
surface.DrawOutlinedRect( 1, 1, w-2, h-2, 1 )
|
||||
end
|
||||
PauseMenu:DockPadding( 10, 10, 10, 10 )
|
||||
|
||||
function PauseMenu:OnRemove()
|
||||
if SettingsMenu and SettingsMenu:IsValid() then SettingsMenu:Remove() end
|
||||
end
|
||||
|
||||
for index, data in ipairs( entries ) do
|
||||
local button = PauseMenu:Add("DButton")
|
||||
button:Dock(TOP)
|
||||
button:DockMargin( 0, 0, 0, 10 )
|
||||
button:SetText( "" )
|
||||
button:SetTall( 32 )
|
||||
button.text = data.name
|
||||
button.Paint = qpaint
|
||||
button.DoClick = data.DoClick
|
||||
end
|
||||
end
|
||||
|
||||
function GM:OnPauseMenuShow()
|
||||
StartPauseMenu()
|
||||
return false
|
||||
end
|
|
@ -58,6 +58,8 @@ AC("gamestate.lua")
|
|||
IN("gamestate.lua")
|
||||
AC("teams.lua")
|
||||
IN("teams.lua")
|
||||
AC("pausemenu.lua")
|
||||
IN("pausemenu.lua")
|
||||
|
||||
AC("debugmenu.lua")
|
||||
IN("debugmenu.lua")
|
||||
|
|
Loading…
Reference in New Issue