Just a ton of progress I forgot to commit
This commit is contained in:
parent
3c25c16787
commit
1dc4d614cd
|
@ -1,4 +1,6 @@
|
|||
|
||||
-- The benny weapon handles the weapon pickups you find throughout the game.
|
||||
|
||||
SWEP.Base = "weapon_base"
|
||||
|
||||
SWEP.PrintName = "Benny Weapon Handler"
|
||||
|
@ -6,10 +8,23 @@ SWEP.PrintName = "Benny Weapon Handler"
|
|||
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
|
||||
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
|
||||
|
||||
function SWEP:SetupDataTables()
|
||||
self:NetworkVar( "Float", 0, "Aim" )
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
if self:Clip1() == 0 then
|
||||
self:EmitSound( "benny/weapons/common/06-13.ogg", 80, 100, 1, CHAN_STATIC )
|
||||
return
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
AddCaption( "PISTOL", Color( 61, 61, 61 ), "[Pistol shot]", 0.1, 0.5 )
|
||||
end
|
||||
|
||||
self:EmitSound( "benny/weapons/1911/0".. math.random(1,3) ..".ogg", 110, 100, 1, CHAN_STATIC )
|
||||
|
||||
self:SetClip1( self:Clip1() - 1 )
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -18,12 +33,23 @@ function SWEP:SecondaryAttack()
|
|||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
self:SetClip1( 17 )
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:Think()
|
||||
self:SetWeaponHoldType("normal")
|
||||
self:SetHoldType("normal")
|
||||
local p = self:GetOwner()
|
||||
|
||||
self:SetAim( math.Approach( self:GetAim(), p:KeyDown(IN_ATTACK2) and 1 or 0, FrameTime()/0.05 ) )
|
||||
|
||||
local ht = "normal"
|
||||
if self:GetAim() > 0 then
|
||||
ht = "revolver"
|
||||
end
|
||||
|
||||
self:SetWeaponHoldType(ht)
|
||||
self:SetHoldType(ht)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
local UUID_chars = "0123456789ABCDEF"
|
||||
|
||||
function UUID_generate()
|
||||
local str = ""
|
||||
for i=1, 8 do
|
||||
str = str .. UUID_chars[ math.random( 1, #UUID_chars ) ]
|
||||
-- if (i%4==0 and i!=8) then
|
||||
-- str = str .. "-"
|
||||
-- end
|
||||
end
|
||||
return str
|
||||
end
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
local debugcolor = Color( 255, 0, 255, 1 )
|
||||
|
||||
local function QuickDrag( self, dist, ply )
|
||||
local spos = ply:GetPos()
|
||||
self.QuickDrag = self.QuickDrag or Vector()
|
||||
|
||||
-- debugoverlay.Box( self.last, Vector( -dist, -dist, 0 ), Vector( dist, dist, 64 ), 0, Color( 0, 0, 255, 0 ) )
|
||||
|
||||
if spos.x > (self.QuickDrag.x+dist) then
|
||||
self.QuickDrag.x = spos.x-dist
|
||||
elseif spos.x < (self.QuickDrag.x-dist) then
|
||||
self.QuickDrag.x = spos.x+dist
|
||||
end
|
||||
|
||||
if spos.y > (self.QuickDrag.y+dist) then
|
||||
self.QuickDrag.y = spos.y-dist
|
||||
elseif spos.y < (self.QuickDrag.y-dist) then
|
||||
self.QuickDrag.y = spos.y+dist
|
||||
end
|
||||
|
||||
return spos
|
||||
end
|
||||
|
||||
tempmapcameras = {}
|
||||
|
||||
tempmapcameras["benny_caramelldansen"] = {}
|
||||
|
@ -10,7 +31,7 @@ tempmapcameras["benny_caramelldansen"] = {}
|
|||
tempmapcameras["benny_caramelldansen"]["main"] = {
|
||||
Type = "Standard",
|
||||
Pos = Vector( -510, 0, 128 ),
|
||||
Ang = Angle( 12, 0, 0 ),
|
||||
Ang = Angle( 44, 0, 0 ),
|
||||
FOV = 90,
|
||||
Checks = {
|
||||
{
|
||||
|
@ -24,6 +45,10 @@ tempmapcameras["benny_caramelldansen"]["main"] = {
|
|||
local ang = Angle()
|
||||
ang:Set( self.Ang )
|
||||
|
||||
pos:Set( QuickDrag( self, 40, ply ) )
|
||||
pos.x = pos.x - 130
|
||||
pos.z = 180
|
||||
|
||||
return pos, ang, self.FOV
|
||||
end
|
||||
}
|
||||
|
@ -166,23 +191,13 @@ local tempcam = {
|
|||
|
||||
Special = function( self, ply )
|
||||
local pos = Vector()
|
||||
local ang = Angle()
|
||||
local fov = self.FOV
|
||||
local ppos = ply:GetPos()
|
||||
local pang = ply:EyeAngles()
|
||||
|
||||
pos:Set( ppos )
|
||||
ang:Add( pang )
|
||||
|
||||
pos.z = pos.z + 68
|
||||
ctrace.start = pos
|
||||
ctrace.endpos = pos + ( ang:Forward() * -60 ) + ( ang:Right() * 20 )
|
||||
ctrace.filter = ply
|
||||
local tr = util.TraceHull( ctrace )
|
||||
|
||||
pos = tr.HitPos
|
||||
|
||||
return pos, ang, fov
|
||||
local ang = Angle( 22, 0, 0 )
|
||||
|
||||
pos:Set( QuickDrag( self, 40, ply ) )
|
||||
pos.x = pos.x - 30
|
||||
pos.z = pos.z + 80
|
||||
|
||||
return pos, ang, self.FOV
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -250,39 +265,65 @@ local function decide_active()
|
|||
return false
|
||||
end
|
||||
|
||||
function bennyfp( origin, angles, fov )
|
||||
local ply = LocalPlayer()
|
||||
assert( IsValid( ply:GetActiveWeapon() ) )
|
||||
|
||||
local pos, ang = Vector(), Angle()
|
||||
|
||||
pos:Set( ply:GetPos() )
|
||||
pos.z = pos.z + 64
|
||||
ang:Set( angles )
|
||||
|
||||
pos:Add( 16 * ang:Right() )
|
||||
pos:Add( -32 * ang:Forward() )
|
||||
pos:Add( 0 * ang:Up() )
|
||||
|
||||
pos:Add( 16 * ang:Up() * (ang.p/90) )
|
||||
|
||||
return pos, ang, 90
|
||||
end
|
||||
|
||||
hook.Add( "CalcView", "MyCalcView", function( ply, pos, ang, fov )
|
||||
if c_unlock:GetBool() then return end
|
||||
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
|
||||
decide_active()
|
||||
local camera = BENNY_ACTIVECAMERA
|
||||
local view = {}
|
||||
view.origin = pos
|
||||
view.angles = ang
|
||||
view.fov = 90
|
||||
if camera then
|
||||
local view = {
|
||||
origin = camera.Pos,
|
||||
angles = camera.Ang,
|
||||
fov = camera.FOV or 60,
|
||||
drawviewer = true
|
||||
}
|
||||
view.origin = camera.Pos
|
||||
view.angles = camera.Ang
|
||||
view.fov = camera.FOV or 60
|
||||
if camera.Special then
|
||||
view.origin, view.angles, view.fov = camera.Special( camera, ply )
|
||||
end
|
||||
|
||||
local st = c_over:GetString()
|
||||
if st != "" then
|
||||
local st = string.Explode( " ", st )
|
||||
view.origin.x = tonumber(st[1])
|
||||
view.origin.y = tonumber(st[2])
|
||||
view.origin.z = tonumber(st[3])
|
||||
|
||||
view.angles.x = tonumber(st[4])
|
||||
view.angles.y = tonumber(st[5])
|
||||
view.angles.z = tonumber(st[6])
|
||||
|
||||
view.fov = tonumber(st[7])
|
||||
end
|
||||
|
||||
--view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) )
|
||||
return view
|
||||
end
|
||||
|
||||
-- PROTO: Add correct benny weapon check
|
||||
if IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetAim() > 0 then
|
||||
view.drawviewer = true
|
||||
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
|
||||
end
|
||||
|
||||
local st = c_over:GetString()
|
||||
if st != "" then
|
||||
local st = string.Explode( " ", st )
|
||||
view.origin.x = tonumber(st[1])
|
||||
view.origin.y = tonumber(st[2])
|
||||
view.origin.z = tonumber(st[3])
|
||||
|
||||
view.angles.x = tonumber(st[4])
|
||||
view.angles.y = tonumber(st[5])
|
||||
view.angles.z = tonumber(st[6])
|
||||
|
||||
view.fov = tonumber(st[7])
|
||||
end
|
||||
|
||||
view.fov = Convert( view.fov, (ScrH()/ScrW())/(3/4) )
|
||||
return view
|
||||
end )
|
||||
|
||||
function Convert( fovDegrees, ratio )
|
||||
|
|
|
@ -8,6 +8,9 @@ local hide = {
|
|||
["CHudSecondaryAmmo"] = true,
|
||||
["CHudPoisonDamageIndicator"] = true,
|
||||
["CHudCrosshair"] = true,
|
||||
["CHUDQuickInfo"] = true,
|
||||
["CHudSuitPower"] = true,
|
||||
["CHudZoom"] = true,
|
||||
}
|
||||
|
||||
hook.Add( "HUDShouldDraw", "HideHUD", function( name )
|
||||
|
@ -135,11 +138,14 @@ function AddCaption( name, color, text, time_to_type, lifetime )
|
|||
end
|
||||
|
||||
local color_caption = Color( 0, 0, 0, 127 )
|
||||
local mat_grad = Material( "benny/hud/grad.png", "mips smooth" )
|
||||
|
||||
hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
||||
local sw, sh = ScrW(), ScrH()
|
||||
localss = ss(1)
|
||||
local b = ss(20)
|
||||
local p = LocalPlayer()
|
||||
-- PROTO: Make sure this is the 'benny' weapon.
|
||||
local wep = p:GetActiveWeapon()
|
||||
|
||||
local scheme = schemes["benny"]
|
||||
|
||||
|
@ -148,7 +154,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
|||
surface.SetDrawColor( scheme["bg"] )
|
||||
surface.DrawRect( b, sh - b - ss(22), ss(140), ss(14+8) )
|
||||
|
||||
local hp = CurTime()*0.5 % 1
|
||||
local hp = p:Health()/100 --CurTime()*0.5 % 1
|
||||
local ti = (CurTime()*0.75 / (hp)) % 1
|
||||
|
||||
-- Text underneath
|
||||
surface.SetFont( "Benny_18" )
|
||||
|
@ -160,6 +167,15 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
|||
surface.SetDrawColor( scheme["fg"] )
|
||||
surface.DrawRect( b + ss(4), sh - b - ss(22) + ss(4), ss((140*hp)-8), ss(14) )
|
||||
|
||||
local gcol = scheme["fg"]
|
||||
local ch, cs, cl = gcol:ToHSL()
|
||||
cl = ((cl*0.0) + (1)*hp)
|
||||
gcol = HSLToColor( ch, cs, cl )
|
||||
gcol.a = ((1-ti)*255*hp) + ((1-hp)*255)
|
||||
surface.SetDrawColor( gcol )
|
||||
surface.SetMaterial( mat_grad )
|
||||
surface.DrawTexturedRect( b + ss(4), sh - b - ss(22) + ss(4), ss((140*hp*ti)-8), ss(14) )
|
||||
|
||||
-- Bar text
|
||||
surface.SetTextColor( scheme["bg"] )
|
||||
surface.SetTextPos( b + ss(6), sh - b - ss(22) + ss(3) )
|
||||
|
@ -170,29 +186,30 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
|||
|
||||
do -- Weapon
|
||||
local w, h = 150, 100
|
||||
local BOXHEIGHT = 44
|
||||
-- BG
|
||||
surface.SetDrawColor( scheme["bg"] )
|
||||
surface.DrawRect( sw - b - ss(w), sh - b - ss(100), ss(w), ss(100) )
|
||||
surface.DrawRect( sw - b - ss(w), sh - b - ss(BOXHEIGHT), ss(w), ss(BOXHEIGHT) )
|
||||
|
||||
-- Text bar
|
||||
surface.SetFont( "Benny_18" )
|
||||
surface.SetDrawColor( scheme["fg"] )
|
||||
surface.DrawRect( sw - b - ss(w-4), sh - b - ss(100-4), ss(w-8), ss(14) )
|
||||
surface.DrawRect( sw - b - ss(w-4), sh - b - ss(BOXHEIGHT-4), ss(w-8), ss(14) )
|
||||
|
||||
surface.SetTextColor( scheme["bg"] )
|
||||
surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(100-3) )
|
||||
surface.SetTextPos( sw - b - ss(w-6), sh - b - ss(BOXHEIGHT-3) )
|
||||
surface.DrawText( "GLOCK-17" )
|
||||
|
||||
surface.SetDrawColor( scheme["fg"] )
|
||||
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(100-4), ss(29), ss(10) )
|
||||
surface.DrawRect( sw - b - ss(w-4), sh - b + ss(16) - ss(BOXHEIGHT-4), ss(29), ss(10) )
|
||||
|
||||
surface.SetFont( "Benny_12" )
|
||||
surface.SetTextColor( scheme["bg"] )
|
||||
surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(100-4) )
|
||||
surface.SetTextPos( sw - b - ss(w-7), sh - b + ss(16) - ss(BOXHEIGHT-4) )
|
||||
surface.DrawText( "3BST" )
|
||||
|
||||
surface.SetFont( "Benny_12" )
|
||||
local text = "17 - MAG 3"
|
||||
local text = wep:Clip1() .. " - MAG 3"
|
||||
local tw = surface.GetTextSize( text )
|
||||
surface.SetTextColor( scheme["fg"] )
|
||||
surface.SetTextPos( sw - b - ss(4) - tw, sh - b - ss(24) )
|
||||
|
@ -200,7 +217,10 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
|||
|
||||
for i=1, 17 do
|
||||
surface.SetDrawColor( scheme["fg"] )
|
||||
surface.DrawRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8) )
|
||||
surface.DrawOutlinedRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8), ss(0.5) )
|
||||
if i <= wep:Clip1() then
|
||||
surface.DrawRect( sw - b - ss(3+4) - ( ss(5) * (i-1) ), sh - b - ss(8+4), ss(3), ss(8) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -241,4 +261,34 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function()
|
|||
surface.DrawText( caption.name )
|
||||
end
|
||||
end
|
||||
|
||||
-- [UUID_generate()] = {
|
||||
-- Clip1 = 20,
|
||||
-- Mag1 = 12,
|
||||
-- Mag2 = 9,
|
||||
-- Mag3 = 17,
|
||||
-- }
|
||||
do -- Inventory
|
||||
local gap = 0
|
||||
for ID, Data in pairs( p:INV_Get() ) do
|
||||
surface.SetDrawColor( scheme["bg"] )
|
||||
surface.DrawRect( b + ss(4), b + ss(4) + gap, ss(140), ss(30) )
|
||||
|
||||
surface.SetFont( "Benny_12" )
|
||||
surface.SetTextColor( scheme["fg"] )
|
||||
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3) + gap )
|
||||
surface.DrawText( ID )
|
||||
|
||||
local str = ""
|
||||
for i, v in pairs( Data ) do
|
||||
str = str .. i .. ": " .. v .. " "
|
||||
end
|
||||
|
||||
surface.SetFont( "Benny_10" )
|
||||
surface.SetTextColor( scheme["fg"] )
|
||||
surface.SetTextPos( b + ss(4 + 4), b + ss(4 + 3 + 8) + gap )
|
||||
surface.DrawText( str )
|
||||
gap = gap + ss(30+4)
|
||||
end
|
||||
end
|
||||
end )
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
function GM:PlayerSetModel( ply )
|
||||
ply:SetModel( "models/player/group01/male_07.mdl" )
|
||||
end
|
||||
|
||||
function GM:PlayerLoadout( ply )
|
||||
function GM:PlayerSpawn( ply )
|
||||
player_manager.SetPlayerClass( ply, "player_benny" )
|
||||
ply:SetModel( "models/player/combine_super_soldier.mdl" )
|
||||
ply:SetPlayerColor( Vector( 0.275, 0.2, 0.145 ) )
|
||||
ply:Give( "benny" )
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
local PT = FindMetaTable( "Player" )
|
||||
|
||||
function PT:INV_Get()
|
||||
if !self.INV then
|
||||
print( "Inventory created")
|
||||
self.INV = {}
|
||||
end
|
||||
return self.INV
|
||||
end
|
|
@ -6,8 +6,21 @@ local wa, wb = 0, 0
|
|||
local blop = Angle()
|
||||
|
||||
hook.Add( "CreateMove", "CamFuck", function( cmd )
|
||||
if LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||
if BENNY_ACTIVECAMERA and LocalPlayer():GetMoveType() != MOVETYPE_NOCLIP then
|
||||
local x, y = cmd:GetForwardMove(), cmd:GetSideMove()
|
||||
|
||||
local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right +
|
||||
local ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom +
|
||||
|
||||
local lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right +
|
||||
local lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom +
|
||||
|
||||
lx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0
|
||||
|
||||
if lx != 0 or ly != 0 then
|
||||
x, y = ly * -320, lx * 320
|
||||
end
|
||||
|
||||
wa, wb = x, y
|
||||
|
||||
local ad = Vector( x, y, 0 )
|
||||
|
@ -23,9 +36,10 @@ hook.Add( "CreateMove", "CamFuck", function( cmd )
|
|||
ad:Rotate( am )
|
||||
ad:Rotate( -an )
|
||||
|
||||
ad:Normalize()
|
||||
ad:Mul(320)
|
||||
-- ad:Normalize()
|
||||
-- ad:Mul(320)
|
||||
|
||||
cmd:ClearMovement()
|
||||
cmd:SetForwardMove( ad.x )
|
||||
cmd:SetSideMove( ad.y )
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
AddCSLuaFile()
|
||||
|
||||
local PLAYER = {}
|
||||
|
||||
PLAYER.DisplayName = "Benny Player Class"
|
||||
|
||||
PLAYER.SlowWalkSpeed = 200
|
||||
PLAYER.WalkSpeed = 400
|
||||
PLAYER.RunSpeed = 600
|
||||
PLAYER.CrouchedWalkSpeed = 0.3
|
||||
PLAYER.DuckSpeed = 0.3
|
||||
PLAYER.UnDuckSpeed = 0.3
|
||||
PLAYER.JumpPower = 200
|
||||
PLAYER.CanUseFlashlight = false
|
||||
PLAYER.MaxHealth = 100
|
||||
PLAYER.MaxArmor = 100
|
||||
PLAYER.StartHealth = 100
|
||||
PLAYER.StartArmor = 0
|
||||
PLAYER.DropWeaponOnDie = false
|
||||
PLAYER.TeammateNoCollide = true
|
||||
PLAYER.AvoidPlayers = true
|
||||
PLAYER.UseVMHands = true
|
||||
|
||||
function PLAYER:SetupDataTables()
|
||||
end
|
||||
|
||||
player_manager.RegisterClass( "player_benny", PLAYER, "player_default" )
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
WEAPONS = {}
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["glock"] = wep
|
||||
wep.Name = "GLOCK-18"
|
||||
wep.WModel = "models/weapons/w_pist_glock18.mdl"
|
||||
wep.Description = "Superb precision but poor capacity."
|
||||
wep.Ammo = 17
|
||||
wep.Damage = 18
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["python"] = wep
|
||||
wep.Name = "PYTHON"
|
||||
wep.Description = "Superb precision but poor capacity."
|
||||
wep.Ammo = 6
|
||||
wep.Damage = 36
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["tmp"] = wep
|
||||
wep.Name = "TMP"
|
||||
wep.Description = "Precise."
|
||||
wep.Ammo = 15
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["mp7"] = wep
|
||||
wep.Name = "MP7"
|
||||
wep.Description = "Small, pistol-sized, and simple."
|
||||
wep.Ammo = 15
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["mp5k"] = wep
|
||||
wep.Name = "MP5K"
|
||||
wep.Description = "Quality manufacturing, but cumbersome."
|
||||
wep.Ammo = 15
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["mac11"] = wep
|
||||
wep.Name = "MAC-11"
|
||||
wep.Description = "More fit for combat in a phone booth."
|
||||
wep.Ammo = 15
|
||||
|
||||
local wep = {}
|
||||
WEAPONS["bizon"] = wep
|
||||
wep.Name = "BIZON"
|
||||
wep.Description = "Unwieldy bullet storm."
|
||||
wep.Ammo = 40
|
BIN
maps/benny_test.bsp (Stored with Git LFS)
BIN
maps/benny_test.bsp (Stored with Git LFS)
Binary file not shown.
5150
maps/benny_test.vmf
5150
maps/benny_test.vmf
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue