Overhaul a ton of stuff

This commit is contained in:
Fesiug 2024-07-18 17:27:46 -04:00
parent bde7e22f50
commit 146ff65133
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
44 changed files with 496 additions and 81 deletions

10
.gitattributes vendored Normal file
View File

@ -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

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.dx80.vtx
*.sw.vtx

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.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-01.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-02.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-03.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-04.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-05.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-06.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-07.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemodes/copsnrobbers/content/sound/cnr/impact/flesh-08.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -10,8 +10,8 @@ function SWEP:GetViewModelPosition( pos, ang )
newpos:Add( ang:Forward() * self.ActivePos.y )
newpos:Add( ang:Up() * self.ActivePos.z )
newpos:Add( ang:Right() * 2 * math.sin( CurTime() * math.pi * 2 ) * speed )
newpos:Add( ang:Up() * -0.5 * math.abs( math.sin( CurTime() * math.pi * 2 ) ) * speed )
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

View File

@ -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

View File

@ -19,10 +19,9 @@ function SWEP:Reload()
self:SetDelayReload( CurTime() + 0.1 )
self:SetShotgunReloading( 1 )
else
self:SendWeaponAnim( ACT_VM_RELOAD )
self:GetOwner():GetViewModel():SetPlaybackRate( 2.5 )
self:SetDelayReload( CurTime() + self:SequenceDuration()/2.5 )
self:SetRefillTime( CurTime() + self:SequenceDuration()/2.5 )
self:SendAnim( "reload" )
--self:SetDelayReload( CurTime() + animtime*0.9 )
--self:SetRefillTime( CurTime() + animtime*0.5 )
end
return true
end

View File

@ -13,7 +13,7 @@ function SWEP:PrimaryAttack( mine )
return false
end
if self:Clip1() == 0 then
self:EmitSound( "weapons/clipempty_rifle.wav", 90, 100, 1, CHAN_STATIC )
self:EmitSound( "weapons/clipempty_rifle.wav", 60, 100, 1, CHAN_STATIC )
self:SetDelay( CurTime() + self.Delay )
return false
end
@ -24,11 +24,11 @@ function SWEP:PrimaryAttack( mine )
self:SetDelay( CurTime() + self.Delay )
self:SetBurstCount( self:GetBurstCount() + 1 )
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
self:SendAnim( "fire" )
self:SetClip1( self:Clip1() - 1 )
self:EmitSound( self.Sound_Fire[ math.random( 1, #self.Sound_Fire ) ], 90, 100, 1, CHAN_STATIC )
self:EmitSound( self.Sound_Mech[ math.random( 1, #self.Sound_Mech ) ], 90, 100, 0.125, 255+2 )
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()

View File

@ -51,16 +51,12 @@ function SWEP:Think()
if self:GetShotgunReloading() == 1 then
if p:KeyDown( IN_ATTACK ) or (self:GetDelayReload() <= CurTime() and self:Clip1() == self.Primary.ClipSize) then
self:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
self:GetOwner():GetViewModel():SetPlaybackRate( 2.5 )
self:SendAnim( "reload_start" )
self:SetRefillTime( -1 )
self:SetShotgunReloading( 0 )
else
if self:GetDelayReload() <= CurTime() then
self:SendWeaponAnim( ACT_VM_RELOAD )
self:GetOwner():GetViewModel():SetPlaybackRate( 2.5 )
self:SetDelayReload( CurTime() + 0.2 )
self:SetRefillTime( CurTime() + 0.1 )
self:SendAnim( "reload" )
end
end
end

View File

@ -25,7 +25,7 @@ SWEP.Sound_Mech = {
SWEP.Delay = ( 60 / 900 )
SWEP.MaxBurst = math.huge
SWEP.ActivePos = Vector( 2, -2, -2 )
SWEP.ActivePos = vector_origin--Vector( 2, -2, -2 )
SWEP.BubbleSpreadUp = 0.8
SWEP.BubbleRecoilUp = 0.8
@ -59,6 +59,9 @@ AddCSLuaFile("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")
@ -85,7 +88,7 @@ SWEP.m_WeaponDeploySpeed = 10
SWEP.BobScale = 0
SWEP.SwayScale = 0
function SWEP:Deploy()
self:SendWeaponAnim( ACT_VM_IDLE )
self:SendAnim( "draw" )
return true
end
function SWEP:Holster()

View File

@ -32,3 +32,6 @@ SWEP.RecoilUp = 55
SWEP.RecoilSpeed = 90
SWEP.RecoilDistStart = 1
SWEP.RecoilDistEnd = 10
-- Model source:
-- https://gamebanana.com/mods/209669

View File

@ -31,5 +31,5 @@ SWEP.SpreadEnd = 15
SWEP.RecoilUp = 33
SWEP.RecoilSpeed = 30/0.1
SWEP.RecoilDistStart = 30
SWEP.RecoilDistEnd = 30
SWEP.RecoilDistStart = 20
SWEP.RecoilDistEnd = 20

View File

@ -33,3 +33,6 @@ SWEP.RecoilUp = 45
SWEP.RecoilSpeed = 40
SWEP.RecoilDistStart = 2
SWEP.RecoilDistEnd = 5
-- Model source:
-- https://gamebanana.com/mods/206952

View File

@ -4,10 +4,10 @@ SWEP.Base = "cnr"
SWEP.PrintName = "N4A4"
SWEP.Slot = 0
SWEP.ViewModel = "models/weapons/cstrike/c_rif_m4a1.mdl"
SWEP.ViewModelFOV = 90
SWEP.ViewModel = "models/cnr/m4a1_view.mdl"
SWEP.ViewModelFOV = 74
SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl"
SWEP.ActivePos = Vector( 0, -2, -2 )
SWEP.ActivePos = vector_origin
SWEP.Sound_Fire = {
"cnr/weapons/m4a1/fire-01.ogg",
@ -19,3 +19,26 @@ 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,
},
}

View File

@ -19,3 +19,6 @@ SWEP.Primary.ClipSize = 32
SWEP.Delay = ( 60 / 1600 )
SWEP.DamageClose = 14
SWEP.DamageFar = 10
-- Model source:
-- https://gamebanana.com/mods/209072

View File

@ -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

View File

@ -4,6 +4,7 @@ local hide = {
["CHudBattery"] = true,
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true,
["CHudWeaponSelection"] = true,
}
hook.Add( "HUDShouldDraw", "HideHUD", function( name )
@ -12,39 +13,20 @@ hook.Add( "HUDShouldDraw", "HideHUD", function( name )
end
end )
surface.CreateFont( "CNR_HUD_1", {
font = "Bahnschrift Light",
size = ScreenScaleH(24),
weight = 0,
})
surface.CreateFont( "CNR_HUD_2", {
font = "Bahnschrift Bold",
size = ScreenScaleH(48),
weight = 0,
})
local sizes = { 48, 28, 24, 18, 14, 10 }
surface.CreateFont( "CNR_HUD_3", {
font = "Bahnschrift Light",
size = ScreenScaleH(14),
weight = 0,
})
surface.CreateFont( "CNR_HUD_4", {
font = "Bahnschrift Bold",
size = ScreenScaleH(28),
weight = 0,
})
surface.CreateFont( "CNR_SEL_1", {
font = "Bahnschrift Light",
size = ScreenScaleH(18),
weight = 0,
})
surface.CreateFont( "CNR_SEL_2", {
font = "Bahnschrift Light",
size = ScreenScaleH(10),
weight = 0,
})
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,
@ -58,8 +40,26 @@ local special2 = {
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 s = ScreenScaleH
local bump = 0
text = tostring(text)
@ -104,7 +104,6 @@ local gamelogic = NULL
hook.Add("HUDPaint", "CNR_HUD", function()
local p, sw, sh = LocalPlayer(), ScrW(), ScrH()
local c = sw/2
local s = ScreenScaleH
local c1 = sw*0.125
local c2 = sw*(1-0.125)
local b = s(8)
@ -112,7 +111,6 @@ hook.Add("HUDPaint", "CNR_HUD", function()
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
@ -127,9 +125,9 @@ hook.Add("HUDPaint", "CNR_HUD", function()
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_1", c1 + b, sh - s(64+12), color_black )
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_2", c1 + b - dumbfuck, sh - s(64), color_black, false, special2 )
MonoDraw( p:Health(), "CNR_HUD_48B", c1 + b - dumbfuck, sh - s(64), color_black, false, special2 )
end
if w then
@ -137,8 +135,8 @@ hook.Add("HUDPaint", "CNR_HUD", function()
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_1", c2 - b, sh - s(64+12), color_black, TEXT_ALIGN_RIGHT )
MonoDraw( w:Clip1(), "CNR_HUD_2", c2 - b, sh - s(64), color_black, true, special2 )
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()
@ -147,7 +145,7 @@ hook.Add("HUDPaint", "CNR_HUD", function()
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_3", b_x + b, b_y + s(4), color_black, TEXT_ALIGN_LEFT )
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
@ -156,15 +154,15 @@ hook.Add("HUDPaint", "CNR_HUD", function()
fuckhead = string.FormattedTime( ltime )
fuckhead = string.format( "%02i.%02i", fuckhead.s, fuckhead.ms )
end
MonoDraw( fuckhead, "CNR_HUD_4", b_x + b, b_y + s(12), color_black, false, special1 )
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_3", n_x + b, n_y + s(4), color_black )
draw.SimpleText( gamelogic:GetRound() .. "/" .. CONVARS["rounds_max"]:GetInt(), "CNR_HUD_4", n_x + b, n_y + s(12), color_black )
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
@ -173,10 +171,175 @@ hook.Add("HUDPaint", "CNR_HUD", function()
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_3", b_x + b, b_y + s(8), color_black, TEXT_ALIGN_LEFT )
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_4", b_x + b_w - b, b_y, color_black, true, special1 )
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)

View File

@ -45,7 +45,7 @@ function GM:ShowTeam()
surface.SetDrawColor( color_black )
surface.DrawOutlinedRect( 0, 0, w, h, s(1) )
draw.SimpleText( v.Name, "CNR_SEL_1", s(4), s(4), color_black )
draw.SimpleText( v.Name, "CNR_HUD_18", s(4), s(4), color_black )
local plys = team.GetPlayers( v.ID )
local mew = { [1] = {} }
@ -75,8 +75,8 @@ function GM:ShowTeam()
bump = 0
for i, v in ipairs( row ) do
local tada = v .. ((i!=#row) and ", " or "")
draw.SimpleText( tada, "CNR_SEL_2", s(4)+bump, s(4+16 + s((_-1)*4)), color_black )
surface.SetFont( "CNR_SEL_2" )
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

View File

@ -3,6 +3,7 @@
function GM:OnDamagedByExplosion( ply, dmginfo )
-- ply:SetDSP( 35, false )
return true
end
function GM:PlayerCanJoinTeam( ply, teamid )
if ( ply:Team() == teamid ) then
@ -39,17 +40,48 @@ end
function GM:CreateTeams()
TEAM_SIDEA = 1
team.SetUp( TEAM_SIDEA, "Side A", Color( 200, 200, 255 ) )
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, 200, 200 ) )
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
@ -144,7 +176,16 @@ end
hook.Add( "StartCommand", "CNR_StartCommand", function( ply, cmd )
if ( ply:IsBot() or !ply:Alive() ) then return end
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
@ -181,8 +222,9 @@ if SERVER then
net.Broadcast()
end
else
local c_attacker = Color( 255, 100, 100 )
local c_victim = Color( 100, 100, 255 )
hook.Add("DrawDeathNotice", "CNR_DrawDeathNotice", function()
return true
end)
net.Receive( "CNR_Kill", function()
local victim = net.ReadEntity()
local attacker = net.ReadEntity()
@ -191,11 +233,15 @@ else
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
@ -205,6 +251,17 @@ else
end
end
chat.AddText( c_attacker, name_attacker, color_white, " [", name_inflictor, "] ", c_victim, name_victim, color_white )
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

View File

@ -35,6 +35,7 @@ concommand.Add( "cnr_cheat_weapons", function( p )
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)

View File

@ -0,0 +1,4 @@
VertexLitGeneric
{
$color2 "[0.5 0.5 0.5]"
}

View File

@ -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]"
}

BIN
materials/cnr/weapons/m4a1/v_m4a1_main.vtf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
materials/cnr/weapons/m4a1/v_m4a1_main_exponent.vtf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
materials/cnr/weapons/m4a1/v_m4a1_main_normal.vtf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
models/cnr/m4a1_view.dx90.vtx (Stored with Git LFS) Normal file

Binary file not shown.

BIN
models/cnr/m4a1_view.mdl (Stored with Git LFS) Normal file

Binary file not shown.

BIN
models/cnr/m4a1_view.vvd (Stored with Git LFS) Normal file

Binary file not shown.

BIN
sound/cnr/weapons/uzi/fire-01.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
sound/cnr/weapons/uzi/fire-02.ogg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
sound/cnr/weapons/uzi/fire-03.ogg (Stored with Git LFS) Normal file

Binary file not shown.