Compare commits
12 Commits
doing-this
...
main
Author | SHA1 | Date |
---|---|---|
Fesiug | 146ff65133 | |
Fesiug | bde7e22f50 | |
Fesiug | eb200dafc6 | |
Fesiug | 7215d129dd | |
Fesiug | 5baa31e570 | |
Fesiug | dd680e2b4b | |
Fesiug | faac326333 | |
Fesiug | c6cd283755 | |
Fesiug | ae0d2ccca0 | |
Fesiug | 164119295f | |
Fesiug | 3282cb3a7f | |
Fesiug | 84a71874d3 |
|
@ -0,0 +1,10 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mdl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.dx90.vtx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.phy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.vvd filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.vtf filter=lfs diff=lfs merge=lfs -text
|
|
@ -0,0 +1,2 @@
|
||||||
|
*.dx80.vtx
|
||||||
|
*.sw.vtx
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"editor.detectIndentation": false,
|
||||||
|
"editor.insertSpaces": false
|
||||||
|
},
|
||||||
|
"extensions": {
|
||||||
|
"recommendations": [
|
||||||
|
"venner.vscode-glua-enhanced"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-01.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-01.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-02.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-02.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-03.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-03.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-04.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-04.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-05.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-05.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-06.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-06.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-07.ogg (Stored with Git LFS)
Normal file
BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/confirm-07.ogg (Stored with Git LFS)
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,13 @@
|
||||||
|
"cg"
|
||||||
|
{
|
||||||
|
"base" "base"
|
||||||
|
"title" "Cops 'n Robbers"
|
||||||
|
"maps" "^cnr_"
|
||||||
|
"category" "pvp"
|
||||||
|
"menusystem" "1"
|
||||||
|
// "workshopid" "0"
|
||||||
|
|
||||||
|
"settings"
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
ENT.Type = "point"
|
||||||
|
|
||||||
|
function ENT:SetupDataTables()
|
||||||
|
self:NetworkVar( "Float", 0, "RoundStartedAt" )
|
||||||
|
self:NetworkVar( "Float", 1, "PregameStartedAt" )
|
||||||
|
self:NetworkVar( "Float", 2, "RoundFinishedAt" )
|
||||||
|
|
||||||
|
self:NetworkVar( "Int", 0, "State" )
|
||||||
|
self:NetworkVar( "Int", 1, "Round" )
|
||||||
|
self:NetworkVar( "Int", 2, "Money" )
|
||||||
|
self:NetworkVar( "Int", 3, "SwappedAtRound" )
|
||||||
|
|
||||||
|
self:NetworkVar( "Bool", 0, "TeamSwap" )
|
||||||
|
|
||||||
|
self:SetRound( 1 )
|
||||||
|
self:SetSwappedAtRound( 1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:Initialize()
|
||||||
|
self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT )
|
||||||
|
end
|
||||||
|
|
||||||
|
function ENT:UpdateTransmitState()
|
||||||
|
return TRANSMIT_ALWAYS
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
function SWEP:GetViewModelPosition( pos, ang )
|
||||||
|
local p = self:GetOwner()
|
||||||
|
|
||||||
|
local speed = math.Clamp( p:GetVelocity():Length2D()/320, 0, 1 )
|
||||||
|
|
||||||
|
local newpos, newang = Vector( pos ), Angle( ang )
|
||||||
|
|
||||||
|
newpos:Add( ang:Right() * self.ActivePos.x )
|
||||||
|
newpos:Add( ang:Forward() * self.ActivePos.y )
|
||||||
|
newpos:Add( ang:Up() * self.ActivePos.z )
|
||||||
|
|
||||||
|
newpos:Add( ang:Right() * 1 * math.sin( CurTime() * math.pi * 2 ) * speed )
|
||||||
|
newpos:Add( ang:Up() * -0.25 * math.abs( math.sin( CurTime() * math.pi * 2 ) ) * speed )
|
||||||
|
|
||||||
|
return newpos, newang
|
||||||
|
end
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
function SWEP:SendAnim( anim )
|
||||||
|
if !self:GetOwner():IsValid() then return 0 end
|
||||||
|
local vm = self:GetOwner():GetViewModel()
|
||||||
|
if !vm:IsValid() then return 0 end
|
||||||
|
|
||||||
|
if !self.Animations then return 0 end
|
||||||
|
local AnimData = self.Animations[anim]
|
||||||
|
if !AnimData then return 0 end
|
||||||
|
|
||||||
|
vm:SendViewModelMatchingSequence( vm:LookupSequence(AnimData.Source) )
|
||||||
|
|
||||||
|
if AnimData.Delay_Reload then
|
||||||
|
self:SetDelayReload( CurTime() + AnimData.Delay_Reload )
|
||||||
|
end
|
||||||
|
if AnimData.Delay_Refill then
|
||||||
|
self:SetRefillTime( CurTime() + AnimData.Delay_Refill )
|
||||||
|
end
|
||||||
|
|
||||||
|
return vm:SequenceDuration()
|
||||||
|
end
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
function SWEP:Reload()
|
||||||
|
if self:GetDelay() > CurTime() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if self:GetDelayReload() > CurTime() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if self:GetShotgunReloading() == 1 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if self:Clip1() >= self.Primary.ClipSize then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.ShotgunReloading then
|
||||||
|
self:SendWeaponAnim( ACT_SHOTGUN_RELOAD_START )
|
||||||
|
self:GetOwner():GetViewModel():SetPlaybackRate( 2.5 )
|
||||||
|
self:SetDelayReload( CurTime() + 0.1 )
|
||||||
|
self:SetShotgunReloading( 1 )
|
||||||
|
else
|
||||||
|
self:SendAnim( "reload" )
|
||||||
|
--self:SetDelayReload( CurTime() + animtime*0.9 )
|
||||||
|
--self:SetRefillTime( CurTime() + animtime*0.5 )
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
|
@ -0,0 +1,81 @@
|
||||||
|
|
||||||
|
function SWEP:Spread()
|
||||||
|
local spread = self:GetBubbleSpread()
|
||||||
|
spread = Lerp( spread, self.SpreadStart, self.SpreadEnd )
|
||||||
|
return spread
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:PrimaryAttack( mine )
|
||||||
|
if self:GetDelay() > CurTime() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if self:GetDelayReload() > CurTime() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if self:Clip1() == 0 then
|
||||||
|
self:EmitSound( "weapons/clipempty_rifle.wav", 60, 100, 1, CHAN_STATIC )
|
||||||
|
self:SetDelay( CurTime() + self.Delay )
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetBurstCount() >= self.MaxBurst then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetDelay( CurTime() + self.Delay )
|
||||||
|
self:SetBurstCount( self:GetBurstCount() + 1 )
|
||||||
|
self:SendAnim( "fire" )
|
||||||
|
self:SetClip1( self:Clip1() - 1 )
|
||||||
|
|
||||||
|
self:EmitSound( self.Sound_Fire[ math.random( 1, #self.Sound_Fire ) ], 80, 100, 1, CHAN_STATIC )
|
||||||
|
self:EmitSound( self.Sound_Mech[ math.random( 1, #self.Sound_Mech ) ], 60, 100, 0.125, CHAN_BODY )
|
||||||
|
|
||||||
|
local dir = self:GetOwner():EyeAngles()
|
||||||
|
local newdir = Vector()
|
||||||
|
local spread = math.rad( self:Spread() )
|
||||||
|
do
|
||||||
|
local radius = util.SharedRandom("CNR_WepRand1_" .. 1, 0, 1 )
|
||||||
|
local theta = util.SharedRandom("CNR_WepRand2_" .. 1, 0, math.rad(360) )
|
||||||
|
local x = radius * math.sin(theta)
|
||||||
|
local y = radius * math.cos(theta)
|
||||||
|
|
||||||
|
newdir:Set( dir:Forward() + (dir:Right() * spread * x) + (dir:Up() * spread * y) )
|
||||||
|
end
|
||||||
|
|
||||||
|
self:FireBullets( {
|
||||||
|
Attacker = self:GetOwner(),
|
||||||
|
Tracer = 1,
|
||||||
|
Damage = self.DamageClose,
|
||||||
|
Force = 1,
|
||||||
|
Num = 1,
|
||||||
|
Dir = newdir,
|
||||||
|
Spread = vector_origin,
|
||||||
|
Src = self:GetOwner():EyePos(),
|
||||||
|
Callback = function( attacker, tr, dmginfo )
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
do
|
||||||
|
if ( !game.SinglePlayer() and CLIENT and IsFirstTimePredicted() ) then
|
||||||
|
local recoil = {}
|
||||||
|
|
||||||
|
recoil.up = util.SharedRandom( "CNR_WepRecoil", -1, 1 ) * self.RecoilUp
|
||||||
|
|
||||||
|
recoil.speed = math.max( 1, self.RecoilSpeed ) -- how much to move in a second
|
||||||
|
|
||||||
|
recoil.dist = Lerp( self:GetBubbleRecoil(), self.RecoilDistStart, self.RecoilDistEnd ) -- total distance to travel
|
||||||
|
|
||||||
|
--recoil.up2 = recoil.up + 180
|
||||||
|
--recoil.speed2 = recoil.speed * 0.25
|
||||||
|
--recoil.dist2 = recoil.dist
|
||||||
|
|
||||||
|
table.insert( self.RecoilTable, recoil )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:SecondaryAttack()
|
||||||
|
return true
|
||||||
|
end
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
SWEP.RecoilTable = {}
|
||||||
|
|
||||||
|
function SWEP:Think()
|
||||||
|
local p = self:GetOwner()
|
||||||
|
|
||||||
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
|
for i, data in pairs( self.RecoilTable ) do
|
||||||
|
local ft = FrameTime()
|
||||||
|
local diff = data.dist - math.Approach( data.dist, 0, ft * data.speed )
|
||||||
|
data.dist = math.Approach( data.dist, 0, ft * data.speed )
|
||||||
|
local m_p, m_y = math.cos(math.rad(data.up)), math.sin(math.rad(data.up))
|
||||||
|
|
||||||
|
local p_p, p_y = m_p * diff, m_y * diff
|
||||||
|
|
||||||
|
p:SetEyeAngles( p:EyeAngles() - Angle( p_p, p_y, 0 ) )
|
||||||
|
|
||||||
|
if data.up2 then
|
||||||
|
if data.dist == 0 then
|
||||||
|
local diff = data.dist2 - math.Approach( data.dist2, 0, ft * data.speed2 )
|
||||||
|
data.dist2 = math.Approach( data.dist2, 0, ft * data.speed2 )
|
||||||
|
local m_p, m_y = math.cos(math.rad(data.up2)), math.sin(math.rad(data.up2))
|
||||||
|
|
||||||
|
local p_p, p_y = m_p * diff, m_y * diff
|
||||||
|
|
||||||
|
p:SetEyeAngles( p:EyeAngles() - Angle( p_p, p_y, 0 ) )
|
||||||
|
end
|
||||||
|
if data.dist2 == 0 then
|
||||||
|
self.RecoilTable[i] = nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if data.dist == 0 then
|
||||||
|
self.RecoilTable[i] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !p:KeyDown( IN_ATTACK ) then
|
||||||
|
self:SetBurstCount( 0 )
|
||||||
|
end
|
||||||
|
|
||||||
|
local up = self:GetDelay() > CurTime()-engine.TickInterval()
|
||||||
|
self:SetBubbleSpread( math.Approach( self:GetBubbleSpread(), up and 1 or 0, FrameTime()/(up and self.BubbleSpreadUp or self.BubbleSpreadDown) ) )
|
||||||
|
self:SetBubbleRecoil( math.Approach( self:GetBubbleRecoil(), up and 1 or 0, FrameTime()/(up and self.BubbleRecoilUp or self.BubbleRecoilDown) ) )
|
||||||
|
|
||||||
|
if self:GetRefillTime() != -1 and CurTime() >= self:GetRefillTime() then
|
||||||
|
self:SetClip1( self.ShotgunReloading and (self:Clip1() + 1) or self.Primary.ClipSize )
|
||||||
|
self:SetRefillTime( -1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:GetShotgunReloading() == 1 then
|
||||||
|
if p:KeyDown( IN_ATTACK ) or (self:GetDelayReload() <= CurTime() and self:Clip1() == self.Primary.ClipSize) then
|
||||||
|
self:SendAnim( "reload_start" )
|
||||||
|
self:SetRefillTime( -1 )
|
||||||
|
self:SetShotgunReloading( 0 )
|
||||||
|
else
|
||||||
|
if self:GetDelayReload() <= CurTime() then
|
||||||
|
self:SendAnim( "reload" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,97 @@
|
||||||
|
|
||||||
|
SWEP.Base = "weapon_base"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CNR weapon base"
|
||||||
|
SWEP.Slot = 5
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_ak47.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.UseHands = true
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl"
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/m4a1/fire-01.ogg",
|
||||||
|
"cnr/weapons/m4a1/fire-02.ogg",
|
||||||
|
"cnr/weapons/m4a1/fire-03.ogg",
|
||||||
|
}
|
||||||
|
SWEP.Sound_Mech = {
|
||||||
|
"cnr/weapons/mech-01.ogg",
|
||||||
|
"cnr/weapons/mech-02.ogg",
|
||||||
|
"cnr/weapons/mech-03.ogg",
|
||||||
|
"cnr/weapons/mech-04.ogg",
|
||||||
|
"cnr/weapons/mech-05.ogg",
|
||||||
|
"cnr/weapons/mech-06.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Delay = ( 60 / 900 )
|
||||||
|
SWEP.MaxBurst = math.huge
|
||||||
|
SWEP.ActivePos = vector_origin--Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.8
|
||||||
|
SWEP.BubbleRecoilUp = 0.8
|
||||||
|
SWEP.BubbleSpreadDown = 0.2
|
||||||
|
SWEP.BubbleRecoilDown = 0.2
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0
|
||||||
|
SWEP.SpreadEnd = 10
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 33
|
||||||
|
SWEP.RecoilSpeed = 90
|
||||||
|
SWEP.RecoilDistStart = 1
|
||||||
|
SWEP.RecoilDistEnd = 10
|
||||||
|
SWEP.RecoilDistFunc = math.ease.InExpo
|
||||||
|
|
||||||
|
SWEP.Primary.Ammo = "pistol"
|
||||||
|
SWEP.Primary.ClipSize = 0
|
||||||
|
SWEP.Primary.DefaultClip = 0
|
||||||
|
SWEP.Primary.Automatic = true
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = 0
|
||||||
|
SWEP.Secondary.Automatic = true
|
||||||
|
|
||||||
|
AddCSLuaFile("sh_think.lua")
|
||||||
|
include ("sh_think.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("sh_shoot.lua")
|
||||||
|
include ("sh_shoot.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("sh_reload.lua")
|
||||||
|
include ("sh_reload.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("sh_animate.lua")
|
||||||
|
include ("sh_animate.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("cl_vm.lua")
|
||||||
|
if CLIENT then
|
||||||
|
include ("cl_vm.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:Initialize()
|
||||||
|
self:SetClip1( self.Primary.ClipSize )
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:SetupDataTables()
|
||||||
|
self:NetworkVar( "Float", 0, "Delay" )
|
||||||
|
self:NetworkVar( "Float", 1, "DelayReload" )
|
||||||
|
self:NetworkVar( "Float", 2, "DelayDeploy" )
|
||||||
|
self:NetworkVar( "Float", 3, "RefillTime" )
|
||||||
|
self:NetworkVar( "Float", 4, "BubbleSpread" )
|
||||||
|
self:NetworkVar( "Float", 5, "BubbleRecoil" )
|
||||||
|
self:NetworkVar( "Int", 0, "BurstCount" )
|
||||||
|
self:NetworkVar( "Int", 1, "ShotgunReloading" )
|
||||||
|
|
||||||
|
self:SetRefillTime( -1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
SWEP.m_WeaponDeploySpeed = 10
|
||||||
|
SWEP.BobScale = 0
|
||||||
|
SWEP.SwayScale = 0
|
||||||
|
function SWEP:Deploy()
|
||||||
|
self:SendAnim( "draw" )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
function SWEP:Holster()
|
||||||
|
self:SetRefillTime( -1 )
|
||||||
|
return true
|
||||||
|
end
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CV-74"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_rif_ak47.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 1, -8, -1 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/ak47/fire-01.ogg",
|
||||||
|
"cnr/weapons/ak47/fire-02.ogg",
|
||||||
|
"cnr/weapons/ak47/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Delay = ( 60 / 700 )
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.9
|
||||||
|
SWEP.BubbleRecoilUp = 0.9
|
||||||
|
SWEP.BubbleSpreadDown = 0.3
|
||||||
|
SWEP.BubbleRecoilDown = 0.3
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0
|
||||||
|
SWEP.SpreadEnd = 10
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 55
|
||||||
|
SWEP.RecoilSpeed = 90
|
||||||
|
SWEP.RecoilDistStart = 1
|
||||||
|
SWEP.RecoilDistEnd = 10
|
||||||
|
|
||||||
|
-- Model source:
|
||||||
|
-- https://gamebanana.com/mods/209669
|
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CAL.50"
|
||||||
|
SWEP.Slot = 1
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_deagle.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 1, -8, -1 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/mossberg/fire-01.ogg",
|
||||||
|
"cnr/weapons/mossberg/fire-02.ogg",
|
||||||
|
"cnr/weapons/mossberg/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 7
|
||||||
|
SWEP.Delay = ( 60 / 200 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 44
|
||||||
|
SWEP.DamageFar = 44
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.01
|
||||||
|
SWEP.BubbleRecoilUp = 0.01
|
||||||
|
SWEP.BubbleSpreadDown = 0.75
|
||||||
|
SWEP.BubbleRecoilDown = 0.75
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0.2
|
||||||
|
SWEP.SpreadEnd = 15
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 33
|
||||||
|
SWEP.RecoilSpeed = 30/0.1
|
||||||
|
SWEP.RecoilDistStart = 20
|
||||||
|
SWEP.RecoilDistEnd = 20
|
|
@ -0,0 +1,38 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CAL.9"
|
||||||
|
SWEP.Slot = 1
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_glock18.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 1, -8, -1 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/glock/fire-01.ogg",
|
||||||
|
"cnr/weapons/glock/fire-02.ogg",
|
||||||
|
"cnr/weapons/glock/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 17
|
||||||
|
SWEP.Delay = ( 60 / 500 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 22
|
||||||
|
SWEP.DamageFar = 11
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.2
|
||||||
|
SWEP.BubbleRecoilUp = 0.2
|
||||||
|
SWEP.BubbleSpreadDown = 0.3
|
||||||
|
SWEP.BubbleRecoilDown = 0.2
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 1
|
||||||
|
SWEP.SpreadEnd = 3
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 45
|
||||||
|
SWEP.RecoilSpeed = 40
|
||||||
|
SWEP.RecoilDistStart = 2
|
||||||
|
SWEP.RecoilDistEnd = 5
|
||||||
|
|
||||||
|
-- Model source:
|
||||||
|
-- https://gamebanana.com/mods/206952
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "REPT-499"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_mach_m249para.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_mach_m249para.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/m249/fire-01.ogg",
|
||||||
|
"cnr/weapons/m249/fire-02.ogg",
|
||||||
|
"cnr/weapons/m249/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 60
|
||||||
|
SWEP.Delay = ( 60 / 900 )
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 2
|
||||||
|
SWEP.BubbleRecoilUp = 2
|
||||||
|
SWEP.BubbleSpreadDown = 0.7
|
||||||
|
SWEP.BubbleRecoilDown = 0.7
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0.1
|
||||||
|
SWEP.SpreadEnd = 4
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 33
|
||||||
|
SWEP.RecoilSpeed = 60
|
||||||
|
SWEP.RecoilDistStart = 0.5
|
||||||
|
SWEP.RecoilDistEnd = 10
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "N4A4"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/cnr/m4a1_view.mdl"
|
||||||
|
SWEP.ViewModelFOV = 74
|
||||||
|
SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl"
|
||||||
|
SWEP.ActivePos = vector_origin
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/m4a1/fire-01.ogg",
|
||||||
|
"cnr/weapons/m4a1/fire-02.ogg",
|
||||||
|
"cnr/weapons/m4a1/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Delay = ( 60 / 900 )
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
-- Model source:
|
||||||
|
-- https://gamebanana.com/mods/210362
|
||||||
|
|
||||||
|
SWEP.Animations = {
|
||||||
|
["idle"] = {
|
||||||
|
Source = "idle",
|
||||||
|
},
|
||||||
|
["fire"] = {
|
||||||
|
Source = "fire",
|
||||||
|
},
|
||||||
|
["draw"] = {
|
||||||
|
Source = "draw",
|
||||||
|
},
|
||||||
|
["melee"] = {
|
||||||
|
Source = "melee1",
|
||||||
|
},
|
||||||
|
["reload"] = {
|
||||||
|
Source = "reload",
|
||||||
|
Delay_Reload = 4,
|
||||||
|
Delay_Refill = 1.5,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "MAXI R90"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_shot_xm1014.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/m4s90/fire-01.ogg",
|
||||||
|
"cnr/weapons/m4s90/fire-02.ogg",
|
||||||
|
"cnr/weapons/m4s90/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 5
|
||||||
|
SWEP.Delay = ( 60 / 180 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
SWEP.ShotgunReloading = true
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "SPITFIRE 45A"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_mac10.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/mac10/fire-01.ogg",
|
||||||
|
"cnr/weapons/mac10/fire-02.ogg",
|
||||||
|
"cnr/weapons/mac10/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 32
|
||||||
|
SWEP.Delay = ( 60 / 1600 )
|
||||||
|
SWEP.DamageClose = 14
|
||||||
|
SWEP.DamageFar = 10
|
||||||
|
|
||||||
|
-- Model source:
|
||||||
|
-- https://gamebanana.com/mods/209072
|
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "SLIMLINE 12G"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_shot_m3super90.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_shot_m3super90.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/mossberg/fire-01.ogg",
|
||||||
|
"cnr/weapons/mossberg/fire-02.ogg",
|
||||||
|
"cnr/weapons/mossberg/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 4
|
||||||
|
SWEP.Delay = ( 60 / 80 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
SWEP.ShotgunReloading = true
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "SWORDFISH-5"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_mp5.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/mp5/fire-01.ogg",
|
||||||
|
"cnr/weapons/mp5/fire-02.ogg",
|
||||||
|
"cnr/weapons/mp5/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 30
|
||||||
|
SWEP.Delay = ( 60 / 900 )
|
||||||
|
SWEP.DamageClose = 16
|
||||||
|
SWEP.DamageFar = 10
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.8
|
||||||
|
SWEP.BubbleRecoilUp = 0.8
|
||||||
|
SWEP.BubbleSpreadDown = 0.2
|
||||||
|
SWEP.BubbleRecoilDown = 0.2
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0
|
||||||
|
SWEP.SpreadEnd = 10
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 60
|
||||||
|
SWEP.RecoilSpeed = 180
|
||||||
|
SWEP.RecoilDistStart = 1
|
||||||
|
SWEP.RecoilDistEnd = 5
|
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CAL.357"
|
||||||
|
SWEP.Slot = 1
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_p228.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_p228.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 1, -8, -1 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/p220/fire-01.ogg",
|
||||||
|
"cnr/weapons/p220/fire-02.ogg",
|
||||||
|
"cnr/weapons/p220/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 13
|
||||||
|
SWEP.Delay = ( 60 / 400 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 21
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.8
|
||||||
|
SWEP.BubbleRecoilUp = 0.2
|
||||||
|
SWEP.BubbleSpreadDown = 0.1
|
||||||
|
SWEP.BubbleRecoilDown = 0.1
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0.1
|
||||||
|
SWEP.SpreadEnd = 4
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 33
|
||||||
|
SWEP.RecoilSpeed = 60
|
||||||
|
SWEP.RecoilDistStart = 0.8
|
||||||
|
SWEP.RecoilDistEnd = 4
|
|
@ -0,0 +1,35 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "CAL.45"
|
||||||
|
SWEP.Slot = 1
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_pist_usp.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_pist_usp.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 1, -8, -1 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/usp/fire-01.ogg",
|
||||||
|
"cnr/weapons/usp/fire-02.ogg",
|
||||||
|
"cnr/weapons/usp/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 12
|
||||||
|
SWEP.Delay = ( 60 / 400 )
|
||||||
|
SWEP.MaxBurst = 1
|
||||||
|
SWEP.DamageClose = 25
|
||||||
|
SWEP.DamageFar = 13
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.6
|
||||||
|
SWEP.BubbleRecoilUp = 0.3
|
||||||
|
SWEP.BubbleSpreadDown = 0.2
|
||||||
|
SWEP.BubbleRecoilDown = 0.2
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0.1
|
||||||
|
SWEP.SpreadEnd = 5
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 45
|
||||||
|
SWEP.RecoilSpeed = 60
|
||||||
|
SWEP.RecoilDistStart = 2
|
||||||
|
SWEP.RecoilDistEnd = 4
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
SWEP.Base = "cnr"
|
||||||
|
|
||||||
|
SWEP.PrintName = "STAP-9"
|
||||||
|
SWEP.Slot = 0
|
||||||
|
|
||||||
|
SWEP.ViewModel = "models/weapons/cstrike/c_smg_tmp.mdl"
|
||||||
|
SWEP.ViewModelFOV = 90
|
||||||
|
SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl"
|
||||||
|
SWEP.ActivePos = Vector( 2, -2, -2 )
|
||||||
|
|
||||||
|
SWEP.Sound_Fire = {
|
||||||
|
"cnr/weapons/uzi/fire-01.ogg",
|
||||||
|
"cnr/weapons/uzi/fire-02.ogg",
|
||||||
|
"cnr/weapons/uzi/fire-03.ogg",
|
||||||
|
}
|
||||||
|
|
||||||
|
SWEP.Primary.ClipSize = 32
|
||||||
|
SWEP.Delay = ( 60 / 750 )
|
||||||
|
SWEP.DamageClose = 16
|
||||||
|
SWEP.DamageFar = 10
|
||||||
|
|
||||||
|
SWEP.BubbleSpreadUp = 0.8
|
||||||
|
SWEP.BubbleRecoilUp = 0.6
|
||||||
|
SWEP.BubbleSpreadDown = 0.2
|
||||||
|
SWEP.BubbleRecoilDown = 0.2
|
||||||
|
|
||||||
|
SWEP.SpreadStart = 0
|
||||||
|
SWEP.SpreadEnd = 10
|
||||||
|
|
||||||
|
SWEP.RecoilUp = 60
|
||||||
|
SWEP.RecoilSpeed = 120
|
||||||
|
SWEP.RecoilDistStart = 0.8
|
||||||
|
SWEP.RecoilDistEnd = 5
|
||||||
|
|
||||||
|
-- Model source:
|
||||||
|
-- https://gamebanana.com/mods/209113
|
|
@ -0,0 +1,345 @@
|
||||||
|
|
||||||
|
local hide = {
|
||||||
|
["CHudHealth"] = true,
|
||||||
|
["CHudBattery"] = true,
|
||||||
|
["CHudAmmo"] = true,
|
||||||
|
["CHudSecondaryAmmo"] = true,
|
||||||
|
["CHudWeaponSelection"] = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
hook.Add( "HUDShouldDraw", "HideHUD", function( name )
|
||||||
|
if ( hide[ name ] ) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end )
|
||||||
|
|
||||||
|
local sizes = { 48, 28, 24, 18, 14, 10 }
|
||||||
|
|
||||||
|
for _, size in ipairs(sizes) do
|
||||||
|
surface.CreateFont( "CNR_HUD_" .. size, {
|
||||||
|
font = "Bahnschrift Light",
|
||||||
|
size = ScreenScaleH(size),
|
||||||
|
weight = 0,
|
||||||
|
})
|
||||||
|
surface.CreateFont( "CNR_HUD_" .. size .. "B", {
|
||||||
|
font = "Bahnschrift Bold",
|
||||||
|
size = ScreenScaleH(size),
|
||||||
|
weight = 0,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local special1 = {
|
||||||
|
normal = 12,
|
||||||
|
colon = 5,
|
||||||
|
clean1 = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
local special2 = {
|
||||||
|
normal = 16+4,
|
||||||
|
colon = 0,
|
||||||
|
clean1 = 6,
|
||||||
|
}
|
||||||
|
|
||||||
|
local baby = Color( 0, 0, 0, 50 )
|
||||||
|
local baby2 = Color( 0, 0, 0, 100 )
|
||||||
|
|
||||||
|
function qt( text, font, x, y, color, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x-1, y-1, baby2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x, y-1, baby2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x+1, y-1, baby2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x-1, y, baby2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x+1, y, baby2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x-1, y+1, baby2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x, y+1, baby2, xalign, yalign )
|
||||||
|
draw.SimpleText( text, font, x+1, y+1, baby2, xalign, yalign )
|
||||||
|
|
||||||
|
draw.SimpleText( text, font, x, y, color, xalign, yalign )
|
||||||
|
end
|
||||||
|
|
||||||
|
local s = function( inp ) return math.Round( inp * ( ScrH() / 480 ) ) end
|
||||||
|
function MonoDraw( text, font, x, y, color, rightalign, special )
|
||||||
|
local bump = 0
|
||||||
|
text = tostring(text)
|
||||||
|
|
||||||
|
if rightalign then
|
||||||
|
local ogbump = 0
|
||||||
|
for i=1, #text do
|
||||||
|
local td = text[i]
|
||||||
|
if td == ":" or td == "," or td == "." then
|
||||||
|
ogbump = ogbump + special.colon
|
||||||
|
else
|
||||||
|
ogbump = ogbump + special.normal
|
||||||
|
end
|
||||||
|
end
|
||||||
|
x = x - s(ogbump)
|
||||||
|
end
|
||||||
|
for i=1, #text do
|
||||||
|
local td = text[i]
|
||||||
|
local clean = 0
|
||||||
|
if td == "1" then
|
||||||
|
clean = special.clean1
|
||||||
|
end
|
||||||
|
draw.SimpleText( td, font, x + s(bump) + s(clean), y, color )
|
||||||
|
if td == ":" or td == "," or td == "." then
|
||||||
|
bump = bump + special.colon
|
||||||
|
else
|
||||||
|
bump = bump + special.normal
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- State Look-up Table
|
||||||
|
local slut = {
|
||||||
|
[0] = "UNINIT",
|
||||||
|
[1] = "WAITING",
|
||||||
|
[2] = "PREGAME",
|
||||||
|
[3] = "TIME",
|
||||||
|
[4] = "POSTGAME",
|
||||||
|
}
|
||||||
|
|
||||||
|
local gamelogic = NULL
|
||||||
|
|
||||||
|
hook.Add("HUDPaint", "CNR_HUD", function()
|
||||||
|
local p, sw, sh = LocalPlayer(), ScrW(), ScrH()
|
||||||
|
local c = sw/2
|
||||||
|
local c1 = sw*0.125
|
||||||
|
local c2 = sw*(1-0.125)
|
||||||
|
local b = s(8)
|
||||||
|
|
||||||
|
local w = p:GetActiveWeapon()
|
||||||
|
w = IsValid(w) and w or false
|
||||||
|
|
||||||
|
if !gamelogic:IsValid() then
|
||||||
|
for i, ent in ents.Iterator() do
|
||||||
|
if ( ent:GetClass() == "cnr_logic" ) then gamelogic = ent print("Located CNR game logic entity") break end
|
||||||
|
end
|
||||||
|
if !gamelogic:IsValid() then
|
||||||
|
print("Couldn't locate CNR game logic entity!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local b_w, b_h = s(64+8), s(64)
|
||||||
|
local b_x, b_y = c1, sh - b_h - s(16)
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
||||||
|
draw.SimpleText( "HP", "CNR_HUD_24", c1 + b, sh - s(64+12), color_black )
|
||||||
|
local dumbfuck = tostring(p:Health()):Left(1) == "1" and s(4) or 0
|
||||||
|
MonoDraw( p:Health(), "CNR_HUD_48B", c1 + b - dumbfuck, sh - s(64), color_black, false, special2 )
|
||||||
|
end
|
||||||
|
|
||||||
|
if w then
|
||||||
|
local b_w, b_h = s(64+8), s(64)
|
||||||
|
local b_x, b_y = c2 - b_w, sh - b_h - s(16)
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
||||||
|
draw.SimpleText( "AMMO", "CNR_HUD_24", c2 - b, sh - s(64+12), color_black, TEXT_ALIGN_RIGHT )
|
||||||
|
MonoDraw( w:Clip1(), "CNR_HUD_48B", c2 - b, sh - s(64), color_black, true, special2 )
|
||||||
|
end
|
||||||
|
|
||||||
|
local state = gamelogic:GetState()
|
||||||
|
do
|
||||||
|
local b_w, b_h = s(64+12), s(42)
|
||||||
|
local b_x, b_y = c1, s(16)
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
||||||
|
draw.SimpleText( slut[ gamelogic:GetState() ], "CNR_HUD_14", b_x + b, b_y + s(4), color_black, TEXT_ALIGN_LEFT )
|
||||||
|
local fuckhead = ""
|
||||||
|
local ltime = LOGIC:GetTimeLeft()
|
||||||
|
if ltime > 60 then
|
||||||
|
fuckhead = string.FormattedTime( LOGIC:GetTimeLeft(), "%02i:%02i")
|
||||||
|
else
|
||||||
|
fuckhead = string.FormattedTime( ltime )
|
||||||
|
fuckhead = string.format( "%02i.%02i", fuckhead.s, fuckhead.ms )
|
||||||
|
end
|
||||||
|
MonoDraw( fuckhead, "CNR_HUD_28B", b_x + b, b_y + s(12), color_black, false, special1 )
|
||||||
|
|
||||||
|
do
|
||||||
|
local n_w, n_h = s(56), s(42)
|
||||||
|
local n_x, n_y = b_x + b + b_w, b_y
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( n_x, n_y, n_w, n_h )
|
||||||
|
draw.SimpleText( "ROUND", "CNR_HUD_14", n_x + b, n_y + s(4), color_black )
|
||||||
|
draw.SimpleText( gamelogic:GetRound() .. "/" .. CONVARS["rounds_max"]:GetInt(), "CNR_HUD_28B", n_x + b, n_y + s(12), color_black )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if state == STATE_INGAME or state == STATE_POSTGAME then
|
||||||
|
local b_w, b_h = s(172), s(30)
|
||||||
|
local b_x, b_y = c1, s(16) + b + s(42)
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( b_x, b_y, b_w, b_h )
|
||||||
|
draw.SimpleText( "$", "CNR_HUD_14", b_x + b, b_y + s(8), color_black, TEXT_ALIGN_LEFT )
|
||||||
|
|
||||||
|
local fuckhead = gamelogic:GetMoney()
|
||||||
|
fuckhead = string.Comma( fuckhead )
|
||||||
|
MonoDraw( fuckhead, "CNR_HUD_28B", b_x + b_w - b, b_y, color_black, true, special1 )
|
||||||
|
end
|
||||||
|
|
||||||
|
if DeathNotices then
|
||||||
|
local b_w, b_h = s(172), s(16)
|
||||||
|
for i, Data in pairs(DeathNotices) do
|
||||||
|
if (Data.Time+3) <= CurTime() then
|
||||||
|
DeathNotices[i] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.sort(DeathNotices, function(a, b)
|
||||||
|
if !a then return true end
|
||||||
|
if !b then return true end
|
||||||
|
|
||||||
|
return (a.Time > b.Time)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local spacing = 0
|
||||||
|
|
||||||
|
for i, Data in ipairs(DeathNotices) do
|
||||||
|
local stupidfuck = math.Clamp( math.TimeFraction( Data.Time, Data.Time+0.25, CurTime()), 0, 1 )
|
||||||
|
local stupidfuck2 = math.Clamp( math.TimeFraction( Data.Time, Data.Time+0.5, CurTime()), 0, 1 )
|
||||||
|
|
||||||
|
if (Data.Time+2.5) <= CurTime() then
|
||||||
|
stupidfuck = 1 - math.Clamp( math.TimeFraction( Data.Time+2.75, Data.Time+3, CurTime()), 0, 1 )
|
||||||
|
stupidfuck2 = 1 - math.Clamp( math.TimeFraction( Data.Time+2.5, Data.Time+3, CurTime()), 0, 1 )
|
||||||
|
end
|
||||||
|
local b_x, b_y = c2 - b_w, s(16) + spacing
|
||||||
|
spacing = spacing + s(4) + (b_h) * stupidfuck
|
||||||
|
|
||||||
|
render.SetScissorRect( b_x, b_y, b_x + (b_w * stupidfuck2), b_y + (b_h * stupidfuck), true )
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( b_x, b_y, b_w * stupidfuck2, b_h * stupidfuck )
|
||||||
|
qt( Data.AttackerName, "CNR_HUD_10", b_x + s(4), b_y + s(3), Data.AttackerColor, TEXT_ALIGN_LEFT )
|
||||||
|
draw.SimpleText( Data.InflictorName, "CNR_HUD_14B", b_x + b_w/2, b_y + s(1), color_black, TEXT_ALIGN_CENTER )
|
||||||
|
qt( Data.VictimName, "CNR_HUD_10", b_x + b_w - s(4), b_y + s(3), Data.VictimColor, TEXT_ALIGN_RIGHT )
|
||||||
|
render.SetScissorRect( 0, 0, 0, 0, false )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Weapon selection
|
||||||
|
do
|
||||||
|
local OrganizedWeapons = {}
|
||||||
|
|
||||||
|
for i, v in ipairs( p:GetWeapons() ) do
|
||||||
|
if !OrganizedWeapons[v:GetSlot()+1] then OrganizedWeapons[v:GetSlot()+1] = {} end
|
||||||
|
local OrgSlot = OrganizedWeapons[v:GetSlot()+1]
|
||||||
|
|
||||||
|
table.insert( OrgSlot, v )
|
||||||
|
end
|
||||||
|
|
||||||
|
local c_w, c_h = s(64), s(24)
|
||||||
|
local booster = 0
|
||||||
|
booster = booster + c_h + s(4)
|
||||||
|
for i, v in ipairs( OrganizedWeapons ) do
|
||||||
|
booster = booster + c_h + s(4)
|
||||||
|
end
|
||||||
|
for SlotNumber, SlotData in ipairs( OrganizedWeapons ) do
|
||||||
|
booster = booster - c_h - s(4)
|
||||||
|
local c_x, c_y = c2 - c_w, sh - s(64+16) - booster
|
||||||
|
for i=#SlotData, 1, -1 do
|
||||||
|
local v = SlotData[i]
|
||||||
|
local eqp = p:GetActiveWeapon() == v
|
||||||
|
surface.SetDrawColor( eqp and color_black or color_white )
|
||||||
|
surface.DrawRect( c_x, c_y, c_w, c_h )
|
||||||
|
|
||||||
|
draw.SimpleText( v:GetPrintName(), "CNR_HUD_10B", c_x + c_w - s(4), c_y + s(10+2), eqp and color_white or color_black, TEXT_ALIGN_RIGHT )
|
||||||
|
c_x = c_x - c_w - s(4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function OW_GetOrganizedWeapons()
|
||||||
|
local p = LocalPlayer()
|
||||||
|
local OrganizedWeapons = {}
|
||||||
|
|
||||||
|
for i, v in ipairs( p:GetWeapons() ) do
|
||||||
|
if !OrganizedWeapons[v:GetSlot()+1] then OrganizedWeapons[v:GetSlot()+1] = {} end
|
||||||
|
local OrgSlot = OrganizedWeapons[v:GetSlot()+1]
|
||||||
|
|
||||||
|
table.insert( OrgSlot, v )
|
||||||
|
end
|
||||||
|
return OrganizedWeapons
|
||||||
|
end
|
||||||
|
|
||||||
|
local function OW_Reorganize()
|
||||||
|
local OW = OW_GetOrganizedWeapons()
|
||||||
|
local NEW = {}
|
||||||
|
|
||||||
|
for SlotNum, SlotData in ipairs(OW) do
|
||||||
|
for WeaponIndex, WeaponEntity in ipairs(SlotData) do
|
||||||
|
table.insert( NEW, WeaponEntity )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return NEW
|
||||||
|
end
|
||||||
|
|
||||||
|
local slottocode = {
|
||||||
|
[1] = "slot1",
|
||||||
|
[2] = "slot2",
|
||||||
|
[3] = "slot3",
|
||||||
|
[4] = "slot4",
|
||||||
|
[5] = "slot5",
|
||||||
|
[6] = "slot6",
|
||||||
|
[7] = "slot7",
|
||||||
|
[8] = "slot8",
|
||||||
|
[9] = "slot9",
|
||||||
|
[0] = "slot0",
|
||||||
|
}
|
||||||
|
|
||||||
|
local codetoslot = table.Flip( slottocode )
|
||||||
|
|
||||||
|
hook.Add("PlayerBindPress", "CNR_PlayerBindPress", function(p, bind, pressed, code)
|
||||||
|
if pressed then
|
||||||
|
if bind == "invnext" or bind == "invprev" then
|
||||||
|
local w = p:GetActiveWeapon()
|
||||||
|
local OW = OW_Reorganize()
|
||||||
|
|
||||||
|
local FlippedOrgSlot = table.Flip( OW )
|
||||||
|
local CurPos = FlippedOrgSlot[ w ]
|
||||||
|
|
||||||
|
local toadvance = CurPos
|
||||||
|
if bind == "invnext" then
|
||||||
|
toadvance = toadvance + 1
|
||||||
|
if toadvance > #OW then
|
||||||
|
toadvance = 1
|
||||||
|
end
|
||||||
|
input.SelectWeapon( OW[toadvance] )
|
||||||
|
elseif bind == "invprev" then
|
||||||
|
toadvance = toadvance - 1
|
||||||
|
if toadvance <= 0 then
|
||||||
|
toadvance = #OW
|
||||||
|
end
|
||||||
|
input.SelectWeapon( OW[toadvance] )
|
||||||
|
end
|
||||||
|
elseif codetoslot[bind] then
|
||||||
|
local w = p:GetActiveWeapon()
|
||||||
|
local ws = w:GetSlot()+1
|
||||||
|
|
||||||
|
local OW = OW_Reorganize()
|
||||||
|
local OW1 = OW_GetOrganizedWeapons()[ ws ]
|
||||||
|
|
||||||
|
local FlippedOrgSlot = table.Flip( OW1 )
|
||||||
|
local toadvance = FlippedOrgSlot[ w ]
|
||||||
|
|
||||||
|
if slottocode[ws] != bind then
|
||||||
|
OW1 = OW_GetOrganizedWeapons()[ codetoslot[bind] ]
|
||||||
|
toadvance = 1
|
||||||
|
else
|
||||||
|
toadvance = toadvance + 1
|
||||||
|
end
|
||||||
|
do
|
||||||
|
if toadvance > #OW1 then
|
||||||
|
toadvance = 1
|
||||||
|
end
|
||||||
|
input.SelectWeapon( OW1[toadvance] )
|
||||||
|
end
|
||||||
|
elseif bind == "lastinv" then
|
||||||
|
local prev = p:GetPreviousWeapon()
|
||||||
|
if prev:IsValid() and prev:IsWeapon() then
|
||||||
|
input.SelectWeapon( prev )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
|
@ -0,0 +1,11 @@
|
||||||
|
include("shared.lua")
|
||||||
|
|
||||||
|
net.Receive("CNR_Logic_Ingame", function()
|
||||||
|
Entity(0):EmitSound( "cnr/events/start.ogg", 0, 100, 0.5, CHAN_STATIC )
|
||||||
|
end)
|
||||||
|
net.Receive("CNR_Logic_Postgame", function()
|
||||||
|
Entity(0):EmitSound( "cnr/events/win.ogg", 0, 100, 0.5, CHAN_STATIC )
|
||||||
|
end)
|
||||||
|
net.Receive("CNR_Logic_Pregame", function()
|
||||||
|
Entity(0):EmitSound( "cnr/events/pregame.ogg", 0, 100, 0.5, CHAN_STATIC )
|
||||||
|
end)
|
|
@ -0,0 +1,95 @@
|
||||||
|
|
||||||
|
function GM:ShowTeam()
|
||||||
|
if IsValid( teampanel ) then teampanel:Remove() return end
|
||||||
|
local s = ScreenScaleH
|
||||||
|
teampanel = vgui.Create( "DFrame" )
|
||||||
|
teampanel:SetSize( s(320), s(240) )
|
||||||
|
teampanel:Center()
|
||||||
|
teampanel:MakePopup()
|
||||||
|
|
||||||
|
function teampanel:Paint( w, h )
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( 0, 0, w, h )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- the ids are undefined pretty early and whatever
|
||||||
|
local teams = {
|
||||||
|
{
|
||||||
|
Name = "Side A",
|
||||||
|
ID = TEAM_SIDEA,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "Side B",
|
||||||
|
ID = TEAM_SIDEB,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "Spectate",
|
||||||
|
ID = TEAM_SPECTATOR,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "Auto-Select",
|
||||||
|
ID = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, v in ipairs( teams ) do
|
||||||
|
local button = teampanel:Add( "DButton" )
|
||||||
|
button:SetSize( s(320), s(48) )
|
||||||
|
button:DockMargin( 0, s(2), 0, 0 )
|
||||||
|
button:Dock( TOP )
|
||||||
|
|
||||||
|
function button:Paint( w, h )
|
||||||
|
surface.SetDrawColor( color_white )
|
||||||
|
surface.DrawRect( 0, 0, w, h )
|
||||||
|
surface.SetDrawColor( color_black )
|
||||||
|
surface.DrawOutlinedRect( 0, 0, w, h, s(1) )
|
||||||
|
|
||||||
|
draw.SimpleText( v.Name, "CNR_HUD_18", s(4), s(4), color_black )
|
||||||
|
|
||||||
|
local plys = team.GetPlayers( v.ID )
|
||||||
|
local mew = { [1] = {} }
|
||||||
|
local curr = 1
|
||||||
|
|
||||||
|
for _, v in ipairs( plys ) do
|
||||||
|
local concat = ""
|
||||||
|
local nick = v:Nick()
|
||||||
|
if #nick > 8 then
|
||||||
|
nick = nick:Left(8) .. ".."
|
||||||
|
end
|
||||||
|
concat = concat .. nick
|
||||||
|
--if i!= #plys then
|
||||||
|
-- concat = concat .. ", "
|
||||||
|
--end
|
||||||
|
if #mew[curr] > 5 then
|
||||||
|
curr = curr + 1
|
||||||
|
end
|
||||||
|
if !mew[curr] then
|
||||||
|
mew[curr] = {}
|
||||||
|
end
|
||||||
|
table.insert( mew[curr], concat )
|
||||||
|
end
|
||||||
|
|
||||||
|
local bump = 0
|
||||||
|
for _, row in ipairs( mew ) do
|
||||||
|
bump = 0
|
||||||
|
for i, v in ipairs( row ) do
|
||||||
|
local tada = v .. ((i!=#row) and ", " or "")
|
||||||
|
draw.SimpleText( tada, "CNR_HUD_10", s(4)+bump, s(4+16 + s((_-1)*4)), color_black )
|
||||||
|
surface.SetFont( "CNR_HUD_10" )
|
||||||
|
bump = bump + surface.GetTextSize( tada )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function button:DoClick()
|
||||||
|
if v.ID == true then
|
||||||
|
RunConsoleCommand( "changeteam", team.BestAutoJoinTeam() )
|
||||||
|
else
|
||||||
|
RunConsoleCommand( "changeteam", v.ID )
|
||||||
|
end
|
||||||
|
teampanel:Remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
AddCSLuaFile("cl_init.lua")
|
||||||
|
AddCSLuaFile("shared.lua")
|
||||||
|
include ("shared.lua")
|
|
@ -0,0 +1,168 @@
|
||||||
|
|
||||||
|
CONVARS = {}
|
||||||
|
|
||||||
|
CONVARS["friendlyfire"] = CreateConVar( "cnr_friendlyfire", 0, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Whether shooting friendlies hurts them", 0, 1 )
|
||||||
|
CONVARS["time_round"] = CreateConVar( "cnr_time_round", 3*60, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Length of a round in seconds" )
|
||||||
|
CONVARS["time_haste"] = CreateConVar( "cnr_time_haste", 1*60, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Time before the round ends to enable haste mode in seconds" )
|
||||||
|
CONVARS["time_pregame"] = CreateConVar( "cnr_time_pregame", 5, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Time before the round starts in seconds" )
|
||||||
|
CONVARS["time_postgame"] = CreateConVar( "cnr_time_postgame", 5, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Time before the round restarts in seconds" )
|
||||||
|
CONVARS["rounds_swap"] = CreateConVar( "cnr_rounds_swap", 2, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Rounds before teams swap" )
|
||||||
|
CONVARS["rounds_max"] = CreateConVar( "cnr_rounds_max", 6, FCVAR_ARCHIVE + FCVAR_REPLICATED, "Maximum rounds before match finishes", 1 )
|
||||||
|
|
||||||
|
STATE_UNINITIALIZED = 0
|
||||||
|
STATE_WAITINGFORPLAYERS = 1
|
||||||
|
STATE_PREGAME = 2
|
||||||
|
STATE_INGAME = 3
|
||||||
|
STATE_POSTGAME = 4
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
util.AddNetworkString("CNR_Logic_Ingame")
|
||||||
|
util.AddNetworkString("CNR_Logic_Postgame")
|
||||||
|
util.AddNetworkString("CNR_Logic_Pregame")
|
||||||
|
gamelogic = NULL
|
||||||
|
hook.Add( "Think", "CNR_GameLogic", function()
|
||||||
|
if !gamelogic:IsValid() then
|
||||||
|
for i, ent in ents.Iterator() do
|
||||||
|
if ( ent:GetClass() == "cnr_logic" ) then gamelogic = ent print("Located CNR game logic entity") break end
|
||||||
|
end
|
||||||
|
if !gamelogic:IsValid() then
|
||||||
|
gamelogic = ents.Create( "cnr_logic" )
|
||||||
|
assert( gamelogic:IsValid(), "Failed to create CNR game logic entity." )
|
||||||
|
gamelogic:Spawn()
|
||||||
|
print("Created CNR game logic entity")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local state = gamelogic:GetState()
|
||||||
|
if state == STATE_UNINITIALIZED then
|
||||||
|
-- Initialize
|
||||||
|
state = STATE_WAITINGFORPLAYERS
|
||||||
|
end
|
||||||
|
|
||||||
|
local willingplayers = #player.GetAll()
|
||||||
|
if state == STATE_WAITINGFORPLAYERS then
|
||||||
|
if willingplayers >= 2 then
|
||||||
|
-- Begin pregame
|
||||||
|
state = STATE_PREGAME
|
||||||
|
gamelogic:SetPregameStartedAt( RealTime() )
|
||||||
|
net.Start( "CNR_Logic_Pregame" )
|
||||||
|
net.Broadcast()
|
||||||
|
|
||||||
|
-- Begin preparations for a new round
|
||||||
|
gamelogic:SetMoney( 0 )
|
||||||
|
|
||||||
|
-- Swap teams
|
||||||
|
if CONVARS["rounds_swap"]:GetBool() and gamelogic:GetRound() > (gamelogic:GetSwappedAtRound()-1)+CONVARS["rounds_swap"]:GetInt() then
|
||||||
|
gamelogic:SetTeamSwap( !gamelogic:GetTeamSwap() )
|
||||||
|
gamelogic:SetSwappedAtRound( gamelogic:GetRound() )
|
||||||
|
end
|
||||||
|
|
||||||
|
LOGIC:SetSpawnpoints()
|
||||||
|
|
||||||
|
for i, v in player.Iterator() do
|
||||||
|
v:Spawn()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if state == STATE_PREGAME then
|
||||||
|
if willingplayers < 2 then
|
||||||
|
-- Cancel pregame
|
||||||
|
state = STATE_WAITINGFORPLAYERS
|
||||||
|
gamelogic:SetPregameStartedAt( 0 )
|
||||||
|
elseif (gamelogic:GetPregameStartedAt() + CONVARS["time_pregame"]:GetInt()) <= RealTime() then
|
||||||
|
-- Begin round
|
||||||
|
state = STATE_INGAME
|
||||||
|
gamelogic:SetRoundStartedAt( RealTime() )
|
||||||
|
net.Start( "CNR_Logic_Ingame" )
|
||||||
|
net.Broadcast()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if state == STATE_INGAME then
|
||||||
|
gamelogic:SetMoney( gamelogic:GetMoney() + 1000 )
|
||||||
|
if (gamelogic:GetRoundStartedAt() + CONVARS["time_round"]:GetInt()) <= RealTime() then
|
||||||
|
state = STATE_POSTGAME
|
||||||
|
gamelogic:SetRoundFinishedAt( RealTime() )
|
||||||
|
net.Start( "CNR_Logic_Postgame" )
|
||||||
|
net.Broadcast()
|
||||||
|
gamelogic:SetRound( gamelogic:GetRound() + 1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if state == STATE_POSTGAME then
|
||||||
|
if (gamelogic:GetRoundFinishedAt() + CONVARS["time_postgame"]:GetInt()) <= RealTime() then
|
||||||
|
state = STATE_PREGAME
|
||||||
|
gamelogic:SetPregameStartedAt( RealTime() )
|
||||||
|
net.Start( "CNR_Logic_Pregame" )
|
||||||
|
net.Broadcast()
|
||||||
|
|
||||||
|
-- Begin preparations for a new round
|
||||||
|
gamelogic:SetMoney( 0 )
|
||||||
|
|
||||||
|
-- Swap teams
|
||||||
|
if CONVARS["rounds_swap"]:GetBool() and gamelogic:GetRound() > (gamelogic:GetSwappedAtRound()-1)+CONVARS["rounds_swap"]:GetInt() then
|
||||||
|
gamelogic:SetTeamSwap( !gamelogic:GetTeamSwap() )
|
||||||
|
gamelogic:SetSwappedAtRound( gamelogic:GetRound() )
|
||||||
|
end
|
||||||
|
|
||||||
|
LOGIC:SetSpawnpoints()
|
||||||
|
|
||||||
|
for i, v in player.Iterator() do
|
||||||
|
v:Spawn()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
gamelogic:SetState( state )
|
||||||
|
end )
|
||||||
|
end
|
||||||
|
|
||||||
|
LOGIC = {}
|
||||||
|
|
||||||
|
function LOGIC:GetLogic()
|
||||||
|
for i, ent in ents.Iterator() do
|
||||||
|
if ( ent:GetClass() == "cnr_logic" ) and ent.GetState then return ent end
|
||||||
|
end
|
||||||
|
if SERVER then
|
||||||
|
gamelogic = ents.Create( "cnr_logic" )
|
||||||
|
assert( gamelogic:IsValid(), "Failed to create CNR game logic entity." )
|
||||||
|
gamelogic:Spawn()
|
||||||
|
print("Created CNR game logic entity")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function LOGIC:GetTimeLeft()
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
|
||||||
|
if gamelogic:GetState() == STATE_PREGAME then
|
||||||
|
local time = CONVARS["time_pregame"]:GetInt()
|
||||||
|
return ( gamelogic:GetPregameStartedAt() + time ) - RealTime(), time
|
||||||
|
elseif gamelogic:GetState() == STATE_INGAME then
|
||||||
|
local time = CONVARS["time_round"]:GetInt()
|
||||||
|
return ( gamelogic:GetRoundStartedAt() + time ) - RealTime(), time
|
||||||
|
elseif gamelogic:GetState() == STATE_POSTGAME then
|
||||||
|
local time = CONVARS["time_postgame"]:GetInt()
|
||||||
|
return ( gamelogic:GetRoundFinishedAt() + time ) - RealTime(), time
|
||||||
|
else
|
||||||
|
return 0, 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function LOGIC:Switcheroo( teamid )
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
local flipped = gamelogic:GetTeamSwap()
|
||||||
|
|
||||||
|
if teamid == TEAM_SIDEA then
|
||||||
|
return (flipped and TEAM_SIDEB or TEAM_SIDEA)
|
||||||
|
else
|
||||||
|
return (flipped and TEAM_SIDEA or TEAM_SIDEB)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function LOGIC:SetSpawnpoints()
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
local flipped = gamelogic:GetTeamSwap()
|
||||||
|
team.SetSpawnPoint( flipped and TEAM_SIDEB or TEAM_SIDEA, "info_player_counterterrorist" )
|
||||||
|
team.SetSpawnPoint( flipped and TEAM_SIDEA or TEAM_SIDEB, "info_player_terrorist" )
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
AddCSLuaFile()
|
||||||
|
|
||||||
|
local PLAYER = {}
|
||||||
|
|
||||||
|
PLAYER.DisplayName = "CNR Player Class"
|
||||||
|
|
||||||
|
PLAYER.SlowWalkSpeed = 200
|
||||||
|
PLAYER.WalkSpeed = 250
|
||||||
|
PLAYER.RunSpeed = 280
|
||||||
|
PLAYER.CrouchedWalkSpeed = 0.3
|
||||||
|
PLAYER.DuckSpeed = 0.3
|
||||||
|
PLAYER.UnDuckSpeed = 0.3
|
||||||
|
PLAYER.JumpPower = 200
|
||||||
|
PLAYER.CanUseFlashlight = true
|
||||||
|
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_cnr", PLAYER, "player_default" )
|
|
@ -0,0 +1,267 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function GM:OnDamagedByExplosion( ply, dmginfo )
|
||||||
|
-- ply:SetDSP( 35, false )
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
function GM:PlayerCanJoinTeam( ply, teamid )
|
||||||
|
if ( ply:Team() == teamid ) then
|
||||||
|
ply:ChatPrint( "You're already on that team" )
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Write this so at the end of a round you can shittalk
|
||||||
|
local sv_alltalk = GetConVar( "sv_alltalk" )
|
||||||
|
function GM:PlayerCanHearPlayersVoice( pListener, pTalker )
|
||||||
|
local alltalk = sv_alltalk:GetInt()
|
||||||
|
if ( alltalk >= 1 ) then return true, alltalk == 2 end
|
||||||
|
|
||||||
|
return pListener:Team() == pTalker:Team(), false
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:PlayerShouldTaunt( ply, actid )
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
function GM:AllowPlayerPickup( ply, object )
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
function GM:PlayerDeathSound()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
function GM:PlayerDeathThink( pl )
|
||||||
|
if ( pl.NextSpawnTime && pl.NextSpawnTime > CurTime() ) then return end
|
||||||
|
pl:Spawn()
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:CreateTeams()
|
||||||
|
|
||||||
|
TEAM_SIDEA = 1
|
||||||
|
team.SetUp( TEAM_SIDEA, "Side A", Color( 100, 100, 255 ) )
|
||||||
|
team.SetSpawnPoint( TEAM_SIDEA, "info_player_counterterrorist" )
|
||||||
|
|
||||||
|
TEAM_SIDEB = 2
|
||||||
|
team.SetUp( TEAM_SIDEB, "Side B", Color( 255, 100, 100 ) )
|
||||||
|
team.SetSpawnPoint( TEAM_SIDEB, "info_player_terrorist" )
|
||||||
|
|
||||||
|
team.SetSpawnPoint( TEAM_SPECTATOR, "worldspawn" )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("PostEntityTakeDamage", "CNR_DamageSound", function( ent, dmginfo, took )
|
||||||
|
if took and ent:IsPlayer() then
|
||||||
|
ent:EmitSound( "cnr/impact/flesh-0" .. math.random(1,8) .. ".ogg", 70, 100, 1, CHAN_BODY )
|
||||||
|
|
||||||
|
local at = dmginfo:GetAttacker()
|
||||||
|
if at:IsValid() and at:IsPlayer() then
|
||||||
|
local rf = RecipientFilter()
|
||||||
|
rf:AddPlayer(at)
|
||||||
|
at:EmitSound( "cnr/impact/confirm-0" .. math.random(1,7) .. ".ogg", 0, 100, 0.5, CHAN_STATIC, nil, nil, rf )
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if CLIENT then
|
||||||
|
hook.Add("CalcView", "CNR_CalcView", function( ply, pos, angles, fov )
|
||||||
|
local rge = ply:GetRagdollEntity()
|
||||||
|
if rge:IsValid() then
|
||||||
|
local he = rge:GetAttachment(rge:LookupAttachment("eyes"))
|
||||||
|
local view = {
|
||||||
|
origin = he.Pos,
|
||||||
|
angles = he.Ang,
|
||||||
|
fov = fov,
|
||||||
|
drawviewer = false
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:ScalePlayerDamage( ply, hitgroup, dmginfo )
|
||||||
|
-- More damage if we're shot in the head
|
||||||
|
if ( hitgroup == HITGROUP_HEAD ) then
|
||||||
|
dmginfo:ScaleDamage( 3 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:PlayerInitialSpawn( pl, transition )
|
||||||
|
if pl:IsBot() then
|
||||||
|
pl:SetTeam( team.BestAutoJoinTeam() )
|
||||||
|
else
|
||||||
|
pl:SetTeam( TEAM_UNASSIGNED )
|
||||||
|
pl:ConCommand( "gm_showteam" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function GM:PlayerSpawnAsSpectator( pl )
|
||||||
|
pl:StripWeapons()
|
||||||
|
if ( pl:Team() == TEAM_UNASSIGNED ) then
|
||||||
|
pl:Spectate( OBS_MODE_FIXED )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pl:SetTeam( TEAM_SPECTATOR )
|
||||||
|
pl:Spectate( OBS_MODE_ROAMING )
|
||||||
|
end
|
||||||
|
function GM:PlayerSelectSpawn( pl, transition )
|
||||||
|
local ent = self:PlayerSelectTeamSpawn( pl:Team(), pl )
|
||||||
|
if ( IsValid( ent ) ) then return ent end
|
||||||
|
end
|
||||||
|
function GM:PlayerSelectTeamSpawn( TeamID, pl )
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
local SpawnPoints = team.GetSpawnPoints( LOGIC:Switcheroo( TeamID ) )
|
||||||
|
if ( !SpawnPoints || table.IsEmpty( SpawnPoints ) ) then return end
|
||||||
|
local ChosenSpawnPoint = nil
|
||||||
|
for i = 0, 6 do
|
||||||
|
ChosenSpawnPoint = table.Random( SpawnPoints )
|
||||||
|
if ( hook.Call( "IsSpawnpointSuitable", GAMEMODE, pl, ChosenSpawnPoint, i == 6 ) ) then
|
||||||
|
return ChosenSpawnPoint
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ChosenSpawnPoint
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:PlayerSpawn( p, transition )
|
||||||
|
player_manager.SetPlayerClass( p, "player_cnr" )
|
||||||
|
|
||||||
|
if ( self.TeamBased and ( p:Team() == TEAM_SPECTATOR or p:Team() == TEAM_UNASSIGNED ) ) then
|
||||||
|
self:PlayerSpawnAsSpectator( p )
|
||||||
|
return
|
||||||
|
end
|
||||||
|
p:UnSpectate()
|
||||||
|
|
||||||
|
p:SetSlowWalkSpeed( 190 )
|
||||||
|
p:SetWalkSpeed( 320 )
|
||||||
|
p:SetRunSpeed( 320 )
|
||||||
|
|
||||||
|
if ( !transition ) then
|
||||||
|
GAMEMODE:PlayerLoadout( p )
|
||||||
|
end
|
||||||
|
|
||||||
|
GAMEMODE:PlayerSetModel( p )
|
||||||
|
|
||||||
|
p:SetupHands()
|
||||||
|
end
|
||||||
|
|
||||||
|
local PT = FindMetaTable("Player")
|
||||||
|
|
||||||
|
function PT:IsCop()
|
||||||
|
return self:Team() == LOGIC:Switcheroo( TEAM_SIDEA )
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:PlayerLoadout( p )
|
||||||
|
p:StripWeapons()
|
||||||
|
|
||||||
|
if p:IsCop() then
|
||||||
|
p:Give("cnr_m4a1")
|
||||||
|
p:Give("cnr_usp")
|
||||||
|
else
|
||||||
|
p:Give("cnr_ak47")
|
||||||
|
p:Give("cnr_glock")
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:PlayerSetModel( p )
|
||||||
|
if p:IsCop() then
|
||||||
|
p:SetModel( "models/player/combine_soldier.mdl" )
|
||||||
|
else
|
||||||
|
p:SetModel( "models/player/group03/male_07.mdl" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
hook.Add( "StartCommand", "CNR_StartCommand", function( ply, cmd )
|
||||||
|
if ( ply:IsBot() ) then
|
||||||
|
local wpn = ply:GetActiveWeapon()
|
||||||
|
if wpn:IsValid() and wpn:Clip1() == 0 then
|
||||||
|
cmd:AddKey(IN_RELOAD)
|
||||||
|
cmd:RemoveKey(IN_ATTACK)
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if ( !ply:Alive() ) then return end
|
||||||
|
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
if IsValid( gamelogic ) and gamelogic:GetState() == STATE_PREGAME then
|
||||||
|
cmd:ClearMovement()
|
||||||
|
cmd:ClearButtons()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.Add( "Move", "CNR_Move", function( ply, mv )
|
||||||
|
local gamelogic = LOGIC:GetLogic()
|
||||||
|
if IsValid( gamelogic ) and gamelogic:GetState() == STATE_PREGAME then
|
||||||
|
mv:SetMaxClientSpeed( 0 )
|
||||||
|
mv:SetMaxSpeed( 0 )
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
util.AddNetworkString( "CNR_Kill" )
|
||||||
|
|
||||||
|
function GM:DoPlayerDeath( ply, attacker, dmginfo )
|
||||||
|
ply:CreateRagdoll()
|
||||||
|
ply:AddDeaths( 1 )
|
||||||
|
if ( attacker:IsValid() && attacker:IsPlayer() ) then
|
||||||
|
if ( attacker == ply ) then
|
||||||
|
attacker:AddFrags( -1 )
|
||||||
|
else
|
||||||
|
attacker:AddFrags( 1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
net.Start( "CNR_Kill" )
|
||||||
|
net.WriteEntity( ply )
|
||||||
|
net.WriteEntity( attacker )
|
||||||
|
net.WriteEntity( dmginfo:GetInflictor() )
|
||||||
|
net.Broadcast()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
hook.Add("DrawDeathNotice", "CNR_DrawDeathNotice", function()
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
net.Receive( "CNR_Kill", function()
|
||||||
|
local victim = net.ReadEntity()
|
||||||
|
local attacker = net.ReadEntity()
|
||||||
|
local inflictor = net.ReadEntity()
|
||||||
|
|
||||||
|
local name_victim = "???"
|
||||||
|
local name_attacker = "???"
|
||||||
|
local name_inflictor = "???"
|
||||||
|
local color_victim = color_white
|
||||||
|
local color_attacker = color_white
|
||||||
|
if IsValid(victim) then
|
||||||
|
name_victim = victim:Nick()
|
||||||
|
color_victim = team.GetColor(victim:Team())
|
||||||
|
end
|
||||||
|
if IsValid(attacker) then
|
||||||
|
name_attacker = attacker:Nick()
|
||||||
|
color_attacker = team.GetColor(attacker:Team())
|
||||||
|
end
|
||||||
|
if IsValid(inflictor) then
|
||||||
|
if inflictor.GetPrintName then
|
||||||
|
name_inflictor = inflictor:GetPrintName()
|
||||||
|
else
|
||||||
|
name_inflictor = inflictor:GetClass()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !DeathNotices then DeathNotices = {} end
|
||||||
|
table.insert( DeathNotices, {
|
||||||
|
Time = CurTime(),
|
||||||
|
VictimEnt = victim,
|
||||||
|
VictimName = name_victim,
|
||||||
|
VictimColor = color_victim,
|
||||||
|
AttackerEnt = attacker,
|
||||||
|
AttackerName = name_attacker,
|
||||||
|
AttackerColor = color_attacker,
|
||||||
|
InflictorEnt = inflictor,
|
||||||
|
InflictorName = name_inflictor
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
GM.Name = "Cops 'n Robbers"
|
||||||
|
GM.Author = "Fesiug"
|
||||||
|
GM.Email = "publicfesiug@outlook.com"
|
||||||
|
GM.Website = "https://github.com/Fesiug/copsnrobbers"
|
||||||
|
GM.TeamBased = true
|
||||||
|
|
||||||
|
AddCSLuaFile("player_class_cnr.lua")
|
||||||
|
include ("player_class_cnr.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("logic.lua")
|
||||||
|
include ("logic.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("playerbs.lua")
|
||||||
|
include ("playerbs.lua")
|
||||||
|
|
||||||
|
AddCSLuaFile("cl_hud.lua")
|
||||||
|
AddCSLuaFile("cl_selectteam.lua")
|
||||||
|
if CLIENT then
|
||||||
|
include ("cl_hud.lua")
|
||||||
|
include ("cl_selectteam.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
function GM:Initialize()
|
||||||
|
-- Do stuff
|
||||||
|
end
|
||||||
|
|
||||||
|
concommand.Add( "cnr_cheat_weapons", function( p )
|
||||||
|
p:Give( "cnr_ak47" )
|
||||||
|
p:Give( "cnr_deagle" )
|
||||||
|
p:Give( "cnr_glock" )
|
||||||
|
p:Give( "cnr_m4a1" )
|
||||||
|
p:Give( "cnr_m4s90" )
|
||||||
|
p:Give( "cnr_m249" )
|
||||||
|
p:Give( "cnr_mac10" )
|
||||||
|
p:Give( "cnr_mossberg" )
|
||||||
|
p:Give( "cnr_mp5" )
|
||||||
|
p:Give( "cnr_uzi" )
|
||||||
|
p:Give( "cnr_p220" )
|
||||||
|
p:Give( "cnr_usp" )
|
||||||
|
end)
|
||||||
|
|
||||||
|
if SERVER then
|
||||||
|
function GM:ShowTeam( ply )
|
||||||
|
ply:SendLua( "GAMEMODE:ShowTeam()" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Include module loader here
|
Binary file not shown.
After Width: | Height: | Size: 824 B |
|
@ -0,0 +1,4 @@
|
||||||
|
VertexLitGeneric
|
||||||
|
{
|
||||||
|
$color2 "[0.5 0.5 0.5]"
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
VertexLitGeneric
|
||||||
|
{
|
||||||
|
$basetexture "cnr/weapons/m4a1/v_m4a1_main"
|
||||||
|
$bumpmap "cnr/weapons/m4a1/v_m4a1_main_normal"
|
||||||
|
$phongexponenttexture "cnr/weapons/m4a1/v_m4a1_main_exponent"
|
||||||
|
$envmap env_cubemap
|
||||||
|
$nocull 1
|
||||||
|
$normalmapalphaenvmapmask 1
|
||||||
|
$envmaptint "[0.01 0.01 0.01]"
|
||||||
|
|
||||||
|
$phong 1
|
||||||
|
$phongboost 1
|
||||||
|
$phongtint "[1 1 1]"
|
||||||
|
$phongfresnelranges "[1 4 7]"
|
||||||
|
$phongalbedotint 1
|
||||||
|
$halflambert 1
|
||||||
|
$color2 "[2 2 2]"
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue