summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--entities/effects/barrel_gib/init.lua19
-rw-r--r--entities/effects/biohazard/init.lua46
-rw-r--r--entities/effects/body_gib/init.lua73
-rw-r--r--entities/effects/bomb_explosion/init.lua66
-rw-r--r--entities/effects/c4_explosion/init.lua80
-rw-r--r--entities/effects/energy_explosion/init.lua34
-rw-r--r--entities/effects/fire_explosion/init.lua34
-rw-r--r--entities/effects/fire_tracer/init.lua50
-rw-r--r--entities/effects/gore_explosion/init.lua64
-rw-r--r--entities/effects/head_gib/init.lua45
-rw-r--r--entities/effects/headshot/init.lua31
-rw-r--r--entities/effects/immolate/init.lua52
-rw-r--r--entities/effects/player_gib/init.lua31
-rw-r--r--entities/effects/puke_explosion/init.lua58
-rw-r--r--entities/effects/puke_spray/init.lua58
-rw-r--r--entities/effects/rad_explosion/init.lua24
-rw-r--r--entities/effects/radiation/init.lua42
-rw-r--r--entities/effects/smoke_crater/init.lua24
-rw-r--r--entities/entities/info_npcspawn/init.lua2
-rw-r--r--entities/entities/npc_nb_common/shared.lua10
-rw-r--r--entities/entities/npc_nb_contagion/shared.lua26
-rw-r--r--entities/entities/npc_nb_leaper/shared.lua84
-rw-r--r--entities/entities/npc_nb_poison/shared.lua46
-rw-r--r--entities/entities/point_evac/cl_init.lua3
-rw-r--r--entities/entities/point_evac/init.lua74
-rw-r--r--entities/entities/point_evac/shared.lua1
-rw-r--r--entities/entities/point_radiation/init.lua44
-rw-r--r--entities/entities/point_stash/cl_init.lua3
-rw-r--r--entities/entities/point_stash/init.lua95
-rw-r--r--entities/entities/point_stash/shared.lua1
-rw-r--r--entities/entities/sent_antidote/cl_init.lua24
-rw-r--r--entities/entities/sent_antidote/init.lua38
-rw-r--r--entities/entities/sent_antidote/shared.lua1
-rw-r--r--entities/entities/sent_barrel_biohazard/cl_init.lua7
-rw-r--r--entities/entities/sent_barrel_biohazard/init.lua65
-rw-r--r--entities/entities/sent_barrel_biohazard/shared.lua2
-rw-r--r--entities/entities/sent_barrel_radioactive/cl_init.lua7
-rw-r--r--entities/entities/sent_barrel_radioactive/init.lua59
-rw-r--r--entities/entities/sent_barrel_radioactive/shared.lua2
-rw-r--r--entities/entities/sent_bonuscrate/cl_init.lua3
-rw-r--r--entities/entities/sent_bonuscrate/init.lua51
-rw-r--r--entities/entities/sent_bonuscrate/shared.lua1
-rw-r--r--entities/entities/sent_c4/cl_init.lua17
-rw-r--r--entities/entities/sent_c4/init.lua61
-rw-r--r--entities/entities/sent_c4/shared.lua2
-rw-r--r--entities/entities/sent_cash/cl_init.lua5
-rw-r--r--entities/entities/sent_cash/init.lua56
-rw-r--r--entities/entities/sent_cash/shared.lua1
-rw-r--r--entities/entities/sent_dropflare/cl_init.lua37
-rw-r--r--entities/entities/sent_dropflare/init.lua41
-rw-r--r--entities/entities/sent_dropflare/shared.lua2
-rw-r--r--entities/entities/sent_droppedgun/cl_init.lua3
-rw-r--r--entities/entities/sent_droppedgun/init.lua28
-rw-r--r--entities/entities/sent_droppedgun/shared.lua1
-rw-r--r--entities/entities/sent_fire/cl_init.lua59
-rw-r--r--entities/entities/sent_fire/init.lua38
-rw-r--r--entities/entities/sent_fire/shared.lua1
-rw-r--r--entities/entities/sent_flare/cl_init.lua49
-rw-r--r--entities/entities/sent_flare/init.lua41
-rw-r--r--entities/entities/sent_flare/shared.lua2
-rw-r--r--entities/entities/sent_fuel_diesel/cl_init.lua7
-rw-r--r--entities/entities/sent_fuel_diesel/init.lua49
-rw-r--r--entities/entities/sent_fuel_diesel/shared.lua2
-rw-r--r--entities/entities/sent_fuel_gas/cl_init.lua7
-rw-r--r--entities/entities/sent_fuel_gas/init.lua49
-rw-r--r--entities/entities/sent_fuel_gas/shared.lua2
-rw-r--r--entities/entities/sent_grenade/cl_init.lua7
-rw-r--r--entities/entities/sent_grenade/init.lua55
-rw-r--r--entities/entities/sent_grenade/shared.lua2
-rw-r--r--entities/entities/sent_grenade_incendiary/cl_init.lua7
-rw-r--r--entities/entities/sent_grenade_incendiary/init.lua55
-rw-r--r--entities/entities/sent_grenade_incendiary/shared.lua2
-rw-r--r--entities/entities/sent_heliflare/cl_init.lua47
-rw-r--r--entities/entities/sent_heliflare/init.lua39
-rw-r--r--entities/entities/sent_heliflare/shared.lua2
-rw-r--r--entities/entities/sent_lootbag/cl_init.lua3
-rw-r--r--entities/entities/sent_lootbag/init.lua67
-rw-r--r--entities/entities/sent_lootbag/shared.lua1
-rw-r--r--entities/entities/sent_oxygen/cl_init.lua7
-rw-r--r--entities/entities/sent_oxygen/init.lua55
-rw-r--r--entities/entities/sent_oxygen/shared.lua2
-rw-r--r--entities/entities/sent_propane_canister/cl_init.lua7
-rw-r--r--entities/entities/sent_propane_canister/init.lua47
-rw-r--r--entities/entities/sent_propane_canister/shared.lua2
-rw-r--r--entities/entities/sent_propane_tank/cl_init.lua7
-rw-r--r--entities/entities/sent_propane_tank/init.lua47
-rw-r--r--entities/entities/sent_propane_tank/shared.lua2
-rw-r--r--entities/entities/sent_radiation/cl_init.lua23
-rw-r--r--entities/entities/sent_radiation/init.lua52
-rw-r--r--entities/entities/sent_radiation/shared.lua1
-rw-r--r--entities/entities/sent_supplycrate/cl_init.lua3
-rw-r--r--entities/entities/sent_supplycrate/init.lua33
-rw-r--r--entities/entities/sent_supplycrate/shared.lua1
-rw-r--r--entities/weapons/rad_ak47/shared.lua6
-rw-r--r--entities/weapons/rad_awp/shared.lua6
-rw-r--r--entities/weapons/rad_base/shared.lua601
-rw-r--r--entities/weapons/rad_berettas/shared.lua42
-rw-r--r--entities/weapons/rad_deagle/shared.lua8
-rw-r--r--entities/weapons/rad_experimental/shared.lua86
-rw-r--r--entities/weapons/rad_famas/shared.lua4
-rw-r--r--entities/weapons/rad_firegun/shared.lua110
-rw-r--r--entities/weapons/rad_fiveseven/shared.lua6
-rw-r--r--entities/weapons/rad_g3/shared.lua34
-rw-r--r--entities/weapons/rad_galil/shared.lua4
-rw-r--r--entities/weapons/rad_glock/shared.lua6
-rw-r--r--entities/weapons/rad_grenade/shared.lua89
-rw-r--r--entities/weapons/rad_incendiarygrenade/shared.lua89
-rw-r--r--entities/weapons/rad_inv/shared.lua410
-rw-r--r--entities/weapons/rad_itemplacer/shared.lua164
-rw-r--r--entities/weapons/rad_m1014/shared.lua196
-rw-r--r--entities/weapons/rad_m249/shared.lua7
-rw-r--r--entities/weapons/rad_mac10/shared.lua6
-rw-r--r--entities/weapons/rad_mp5/shared.lua6
-rw-r--r--entities/weapons/rad_p228/shared.lua6
-rw-r--r--entities/weapons/rad_p90/shared.lua6
-rw-r--r--entities/weapons/rad_revolver/shared.lua36
-rw-r--r--entities/weapons/rad_scout/shared.lua6
-rw-r--r--entities/weapons/rad_sg552/shared.lua82
-rw-r--r--entities/weapons/rad_shotgun/shared.lua206
-rw-r--r--entities/weapons/rad_spas12/shared.lua220
-rw-r--r--entities/weapons/rad_tmp/shared.lua6
-rw-r--r--entities/weapons/rad_ump45/shared.lua6
-rw-r--r--entities/weapons/rad_usp/shared.lua6
-rw-r--r--entities/weapons/rad_z_banshee/shared.lua62
-rw-r--r--entities/weapons/rad_z_base/shared.lua182
-rw-r--r--entities/weapons/rad_z_contagion/shared.lua10
-rw-r--r--entities/weapons/rad_z_leaper/shared.lua36
-rw-r--r--entities/weapons/rad_z_runner/shared.lua8
-rw-r--r--gamemode/animations.lua10
-rw-r--r--gamemode/cl_hudstains.lua56
-rw-r--r--gamemode/cl_init.lua842
-rw-r--r--gamemode/cl_inventory.lua38
-rw-r--r--gamemode/cl_notice.lua79
-rw-r--r--gamemode/cl_postprocess.lua376
-rw-r--r--gamemode/cl_scoreboard.lua240
-rw-r--r--gamemode/cl_spawnmenu.lua309
-rw-r--r--gamemode/cl_targetid.lua92
-rw-r--r--gamemode/default_player.lua4
-rw-r--r--gamemode/enums.lua2
-rw-r--r--gamemode/events.lua1
-rw-r--r--gamemode/events/antidote_shortage.lua28
-rw-r--r--gamemode/events/fallout.lua58
-rw-r--r--gamemode/events/radio_blackout.lua18
-rw-r--r--gamemode/events/radioblackout.lua18
-rw-r--r--gamemode/events/scientist.lua14
-rw-r--r--gamemode/events/supply_crate.lua16
-rw-r--r--gamemode/events/supplycrate.lua16
-rw-r--r--gamemode/events/weather_event.lua10
-rw-r--r--gamemode/init.lua1506
-rw-r--r--gamemode/items.lua64
-rw-r--r--gamemode/items/ammo.lua61
-rw-r--r--gamemode/items/misc.lua326
-rw-r--r--gamemode/items/misc_explosive.lua40
-rw-r--r--gamemode/items/special.lua48
-rw-r--r--gamemode/items/supplies.lua129
-rw-r--r--gamemode/items/weapons_common.lua242
-rw-r--r--gamemode/items/weapons_special.lua56
-rw-r--r--gamemode/map_defaults.lua10
-rw-r--r--gamemode/npcfix.lua2
-rw-r--r--gamemode/player_class/player_army.lua4
-rw-r--r--gamemode/player_class/player_base.lua24
-rw-r--r--gamemode/player_class/player_default.lua24
-rw-r--r--gamemode/player_class/player_zombie.lua34
-rw-r--r--gamemode/resource.lua7
-rw-r--r--gamemode/shared.lua78
-rw-r--r--gamemode/tables.lua36
-rw-r--r--gamemode/vgui/vgui_categorybutton.lua48
-rw-r--r--gamemode/vgui/vgui_classpicker.lua26
-rw-r--r--gamemode/vgui/vgui_dialogue.lua72
-rw-r--r--gamemode/vgui/vgui_endgame.lua186
-rw-r--r--gamemode/vgui/vgui_goodmodelpanel.lua102
-rw-r--r--gamemode/vgui/vgui_helpmenu.lua34
-rw-r--r--gamemode/vgui/vgui_itemdisplay.lua92
-rw-r--r--gamemode/vgui/vgui_itempanel.lua276
-rw-r--r--gamemode/vgui/vgui_panelbase.lua18
-rw-r--r--gamemode/vgui/vgui_panelsheet.lua254
-rw-r--r--gamemode/vgui/vgui_playerdisplay.lua118
-rw-r--r--gamemode/vgui/vgui_playerpanel.lua26
-rw-r--r--gamemode/vgui/vgui_scroller.lua36
-rw-r--r--gamemode/vgui/vgui_shopmenu.lua34
-rw-r--r--gamemode/vgui/vgui_sidebutton.lua40
-rw-r--r--gamemode/vgui/vgui_zombieclasses.lua26
-rw-r--r--gamemode/weather.lua466
183 files changed, 6033 insertions, 6113 deletions
diff --git a/entities/effects/barrel_gib/init.lua b/entities/effects/barrel_gib/init.lua
index f635312..1c2008f 100644
--- a/entities/effects/barrel_gib/init.lua
+++ b/entities/effects/barrel_gib/init.lua
@@ -5,33 +5,33 @@ function EFFECT:Init( data )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
//self.Entity:SetMaterial( "models/flesh" )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) )
self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
local vec = VectorRand()
vec.z = math.Clamp( vec.z, -0.4, 0.8 )
-
+
phys:Wake()
phys:SetMass( 100 )
phys:AddAngleVelocity( VectorRand() * 500 )
phys:SetVelocity( vec * math.Rand( 100, 200 ) )
-
+
end
-
+
self.LifeTime = CurTime() + 15
-
+
end
function EFFECT:Think( )
return self.LifeTime > CurTime()
-
+
end
function EFFECT:Render()
@@ -39,4 +39,3 @@ function EFFECT:Render()
self.Entity:DrawModel()
end
-
diff --git a/entities/effects/biohazard/init.lua b/entities/effects/biohazard/init.lua
index 8af6357..ca80b2d 100644
--- a/entities/effects/biohazard/init.lua
+++ b/entities/effects/biohazard/init.lua
@@ -5,14 +5,14 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
self.SoundTime = 0
-
+
local pos = data:GetOrigin() + Vector(0,0,10)
local emitter = ParticleEmitter( pos )
-
+
self.Pos = pos
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -23,14 +23,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 10 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( vec * 250 )
particle:SetDieTime( math.Rand( 0.8, 1.0 ) )
@@ -41,14 +41,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 )
particle:SetGravity( Vector( 0, 0, -400 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) )
particle:SetVelocity( vec * 300 )
particle:SetLifeTime( 0 )
@@ -59,37 +59,37 @@ function EFFECT:Init( data )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
-
+
particle:SetCollideCallback( function( part, pos, normal )
-
+
util.Decal( "yellowblood", pos + normal, pos - normal )
-
+
end )
-
+
end
emitter:Finish()
-
+
end
function EFFECT:Think()
if self.SoundTime < CurTime() then
-
+
sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) )
-
+
self.SoundTime = CurTime() + 0.5
-
+
end
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/body_gib/init.lua b/entities/effects/body_gib/init.lua
index d433bce..586927e 100644
--- a/entities/effects/body_gib/init.lua
+++ b/entities/effects/body_gib/init.lua
@@ -4,13 +4,13 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
self.SoundTime = CurTime() + math.Rand( 0.2, 1.0 )
-
+
local pos = data:GetOrigin() + Vector(0,0,50)
local emitter = ParticleEmitter( pos )
-
+
self.Pos = pos
self.Normal = data:GetNormal()
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
particle:SetStartAlpha( 255 )
@@ -19,7 +19,7 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 100, 150 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 6.0, 8.0 ) )
particle:SetStartAlpha( 50 )
@@ -29,9 +29,9 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -5 ) )
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -42,14 +42,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 12 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( vec * 250 + ( self.Normal * ( i * 10 ) ) )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
@@ -60,14 +60,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) )
particle:SetVelocity( vec * 300 )
particle:SetLifeTime( 0 )
@@ -78,65 +78,64 @@ function EFFECT:Init( data )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 40, 0, 0 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
-
+
particle:SetCollideCallback( function( part, pos, normal )
-
+
util.Decal( "Blood", pos + normal, pos - normal )
-
+
end )
-
+
end
emitter:Finish()
-
+
for i=1, 8 do
-
+
local ed = EffectData()
ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) )
-
+
if i < 4 then
ed:SetScale( 1 )
else
ed:SetScale( 2 )
end
-
+
util.Effect( "player_gib", ed, true, true )
-
+
end
-
+
if LocalPlayer():GetPos():Distance( pos ) <= 300 then
-
+
local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 )
-
+
for i=1, math.Round( frac * 6 ) do
-
+
AddStain()
-
+
end
-
+
end
-
+
end
function EFFECT:Think( )
if self.SoundTime < CurTime() then
-
+
sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) )
-
+
self.SoundTime = CurTime() + math.Rand( 0.2, 0.6 )
-
+
end
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
-end
+end
diff --git a/entities/effects/bomb_explosion/init.lua b/entities/effects/bomb_explosion/init.lua
index 459c3bd..9078921 100644
--- a/entities/effects/bomb_explosion/init.lua
+++ b/entities/effects/bomb_explosion/init.lua
@@ -4,19 +4,19 @@ local matRefraction = Material( "refract_ring" )
function EFFECT:Init( data )
self.Entity:SetRenderBounds( Vector() * -1024, Vector() * 1024 )
-
+
self.Pos = data:GetOrigin()
self.Norm = data:GetNormal()
self.Emitter = ParticleEmitter( self.Pos )
self.DieTime = CurTime() + 5
-
+
for i=1, math.random(3,6) do
-
+
local vec = self.Norm + VectorRand() * 0.7
vec.x = math.Clamp( vec.x, -1.0, 0 )
-
+
local particle = self.Emitter:Add( "effects/fire_cloud2", self.Pos )
-
+
particle:SetVelocity( vec * math.random( 400, 600 ) )
particle:SetDieTime( 1.0 )
particle:SetStartAlpha( 255 )
@@ -24,19 +24,19 @@ function EFFECT:Init( data )
particle:SetStartSize( 5 )
particle:SetEndSize( 0 )
particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 )
-
+
particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) )
particle:SetAirResistance( math.random( 20, 60 ) )
particle:SetCollide( true )
-
+
particle:SetLifeTime( 0 )
particle:SetThinkFunction( CloudThink )
particle:SetNextThink( CurTime() + 0.1 )
-
+
end
-
+
for i=1, 15 do
-
+
local particle = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
particle:SetVelocity( self.Norm * math.random(50,100) + VectorRand() * math.random(50,100) )
@@ -48,9 +48,9 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.2, 0.2 ) )
particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 )
-
+
local particle = self.Emitter:Add( "particle/particle_smokegrenade", self.Pos )
-
+
particle:SetDieTime( math.Rand( 1.5, 2.0 ) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
@@ -58,32 +58,32 @@ function EFFECT:Init( data )
particle:SetEndSize( math.Rand( 100, 150 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local vec = VectorRand()
vec.x = math.Rand( -0.1, 0.1 )
-
+
if i % 2 == 0 then
-
+
particle:SetVelocity( self.Norm * math.random(100,150) + vec * math.random(40,80) )
-
+
else
-
+
particle:SetVelocity( vec * math.random(100,150) )
-
+
end
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
particle:SetGravity( Vector(0,0,-50) )
particle:SetCollide( true )
-
+
end
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Pos
dlight.r = 250
dlight.g = 200
@@ -92,17 +92,17 @@ function EFFECT:Init( data )
dlight.Decay = 2048
dlight.size = 2048
dlight.DieTime = CurTime() + 5
-
+
end
-
+
self.Emitter:Finish()
-
+
end
function EFFECT:Think( )
- return self.DieTime > CurTime()
-
+ return self.DieTime > CurTime()
+
end
function EFFECT:Render()
@@ -118,9 +118,9 @@ function CloudThink( part )
local emitter = ParticleEmitter( pos )
local vec = VectorRand()
vec.x = math.Rand( -0.1, 0 )
-
+
local particle = emitter:Add( "particle/particle_smokegrenade", pos )
-
+
particle:SetVelocity( vec * 3 + ( WindVector * ( 2 * ( 1 - scale ) ) ) )
particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 )
particle:SetStartAlpha( math.random( 100, 150 ) )
@@ -129,10 +129,10 @@ function CloudThink( part )
particle:SetEndSize( math.random( 1, 5 ) + scale * 30 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
emitter:Finish()
end
diff --git a/entities/effects/c4_explosion/init.lua b/entities/effects/c4_explosion/init.lua
index bb676cc..55fe627 100644
--- a/entities/effects/c4_explosion/init.lua
+++ b/entities/effects/c4_explosion/init.lua
@@ -1,12 +1,12 @@
function EFFECT:Init( data )
-
+
local pos = data:GetOrigin()
-
+
local emitter = ParticleEmitter( pos )
-
+
for i=1,math.random(10,15) do
-
+
local particle = emitter:Add( "particles/smokey", pos )
particle:SetVelocity( Vector(math.random(-90, 90),math.random(-90, 90), math.random(-70, 70) ) )
@@ -17,11 +17,11 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -95, 95 ) )
particle:SetRollDelta( math.Rand( -0.12, 0.12 ) )
particle:SetColor( 10,10,10 )
-
+
end
-
+
for i=1, math.random(10,15) do
-
+
local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(-30,50)))
particle:SetVelocity( Vector(math.random(-150,150),math.random(-150,150),math.random(100,200)) )
@@ -33,11 +33,11 @@ function EFFECT:Init( data )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 )
particle:VelocityDecay( false )
-
+
end
-
+
for i=1, math.random(15,25) do
-
+
local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos + Vector(math.random(-40,40),math.random(-40,40),math.random(10,20)))
particle:SetVelocity( Vector(math.random(-200,200),math.random(-200,200),math.random(0,60)) )
@@ -48,12 +48,12 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( 360,480 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 )
- particle:VelocityDecay( true )
-
+ particle:VelocityDecay( true )
+
end
-
+
for i=0,math.random(5,9) do
-
+
local particle = emitter:Add( "effects/fire_embers"..math.random(1,3), pos )
particle:SetVelocity( Vector(math.random(-400,400),math.random(-400,400),math.random(300,550)) )
particle:SetDieTime(math.Rand(2,5))
@@ -66,18 +66,18 @@ function EFFECT:Init( data )
particle:SetColor(255, 220, 100)
particle:SetGravity(Vector(0,0,-520)) //-600 is normal
particle:SetCollide(true)
- particle:SetBounce(0.45)
-
+ particle:SetBounce(0.45)
+
end
-
+
for i=1, 5 do
-
+
local particle = emitter:Add( "particle/particle_smokegrenade", pos )
-
+
particle:SetDieTime( math.Rand( 2.0, 4.0 ) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
-
+
if i % 2 == 1 then
particle:SetVelocity( Vector( math.random(-100,100), math.random(-100,100), math.random(0,50) ) )
particle:SetStartSize( math.Rand( 50, 100 ) )
@@ -87,15 +87,15 @@ function EFFECT:Init( data )
particle:SetStartSize( math.Rand( 50, 100 ) )
particle:SetEndSize( math.Rand( 200, 400 ) )
end
-
+
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
if math.random(1,4) != 1 then
-
+
local vec = Vector( math.Rand(-8,8), math.Rand(-8,8), math.Rand(8,12) )
local particle = emitter:Add( "effects/fire_cloud2", pos + vec * 10 )
@@ -106,7 +106,7 @@ function EFFECT:Init( data )
particle:SetStartSize( 8 )
particle:SetEndSize( 0 )
particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 )
-
+
particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) )
particle:SetAirResistance( math.random( 20, 60 ) )
particle:SetCollide( true )
@@ -114,17 +114,17 @@ function EFFECT:Init( data )
particle:SetLifeTime( 0 )
particle:SetThinkFunction( CloudThink )
particle:SetNextThink( CurTime() + 0.1 )
-
+
end
-
+
end
-
+
emitter:Finish()
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = pos
dlight.r = 250
dlight.g = 200
@@ -133,19 +133,19 @@ function EFFECT:Init( data )
dlight.Decay = 1024
dlight.size = 1024
dlight.DieTime = CurTime() + 5
-
+
end
-
+
end
function EFFECT:Think( )
return false
-
+
end
function EFFECT:Render()
-
+
end
function CloudThink( part )
@@ -155,22 +155,22 @@ function CloudThink( part )
local scale = 1 - part:GetLifeTime()
local pos = part:GetPos()
local emitter = ParticleEmitter( pos )
-
+
local particle = emitter:Add( "particle/particle_smokegrenade", pos )
-
+
particle:SetVelocity( VectorRand() * 3 + ( WindVector * ( 3 * ( 1 - scale ) ) ) )
particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 )
particle:SetStartAlpha( math.random( 100, 150 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.random( 1, 3 ) + scale * math.random( 20, 50 ) )
particle:SetEndSize( math.random( 1, 5 ) + scale * math.random( 30, 50 ) )
-
+
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
emitter:Finish()
end
diff --git a/entities/effects/energy_explosion/init.lua b/entities/effects/energy_explosion/init.lua
index d959e8a..8077791 100644
--- a/entities/effects/energy_explosion/init.lua
+++ b/entities/effects/energy_explosion/init.lua
@@ -3,13 +3,13 @@
function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
-
+
local pos = data:GetOrigin()
local normal = data:GetNormal()
local emitter = ParticleEmitter( pos )
-
+
for i=1, 20 do
-
+
local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos )
particle:SetVelocity( VectorRand() * 100 )
particle:SetDieTime( math.Rand( 0.3, 0.6 ) )
@@ -19,14 +19,14 @@ function EFFECT:Init( data )
particle:SetEndSize( math.Rand( 40, 80 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 100, 250 )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = normal * math.random( 150, 200 )+ VectorRand() * 50
local normalized = vec:GetNormal():Angle()
-
+
local particle = emitter:Add( "effects/yellowflare", pos )
particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 )
particle:SetAngles( normalized )
@@ -39,16 +39,16 @@ function EFFECT:Init( data )
particle:SetEndLength( 20 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 100, 200 )
-
+
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand() * 500
local normalized = vec:GetNormal():Angle()
-
+
local particle = emitter:Add( "effects/yellowflare", pos )
particle:SetVelocity( vec )
particle:SetAngles( normalized )
@@ -60,23 +60,23 @@ function EFFECT:Init( data )
particle:SetEndLength( 20 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 100, 200 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 1.0 )
-
+
end
emitter:Finish()
-
+
end
function EFFECT:Think( )
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/fire_explosion/init.lua b/entities/effects/fire_explosion/init.lua
index d51b1c3..f4fe339 100644
--- a/entities/effects/fire_explosion/init.lua
+++ b/entities/effects/fire_explosion/init.lua
@@ -3,11 +3,11 @@
function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
-
+
local pos = data:GetOrigin()
local normal = data:GetNormal()
local emitter = ParticleEmitter( pos )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 1.0, 1.5 ) )
particle:SetStartAlpha( 255 )
@@ -16,9 +16,9 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 50, 100 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 50, 50 )
-
+
for i=1, 10 do
-
+
local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos )
particle:SetVelocity( VectorRand() * 50 + normal * 50 )
particle:SetDieTime( math.Rand( 0.3, 0.6 ) )
@@ -28,14 +28,14 @@ function EFFECT:Init( data )
particle:SetEndSize( math.Rand( 30, 60 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 200, 150, 100 )
-
+
end
-
+
for i=1, math.random(5,10) do
-
+
local vec = normal * math.random( 150, 200 ) + VectorRand() * 50
local normalized = vec:GetNormal():Angle()
-
+
local particle = emitter:Add( "effects/yellowflare", pos )
particle:SetVelocity( normal * math.random(150,200) + VectorRand() * 50 )
particle:SetLifeTime( 0 )
@@ -46,19 +46,19 @@ function EFFECT:Init( data )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 200, 100, 50 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( math.Rand( 0, 0.2 ) )
-
+
end
emitter:Finish()
-
+
local dlight = DynamicLight( self:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = pos
dlight.r = 255
dlight.g = 150
@@ -67,17 +67,17 @@ function EFFECT:Init( data )
dlight.Decay = 512
dlight.size = 256 * math.Rand( 0.5, 1.0 )
dlight.DieTime = CurTime() + 5
-
+
end
-
+
end
function EFFECT:Think( )
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/fire_tracer/init.lua b/entities/effects/fire_tracer/init.lua
index 3f8842b..eef727a 100644
--- a/entities/effects/fire_tracer/init.lua
+++ b/entities/effects/fire_tracer/init.lua
@@ -7,24 +7,24 @@ function EFFECT:Init( data )
self.Position = data:GetStart()
self.WeaponEnt = data:GetEntity()
self.Attachment = data:GetAttachment()
-
+
self.StartPos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment )
self.EndPos = data:GetOrigin()
-
+
local dir = self.StartPos - self.EndPos
dir:Normalize()
-
+
self.Dir = dir
-
+
self.Entity:SetRenderBoundsWS( self.StartPos, self.EndPos )
-
+
self.Alpha = 100
self.Color = Color( 250, 150, 50, self.Alpha )
-
+
local dlight = DynamicLight( self:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.StartPos
dlight.r = 255
dlight.g = 150
@@ -33,7 +33,7 @@ function EFFECT:Init( data )
dlight.Decay = 256
dlight.size = 256 * math.Rand( 0.5, 1.0 )
dlight.DieTime = CurTime() + 5
-
+
end
end
@@ -44,7 +44,7 @@ function EFFECT:Think( )
self.Alpha = self.Alpha - FrameTime() * 200
self.Color = Color( 250, 150, 50, self.Alpha )
-
+
return self.Alpha > 0
end
@@ -52,36 +52,36 @@ end
function EFFECT:Render( )
if self.Alpha < 1 then return end
-
+
--[[self.Length = ( self.StartPos - self.EndPos ):Length()
-
+
render.SetMaterial( self.Mat )
render.DrawBeam( self.StartPos, self.EndPos, ( 100 / self.Alpha ) * 0.5 + 0.5, 0, 0, self.Color )]]
-
+
if ( self.Alpha < 1 ) then return end
self.Length = (self.StartPos - self.EndPos):Length()
-
+
local texcoord = CurTime() * -0.2
-
+
for i = 1, 10 do
-
+
render.SetMaterial( self.Mat )
-
+
texcoord = texcoord + i * 0.05 * texcoord
-
- render.DrawBeam( self.StartPos,
- self.EndPos,
- i * self.Alpha * 0.03,
- texcoord,
- texcoord + (self.Length / (128 + self.Alpha)),
+
+ render.DrawBeam( self.StartPos,
+ self.EndPos,
+ i * self.Alpha * 0.03,
+ texcoord,
+ texcoord + (self.Length / (128 + self.Alpha)),
self.Color )
-
+
render.SetMaterial( self.Sprite )
render.DrawSprite( self.StartPos + self.Dir * i, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) )
render.DrawSprite( self.EndPos, i * 5, i * 5, Color( self.Color.r, self.Color.g, self.Color.b, self.Alpha ) )
-
+
end
end
diff --git a/entities/effects/gore_explosion/init.lua b/entities/effects/gore_explosion/init.lua
index e4406a1..66a8641 100644
--- a/entities/effects/gore_explosion/init.lua
+++ b/entities/effects/gore_explosion/init.lua
@@ -3,10 +3,10 @@
function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
-
+
local pos = data:GetOrigin() + Vector(0,0,50)
local emitter = ParticleEmitter( pos )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
particle:SetStartAlpha( 255 )
@@ -15,7 +15,7 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 150, 200 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 6.0, 8.0 ) )
particle:SetStartAlpha( 50 )
@@ -25,9 +25,9 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -5 ) )
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -38,14 +38,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 12 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( vec * 250 + Vector(0,0,50) )
particle:SetDieTime( math.Rand( 0.8, 1.0 ) )
@@ -56,14 +56,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) )
particle:SetVelocity( vec * 300 )
particle:SetLifeTime( 0 )
@@ -74,56 +74,56 @@ function EFFECT:Init( data )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 40, 0, 0 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
-
+
particle:SetCollideCallback( function( part, pos, normal )
-
+
util.Decal( "Blood", pos + normal, pos - normal )
-
+
end )
-
+
end
emitter:Finish()
-
+
for i=1, 15 do
-
+
local ed = EffectData()
ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) )
-
+
if i < 5 then
ed:SetScale( 1 )
else
ed:SetScale( 2 )
end
-
+
util.Effect( "player_gib", ed, true, true )
-
+
end
-
+
if LocalPlayer():GetPos():Distance( pos ) <= 300 then
-
+
local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 300 )
-
+
for i=1, math.Round( frac * 12 ) do
-
+
AddStain()
-
+
end
-
+
end
-
+
end
function EFFECT:Think( )
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/head_gib/init.lua b/entities/effects/head_gib/init.lua
index 8a36dd9..6258735 100644
--- a/entities/effects/head_gib/init.lua
+++ b/entities/effects/head_gib/init.lua
@@ -1,10 +1,10 @@
function EFFECT:Init( data )
-
- local pos = data:GetOrigin()
+
+ local pos = data:GetOrigin()
local emitter = ParticleEmitter( pos )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( 0.5 )
particle:SetStartAlpha( 255 )
@@ -13,7 +13,7 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 50, 100 ) )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 5.0, 7.0 ) )
particle:SetStartAlpha( 50 )
@@ -23,9 +23,9 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -5 ) )
-
+
for i=1, math.random(5,10) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -36,11 +36,11 @@ function EFFECT:Init( data )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 6 do
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,0,75) )
particle:SetDieTime( 0.5 )
@@ -51,41 +51,40 @@ function EFFECT:Init( data )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
emitter:Finish()
-
+
for i=1, 3 do
-
+
local ed = EffectData()
ed:SetOrigin( pos )
ed:SetScale( 1 )
util.Effect( "player_gib", ed, true, true )
-
+
end
-
+
if LocalPlayer():GetPos():Distance( pos ) <= 100 then
-
+
local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 )
-
+
for i=1, math.Round( frac * 6 ) do
-
+
AddStain()
-
+
end
-
+
end
-
+
end
function EFFECT:Think( )
return false
-
+
end
function EFFECT:Render()
-
-end
+end
diff --git a/entities/effects/headshot/init.lua b/entities/effects/headshot/init.lua
index 7aadb41..1bc08c1 100644
--- a/entities/effects/headshot/init.lua
+++ b/entities/effects/headshot/init.lua
@@ -1,10 +1,10 @@
function EFFECT:Init( data )
-
+
local pos = data:GetOrigin()
local emitter = ParticleEmitter( pos )
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( 0.3 )
particle:SetStartAlpha( 255 )
@@ -13,7 +13,7 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 50, 100 ) )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
-
+
local particle = emitter:Add( "particles/smokey", pos )
particle:SetDieTime( math.Rand( 10, 20 ) )
particle:SetStartAlpha( math.random( 20, 40 ) )
@@ -22,9 +22,9 @@ function EFFECT:Init( data )
particle:SetEndSize( 10 )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
-
+
for i=1, math.random(2,4) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -35,32 +35,31 @@ function EFFECT:Init( data )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 50, 0, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
emitter:Finish()
-
+
if LocalPlayer():GetPos():Distance( pos ) <= 100 then
-
+
local frac = 1 - ( LocalPlayer():GetPos():Distance( pos ) / 100 )
-
+
for i=1, math.Round( frac * 3 ) do
-
+
AddStain()
-
+
end
-
+
end
-
+
end
function EFFECT:Think( )
return false
-
+
end
function EFFECT:Render()
-
-end
+end
diff --git a/entities/effects/immolate/init.lua b/entities/effects/immolate/init.lua
index e6a7cc1..c562638 100644
--- a/entities/effects/immolate/init.lua
+++ b/entities/effects/immolate/init.lua
@@ -4,47 +4,47 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 5
self.SmokeTime = 0
self.Ent = data:GetEntity()
-
+
if not IsValid( self.Ent ) then self.DieTime = 0 return end
-
+
self.Emitter = ParticleEmitter( self.Ent:GetPos() )
-
+
if LocalPlayer() != self.Ent then return end
-
+
LocalPlayer():EmitSound( "ambient/fire/ignite.wav", 100, 80 )
-
+
end
function EFFECT:Think()
if IsValid( self.Ent ) then
-
+
if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then
-
+
self.DieTime = 0
-
+
end
-
+
end
if self.DieTime < CurTime() or not IsValid( self.Ent ) then
-
+
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
-
+
return false
-
+
end
local pos
-
+
for i=1, 3 do
-
+
pos = self.Ent:GetPos() + Vector(0,0,math.random(1,50)) + Vector(math.random(-10,10),math.random(-10,10),0)
-
+
local particle = self.Emitter:Add( "effects/muzzleflash" .. math.random(1,4), pos )
particle:SetVelocity( Vector(0,0,80) )
particle:SetDieTime( math.Rand( 0.2, 0.4 ) )
@@ -55,13 +55,13 @@ function EFFECT:Think()
particle:SetRoll( math.random(-180,180) )
particle:SetColor( 255, 200, 200 )
particle:SetGravity( Vector( 0, 0, 500 ) )
-
+
end
-
+
if self.SmokeTime < CurTime() then
-
+
self.SmokeTime = CurTime() + 0.02
-
+
local particle = self.Emitter:Add( "particles/smokey", pos )
particle:SetVelocity( Vector(0,0,30) )
particle:SetDieTime( math.Rand( 1.0, 2.5 ) )
@@ -72,17 +72,13 @@ function EFFECT:Think()
particle:SetRoll( 0 )
particle:SetColor( 50, 50, 50 )
particle:SetGravity( Vector( 0, 0, 30 ) )
-
+
end
return true
-
-end
-function EFFECT:Render()
-
end
+function EFFECT:Render()
-
-
+end
diff --git a/entities/effects/player_gib/init.lua b/entities/effects/player_gib/init.lua
index 2afcae0..62b5916 100644
--- a/entities/effects/player_gib/init.lua
+++ b/entities/effects/player_gib/init.lua
@@ -6,48 +6,48 @@ function EFFECT:Init( data )
if scale < 2 then
self.Entity:SetModel( table.Random( GAMEMODE.SmallGibs ) )
else
- self.Entity:SetModel( table.Random( GAMEMODE.BigGibs ) )
+ self.Entity:SetModel( table.Random( GAMEMODE.BigGibs ) )
end
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMaterial( "models/flesh" )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self.Entity:SetCollisionBounds( Vector( -128 -128, -128 ), Vector( 128, 128, 128 ) )
self.Entity:SetAngles( Angle( math.Rand(0,360), math.Rand(0,360), math.Rand(0,360) ) )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
local vec = VectorRand()
vec.z = math.Clamp( vec.z, -0.4, 0.8 )
-
+
phys:Wake()
phys:SetMass( 100 )
phys:AddAngleVelocity( VectorRand() * 500 )
phys:SetMaterial( "gmod_silent" )
-
+
if scale < 2 then
-
+
phys:SetVelocity( vec * math.Rand( 100, 200 ) )
-
+
else
-
+
phys:SetVelocity( vec * math.Rand( 300, 600 ) )
-
+
end
-
+
end
-
+
self.LifeTime = CurTime() + 15
-
+
end
function EFFECT:Think( )
return self.LifeTime > CurTime()
-
+
end
function EFFECT:Render()
@@ -55,4 +55,3 @@ function EFFECT:Render()
self.Entity:DrawModel()
end
-
diff --git a/entities/effects/puke_explosion/init.lua b/entities/effects/puke_explosion/init.lua
index 9a13226..afc00f6 100644
--- a/entities/effects/puke_explosion/init.lua
+++ b/entities/effects/puke_explosion/init.lua
@@ -5,12 +5,12 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
self.SoundTime = 0
-
+
local pos = data:GetOrigin() + Vector(0,0,50)
local emitter = ParticleEmitter( pos )
-
+
self.Pos = pos
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
particle:SetStartAlpha( 255 )
@@ -19,9 +19,9 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 100, 150 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -32,14 +32,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 10 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( vec * 300 )
particle:SetDieTime( math.Rand( 0.8, 1.0 ) )
@@ -50,14 +50,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 )
particle:SetGravity( Vector( 0, 0, -400 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random( 1, 2 ), pos + Vector( 0, 0, math.random( -10, 10 ) ) )
particle:SetVelocity( vec * 300 )
particle:SetLifeTime( 0 )
@@ -68,52 +68,52 @@ function EFFECT:Init( data )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
-
+
particle:SetCollideCallback( function( part, pos, normal )
-
+
util.Decal( "yellowblood", pos + normal, pos - normal )
-
+
end )
-
+
end
emitter:Finish()
-
+
for i=1, 10 do
-
+
local ed = EffectData()
ed:SetOrigin( pos + Vector( 0, 0, math.random( 0, 30 ) ) )
-
+
if i < 5 then
ed:SetScale( 1 )
else
ed:SetScale( 2 )
end
-
+
util.Effect( "player_gib", ed, true, true )
-
+
end
-
+
end
function EFFECT:Think()
if self.SoundTime < CurTime() then
-
+
sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) )
-
+
self.SoundTime = CurTime() + 0.5
-
+
end
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/puke_spray/init.lua b/entities/effects/puke_spray/init.lua
index b2d73ac..f7bb955 100644
--- a/entities/effects/puke_spray/init.lua
+++ b/entities/effects/puke_spray/init.lua
@@ -5,12 +5,12 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 1.5
self.SoundTime = 0
-
+
local pos = data:GetOrigin() + Vector(0,0,50)
local emitter = ParticleEmitter( pos )
-
+
self.Pos = pos
-
+
local particle = emitter:Add( "effects/blood_core", pos )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
particle:SetStartAlpha( 255 )
@@ -19,9 +19,9 @@ function EFFECT:Init( data )
particle:SetEndSize( math.random( 100, 150 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -32,14 +32,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 10 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos )
particle:SetVelocity( vec * 200 )
particle:SetDieTime( math.Rand( 0.8, 1.0 ) )
@@ -50,14 +50,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g + math.random(0,20), 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, math.random(3,6) do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "nuke/gore" .. math.random(1,2), pos + Vector(0,0,math.random(-10,10)) )
particle:SetVelocity( vec * 300 )
particle:SetLifeTime( 0 )
@@ -68,52 +68,52 @@ function EFFECT:Init( data )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( self.Color.r, self.Color.g, 0 )
-
+
particle:SetGravity( Vector( 0, 0, -500 ) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
-
+
particle:SetCollideCallback( function( part, pos, normal )
-
+
util.Decal( "yellowblood", pos + normal, pos - normal )
-
+
end )
-
+
end
emitter:Finish()
-
+
for i=1, 5 do
-
+
local ed = EffectData()
ed:SetOrigin( pos + Vector(0,0,math.random(0,30)) )
-
+
if i < 3 then
ed:SetScale( 1 )
else
ed:SetScale( 2 )
end
-
+
util.Effect( "player_gib", ed, true, true )
-
+
end
-
+
end
function EFFECT:Think( )
if self.SoundTime < CurTime() then
-
+
sound.Play( table.Random( GAMEMODE.GoreSplat ), self.Pos, 100, math.random(90,110) )
-
+
self.SoundTime = CurTime() + 0.5
-
+
end
return self.DieTime > CurTime()
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/rad_explosion/init.lua b/entities/effects/rad_explosion/init.lua
index e888a2e..75e7ec5 100644
--- a/entities/effects/rad_explosion/init.lua
+++ b/entities/effects/rad_explosion/init.lua
@@ -1,11 +1,11 @@
function EFFECT:Init( data )
-
+
local pos = data:GetOrigin() + Vector(0,0,40)
local emitter = ParticleEmitter( pos )
-
+
for i=1, math.random(4,8) do
-
+
local particle = emitter:Add( "effects/blood", pos )
particle:SetVelocity( VectorRand() * 100 + Vector(0,math.random(-25,25),50) )
particle:SetDieTime( 1.0 )
@@ -16,14 +16,14 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetColor( 100, 200, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
end
-
+
for i=1, 20 do
-
+
local vec = VectorRand()
vec.z = math.Rand( -0.2, 1.0 )
-
+
local particle = emitter:Add( "effects/yellowflare", pos )
particle:SetVelocity( vec * 300 )
particle:SetDieTime( math.Rand( 2.5, 3.5 ) )
@@ -34,22 +34,22 @@ function EFFECT:Init( data )
particle:SetRoll( math.random( -360, 360 ) )
particle:SetColor( 100, 200, 0 )
particle:SetGravity( Vector( 0, 0, -300 ) )
-
+
particle:SetCollide( true )
particle:SetBounce( math.Rand( 0.1, 0.5 ) )
-
+
end
emitter:Finish()
-
+
end
function EFFECT:Think( )
return false
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/effects/radiation/init.lua b/entities/effects/radiation/init.lua
index e9021c9..5a4281e 100644
--- a/entities/effects/radiation/init.lua
+++ b/entities/effects/radiation/init.lua
@@ -4,43 +4,43 @@ function EFFECT:Init( data )
self.DieTime = CurTime() + 5
self.PartTime = 0
self.Ent = data:GetEntity()
-
+
if not IsValid( self.Ent ) then self.DieTime = 0 return end
-
+
self.Emitter = ParticleEmitter( self.Ent:GetPos() )
-
+
end
function EFFECT:Think()
if IsValid( self.Ent ) then
-
+
if self.Ent:IsPlayer() and ( !self.Ent:Alive() or self.Ent == LocalPlayer() ) then
-
+
self.DieTime = 0
-
+
end
-
+
end
if self.DieTime < CurTime() or not IsValid( self.Ent ) then
-
+
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
-
+
return false
-
+
end
if self.PartTime < CurTime() then
-
+
self.PartTime = CurTime() + math.Rand( 0.2, 0.4 )
-
+
local pos = self.Ent:GetPos() + Vector(0,0,math.random(1,40)) + Vector(math.random(-10,10),math.random(-10,10),0)
-
+
local particle = self.Emitter:Add( "effects/yellowflare", pos )
particle:SetVelocity( VectorRand() * 5 )
particle:SetDieTime( math.Rand( 2.0, 4.0 ) )
@@ -51,20 +51,16 @@ function EFFECT:Think()
particle:SetRoll( math.random( -180, 180 ) )
particle:SetColor( 100, 200, 0 )
particle:SetGravity( Vector( 0, 0, -500 ) )
-
+
particle:SetCollide( true )
particle:SetBounce( math.Rand( 0, 0.2 ) )
-
+
end
return true
-
-end
-function EFFECT:Render()
-
end
+function EFFECT:Render()
-
-
+end
diff --git a/entities/effects/smoke_crater/init.lua b/entities/effects/smoke_crater/init.lua
index 68c713b..e16d873 100644
--- a/entities/effects/smoke_crater/init.lua
+++ b/entities/effects/smoke_crater/init.lua
@@ -4,7 +4,7 @@ function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Magnitude = data:GetMagnitude() or 1
-
+
self.Emitter = ParticleEmitter( self.Pos )
self.DieTime = CurTime() + 15
self.Interval = 0
@@ -15,9 +15,9 @@ end
function EFFECT:Think( )
if self.Interval < CurTime() then
-
+
self.Interval = CurTime() + 0.2
-
+
local particle = self.Emitter:Add( "particles/smokey", self.Pos + VectorRand() * 10 )
particle:SetVelocity( Vector( math.Rand(-3,3), math.Rand(-3,3), math.Rand(20,40) ) + WindVector )
@@ -28,25 +28,25 @@ function EFFECT:Think( )
particle:SetEndSize( math.Rand( 50, 200 ) * self.Magnitude )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local rand = math.random(10,50)
- particle:SetColor( rand, rand, rand )
+ particle:SetColor( rand, rand, rand )
end
-
+
if self.DieTime > CurTime() then
-
+
return true
-
+
else
-
+
self.Emitter:Finish()
return false
-
+
end
-
+
end
function EFFECT:Render()
-
+
end
diff --git a/entities/entities/info_npcspawn/init.lua b/entities/entities/info_npcspawn/init.lua
index c7e915b..87746e9 100644
--- a/entities/entities/info_npcspawn/init.lua
+++ b/entities/entities/info_npcspawn/init.lua
@@ -8,7 +8,7 @@ function ENT:Initialize()
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:DrawShadow( false )
end
diff --git a/entities/entities/npc_nb_common/shared.lua b/entities/entities/npc_nb_common/shared.lua
index 8890529..2590783 100644
--- a/entities/entities/npc_nb_common/shared.lua
+++ b/entities/entities/npc_nb_common/shared.lua
@@ -16,8 +16,8 @@ ENT.BaseHealth = 90
ENT.MoveSpeed = 175
ENT.MoveAnim = ACT_RUN
-ENT.Models = { Model( "models/zed/malezed_04.mdl" ),
-Model( "models/zed/malezed_06.mdl" ),
+ENT.Models = { Model( "models/zed/malezed_04.mdl" ),
+Model( "models/zed/malezed_06.mdl" ),
Model( "models/zed/malezed_08.mdl" ) }
ENT.VoiceSounds = {}
@@ -66,7 +66,7 @@ Sound( "nuke/redead/attack_8.wav" ),
Sound( "nuke/redead/attack_9.wav" ),
Sound( "nuke/redead/attack_10.wav" ) }
-function ENT:OnDeath( dmginfo )
+function ENT:OnDeath( dmginfo )
end
@@ -75,9 +75,9 @@ function ENT:OnHitEnemy( enemy )
enemy:TakeDamage( self.Damage, self.Entity )
enemy:SetInfected( true )
enemy:ViewBounce( 10 )
-
+
umsg.Start( "Drunk", enemy )
umsg.Short( 1 )
umsg.End()
-end \ No newline at end of file
+end
diff --git a/entities/entities/npc_nb_contagion/shared.lua b/entities/entities/npc_nb_contagion/shared.lua
index 14d1503..5018518 100644
--- a/entities/entities/npc_nb_contagion/shared.lua
+++ b/entities/entities/npc_nb_contagion/shared.lua
@@ -16,7 +16,7 @@ ENT.MoveSpeed = 50
ENT.MoveAnim = ACT_WALK
ENT.Models = nil
-ENT.Model = Model( "models/zombie/classic.mdl" )
+ENT.Model = Model( "models/zombie/classic.mdl" )
ENT.VoiceSounds = {}
@@ -55,34 +55,34 @@ Sound( "npc/zombie/zo_attack2.wav" ) }
ENT.Torso = Model( "models/zombie/classic_torso.mdl" )
function ENT:OnDeath( dmginfo )
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
if v:GetPos():Distance( self.Entity:GetPos() ) < 150 then
-
+
v:TakeDamage( 40, self.Entity )
v:SetInfected( true )
-
+
umsg.Start( "Drunk", v )
umsg.Short( 2 )
umsg.End()
-
+
end
-
+
end
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "puke_spray", ed, true, true )
-
+
if dmginfo:IsExplosionDamage() then
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "gore_explosion", ed, true, true )
-
+
end
-
+
self.Entity:SpawnRagdoll( dmginfo, self.Torso, self.Entity:GetPos() + Vector(0,0,50), true )
self.Entity:SetModel( self.Legs )
@@ -97,4 +97,4 @@ function ENT:OnHitEnemy( enemy )
umsg.Short( 3 )
umsg.End()
-end \ No newline at end of file
+end
diff --git a/entities/entities/npc_nb_leaper/shared.lua b/entities/entities/npc_nb_leaper/shared.lua
index 174fa0f..7d46821 100644
--- a/entities/entities/npc_nb_leaper/shared.lua
+++ b/entities/entities/npc_nb_leaper/shared.lua
@@ -17,7 +17,7 @@ ENT.JumpHeight = 300
ENT.MoveAnim = ACT_RUN
ENT.Models = nil
-ENT.Model = Model( "models/zombie/fast.mdl" )
+ENT.Model = Model( "models/zombie/fast.mdl" )
ENT.Legs = Model( "models/gibs/fast_zombie_legs.mdl" )
ENT.VoiceSounds = {}
@@ -43,7 +43,7 @@ Sound( "npc/fast_zombie/leap1.wav" ) }
ENT.Leap = Sound( "npc/fast_zombie/fz_scream1.wav" )
-function ENT:OnDeath( dmginfo )
+function ENT:OnDeath( dmginfo )
end
@@ -52,7 +52,7 @@ function ENT:OnHitEnemy( enemy )
enemy:TakeDamage( self.Damage, self.Entity )
enemy:SetBleeding( true )
enemy:ViewBounce( 15 )
-
+
umsg.Start( "Drunk", enemy )
umsg.Short( 1 )
umsg.End()
@@ -62,18 +62,18 @@ end
function ENT:OnStuck()
local ent = self.Entity:GetBreakable()
-
+
if IsValid( ent ) then
-
+
self.Obstructed = true
-
+
else
-
+
self.Obstructed = false
self.Entity:DownTrace()
-
+
end
-
+
self.loco:ClearStuck()
end
@@ -81,16 +81,16 @@ end
function ENT:DownTrace()
local trace = {}
- trace.start = self.Entity:GetPos()
+ trace.start = self.Entity:GetPos()
trace.endpos = trace.start + Vector(0,0,-1000)
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
-
+
if tr.Hit then
-
+
self.Entity:SetPos( tr.HitPos + tr.HitNormal * 5 )
-
+
end
end
@@ -98,54 +98,54 @@ end
function ENT:RunBehaviour()
while true do
-
- self.Entity:StartActivity( self.MoveAnim )
+
+ self.Entity:StartActivity( self.MoveAnim )
self.loco:SetDesiredSpeed( self.MoveSpeed )
-
+
local enemy = self.Entity:FindEnemy()
-
+
if not IsValid( enemy ) then
-
+
self.Entity:MoveToPos( self.Entity:GetPos() + Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 0 ) * 500 )
- self.Entity:StartActivity( ACT_IDLE )
-
+ self.Entity:StartActivity( ACT_IDLE )
+
else
-
+
if self.Obstructed then
-
+
self.Entity:BreakableRoutine()
-
+
coroutine.yield()
-
+
end
-
+
local age = math.Clamp( math.min( enemy:GetPos():Distance( self.Entity:GetPos() ), 1000 ) / 1000, 0.2, 1 )
local opts = { draw = self.ShouldDrawPath, maxage = 3 * age, tolerance = self.MeleeDistance }
-
+
if math.random(1,20) == 1 then
-
+
self.loco:SetDesiredSpeed( math.random( 350, 700 ) )
self.loco:SetJumpHeight( math.random( 150, self.JumpHeight ) )
self.loco:Jump()
-
+
self.Entity:SetVelocity( self.Entity:GetForward() * math.random( 350, 700 ) + Vector(0,0,200) )
self.Entity:EmitSound( self.Leap, 100, math.random(90,110) )
-
+
end
-
- self.Entity:MoveToPos( enemy:GetPos(), opts )
-
- self.Entity:StartActivity( ACT_IDLE )
-
+
+ self.Entity:MoveToPos( enemy:GetPos(), opts )
+
+ self.Entity:StartActivity( ACT_IDLE )
+
self.Entity:BreakableRoutine()
self.Entity:EnemyRoutine()
-
- self.Entity:StartActivity( ACT_IDLE )
-
+
+ self.Entity:StartActivity( ACT_IDLE )
+
end
-
+
coroutine.yield()
-
+
end
-
-end \ No newline at end of file
+
+end
diff --git a/entities/entities/npc_nb_poison/shared.lua b/entities/entities/npc_nb_poison/shared.lua
index c4c67b3..10a4953 100644
--- a/entities/entities/npc_nb_poison/shared.lua
+++ b/entities/entities/npc_nb_poison/shared.lua
@@ -46,52 +46,52 @@ ENT.VoiceSounds.Attack = { Sound( "npc/zombie_poison/pz_throw2.wav" ),
Sound( "npc/zombie_poison/pz_throw3.wav" ),
Sound( "npc/zombie_poison/pz_alert2.wav" ) }
-function ENT:OnDeath( dmginfo )
+function ENT:OnDeath( dmginfo )
end
function ENT:OnThink()
if self.EffectTime < CurTime() then
-
+
self.EffectTime = CurTime() + 5
-
+
local ed = EffectData()
ed:SetEntity( self.Entity )
util.Effect( "radiation", ed, true, true )
-
+
end
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
local dist = v:GetPos():Distance( self.Entity:GetPos() )
-
+
if dist < self.SoundRadius then
-
+
if dist < self.Radius then
-
+
if ( v.RadAddTime or 0 ) < CurTime() then
-
+
v.RadAddTime = CurTime() + 8
v:AddRadiation( 1 )
-
+
end
-
+
end
-
+
if ( v.NextRadSound or 0 ) < CurTime() then
-
+
local scale = math.Clamp( ( self.SoundRadius - dist ) / ( self.SoundRadius - self.Radius ), 0.1, 1.0 )
-
- v.NextRadSound = CurTime() + 1 - scale
+
+ v.NextRadSound = CurTime() + 1 - scale
v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 )
v:NoticeOnce( "A radioactive zombie is nearby", GAMEMODE.Colors.Blue )
v:NoticeOnce( "Radioactive zombies will poison nearby people", GAMEMODE.Colors.Blue, 3, 2 )
-
+
end
-
+
end
-
+
end
end
@@ -101,21 +101,21 @@ function ENT:OnHitEnemy( enemy )
enemy:TakeDamage( self.Damage, self.Entity )
enemy:AddRadiation( 2 )
enemy:ViewBounce( 35 )
-
+
umsg.Start( "Drunk", enemy )
umsg.Short( 3 )
umsg.End()
end
-function ENT:OnDeath( dmginfo )
+function ENT:OnDeath( dmginfo )
- local ent = ents.Create( "sent_radiation" )
+ local ent = ents.Create( "sent_radiation" )
ent:SetPos( self.Entity:GetPos() )
ent:Spawn()
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "rad_explosion", ed, true, true )
-end \ No newline at end of file
+end
diff --git a/entities/entities/point_evac/cl_init.lua b/entities/entities/point_evac/cl_init.lua
index c069cf8..a60aed9 100644
--- a/entities/entities/point_evac/cl_init.lua
+++ b/entities/entities/point_evac/cl_init.lua
@@ -14,6 +14,5 @@ function ENT:OnRemove()
end
function ENT:Draw()
-
-end
+end
diff --git a/entities/entities/point_evac/init.lua b/entities/entities/point_evac/init.lua
index 040bf87..c413c9c 100644
--- a/entities/entities/point_evac/init.lua
+++ b/entities/entities/point_evac/init.lua
@@ -8,67 +8,67 @@ ENT.Heli = Sound( "ambient/machines/heli_pass2.wav" )
ENT.EvacDist = 400
function ENT:Initialize()
-
+
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_NONE )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER )
self.Entity:SetTrigger( true )
self.Entity:SetNotSolid( true )
- self.Entity:DrawShadow( false )
-
+ self.Entity:DrawShadow( false )
+
self.Entity:SetCollisionBounds( Vector( -150, -150, -150 ), Vector( 150, 150, 150 ) )
self.Entity:PhysicsInitBox( Vector( -150, -150, -150 ), Vector( 150, 150, 150 ) )
-
+
self.DieTime = CurTime() + 44
self.SoundTime = CurTime() + 43
-
+
self.Players = {}
-
+
local flare = ents.Create( "sent_heliflare" )
flare:SetPos( self.Entity:GetPos() )
flare:Spawn()
-
+
self.Entity:EmitSound( self.Heli, 150 )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,10)
trace.endpos = trace.start + Vector(0,0,800)
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
-
+
if tr.HitPos:Distance( self.Entity:GetPos() ) < 400 then return end
-
+
local heli = ents.Create( "prop_dynamic" )
heli:SetModel( "models/combine_helicopter.mdl" )
heli:SetPos( tr.HitPos + Vector(0,0,-150) )
heli:Spawn()
heli:Fire( "SetAnimation", "idle", 1 )
-
+
end
function ENT:Think()
if self.SoundTime and self.SoundTime < CurTime() then
-
+
self.Entity:EmitSound( self.Heli, 150 )
-
+
self.SoundTime = nil
-
+
end
if self.DieTime < CurTime() then
-
+
self.Entity:Evac()
self.Entity:Remove()
-
+
for k,v in pairs( team.GetPlayers( TEAM_ZOMBIES ) ) do
-
+
v:Notice( "The chopper has left the evac zone", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
end
@@ -76,42 +76,42 @@ end
function ENT:Evac()
for k,v in pairs( self.Players ) do
-
+
if IsValid( v ) and v:Alive() and v:Team() == TEAM_ARMY and v:GetPos():Distance( self.Entity:GetPos() ) < self.EvacDist then
-
+
v:Evac()
-
+
end
-
+
end
end
-function ENT:Touch( ent )
+function ENT:Touch( ent )
if not ent:IsPlayer() then return end
-
+
if ent:Team() != TEAM_ARMY then return end
-
+
if table.HasValue( self.Players, ent ) then return end
-
+
table.insert( self.Players, ent )
-
+
if not self.FirstEvac then
-
+
self.FirstEvac = true
-
+
ent:AddStat( "Evac" )
-
+
end
-
+
ent:Notice( "You made it to the evac zone", GAMEMODE.Colors.Green, 5 )
ent:Notice( "The helicopter will take off shortly", GAMEMODE.Colors.Blue, 5, 2 )
-
-end
+
+end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
diff --git a/entities/entities/point_evac/shared.lua b/entities/entities/point_evac/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/point_evac/shared.lua
+++ b/entities/entities/point_evac/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/point_radiation/init.lua b/entities/entities/point_radiation/init.lua
index 7821c2d..e2b3f16 100644
--- a/entities/entities/point_radiation/init.lua
+++ b/entities/entities/point_radiation/init.lua
@@ -3,12 +3,12 @@ ENT.Type = "point"
ENT.Base = "base_point"
function ENT:Initialize()
-
+
self.Active = true
self.Radius = 400
self.SoundRadius = 800
self.Pos = self.Entity:GetPos()
-
+
end
function ENT:SetArtifact( ent )
@@ -38,15 +38,15 @@ end
function ENT:KeyValue( key, value )
if key == "radius" then
-
+
self.Radius = math.Clamp( tonumber( value ), 100, 5000 )
self.SoundRadius = self.Radius * 1.4
-
+
elseif key == "randomradius" then
-
+
self.Radius = math.random( 100, math.Clamp( tonumber( value ), 500, 5000 ) )
self.SoundRadius = self.Radius * 1.4
-
+
end
end
@@ -60,35 +60,35 @@ end
function ENT:Think()
if not self.Active then return end
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
local dist = v:GetPos():Distance( self.Pos )
-
+
if dist < self.SoundRadius then
-
+
if dist < self.Radius then
-
+
if ( v.RadAddTime or 0 ) < CurTime() then
-
+
v.RadAddTime = CurTime() + 10
v:AddRadiation( 1 )
-
+
end
-
+
end
-
+
if ( v.NextRadSound or 0 ) < CurTime() then
-
+
local scale = math.Clamp( ( self.SoundRadius - dist ) / ( self.SoundRadius - self.Radius ), 0.1, 1.0 )
-
- v.NextRadSound = CurTime() + 1 - scale
+
+ v.NextRadSound = CurTime() + 1 - scale
v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 )
-
+
end
-
+
end
-
+
end
-
+
end
diff --git a/entities/entities/point_stash/cl_init.lua b/entities/entities/point_stash/cl_init.lua
index e978063..b82b4fa 100644
--- a/entities/entities/point_stash/cl_init.lua
+++ b/entities/entities/point_stash/cl_init.lua
@@ -6,6 +6,5 @@ function ENT:Initialize()
end
function ENT:Draw()
-
-end
+end
diff --git a/entities/entities/point_stash/init.lua b/entities/entities/point_stash/init.lua
index 94fcc43..99e7c6f 100644
--- a/entities/entities/point_stash/init.lua
+++ b/entities/entities/point_stash/init.lua
@@ -6,35 +6,35 @@ include( 'shared.lua' )
function ENT:Initialize()
self.Entity:SetModel( "models/Roller.mdl" )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
self.Entity:DrawShadow( false )
-
+
self.Cash = 0
self.LastUse = 0
self.LastThink = 0
self.Items = {}
-
+
self.ItemTbl = { ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_FOOD, ITEM_SUPPLY, ITEM_SUPPLY, ITEM_MISC, ITEM_MISC, ITEM_LOOT, ITEM_LOOT, ITEM_AMMO, ITEM_AMMO, ITEM_EXODUS, ITEM_WPN_COMMON }
-
+
for i=1, math.random(2,5) do
-
+
local rand = item.RandomItem( table.Random( self.ItemTbl ) )
-
+
self.Entity:AddItem( rand.ID )
-
+
end
end
function ENT:SetCash( amt )
- self.Cash = math.Clamp( amt, 0, 32000 )
+ self.Cash = math.Clamp( amt, 0, 32000 )
end
@@ -44,59 +44,59 @@ function ENT:GetCash()
end
-function ENT:Think()
-
+function ENT:Think()
+
if not IsValid( self.Entity:GetUser() ) then return end
-
+
if not self.Entity:GetUser():Alive() then
-
+
self.Entity:SetUser()
-
+
end
-
+
if self.LastThink < CurTime() then
-
+
self.LastThink = CurTime() + ( 10 * 60 )
-
+
if #self.Entity:GetItems() < 1 then
-
+
for i=1, math.random(2,5) do
-
+
local rand = item.RandomItem( table.Random( self.ItemTbl ) )
-
+
self.Entity:AddItem( rand.ID )
-
+
end
-
+
end
-
+
end
-
-end
+
+end
function ENT:GetUser()
return self.User
-
+
end
function ENT:SetUser( ply )
self.User = ply
-
+
end
function ENT:OnExit( ply )
if ( self.LastUse or 0 ) > CurTime() then return end
-
+
self.LastUse = CurTime() + 1.0
-
+
if IsValid( self.Entity:GetUser() ) then
-
+
self.Entity:SetUser()
ply:ToggleStashMenu( self.Entity, false, "StashMenu" )
-
+
end
end
@@ -104,18 +104,18 @@ end
function ENT:OnUsed( ply )
if ( self.LastUse or 0 ) > CurTime() then return end
-
+
self.LastUse = CurTime() + 1.0
if IsValid( self.Entity:GetUser() ) and self.Entity:GetUser() != ply then return end
-
+
if not IsValid( self.Entity:GetUser() ) then
-
+
ply:SynchCash( self.Cash )
-
+
self.Entity:SetUser( ply )
ply:ToggleStashMenu( self.Entity, true, "StashMenu" )
-
+
end
end
@@ -127,7 +127,7 @@ end
function ENT:GetItems()
return self.Items
-
+
end
function ENT:AddItem( id )
@@ -135,7 +135,7 @@ function ENT:AddItem( id )
self.Items = self.Items or {}
table.insert( self.Items, id )
-
+
self.Entity:Synch()
end
@@ -143,17 +143,17 @@ end
function ENT:RemoveItem( id )
for k,v in pairs( self.Items ) do
-
+
if v == id then
-
+
self.Entity:Synch()
-
+
table.remove( self.Items, k )
-
+
return
-
+
end
-
+
end
end
@@ -161,10 +161,9 @@ end
function ENT:Synch()
if IsValid( self.Entity:GetUser() ) then
-
+
self.Entity:GetUser():SynchStash( self.Entity )
-
+
end
end
-
diff --git a/entities/entities/point_stash/shared.lua b/entities/entities/point_stash/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/point_stash/shared.lua
+++ b/entities/entities/point_stash/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_antidote/cl_init.lua b/entities/entities/sent_antidote/cl_init.lua
index 88a116a..7d6f889 100644
--- a/entities/entities/sent_antidote/cl_init.lua
+++ b/entities/entities/sent_antidote/cl_init.lua
@@ -8,7 +8,7 @@ function ENT:Initialize()
end
function ENT:Think()
-
+
end
local matLight = Material( "toxsin/allyvision" )
@@ -16,29 +16,29 @@ local matLight = Material( "toxsin/allyvision" )
function ENT:Draw()
self.Entity:DrawModel()
-
+
end
-
+
--[[local scale = ( math.Clamp( self.Entity:GetPos():Distance( LocalPlayer():GetPos() ), 500, 3000 ) - 500 ) / 2500
-
+
local eyenorm = self.Entity:GetPos() - EyePos()
local dist = eyenorm:Length()
eyenorm:Normalize()
-
+
local pos = EyePos() + eyenorm * dist * 0.01
-
+
cam.Start3D( pos, EyeAngles() )
-
+
render.SetColorModulation( 0, 1.0, 0.5 )
render.SetBlend( scale )
render.MaterialOverride( matLight )
-
+
self.Entity:DrawModel()
-
+
render.SetColorModulation( 1, 1, 1 )
render.SetBlend( 1 )
render.MaterialOverride( 0 )
-
+
cam.End3D()
-
-end]] \ No newline at end of file
+
+end]]
diff --git a/entities/entities/sent_antidote/init.lua b/entities/entities/sent_antidote/init.lua
index 8fc742d..62ba1ad 100644
--- a/entities/entities/sent_antidote/init.lua
+++ b/entities/entities/sent_antidote/init.lua
@@ -7,32 +7,32 @@ ENT.Cure = Sound( "ItemBattery.Touch" )
ENT.Model = Model( "models/Items/item_item_crate.mdl" )
function ENT:Initialize()
-
+
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
end
-
+
self.Entity:SetColor( Color( 150, 255, 200, 255 ) )
-
+
self.CureCount = math.max( team.NumPlayers( TEAM_ARMY ) / 2, 1 )
end
-function ENT:Think()
-
-end
+function ENT:Think()
+
+end
function ENT:SetOverride()
@@ -57,30 +57,30 @@ function ENT:Use( ply, caller )
if self.Removing then return end
if ply:IsInfected() then
-
+
ply:SetInfected( false )
ply:AddStamina( 20 )
ply:EmitSound( self.Cure )
ply:Notice( "Your infection has been cured", GAMEMODE.Colors.Green )
if not self.Override then
-
+
self.CureCount = self.CureCount - 1
-
+
end
-
+
end
-
+
if self.CureCount < 1 then
-
+
self.Entity:Remove()
-
+
end
end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
diff --git a/entities/entities/sent_antidote/shared.lua b/entities/entities/sent_antidote/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_antidote/shared.lua
+++ b/entities/entities/sent_antidote/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_barrel_biohazard/cl_init.lua b/entities/entities/sent_barrel_biohazard/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_barrel_biohazard/cl_init.lua
+++ b/entities/entities/sent_barrel_biohazard/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_barrel_biohazard/init.lua b/entities/entities/sent_barrel_biohazard/init.lua
index b776619..f7bcf1a 100644
--- a/entities/entities/sent_barrel_biohazard/init.lua
+++ b/entities/entities/sent_barrel_biohazard/init.lua
@@ -16,21 +16,21 @@ function ENT:Initialize()
self.Entity:SetModel( self.Model )
self.Entity:SetSkin( skin )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -46,66 +46,66 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
if v:GetPos():Distance( self.Entity:GetPos() ) < 200 and not v:IsInfected() and v:Alive() then
-
+
v:SetInfected( true )
-
+
end
-
+
end
-
+
for i=1, math.random( 2, 4 ) do
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "barrel_gib", ed, true, true )
-
+
end
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "biohazard", ed, true, true )
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -117,21 +117,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_barrel_biohazard/shared.lua b/entities/entities/sent_barrel_biohazard/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_barrel_biohazard/shared.lua
+++ b/entities/entities/sent_barrel_biohazard/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_barrel_radioactive/cl_init.lua b/entities/entities/sent_barrel_radioactive/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_barrel_radioactive/cl_init.lua
+++ b/entities/entities/sent_barrel_radioactive/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_barrel_radioactive/init.lua b/entities/entities/sent_barrel_radioactive/init.lua
index ef2fcd0..ba55d36 100644
--- a/entities/entities/sent_barrel_radioactive/init.lua
+++ b/entities/entities/sent_barrel_radioactive/init.lua
@@ -16,21 +16,21 @@ function ENT:Initialize()
self.Entity:SetModel( self.Model )
self.Entity:SetSkin( skin )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -46,60 +46,60 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
for i=1, math.random( 2, 4 ) do
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "barrel_gib", ed, true, true )
-
+
end
-
+
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "rad_explosion", ed, true, true )
-
- local ent = ents.Create( "sent_radiation" )
+
+ local ent = ents.Create( "sent_radiation" )
ent:SetPos( self.Entity:GetPos() )
ent:Spawn()
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -111,21 +111,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_barrel_radioactive/shared.lua b/entities/entities/sent_barrel_radioactive/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_barrel_radioactive/shared.lua
+++ b/entities/entities/sent_barrel_radioactive/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_bonuscrate/cl_init.lua b/entities/entities/sent_bonuscrate/cl_init.lua
index f1cad0f..fa2c2a9 100644
--- a/entities/entities/sent_bonuscrate/cl_init.lua
+++ b/entities/entities/sent_bonuscrate/cl_init.lua
@@ -8,6 +8,5 @@ end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_bonuscrate/init.lua b/entities/entities/sent_bonuscrate/init.lua
index 3817a61..fd61688 100644
--- a/entities/entities/sent_bonuscrate/init.lua
+++ b/entities/entities/sent_bonuscrate/init.lua
@@ -8,19 +8,19 @@ ENT.Open = Sound( "Wood.Strain" )
ENT.Model = Model( "models/items/ammocrate_smg1.mdl" )
function ENT:Initialize()
-
+
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 200 )
@@ -29,33 +29,33 @@ function ENT:Initialize()
self.Removing = false
self.Contents = { 1 }
self.Users = {}
- self.Uses = math.random( 1, 5 )
+ self.Uses = math.random( 1, 5 )
end
-function ENT:Think()
-
-end
+function ENT:Think()
+
+end
function ENT:GenerateContents()
self.Contents = {}
-
+
local tbl = { ITEM_WPN_COMMON, ITEM_AMMO, ITEM_AMMO }
-
+
if math.random( 1, 50 ) == 1 then
-
+
tbl = { ITEM_WPN_SPECIAL, ITEM_AMMO, ITEM_AMMO }
-
+
end
for k,v in pairs( tbl ) do
-
+
local tbl = item.RandomItem( v )
local id = tbl.ID
-
+
table.insert( self.Contents, id )
-
+
end
end
@@ -72,15 +72,15 @@ function ENT:Use( ply, caller )
self.Entity:EmitSound( self.Open )
self.Entity:GenerateContents()
-
+
ply:AddMultipleToInventory( self.Contents )
-
+
table.insert( self.Users, ply )
-
- if table.Count( self.Users ) == self.Uses then
+
+ if table.Count( self.Users ) == self.Uses then
self.Entity:Remove()
-
+
end
end
@@ -88,10 +88,9 @@ end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.Bang )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_bonuscrate/shared.lua b/entities/entities/sent_bonuscrate/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_bonuscrate/shared.lua
+++ b/entities/entities/sent_bonuscrate/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_c4/cl_init.lua b/entities/entities/sent_c4/cl_init.lua
index 1821218..daa3d14 100644
--- a/entities/entities/sent_c4/cl_init.lua
+++ b/entities/entities/sent_c4/cl_init.lua
@@ -4,7 +4,7 @@ function ENT:Initialize()
self.Light = Material( "sprites/light_glow02_add" )
self.Beep = CurTime() + 1
-
+
end
function ENT:OnRemove()
@@ -14,23 +14,22 @@ end
function ENT:Think()
if self.Beep < CurTime() then
-
+
self.Beep = CurTime() + 1
-
+
end
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
+
if self.Beep <= ( CurTime() + 0.1 ) then
-
+
render.SetMaterial( self.Light )
render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * -5, 6, 6, Color( 255, 0, 0 ) )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_c4/init.lua b/entities/entities/sent_c4/init.lua
index 3410fca..56d6548 100644
--- a/entities/entities/sent_c4/init.lua
+++ b/entities/entities/sent_c4/init.lua
@@ -13,25 +13,25 @@ ENT.Radius = 600
function ENT:Initialize()
self.Entity:SetModel( Model( "models/weapons/w_c4.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
self.Delay = CurTime() + 10
self.Beep = CurTime() + 1
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -43,19 +43,19 @@ end
function ENT:Think()
if self.Delay < CurTime() then
-
+
self.Entity:Explode()
-
+
end
if self.Beep < CurTime() then
-
+
self.Beep = CurTime() + 1
-
+
self.Entity:EmitSound( self.BeepSound, 100, 120 )
-
+
end
-
+
end
function ENT:Explode()
@@ -67,41 +67,41 @@ function ENT:Explode()
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "c4_explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos()
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 1.2 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
-
+
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
for k,v in pairs( player.GetAll() ) do
-
+
if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then
-
+
v:SetBleeding( true )
-
+
end
-
+
end
-
+
self.Entity:Remove()
end
@@ -111,10 +111,9 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
-
-end
+end
diff --git a/entities/entities/sent_c4/shared.lua b/entities/entities/sent_c4/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_c4/shared.lua
+++ b/entities/entities/sent_c4/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_cash/cl_init.lua b/entities/entities/sent_cash/cl_init.lua
index d0fb196..ccd47eb 100644
--- a/entities/entities/sent_cash/cl_init.lua
+++ b/entities/entities/sent_cash/cl_init.lua
@@ -6,13 +6,12 @@ function ENT:Initialize()
end
function ENT:Think()
-
+
end
function ENT:Draw()
//self.Entity:SetModelScale( Vector(1,1,1) + Vector(1,1,1) * math.sin( CurTime() * 3 ) * 0.1 )
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_cash/init.lua b/entities/entities/sent_cash/init.lua
index 1adb29e..eeb88fc 100644
--- a/entities/entities/sent_cash/init.lua
+++ b/entities/entities/sent_cash/init.lua
@@ -4,69 +4,69 @@ AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
function ENT:Initialize()
-
+
self.Entity:SetModel( Model( "models/props/cs_assault/money.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
end
-
+
self.Cash = 0
self.NPCThink = 0
self.RemoveTime = CurTime() + 10 * 60
end
-function ENT:Think()
+function ENT:Think()
if self.NPCThink < CurTime() then
-
+
self.NPCThink = CurTime() + 10
-
+
for k,v in pairs( ents.FindByClass( "npc_trader*" ) ) do
-
+
if v:GetPos():Distance( self.Entity:GetPos() ) < 50 then
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:ApplyForceCenter( ( self.Entity:GetPos() - v:GetPos() ):Normalize() * phys:GetMass() * 100 )
-
+
return
-
+
end
-
+
end
-
+
end
-
+
if self.RemoveTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
-
+
end
-
-end
+
+end
function ENT:SetCash( amt )
self.Cash = amt
-
+
self.Entity:SetNWInt( "Cash", amt )
-
+
end
function ENT:GetCash()
@@ -76,9 +76,9 @@ function ENT:GetCash()
end
function ENT:Use( ply, caller )
-
+
ply:AddCash( self.Cash )
-
+
self.Entity:Remove()
end
diff --git a/entities/entities/sent_cash/shared.lua b/entities/entities/sent_cash/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_cash/shared.lua
+++ b/entities/entities/sent_cash/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_dropflare/cl_init.lua b/entities/entities/sent_dropflare/cl_init.lua
index 3ff2828..0ed93cc 100644
--- a/entities/entities/sent_dropflare/cl_init.lua
+++ b/entities/entities/sent_dropflare/cl_init.lua
@@ -2,17 +2,17 @@ include('shared.lua')
function ENT:Initialize()
- self.Emitter = ParticleEmitter( self.Entity:GetPos() )
+ self.Emitter = ParticleEmitter( self.Entity:GetPos() )
self.Smoke = 0
-
+
end
function ENT:OnRemove()
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
end
@@ -20,11 +20,11 @@ end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end
-
+
if self.Smoke < CurTime() then
-
+
self.Smoke = CurTime() + 0.2
-
+
local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 )
particle:SetVelocity( VectorRand() * 5 + WindVector + Vector(0,0,10) )
particle:SetDieTime( math.Rand( 2.5, 5.0 ) )
@@ -33,16 +33,16 @@ function ENT:Think()
particle:SetStartSize( math.random( 3, 6 ) )
particle:SetEndSize( math.random( 25, 50 ) )
particle:SetGravity( Vector( 0, 0, 10 ) )
-
+
local col = math.random( 100, 150 )
particle:SetColor( col, col + 50, col )
-
+
end
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Entity:GetPos()
dlight.r = 50
dlight.g = 255
@@ -51,9 +51,9 @@ function ENT:Think()
dlight.Decay = 2048
dlight.size = 256 * math.Rand( 0.5, 1.0 )
dlight.DieTime = CurTime() + 1
-
+
end
-
+
end
local matFlare = Material( "effects/blueflare1" )
@@ -63,11 +63,10 @@ function ENT:Draw()
self.Entity:DrawModel()
if self.Entity:GetNWFloat( "BurnDelay", CurTime() + 1 ) > CurTime() then return end
-
+
local size = math.Rand( 5, 25 )
-
+
render.SetMaterial( matFlare )
- render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 50, 255, 50, 255 ) )
-
-end
+ render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 50, 255, 50, 255 ) )
+end
diff --git a/entities/entities/sent_dropflare/init.lua b/entities/entities/sent_dropflare/init.lua
index b806886..a9ff1a2 100644
--- a/entities/entities/sent_dropflare/init.lua
+++ b/entities/entities/sent_dropflare/init.lua
@@ -9,29 +9,29 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" )
function ENT:Initialize()
self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 10 )
-
+
end
-
+
self.DieTime = CurTime() + 15
-
+
self.Entity:EmitSound( "Weapon_SMG1.Special1", 100, 80 )
-
+
end
function ENT:SetDieTime( t )
@@ -43,21 +43,21 @@ end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then
-
+
if not self.Burning then
-
+
self.Burning = true
self.Entity:EmitSound( self.Burn )
self.Entity:EmitSound( self.Explode, 100, math.random(90,110) )
-
+
end
-
+
end
-
+
if self.DieTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
end
@@ -69,16 +69,15 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
-
+
end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
-
diff --git a/entities/entities/sent_dropflare/shared.lua b/entities/entities/sent_dropflare/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_dropflare/shared.lua
+++ b/entities/entities/sent_dropflare/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_droppedgun/cl_init.lua b/entities/entities/sent_droppedgun/cl_init.lua
index f1cad0f..fa2c2a9 100644
--- a/entities/entities/sent_droppedgun/cl_init.lua
+++ b/entities/entities/sent_droppedgun/cl_init.lua
@@ -8,6 +8,5 @@ end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_droppedgun/init.lua b/entities/entities/sent_droppedgun/init.lua
index 20d6571..9d8a1ec 100644
--- a/entities/entities/sent_droppedgun/init.lua
+++ b/entities/entities/sent_droppedgun/init.lua
@@ -4,46 +4,46 @@ AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
function ENT:Initialize()
-
+
if string.find( self.Entity:GetModel(), "hammer" ) or string.find( self.Entity:GetModel(), "axe" ) then
local model = self.Entity:GetModel()
-
+
self.Entity:SetModel( "models/props_canal/mattpipe.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetModel( model )
-
+
//self.Entity:PhysicsInitBox( Vector(-5,-5,-5), Vector(5,5,5) )
else
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
-
+
end
-
+
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
end
end
-function ENT:Think()
-
-end
+function ENT:Think()
+
+end
function ENT:Use( ply, caller )
if ply:Team() != TEAM_ARMY then return end
-
+
ply:AddToInventory( self.Entity )
end
diff --git a/entities/entities/sent_droppedgun/shared.lua b/entities/entities/sent_droppedgun/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_droppedgun/shared.lua
+++ b/entities/entities/sent_droppedgun/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_fire/cl_init.lua b/entities/entities/sent_fire/cl_init.lua
index fb83991..a99621b 100644
--- a/entities/entities/sent_fire/cl_init.lua
+++ b/entities/entities/sent_fire/cl_init.lua
@@ -4,10 +4,10 @@ include('shared.lua')
function ENT:Initialize()
self.Emitter = ParticleEmitter( self.Entity:GetPos() )
-
+
self.SmokeTime = 0
self.LightTime = 0
-
+
self.Entity:DoTraces()
end
@@ -15,28 +15,28 @@ end
function ENT:DoTraces()
if self.Entity:GetPos() == Vector(0,0,0) then return end
-
+
self.PosTbl = {}
for i=-30,30 do
-
+
for j=-30,30 do
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector( i * 2, j * 2, 10 )
trace.endpos = trace.start + Vector(0,0,200)
-
+
local tr = util.TraceLine( trace )
-
+
trace.start = tr.HitPos
trace.endpos = trace.start + Vector( 0, 0, -2000 )
-
+
local tr2 = util.TraceLine( trace )
-
+
table.insert( self.PosTbl, { Pos = tr2.HitPos, Scale = ( ( 30 - math.abs( i ) ) + ( 30 - math.abs( j ) ) ) / 60 } )
-
+
end
-
+
end
end
@@ -44,15 +44,15 @@ end
function ENT:Think()
if not self.PosTbl then
-
+
self.Entity:DoTraces()
-
+
if not self.PosTbl then return end
-
+
end
local tbl = table.Random( self.PosTbl )
-
+
local particle = self.Emitter:Add( "effects/muzzleflash" .. math.random(1,4), tbl.Pos + ( VectorRand() * 2 ) )
particle:SetVelocity( Vector(0,0,80) )
particle:SetDieTime( math.Rand( 0.2, 0.4 ) + math.Rand( 0.3, 0.6 ) * tbl.Scale )
@@ -63,11 +63,11 @@ function ENT:Think()
particle:SetRoll( math.random(-180,180) )
particle:SetColor( 255, 200, 200 )
particle:SetGravity( Vector( 0, 0, 400 + ( tbl.Scale * 100 ) ) )
-
+
if self.SmokeTime < CurTime() then
-
+
self.SmokeTime = CurTime() + 0.02
-
+
local particle = self.Emitter:Add( "particles/smokey", tbl.Pos + ( VectorRand() * 2 ) + Vector(0,0,50) )
particle:SetVelocity( Vector( 0, 0, 30 + tbl.Scale * 10 ) )
particle:SetDieTime( math.Rand( 0.5, 1.0 ) + ( tbl.Scale * math.Rand( 2.5, 3.5 ) ) )
@@ -78,17 +78,17 @@ function ENT:Think()
particle:SetRoll( 0 )
particle:SetColor( 10, 10, 10 )
particle:SetGravity( Vector( 0, 0, 30 ) )
-
+
end
-
+
if self.LightTime < CurTime() then
-
+
self.LightTime = CurTime() + 0.05
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Entity:GetPos()
dlight.r = 255
dlight.g = 120
@@ -97,9 +97,9 @@ function ENT:Think()
dlight.Decay = 2048
dlight.size = 256 * math.Rand( 0.8, 1.2 )
dlight.DieTime = CurTime() + 1
-
+
end
-
+
end
end
@@ -107,14 +107,13 @@ end
function ENT:OnRemove()
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
end
function ENT:Draw()
-
-end
+end
diff --git a/entities/entities/sent_fire/init.lua b/entities/entities/sent_fire/init.lua
index d643ada..2be7870 100644
--- a/entities/entities/sent_fire/init.lua
+++ b/entities/entities/sent_fire/init.lua
@@ -8,22 +8,22 @@ ENT.LifeTime = 10
ENT.Explosives = { "sent_oxygen", "sent_propane_canister", "sent_propane_tank", "sent_fuel_diesel", "sent_fuel_gas" }
function ENT:Initialize()
-
+
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_NONE )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER )
self.Entity:SetTrigger( true )
self.Entity:SetNotSolid( true )
- self.Entity:DrawShadow( false )
-
+ self.Entity:DrawShadow( false )
+
self.Entity:SetCollisionBounds( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) )
self.Entity:PhysicsInitBox( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) )
-
+
self.DieTime = CurTime() + self.LifeTime
-
+
self.Entity:EmitSound( self.BurnSound )
-
+
end
function ENT:SetLifeTime( num )
@@ -41,34 +41,34 @@ end
function ENT:Think()
if self.DieTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
end
-function ENT:Touch( ent )
+function ENT:Touch( ent )
if not IsValid( self.Entity:GetOwner() ) then return end
-
+
//if ent:IsPlayer() and ent:Team() == self.Entity:GetOwner():Team() then return end
-
+
if table.HasValue( self.Explosives, ent:GetClass() ) then
-
+
ent:SetOwner( self.Entity:GetOwner() )
ent:Explode()
-
+
end
-
+
if not ent.NextBot and not ent:IsPlayer() then return end
-
+
ent:DoIgnite( self.Entity:GetOwner() )
-
-end
+
+end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
diff --git a/entities/entities/sent_fire/shared.lua b/entities/entities/sent_fire/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_fire/shared.lua
+++ b/entities/entities/sent_fire/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_flare/cl_init.lua b/entities/entities/sent_flare/cl_init.lua
index d6bf3a4..44a985c 100644
--- a/entities/entities/sent_flare/cl_init.lua
+++ b/entities/entities/sent_flare/cl_init.lua
@@ -2,17 +2,17 @@ include('shared.lua')
function ENT:Initialize()
- self.Emitter = ParticleEmitter( self.Entity:GetPos() )
+ self.Emitter = ParticleEmitter( self.Entity:GetPos() )
self.Smoke = 0
-
+
end
function ENT:OnRemove()
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
end
@@ -20,11 +20,11 @@ end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end
-
+
if self.Smoke < CurTime() then
-
+
self.Smoke = CurTime() + 0.2
-
+
local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 )
particle:SetVelocity( VectorRand() * 5 + WindVector )
particle:SetDieTime( math.Rand( 2.5, 4.5 ) )
@@ -33,16 +33,16 @@ function ENT:Think()
particle:SetStartSize( math.random( 2, 4 ) )
particle:SetEndSize( math.random( 15, 30 ) )
particle:SetGravity( Vector( 0, 0, 10 ) )
-
+
local col = math.random( 100, 150 )
particle:SetColor( col + 50, col, col )
-
+
end
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Entity:GetPos()
dlight.r = 255
dlight.g = 50
@@ -51,22 +51,22 @@ function ENT:Think()
dlight.Decay = 2048
dlight.size = 512 * math.Rand( 1.50, 1.75 )
dlight.DieTime = CurTime() + 1
-
+
end
-
+
if not LocalPlayer():Alive() then return end
-
+
local dist = LocalPlayer():GetPos():Distance( self.Entity:GetPos() )
-
+
if dist < 300 then
-
+
local scale = math.Clamp( 1 - ( math.Clamp( dist, 1, 300 ) / 300 ), 0, 1 )
-
+
Sharpen = scale * 5
ColorModify[ "$pp_colour_contrast" ] = 1 + ( scale * 0.6 )
-
+
end
-
+
end
local matFlare = Material( "effects/blueflare1" )
@@ -76,11 +76,10 @@ function ENT:Draw()
self.Entity:DrawModel()
if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end
-
+
local size = math.Rand( 5, 25 )
-
+
render.SetMaterial( matFlare )
- render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 255, 50, 50, 255 ) )
-
-end
+ render.DrawSprite( self.Entity:GetPos() + self.Entity:GetRight() * 5, size, size, Color( 255, 50, 50, 255 ) )
+end
diff --git a/entities/entities/sent_flare/init.lua b/entities/entities/sent_flare/init.lua
index 7e36159..8f54afe 100644
--- a/entities/entities/sent_flare/init.lua
+++ b/entities/entities/sent_flare/init.lua
@@ -9,49 +9,49 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" )
function ENT:Initialize()
self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 10 )
-
+
end
-
+
self.DieTime = CurTime() + 60 * 5
-
+
self.Entity:EmitSound( "Weapon_SMG1.Special1", 100, 80 )
-
+
end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then
-
+
if not self.Burning then
-
+
self.Burning = true
self.Entity:EmitSound( self.Burn )
self.Entity:EmitSound( self.Explode, 100, math.random(90,110) )
-
+
end
-
+
end
-
+
if self.DieTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
end
@@ -63,16 +63,15 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
-
+
end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
-
diff --git a/entities/entities/sent_flare/shared.lua b/entities/entities/sent_flare/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_flare/shared.lua
+++ b/entities/entities/sent_flare/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_fuel_diesel/cl_init.lua b/entities/entities/sent_fuel_diesel/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_fuel_diesel/cl_init.lua
+++ b/entities/entities/sent_fuel_diesel/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_fuel_diesel/init.lua b/entities/entities/sent_fuel_diesel/init.lua
index 9340505..d9c07ba 100644
--- a/entities/entities/sent_fuel_diesel/init.lua
+++ b/entities/entities/sent_fuel_diesel/init.lua
@@ -12,21 +12,21 @@ ENT.Radius = 350
function ENT:Initialize()
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -42,50 +42,50 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
--[[local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )]]
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
local fire = ents.Create( "sent_fire" )
fire:SetPos( self.Entity:GetPos() )
fire:SetOwner( self.Entity:GetOwner() )
fire:SetLifeTime( 10 )
fire:Spawn()
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -97,21 +97,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_fuel_diesel/shared.lua b/entities/entities/sent_fuel_diesel/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_fuel_diesel/shared.lua
+++ b/entities/entities/sent_fuel_diesel/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_fuel_gas/cl_init.lua b/entities/entities/sent_fuel_gas/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_fuel_gas/cl_init.lua
+++ b/entities/entities/sent_fuel_gas/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_fuel_gas/init.lua b/entities/entities/sent_fuel_gas/init.lua
index 6672661..537c2bd 100644
--- a/entities/entities/sent_fuel_gas/init.lua
+++ b/entities/entities/sent_fuel_gas/init.lua
@@ -12,21 +12,21 @@ ENT.Radius = 350
function ENT:Initialize()
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -42,50 +42,50 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
--[[local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )]]
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
local fire = ents.Create( "sent_fire" )
fire:SetPos( self.Entity:GetPos() )
fire:SetOwner( self.Entity:GetOwner() )
fire:SetLifeTime( 12 )
fire:Spawn()
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -97,21 +97,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_fuel_gas/shared.lua b/entities/entities/sent_fuel_gas/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_fuel_gas/shared.lua
+++ b/entities/entities/sent_fuel_gas/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_grenade/cl_init.lua b/entities/entities/sent_grenade/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_grenade/cl_init.lua
+++ b/entities/entities/sent_grenade/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_grenade/init.lua b/entities/entities/sent_grenade/init.lua
index 3973d4f..07f3901 100644
--- a/entities/entities/sent_grenade/init.lua
+++ b/entities/entities/sent_grenade/init.lua
@@ -11,26 +11,26 @@ ENT.Speed = 3500
function ENT:Initialize()
self.Entity:SetModel( Model( "models/weapons/w_eq_fraggrenade_thrown.mdl") )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 5 )
phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed )
-
+
end
-
+
self.Delay = CurTime() + 3.5
-
+
end
function ENT:SetSpeed( num )
@@ -42,9 +42,9 @@ end
function ENT:Think()
if self.Delay < CurTime() then
-
+
self.Entity:Explode()
-
+
end
end
@@ -54,41 +54,41 @@ function ENT:Explode()
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) and self.Entity:GetOwner():Team() == TEAM_ARMY then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
--[[for k,v in pairs( player.GetAll() ) do
-
+
if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then
-
+
v:SetBleeding( true )
-
+
end
-
+
end]]
-
+
self.Entity:Remove()
end
@@ -98,16 +98,15 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound, 50, math.random(90,110) )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_grenade/shared.lua b/entities/entities/sent_grenade/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_grenade/shared.lua
+++ b/entities/entities/sent_grenade/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_grenade_incendiary/cl_init.lua b/entities/entities/sent_grenade_incendiary/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_grenade_incendiary/cl_init.lua
+++ b/entities/entities/sent_grenade_incendiary/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_grenade_incendiary/init.lua b/entities/entities/sent_grenade_incendiary/init.lua
index 906fe1f..a6fb1fa 100644
--- a/entities/entities/sent_grenade_incendiary/init.lua
+++ b/entities/entities/sent_grenade_incendiary/init.lua
@@ -12,26 +12,26 @@ ENT.Speed = 3500
function ENT:Initialize()
self.Entity:SetModel( Model( "models/weapons/w_eq_flashbang.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 5 )
phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed )
-
+
end
-
+
self.Delay = CurTime() + 3.5
-
+
end
function ENT:SetSpeed( num )
@@ -43,9 +43,9 @@ end
function ENT:Think()
if self.Delay < CurTime() then
-
+
self.Entity:Explode()
-
+
end
end
@@ -55,42 +55,42 @@ function ENT:Explode()
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) and self.Entity:GetOwner():Team() == TEAM_ARMY then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
local fire = ents.Create( "sent_fire" )
fire:SetPos( self.Entity:GetPos() )
fire:SetOwner( self.Entity:GetOwner() )
fire:SetLifeTime( 8 )
fire:Spawn()
-
+
--[[for k,v in pairs( player.GetAll() ) do
-
+
if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then
-
+
v:SetBleeding( true )
-
+
end
-
+
end]]
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
@@ -101,16 +101,15 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound, 50, math.random(120,140) )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_grenade_incendiary/shared.lua b/entities/entities/sent_grenade_incendiary/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_grenade_incendiary/shared.lua
+++ b/entities/entities/sent_grenade_incendiary/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_heliflare/cl_init.lua b/entities/entities/sent_heliflare/cl_init.lua
index 30e76c6..5c2884e 100644
--- a/entities/entities/sent_heliflare/cl_init.lua
+++ b/entities/entities/sent_heliflare/cl_init.lua
@@ -2,17 +2,17 @@ include('shared.lua')
function ENT:Initialize()
- self.Emitter = ParticleEmitter( self.Entity:GetPos() )
+ self.Emitter = ParticleEmitter( self.Entity:GetPos() )
self.Smoke = 0
-
+
end
function ENT:OnRemove()
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
end
@@ -20,11 +20,11 @@ end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end
-
+
if self.Smoke < CurTime() then
-
+
self.Smoke = CurTime() + 0.2
-
+
local particle = self.Emitter:Add( "particles/smokey", self.Entity:GetPos() + self.Entity:GetRight() * 5 )
particle:SetVelocity( VectorRand() * 8 + WindVector )
particle:SetDieTime( math.Rand( 4.0, 8.0 ) )
@@ -33,16 +33,16 @@ function ENT:Think()
particle:SetStartSize( 1 )
particle:SetEndSize( math.random( 50, 150 ) )
particle:SetGravity( Vector( 0, 0, 25 ) + WindVector * 1.5 )
-
+
local col = math.random( 50, 100 )
particle:SetColor( col + 150, col, col )
-
+
end
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Entity:GetPos()
dlight.r = 255
dlight.g = 50
@@ -51,22 +51,22 @@ function ENT:Think()
dlight.Decay = 0
dlight.size = 256
dlight.DieTime = CurTime() + 0.1
-
+
end
-
+
if not LocalPlayer():Alive() then return end
-
+
local dist = LocalPlayer():GetPos():Distance( self.Entity:GetPos() )
-
+
if dist < 300 then
-
+
local scale = math.Clamp( 1 - ( math.Clamp( dist, 1, 300 ) / 300 ), 0, 1 )
-
+
Sharpen = scale * 5
ColorModify[ "$pp_colour_contrast" ] = 1 + ( scale * 0.6 )
-
+
end
-
+
end
local matFlare = Material( "sprites/flareglow" )
@@ -76,9 +76,8 @@ function ENT:Draw()
self.Entity:DrawModel()
if self.Entity:GetNWFloat( "BurnDelay", 9000 ) > CurTime() then return end
-
+
render.SetMaterial( matFlare )
- render.DrawSprite( self.Entity:GetPos(), 170, 170, Color( 255, 50, 50, 255 ) )
-
-end
+ render.DrawSprite( self.Entity:GetPos(), 170, 170, Color( 255, 50, 50, 255 ) )
+end
diff --git a/entities/entities/sent_heliflare/init.lua b/entities/entities/sent_heliflare/init.lua
index 914b5c1..0f306b7 100644
--- a/entities/entities/sent_heliflare/init.lua
+++ b/entities/entities/sent_heliflare/init.lua
@@ -9,47 +9,47 @@ ENT.Explode = Sound( "weapons/flashbang/flashbang_explode1.wav" )
function ENT:Initialize()
self.Entity:SetModel( Model( "models/props_c17/trappropeller_lever.mdl" ) )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.Entity:DrawShadow( false )
-
+
self.Entity:SetNWFloat( "BurnDelay", CurTime() + 3 )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:SetDamping( 0, 10 )
-
+
end
-
+
self.DieTime = CurTime() + 45
-
+
end
function ENT:Think()
if self.Entity:GetNWFloat( "BurnDelay", 0 ) < CurTime() then
-
+
if not self.Burning then
-
+
self.Burning = true
self.Entity:EmitSound( self.Rotor )
self.Entity:EmitSound( self.Explode, 100, math.random(90,110) )
-
+
end
-
+
end
-
+
if self.DieTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
end
@@ -61,16 +61,15 @@ function ENT:OnRemove()
end
function ENT:OnTakeDamage( dmginfo )
-
+
end
function ENT:PhysicsCollide( data, phys )
-
+
end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
-
diff --git a/entities/entities/sent_heliflare/shared.lua b/entities/entities/sent_heliflare/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_heliflare/shared.lua
+++ b/entities/entities/sent_heliflare/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_lootbag/cl_init.lua b/entities/entities/sent_lootbag/cl_init.lua
index 5af3dc2..49ad7f9 100644
--- a/entities/entities/sent_lootbag/cl_init.lua
+++ b/entities/entities/sent_lootbag/cl_init.lua
@@ -10,6 +10,5 @@ function ENT:Draw()
if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != LocalPlayer() then return end
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_lootbag/init.lua b/entities/entities/sent_lootbag/init.lua
index 7a93b0a..bc9d64a 100644
--- a/entities/entities/sent_lootbag/init.lua
+++ b/entities/entities/sent_lootbag/init.lua
@@ -4,31 +4,31 @@ AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
function ENT:Initialize()
-
+
self.Entity:SetModel( "models/props_junk/garbage_bag001a.mdl" )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
end
self.LastUse = CurTime() + 1
self.Cash = 0
-
+
end
function ENT:SetCash( amt )
- self.Cash = math.Clamp( amt, 0, 32000 )
+ self.Cash = math.Clamp( amt, 0, 32000 )
end
@@ -38,18 +38,18 @@ function ENT:GetCash()
end
-function ENT:Think()
+function ENT:Think()
if ( table.Count( self.Entity:GetItems() ) < 1 and self:GetCash() < 1 ) or ( self.DieTime and self.DieTime < CurTime() ) then
-
+
self.Entity:Remove()
-
+
end
-
-end
+
+end
function ENT:SetRemoval( num )
-
+
self.DieTime = CurTime() + num
end
@@ -58,14 +58,14 @@ end
if ( self.LastUse or 0 ) > CurTime() then return end
if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != ply then return end
-
+
self.LastUse = CurTime() + 1.0
if IsValid( self.Entity:GetUser() ) then
-
+
self.Entity:SetUser()
ply:ToggleStashMenu( self.Entity, false, "StashMenu" )
-
+
end
end
@@ -74,26 +74,26 @@ function ENT:OnUsed( ply )
if ( self.LastUse or 0 ) > CurTime() then return end
if IsValid( self.Entity:GetNWEntity( "QuestOwner", nil ) ) and self.Entity:GetNWEntity( "QuestOwner", nil ) != ply then return end
-
+
self.LastUse = CurTime() + 1.0
if not IsValid( self.Entity:GetUser() ) then
-
+
ply:SynchCash( self.Cash )
-
+
self.Entity:SetUser( ply )
ply:ToggleStashMenu( self.Entity, true, "StashMenu" )
-
+
end
end]]
function ENT:Use( ply, caller )
-
+
if ply:Team() != TEAM_ARMY then return end
if self.Removing then return end
-
+
self.Removing = true
ply:AddMultipleToInventory( self.Items )
@@ -106,7 +106,7 @@ end
function ENT:GetItems()
return self.Items or {}
-
+
end
function ENT:AddItem( id )
@@ -114,7 +114,7 @@ function ENT:AddItem( id )
self.Items = self.Items or {}
table.insert( self.Items, id )
-
+
//self.Entity:Synch()
end
@@ -122,17 +122,17 @@ end
function ENT:RemoveItem( id )
for k,v in pairs( self.Items ) do
-
+
if v == id then
-
+
//self.Entity:Synch()
-
+
table.remove( self.Items, k )
-
+
return
-
+
end
-
+
end
end
@@ -140,10 +140,9 @@ end
function ENT:Synch()
--[[if IsValid( self.Entity:GetUser() ) then
-
+
self.Entity:GetUser():SynchStash( self.Entity )
-
+
end]]
end
-
diff --git a/entities/entities/sent_lootbag/shared.lua b/entities/entities/sent_lootbag/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_lootbag/shared.lua
+++ b/entities/entities/sent_lootbag/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_oxygen/cl_init.lua b/entities/entities/sent_oxygen/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_oxygen/cl_init.lua
+++ b/entities/entities/sent_oxygen/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_oxygen/init.lua b/entities/entities/sent_oxygen/init.lua
index 550be32..c2ef088 100644
--- a/entities/entities/sent_oxygen/init.lua
+++ b/entities/entities/sent_oxygen/init.lua
@@ -12,22 +12,22 @@ ENT.Speed = 3500
function ENT:Initialize()
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
phys:ApplyForceCenter( self.Entity:GetAngles():Forward() * self.Speed )
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -45,47 +45,47 @@ function ENT:Explode()
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
for k,v in pairs( player.GetAll() ) do
-
+
if v:Team() != self.Entity:GetOwner():Team() and v:GetPos():Distance( self.Entity:GetPos() ) < self.Radius then
-
+
v:SetBleeding( true )
-
+
end
-
+
end
-
+
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -97,21 +97,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound, 100, 120 )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_oxygen/shared.lua b/entities/entities/sent_oxygen/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_oxygen/shared.lua
+++ b/entities/entities/sent_oxygen/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_propane_canister/cl_init.lua b/entities/entities/sent_propane_canister/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_propane_canister/cl_init.lua
+++ b/entities/entities/sent_propane_canister/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_propane_canister/init.lua b/entities/entities/sent_propane_canister/init.lua
index b36368f..a0894cb 100644
--- a/entities/entities/sent_propane_canister/init.lua
+++ b/entities/entities/sent_propane_canister/init.lua
@@ -12,21 +12,21 @@ ENT.Radius = 350
function ENT:Initialize()
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -42,44 +42,44 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -91,21 +91,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_propane_canister/shared.lua b/entities/entities/sent_propane_canister/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_propane_canister/shared.lua
+++ b/entities/entities/sent_propane_canister/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_propane_tank/cl_init.lua b/entities/entities/sent_propane_tank/cl_init.lua
index 514bad0..6eb79fa 100644
--- a/entities/entities/sent_propane_tank/cl_init.lua
+++ b/entities/entities/sent_propane_tank/cl_init.lua
@@ -1,7 +1,7 @@
include('shared.lua')
function ENT:Initialize()
-
+
end
function ENT:OnRemove()
@@ -9,12 +9,11 @@ function ENT:OnRemove()
end
function ENT:Think()
-
+
end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_propane_tank/init.lua b/entities/entities/sent_propane_tank/init.lua
index caadbf5..8cc24f3 100644
--- a/entities/entities/sent_propane_tank/init.lua
+++ b/entities/entities/sent_propane_tank/init.lua
@@ -12,21 +12,21 @@ ENT.Radius = 350
function ENT:Initialize()
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
//self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
-
+
end
-
+
end
function ENT:SetSpeed( num )
@@ -42,44 +42,44 @@ end
function ENT:Explode()
if self.Exploded then return end
-
+
self.Exploded = true
local ed = EffectData()
ed:SetOrigin( self.Entity:GetPos() )
util.Effect( "Explosion", ed, true, true )
-
+
local trace = {}
trace.start = self.Entity:GetPos() + Vector(0,0,20)
trace.endpos = trace.start + Vector( 0, 0, -200 )
trace.filter = self.Entity
-
+
local tr = util.TraceLine( trace )
if tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.8 )
util.Effect( "smoke_crater", ed, true, true )
-
+
util.Decal( "Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
-
+
end
if IsValid( self.Entity:GetOwner() ) then
-
+
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), self.Radius, self.Damage )
-
+
end
-
+
self.Entity:EmitSound( self.DieSound, 100, math.random(90,110) )
self.Entity:Remove()
end
function ENT:Use( ply, caller )
-
+
ply:AddToInventory( self.Entity )
end
@@ -91,21 +91,20 @@ end
function ENT:OnTakeDamage( dmginfo )
if dmginfo:IsBulletDamage() and IsValid( dmginfo:GetAttacker() ) and dmginfo:GetAttacker():IsPlayer() then
-
+
self.Entity:SetOwner( dmginfo:GetAttacker() )
self.Entity:Explode()
-
+
end
-
+
end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.HitSound )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_propane_tank/shared.lua b/entities/entities/sent_propane_tank/shared.lua
index 8b0a8a2..1036ddc 100644
--- a/entities/entities/sent_propane_tank/shared.lua
+++ b/entities/entities/sent_propane_tank/shared.lua
@@ -1,2 +1,2 @@
ENT.Type = "anim"
-ENT.Base = "base_anim" \ No newline at end of file
+ENT.Base = "base_anim"
diff --git a/entities/entities/sent_radiation/cl_init.lua b/entities/entities/sent_radiation/cl_init.lua
index e07f410..44beb90 100644
--- a/entities/entities/sent_radiation/cl_init.lua
+++ b/entities/entities/sent_radiation/cl_init.lua
@@ -12,26 +12,26 @@ end
function ENT:Think()
self.Scale = ( self.DieTime - CurTime() ) / 30
-
+
if self.LightTime < CurTime() then
-
+
self.LightTime = CurTime() + 0.1
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Entity:GetPos()
dlight.r = 150
dlight.g = 255
dlight.b = 50
dlight.Brightness = 2
dlight.Decay = 0
- dlight.size = self.Scale * self.Entity:GetNWInt( "Distance", 300 )
+ dlight.size = self.Scale * self.Entity:GetNWInt( "Distance", 300 )
dlight.DieTime = CurTime() + 1
-
+
end
-
+
end
end
@@ -39,14 +39,13 @@ end
function ENT:OnRemove()
if self.Emitter then
-
+
self.Emitter:Finish()
-
+
end
end
function ENT:Draw()
-
-end
+end
diff --git a/entities/entities/sent_radiation/init.lua b/entities/entities/sent_radiation/init.lua
index 52eabb4..3c3f6a2 100644
--- a/entities/entities/sent_radiation/init.lua
+++ b/entities/entities/sent_radiation/init.lua
@@ -7,21 +7,21 @@ ENT.Scale = 1
ENT.Distance = 300
function ENT:Initialize()
-
+
self.Entity:SetMoveType( MOVETYPE_NONE )
self.Entity:SetSolid( SOLID_NONE )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER )
self.Entity:SetNotSolid( true )
- self.Entity:DrawShadow( false )
-
+ self.Entity:DrawShadow( false )
+
self.Entity:SetCollisionBounds( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) )
self.Entity:PhysicsInitBox( Vector( -60, -60, -60 ), Vector( 60, 60, 60 ) )
-
+
self.Entity:SetNWInt( "Distance", self.Distance )
-
+
self.DieTime = CurTime() + 30
-
+
end
function ENT:SetDistance( num )
@@ -43,48 +43,48 @@ end
function ENT:Think()
if self.DieTime < CurTime() then
-
+
self.Entity:Remove()
-
+
end
-
+
self.Scale = ( self.DieTime - CurTime() ) / 30
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
local dist = v:GetPos():Distance( self.Entity:GetPos() )
-
+
if dist < ( self.Distance * self.Scale ) + 100 then
-
+
if dist < ( self.Distance * self.Scale ) then
-
+
if ( v.RadAddTime or 0 ) < CurTime() then
-
+
v.RadAddTime = CurTime() + 8
v:AddRadiation( 1 )
-
+
end
-
+
end
-
+
if ( v.NextRadSound or 0 ) < CurTime() then
-
+
local scale = math.Clamp( ( ( self.Distance * self.Scale ) + 100 - dist ) / ( ( self.Distance * self.Scale ) ), 0.1, 1.0 )
-
- v.NextRadSound = CurTime() + 1 - scale
+
+ v.NextRadSound = CurTime() + 1 - scale
v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random( 80, 90 ) + scale * 20 )
v:NoticeOnce( "A radioactive deposit is nearby", GAMEMODE.Colors.Blue )
-
+
end
-
+
end
-
+
end
end
function ENT:UpdateTransmitState()
- return TRANSMIT_ALWAYS
+ return TRANSMIT_ALWAYS
end
diff --git a/entities/entities/sent_radiation/shared.lua b/entities/entities/sent_radiation/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_radiation/shared.lua
+++ b/entities/entities/sent_radiation/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/entities/sent_supplycrate/cl_init.lua b/entities/entities/sent_supplycrate/cl_init.lua
index f1cad0f..fa2c2a9 100644
--- a/entities/entities/sent_supplycrate/cl_init.lua
+++ b/entities/entities/sent_supplycrate/cl_init.lua
@@ -8,6 +8,5 @@ end
function ENT:Draw()
self.Entity:DrawModel()
-
-end
+end
diff --git a/entities/entities/sent_supplycrate/init.lua b/entities/entities/sent_supplycrate/init.lua
index 932ca4e..07d3389 100644
--- a/entities/entities/sent_supplycrate/init.lua
+++ b/entities/entities/sent_supplycrate/init.lua
@@ -8,23 +8,23 @@ ENT.Open = Sound( "Wood.Strain" )
ENT.Model = Model( "models/Items/item_item_crate.mdl" )
function ENT:Initialize()
-
+
self.Entity:SetModel( self.Model )
-
+
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
-
+
self.Entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
local phys = self.Entity:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:Wake()
end
-
+
self.Entity:SetColor( Color( 255, 200, 150, 255 ) )
self.Removing = false
@@ -32,13 +32,13 @@ function ENT:Initialize()
end
-function ENT:Think()
-
+function ENT:Think()
+
if IsValid( self.User ) and self.User:Alive() and self.User:Team() == TEAM_ARMY then return end
-
+
self.Entity:SetColor( Color( 255, 255, 150, 255 ) )
-
-end
+
+end
function ENT:SetContents( tbl )
@@ -55,7 +55,7 @@ end
function ENT:Use( ply, caller )
if IsValid( self.User ) and self.User:Alive() and self.User:Team() == TEAM_ARMY and ply != self.User then return end
-
+
if ply:Team() != TEAM_ARMY then return end
if self.Removing then return end
@@ -70,10 +70,9 @@ end
function ENT:PhysicsCollide( data, phys )
if data.Speed > 50 and data.DeltaTime > 0.15 then
-
+
self.Entity:EmitSound( self.Bang )
-
+
end
-
-end
+end
diff --git a/entities/entities/sent_supplycrate/shared.lua b/entities/entities/sent_supplycrate/shared.lua
index 8e216e2..1036ddc 100644
--- a/entities/entities/sent_supplycrate/shared.lua
+++ b/entities/entities/sent_supplycrate/shared.lua
@@ -1,3 +1,2 @@
ENT.Type = "anim"
ENT.Base = "base_anim"
-
diff --git a/entities/weapons/rad_ak47/shared.lua b/entities/weapons/rad_ak47/shared.lua
index 36d2799..a0001df 100644
--- a/entities/weapons/rad_ak47/shared.lua
+++ b/entities/weapons/rad_ak47/shared.lua
@@ -1,16 +1,16 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
-
+
SWEP.PrintName = "AK-47"
SWEP.IconLetter = "b"
SWEP.Slot = 4
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
diff --git a/entities/weapons/rad_awp/shared.lua b/entities/weapons/rad_awp/shared.lua
index f20fd07..64a656b 100644
--- a/entities/weapons/rad_awp/shared.lua
+++ b/entities/weapons/rad_awp/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "AWP"
SWEP.IconLetter = "r"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
diff --git a/entities/weapons/rad_base/shared.lua b/entities/weapons/rad_base/shared.lua
index 63ef374..684572f 100644
--- a/entities/weapons/rad_base/shared.lua
+++ b/entities/weapons/rad_base/shared.lua
@@ -1,11 +1,11 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
SWEP.Weight = 1
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
-
+
end
if CLIENT then
@@ -16,18 +16,18 @@ if CLIENT then
SWEP.ViewModelFOV = 75
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "BASE WEAPON"
SWEP.IconLetter = "c"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
SWEP.IconFont = "CSSelectIcons"
-
+
function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
//draw.SimpleText( self.IconLetter, self.IconFont, x + wide/2, y + tall/2.5, Color( 15, 20, 200, 255 ), TEXT_ALIGN_CENTER )
end
-
+
end
SWEP.HoldType = "pistol"
@@ -84,7 +84,7 @@ SWEP.FalloffDistances[ "Buckshot" ] = { Range = 300, Falloff = 500 }
SWEP.UseShellSounds = true
SWEP.ShellSounds = { "player/pl_shell1.wav", "player/pl_shell2.wav", "player/pl_shell3.wav" }
-SWEP.BuckshotShellSounds = { "weapons/fx/tink/shotgun_shell1.wav", "weapons/fx/tink/shotgun_shell2.wav", "weapons/fx/tink/shotgun_shell3.wav" }
+SWEP.BuckshotShellSounds = { "weapons/fx/tink/shotgun_shell1.wav", "weapons/fx/tink/shotgun_shell2.wav", "weapons/fx/tink/shotgun_shell3.wav" }
SWEP.Pitches = {}
SWEP.Pitches[ "Pistol" ] = 100
@@ -169,19 +169,19 @@ end
function SWEP:GetMoveScale( movetime, duration, mul )
mul = 1
-
+
if CurTime() - movetime < duration then
-
+
mul = math.Clamp( ( CurTime() - duration ) / movetime, 0, 1 )
-
+
end
-
+
if self.Weapon:GetNWBool( "ReverseAnim", false ) then
-
+
return -( mul - 1 ) ^ 3
-
+
end
-
+
return ( mul - 1 ) ^ 3 + 1
end
@@ -193,23 +193,23 @@ function SWEP:AngApproach( newang, ang, mul )
ang:RotateAroundAxis( ang:Right(), newang.x * mul )
ang:RotateAroundAxis( ang:Up(), newang.y * mul )
ang:RotateAroundAxis( ang:Forward(), newang.z * mul )
-
+
return ang
end
-function SWEP:PosApproach( newpos, pos, ang, mul )
+function SWEP:PosApproach( newpos, pos, ang, mul )
local right = ang:Right()
local up = ang:Up()
local forward = ang:Forward()
-
+
if not newpos then return pos end
pos = pos + newpos.x * right * mul
pos = pos + newpos.y * forward * mul
pos = pos + newpos.z * up * mul
-
+
return pos
end
@@ -218,7 +218,7 @@ function SWEP:MoveViewModelTo( newpos, newang, pos, ang, mul )
ang = self:AngApproach( newang, ang, mul )
pos = self:PosApproach( newpos, pos, ang, mul )
-
+
return pos, ang
end
@@ -226,40 +226,40 @@ end
function SWEP:Initialize()
self.Weapon:SetWeaponHoldType( self.HoldType )
-
+
end
function SWEP:Deploy()
if SERVER then
-
+
self.Weapon:SetZoomMode( 1 )
self.Owner:DrawViewModel( true )
-
- end
+
+ end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+end
function SWEP:Holster()
-
+
return true
end
-function SWEP:Think()
+function SWEP:Think()
self.Weapon:ReloadThink()
if self.Owner:GetVelocity():Length() > 0 and self.Owner:KeyDown( IN_SPEED ) then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
self.Weapon:UnZoom()
-
+
end
end
@@ -267,19 +267,19 @@ end
function SWEP:SetZoomMode( num )
if num > #self.ZoomModes then
-
+
num = 1
self.Weapon:UnZoom()
-
+
end
-
+
self.Weapon:SetNWInt( "Mode", num )
-
+
if self.Owner:GetFOV() != self.ZoomModes[num] then
-
+
self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] )
-
+
end
end
@@ -287,7 +287,7 @@ end
function SWEP:GetZoomMode()
return self.Weapon:GetNWInt( "Mode", 1 )
-
+
end
function SWEP:UnZoom()
@@ -296,67 +296,67 @@ function SWEP:UnZoom()
self.Weapon:SetZoomMode( 1 )
self.Weapon:SetNWBool( "ReverseAnim", true )
-
+
self.Owner:DrawViewModel( true )
-
+
end
function SWEP:Reload()
if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end
-
- if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
-
+
+ if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
+
self.Weapon:SetClip1( self.Primary.ClipSize )
-
+
return
-
+
end
if self.Weapon:GetZoomMode() != 1 then
-
+
self.Weapon:UnZoom()
-
- end
+
+ end
self.Weapon:DoReload()
-
+
end
function SWEP:StartWeaponAnim( anim )
-
+
if IsValid( self.Owner ) then
-
+
local vm = self.Owner:GetViewModel()
-
+
local idealSequence = self:SelectWeightedSequence( anim )
local nextSequence = self:FindTransitionSequence( self.Weapon:GetSequence(), idealSequence )
-
+
//vm:RemoveEffects( EF_NODRAW )
//vm:SetPlaybackRate( pbr )
if nextSequence > 0 then
-
+
vm:SendViewModelMatchingSequence( nextSequence )
-
+
else
-
+
vm:SendViewModelMatchingSequence( idealSequence )
-
+
end
return vm:SequenceDuration( vm:GetSequence() )
-
- end
-
+
+ end
+
end
function SWEP:DoReload()
local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD )
-
+
self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.080 )
-
+
self.ReloadTime = CurTime() + time
end
@@ -364,10 +364,10 @@ end
function SWEP:ReloadThink()
if self.ReloadTime and self.ReloadTime <= CurTime() then
-
+
self.ReloadTime = nil
self.Weapon:SetClip1( self.Primary.ClipSize )
-
+
end
end
@@ -377,120 +377,120 @@ function SWEP:CanSecondaryAttack()
if self.HolsterMode or self.Owner:KeyDown( IN_SPEED ) or self.LastRunFrame > CurTime() then return false end
if self.Weapon:Clip1() <= 0 and self.IsSniper then
-
+
if self.Weapon:GetZoomMode() != 1 then
-
+
self.Weapon:UnZoom()
-
+
end
-
+
return false
-
+
end
-
+
return true
-
+
end
function SWEP:CanPrimaryAttack()
if self.HolsterMode or self.ReloadTime or self.LastRunFrame > CurTime() then return false end
-
- if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
-
+
+ if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
-
- return false
-
+
+ return false
+
end
if self.Weapon:Clip1() <= 0 then
-
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
self.Weapon:DoReload()
-
+
if self.Weapon:GetZoomMode() != 1 then
-
+
self.Weapon:UnZoom()
-
- end
-
+
+ end
+
return false
-
+
end
-
+
return true
-
+
end
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
- end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ end
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
if CLIENT then return end
-
+
if self.UseShellSounds then
-
+
local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 )
local tbl = self.ShellSounds
local pos = self.Owner:GetPos()
-
+
if self.AmmoType == "Buckshot" then
-
+
tbl = self.BuckshotShellSounds
-
+
end
-
+
timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end )
-
+
end
-
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:SetClip1( self.Weapon:Clip1() - self.Primary.NumShots )
self.Weapon:ShootEffects()
-
+
if self.IsSniper and self.Weapon:GetZoomMode() == 1 then
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 )
-
+
else
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
-
+
end
-
+
if self.Weapon:GetZoomMode() > 1 then
-
+
self.Weapon:UnZoom()
-
+
end
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, self.Primary.NumShots * -1 )
-
+
end
end
@@ -498,31 +498,31 @@ end
function SWEP:SecondaryAttack()
if not self.Weapon:CanSecondaryAttack() then return end
-
+
self.Weapon:SetNextSecondaryFire( CurTime() + 0.25 )
-
+
if not self.IsSniper then
-
+
self.Weapon:ToggleLaser()
-
+
return
-
+
end
-
+
if SERVER then
-
+
if self.Weapon:GetZoomMode() == 1 then
-
+
self.Owner:DrawViewModel( false )
-
+
end
-
+
self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 )
-
+
end
-
+
self.Weapon:EmitSound( self.Secondary.Sound )
-
+
end
function SWEP:ToggleLaser()
@@ -536,101 +536,101 @@ function SWEP:AdjustMouseSensitivity()
local num = self.Weapon:GetNWInt( "Mode", 1 )
local scale = ( self.ZoomModes[ num ] or 0 ) / 100
-
+
if scale == 0 then
-
+
return nil
-
+
end
return scale
-
-end
-function SWEP:GetDamageFalloffScale( distance )
+end
+
+function SWEP:GetDamageFalloffScale( distance )
+
+ local scale = 1
- local scale = 1
+ if distance > self.FalloffDistances[ self.AmmoType ].Range then
- if distance > self.FalloffDistances[ self.AmmoType ].Range then
+ scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) )
- scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) )
+ end
- end
-
return math.Clamp( scale, 0.1, 1.0 )
-
+
end
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", numbullets )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.75, 0, 10 )
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 0
- bullet.Force = damage * 2
+ bullet.Force = damage * 2
bullet.Damage = damage
bullet.AmmoType = "Pistol"
-
+
//if self.IsSniper and self.AmmoType == "Sniper" then
-
+
//bullet.TracerName = "sniper_tracer"
-
+
//end
-
+
bullet.Callback = function( attacker, tr, dmginfo )
-
+
dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) )
-
+
if tr.Entity.NextBot then
-
+
tr.Entity:OnLimbHit( tr.HitGroup, dmginfo )
-
+
end
if ( IsValid( tr.Entity ) and tr.Entity:IsPlayer() ) or math.random(1,5) != 1 then return end
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 )
-
+
end
-
+
self.Owner:LagCompensation( true )
-
+
self.Owner:FireBullets( bullet )
-
+
self.Owner:LagCompensation( false )
-
+
end
function SWEP:GetPenetrationDistance( mat_type )
if ( mat_type == MAT_PLASTIC || mat_type == MAT_WOOD || mat_type == MAT_ALIENFLESH || mat_type == MAT_FLESH || mat_type == MAT_GLASS ) then
-
+
return 64
-
+
end
-
+
return 32
-
+
end
function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage )
@@ -642,168 +642,168 @@ function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage )
elseif( mat_type == MAT_TILE || mat_type == MAT_SAND || mat_type == MAT_DIRT ) then
return damage - ( distance * 1.2 )
end
-
+
return damage - ( distance * 1.8 )
-
+
end
--[[function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce )
if ( !self or !IsValid( self.Weapon ) ) then return end
-
- if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then
-
- local effectdata = EffectData()
- effectdata:SetOrigin( tr.HitPos )
- util.Effect( "BloodImpact", effectdata )
-
- end
-
+
+ if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then
+
+ local effectdata = EffectData()
+ effectdata:SetOrigin( tr.HitPos )
+ util.Effect( "BloodImpact", effectdata )
+
+ end
+
// Don't go through more than 3 times
if ( bounce > 3 ) then return false end
-
+
// Direction (and length) that we are gonna penetrate
local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType )
-
+
local PeneTrace = {}
PeneTrace.endpos = tr.HitPos
PeneTrace.start = tr.HitPos + PeneDir
PeneTrace.mask = MASK_SHOT
PeneTrace.filter = { self.Owner }
-
- local PeneTrace = util.TraceLine( PeneTrace )
-
+
+ local PeneTrace = util.TraceLine( PeneTrace )
+
// Bullet didn't penetrate.
if ( PeneTrace.StartSolid or PeneTrace.Fraction >= 1.0 or tr.Fraction <= 0.0 ) then return false end
-
+
local distance = ( PeneTrace.HitPos - tr.HitPos ):Length()
local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() )
-
+
if new_damage > 0 then
-
- local bullet =
- {
+
+ local bullet =
+ {
Num = 1,
Src = PeneTrace.HitPos,
- Dir = tr.Normal,
+ Dir = tr.Normal,
Spread = Vector( 0, 0, 0 ),
Tracer = 0,
Force = 5,
Damage = new_damage,
AmmoType = "Pistol",
}
-
+
bullet.Callback = function ( attacker, tr, dmginfo )
-
+
if IsValid( self ) and IsValid( self.Weapon ) then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 )
-
+
end
-
+
end
-
+
local effectdata = EffectData()
effectdata:SetOrigin( PeneTrace.HitPos )
effectdata:SetNormal( PeneTrace.Normal )
- util.Effect( "Impact", effectdata )
-
+ util.Effect( "Impact", effectdata )
+
local func = function( attacker, bullet )
-
+
if IsValid( attacker ) then
-
+
attacker.FireBullets( attacker, bullet, true )
-
+
end
-
+
end
-
+
timer.Simple( 0.05, function() func( attacker, bullet ) end )
-
+
if SERVER and tr.MatType != MAT_FLESH then
-
+
sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) )
-
+
end
-
+
end
-
+
end]]
function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce )
if ( !self or not IsValid( self.Weapon ) ) then return end
-
- if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then
-
- local effectdata = EffectData()
- effectdata:SetOrigin( tr.HitPos )
- util.Effect( "BloodImpact", effectdata )
-
- end
-
+
+ if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then
+
+ local effectdata = EffectData()
+ effectdata:SetOrigin( tr.HitPos )
+ util.Effect( "BloodImpact", effectdata )
+
+ end
+
if ( bounce > 3 ) then return false end
-
+
local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType )
-
+
local PeneTrace = {}
PeneTrace.endpos = tr.HitPos
PeneTrace.start = tr.HitPos + PeneDir
PeneTrace.mask = MASK_SHOT
PeneTrace.filter = { self.Owner }
-
- local PeneTrace = util.TraceLine( PeneTrace )
-
+
+ local PeneTrace = util.TraceLine( PeneTrace )
+
if ( PeneTrace.StartSolid || PeneTrace.Fraction >= 1.0 || tr.Fraction <= 0.0 ) then return false end
-
+
local distance = ( PeneTrace.HitPos - tr.HitPos ):Length()
local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() )
-
+
if new_damage > 0 then
-
- local bullet =
- {
+
+ local bullet =
+ {
Num = 1,
Src = PeneTrace.HitPos,
- Dir = tr.Normal,
+ Dir = tr.Normal,
Spread = Vector( 0, 0, 0 ),
Tracer = 0,
Force = 5,
Damage = new_damage,
AmmoType = "Pistol",
}
-
- bullet.Callback = function( a, b, c )
-
+
+ bullet.Callback = function( a, b, c )
+
if IsValid( self ) and IsValid( self.Weapon ) then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 )
-
- end
-
+
+ end
+
end
-
+
local effectdata = EffectData()
effectdata:SetOrigin( PeneTrace.HitPos );
effectdata:SetNormal( PeneTrace.Normal );
- util.Effect( "Impact", effectdata )
-
+ util.Effect( "Impact", effectdata )
+
timer.Simple( 0.01, function() attacker:FireBullets( bullet, true ) end )
-
+
if SERVER and tr.MatType != MAT_FLESH and bounce == 0 then
-
+
sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) )
-
+
end
-
+
end
-
+
end
function SWEP:ShouldNotDraw()
return self.Weapon:GetNWBool( "Laser", false )
-
+
end
if CLIENT then
@@ -813,7 +813,7 @@ if CLIENT then
SWEP.CrossBlue = CreateClientConVar( "cl_redead_crosshair_b", 255, true, false )
SWEP.CrossAlpha = CreateClientConVar( "cl_redead_crosshair_a", 255, true, false )
SWEP.CrossLength = CreateClientConVar( "cl_redead_crosshair_length", 10, true, false )
-
+
SWEP.DotMat = Material( "Sprites/light_glow02_add_noz" )
SWEP.LasMat = Material( "sprites/bluelaser1" )
@@ -824,120 +824,120 @@ SWEP.CrosshairScale = 1
function SWEP:LaserDraw()
local vm = self.Owner:GetViewModel()
-
+
if IsValid( vm ) then
-
+
local idx = vm:LookupAttachment( "1" )
-
+
if idx == 0 then idx = vm:LookupAttachment( "muzzle" ) end
-
+
local trace = util.GetPlayerTrace( ply )
local tr = util.TraceLine( trace )
local tbl = vm:GetAttachment( idx )
-
+
local pos = tr.HitPos
-
+
if vm:GetSequence() != ACT_VM_IDLE then
-
+
self.AngDiff = ( tbl.Ang - self.LastGoodAng ):Forward()
-
+
trace = {}
trace.start = tbl.Pos or Vector(0,0,0)
trace.endpos = trace.start + ( ( EyeAngles() + self.AngDiff ):Forward() * 99999 )
trace.filter = { self.Owner, self.Weapon }
-
+
local tr2 = util.TraceLine( trace )
-
+
pos = tr2.HitPos
-
+
else
-
+
self.LastGoodAng = tbl.Ang
-
+
end
-
+
cam.Start3D( EyePos(), EyeAngles() )
-
+
local dir = ( tbl.Ang ):Forward()
local start = tbl.Pos
-
+
render.SetMaterial( self.LasMat )
-
+
for i=0,254 do
-
+
render.DrawBeam( start, start + dir * 5, 2, 0, 12, Color( 255, 0, 0, 255 - i ) )
-
+
start = start + dir * 5
-
+
end
-
+
local dist = tr.HitPos:Distance( EyePos() )
local size = math.Rand( 6, 7 )
local dotsize = dist / size ^ 2
-
+
render.SetMaterial( self.DotMat )
render.DrawQuadEasy( pos, ( EyePos() - tr.HitPos ):GetNormal(), dotsize, dotsize, Color( 255, 0, 0, 255 ), 0 )
-
+
cam.End3D()
-
- end
+
+ end
end
function SWEP:DrawHUD()
if self.Weapon:ShouldNotDraw() then return end
-
+
if self.Weapon:GetNWBool( "Laser", false ) then return end
-
+
local mode = self.Weapon:GetZoomMode()
if not self.IsSniper or mode == 1 then
-
+
local cone = self.Primary.Cone
local scale = cone
-
+
if self.IsSniper then
-
+
cone = self.Primary.SniperCone
scale = cone
-
+
end
-
+
local x = ScrW() * 0.5
local y = ScrH() * 0.5
local scalebywidth = ( ScrW() / 1024 ) * 10
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = cone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( cone / 1.75, 0, 10 )
-
+
end
-
+
scale = scale * scalebywidth
-
+
local dist = math.abs( self.CrosshairScale - scale )
self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 )
-
+
local gap = 40 * self.CrosshairScale
local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale
-
+
surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() )
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-
+
return
-
+
end
-
+
if mode != 1 then
-
+
local w = ScrW()
local h = ScrH()
local wr = ( h / 3 ) * 4
@@ -945,14 +945,13 @@ function SWEP:DrawHUD()
surface.SetTexture( surface.GetTextureID( "gmod/scope" ) )
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h )
-
+
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h )
surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h )
surface.DrawLine( 0, h * 0.50, w, h * 0.50 )
surface.DrawLine( w * 0.50, 0, w * 0.50, h )
-
+
end
-
-end
+end
diff --git a/entities/weapons/rad_berettas/shared.lua b/entities/weapons/rad_berettas/shared.lua
index 4ffeebd..ff48da6 100644
--- a/entities/weapons/rad_berettas/shared.lua
+++ b/entities/weapons/rad_berettas/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Dual Berettas"
SWEP.IconLetter = "s"
SWEP.Slot = 2
SWEP.Slotpos = 0
-
+
end
SWEP.HoldType = "duel"
@@ -44,36 +44,36 @@ SWEP.Primary.Delay = 0.180
SWEP.Primary.ClipSize = 30
SWEP.Primary.Automatic = false
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
self.Weapon:SendWeaponAnim( self.Anims[ self.AnimPos ] )
self.AnimPos = self.AnimPos + 1
-
+
if self.AnimPos > 2 then
-
+
self.AnimPos = 1
-
+
end
-
+
end
--[[function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -81,11 +81,11 @@ end
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end]]
diff --git a/entities/weapons/rad_deagle/shared.lua b/entities/weapons/rad_deagle/shared.lua
index 1bc4118..5298747 100644
--- a/entities/weapons/rad_deagle/shared.lua
+++ b/entities/weapons/rad_deagle/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "Desert Eagle"
SWEP.IconLetter = "f"
SWEP.Slot = 2
SWEP.Slotpos = 1
-
+
end
SWEP.HoldType = "revolver"
@@ -36,4 +36,4 @@ SWEP.Primary.Cone = 0.030
SWEP.Primary.Delay = 0.380
SWEP.Primary.ClipSize = 7
-SWEP.Primary.Automatic = false \ No newline at end of file
+SWEP.Primary.Automatic = false
diff --git a/entities/weapons/rad_experimental/shared.lua b/entities/weapons/rad_experimental/shared.lua
index f8da7b8..4c2d1b8 100644
--- a/entities/weapons/rad_experimental/shared.lua
+++ b/entities/weapons/rad_experimental/shared.lua
@@ -1,20 +1,20 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
-
+
SWEP.ViewModelFlip = false
-
+
SWEP.ViewModelFOV = 60
-
+
SWEP.PrintName = "PPW-952"
SWEP.IconLetter = "m"
SWEP.Slot = 4
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
@@ -51,28 +51,28 @@ SWEP.Primary.Delay = 1.400
SWEP.Primary.ClipSize = 3
SWEP.Primary.Automatic = true
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -81,11 +81,11 @@ function SWEP:PrimaryAttack()
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end
@@ -93,62 +93,62 @@ end
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", numbullets )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.75, 0, 10 )
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 1
- bullet.Force = damage * 2
+ bullet.Force = damage * 2
bullet.Damage = 1
bullet.AmmoType = "Pistol"
bullet.TracerName = "AirboatGunHeavyTracer"
-
+
bullet.Callback = function ( attacker, tr, dmginfo )
if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then
-
+
if tr.Entity:IsPlayer() and tr.Entity:Team() == TEAM_ZOMBIES then
-
+
tr.Entity:SetModel( table.Random( GAMEMODE.Corpses ) )
-
+
end
-
+
local dmg = DamageInfo()
dmg:SetDamage( 500 )
dmg:SetDamageType( DMG_BLAST )
dmg:SetAttacker( self.Owner )
dmg:SetInflictor( self.Weapon )
-
+
tr.Entity:EmitSound( self.Gore, 100, math.random(90,110) )
tr.Entity:TakeDamageInfo( dmg )
-
+
end
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetNormal( tr.HitNormal )
util.Effect( "energy_explosion", ed, true, true )
end
-
+
self.Owner:FireBullets( bullet )
-
+
end
diff --git a/entities/weapons/rad_famas/shared.lua b/entities/weapons/rad_famas/shared.lua
index b7966f4..7b8682b 100644
--- a/entities/weapons/rad_famas/shared.lua
+++ b/entities/weapons/rad_famas/shared.lua
@@ -1,13 +1,13 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "FAMAS"
SWEP.IconLetter = "v"
SWEP.Slot = 4
diff --git a/entities/weapons/rad_firegun/shared.lua b/entities/weapons/rad_firegun/shared.lua
index a8e3ae8..5e83dc9 100644
--- a/entities/weapons/rad_firegun/shared.lua
+++ b/entities/weapons/rad_firegun/shared.lua
@@ -1,20 +1,20 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
-
+
SWEP.ViewModelFlip = false
-
+
SWEP.ViewModelFOV = 60
-
+
SWEP.PrintName = "HEAT Cannon"
SWEP.IconLetter = "m"
SWEP.Slot = 4
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "physgun"
@@ -52,28 +52,28 @@ SWEP.Primary.Delay = 1.700
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = true
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -82,14 +82,14 @@ function SWEP:PrimaryAttack()
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
self.Owner:EmitSound( self.Primary.Sound2 )
-
+
end
-
+
self.ReloadTime = CurTime() + self.Primary.Delay
end
@@ -97,16 +97,16 @@ end
function SWEP:ReloadThink()
if self.ReloadTime and self.ReloadTime <= CurTime() then
-
+
self.ReloadTime = nil
self.Weapon:SetClip1( self.Primary.ClipSize )
-
+
end
end
function SWEP:Reload()
-
+
end
SWEP.Decals = { "Scorch", "SmallScorch" }
@@ -114,77 +114,77 @@ SWEP.Decals = { "Scorch", "SmallScorch" }
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", numbullets )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.75, 0, 10 )
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 1
- bullet.Force = damage * 2
+ bullet.Force = damage * 2
bullet.Damage = 1
bullet.AmmoType = "Pistol"
bullet.TracerName = "fire_tracer"
-
+
bullet.Callback = function ( attacker, tr, dmginfo )
if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then
-
+
if tr.Entity:IsPlayer() then
-
+
tr.Entity:TakeDamage( self.Primary.Damage, self.Owner )
-
+
else
-
+
tr.Entity:TakeDamage( math.Clamp( math.min( 20, tr.Entity:Health() - 5 ), 1, 20 ), self.Owner )
-
+
end
-
+
if tr.Entity.NextBot or ( tr.Entity:IsPlayer() and tr.Entity:Team() != TEAM_ARMY ) then
-
+
tr.Entity:DoIgnite( self.Owner )
tr.Entity:EmitSound( self.Burn, 100, math.random(90,110) )
-
+
end
-
+
end
-
+
sound.Play( self.Burn2, tr.HitPos )
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetNormal( tr.HitNormal )
util.Effect( "fire_explosion", ed, true, true )
-
+
if tr.HitNormal.z > 0.5 and tr.HitWorld then
-
+
local ed = EffectData()
ed:SetOrigin( tr.HitPos )
ed:SetMagnitude( 0.5 )
util.Effect( "smoke_crater", ed, true, true )
-
+
end
-
+
util.Decal( table.Random( self.Decals ), tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal )
end
-
+
self.Owner:FireBullets( bullet )
-
+
end
diff --git a/entities/weapons/rad_fiveseven/shared.lua b/entities/weapons/rad_fiveseven/shared.lua
index 28ce60e..3634c0e 100644
--- a/entities/weapons/rad_fiveseven/shared.lua
+++ b/entities/weapons/rad_fiveseven/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "FN Five-Seven"
SWEP.IconLetter = "y"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "pistol"
diff --git a/entities/weapons/rad_g3/shared.lua b/entities/weapons/rad_g3/shared.lua
index 8e9d8b7..d55b732 100644
--- a/entities/weapons/rad_g3/shared.lua
+++ b/entities/weapons/rad_g3/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "G3 SG1"
SWEP.IconLetter = "i"
SWEP.Slot = 4
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "ar2"
@@ -44,33 +44,33 @@ SWEP.Primary.Automatic = true
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:SetClip1( self.Weapon:Clip1() - 1 )
self.Weapon:ShootEffects()
-
+
if self.IsSniper and self.Weapon:GetZoomMode() == 1 then
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 )
-
+
else
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
-
+
end
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
-end \ No newline at end of file
+end
diff --git a/entities/weapons/rad_galil/shared.lua b/entities/weapons/rad_galil/shared.lua
index 246ab86..e92a431 100644
--- a/entities/weapons/rad_galil/shared.lua
+++ b/entities/weapons/rad_galil/shared.lua
@@ -1,13 +1,13 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "IMI Galil"
SWEP.IconLetter = "v"
SWEP.Slot = 4
diff --git a/entities/weapons/rad_glock/shared.lua b/entities/weapons/rad_glock/shared.lua
index fd00c73..67c8f87 100644
--- a/entities/weapons/rad_glock/shared.lua
+++ b/entities/weapons/rad_glock/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "Glock 19"
SWEP.IconLetter = "c"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "pistol"
diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua
index 516f491..fe05c4a 100644
--- a/entities/weapons/rad_grenade/shared.lua
+++ b/entities/weapons/rad_grenade/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "HE Grenade"
SWEP.IconLetter = "h"
SWEP.Slot = 3
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "grenade"
@@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = false
-function SWEP:Think()
+function SWEP:Think()
if self.Owner:GetVelocity():Length() > 0 then
-
+
if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
end
-
+
end
-
+
if self.ThrowTime then
-
+
if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then
-
- self.ThrowAnim = true
-
+
+ self.ThrowAnim = true
+
if self.ThrowPower > 1000 then
-
+
self.Weapon:SendWeaponAnim( ACT_VM_THROW )
-
+
end
-
+
end
-
+
if self.ThrowTime < CurTime() then
-
+
self.ThrowTime = nil
self.ReloadTime = CurTime() + 0.75
-
+
if CLIENT then return end
-
+
local tbl = item.GetByModel( "models/weapons/w_eq_fraggrenade_thrown.mdl" )
-
- if self.Owner:HasItem( tbl.ID ) then
-
+
+ if self.Owner:HasItem( tbl.ID ) then
+
self.Owner:RemoveFromInventory( tbl.ID )
-
+
end
-
+
local ent = ents.Create( "sent_grenade" )
ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 )
ent:SetOwner( self.Owner )
ent:SetAngles( self.Owner:GetAimVector():Angle() )
ent:SetSpeed( self.ThrowPower )
ent:Spawn()
-
+
if not self.Owner:HasItem( tbl.ID ) then
-
+
self.Owner:StripWeapon( "rad_grenade" )
-
+
end
-
+
end
-
+
end
-
+
if self.ReloadTime and self.ReloadTime < CurTime() then
-
+
self.ReloadTime = nil
-
+
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
end
end
@@ -113,7 +113,7 @@ function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:ShootEffects()
-
+
self.ThrowTime = CurTime() + 1.25
self.ThrowAnim = false
self.ThrowPower = 800
@@ -126,26 +126,25 @@ function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:ShootEffects()
-
+
self.ThrowTime = CurTime() + 1.25
self.ThrowAnim = false
self.ThrowPower = 3000
-
+
end
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
- self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
+ self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
+
end
-
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
+
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
end
function SWEP:DrawHUD()
end
-
diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua
index 3dda5dc..42e2723 100644
--- a/entities/weapons/rad_incendiarygrenade/shared.lua
+++ b/entities/weapons/rad_incendiarygrenade/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "Incendiary Grenade"
SWEP.IconLetter = "h"
SWEP.Slot = 3
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "grenade"
@@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = false
-function SWEP:Think()
+function SWEP:Think()
if self.Owner:GetVelocity():Length() > 0 then
-
+
if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
end
-
+
end
-
+
if self.ThrowTime then
-
+
if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then
-
- self.ThrowAnim = true
-
+
+ self.ThrowAnim = true
+
if self.ThrowPower > 1000 then
-
+
self.Weapon:SendWeaponAnim( ACT_VM_THROW )
-
+
end
-
+
end
-
+
if self.ThrowTime < CurTime() then
-
+
self.ThrowTime = nil
self.ReloadTime = CurTime() + 0.75
-
+
if CLIENT then return end
-
+
local tbl = item.GetByModel( "models/weapons/w_eq_flashbang.mdl" )
-
- if self.Owner:HasItem( tbl.ID ) then
-
+
+ if self.Owner:HasItem( tbl.ID ) then
+
self.Owner:RemoveFromInventory( tbl.ID )
-
+
end
-
+
local ent = ents.Create( "sent_grenade_incendiary" )
ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 )
ent:SetOwner( self.Owner )
ent:SetAngles( self.Owner:GetAimVector():Angle() )
ent:SetSpeed( self.ThrowPower )
ent:Spawn()
-
+
if not self.Owner:HasItem( tbl.ID ) then
-
+
self.Owner:StripWeapon( "rad_incendiarygrenade" )
-
+
end
-
+
end
-
+
end
-
+
if self.ReloadTime and self.ReloadTime < CurTime() then
-
+
self.ReloadTime = nil
-
+
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
end
end
@@ -113,7 +113,7 @@ function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:ShootEffects()
-
+
self.ThrowTime = CurTime() + 1.25
self.ThrowAnim = false
self.ThrowPower = 800
@@ -126,26 +126,25 @@ function SWEP:PrimaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:ShootEffects()
-
+
self.ThrowTime = CurTime() + 1.25
self.ThrowAnim = false
self.ThrowPower = 3000
-
+
end
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if SERVER then
-
- self.Owner:ViewBounce( self.Primary.Recoil )
-
+
+ self.Owner:ViewBounce( self.Primary.Recoil )
+
end
-
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
+
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
end
function SWEP:DrawHUD()
end
-
diff --git a/entities/weapons/rad_inv/shared.lua b/entities/weapons/rad_inv/shared.lua
index 50e7691..15510d4 100644
--- a/entities/weapons/rad_inv/shared.lua
+++ b/entities/weapons/rad_inv/shared.lua
@@ -1,19 +1,19 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Quick Inventory"
SWEP.IconLetter = "H"
SWEP.Slot = 0
SWEP.Slotpos = 1
-
+
end
SWEP.HoldType = "normal"
@@ -39,13 +39,13 @@ SWEP.PanelSize = 80
function SWEP:Holster()
if SERVER then return true end
-
+
if self.Deployed then
-
+
self.Deployed = false
-
+
self.Weapon:RemovePanels()
-
+
end
return true
@@ -54,33 +54,33 @@ end
function SWEP:Deploy()
- if SERVER then
-
+ if SERVER then
+
self.Weapon:SetNWInt( "InvPos", 1 )
self.Weapon:SetNWBool( "Synch", false )
self.Weapon:SetNWBool( "UseMode", false )
-
+
self.Owner:SynchInventory()
-
- self.Owner:NoticeOnce( "Right click to scroll through your inventory", GAMEMODE.Colors.Blue, 5, 2 )
- self.Owner:NoticeOnce( "Left click to select an item and use it", GAMEMODE.Colors.Blue, 5, 4 )
-
- return true
-
+
+ self.Owner:NoticeOnce( "Right click to scroll through your inventory", GAMEMODE.Colors.Blue, 5, 2 )
+ self.Owner:NoticeOnce( "Left click to select an item and use it", GAMEMODE.Colors.Blue, 5, 4 )
+
+ return true
+
end
-
+
if not self.Deployed then
-
+
self.Deployed = true
self.LastInv = Inv_Size()
self.InvPos = 1
-
+
self.Weapon:GeneratePanels()
-
+
end
-
- return true
-
+
+ return true
+
end
function SWEP:GeneratePanels()
@@ -88,42 +88,42 @@ function SWEP:GeneratePanels()
self.InvPanels = {}
self.YPosTbl = {}
self.InvItems = Inv_UniqueItems()
-
+
if Inv_Size() == 0 then return end
-
+
for i=1, math.min( self.NumPanels, #self.InvItems ) do
-
+
local id = self.Weapon:GetNWInt( "InvPos", 1 ) + i - 1
-
+
if id > #self.InvItems then
-
+
id = math.Clamp( id - #self.InvItems, 1, #self.InvItems )
-
+
end
-
+
local panel = vgui.Create( "ItemPanel" )
panel:SetItemTable( item.GetByID( self.InvItems[id] ) )
-
+
if i == 1 then
-
+
panel:SetPos( -self.PanelSize, self.YPos )
panel:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 )
panel:SetSizeOverride( self.PanelSize * 1.5 )
panel.YPos = self.YPos
-
+
else
-
+
panel:SetPos( -self.PanelSize, self.YPos + ( self.PanelSize * ( i - 1 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i ) )
panel:SetSize( self.PanelSize, self.PanelSize )
panel:SetSizeOverride( self.PanelSize )
panel.YPos = self.YPos + ( self.PanelSize * ( i - 2 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i )
-
+
end
-
+
self.YPosTbl[i] = panel.YPos
-
+
table.insert( self.InvPanels, panel )
-
+
end
end
@@ -132,35 +132,35 @@ function SWEP:AddPanel() // call after removing a panel
local id = self.Weapon:GetNWInt( "InvPos", 1 ) - 1
local inv = Inv_UniqueItems()
-
+
if id < 1 then
-
+
id = #inv
-
+
end
local i = #self.InvPanels
local tbl = item.GetByID( inv[id] )
-
+
local panel = vgui.Create( "ItemPanel" )
panel:SetItemTable( tbl )
panel:SetPos( -self.PanelSize, self.YPosTbl[ i + 1 ] )
panel:SetSize( self.PanelSize, self.PanelSize )
panel:SetSizeOverride( self.PanelSize )
panel.YPos = self.YPosTbl[ i + 1 ]
-
+
table.insert( self.InvPanels, panel )
-
+
end
function SWEP:RemovePanels()
for k,v in pairs( self.InvPanels ) do
-
+
v:Remove()
-
+
end
-
+
self.InvPanels = {}
self.InvItems = {}
self.YPosTbl = {}
@@ -170,7 +170,7 @@ end
function SWEP:RemovePanel()
if not self.InvPanels[1] then return end
-
+
self.InvPanels[1].Removal = true
end
@@ -178,9 +178,9 @@ end
function SWEP:RemoveAllPanels()
for k,v in pairs( self.InvPanels ) do
-
+
v.Removal = true
-
+
end
end
@@ -188,50 +188,50 @@ end
function SWEP:SecondaryAttack()
if CLIENT then return end
-
+
self.Weapon:SetNextSecondaryFire( CurTime() + 0.3 )
-
+
if self.Weapon:GetNWBool( "UseMode", false ) then
-
+
local inv = self.Owner:GetUniqueInventory()
local pos = self.Weapon:GetNWInt( "InvPos", 1 )
local tbl = item.GetByID( inv[pos] )
-
+
self.Weapon:SetNWInt( "FuncPos", self.Weapon:GetNWInt( "FuncPos", 1 ) + 1 )
-
+
if tbl.Weapon then
-
+
if self.Weapon:GetNWInt( "FuncPos", 1 ) > 2 then
-
+
self.Weapon:SetNWInt( "FuncPos", 1 )
-
+
end
-
+
return
-
+
end
-
+
if self.Weapon:GetNWInt( "FuncPos", 1 ) > ( #self.Functions + 2 ) then
-
+
self.Weapon:SetNWInt( "FuncPos", 1 )
-
+
end
-
+
else
-
+
local size = #self.Owner:GetUniqueInventory()
local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + 1
-
+
if pos > size then
-
+
pos = 1
-
+
end
-
+
self.Weapon:SetNWInt( "InvPos", pos )
-
+
end
-
+
self.Owner:ClientSound( self.Scroll )
end
@@ -239,152 +239,152 @@ end
function SWEP:PrimaryAttack()
if CLIENT then return end
-
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
local inv = self.Owner:GetUniqueInventory()
- local pos = self.Weapon:GetNWInt( "InvPos", 1 )
+ local pos = self.Weapon:GetNWInt( "InvPos", 1 )
local tbl = item.GetByID( inv[pos] )
-
+
if not tbl then return end
-
+
if self.Weapon:GetNWBool( "UseMode", false ) then
local fpos = self.Weapon:GetNWInt( "FuncPos", 1 )
-
+
if tbl.Weapon then
-
+
if fpos == 1 then
-
+
self.Owner:ClientSound( self.Cancel )
-
+
else
-
+
self.Functions[1]( self.Owner, tbl.ID )
-
+
end
-
+
self.Weapon:SetNWBool( "UseMode", false )
self.Weapon:SetNWInt( "FuncPos", 1 )
self.Weapon:SetNWInt( "InvPos", 1 )
self.Weapon:Synch()
-
+
return
-
+
end
-
+
if fpos == 1 then
-
+
self.Owner:ClientSound( self.Cancel )
-
+
elseif fpos == 2 then
-
+
self.Weapon:DropItem( tbl.ID, 1 )
-
+
else
-
+
self.Functions[ fpos - 2 ]( self.Owner, tbl.ID )
-
+
end
-
+
self.Weapon:SetNWBool( "UseMode", false )
self.Weapon:SetNWInt( "FuncPos", 1 )
self.Weapon:SetNWInt( "InvPos", 1 )
self.Weapon:Synch()
-
+
else
-
+
self.Weapon:SetNWBool( "UseMode", !self.Weapon:SetNWBool( "UseMode", false ) )
-
+
self.Functions = tbl.Functions
-
+
self.Owner:ClientSound( self.Selection )
-
+
end
-
+
end
function SWEP:DropItem( id, count )
-
+
if not self.Owner:HasItem( id ) then return end
-
+
local tbl = item.GetByID( id )
-
+
if count == 1 then
-
+
if self.Owner:HasItem( id ) then
-
+
local makeprop = true
-
+
if tbl.DropFunction then
-
+
makeprop = tbl.DropFunction( self.Owner, id, true )
-
+
end
-
+
if makeprop then
-
+
local prop = ents.Create( "prop_physics" )
prop:SetPos( self.Owner:GetItemDropPos() )
prop:SetAngles( self.Owner:GetAimVector():Angle() )
- prop:SetModel( tbl.Model )
+ prop:SetModel( tbl.Model )
prop:SetCollisionGroup( COLLISION_GROUP_WEAPON )
prop:Spawn()
prop.IsItem = true
prop.Removal = CurTime() + 5 * 60
-
+
end
-
+
self.Owner:RemoveFromInventory( id, true )
self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) )
-
+
end
-
+
return
-
+
end
-
+
local items = {}
-
+
for i=1, count do
-
+
if self.Owner:HasItem( id ) then
-
+
table.insert( items, id )
-
+
end
-
+
end
-
+
local loot = ents.Create( "sent_lootbag" )
-
+
for k,v in pairs( items ) do
-
+
loot:AddItem( v )
-
+
end
-
+
loot:SetAngles( self.Owner:GetAimVector():Angle() )
loot:SetPos( self.Owner:GetItemDropPos() )
loot:SetRemoval( 60 * 5 )
loot:Spawn()
-
+
self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) )
self.Owner:RemoveMultipleFromInventory( items )
-
+
if tbl.DropFunction then
-
+
tbl.DropFunction( self.Owner, id )
-
+
end
end
function SWEP:Synch()
- umsg.Start( "InvSWEP", self.Owner )
+ umsg.Start( "InvSWEP", self.Owner )
umsg.End()
-
+
end
function RecvSynch()
@@ -394,68 +394,68 @@ function RecvSynch()
end
usermessage.Hook( "InvSWEP", RecvSynch )
-function SWEP:Think()
+function SWEP:Think()
if SERVER then return end
-
+
if not self.Deployed then return end
-
+
local removing = false
-
+
if InvSWEPSynch or self.LastInv != Inv_Size() then
-
+
removing = true
InvSWEPSynch = false
-
+
self.Weapon:RemoveAllPanels()
-
+
end
-
+
self.LastInv = Inv_Size()
-
+
if #self.InvPanels < 1 then
-
+
self.Weapon:GeneratePanels()
-
+
end
-
+
if removing then return end
-
+
if self.Shuffle and #self.InvPanels < 5 then
-
+
for k,v in pairs( self.InvPanels ) do
-
+
v.YPos = self.YPosTbl[k]
-
+
end
-
+
self.Weapon:AddPanel()
-
+
self.Shuffle = false
-
+
end
-
+
if self.InvPos != self.Weapon:GetNWInt( "InvPos", 1 ) then
-
+
self.InvPos = self.Weapon:GetNWInt( "InvPos", 1 )
-
+
self.Weapon:RemovePanel()
-
+
end
-
+
end
function SWEP:DrawOption( i, name )
surface.SetFont( "InventoryFont" )
-
+
local w,h = surface.GetTextSize( name )
local col = Color( 255, 255, 255 )
-
+
if i == self.Weapon:GetNWInt( "FuncPos", 1 ) then
-
+
col = Color( 50, 255, 50 )
-
+
end
draw.RoundedBox( 4, self.PanelSize * 1.5 + 20, 12 + ( i - 1 ) * 25, w + 8, h, Color( 0, 0, 0, 200 ) )
@@ -466,97 +466,97 @@ end
function SWEP:DrawHUD()
if self.Weapon:GetNWBool( "UseMode", false ) then
-
+
local inv = Inv_UniqueItems()
local tbl = item.GetByID( inv[ self.Weapon:GetNWInt( "InvPos", 1 ) ] )
-
+
if not tbl then return end
-
+
if tbl.Weapon then
-
+
self.Weapon:DrawOption( 1, "cancel" )
self.Weapon:DrawOption( 2, "drop" )
-
+
return
-
+
end
-
+
for i=1, #tbl.Functions + 2 do
-
+
if i == 1 then
-
+
self.Weapon:DrawOption( i, "cancel" )
-
+
elseif i == 2 then
-
+
self.Weapon:DrawOption( i, "drop" )
-
+
else
-
+
self.Weapon:DrawOption( i, string.lower( tbl.Functions[ i - 2 ]( 0, 0, true ) ) )
-
+
end
-
+
end
-
+
end
-
+
for k,v in pairs( self.InvPanels or {} ) do
-
+
v.LastX = math.Clamp( math.max( ( v.LastX or self.PanelSize + self.XPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.XPos )
v.LastY = math.Clamp( math.max( ( v.LastY or self.YPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.YPos )
-
+
if v.LastX != 0 or v.LastY != 0 then // automatically bring the panel into the screen
-
+
v:SetPos( self.XPos - v.LastX, v.YPos - v.LastY )
-
+
if v.YPos == self.YPosTbl[1] then
-
+
v:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 )
v:SetSizeOverride( self.PanelSize * 1.5 )
-
+
end
-
+
end
-
+
if v.Removal then
-
+
v.RemoveX = math.Clamp( ( v.RemoveX or self.XPos ) - ( FrameTime() * 700 ), -1 * ( self.PanelSize * 2 ), self.PanelSize + self.XPos )
-
+
if v.RemoveX != -1 * ( self.PanelSize * 2 ) then
-
+
v:SetPos( v.RemoveX, v.YPos )
-
+
else
-
+
v:Remove()
-
+
table.remove( self.InvPanels, k )
-
+
local all = true
-
+
for c,d in pairs( self.InvPanels ) do
-
+
if not d.Removal then
-
+
all = false
-
+
end
-
+
end
-
+
if not all then
-
+
self.Shuffle = true
-
+
end
-
+
break
-
+
end
-
+
end
-
+
end
-
+
end
diff --git a/entities/weapons/rad_itemplacer/shared.lua b/entities/weapons/rad_itemplacer/shared.lua
index 12dad13..6ae189d 100644
--- a/entities/weapons/rad_itemplacer/shared.lua
+++ b/entities/weapons/rad_itemplacer/shared.lua
@@ -1,11 +1,11 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
SWEP.Weight = 1
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
-
+
end
if CLIENT then
@@ -19,15 +19,15 @@ if CLIENT then
SWEP.ViewModelFOV = 74
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Item Placement Tool"
SWEP.Slot = 5
SWEP.Slotpos = 5
-
+
function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
-
+
end
-
+
end
SWEP.HoldType = "pistol"
@@ -71,35 +71,35 @@ SWEP.SharedItems = {}
function SWEP:Initialize()
if SERVER then
-
+
self.Weapon:SetWeaponHoldType( self.HoldType )
-
+
end
-
+
end
function SWEP:Synch()
for k,v in pairs( self.ServersideItems ) do
-
+
local ents = ents.FindByClass( v )
local postbl = {}
-
+
for c,d in pairs( ents ) do
-
+
table.insert( postbl, d:GetPos() )
-
+
end
-
+
net.Start( "ItemPlacerSynch" )
net.WriteString( v )
net.WriteTable( postbl )
net.Send( self.Owner )
-
+
//local tbl = { Name = v, Ents = postbl }
-
+
//datastream.StreamToClients( { self.Owner }, "ItemPlacerSynch", tbl )
-
+
end
end
@@ -120,51 +120,51 @@ datastream.Hook( "ItemPlacerSynch", PlacerSynch )]]
function SWEP:Deploy()
if SERVER then
-
+
self.Weapon:Synch()
-
+
end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
-function SWEP:Think()
+end
+
+function SWEP:Think()
if CLIENT then return end
if self.Owner:KeyDown( IN_USE ) and ( ( self.NextDel or 0 ) < CurTime() ) then
-
+
self.NextDel = CurTime() + 1
-
+
local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
-
+
local closest
local dist = 1000
-
+
for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do
-
+
if v:GetPos():Distance( tr.HitPos ) < dist then
-
+
dist = v:GetPos():Distance( tr.HitPos )
closest = v
-
+
end
-
+
end
-
+
if IsValid( closest ) then
-
+
closest:Remove()
-
+
self.Owner:EmitSound( self.Primary.Delete1 )
-
+
self.Weapon:Synch()
-
+
end
-
+
end
end
@@ -172,17 +172,17 @@ end
function SWEP:Reload()
if CLIENT then return end
-
+
for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do
-
+
v:Remove()
-
+
end
-
+
self.Weapon:Synch()
-
+
self.Owner:EmitSound( self.Primary.Delete )
-
+
end
function SWEP:Holster()
@@ -191,21 +191,21 @@ function SWEP:Holster()
end
-function SWEP:ShootEffects()
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+function SWEP:ShootEffects()
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
end
function SWEP:PlaceItem()
local itemtype = self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ]
-
+
local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) )
-
+
local ent = ents.Create( itemtype )
ent:SetPos( tr.HitPos + tr.HitNormal * 5 )
ent:Spawn()
@@ -218,13 +218,13 @@ function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + 1 )
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Weapon:PlaceItem()
-
+
self.Weapon:Synch()
-
+
end
end
@@ -232,64 +232,62 @@ end
function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + 0.5 )
-
+
self.Weapon:EmitSound( self.Primary.Swap )
-
+
if SERVER then
-
+
self.Weapon:SetNWInt( "ItemType", self.Weapon:GetNWInt( "ItemType", 1 ) + 1 )
-
+
if self.Weapon:GetNWInt( "ItemType", 1 ) > #self.ItemTypes then
-
+
self.Weapon:SetNWInt( "ItemType", 1 )
-
+
end
-
+
end
-
+
end
function SWEP:DrawHUD()
draw.SimpleText( "PRIMARY FIRE: Place Item SECONDARY FIRE: Change Item Type +USE: Delete Nearest Item Of Current Type RELOAD: Remove All Of Current Item Type", "AmmoFontSmall", ScrW() * 0.5, ScrH() - 120, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.SimpleText( "CURRENT ITEM TYPE: "..self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ], "AmmoFontSmall", ScrW() * 0.5, ScrH() - 100, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
for k,v in pairs( self.SharedItems ) do
for c,d in pairs( ents.FindByClass( v ) ) do
-
+
local pos = d:GetPos():ToScreen()
-
+
if pos.visible then
-
+
draw.SimpleText( v, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) )
-
+
end
-
+
end
-
+
end
-
+
for k,v in pairs( ClientItemPlacerTbl ) do
-
+
for c,d in pairs( v ) do
-
+
local vec = Vector( d[1], d[2], d[3] )
-
+
local pos = vec:ToScreen()
-
+
if pos.visible then
-
+
draw.SimpleText( k, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) )
-
+
end
-
+
end
-
- end
-
-end
+ end
+end
diff --git a/entities/weapons/rad_m1014/shared.lua b/entities/weapons/rad_m1014/shared.lua
index 9d4ca65..2b176a5 100644
--- a/entities/weapons/rad_m1014/shared.lua
+++ b/entities/weapons/rad_m1014/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "M1014 Shotgun"
SWEP.IconLetter = "B"
SWEP.Slot = 3
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "shotgun"
@@ -45,64 +45,64 @@ function SWEP:Deploy()
self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 )
if SERVER then
-
+
self.Weapon:SetZoomMode( 1 )
-
- end
-
+
+ end
+
self.InIron = false
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+end
function SWEP:CanPrimaryAttack()
if self.HolsterMode or self.LastRunFrame > CurTime() then return false end
-
- if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
-
+
+ if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ return false
+
end
-
+
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return false
-
+
end
if self.Weapon:Clip1() <= 0 then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
return false
-
+
end
-
+
return true
-
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -110,17 +110,17 @@ function SWEP:PrimaryAttack()
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if self.Weapon:GetZoomMode() > 1 then
-
+
self.Weapon:UnZoom()
-
+
end
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end
@@ -128,73 +128,73 @@ end
function SWEP:Reload()
if self.HolsterMode or self.Weapon:Clip1() == self.Primary.ClipSize then return end
-
+
if self.Weapon:Clip1() < self.Primary.ClipSize and not self.Weapon:GetNWBool( "Reloading", false ) then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
end
-
+
end
function SWEP:Think()
if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then
-
+
self.HolsterTime = CurTime() + 2
--[[self.HolsterMode = !self.HolsterMode
-
+
if self.HolsterMode then
-
+
self.Owner:SetLuaAnimation( self.HoldType )
-
+
else
-
+
self.Owner:StopAllLuaAnimations( 0.5 )
-
+
end]]
-
+
end
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then
-
+
// Finsished reload
if self.Weapon:Clip1() >= self.Primary.ClipSize then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return
-
+
end
-
+
// Next cycle
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
-
+
// Add ammo
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
end
-
+
end
if self.Owner:GetVelocity():Length() > 0 then
-
+
if self.Owner:KeyDown( IN_SPEED ) then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
end
-
+
end
end
@@ -202,61 +202,61 @@ end
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", 1 )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.25, 0, 10 )
-
+
end
-
+
local tracer = 1
-
+
if ( zoommode or 1 ) > 1 then
-
+
tracer = 0
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 0
- bullet.Force = damage * 2
- bullet.Damage = damage
+ bullet.Force = damage * 2
+ bullet.Damage = damage
bullet.AmmoType = "Pistol"
bullet.TracerName = tracername
bullet.Callback = function ( attacker, tr, dmginfo )
-
+
dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) )
-
+
if tr.Entity.NextBot then
-
+
tr.Entity:OnLimbHit( tr.HitGroup, dmginfo )
-
+
end
-
+
if math.random(1,6) == 1 then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 )
-
+
end
end
-
+
self.Owner:FireBullets( bullet )
-
+
end
function SWEP:DrawHUD()
@@ -264,36 +264,36 @@ function SWEP:DrawHUD()
if self.Weapon:ShouldNotDraw() then return end
if not self.IsSniper and not self.Owner:GetNWBool( "InIron", false ) then
-
+
local x = ScrW() * 0.5
local y = ScrH() * 0.5
local scalebywidth = ( ScrW() / 1024 ) * 10
local scale = self.Primary.Cone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = self.Primary.Cone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 )
-
+
end
-
+
scale = scale * scalebywidth
-
+
local dist = math.abs( self.CrosshairScale - scale )
self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 )
-
+
local gap = 40 * self.CrosshairScale
local length = gap + self.CrossLength:GetInt()
-
+
surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() )
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-
+
end
-
+
end
diff --git a/entities/weapons/rad_m249/shared.lua b/entities/weapons/rad_m249/shared.lua
index 7e72cd2..96a4830 100644
--- a/entities/weapons/rad_m249/shared.lua
+++ b/entities/weapons/rad_m249/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "M249 SAW"
SWEP.IconLetter = "z"
SWEP.Slot = 4
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
@@ -37,4 +37,3 @@ SWEP.Primary.Delay = 0.090
SWEP.Primary.ClipSize = 100
SWEP.Primary.Automatic = true
-
diff --git a/entities/weapons/rad_mac10/shared.lua b/entities/weapons/rad_mac10/shared.lua
index 3e95b6e..b69d53b 100644
--- a/entities/weapons/rad_mac10/shared.lua
+++ b/entities/weapons/rad_mac10/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "MAC 10"
SWEP.IconLetter = "l"
SWEP.Slot = 3
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "revolver"
diff --git a/entities/weapons/rad_mp5/shared.lua b/entities/weapons/rad_mp5/shared.lua
index e41ef49..b5e3025 100644
--- a/entities/weapons/rad_mp5/shared.lua
+++ b/entities/weapons/rad_mp5/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "HK MP5"
SWEP.IconLetter = "x"
SWEP.Slot = 3
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "smg"
diff --git a/entities/weapons/rad_p228/shared.lua b/entities/weapons/rad_p228/shared.lua
index 56c1415..9a21f5b 100644
--- a/entities/weapons/rad_p228/shared.lua
+++ b/entities/weapons/rad_p228/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "P228 Compact"
SWEP.IconLetter = "y"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "pistol"
diff --git a/entities/weapons/rad_p90/shared.lua b/entities/weapons/rad_p90/shared.lua
index 2055466..7525436 100644
--- a/entities/weapons/rad_p90/shared.lua
+++ b/entities/weapons/rad_p90/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "FN P90"
SWEP.IconLetter = "l"
SWEP.Slot = 3
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "rpg"
diff --git a/entities/weapons/rad_revolver/shared.lua b/entities/weapons/rad_revolver/shared.lua
index 2b34184..d6bcce5 100644
--- a/entities/weapons/rad_revolver/shared.lua
+++ b/entities/weapons/rad_revolver/shared.lua
@@ -1,19 +1,19 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Colt Python"
SWEP.IconLetter = "f"
SWEP.Slot = 2
SWEP.Slotpos = 1
-
+
end
SWEP.HoldType = "revolver"
@@ -41,31 +41,31 @@ SWEP.Primary.Delay = 0.850
SWEP.Primary.ClipSize = 6
SWEP.Primary.Automatic = false
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if SERVER then
-
- self.Owner:ViewBounce( self.Primary.Recoil )
-
+
+ self.Owner:ViewBounce( self.Primary.Recoil )
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
if CLIENT then return end
- local tbl = self.ShellSounds[ ( self.Primary.ShellType or 1 ) ]
+ local tbl = self.ShellSounds[ ( self.Primary.ShellType or 1 ) ]
local pos = self.Owner:GetPos()
-
+
//timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl.Wavs ), pos, 75, tbl.Pitch ) end )
-
+
--[[local ed = EffectData()
ed:SetOrigin( self.Owner:GetShootPos() )
ed:SetEntity( self.Weapon )
ed:SetAttachment( self.Weapon:LookupAttachment( "2" ) )
ed:SetScale( ( self.Primary.ShellType or SHELL_9MM ) )
util.Effect( "weapon_shell", ed, true, true )]]
-
-end \ No newline at end of file
+
+end
diff --git a/entities/weapons/rad_scout/shared.lua b/entities/weapons/rad_scout/shared.lua
index d7fa4d0..6fafaca 100644
--- a/entities/weapons/rad_scout/shared.lua
+++ b/entities/weapons/rad_scout/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "Steyr Scout"
SWEP.IconLetter = "n"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua
index 9d22ef2..393ab68 100644
--- a/entities/weapons/rad_sg552/shared.lua
+++ b/entities/weapons/rad_sg552/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "SG 552"
SWEP.IconLetter = "A"
SWEP.Slot = 4
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "ar2"
@@ -45,13 +45,13 @@ SWEP.Primary.Automatic = true
function SWEP:SetZoomMode( num )
if num > 2 then
-
+
num = 1
self.Weapon:UnZoom()
-
+
end
-
+
self.Weapon:SetNWInt( "Mode", num )
self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] )
@@ -59,39 +59,39 @@ end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) )
self.Weapon:SetClip1( self.Weapon:Clip1() - 1 )
self.Weapon:ShootEffects()
-
+
if self.IsSniper and self.Weapon:GetZoomMode() == 1 then
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 )
-
+
else
-
+
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
-
+
end
-
+
--[[if self.Weapon:GetZoomMode() > 1 then
-
+
self.Weapon:UnZoom()
-
+
end]]
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end
@@ -99,49 +99,49 @@ end
function SWEP:DrawHUD()
if self.Weapon:ShouldNotDraw() then return end
-
+
local mode = self.Weapon:GetZoomMode()
local cone = self.Primary.Cone
local scale = cone
-
+
if mode == 1 then
-
+
cone = self.Primary.SniperCone
scale = cone
-
+
end
local x = ScrW() * 0.5
local y = ScrH() * 0.5
local scalebywidth = ( ScrW() / 1024 ) * 10
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = cone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( cone / 1.75, 0, 10 )
-
+
end
-
+
scale = scale * scalebywidth
-
+
local dist = math.abs( self.CrosshairScale - scale )
self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 )
-
+
local gap = 40 * self.CrosshairScale
local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale
-
+
surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() )
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-
+
if mode != 1 then
-
+
local w = ScrW()
local h = ScrH()
local wr = ( h / 3 ) * 4
@@ -149,11 +149,11 @@ function SWEP:DrawHUD()
surface.SetTexture( surface.GetTextureID( "gmod/scope" ) )
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h )
-
+
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h )
surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h )
-
+
end
-
-end \ No newline at end of file
+
+end
diff --git a/entities/weapons/rad_shotgun/shared.lua b/entities/weapons/rad_shotgun/shared.lua
index d754462..6b424dd 100644
--- a/entities/weapons/rad_shotgun/shared.lua
+++ b/entities/weapons/rad_shotgun/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "Winchester 1887"
SWEP.IconLetter = "k"
SWEP.Slot = 3
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "shotgun"
@@ -47,85 +47,85 @@ function SWEP:Deploy()
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetVar( "PumpTime", 0 )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 )
-
+
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+end
function SWEP:CanPrimaryAttack()
if self.HolsterMode or self.LastRunFrame > CurTime() then return false end
-
- if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
-
+
+ if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ return false
+
end
-
+
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return false
-
+
end
if self.Weapon:Clip1() <= 0 then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
//self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
return false
-
+
end
-
+
return true
-
+
end
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
if self.UseShellSounds then
-
+
local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 )
local tbl = self.BuckshotShellSounds
local pos = self.Owner:GetPos()
-
+
timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end )
-
+
end
-
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
-
+
self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -133,11 +133,11 @@ function SWEP:PrimaryAttack()
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end
@@ -145,17 +145,17 @@ end
function SWEP:Reload()
if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end
-
+
if self.Weapon:Clip1() < self.Primary.ClipSize then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
//self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
end
-
+
end
function SWEP:PumpIt()
@@ -164,70 +164,70 @@ function SWEP:PumpIt()
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP )
self.Weapon:EmitSound( self.Primary.Pump )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
-
+
end
function SWEP:Think()
if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then
-
+
self.HolsterTime = CurTime() + 2
self.HolsterMode = !self.HolsterMode
-
+
if self.HolsterMode then
-
+
self.Owner:SetLuaAnimation( self.HoldType )
-
+
else
-
+
self.Owner:StopAllLuaAnimations( 0.5 )
-
+
end
-
+
end
if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then
-
+
self.Weapon:SetVar( "PumpTime", 0 )
self.Weapon:PumpIt()
-
+
end
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then
-
+
// Finsished reload
if self.Weapon:Clip1() >= self.Primary.ClipSize then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return
-
+
end
-
+
// Next cycle
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
-
+
// Add ammo
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
end
-
+
end
if self.Owner:GetVelocity():Length() > 0 then
-
+
if self.Owner:KeyDown( IN_SPEED ) then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
end
-
+
end
end
@@ -235,53 +235,53 @@ end
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", 1 )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.25, 0, 10 )
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 0
- bullet.Force = damage * 2
- bullet.Damage = damage
+ bullet.Force = damage * 2
+ bullet.Damage = damage
bullet.AmmoType = "Pistol"
bullet.TracerName = tracername
bullet.Callback = function ( attacker, tr, dmginfo )
-
+
dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) )
-
+
if tr.Entity.NextBot then
-
+
tr.Entity:OnLimbHit( tr.HitGroup, dmginfo )
-
+
end
-
+
if math.random(1,6) == 1 then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 )
-
+
end
end
-
+
self.Owner:FireBullets( bullet )
-
+
end
function SWEP:DrawHUD()
@@ -292,29 +292,29 @@ function SWEP:DrawHUD()
local y = ScrH() * 0.5
local scalebywidth = ( ScrW() / 1024 ) * 10
local scale = self.Primary.Cone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = self.Primary.Cone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 )
-
+
end
-
+
scale = scale * scalebywidth
-
+
local dist = math.abs( self.CrosshairScale - scale )
self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 )
-
+
local gap = 40 * self.CrosshairScale
local length = gap + self.CrossLength:GetInt()
-
+
surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() )
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-
+
end
diff --git a/entities/weapons/rad_spas12/shared.lua b/entities/weapons/rad_spas12/shared.lua
index c3bcfb7..432ed09 100644
--- a/entities/weapons/rad_spas12/shared.lua
+++ b/entities/weapons/rad_spas12/shared.lua
@@ -1,19 +1,19 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "SPAS-12"
SWEP.IconLetter = "k"
SWEP.Slot = 3
SWEP.Slotpos = 3
-
+
end
SWEP.HoldType = "shotgun"
@@ -53,89 +53,89 @@ function SWEP:Deploy()
self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 )
if SERVER then
-
+
self.Weapon:SetZoomMode( 1 )
-
+
end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+end
function SWEP:CanPrimaryAttack()
if self.HolsterMode or self.LastRunFrame > CurTime() then return false end
-
- if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
-
+
+ if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ return false
+
end
-
+
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return false
-
+
end
if self.Weapon:Clip1() <= 0 and not self.Weapon:GetNWBool( "Reloading", false ) then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
//self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
return false
-
+
end
-
+
return true
-
+
end
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if IsFirstTimePredicted() then
-
+
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) )
-
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
if self.UseShellSounds then
-
+
local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 )
local tbl = self.BuckshotShellSounds
local pos = self.Owner:GetPos()
-
+
timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end )
-
+
end
-
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
-
+
self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -143,11 +143,11 @@ function SWEP:PrimaryAttack()
self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() )
self.Weapon:TakePrimaryAmmo( 1 )
self.Weapon:ShootEffects()
-
+
if SERVER then
-
+
self.Owner:AddAmmo( self.AmmoType, -1 )
-
+
end
end
@@ -155,18 +155,18 @@ end
function SWEP:Reload()
if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end
-
+
if self.Weapon:Clip1() < self.Primary.ClipSize then
-
+
self.Weapon:SetNWBool( "Reloading", true )
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
-
+
//self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
end
-
+
end
function SWEP:PumpIt()
@@ -175,73 +175,73 @@ function SWEP:PumpIt()
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP )
self.Weapon:EmitSound( self.Primary.Pump )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
-
+
end
function SWEP:Think()
if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then
-
+
self.HolsterTime = CurTime() + 2
self.HolsterMode = !self.HolsterMode
-
+
--[[if self.HolsterMode then
-
+
self.Owner:SetLuaAnimation( self.HoldType )
-
+
else
-
+
self.Owner:StopAllLuaAnimations( 0.5 )
-
+
end]]
-
+
end
if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then
-
+
self.Weapon:SetVar( "PumpTime", 0 )
self.Weapon:PumpIt()
-
+
end
if self.Weapon:GetNWBool( "Reloading", false ) then
-
+
if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then
-
+
// Finsished reload
if self.Weapon:Clip1() >= self.Primary.ClipSize then
-
+
self.Weapon:SetNWBool( "Reloading", false )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
-
+
self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH )
-
+
return
-
+
end
-
+
// Next cycle
self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 )
self.Weapon:SendWeaponAnim( ACT_VM_RELOAD )
-
+
// Add ammo
self.Weapon:SetClip1( self.Weapon:Clip1() + 1 )
-
+
// Sound
self.Weapon:EmitSound( self.Primary.ReloadSound, 100, math.random(90,110) )
-
+
end
-
+
end
if self.Owner:GetVelocity():Length() > 0 then
-
+
if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then
-
+
self.LastRunFrame = CurTime() + 0.3
-
+
end
-
+
end
end
@@ -249,61 +249,61 @@ end
function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode )
if SERVER then
-
+
self.Owner:AddStat( "Bullets", 1 )
-
+
end
local scale = aimcone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = aimcone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( aimcone / 1.25, 0, 10 )
-
+
end
-
+
local tracer = 1
-
+
if ( zoommode or 1 ) > 1 then
-
+
tracer = 0
-
+
end
-
+
local bullet = {}
bullet.Num = numbullets
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( scale, scale, 0 )
+ bullet.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 0
- bullet.Force = damage * 2
- bullet.Damage = damage
+ bullet.Force = damage * 2
+ bullet.Damage = damage
bullet.AmmoType = "Pistol"
bullet.TracerName = tracername
bullet.Callback = function ( attacker, tr, dmginfo )
-
+
dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) )
-
+
if tr.Entity.NextBot then
-
+
tr.Entity:OnLimbHit( tr.HitGroup, dmginfo )
-
+
end
-
+
if math.random(1,6) == 1 then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 )
-
+
end
end
-
+
self.Owner:FireBullets( bullet )
-
+
end
function SWEP:DrawHUD()
@@ -314,29 +314,29 @@ function SWEP:DrawHUD()
local y = ScrH() * 0.5
local scalebywidth = ( ScrW() / 1024 ) * 10
local scale = self.Primary.Cone
-
+
if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then
-
+
scale = self.Primary.Cone * 1.75
-
+
elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then
-
+
scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 )
-
+
end
-
+
scale = scale * scalebywidth
-
+
local dist = math.abs( self.CrosshairScale - scale )
self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 )
-
+
local gap = 40 * self.CrosshairScale
local length = gap + self.CrossLength:GetInt()
-
+
surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() )
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-
+
end
diff --git a/entities/weapons/rad_tmp/shared.lua b/entities/weapons/rad_tmp/shared.lua
index f0a794a..0653b17 100644
--- a/entities/weapons/rad_tmp/shared.lua
+++ b/entities/weapons/rad_tmp/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "TMP"
SWEP.IconLetter = "x"
SWEP.Slot = 3
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "rpg"
diff --git a/entities/weapons/rad_ump45/shared.lua b/entities/weapons/rad_ump45/shared.lua
index b8191ca..6f232d1 100644
--- a/entities/weapons/rad_ump45/shared.lua
+++ b/entities/weapons/rad_ump45/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "HK UMP45"
SWEP.IconLetter = "q"
SWEP.Slot = 3
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "smg"
diff --git a/entities/weapons/rad_usp/shared.lua b/entities/weapons/rad_usp/shared.lua
index 91db700..ea321a3 100644
--- a/entities/weapons/rad_usp/shared.lua
+++ b/entities/weapons/rad_usp/shared.lua
@@ -1,18 +1,18 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = true
-
+
SWEP.PrintName = "USP Compact"
SWEP.IconLetter = "a"
SWEP.Slot = 2
SWEP.Slotpos = 2
-
+
end
SWEP.HoldType = "pistol"
diff --git a/entities/weapons/rad_z_banshee/shared.lua b/entities/weapons/rad_z_banshee/shared.lua
index 00e881a..eae8fd9 100644
--- a/entities/weapons/rad_z_banshee/shared.lua
+++ b/entities/weapons/rad_z_banshee/shared.lua
@@ -1,21 +1,21 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Claws"
SWEP.IconLetter = "C"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
killicon.AddFont( "rad_z_banshee", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
-
+
end
SWEP.Base = "rad_z_base"
@@ -49,11 +49,11 @@ end
function SWEP:Holster()
if SERVER then
-
+
self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(40,60) )
-
+
end
-
+
return true
end
@@ -61,57 +61,57 @@ end
function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + 8 )
-
+
if SERVER then
-
+
self.Owner:VoiceSound( self.Taunt, 100, math.random( 90, 100 ) )
-
+
local hit = false
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
local dist = v:GetPos():Distance( self.Owner:GetPos() )
-
+
if dist <= 350 then
-
+
local scale = 1 - ( dist / 350 )
local count = math.Round( scale * 4 )
-
+
umsg.Start( "Drunk", v )
umsg.Short( count )
umsg.End()
umsg.Start( "ScreamHit", v )
umsg.End()
-
+
v:TakeDamage( scale * 20, self.Owner, self.Weapon )
v:SetDSP( 34, false )
-
+
self.Owner:AddZedDamage( 5 )
-
+
hit = true
-
+
end
-
+
end
-
+
if hit then
-
+
self.Owner:Notice( "You disoriented a human", GAMEMODE.Colors.Green )
-
+
end
-
+
end
end
function SWEP:PrimaryAttack()
-
+
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(130,150) )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
-
+
self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 )
-
+
end
function SWEP:OnHitHuman( ent, dmg )
@@ -119,13 +119,13 @@ function SWEP:OnHitHuman( ent, dmg )
if ent:GetRadiation() != 5 then
ent:AddRadiation( 1 )
-
+
self.Owner:AddZedDamage( 10 )
-
+
end
-
+
self.Owner:AddZedDamage( dmg )
self.Owner:DrawBlood( 4 )
self.Owner:Notice( "You irradiated a human", GAMEMODE.Colors.Green )
-end \ No newline at end of file
+end
diff --git a/entities/weapons/rad_z_base/shared.lua b/entities/weapons/rad_z_base/shared.lua
index 0748b8d..3ccbcf0 100644
--- a/entities/weapons/rad_z_base/shared.lua
+++ b/entities/weapons/rad_z_base/shared.lua
@@ -1,21 +1,21 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Claws"
SWEP.IconLetter = "C"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
killicon.AddFont( "rad_z_common", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) );
-
+
end
SWEP.HoldType = "slam"
@@ -44,7 +44,7 @@ SWEP.Primary.Automatic = true
function SWEP:GetViewModelPosition( pos, ang )
return pos, ang
-
+
end
function SWEP:NoobHelp()
@@ -56,13 +56,13 @@ end
function SWEP:Deploy()
self.Owner:DrawWorldModel( false )
-
+
if SERVER then
-
+
self.Weapon:NoobHelp()
-
+
end
-
+
return true
end
@@ -70,11 +70,11 @@ end
function SWEP:Holster()
if SERVER then
-
- self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) )
-
+
+ self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) )
+
end
-
+
return true
end
@@ -82,32 +82,32 @@ end
function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + 2.5 )
-
+
if SERVER then
-
+
self.Owner:VoiceSound( table.Random( self.Taunt ), 100, math.random( 90, 100 ) )
-
+
end
end
function SWEP:PrimaryAttack()
-
+
self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,110) )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
-
+
self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 )
-
+
end
-function SWEP:Think()
+function SWEP:Think()
if self.ThinkTime != 0 and self.ThinkTime < CurTime() then
-
+
self.Weapon:MeleeTrace( self.Primary.Damage )
-
+
self.ThinkTime = 0
-
+
end
end
@@ -115,40 +115,40 @@ end
function SWEP:OnHitHuman( ent, dmg )
if not ent:IsInfected() then
-
+
ent:SetInfected( true )
-
+
self.Owner:Notice( "You infected a human", GAMEMODE.Colors.Green )
self.Owner:AddZedDamage( 15 )
-
+
end
-
+
self.Owner:AddZedDamage( dmg )
self.Owner:DrawBlood( 3 )
-
+
end
function SWEP:MeleeTrace( dmg )
-
+
self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
+
self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER )
-
+
if CLIENT then return end
-
+
self.Weapon:SetNWString( "CurrentAnim", "zattack" .. math.random(1,3) )
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
local pos = self.Owner:GetShootPos()
local aim = self.Owner:GetAimVector() * 80
-
+
local line = {}
line.start = pos
line.endpos = pos + aim
line.filter = self.Owner
-
+
local linetr = util.TraceLine( line )
-
+
local tr = {}
tr.start = pos + self.Owner:GetAimVector() * -5
tr.endpos = pos + aim
@@ -160,54 +160,54 @@ function SWEP:MeleeTrace( dmg )
local trace = util.TraceHull( tr )
local ent = trace.Entity
local ent2 = linetr.Entity
-
+
if not IsValid( ent ) and IsValid( ent2 ) then
-
+
ent = ent2
-
+
end
- if not IsValid( ent ) then
-
+ if not IsValid( ent ) then
+
self.Owner:EmitSound( self.Primary.Miss, 100, math.random(90,110) )
-
- return
-
+
+ return
+
elseif not ent:IsWorld() then
-
+
if ent:IsPlayer() and ent:Team() == TEAM_ARMY then
-
+
ent:TakeDamage( dmg, self.Owner, self.Weapon )
ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) )
-
+
self.Weapon:OnHitHuman( ent, dmg )
-
+
local ed = EffectData()
ed:SetOrigin( trace.HitPos )
util.Effect( "BloodImpact", ed, true, true )
-
+
elseif string.find( ent:GetClass(), "npc" ) then
-
+
ent:TakeDamage( 20, self.Owner, self.Weapon )
ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) )
-
- elseif !ent:IsPlayer() then
-
+
+ elseif !ent:IsPlayer() then
+
if ent:GetClass() == "prop_door_rotating" then
-
+
if not ent.Hits then
-
+
ent.Hits = 1
ent.MaxHits = math.random(5,10)
-
+
ent:EmitSound( Sound( "Wood_Plank.Break" ) )
-
+
else
-
+
ent.Hits = ent.Hits + 1
-
+
if ent.Hits > ent.MaxHits then
-
+
local prop = ents.Create( "prop_physics" )
prop:SetPos( ent:GetPos() )
prop:SetAngles( ent:GetAngles() + Angle(10,0,2) )
@@ -215,75 +215,75 @@ function SWEP:MeleeTrace( dmg )
prop:SetSkin( ent:GetSkin() )
prop:SetCollisionGroup( COLLISION_GROUP_WEAPON )
prop:Spawn()
-
- local dir = ent:GetPos() - self.Owner:GetShootPos()
+
+ local dir = ent:GetPos() - self.Owner:GetShootPos()
dir:Normalize()
-
+
local phys = prop:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:ApplyForceCenter( dir * phys:GetMass() * 800 )
end
-
+
ent:EmitSound( Sound( "Wood_Crate.Break" ) )
ent:Remove()
-
+
return
-
+
else
-
+
ent:EmitSound( Sound( "Wood_Plank.Break" ) )
-
+
end
-
+
end
-
+
elseif string.find( ent:GetClass(), "breakable" ) then
-
+
ent:TakeDamage( 50, self.Owner, self.Weapon )
ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) )
-
+
if ent:GetClass() == "func_breakable_surf" then
-
+
ent:Fire( "shatter", "1 1 1", 0 )
-
+
return
-
+
end
-
+
end
-
+
local phys = ent:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
ent:SetPhysicsAttacker( self.Owner )
ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) )
-
+
if ent.IsWood then
-
+
ent:TakeDamage( 75, self.Owner, self.Weapon )
ent:EmitSound( self.Primary.Door )
-
+
else
-
+
ent:TakeDamage( 25, self.Owner, self.Weapon )
-
+
end
-
+
phys:Wake()
phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 400 )
-
+
end
-
+
end
-
+
end
end
function SWEP:DrawHUD()
-
+
end
diff --git a/entities/weapons/rad_z_contagion/shared.lua b/entities/weapons/rad_z_contagion/shared.lua
index 0bfb142..ace303b 100644
--- a/entities/weapons/rad_z_contagion/shared.lua
+++ b/entities/weapons/rad_z_contagion/shared.lua
@@ -1,21 +1,21 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Claws"
SWEP.IconLetter = "C"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
killicon.AddFont( "rad_z_contagion", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
-
+
end
SWEP.Base = "rad_z_base"
@@ -59,7 +59,7 @@ end
function SWEP:OnHitHuman( ent, dmg )
ent:ViewBounce( 20 )
-
+
self.Owner:AddZedDamage( dmg )
self.Owner:DrawBlood( 5 )
diff --git a/entities/weapons/rad_z_leaper/shared.lua b/entities/weapons/rad_z_leaper/shared.lua
index e123b48..ee4db39 100644
--- a/entities/weapons/rad_z_leaper/shared.lua
+++ b/entities/weapons/rad_z_leaper/shared.lua
@@ -1,21 +1,21 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Claws"
SWEP.IconLetter = "C"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
killicon.AddFont( "rad_z_leaper", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
-
+
end
SWEP.Base = "rad_z_base"
@@ -53,28 +53,28 @@ function SWEP:NoobHelp()
end
-function SWEP:Think()
+function SWEP:Think()
if self.ThinkTime != 0 and self.ThinkTime < CurTime() then
-
+
self.Weapon:MeleeTrace( self.Primary.Damage )
-
+
self.ThinkTime = 0
-
+
end
-
+
if CLIENT then return end
-
+
if self.JumpTime < CurTime() and self.Owner:KeyDown( IN_SPEED ) then
-
+
local vec = self.Owner:GetAimVector()
vec.z = math.Clamp( vec.z, 0.40, 0.75 )
-
+
self.JumpTime = CurTime() + 8
-
+
self.Owner:SetVelocity( vec * 800 )
self.Owner:EmitSound( self.Scream, 100, math.random( 90, 110 ) )
-
+
end
end
@@ -84,13 +84,13 @@ function SWEP:OnHitHuman( ent, dmg )
if not ent:IsBleeding() then
ent:SetBleeding( true )
-
+
self.Owner:Notice( "You made a human bleed", GAMEMODE.Colors.Green )
self.Owner:AddZedDamage( 10 )
-
+
end
-
+
self.Owner:AddZedDamage( dmg )
self.Owner:DrawBlood( 5 )
-
+
end
diff --git a/entities/weapons/rad_z_runner/shared.lua b/entities/weapons/rad_z_runner/shared.lua
index feeae59..a9e766f 100644
--- a/entities/weapons/rad_z_runner/shared.lua
+++ b/entities/weapons/rad_z_runner/shared.lua
@@ -1,21 +1,21 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "Claws"
SWEP.IconLetter = "C"
SWEP.Slot = 0
SWEP.Slotpos = 0
-
+
killicon.AddFont( "rad_z_runner", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) );
-
+
end
SWEP.HoldType = "slam"
diff --git a/gamemode/animations.lua b/gamemode/animations.lua
index 3fac3ce..de9764e 100644
--- a/gamemode/animations.lua
+++ b/gamemode/animations.lua
@@ -4,7 +4,7 @@ function GM:UpdateAnimation( ply, velocity, maxseqgroundspeed )
if ply:Team() == TEAM_UNASSIGNED then return end
player_manager.RunClass( ply, "UpdateAnimation", velocity, maxseqgroundspeed )
-
+
end
function GM:CalcMainActivity( ply, velocity )
@@ -12,7 +12,7 @@ function GM:CalcMainActivity( ply, velocity )
if ply:Team() == TEAM_UNASSIGNED then return end
return player_manager.RunClass( ply, "CalcMainActivity", velocity )
-
+
end
function GM:TranslateActivity( ply, act )
@@ -20,7 +20,7 @@ function GM:TranslateActivity( ply, act )
if ply:Team() == TEAM_UNASSIGNED then return end
return player_manager.RunClass( ply, "TranslateActivity", act )
-
+
end
function GM:DoAnimationEvent( ply, event, data )
@@ -28,5 +28,5 @@ function GM:DoAnimationEvent( ply, event, data )
if ply:Team() == TEAM_UNASSIGNED then return end
return player_manager.RunClass( ply, "DoAnimationEvent", event, data )
-
-end \ No newline at end of file
+
+end
diff --git a/gamemode/cl_hudstains.lua b/gamemode/cl_hudstains.lua
index 9b2b637..587b1dc 100644
--- a/gamemode/cl_hudstains.lua
+++ b/gamemode/cl_hudstains.lua
@@ -2,46 +2,46 @@
local BloodTable = {}
local function DrawBlood()
-
+
if #BloodTable < 1 then return end
for i=1, #BloodTable do
-
+
if BloodTable[i] then
-
+
local scale = math.Clamp( ( BloodTable[i].DieTime - CurTime() ) / BloodTable[i].Die, 0, 1 )
-
+
if scale == 0 then
-
+
BloodTable[i].Remove = true
-
+
else
-
+
local alpha = math.floor( BloodTable[i].Alpha * scale )
-
+
surface.SetTexture( BloodTable[i].Mat )
//surface.SetDrawColor( 250, 10, 10, alpha )
surface.SetDrawColor( 175, 10, 10, alpha )
surface.DrawTexturedRect( BloodTable[i].X, BloodTable[i].Y, BloodTable[i].Size, BloodTable[i].Size )//, BloodTable[i].Rot )
-
+
end
-
+
end
-
+
end
-
+
for k,v in pairs( BloodTable ) do
-
+
if v.Remove then
-
+
table.remove( BloodTable, k )
-
+
break
-
+
end
-
+
end
-
+
end
hook.Add( "HUDPaint", "BloodPaint", DrawBlood )
@@ -51,31 +51,31 @@ StainMats = { "nuke/blood/Blood1",
"nuke/blood/Blood4",
"nuke/blood/Blood5",
"nuke/blood/Blood6",
-"nuke/blood/Blood7" }
+"nuke/blood/Blood7" }
function AddStain( msg )
local num = 1
- if msg then
-
+ if msg then
+
num = msg:ReadShort()
-
+
end
-
+
for i=1, num do
local count = #BloodTable + 1
-
+
local size = math.random( 256, 1024 )
local x = math.random( size * -0.5, ScrW() - ( size * 0.5 ) )
local y = math.random( size * -0.5, ScrH() - ( size * 0.5 ) )
local rand = math.Rand( 3.5, 6.5 )
-
+
BloodTable[count] = { Size = size, X = x, Y = y, Mat = surface.GetTextureID( table.Random( StainMats ) ), Die = rand, DieTime = CurTime() + rand, Alpha = math.random( 150, 250 ) }
-
+
end
-
+
end
-usermessage.Hook( "BloodStain", AddStain )
+usermessage.Hook( "BloodStain", AddStain )
diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua
index e9ba2a8..1933025 100644
--- a/gamemode/cl_init.lua
+++ b/gamemode/cl_init.lua
@@ -38,7 +38,7 @@ CV_Density = CreateClientConVar( "cl_redead_rain_density", "1.0", true, false )
CV_NoobHelp = CreateClientConVar( "cl_redead_noob_help", "1", true, false )
function GM:Initialize()
-
+
WindVector = Vector( math.random(-10,10), math.random(-10,10), 0 )
StaticPos = Vector(0,0,0)
ViewWobble = 0
@@ -52,7 +52,7 @@ function GM:Initialize()
DeathScreenScale = 0
HeartBeat = 0
JumpTimer = 0
-
+
surface.CreateFont ( "DeathFont", { size = 34, weight = 200, antialias = true, additive = true, font = "Graffiare" } )
surface.CreateFont ( "AmmoFont", { size = 28, weight = 200, antialias = true, additive = true, font = "Graffiare" } )
surface.CreateFont ( "CashFont", { size = 22, weight = 200, antialias = true, additive = true, font = "Graffiare" } )
@@ -70,25 +70,25 @@ function GM:Initialize()
//matArm = Material( "radbox/radar_arm" )
//matArrow = Material( "radbox/radar_arrow" )
//matNoise = Material( "radbox/nvg_noise" )
-
+
matHealth = Material( "radbox/img_health" )
matStamina = Material( "radbox/img_stamina" )
matBlood = Material( "radbox/img_blood" )
matRadiation = Material( "radbox/img_radiation" )
matInfection = Material( "radbox/img_infect" )
-
+
GAMEMODE:WeatherInit()
-
+
end
function GM:GetHelpHTML()
local str = ""
-
+
for k,v in pairs( GAMEMODE.HelpText ) do
-
+
str = str .. v
-
+
end
return str
@@ -99,13 +99,13 @@ end
function GM:ShowHelp()
if IsValid( self.HelpFrame ) then return end
-
+
self.HelpFrame = vgui.Create( "HelpMenu" )
self.HelpFrame:SetSize( 415, 370 )
self.HelpFrame:Center()
self.HelpFrame:MakePopup()
self.HelpFrame:SetKeyboardInputEnabled( false )
-
+
end
function GM:ShowClasses()
@@ -114,7 +114,7 @@ function GM:ShowClasses()
classmenu:SetSize( 415, 475 )
classmenu:Center()
classmenu:MakePopup()]]
-
+
GAMEMODE:ShowHelp()
end
@@ -122,7 +122,7 @@ end
function GM:ShowZombieClasses()
if IsValid( self.Classes ) then return end
-
+
self.Classes = vgui.Create( "ZombieClassPicker" )
self.Classes:SetSize( 415, 475 )
self.Classes:Center()
@@ -133,21 +133,21 @@ end
function GM:HUDShouldDraw( name )
if GAMEMODE.ScoreboardVisible then return false end
-
+
for k, v in pairs{ "CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo", "CHudSuitPower", "CHudPoisonDamageIndicator", "CHudCrosshair" } do
-
- if name == v then return false end
-
- end
-
+
+ if name == v then return false end
+
+ end
+
if name == "CHudDamageIndicator" and not LocalPlayer():Alive() then
-
+
return false
-
+
end
-
+
return true
-
+
end
function GM:Think()
@@ -157,178 +157,178 @@ function GM:Think()
GAMEMODE:GoreRagdolls()
GAMEMODE:HUDTraces()
//GAMEMODE:SpawnRagdolls()
-
+
if GetGlobalBool( "GameOver", false ) and not EndScreenShown then
-
+
EndScreenShown = true
-
+
local endscreen = vgui.Create( "EndGame" )
endscreen:SetPos(0,0)
-
+
end
if IsValid( LocalPlayer() ) and LocalPlayer():Alive() and not StartMenuShown then
-
+
StartMenuShown = true
GAMEMODE:ShowClasses()
-
+
//player_manager.SetPlayerClass( LocalPlayer(), "player_base" )
-
+
end
if not LocalPlayer():Alive() and GAMEMODE:ElementsVisible() then
-
+
GAMEMODE:ClearElements()
-
+
gui.EnableScreenClicker( false )
-
+
end
-
+
if LocalPlayer():Team() != TEAM_ARMY then return end
if LocalPlayer():Alive() and HeartBeat < CurTime() and ( LocalPlayer():GetNWBool( "Bleeding", false ) or LocalPlayer():Health() < 50 ) then
-
+
local scale = LocalPlayer():Health() / 100
HeartBeat = CurTime() + 0.5 + scale * 1.5
-
+
LocalPlayer():EmitSound( Sound( "nuke/heartbeat.wav" ), 100, 150 - scale * 50 )
-
+
end
-
+
--[[if Inv_HasItem( "models/gibs/shield_scanner_gib1.mdl" ) then
-
+
MaxDist = 2200
ArmSpeed = 90
-
+
else
-
+
MaxDist = 1500
ArmSpeed = 70
-
+
end
if ( NextRadarThink or 0 ) < CurTime() then
-
+
NextRadarThink = CurTime() + 1.5
-
- RadarEntTable = team.GetPlayers( TEAM_ZOMBIES )
+
+ RadarEntTable = team.GetPlayers( TEAM_ZOMBIES )
RadarEntTable = table.Add( RadarEntTable, team.GetPlayers( TEAM_ARMY ) )
RadarEntTable = table.Add( RadarEntTable, ents.FindByClass( "npc_*" ) )
RadarEntTable = table.Add( RadarEntTable, ents.FindByClass( "sent_lootbag" ) )
RadarEntTable = table.Add( RadarEntTable, ents.FindByClass( "point_stash" ) )
RadarEntTable = table.Add( RadarEntTable, ents.FindByClass( "sent_supplycrate" ) )
RadarEntTable = table.Add( RadarEntTable, ents.FindByClass( "sent_antidote" ) )
-
+
end
-
+
local aimvec = LocalPlayer():GetAimVector()
-
+
for k,v in pairs( RadarEntTable ) do
-
+
if not IsValid( v ) then break end
-
+
local dirp = ( LocalPlayer():GetPos() - v:GetPos() ):GetNormal()
local aimvec = LocalPlayer():GetAimVector()
aimvec.z = dirp.z
-
+
local dir = ( aimvec:Angle() + Angle( 0, ArmAngle + 90, 0 ) ):Forward()
local dot = dir:Dot( dirp )
local diff = ( v:GetPos() - LocalPlayer():GetPos() )
-
+
local close = math.sqrt( diff.x * diff.x + diff.y * diff.y ) < MaxDist * FadeDist
if ( !v:IsPlayer() or ( v:Alive() and ( v != LocalPlayer() and ( v:Team() == LocalPlayer():Team() or close ) ) ) ) and !IsOnRadar( v ) and ( dot > 0.99 or close ) then
-
+
local pos = v:GetPos()
local color = Color( 0, 255, 0 )
-
+
if not v:IsPlayer() then
-
+
color = Color( 80, 150, 255 )
-
+
if v:GetClass() == "sent_antidote" or v:GetClass() == "sent_supplycrate" then
-
+
color = Color( 255, 255, 255 )
-
+
elseif v:IsNPC() then
-
+
if v:GetClass() == "npc_scientist" then
-
+
color = Color( 200, 200, 0 )
-
+
else
-
+
color = Color( 255, 80, 80 )
-
+
end
-
+
end
-
+
elseif v:IsPlayer() and v:Team() != LocalPlayer():Team() then
-
+
color = Color( 255, 80, 80 )
-
+
end
-
+
local dietime = CurTime() + BlipTime
-
+
if close then
-
+
dietime = -1
-
+
end
-
+
table.insert( PosTable, { Ent = v, Pos = pos, DieTime = dietime, Color = color } )
-
+
end
-
+
end]]
-
+
end
function GM:FadeRagdolls()
for k,v in pairs( ents.FindByClass( "class C_ClientRagdoll" ) ) do
-
+
if v.Time and v.Time < CurTime() then
-
+
//v:SetColor( Color( 255, 255, 255, v.Alpha ) )
//v.Alpha = math.Approach( v.Alpha, 0, -2 )
-
+
//if v.Alpha <= 0 then
//v:Remove()
//end
-
+
v:Remove()
-
+
elseif not v.Time then
-
+
v.Time = CurTime() + 12
//v.Alpha = 255
-
+
end
-
+
end
-
+
end
function GM:GetNearestEnt( pos, dist, tbl )
- local closest
+ local closest
local best = 9000
for k,v in pairs( tbl ) do
-
+
local newdist = v:GetPos():Distance( pos )
-
+
if newdist < dist and newdist < best then
-
+
closest = v
-
+
end
-
+
end
-
+
return closest
end
@@ -343,205 +343,205 @@ function GM:GoreRagdolls()
tbl = table.Add( tbl, ents.FindByClass( "class C_ClientRagdoll" ) )
for k,v in pairs( tbl ) do
-
+
if not v.Gore and table.HasValue( GAMEMODE.Corpses, string.lower( v:GetModel() ) ) then
-
+
v.Gore = true
v:SetMaterial( "models/flesh" )
-
+
local phys = v:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
phys:ApplyForceCenter( VectorRand() * 5000 )
-
+
end
-
+
elseif not LocalPlayer():Alive() and IsValid( LocalPlayer():GetRagdollEntity() ) and LocalPlayer():GetRagdollEntity() == v and not v.Slowed and not table.HasValue( GAMEMODE.Corpses, string.lower( v:GetModel() ) ) then
-
+
v.Slowed = true
-
+
local phys = v:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
local count = LocalPlayer():GetRagdollEntity():GetPhysicsObjectCount()
-
+
for i=0, count do
-
+
local limb = v:GetPhysicsObjectNum( i )
-
+
if IsValid( limb ) then
-
+
limb:SetDamping( 5, 0 )
limb:ApplyForceCenter( VectorRand() * 50 )
-
+
end
-
+
end
-
+
phys:Wake()
-
+
end
-
+
end
-
+
if not v.Randomized then
-
+
v.Randomized = true
-
- if math.random(1,2) == 1 then
-
+
+ if math.random(1,2) == 1 then
+
local phys = v:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
for i=1, math.random(2,6) do
-
+
local count = v:GetPhysicsObjectCount()
local limb = v:GetPhysicsObjectNum( math.random( 0, count ) )
-
+
if IsValid( limb ) then
-
+
limb:SetDamping( math.Rand( 0, 2 ), math.Rand( 0, 5 ) )
limb:ApplyForceCenter( VectorRand() * 75 )
-
+
end
-
+
phys:Wake()
-
+
end
-
+
end
-
+
end
-
+
end
-
+
end
-
+
for c,d in pairs( HeadlessTbl ) do
-
+
local ent = GAMEMODE:GetNearestEnt( d.Pos, 50, tbl )
-
+
if IsValid( ent ) and not ent.IsHeadless then
-
- ent:ManipulateBoneScale( 6, Vector( 0.01, 0.01, 0.01 ) )
- ent:ManipulateBoneScale( 6, Vector( 0.001, 0.001, 0.001 ) )
-
+
+ ent:ManipulateBoneScale( 6, Vector( 0.01, 0.01, 0.01 ) )
+ ent:ManipulateBoneScale( 6, Vector( 0.001, 0.001, 0.001 ) )
+
ent.IsHeadless = true
-
+
table.remove( HeadlessTbl, c )
-
+
break
-
+
elseif d.Time < CurTime() then
-
+
table.remove( HeadlessTbl, c )
-
+
break
-
+
end
-
+
end
-
+
for c,d in pairs( BurnTbl ) do
-
+
local ent = GAMEMODE:GetNearestEnt( d.Pos, 50, tbl )
-
+
if IsValid( ent ) and not ent.IsBurnt then
-
+
ent:SetMaterial( table.Random( GAMEMODE.GoreSheets ) )
ent.IsBurnt = true
-
+
table.remove( BurnTbl, c )
-
+
break
-
+
elseif d.Time < CurTime() then
-
+
table.remove( BurnTbl, c )
-
+
break
-
+
end
-
+
end
-
+
end
function GM:SpawnRagdolls()
local tbl = ents.FindByClass( "npc_*" )
-
+
for c,d in pairs( RagdollTbl ) do
-
+
local ent = GAMEMODE:GetNearestEnt( d.Pos, 30, tbl )
-
+
if IsValid( ent ) and not ent.Ragdolled then
-
+
ent:BecomeRagdollOnClient()
ent.Ragdolled = true
-
+
table.remove( RagdollTbl, c )
-
+
break
-
+
elseif d.Time < CurTime() then
-
+
table.remove( RagdollTbl, c )
-
+
break
-
+
end
-
+
end
-
+
end
function DrawBar( x, y, w, h, value, maxvalue, icon, colorlight, colordark, hp )
draw.RoundedBox( 4, x - 1, y, h + 1, h, Color( 0, 0, 0, 180 ) )
-
- surface.SetDrawColor( colorlight.r, colorlight.g, colorlight.b, 180 )
- surface.SetMaterial( icon )
- surface.DrawTexturedRect( x, y + 1, h - 1, h - 2 )
-
+
+ surface.SetDrawColor( colorlight.r, colorlight.g, colorlight.b, 180 )
+ surface.SetMaterial( icon )
+ surface.DrawTexturedRect( x, y + 1, h - 1, h - 2 )
+
x = x + h + 4
-
+
local w = 5 + maxvalue * 2
-
+
draw.RoundedBox( 4, x, y, w, h, Color( 0, 0, 0, 180 ) )
-
+
for i=1, value do
-
+
local grn = colorlight.g
-
+
if i <= 50 then
-
+
grn = grn + 50
-
+
end
-
+
draw.RoundedBox( 0, 1 + x + i * 2, y + 3, 1, h - 6, colordark )
draw.RoundedBox( 0, 1 + x + i * 2, y + 3 + ( h * 0.2 ), 1, h - 6 - ( h * 0.4 ), Color( colorlight.r, grn, colorlight.b ) )
-
+
--[[if hp then
-
+
if i % 6 == 0 or ( i + 1 ) % 6 == 0 or ( i + 2 ) % 6 == 0 then
-
+
draw.RoundedBox( 0, 1 + x + i * 2, y + 3, 1, ( h * ( math.sin( CurTime() * 3 + i ) * 0.2 + 0.5 ) ) - 3, Color( colorlight.r, grn, colorlight.b ) )
-
+
end
-
+
draw.RoundedBox( 0, 1 + x + i * 2, y + 3, 1, ( h * 0.4 ) - 3, Color( colorlight.r, grn, colorlight.b ) )
-
+
else
-
+
draw.RoundedBox( 0, 1 + x + i * 2, y + 3, 1, ( h * ( math.sin( ( CurTime() * 0.1 + i * 0.5 ) ) * ( math.sin( CurTime() * 2 ) * 0.15 ) + 0.5 ) ) - 3, Color( colorlight.r, grn, colorlight.b ) )
-
+
end]]
-
+
end
end
@@ -549,10 +549,10 @@ end
function DrawIcon( x, y, w, h, icon, color )
draw.RoundedBox( 4, x - 1, y, h + 1, h, Color( 0, 0, 0, 180 ) )
-
- surface.SetDrawColor( color.r, color.g, color.b, 180 )
- surface.SetMaterial( icon )
- surface.DrawTexturedRect( x, y + 1, h - 1, h - 2 )
+
+ surface.SetDrawColor( color.r, color.g, color.b, 180 )
+ surface.SetMaterial( icon )
+ surface.DrawTexturedRect( x, y + 1, h - 1, h - 2 )
end
@@ -561,10 +561,10 @@ function DrawAmmo( x, y, w, h, text, label )
if not IsValid( LocalPlayer():GetActiveWeapon() ) then return end
draw.RoundedBox( 4, x, y, w, h, Color( 0, 0, 0, 180 ) )
-
+
draw.SimpleText( text, "AmmoFont", x + 5, y + ( h * 0.5 ) - 5, Color( 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( label, "AmmoFontSmall", x + 5, y + 5, Color( 255, 255, 150 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
end
function DrawCash( x, y, w, h, text )
@@ -580,39 +580,39 @@ function GM:GetAfflictions()
local cols = { Color( 40, 200, 40 ), Color( 80, 150, 40 ), Color( 150, 150, 0 ), Color( 200, 100, 40 ), Color( 255, 40, 40 ) }
if LocalPlayer():GetNWBool( "Infected", false ) then
-
+
table.insert( tbl, { Icon = matInfection, Color = Color( 40, 200, 40 ) } )
-
+
end
-
+
if LocalPlayer():GetNWBool( "Bleeding", false ) then
-
+
table.insert( tbl, { Icon = matBlood, Color = Color( 225, 40, 40 ) } )
-
+
end
-
+
if LocalPlayer():GetNWInt( "Radiation", 0 ) > 0 then
table.insert( tbl, { Icon = matRadiation, Color = cols[ LocalPlayer():GetNWInt( "Radiation", 1 ) ] } )
-
+
end
-
+
return tbl
end
function GM:GetHealthColor()
-
+
local hp = math.Clamp( LocalPlayer():Health(), 0, 500 )
-
+
if hp > 150 then
-
+
return Color( 0, 255, 255 )
-
+
end
-
+
local scale = hp / 150
-
+
return Color( ( 1 - scale ) * 255, scale * 255, scale * 255 )
end
@@ -623,32 +623,32 @@ function GM:DrawMarkers()
tbl = table.Add( tbl, ents.FindByClass( "sent_antidote" ) )
for k,v in pairs( tbl ) do
-
+
local sc = v:GetPos():ToScreen()
-
+
if sc.visible then
-
+
local text = "antidote"
local offset = ( v:GetPos() + Vector(0,0,80) ):ToScreen()
local dist = v:GetPos():Distance( LocalPlayer():GetPos() )
local maxdist = 1600
-
+
if v:GetClass() == "sent_heliflare" then
-
+
text = "evac zone"
offset = ( v:GetPos() + Vector(0,0,40) ):ToScreen()
maxdist = 600
-
+
end
-
+
local alpha = math.Clamp( dist - maxdist, 0, 200 ) / 200
-
+
sc.y = sc.y + ( offset.y - sc.y )
-
+
draw.SimpleText( text, "HudMarker", sc.x, sc.y, Color( 255, 255, 255, alpha * 255 ), TEXT_ALIGN_CENTER )
-
+
end
-
+
end
end
@@ -656,299 +656,299 @@ end
function GM:HUDPaint()
if GetGlobalBool( "GameOver", false ) then return end
-
+
if LocalPlayer():IsFrozen() then return end
-
+
if LocalPlayer():Team() == TEAM_ZOMBIES then
-
+
GAMEMODE:PaintWeather()
-
+
if not LocalPlayer():Alive() then
-
- DeathScreenScale = math.Approach( DeathScreenScale, 1, FrameTime() * 0.3 )
-
+
+ DeathScreenScale = math.Approach( DeathScreenScale, 1, FrameTime() * 0.3 )
+
draw.RoundedBox( 0, 0, 0, ScrW(), ScrH() * ( 0.15 * DeathScreenScale ), Color( 0, 0, 0, 180 ) )
draw.RoundedBox( 0, 0, ScrH() - ( ScrH() * ( 0.15 * DeathScreenScale ) ), ScrW(), ScrH() * ( 0.15 * DeathScreenScale ), Color( 0, 0, 0, 180 ) )
-
+
if DeathScreenScale == 1 then
-
+
local dtime = math.Round( DeathScreenTime - CurTime() )
-
+
if dtime > 0 then
-
+
draw.SimpleText( "YOU WILL RESPAWN IN "..dtime.." SECONDS", "DeathFont", ScrW() * 0.5, ScrH() * 0.1, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
else
-
+
draw.SimpleText( "PRESS ANY KEY TO RESPAWN", "DeathFont", ScrW() * 0.5, ScrH() * 0.1, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
draw.SimpleText( DeathScreenText or "POOP", "DeathFont", ScrW() * 0.5, ScrH() * 0.9, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
else
-
+
local hp = math.Clamp( LocalPlayer():Health(), 0, 500 )
local x, y = 40, ScrH() - 60
-
+
surface.SetFont( "ZombieHud" )
local w, h = surface.GetTextSize( "Health: " .. hp )
-
+
draw.RoundedBox( 4, 30, ScrH() - 70, w + 20, h + 20, Color( 0, 0, 0, 180 ) )
-
+
draw.SimpleText( "Health: " .. hp, "ZombieHud", x+1, y+1, Color(40,40,40), TEXT_ALIGN_LEFT )
draw.SimpleText( "Health: " .. hp, "ZombieHud", x+1, y-1, Color(40,40,40), TEXT_ALIGN_LEFT )
draw.SimpleText( "Health: " .. hp, "ZombieHud", x-1, y-1, Color(40,40,40), TEXT_ALIGN_LEFT )
draw.SimpleText( "Health: " .. hp, "ZombieHud", x-1, y+1, Color(40,40,40), TEXT_ALIGN_LEFT )
draw.SimpleText( "Health: " .. hp, "ZombieHud", x, y, GAMEMODE:GetHealthColor(), TEXT_ALIGN_LEFT )
-
+
if not LocalPlayer():GetNWBool( "Lord", false ) then return end
-
+
local xpos, ypos = x + w + 20, ScrH() - 70
local w = 200
local scale = math.floor( w * math.Clamp( LocalPlayer():GetNWInt( "ZedDamage", 0 ) / GAMEMODE.RedemptionDamage, 0.01, 1.00 ) )
local pos = 0
-
+
draw.RoundedBox( 4, xpos, ypos, w + 20, h + 20, Color( 0, 0, 0, 180 ) )
-
+
if scale == 200 then
-
+
draw.RoundedBox( 0, xpos + 10, ScrH() - 60, scale, h, Color( 200, 0, 0, 200 ) )
-
+
else
-
+
draw.RoundedBox( 0, xpos + 10, ScrH() - 60, scale, h, Color( 100, 0, 0, 200 ) )
-
+
end
-
+
while pos < scale do
-
- local width = math.min( math.random( 10, 50 ), math.max( scale - pos, 1 ) )
-
- local tbl = {}
+
+ local width = math.min( math.random( 10, 50 ), math.max( scale - pos, 1 ) )
+
+ local tbl = {}
tbl.texture = surface.GetTextureID( "nuke/redead/noise0" .. math.random(1,3) )
tbl.x = xpos + pos + 10
- tbl.y = ScrH() - 60
+ tbl.y = ScrH() - 60
tbl.w = width
tbl.h = h
-
+
if scale == 200 then
-
- tbl.color = Color( 250, 125 + math.sin( CurTime() * 5 ) * 125, 125 + math.sin( CurTime() * 5 ) * 125, 250 )
-
+
+ tbl.color = Color( 250, 125 + math.sin( CurTime() * 5 ) * 125, 125 + math.sin( CurTime() * 5 ) * 125, 250 )
+
else
-
- tbl.color = Color( 250, 0, 0, 200 )
-
+
+ tbl.color = Color( 250, 0, 0, 200 )
+
end
-
+
draw.TexturedQuad( tbl )
-
+
pos = pos + width
-
+
end
-
+
end
-
+
return
-
+
end
-
+
GAMEMODE:HUDDrawTargetID()
-
+
if not LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_UNASSIGNED then
-
- DeathScreenScale = math.Approach( DeathScreenScale, 1, FrameTime() * 0.3 )
-
+
+ DeathScreenScale = math.Approach( DeathScreenScale, 1, FrameTime() * 0.3 )
+
draw.RoundedBox( 0, 0, 0, ScrW(), ScrH() * ( 0.15 * DeathScreenScale ), Color( 0, 0, 0, 180 ) )
draw.RoundedBox( 0, 0, ScrH() - ( ScrH() * ( 0.15 * DeathScreenScale ) ), ScrW(), ScrH() * ( 0.15 * DeathScreenScale ), Color( 0, 0, 0, 180 ) )
-
+
if DeathScreenScale == 1 then
-
+
local dtime = math.Round( DeathScreenTime - CurTime() )
-
+
if dtime > 0 then
-
+
draw.SimpleText( "YOU WILL RESPAWN IN "..dtime.." SECONDS", "DeathFont", ScrW() * 0.5, ScrH() * 0.1, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
else
-
+
draw.SimpleText( "PRESS ANY KEY TO RESPAWN", "DeathFont", ScrW() * 0.5, ScrH() * 0.1, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
draw.SimpleText( DeathScreenText or "POOP", "DeathFont", ScrW() * 0.5, ScrH() * 0.9, Color( 255, 0, 0 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
end
-
+
if not LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_UNASSIGNED then return end //or GAMEMODE:ElementsVisible() then return end
-
+
GAMEMODE:DrawMarkers()
-
+
local xlen = 200
local ylen = 25
local xpos = 5
local ypos = ScrH() - 5 - ylen
-
+
DrawBar( xpos, ypos, xlen, ylen, LocalPlayer():Health(), 150, matHealth, Color( 225, 50, 50, 255 ), Color( 175, 25, 25, 255 ), true )
-
+
ypos = ScrH() - 10 - ylen * 2
-
+
local stam = LocalPlayer():GetNWInt( "Stamina", 0 )
-
+
DrawBar( xpos, ypos, xlen, ylen, stam, 150, matStamina, Color( 50, 100, 225, 255 ), Color( 25, 50, 175, 255 ), false )
-
+
local tbl = GAMEMODE:GetAfflictions()
-
+
for k,v in pairs( tbl ) do
-
+
ypos = ScrH() - ( 10 + ( k * 5 ) ) - ylen * ( 2 + k )
-
+
DrawIcon( xpos, ypos, xlen, ylen, v.Icon, v.Color )
-
+
end
-
+
local ylen = 55
local ypos = 35
-
+
if IsValid( LocalPlayer():GetActiveWeapon() ) and ( LocalPlayer():GetActiveWeapon().AmmoType or "SMG" ) != "Knife" then
-
+
local total = LocalPlayer():GetNWInt( "Ammo" .. ( LocalPlayer():GetActiveWeapon().AmmoType or "SMG" ), 0 )
local ammo = math.Clamp( LocalPlayer():GetActiveWeapon():Clip1(), 0, total )
-
+
local xlen = 50
-
+
DrawAmmo( ScrW() - 5 - xlen, ScrH() - ylen - 5, xlen, ylen, total, "TOTAL" )
DrawAmmo( ScrW() - 10 - xlen * 2, ScrH() - ylen - 5, xlen, ylen, ammo, "AMMO" )
-
+
ypos = ypos + ylen + 5
-
+
end
-
+
DrawCash( ScrW() - 110, ScrH() - ypos, 105, 30, string.upper( LocalPlayer():GetNWInt( "Cash", 0 ) .. " " .. GAMEMODE.CurrencyName .. "s" ) )
GAMEMODE:PaintWeather()
- --[[local radius = 200
+ --[[local radius = 200
local centerx = ScrW() - ( radius / 2 ) - 20
local centery = 20 + ( radius / 2 )
-
+
ArmAngle = ArmAngle + FrameTime() * ArmSpeed
-
+
if ArmAngle > 360 then
ArmAngle = 0 + ( ArmAngle - 360 )
end
-
- surface.SetDrawColor( 255, 255, 255, 220 )
- surface.SetMaterial( matRadar )
- surface.DrawTexturedRect( ScrW() - radius - 20, 20, radius, radius )
-
+
+ surface.SetDrawColor( 255, 255, 255, 220 )
+ surface.SetMaterial( matRadar )
+ surface.DrawTexturedRect( ScrW() - radius - 20, 20, radius, radius )
+
local aimvec = LocalPlayer():GetAimVector()
-
+
for k,v in pairs( PosTable ) do
-
+
local diff = v.Pos - LocalPlayer():GetPos()
- local alpha = 100
-
+ local alpha = 100
+
if IsValid( v.Ent ) and ( v.Ent:IsPlayer() or v.Ent:IsNPC() ) then
-
+
diff = v.Ent:GetPos() - LocalPlayer():GetPos()
-
+
end
-
+
if v.DieTime != -1 then
-
+
alpha = 100 * ( math.Clamp( v.DieTime - CurTime(), 0, BlipTime ) / BlipTime )
-
+
elseif not IsValid( v.Ent ) then
-
+
PosTable[k].DieTime = CurTime() + 1.5
-
+
end
-
+
if math.sqrt( diff.x * diff.x + diff.y * diff.y ) > MaxDist * FadeDist and v.DieTime == -1 then
-
+
PosTable[k].DieTime = CurTime() + 1.5 // Remove the dot because they left our inner circle
-
+
end
-
+
if alpha > 0 and math.sqrt( diff.x * diff.x + diff.y * diff.y ) < MaxDist then
-
+
local addx = diff.x / MaxDist
local addy = diff.y / MaxDist
local addz = math.sqrt( addx * addx + addy * addy )
local phi = math.atan2( addx, addy ) - math.atan2( aimvec.x, aimvec.y ) - ( math.pi / 2 )
-
+
addx = math.cos( phi ) * addz
addy = math.sin( phi ) * addz
-
+
draw.RoundedBox( 4, centerx + addx * ( ( radius - 15 ) / 2 ) - 4, centery + addy * ( ( radius - 15 ) / 2 ) - 4, 5, 5, Color( v.Color.r, v.Color.g, v.Color.b, alpha ) )
-
+
end
-
+
end
-
+
for k,v in pairs( PosTable ) do
-
+
if v.DieTime != -1 and v.DieTime < CurTime() then
-
+
table.remove( PosTable, k )
-
+
end
-
+
end
-
- surface.SetDrawColor( 255, 255, 255, 220 )
+
+ surface.SetDrawColor( 255, 255, 255, 220 )
surface.SetMaterial( matArm )
- surface.DrawTexturedRectRotated( centerx, centery, radius, radius, ArmAngle )
-
+ surface.DrawTexturedRectRotated( centerx, centery, radius, radius, ArmAngle )
+
local ent = LocalPlayer():GetDTEntity( 0 )
-
+
if IsValid( ent ) or StaticPos != Vector(0,0,0) then
-
+
local ang = Angle(0,0,0)
-
+
if IsValid( ent ) then
-
+
ang = ( ent:GetPos() - LocalPlayer():GetShootPos()):Angle() - LocalPlayer():GetForward():Angle()
-
+
local diff = ( ent:GetPos() - LocalPlayer():GetPos() )
-
- if math.sqrt( diff.x * diff.x + diff.y * diff.y ) < MaxDist * FadeDist then
-
+
+ if math.sqrt( diff.x * diff.x + diff.y * diff.y ) < MaxDist * FadeDist then
+
return
-
+
end
-
+
end
-
+
if StaticPos != Vector(0,0,0) then
-
+
ang = ( StaticPos - LocalPlayer():GetShootPos()):Angle() - LocalPlayer():GetForward():Angle()
-
+
end
-
- surface.SetDrawColor( 255, 255, 255, 200 )
+
+ surface.SetDrawColor( 255, 255, 255, 200 )
surface.SetMaterial( matArrow )
surface.DrawTexturedRectRotated( centerx, centery, radius, radius, ang.y )
-
+
end]]
-
+
end
--[[function IsOnRadar( ent )
for k,v in pairs( PosTable ) do
-
+
if v.Ent == ent then
-
+
return v
-
+
end
-
+
end
end]]
@@ -976,75 +976,75 @@ end
function GM:CreateMove( cmd )
if LocalPlayer():Team() == TEAM_ZOMBIES then
-
+
if bit.band( cmd:GetButtons(), IN_DUCK ) > 0 then
-
+
cmd:SetButtons( cmd:GetButtons() - IN_DUCK )
-
+
end
-
+
local ang = cmd:GetViewAngles()
-
+
if ang.r != 0 then
-
+
ang.r = 0
cmd:SetViewAngles( ang )
-
+
end
-
+
else
-
+
local scale = LocalPlayer():GetNWInt( "Radiation", 0 ) / 5
local wobble = 0
-
+
if LocalPlayer():GetNWBool( "Infected", false ) then
-
+
scale = math.max( scale, 0.3 )
-
+
end
-
+
if scale > 0 and LocalPlayer():Alive() then
-
+
wobble = scale * 0.05
-
+
end
-
+
local drunkscale = Drunkness / 10
-
+
if Drunkness > 0 then
-
+
if ( DrunkTimer or 0 ) < CurTime() then
-
+
Drunkness = math.Clamp( Drunkness - 1, 0, 20 )
DrunkTimer = CurTime() + 15
-
+
end
-
+
wobble = wobble + ( drunkscale * 0.08 )
end
-
+
if LocalPlayer():Health() <= 75 and LocalPlayer():Alive() then
-
+
local hscale = math.Clamp( LocalPlayer():Health() / 50, 0, 1 )
wobble = wobble + ( 0.05 - 0.05 * hscale )
-
+
end
-
- ViewWobble = math.Approach( ViewWobble, wobble, FrameTime() * 0.1 )
-
+
+ ViewWobble = math.Approach( ViewWobble, wobble, FrameTime() * 0.1 )
+
local ang = cmd:GetViewAngles()
-
+
if ViewWobble > 0 or ang.r != 0 then
-
+
ang.p = ang.p + math.sin( CurTime() ) * ViewWobble
ang.y = ang.y + math.cos( CurTime() ) * ViewWobble
ang.r = math.Approach( ang.r + math.sin( CurTime() ) * ( ( ViewWobble * 0.5 ) * math.cos( CurTime() * ViewWobble ) ), 0, FrameTime() * 0.5 )
-
+
cmd:SetViewAngles( ang )
-
+
end
-
+
end
end
@@ -1052,14 +1052,14 @@ end
function GrenadeHit( msg )
DisorientTime = CurTime() + 8
-
+
end
usermessage.Hook( "GrenadeHit", GrenadeHit )
function ScreamHit( msg )
ScreamTime = CurTime() + 8
-
+
end
usermessage.Hook( "ScreamHit", ScreamHit )
@@ -1070,7 +1070,7 @@ function DeathScreen( msg )
DeathScreenScale = 0
DeathScreenTime = CurTime() + 10
DeathScreenText = table.Random( GAMEMODE.DeathScreenText[ dteam or TEAM_ARMY ] )
-
+
end
usermessage.Hook( "DeathScreen", DeathScreen )
@@ -1079,18 +1079,18 @@ usermessage.Hook( "DeathScreen", DeathScreen )
local pos = msg:ReadVector()
local burn = msg:ReadShort()
local ent = Entity( msg:ReadShort() )
-
+
if IsValid( ent ) and not ent.Ragdolled then
-
+
ent:BecomeRagdollOnClient()
ent.Ragdolled = true
-
+
end
-
+
if burn == 2 then
-
+
table.insert( BurnTbl, { Pos = pos, Time = CurTime() + 0.5 } )
-
+
end
end
@@ -1118,24 +1118,24 @@ end
usermessage.Hook( "Headless", Headless )
function SetRadarTarget( msg )
-
+
StaticPos = msg:ReadVector()
-
+
end
usermessage.Hook( "StaticTarget", SetRadarTarget )
function AddDrunkness( msg )
-
+
Drunkness = math.Clamp( Drunkness + msg:ReadShort(), 0, 20 )
DrunkTimer = CurTime() + 30
-
+
end
usermessage.Hook( "Drunk", AddDrunkness )
function CashSynch( msg )
-
+
Inv_SetStashCash( msg:ReadShort() )
-
+
end
usermessage.Hook( "CashSynch", CashSynch )
@@ -1143,17 +1143,17 @@ function Radio( msg )
local num = msg:ReadShort()
local snd = msg:ReadString()
-
+
if num == 100 then
-
+
surface.PlaySound( snd )
-
+
else
-
+
if not IsValid( LocalPlayer() ) then return end
-
+
sound.Play( snd, LocalPlayer():GetShootPos(), 180, num, 1 )
-
+
end
end
@@ -1163,11 +1163,11 @@ net.Receive( "StatsSynch", function( len )
local count = net.ReadInt( 8 )
PlayerStats = {}
-
+
for i=1, count do
-
+
table.insert( PlayerStats, { Player = net.ReadEntity(), Stats = net.ReadTable() } )
-
+
end
end )
@@ -1175,11 +1175,11 @@ end )
net.Receive( "InventorySynch", function( len )
LocalInventory = net.ReadTable()
-
+
if GAMEMODE.ItemSheet and GAMEMODE.ItemSheet:IsVisible() then
-
+
GAMEMODE.ItemSheet:RefreshItems( LocalInventory )
-
+
end
end )
@@ -1187,11 +1187,11 @@ end )
net.Receive( "StashSynch", function( len )
LocalStash = net.ReadTable()
-
+
if StashScreen and StashScreen:IsVisible() then
-
+
StashScreen:RefreshItems( LocalStash )
-
+
end
end )
diff --git a/gamemode/cl_inventory.lua b/gamemode/cl_inventory.lua
index f8df461..33bad6b 100644
--- a/gamemode/cl_inventory.lua
+++ b/gamemode/cl_inventory.lua
@@ -8,15 +8,15 @@ PreviewPriceScale = 1
function Inv_HasItem( id )
for k,v in pairs( LocalInventory ) do
-
+
local tbl = item.GetByID( v )
-
+
if ( type( id ) == "number" and tbl.ID == id ) or ( type( id ) == "string" and tbl.Model == id ) then
-
+
return tbl
-
+
end
-
+
end
end
@@ -24,17 +24,17 @@ end
function Inv_ItemCount( id )
local count = 0
-
+
for k,v in pairs( LocalInventory ) do
-
+
if v == id then
-
+
count = count + 1
-
+
end
-
+
end
-
+
return count
end
@@ -48,17 +48,17 @@ end
function Inv_UniqueItems()
local ids = {}
-
+
for k,v in pairs( LocalInventory ) do
-
+
if not table.HasValue( ids, v ) then
-
+
table.insert( ids, v )
-
+
end
-
+
end
-
+
return ids
end
@@ -72,11 +72,11 @@ end
function Inv_GetStashCash()
return LocalStashCash
-
+
end
function Inv_SetStashCash( amt )
LocalStashCash = amt
-end \ No newline at end of file
+end
diff --git a/gamemode/cl_notice.lua b/gamemode/cl_notice.lua
index c2a7333..3003c6b 100644
--- a/gamemode/cl_notice.lua
+++ b/gamemode/cl_notice.lua
@@ -16,17 +16,17 @@ function DoNotice( msg )
local len = msg:ReadShort()
local once = msg:ReadBool()
local col = Color( r, g, b, 255 )
-
+
if once and not CV_NoobHelp:GetBool() then return end
-
+
MsgN( str )
-
+
str = string.gsub( str, " ", " " )
-
+
GAMEMODE:AddNotify( str, col, len )
-
+
end
-usermessage.Hook( "ToxNotice", DoNotice )
+usermessage.Hook( "ToxNotice", DoNotice )
function GM:AddNotify( msg, col, len )
@@ -40,30 +40,30 @@ function GM:AddNotify( msg, col, len )
tab.y = ScrH()
tab.a = 255
tab.col = col
-
+
table.insert( NoteQueue, tab )
-
+
end
function NotifyThink()
if NextNotify < CurTime() then
-
+
NextNotify = CurTime() + 0.3
-
+
if NoteQueue[1] then
-
+
NoteQueue[1].recv = SysTime()
-
+
table.insert( HUDNotes, NoteQueue[1] )
-
+
HUDNote_c = HUDNote_c + 1
HUDNote_i = HUDNote_i + 1
-
+
table.remove( NoteQueue, 1 )
-
+
end
-
+
end
end
@@ -74,58 +74,58 @@ local function DrawNotice( self, k, v, i )
local H = ScrH() / 1024
local x = v.x - 25 * H //74
local y = v.y - 300 * H //580 * H
-
+
if !v.w then
-
+
surface.SetFont( "Notice" )
v.w, v.h = surface.GetTextSize( v.text )
-
+
end
-
+
local w = v.w
local h = v.h
w = w - 16
h = h + 16
draw.RoundedBox( 4, x - w - h + 8, y - 8, w + h, h, Color( 10, 10, 10, v.a * 0.5 ) )
-
+
draw.SimpleText( v.text, "Notice", x+1, y+1, Color(0,0,0,v.a*0.8), TEXT_ALIGN_RIGHT )
draw.SimpleText( v.text, "Notice", x-1, y-1, Color(0,0,0,v.a*0.5), TEXT_ALIGN_RIGHT )
draw.SimpleText( v.text, "Notice", x+1, y-1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT )
draw.SimpleText( v.text, "Notice", x-1, y+1, Color(0,0,0,v.a*0.6), TEXT_ALIGN_RIGHT )
draw.SimpleText( v.text, "Notice", x, y, v.col, TEXT_ALIGN_RIGHT )
-
+
local ideal_y = ScrH() - (HUDNote_c - i) * (h + 4)
local ideal_x = ScrW()
-
+
local timeleft = v.len - ( SysTime() - v.recv )
-
+
//gone from screen
-
+
if ( timeleft < 0.5 ) then
-
+
ideal_x = ScrW() + w * 4 //2
-
+
end
-
+
local spd = RealFrameTime() * 15
-
+
v.y = v.y + v.vely * spd
v.x = v.x + v.velx * spd
-
+
local dist = ideal_y - v.y
v.vely = v.vely + dist * spd * 1
-
+
if (math.abs(dist) < 2 && math.abs(v.vely) < 0.1) then v.vely = 0 end
-
+
local dist = ideal_x - v.x
-
+
v.velx = v.velx + dist * spd * 1
-
+
if (math.abs(dist) < 2 && math.abs(v.velx) < 0.1) then v.velx = 0 end
-
+
//friction that is FPS independant
-
+
v.velx = v.velx * (0.95 - RealFrameTime() * 8 )
v.vely = v.vely * (0.95 - RealFrameTime() * 8 )
@@ -134,15 +134,15 @@ end
function PaintNotes()
if ( !HUDNotes ) then return end
-
+
local i = 0
for k, v in pairs( HUDNotes ) do
if ( v != 0 ) then
i = i + 1
- DrawNotice( self, k, v, i)
+ DrawNotice( self, k, v, i)
end
end
-
+
for k, v in pairs( HUDNotes ) do
if ( v != 0 && v.recv + v.len < SysTime() ) then
HUDNotes[ k ] = 0
@@ -153,4 +153,3 @@ function PaintNotes()
end
hook.Add("HUDPaint", "PaintNotes", PaintNotes)
-
diff --git a/gamemode/cl_postprocess.lua b/gamemode/cl_postprocess.lua
index 9afad78..cf4a696 100644
--- a/gamemode/cl_postprocess.lua
+++ b/gamemode/cl_postprocess.lua
@@ -25,161 +25,161 @@ function GM:RenderScreenspaceEffects()
local approach = FrameTime() * 0.05
if ( Sharpen > 0 ) then
-
+
DrawSharpen( Sharpen, 0.5 )
-
+
Sharpen = math.Approach( Sharpen, 0, FrameTime() * 0.5 )
-
+
end
if ( MotionBlur > 0 ) then
-
+
DrawMotionBlur( 1 - MotionBlur, 1.0, 0.0 )
-
+
MotionBlur = math.Approach( MotionBlur, 0, approach )
-
+
end
-
+
if LocalPlayer():FlashlightIsOn() then
-
- ColorModify[ "$pp_colour_brightness" ] = math.Approach( ColorModify[ "$pp_colour_brightness" ], 0.01, FrameTime() * 0.25 )
- ColorModify[ "$pp_colour_contrast" ] = math.Approach( ColorModify[ "$pp_colour_contrast" ], 1.02, FrameTime() * 0.25 )
-
+
+ ColorModify[ "$pp_colour_brightness" ] = math.Approach( ColorModify[ "$pp_colour_brightness" ], 0.01, FrameTime() * 0.25 )
+ ColorModify[ "$pp_colour_contrast" ] = math.Approach( ColorModify[ "$pp_colour_contrast" ], 1.02, FrameTime() * 0.25 )
+
end
-
+
local rads = LocalPlayer():GetNWInt( "Radiation", 0 )
-
+
if rads > 0 and LocalPlayer():Alive() then
-
+
local scale = rads / 5
-
+
MotionBlur = math.Approach( MotionBlur, scale * 0.5, FrameTime() )
Sharpen = math.Approach( Sharpen, scale * 5, FrameTime() * 3 )
-
+
ColorModify[ "$pp_colour_colour" ] = math.Approach( ColorModify[ "$pp_colour_colour" ], 1.0 - scale * 0.8, FrameTime() * 0.1 )
-
+
end
-
+
if GetGlobalBool( "Radiation", false ) and not GAMEMODE.PlayerIsIndoors then
-
+
ColorModify[ "$pp_colour_mulg" ] = 0.15
ColorModify[ "$pp_colour_mulr" ] = 0.10
ColorModify[ "$pp_colour_addg" ] = 0.05
ColorModify[ "$pp_colour_addr" ] = 0.03
-
+
end
-
+
if LocalPlayer():Team() == TEAM_ZOMBIES then
-
+
if LocalPlayer():Alive() then
-
+
ColorModify[ "$pp_colour_brightness" ] = -0.15
ColorModify[ "$pp_colour_addr" ] = 0.25
ColorModify[ "$pp_colour_mulr" ] = 0.15
ColorModify[ "$pp_colour_addg" ] = 0.15
-
+
else
-
+
ColorModify[ "$pp_colour_addr" ] = 0.25
ColorModify[ "$pp_colour_mulr" ] = 0.30
ColorModify[ "$pp_colour_addg" ] = 0.05
ColorModify[ "$pp_colour_brightness" ] = -0.20
-
+
MotionBlur = 0.40
-
+
end
-
+
else
-
+
if not LocalPlayer():Alive() then
-
+
ColorModify[ "$pp_colour_addr" ] = 0.25
ColorModify[ "$pp_colour_mulr" ] = 0.30
ColorModify[ "$pp_colour_brightness" ] = -0.20
-
+
MotionBlur = 0.40
-
+
elseif LocalPlayer():GetNWBool( "Infected", false ) then
-
+
ColorModify[ "$pp_colour_brightness" ] = -0.02
ColorModify[ "$pp_colour_mulg" ] = 0.55
ColorModify[ "$pp_colour_addg" ] = 0.02 // too much? too little?
-
+
//MotionBlur = 0.30
-
+
end
-
+
end
-
+
for k,v in pairs( ColorModify ) do
-
+
if k == "$pp_colour_colour" or k == "$pp_colour_contrast" then
-
- ColorModify[k] = math.Approach( ColorModify[k], 1, approach )
-
+
+ ColorModify[k] = math.Approach( ColorModify[k], 1, approach )
+
elseif k == "$pp_colour_brightness" and GetGlobalBool( "GameOver", false ) then
-
+
ColorModify[k] = -1.50
-
+
else
-
- ColorModify[k] = math.Approach( ColorModify[k], 0, approach )
-
+
+ ColorModify[k] = math.Approach( ColorModify[k], 0, approach )
+
end
-
+
MixedColorMod[k] = math.Approach( MixedColorMod[k] or 0, ColorModify[k], FrameTime() * 0.10 )
-
+
end
-
+
DrawColorModify( MixedColorMod )
DrawPlayerRenderEffects()
DrawLaser()
-
+
end
-function GM:GetMotionBlurValues( y, x, fwd, spin )
+function GM:GetMotionBlurValues( y, x, fwd, spin )
if LocalPlayer():Team() == TEAM_ZOMBIES then return y, x, fwd, spin end
if LocalPlayer():Alive() and LocalPlayer():Health() <= 50 then
-
+
local scale = math.Clamp( LocalPlayer():Health() / 50, 0, 1 )
// local beat = math.Clamp( HeartBeat - CurTime(), 0, 2 ) * ( 1 - scale )
-
+
fwd = 1 - scale // + beat
-
+
elseif LocalPlayer():GetNWBool( "InIron", false ) then
-
+
fwd = 0.05
-
+
end
-
+
if DisorientTime and DisorientTime > CurTime() then
-
- if not LocalPlayer():Alive() then
+
+ if not LocalPlayer():Alive() then
DisorientTime = nil
end
-
+
local scale = ( ( DisorientTime or 0 ) - CurTime() ) / 10
local newx, newy = RotateAroundCoord( 0, 0, 1, scale * 0.05 )
-
+
return newy, newx, fwd, spin
-
+
end
-
+
if ScreamTime and ScreamTime > CurTime() then
-
- if not LocalPlayer():Alive() then
+
+ if not LocalPlayer():Alive() then
ScreamTime = nil
end
-
+
local scale = ( ( ScreamTime or 0 ) - CurTime() ) / 10
local newy = math.sin( CurTime() * 1.5 ) * scale * 0.08
-
+
return newy, x, fwd, spin
-
+
end
-
+
return y, x, fwd, spin
end
@@ -197,75 +197,75 @@ local MaterialVision = Material( "nuke/redead/allyvision" )
//local MaterialItem = Material( "toxsin/allyvision" )
function DrawPlayerRenderEffects()
-
+
if LocalPlayer():Team() != TEAM_ZOMBIES and LocalPlayer():Team() != TEAM_ARMY then return end
-
+
if GetGlobalBool( "GameOver", false ) then return end
-
+
cam.Start3D( EyePos(), EyeAngles() )
-
+
--[[if IsValid( TargetedEntity ) and table.HasValue( ValidTargetEnts, TargetedEntity:GetClass() ) then // halos replaced this
-
+
if TargetedEntity:GetPos():Distance( LocalPlayer():GetPos() ) < 500 then
-
+
local scale = 1 - ( TargetedEntity:GetPos():Distance( LocalPlayer():GetPos() ) / 500 )
-
+
render.SuppressEngineLighting( true )
render.SetBlend( scale * 0.4 )
render.SetColorModulation( 0, 0.5, 0 )
-
+
render.MaterialOverride( MaterialItem )
-
+
cam.IgnoreZ( false )
TargetedEntity:DrawModel()
-
+
render.SuppressEngineLighting( false )
render.SetColorModulation( 1, 1, 1 )
render.SetBlend( 1 )
-
+
render.MaterialOverride( 0 )
-
+
end
-
+
end]]
-
+
for k,v in pairs( GAMEMODE:GetHighlightedUnits() ) do
-
+
if ( v:IsPlayer() and v:Alive() and v != LocalPlayer() ) or v:IsNPC() then
-
+
local scale = ( math.Clamp( v:GetPos():Distance( LocalPlayer():GetPos() ), 500, 3000 ) - 500 ) / 2500
//render.SuppressEngineLighting( true )
render.SetBlend( scale )
-
+
render.MaterialOverride( MaterialVision )
-
+
if LocalPlayer():Team() == TEAM_ARMY then
-
+
render.SetColorModulation( 0, 0.2, 1.0 )
-
+
else
-
+
render.SetColorModulation( 1.0, 0.2, 0 )
-
+
end
-
+
cam.IgnoreZ( false )
-
+
v:SetupBones()
v:DrawModel()
-
+
//render.SuppressEngineLighting( false )
render.SetColorModulation( 1, 1, 1 )
render.SetBlend( 1 )
-
+
render.MaterialOverride( 0 )
end
-
+
end
-
+
cam.End3D()
end
@@ -276,118 +276,118 @@ LasMat = Material( "sprites/bluelaser1" )
function DrawLaser()
if LocalPlayer():Team() != TEAM_ARMY then return end
-
+
//local vm = LocalPlayer():GetViewModel( 0 )
-
+
//if not IsValid( vm ) then return end
-
+
local wep = LocalPlayer():GetActiveWeapon()
-
+
if not IsValid( wep ) or not wep:GetNWBool( "Laser", false ) then return end
-
+
//local idx = vm:LookupAttachment( "1" )
-
+
//if idx == 0 then idx = vm:LookupAttachment( "muzzle" ) end
-
+
--[[local trace = util.GetPlayerTrace( LocalPlayer() )
local tr = util.TraceLine( trace )
local tbl = vm:GetAttachment( idx )
-
+
local pos = tr.HitPos]]
-
+
local look = LocalPlayer():EyeAngles()
local dir = look:Forward()
//local tbl = vm:GetAttachment( idx )
//local ang = tbl.Ang
//local offset = wep.LaserOffset
-
+
//ang:RotateAroundAxis( look:Up(), ( offset.p or 0 ) )
//ang:RotateAroundAxis( look:Forward(), ( offset.r or 0 ) )
//ang:RotateAroundAxis( look:Right(), ( offset.y or 0 ) )
-
+
//local forward = ang:Forward()
//lasforward = tbl.Ang:Forward()
-
+
//forward = forward * wep.LaserScale
-
+
//dir = dir + forward
-
+
local trace = {}
-
- trace.start = LocalPlayer():GetShootPos()
+
+ trace.start = LocalPlayer():GetShootPos()
trace.endpos = trace.start + dir * 9000
trace.filter = { LocalPlayer(), weap, lp }
trace.mask = MASK_SOLID
-
- local tr = util.TraceLine( trace )
+
+ local tr = util.TraceLine( trace )
local dist = math.Clamp( tr.HitPos:Distance( EyePos() ), 0, 500 )
local size = math.Rand( 2, 4 ) + ( dist / 500 ) * 6
local col = Color( 255, 0, 0, 255 )
-
+
--[[if v == lp and IsValid( GAMEMODE.TargetEnt ) and GAMEMODE.TargetEnt:IsPlayer() and GAMEMODE.TargetEnt:Team() == TEAM_HUMAN then
-
- size = size + math.Rand( 0.5, 2.0 )
-
+
+ size = size + math.Rand( 0.5, 2.0 )
+
elseif v != lp then
-
+
size = math.Rand( 0, 1 ) + ( dist / 500 ) * 6
-
+
end]]
-
+
if ( wep.LastRunFrame or 0 ) > CurTime() then return end
-
+
cam.Start3D( EyePos(), EyeAngles() )
-
+
local norm = ( EyePos() - tr.HitPos ):GetNormal()
-
+
render.SetMaterial( DotMat )
render.DrawQuadEasy( tr.HitPos + norm * size, norm, size, size, col, 0 )
-
+
cam.End3D()
-
+
--[[if vm:GetSequence() != ACT_VM_IDLE then
-
+
wep.AngDiff = ( tbl.Ang - ( wep.LastGoodAng or Angle(0,0,0) ) )//:Forward()
-
+
trace = {}
trace.start = EyePos() or Vector(0,0,0)
trace.endpos = trace.start + ( ( EyeAngles() + wep.AngDiff ):Forward() * 99999 )
trace.filter = { wep, LocalPlayer() }
-
+
local tr2 = util.TraceLine( trace )
-
+
pos = tr2.HitPos
-
+
else
-
+
wep.LastGoodAng = tbl.Ang
-
+
end]]
-
+
--[[cam.Start3D( EyePos(), EyeAngles() )
-
+
local dir = ( tbl.Ang + Angle(0,90,0) ):Forward()
dir.z = EyeAngles():Forward().z
-
+
local start = tbl.Pos + ( dir * -5 ) + wep.LaserOffset
-
+
render.SetMaterial( LasMat )
-
+
for i=0,254 do
-
+
render.DrawBeam( start, start + dir * 0.2, 2, 0, 12, Color( 255, 0, 0, 255 - i ) )
-
+
start = start + dir * 0.2
-
+
end
-
+
local dist = tr.HitPos:Distance( EyePos() )
local size = math.Rand( 7, 8 )
local dotsize = dist / ( size ^ 2 )
-
+
render.SetMaterial( DotMat )
render.DrawQuadEasy( pos, ( EyePos() - tr.HitPos ):GetNormal(), dotsize, dotsize, Color( 255, 0, 0, 255 ), 0 )
-
+
cam.End3D() ]]
end
@@ -396,7 +396,7 @@ function GM:GetHighlightedUnits()
local tbl = team.GetPlayers( TEAM_ARMY )
tbl = table.Add( tbl, ents.FindByClass( "npc_scientist" ) )
-
+
return tbl
end
@@ -406,52 +406,52 @@ function GM:PreDrawHalos()
if GetGlobalBool( "GameOver", false ) then return end
if LocalPlayer():Team() != TEAM_ZOMBIES and LocalPlayer():Team() != TEAM_ARMY then return end
-
+
--[[for k,v in pairs( GAMEMODE:GetHighlightedUnits() ) do
-
+
if ( ( v:IsPlayer() and v:Alive() and v != LocalPlayer() ) or ( v:IsNPC() and not v.Ragdolled ) ) then
-
+
local dist = math.Clamp( v:GetPos():Distance( LocalPlayer():GetPos() ), 250, 500 ) - 250
local scale = dist / 250
-
+
if scale > 0 then
-
+
if LocalPlayer():Team() == TEAM_ARMY then
-
+
//halo.Add( {v}, Color( 0, 200, 200, 200 * scale ), 2, 2, 1, 1, true ) // removed till garry optimizes this
-
+
else
-
+
//halo.Add( {v}, Color( 200, 0, 0, 200 * scale ), 2, 2, 1, 1, false )
-
+
end
-
+
end
end
-
+
end]]
-
+
if LocalPlayer():Team() == TEAM_ARMY then
-
+
if IsValid( TargetedEntity ) and not TargetedEntity:IsPlayer() and ( TargetedEntity:GetClass() != "npc_scientist" or TargetedEntity:GetNWBool( "Dead", false ) == false ) then
-
+
local dist = math.Clamp( TargetedEntity:GetPos():Distance( LocalPlayer():GetPos() ), 0, 500 )
local scale = 1 - ( dist / 500 )
-
+
halo.Add( {TargetedEntity}, Color( 0, 100, 200, 255 * scale ), 2 * scale, 2 * scale, 1, 1, false )
-
+
end
-
+
if IsValid( GAMEMODE.ClientAntidote ) then
-
+
local dist = math.Clamp( GAMEMODE.ClientAntidote:GetPos():Distance( LocalPlayer():GetPos() ), 250, 500 ) - 250
local scale = dist / 250
-
+
halo.Add( {GAMEMODE.ClientAntidote}, Color( 0, 200, 0, 200 * scale ), 2, 2, 1, 1, true )
-
+
end
-
+
end
end
@@ -465,52 +465,52 @@ function GM:CalcView( ply, origin, angle, fov )
local vel = ply:GetVelocity()
local ang = ply:EyeAngles()
-
+
VelSmooth = VelSmooth * 0.5 + vel:Length() * 0.1
WalkTimer = WalkTimer + VelSmooth * FrameTime() * 0.1
-
+
angle.roll = angle.roll + ang:Right():DotProduct( vel ) * 0.002
-
+
if ply:Alive() then
-
+
--[[if ViewWobble > 0 then
-
+
angle.roll = angle.roll + math.sin( CurTime() + TimeSeed( 1, -2, 2 ) ) * ( ViewWobble * 15 )
angle.pitch = angle.pitch + math.sin( CurTime() + TimeSeed( 2, -2, 2 ) ) * ( ViewWobble * 15 )
angle.yaw = angle.yaw + math.sin( CurTime() + TimeSeed( 3, -2, 2 ) ) * ( ViewWobble * 15 )
-
+
end]]
-
+
DeathAngle = angle
DeathOrigin = origin
-
+
elseif not ply:Alive() and CV_RagdollVision:GetBool() then
-
+
local rag = ply:GetRagdollEntity()
-
+
if IsValid( rag ) then
-
+
local eyes = rag:LookupAttachment( "eyes" )
local tbl = rag:GetAttachment( eyes )
-
+
if tbl then
-
+
angle = tbl.Ang
origin = tbl.Pos + ( tbl.Ang:Up() * 16 ) + ( tbl.Ang:Forward() * -8 )
-
+
end
-
+
end
-
+
end
-
+
if ply:GetGroundEntity() != NULL then
-
+
angle.roll = angle.roll + math.sin( WalkTimer ) * VelSmooth * 0.001
angle.pitch = angle.pitch + math.cos( WalkTimer * 1.25 ) * VelSmooth * 0.005
-
+
end
-
+
return self.BaseClass:CalcView( ply, origin, angle, fov )
-
+
end
diff --git a/gamemode/cl_scoreboard.lua b/gamemode/cl_scoreboard.lua
index 08c2ee7..9eb9602 100644
--- a/gamemode/cl_scoreboard.lua
+++ b/gamemode/cl_scoreboard.lua
@@ -4,44 +4,44 @@ function GM:CustomizeScoreboard()
// these fonts are used in the header on the top of the scoreboard
surface.CreateFont ( "MenuTitle", { size = 30, weight = 500, antialias = true, additive = false, font = "Graffiare" } )
surface.CreateFont ( "MenuDesc", { size = 16, weight = 800, antialias = true, additive = false, font = "Verdana" } )
-
+
// scoreboard fonts
surface.CreateFont ( "ScoreboardLabel", { size = 14, weight = 1000, antialias = true, additive = false, font = "Tahoma" } )
surface.CreateFont ( "ScoreboardTeamName", { size = 14, weight = 1000, antialias = true, additive = false, font = "Verdana" } )
surface.CreateFont ( "ScoreboardPlayerText", { size = 14, weight = 600, antialias = true, additive = false, font = "Arial" } )
-
+
// colors used on the scoreboard
GAMEMODE.TitleColor = Color( 255, 255, 255, 255 ) // title text color
GAMEMODE.TitleShadow = Color( 0, 0, 0, 100 ) // title shadow color
-
+
GAMEMODE.DescColor = Color( 255, 255, 255, 255 ) // subtext color
GAMEMODE.DescShadow = Color( 50, 50, 50, 100 ) // subtext shadow color
-
+
GAMEMODE.TeamTextColor = Color( 0, 0, 0, 255 ) // text color for team bar
GAMEMODE.TeamShadowColor = Color( 255, 255, 255, 0 ) // text shadow color for team bar
-
+
GAMEMODE.TitleBackground = Color( 100, 100, 100, 150 ) // background color for the title and subtext
GAMEMODE.ScreenBackground = Color( 50, 50, 50, 50 ) //background color for the rest of the screen
-
+
GAMEMODE.ScoreBackground = Color( 200, 200, 200, 100 ) // background for team score panel
GAMEMODE.PlayerBackground = Color( 60, 60, 60, 100 ) // background for player score panel
-
+
end
function GM:ScoreboardShow()
if not GAMEMODE.ScoreBoard or GAMEMODE.ScoreBoard == NULL then
-
+
GAMEMODE:CustomizeScoreboard()
GAMEMODE.ScoreBoard = vgui.Create( "ScoreBoard" )
-
+
end
-
+
GAMEMODE.ScoreBoard:SetVisible( true )
GAMEMODE.ScoreboardVisible = true
-
+
gui.EnableScreenClicker( true )
-
+
end
function GM:ScoreboardHide()
@@ -50,44 +50,44 @@ function GM:ScoreboardHide()
GAMEMODE.ScoreBoard:SetVisible( false )
GAMEMODE.ScoreboardVisible = false
-
+
gui.EnableScreenClicker( false )
-
+
end
function GM:GetPlayerStats( ply )
- if not ply then
-
- return { "Kills", GAMEMODE.CurrencyName .. "s" }
-
+ if not ply then
+
+ return { "Kills", GAMEMODE.CurrencyName .. "s" }
+
else
-
- return { ply:Frags(), ply:GetNWInt( "Cash", 10 ) }
-
+
+ return { ply:Frags(), ply:GetNWInt( "Cash", 10 ) }
+
end
-
+
end
function GM:GetDefaultPlayerStats(ply)
-
+
return ply:Nick(), ply:Ping()
-
+
end
local MENUBASE = {}
function MENUBASE:Init()
-
+
self.TitleText = ""
self.DescText = ""
-
+
self:SetPos( 0, 0 )
self:SetSize( ScrW(), ScrH() )
-
+
self:SetTitle("")
self:ShowCloseButton(false)
-
+
end
function MENUBASE:SetTitleText( text )
@@ -104,20 +104,20 @@ function MENUBASE:Paint()
surface.SetDrawColor( GAMEMODE.ScreenBackground.r, GAMEMODE.ScreenBackground.g, GAMEMODE.ScreenBackground.b, GAMEMODE.ScreenBackground.a )
surface.DrawRect( 0, 80, ScrW(), ScrH() - 80 )
-
+
surface.SetDrawColor( GAMEMODE.TitleBackground.r, GAMEMODE.TitleBackground.g, GAMEMODE.TitleBackground.b, GAMEMODE.TitleBackground.a )
surface.DrawRect( 0, 0, ScrW(), 80 )
-
+
if self.TitleText == "" then
self.TitleText = GetGlobalString( "ServerName" )
end
-
+
draw.SimpleText( self.TitleText, "MenuTitle", 22, 22, GAMEMODE.TitleShadow, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( self.TitleText, "MenuTitle", 20, 20, GAMEMODE.TitleColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
draw.SimpleText( self.DescText, "MenuDesc", 22, 57, GAMEMODE.DescShadow, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( self.DescText, "MenuDesc", 20, 55, GAMEMODE.DescColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
end
vgui.Register( "MenuBase", MENUBASE, "DFrame" )
@@ -128,7 +128,7 @@ function PANEL:Init()
self.BaseClass.SetTitleText( self, GetGlobalString( "ServerName" ) )
self.BaseClass.SetDescText( self, GAMEMODE.Name .. " - ".. game.GetMap() )
-
+
self.PanelList = vgui.Create( "DPanelList", self )
self.PanelList:SetSize( ScrW() - 40, ScrH() - 130 )
self.PanelList:SetPos( 20, 105 )
@@ -136,73 +136,73 @@ function PANEL:Init()
self.PanelList:EnableVerticalScrollbar( true )
self.PanelList:EnableHorizontal( false )
self.PanelList.Paint = function() end
-
- self.Canvas = vgui.Create( "Panel" )
- self.Canvas.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
+
+ self.Canvas = vgui.Create( "Panel" )
+ self.Canvas.OnMousePressed = function( self, code ) self:GetParent():OnMousePressed( code ) end
self.Canvas:SetMouseInputEnabled( true )
self.Canvas.InvalidateLayout = function() self:InvalidateLayout() end
self.Canvas:SetSize( ScrW() - 40, 200 )
self.Canvas:SetPos( 0, 0 )
self.Canvas.Paint = function() end
-
+
self.PanelList:AddItem(self.Canvas)
self.Teams = {}
-
+
local teams = team.GetAllTeams()
-
+
for k,v in pairs( teams ) do
-
+
if k > 0 and k < 1002 then
-
+
table.insert( self.Teams, k )
-
+
end
-
+
end
-
+
end
function PANEL:Paint()
self.BaseClass.Paint(self)
-
+
self.CanvasSize = 0
-
+
if not self.TeamPanels then
-
+
self.TeamPanels = {}
local ypos = 0
-
+
for k,v in pairs( self.Teams ) do
-
+
self.TeamPanels[k] = vgui.Create( "TeamScore", self.Canvas )
self.TeamPanels[k]:SetPos( 0, ypos )
self.TeamPanels[k]:SetSize( ScrW() - 56, self.TeamPanels[k]:GetVerticalSize() )
self.TeamPanels[k]:SetTeam( v )
ypos = ypos + self.TeamPanels[k]:GetVerticalSize()
self.CanvasSize = self.CanvasSize + self.TeamPanels[k]:GetVerticalSize()
-
+
end
-
+
else
-
+
local ypos = 0
-
+
for k,v in pairs( self.TeamPanels ) do
-
+
v:SetPos( 0, ypos )
v:SetSize( ScrW() - 56, v:GetVerticalSize() )
ypos = ypos + v:GetVerticalSize()
self.CanvasSize = self.CanvasSize + v:GetVerticalSize()
-
+
end
-
+
end
-
+
self.Canvas:SetSize( ScrW() - 40, self.CanvasSize )
- self.PanelList:InvalidateLayout( true )
-
+ self.PanelList:InvalidateLayout( true )
+
end
vgui.Register( "ScoreBoard", PANEL, "MenuBase" )
@@ -216,7 +216,7 @@ function TFRAME:Init( )
self:SetPaintBorderEnabled( false )
self.CleanUp = 0
self.Size = 40
-
+
end
function TFRAME:SetTeam( teamid )
@@ -224,115 +224,115 @@ function TFRAME:SetTeam( teamid )
self.TeamID = teamid
self.Players = {}
self.Rows = {}
-
+
end
function TFRAME:Paint( )
if not self.TeamID then return end
-
+
local col = team.GetColor( self.TeamID )
surface.SetDrawColor( col.r, col.g, col.b, 255 )
surface.DrawRect( 0, 0, self:GetWide(), 25 )
-
+
surface.SetDrawColor( 0, 0, 0, 255 )
surface.DrawOutlinedRect( 0, 0, self:GetWide(), 25 )
-
+
surface.SetDrawColor( GAMEMODE.ScoreBackground.r, GAMEMODE.ScoreBackground.g, GAMEMODE.ScoreBackground.b, GAMEMODE.ScoreBackground.a )
surface.DrawRect( 0, 25, self:GetWide(), self:GetTall() - 25 )
-
+
local text = " Member )"
-
+
if team.NumPlayers( self.TeamID ) > 1 or team.NumPlayers( self.TeamID ) == 0 then
-
+
text = " Members )"
-
+
end
-
+
local teamcol = GAMEMODE.TeamTextColor
local teamshad = GAMEMODE.TeamShadowColor
-
+
draw.SimpleText( team.GetName( self.TeamID ).." ( "..team.NumPlayers( self.TeamID )..text, "ScoreboardTeamName", 10, 3, Color( teamshad.r, teamshad.g, teamshad.b, teamshad.a ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( team.GetName( self.TeamID ).." ( "..team.NumPlayers( self.TeamID )..text, "ScoreboardTeamName", 9, 3, Color( teamcol.r, teamcol.g, teamcol.b, teamcol.a ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
local tbl = GAMEMODE:GetPlayerStats()
local pos = 10
-
+
draw.SimpleText( "Ping", "ScoreboardLabel", self:GetWide() - pos, 3, Color( teamshad.r, teamshad.g, teamshad.b, teamshad.a ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
draw.SimpleText( "Ping", "ScoreboardLabel", self:GetWide() - pos - 1, 3, Color( teamcol.r, teamcol.g, teamcol.b, teamcol.a ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
-
+
for k,v in pairs( tbl ) do
-
+
pos = pos + 70
draw.SimpleText( v, "ScoreboardLabel", self:GetWide() - pos, 3, Color( teamshad.r, teamshad.g, teamshad.b, teamshad.a ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
draw.SimpleText( v, "ScoreboardLabel", self:GetWide() - pos - 1, 3, Color( teamcol.r, teamcol.g, teamcol.b, teamcol.a ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
-
+
end
-
+
local size = 40
self.Players = team.GetPlayers( self.TeamID )
-
+
for k, v in pairs( self.Players ) do
-
+
local inserted
-
+
for c, d in pairs( self.Rows ) do
-
+
if d.Ply == v then
-
+
inserted = true
-
+
end
-
+
end
-
+
if not inserted then
-
+
local row = vgui.Create( "PlayerRow", self )
row:SetPlayer( v )
row:SetSize( self:GetWide() - 15, 30 )
row.Ply = v
-
+
table.insert( self.Rows, row )
-
+
end
-
+
end
-
+
for k, v in pairs( self.Rows ) do
-
+
v:SetPos( 5, ( k * 37 ) )
size = size + 37
-
+
end
-
+
if self.CleanUp < CurTime() then
-
+
for k, v in pairs( self.Rows ) do
-
+
if not v.Ply or not v.Ply:IsValid() or v.Ply:Team() != self.TeamID then
-
+
local row = v
table.remove( self.Rows, k )
row:Remove()
size = size - 37
-
+
end
-
+
end
-
+
self.CleanUp = CurTime() + 0.3
-
+
end
-
+
self.Size = size
-
+
end
function TFRAME:GetVerticalSize()
return self.Size
-
+
end
vgui.Register( "TeamScore", TFRAME, "DPanel" )
@@ -345,54 +345,54 @@ function PFRAME:Init()
self.Avatar:SetPos( 5, 0 )
self.Avatar:SetSize( 32, 32 )
self.Invalid = 0
-
+
end
function PFRAME:SetPlayer( ply )
if not ply or not ply:IsValid() then
-
+
return false
-
+
end
-
+
self.Player = ply
self.Avatar:SetPlayer( ply )
-
+
end
function PFRAME:Paint( )
-
+
if not self.Player or not self.Player:IsValid() then
-
+
return
-
+
end
-
+
local ply = self.Player
-
+
local name, ping = GAMEMODE:GetDefaultPlayerStats(ply)
local stats = GAMEMODE:GetPlayerStats(ply)
local tbl = GAMEMODE:GetPlayerStats()
-
+
local pos = 0
-
+
surface.SetDrawColor( GAMEMODE.PlayerBackground.r,GAMEMODE.PlayerBackground.g, GAMEMODE.PlayerBackground.b, GAMEMODE.PlayerBackground.a )
surface.DrawRect( 5, 0, self:GetWide(), self:GetTall() )
-
+
draw.SimpleText( name, "ScoreboardPlayerText", 45, 8, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( name, "ScoreboardPlayerText", 44, 8, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
draw.SimpleText( tostring( ping ), "ScoreboardPlayerText", self:GetWide(), 8, Color( 0, 0, 0, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
draw.SimpleText( tostring( ping ), "ScoreboardPlayerText", self:GetWide() - 1, 8, Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
-
+
for k,v in pairs( stats ) do
-
+
pos = pos + 70
draw.SimpleText( tostring( v ), "ScoreboardPlayerText", self:GetWide() - pos, 8, Color( 0, 0, 0, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
draw.SimpleText( tostring( v ), "ScoreboardPlayerText", self:GetWide() - pos - 1, 8, Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_LEFT )
-
+
end
-
+
end
vgui.Register( "PlayerRow", PFRAME, "DPanel" )
diff --git a/gamemode/cl_spawnmenu.lua b/gamemode/cl_spawnmenu.lua
index 1515e53..de3a69f 100644
--- a/gamemode/cl_spawnmenu.lua
+++ b/gamemode/cl_spawnmenu.lua
@@ -4,19 +4,19 @@ GM.Cart = {}
GM.CartItems = {}
GM.OptionPanels = {}
-GM.Categories = {
+GM.Categories = {
{ Name = "Weapons", Icon = "icon16/gun.png", Categories = { ITEM_WPN_COMMON, ITEM_WPN_SPECIAL } },
{ Name = "Ammunition", Icon = "icon16/package.png", Categories = { ITEM_AMMO } },
{ Name = "Supplies", Icon = "icon16/pill.png", Categories = { ITEM_SUPPLY, ITEM_SPECIAL } },
-{ Name = "Miscellaneous", Icon = "icon16/bin.png", Categories = { ITEM_MISC, ITEM_BUYABLE } }
+{ Name = "Miscellaneous", Icon = "icon16/bin.png", Categories = { ITEM_MISC, ITEM_BUYABLE } }
}
function GM:CreateElement( name )
local element = vgui.Create( name )
-
+
table.insert( GAMEMODE.Elements, element )
-
+
return element
end
@@ -24,11 +24,11 @@ end
function GM:ClearElements()
for k,v in pairs( GAMEMODE.Elements ) do
-
+
v:Remove()
-
+
end
-
+
GAMEMODE.Elements = {}
end
@@ -36,20 +36,20 @@ end
function GM:AddToCart( tbl, amt )
for i=1,amt do
-
+
table.insert( GAMEMODE.Cart, tbl.ID )
-
+
local btn = GAMEMODE:CreateElement( "SideButton" )
btn:SetPos( 765, 5 + 35 * ( table.Count( GAMEMODE.Cart ) - 1 ) )
btn:SetSize( 250, 30 )
btn:SetImage( "icon16/cross.png" )
btn:SetText( tbl.Name )
btn:SetFunction( function() RunConsoleCommand( "inv_refund", tbl.ID ) btn:Remove() GAMEMODE:ClearCartItem( tbl.ID ) end )
-
+
table.insert( GAMEMODE.CartItems, btn )
-
+
end
-
+
GAMEMODE:CheckCartButton()
end
@@ -57,19 +57,19 @@ end
function GM:RefreshCart()
local cart = GAMEMODE.CartItems
-
+
GAMEMODE.CartItems = {}
-
+
for k,v in pairs( cart ) do
-
+
if IsValid( v ) then
-
+
table.insert( GAMEMODE.CartItems, v )
-
+
v:SetPos( 765, 5 + 35 * ( table.Count( GAMEMODE.CartItems ) - 1 ) )
-
+
end
-
+
end
end
@@ -77,11 +77,11 @@ end
function GM:CheckCartButton()
if GAMEMODE.CartButton then
-
+
GAMEMODE.CartButton:Remove()
-
+
end
-
+
if table.Count( GAMEMODE.Cart ) < 1 then return end
local btn = GAMEMODE:CreateElement( "SideButton" )
@@ -90,7 +90,7 @@ function GM:CheckCartButton()
btn:SetImage( "icon16/cart.png" )
btn:SetText( "Airdrop Items" )
btn:SetFunction( function() RunConsoleCommand( "ordershipment" ) GAMEMODE:ClearCart() btn:Remove() end )
-
+
GAMEMODE.CartButton = btn
end
@@ -98,18 +98,18 @@ end
function GM:ClearCartItem( id )
for k,v in pairs( GAMEMODE.Cart ) do
-
+
if v == id then
-
+
table.remove( GAMEMODE.Cart, k )
-
+
GAMEMODE:RefreshCart()
GAMEMODE:CheckCartButton()
-
+
return
-
+
end
-
+
end
end
@@ -119,13 +119,13 @@ function GM:ClearCart()
GAMEMODE.Cart = {}
for k,v in pairs( GAMEMODE.CartItems ) do
-
+
if IsValid( v ) then
-
+
v:Remove()
-
+
end
-
+
end
end
@@ -133,7 +133,7 @@ end
function GM:ElementsVisible()
if GAMEMODE.Elements[1] then return true end
-
+
return false
end
@@ -143,16 +143,16 @@ function GM:SetItemToPreview( id, style, scale, count )
//print( debug.traceback() )
PreviewTable = item.GetByID( id ) //table.Copy( item.GetByID( id ) )
-
+
if scale and style then
-
+
PreviewStyle = style
PreviewPriceScale = scale
-
+
end
GAMEMODE:RebuildOptions( PreviewTable or {}, style, count or 1 )
-
+
end
function GM:GetItemToPreview()
@@ -164,119 +164,119 @@ end
function GM:RebuildOptions( tbl, style, count )
for k,v in pairs( GAMEMODE.OptionPanels ) do
-
+
v:Remove()
-
+
end
-
+
local ypos = 400
-
+
if style == "Buy" then
-
+
for k,v in pairs{ 1, 3, 5, 10 } do
-
+
if v == 1 or not tbl.Weapon then
-
+
local btn = GAMEMODE:CreateElement( "SideButton" )
btn:SetPos( 510, ypos )
btn:SetSize( 250, 30 )
btn:SetImage( "icon16/money.png" )
-
+
if v == 1 then
btn:SetText( "Buy" )
else
btn:SetText( "Buy " .. v )
end
-
+
btn:SetFunction( function() if LocalPlayer():GetNWInt( "Cash", 0 ) >= tbl.Price * v then RunConsoleCommand( "inv_buy", tbl.ID, v ) GAMEMODE:AddToCart( tbl, v ) end end )
-
+
table.insert( GAMEMODE.OptionPanels, btn )
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
end
-
+
else
-
+
for k,v in pairs{ 1, 3, 5, 10 } do
-
+
if not tbl.Weapon and count >= v then
-
+
local btn = GAMEMODE:CreateElement( "SideButton" )
btn:SetPos( 510, ypos )
btn:SetSize( 250, 30 )
btn:SetImage( "icon16/arrow_down.png" )
-
+
if v == 1 then
btn:SetText( "Drop" )
else
btn:SetText( "Drop " .. v )
end
-
+
btn:SetFunction( function() RunConsoleCommand( "inv_drop", tbl.ID, v ) end )
-
+
table.insert( GAMEMODE.OptionPanels, btn )
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
end
-
+
if count > 1 then
-
+
local btn = GAMEMODE:CreateElement( "SideButton" )
btn:SetPos( 510, ypos )
btn:SetSize( 250, 30 )
btn:SetImage( "icon16/box.png" )
btn:SetText( "Drop All" )
btn:SetFunction( function() RunConsoleCommand( "inv_drop", tbl.ID, count ) end )
-
+
table.insert( GAMEMODE.OptionPanels, btn )
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
for k,v in pairs( tbl.Functions ) do
-
+
local btn = GAMEMODE:CreateElement( "SideButton" )
btn:SetPos( 510, ypos )
btn:SetSize( 250, 30 )
btn:SetImage( v( 0, 0, 0, true ) )
btn:SetText( v( 0, 0, true ) )
btn:SetFunction( function() RunConsoleCommand( "inv_action", tbl.ID, k ) end )
-
+
table.insert( GAMEMODE.OptionPanels, btn )
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
end
end
function GM:OnSpawnMenuClose()
-
+
if not LocalPlayer():Alive() or LocalPlayer():Team() != TEAM_ARMY then return end
-
+
if GAMEMODE:ElementsVisible() then
-
+
gui.EnableScreenClicker( false )
-
+
GAMEMODE:ClearElements()
-
+
else
-
+
gui.EnableScreenClicker( true )
-
+
local ypos = 5
-
+
for k,v in pairs( GAMEMODE.Categories ) do
-
+
local toggle = GAMEMODE:CreateElement( "CategoryButton" )
toggle:SetPos( 510, ypos )
toggle:SetText( v.Name )
@@ -284,20 +284,20 @@ function GM:OnSpawnMenuClose()
toggle:SetSize( 250, 30 )
toggle:SetSelectedState( true, true )
toggle.OnToggle = function( pnl, bool )
-
+
if GAMEMODE.ItemSheet then
-
+
GAMEMODE.ItemSheet:ToggleVisible( v.Categories, bool )
GAMEMODE.ItemSheet:RefreshItems( LocalInventory )
-
+
end
-
+
end
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
local inv = GAMEMODE:CreateElement( "ItemSheet" )
inv:SetSize( 500, ScrH() - 125 )
inv:SetPos( 5, 5 )
@@ -307,47 +307,47 @@ function GM:OnSpawnMenuClose()
inv:SetStashable( false, "Stash", true )
inv:RefreshItems( LocalInventory )
//inv:EnableVerticalScrollbar()
-
+
GAMEMODE.ItemSheet = inv
-
+
local disp = GAMEMODE:CreateElement( "ItemDisplay" )
disp:SetSize( 250, 250 )
disp:SetPos( 510, 145 )
-
+
local scrollup = GAMEMODE:CreateElement( "Scroller" )
scrollup:SetSize( 30, 30 )
scrollup:SetPos( 475, ScrH() - 115 )
scrollup:SetTarget( inv )
scrollup:SetImage( "icon16/arrow_up.png" )
-
+
local scrolldown = GAMEMODE:CreateElement( "Scroller" )
scrolldown:SetSize( 30, 30 )
scrolldown:SetPos( 440, ScrH() - 115 )
scrolldown:SetTarget( inv )
scrolldown:SetScrollUp( false )
scrolldown:SetImage( "icon16/arrow_down.png" )
-
+
end
-
+
--[[if not InventoryScreen:IsVisible() then
-
+
InventoryScreen:SetSize( ScrW() - 10, ScrH() * 0.5 - 10 )
InventoryScreen:SetStashable( false, "Stash", true )
InventoryScreen:RefreshItems( LocalInventory )
InventoryScreen:SetVisible( true )
InfoScreen:SetVisible( true )
PlayerScreen:SetVisible( true )
-
+
gui.EnableScreenClicker( true )
-
+
else
-
+
InventoryScreen:SetVisible( false )
InfoScreen:SetVisible( false )
PlayerScreen:SetVisible( false )
gui.EnableScreenClicker( false )
-
+
end]]
end
@@ -356,21 +356,21 @@ function StoreMenu( msg )
local open = msg:ReadBool()
local scale = msg:ReadFloat()
-
+
if GAMEMODE:ElementsVisible() then
GAMEMODE:ClearElements()
-
- end
-
+
+ end
+
if open then
-
+
gui.EnableScreenClicker( true )
-
+
local ypos = 5
-
+
for k,v in pairs( GAMEMODE.Categories ) do
-
+
local toggle = GAMEMODE:CreateElement( "CategoryButton" )
toggle:SetPos( 510, ypos )
toggle:SetText( v.Name )
@@ -378,20 +378,20 @@ function StoreMenu( msg )
toggle:SetSize( 250, 30 )
toggle:SetSelectedState( true, true )
toggle.OnToggle = function( pnl, bool )
-
+
if GAMEMODE.ItemSheet then
-
+
GAMEMODE.ItemSheet:ToggleVisible( v.Categories, bool )
GAMEMODE.ItemSheet:RefreshItems( LocalStash )
-
+
end
-
+
end
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
local inv = GAMEMODE:CreateElement( "ItemSheet" )
inv:SetSize( 500, ScrH() - 125 )
inv:SetPos( 5, 5 )
@@ -401,70 +401,70 @@ function StoreMenu( msg )
inv:SetStashable( open, "Buy" )
inv:RefreshItems( LocalStash )
//inv:EnableVerticalScrollbar()
-
+
GAMEMODE.ItemSheet = inv
-
+
local disp = GAMEMODE:CreateElement( "ItemDisplay" )
disp:SetSize( 250, 250 )
disp:SetPos( 510, 145 )
-
+
local scrollup = GAMEMODE:CreateElement( "Scroller" )
scrollup:SetSize( 30, 30 )
scrollup:SetPos( 475, ScrH() - 115 )
scrollup:SetTarget( inv )
scrollup:SetImage( "icon16/arrow_up.png" )
-
+
local scrolldown = GAMEMODE:CreateElement( "Scroller" )
scrolldown:SetSize( 30, 30 )
scrolldown:SetPos( 440, ScrH() - 115 )
scrolldown:SetTarget( inv )
scrolldown:SetScrollUp( false )
scrolldown:SetImage( "icon16/arrow_down.png" )
-
+
surface.PlaySound( table.Random( GAMEMODE.RadioBeep ) )
-
+
local cart = GAMEMODE.Cart
GAMEMODE.Cart = {}
-
+
for k,v in pairs( cart ) do
-
+
local tbl = item.GetByID( v )
-
+
GAMEMODE:AddToCart( tbl, 1 )
-
+
end
-
+
else
-
+
gui.EnableScreenClicker( false )
-
+
end
-
+
--[[ShopMenu = open
-
+
StashScreen:SetPos( 5, ScrH() * 0.5 + 5 )
StashScreen:SetStashable( open, "Buy" )
StashScreen:SetVisible( open )
-
+
SaleScreen:SetVisible( open )
InfoScreen:SetVisible( open )
PlayerScreen:SetVisible( open )
-
+
gui.EnableScreenClicker( open )
-
+
if open then
-
+
StashScreen:RefreshItems( LocalStash )
-
+
surface.PlaySound( table.Random( GAMEMODE.RadioBeep ) )
-
+
end]]
end
usermessage.Hook( "StoreMenu", StoreMenu )
function GM:InitVGUI() //obsolete
-
+
InventoryScreen = vgui.Create( "ItemSheet" )
InventoryScreen:SetSize( ScrW() * 0.5 - 10, ScrH() * 0.5 - 10 )
InventoryScreen:SetPos( 5, ScrH() * 0.5 + 5 )
@@ -472,18 +472,18 @@ function GM:InitVGUI() //obsolete
InventoryScreen:SetPadding( 3 )
InventoryScreen:EnableHorizontal( true )
InventoryScreen:SetVisible( false )
-
+
InfoScreen = vgui.Create( "ItemDisplay" )
InfoScreen:SetSize( ScrW() * 0.3 - 10, ScrH() * 0.5 - 5 )
InfoScreen:SetPos( 5, 5 )
InfoScreen:SetVisible( false )
-
+
PlayerScreen = vgui.Create( "PlayerDisplay" )
PlayerScreen:SetSize( ScrW() * 0.3 - 10, ScrH() * 0.5 - 5 )
PlayerScreen:SetPos( ScrW() * 0.7 + 5, 5 )
PlayerScreen:SetVisible( false )
PlayerScreen:SetupCam( Vector(0,96,36), Vector(0,0,36) )
-
+
StashScreen = vgui.Create( "ItemSheet" )
StashScreen:SetSize( ScrW() * 0.5 - 10, ScrH() * 0.5 - 10 )
StashScreen:SetPos( ScrW() * 0.5 + 5, ScrH() * 0.5 + 5 )
@@ -493,53 +493,52 @@ function GM:InitVGUI() //obsolete
StashScreen:SetVisible( false )
StashScreen:SetStashable( true, "Take" )
StashScreen.GetCash = function() return Inv_GetStashCash() end
-
+
SaleScreen = vgui.Create( "ShopMenu" )
SaleScreen:SetSize( ScrW() * 0.5 - 10, ScrH() * 0.5 - 10 )
SaleScreen:SetPos( ScrW() * 0.5 + 5, ScrH() * 0.5 + 5 )
SaleScreen:SetVisible( false )
-
+
local ypos = 5
-
+
for k,v in pairs( GAMEMODE.Categories ) do
-
+
local toggle = vgui.Create( "CategoryButton" )
toggle:SetPos( 5, ypos )
toggle:SetText( v.Name )
toggle:SetImage( v.Icon )
toggle:SetSize( 500, 30 )
-
+
ypos = ypos + 5 + 30
-
+
end
-
+
end
function StashMenu( msg )
local open = msg:ReadBool()
-
+
if InventoryScreen:IsVisible() and open then return end
-
+
StashScreen:SetPos( ScrW() * 0.5 + 5, ScrH() * 0.5 + 5 )
StashScreen:SetStashable( open, "Take" )
StashScreen:SetVisible( open )
-
+
InventoryScreen:SetSize( ScrW() * 0.5 - 10, ScrH() * 0.5 - 10 )
InventoryScreen:SetStashable( open, "Stash", true )
InventoryScreen:RefreshItems( LocalInventory )
InventoryScreen:SetVisible( open )
InfoScreen:SetVisible( open )
PlayerScreen:SetVisible( open )
-
+
gui.EnableScreenClicker( open )
-
+
if open then
-
+
StashScreen:RefreshItems( LocalStash )
-
+
end
-
+
end
usermessage.Hook( "StashMenu", StashMenu )
-
diff --git a/gamemode/cl_targetid.lua b/gamemode/cl_targetid.lua
index 0a69c81..2ea338c 100644
--- a/gamemode/cl_targetid.lua
+++ b/gamemode/cl_targetid.lua
@@ -8,128 +8,128 @@ local TargetedDist = Vector(0,0,0)
ValidTargetEnts = { "prop_physics", "sent_oxygen", "sent_fuel_diesel", "sent_fuel_gas", "sent_propane_tank", "sent_propane_canister", "sent_barrel_radioactive", "sent_barrel_biohazard" }
function GM:GetEntityID( ent )
-
+
if table.HasValue( ValidTargetEnts, ent:GetClass() ) then
-
+
local tbl = item.GetByClass( ent:GetClass() )
-
+
if tbl then
-
+
TargetedName = tbl.Name
TargetedEntity = ent
TargetedDist = Vector( 0, 0, TargetedEntity:OBBCenter():Distance( TargetedEntity:OBBMaxs() ) )
-
+
else
-
+
tbl = item.GetByModel( ent:GetModel() )
-
+
if tbl then
-
+
TargetedName = tbl.Name
TargetedEntity = ent
TargetedDist = Vector( 0, 0, TargetedEntity:OBBCenter():Distance( TargetedEntity:OBBMaxs() ) )
-
+
end
-
+
end
-
+
elseif ent:GetClass() == "sent_droppedgun" then
-
+
local tbl = item.GetByModel( ent:GetModel() )
-
+
if tbl then
-
+
TargetedName = tbl.Name
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 10 )
-
+
end
-
+
elseif ent:GetClass() == "sent_lootbag" then
-
+
TargetedName = "Loot"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 10 )
-
+
elseif ent:GetClass() == "sent_cash" then
-
+
TargetedName = ent:GetNWInt( "Cash", 10 ) .. " " .. GAMEMODE.CurrencyName .. "s"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 5 )
-
+
elseif ent:GetClass() == "sent_antidote" then
-
+
TargetedName = "Antidote Crate"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 15 )
-
+
elseif ent:GetClass() == "sent_supplycrate" then
-
+
TargetedName = "Supply Crate"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 15 )
-
+
elseif ent:GetClass() == "sent_bonuscrate" then
-
+
TargetedName = "Weapon Cache"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 25 )
-
+
elseif ent:GetClass() == "npc_scientist" then
-
+
TargetedName = "Field Researcher"
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 40 )
-
+
elseif ent:IsPlayer() and ent:Team() == TEAM_ARMY then
-
+
TargetedName = ent:Name()
TargetedEntity = ent
TargetedDist = Vector( 0, 0, 35 )
-
+
end
-
+
if IsValid( TargetedEntity ) then
-
+
TargetedTime = CurTime() + 5
-
+
end
-
+
end
function GM:HUDTraces()
local tr = util.TraceLine( util.GetPlayerTrace( LocalPlayer() ) )
-
+
GAMEMODE.LastTraceEnt = tr.Entity
if IsValid( GAMEMODE.LastTraceEnt ) and GAMEMODE.LastTraceEnt:GetPos():Distance( LocalPlayer():GetPos() ) < 800 then
-
+
GAMEMODE:GetEntityID( GAMEMODE.LastTraceEnt )
-
+
end
-
+
end
function GM:HUDDrawTargetID()
if not IsValid( LocalPlayer() ) then return end
-
+
if not LocalPlayer():Alive() or LocalPlayer():Team() == TEAM_ZOMBIES then return end
-
+
if IsValid( TargetedEntity ) and TargetedTime > CurTime() then
-
+
local worldpos = TargetedEntity:LocalToWorld( TargetedEntity:OBBCenter() ) + TargetedDist
local pos = ( worldpos ):ToScreen()
-
+
//print( TargetedName .. " " .. tostring(TargetedDist) .. tostring(pos.visible) .. " - " .. pos.x .. " n " .. pos.y )
-
+
if pos.visible then
-
+
draw.SimpleText( TargetedName or "Error", "AmmoFontSmall", pos.x, pos.y, Color( 80, 150, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
end
end
diff --git a/gamemode/default_player.lua b/gamemode/default_player.lua
index a84c8ab..ce52e6a 100644
--- a/gamemode/default_player.lua
+++ b/gamemode/default_player.lua
@@ -1,6 +1,6 @@
DEFINE_BASECLASS( "player_default" )
-local PLAYER = {}
+local PLAYER = {}
function PLAYER:GetHandsModel()
@@ -12,4 +12,4 @@ function PLAYER:Spawn()
end
-player_manager.RegisterClass( "player_army", PLAYER, "player_default" ) \ No newline at end of file
+player_manager.RegisterClass( "player_army", PLAYER, "player_default" )
diff --git a/gamemode/enums.lua b/gamemode/enums.lua
index 9b9a2e6..024e46e 100644
--- a/gamemode/enums.lua
+++ b/gamemode/enums.lua
@@ -26,4 +26,4 @@ CLASS_LEAPER = 4
EVENT_BONUS = 1
EVENT_WEATHER = 2
-EVENT_BAD = 3 \ No newline at end of file
+EVENT_BAD = 3
diff --git a/gamemode/events.lua b/gamemode/events.lua
index c4f9757..2ca9c88 100644
--- a/gamemode/events.lua
+++ b/gamemode/events.lua
@@ -14,4 +14,3 @@ function GetRandom()
return table.Random( Events )
end
-
diff --git a/gamemode/events/antidote_shortage.lua b/gamemode/events/antidote_shortage.lua
index 829709b..c88a99e 100644
--- a/gamemode/events/antidote_shortage.lua
+++ b/gamemode/events/antidote_shortage.lua
@@ -3,37 +3,37 @@ local EVENT = {}
EVENT.Chance = 0.75
EVENT.Type = EVENT_BAD
-EVENT.TimeText = { "1 minute", "2 minutes", "3 minutes" }
-EVENT.Times = { 60, 120, 180 }
+EVENT.TimeText = { "1 minute", "2 minutes", "3 minutes" }
+EVENT.Times = { 60, 120, 180 }
function EVENT:Start()
-
+
local num = math.random(1,3)
-
+
EVENT.EndTime = CurTime() + EVENT.Times[ num ]
EVENT.ThinkTime = 0
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Antidote supplies will be low for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 )
v:Notice( "The antidote shortage has ended", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] )
-
+
end
-
+
end
-
+
function EVENT:Think()
if EVENT.ThinkTime < CurTime() then
-
+
EVENT.ThinkTime = CurTime() + 3
-
+
if IsValid( GAMEMODE.Antidote ) and GAMEMODE.Antidote:CuresLeft() > 1 then
-
+
GAMEMODE.Antidote:SetCures( 1 )
-
+
end
-
+
end
end
diff --git a/gamemode/events/fallout.lua b/gamemode/events/fallout.lua
index b316523..2d31118 100644
--- a/gamemode/events/fallout.lua
+++ b/gamemode/events/fallout.lua
@@ -3,75 +3,75 @@ local EVENT = {}
EVENT.Chance = 0.50
EVENT.Type = EVENT_BAD
-EVENT.TimeText = { "30 seconds", "1 minute" }
-EVENT.Times = { 30, 60 }
+EVENT.TimeText = { "30 seconds", "1 minute" }
+EVENT.Times = { 30, 60 }
function EVENT:Start()
-
+
local num = math.random(1,2)
-
+
EVENT.Delay = CurTime() + 15
EVENT.RadTime = CurTime() + EVENT.Times[ num ] + 15
EVENT.RadDelay = 0
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Nuclear fallout contamination is imminent", GAMEMODE.Colors.White, 7 )
v:Notice( "Enter a building to avoid radiation poisoning", GAMEMODE.Colors.White, 7, 2 )
v:Notice( "The atmospheric fallout will subside in " .. EVENT.TimeText[ num ], GAMEMODE.Colors.White, 7, 15 )
v:Notice( "Atmospheric radioactivity levels are now safe", GAMEMODE.Colors.White, 7, EVENT.Times[ num ] + 15 )
-
+
end
-
+
timer.Simple( 15, function() SetGlobalBool( "Radiation", true ) end )
-
+
end
-
+
function EVENT:Think()
if EVENT.Delay < CurTime() then
-
+
if EVENT.RadDelay < CurTime() then
-
+
EVENT.RadDelay = CurTime() + 1
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
if not v:IsIndoors() then
-
+
if math.random(1,2) == 1 then
v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random(90,110) )
-
- end
-
+
+ end
+
if math.random(1,5) == 1 then
-
+
v:AddRadiation( 1 )
-
+
end
-
+
else
-
+
if math.random(1,6) == 1 then
v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random(120,140) )
-
- end
-
+
+ end
+
end
-
+
end
-
+
end
-
+
end
end
function EVENT:EndThink()
- return EVENT.RadTime < CurTime()
+ return EVENT.RadTime < CurTime()
end
diff --git a/gamemode/events/radio_blackout.lua b/gamemode/events/radio_blackout.lua
index 27c5344..024037f 100644
--- a/gamemode/events/radio_blackout.lua
+++ b/gamemode/events/radio_blackout.lua
@@ -3,24 +3,24 @@ local EVENT = {}
EVENT.Chance = 0.75
EVENT.Type = EVENT_BAD
-EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" }
-EVENT.Times = { 30, 60, 90 }
+EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" }
+EVENT.Times = { 30, 60, 90 }
function EVENT:Start()
-
+
local num = math.random(1,3)
-
+
GAMEMODE.RadioBlock = CurTime() + EVENT.Times[ num ]
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Radio communications will be down for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 )
v:Notice( "Radio communications are back online", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/events/radioblackout.lua b/gamemode/events/radioblackout.lua
index 27c5344..024037f 100644
--- a/gamemode/events/radioblackout.lua
+++ b/gamemode/events/radioblackout.lua
@@ -3,24 +3,24 @@ local EVENT = {}
EVENT.Chance = 0.75
EVENT.Type = EVENT_BAD
-EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" }
-EVENT.Times = { 30, 60, 90 }
+EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" }
+EVENT.Times = { 30, 60, 90 }
function EVENT:Start()
-
+
local num = math.random(1,3)
-
+
GAMEMODE.RadioBlock = CurTime() + EVENT.Times[ num ]
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Radio communications will be down for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 )
v:Notice( "Radio communications are back online", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/events/scientist.lua b/gamemode/events/scientist.lua
index ce58fdf..3bbe6c3 100644
--- a/gamemode/events/scientist.lua
+++ b/gamemode/events/scientist.lua
@@ -5,22 +5,22 @@ EVENT.Chance = 0.75
EVENT.Type = EVENT_BONUS
function EVENT:Start()
-
+
local spawns = ents.FindByClass( "info_evac" )
local evac = table.Random( spawns )
-
+
local ent = ents.Create( "npc_scientist" )
ent:SetPos( evac:GetPos() + Vector(0,0,10) )
ent:Spawn()
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "A surviving field researcher has been sighted", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/events/supply_crate.lua b/gamemode/events/supply_crate.lua
index 35ca974..6de809f 100644
--- a/gamemode/events/supply_crate.lua
+++ b/gamemode/events/supply_crate.lua
@@ -5,24 +5,24 @@ EVENT.Chance = 0.95
EVENT.Type = EVENT_BONUS
function EVENT:Start()
-
+
local spawns = ents.FindByClass( "info_lootspawn" )
local loot = table.Random( spawns )
-
+
if not IsValid( loot ) then MsgN( "ERROR: Unable to locate loot spawns. Map not configured?" ) return end
-
+
local ent = ents.Create( "sent_bonuscrate" )
ent:SetPos( loot:GetPos() + Vector(0,0,10) )
ent:Spawn()
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Keep an eye out for a civilian weapon cache", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/events/supplycrate.lua b/gamemode/events/supplycrate.lua
index 35ca974..6de809f 100644
--- a/gamemode/events/supplycrate.lua
+++ b/gamemode/events/supplycrate.lua
@@ -5,24 +5,24 @@ EVENT.Chance = 0.95
EVENT.Type = EVENT_BONUS
function EVENT:Start()
-
+
local spawns = ents.FindByClass( "info_lootspawn" )
local loot = table.Random( spawns )
-
+
if not IsValid( loot ) then MsgN( "ERROR: Unable to locate loot spawns. Map not configured?" ) return end
-
+
local ent = ents.Create( "sent_bonuscrate" )
ent:SetPos( loot:GetPos() + Vector(0,0,10) )
ent:Spawn()
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "Keep an eye out for a civilian weapon cache", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/events/weather_event.lua b/gamemode/events/weather_event.lua
index f7640fe..ab79299 100644
--- a/gamemode/events/weather_event.lua
+++ b/gamemode/events/weather_event.lua
@@ -13,15 +13,15 @@ EVENT.Types[4] = "strong winds"
function EVENT:Start()
GAMEMODE:RandomizeWeather( true )
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "The weather conditions are worsening", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
-
+
function EVENT:Think()
end
diff --git a/gamemode/init.lua b/gamemode/init.lua
index eafdfcb..0d2fa20 100644
--- a/gamemode/init.lua
+++ b/gamemode/init.lua
@@ -54,78 +54,78 @@ util.AddNetworkString( "ItemPlacerSynch" )
util.AddNetworkString( "WeatherSynch" )
function GM:Initialize()
-
+
GAMEMODE.NextZombieThink = CurTime() + GetConVar( "sv_redead_setup_time" ):GetInt()
GAMEMODE.RandomLoot = {}
GAMEMODE.PlayerIDs = {}
GAMEMODE.Lords = {}
GAMEMODE.Wave = 1
GAMEMODE.NextWave = CurTime() + 60 * GetConVar( "sv_redead_wave_length" ):GetInt()
-
- local length = #GAMEMODE.Waves * ( GetConVar( "sv_redead_wave_length" ):GetInt() * 60 )
-
+
+ local length = #GAMEMODE.Waves * ( GetConVar( "sv_redead_wave_length" ):GetInt() * 60 )
+
for i=1, #GAMEMODE.Waves - 1 do
-
+
local remain = length - i * GetConVar( "sv_redead_wave_length" ):GetInt() * 60
local num = i * GetConVar( "sv_redead_wave_length" ):GetInt()
-
+
timer.Simple( remain, function() for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do v:Notice( num .. " minutes until evac arrives", GAMEMODE.Colors.White, 5 ) end end )
-
+
end
-
+
timer.Simple( GetConVar( "sv_redead_setup_time" ):GetInt(), function() for k,v in pairs( player.GetAll() ) do v:Notice( "The undead onslaught has begun", GAMEMODE.Colors.White, 5 ) end end )
-
+
timer.Simple( GetConVar( "sv_redead_setup_time" ):GetInt() - 5, function() for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do v:Notice( "Press F4 if you want to be the zombie lord", GAMEMODE.Colors.White, 5 ) end end )
-
+
timer.Simple( GetConVar( "sv_redead_setup_time" ):GetInt() + 5, function() GAMEMODE:PickLord() GAMEMODE.EarlyPick = true end )
-
- timer.Simple( length - 60, function()
-
+
+ timer.Simple( length - 60, function()
+
if GetGlobalBool( "GameOver", false ) then return end
-
- GAMEMODE.EvacAlert = true
-
- for k,v in pairs( player.GetAll() ) do
-
- v:ClientSound( GAMEMODE.LastMinute )
- v:Notice( "The evac chopper is en route", GAMEMODE.Colors.White, 5 )
-
+
+ GAMEMODE.EvacAlert = true
+
+ for k,v in pairs( player.GetAll() ) do
+
+ v:ClientSound( GAMEMODE.LastMinute )
+ v:Notice( "The evac chopper is en route", GAMEMODE.Colors.White, 5 )
+
end
-
+
end )
-
- timer.Simple( length - 40, function()
-
+
+ timer.Simple( length - 40, function()
+
if GetGlobalBool( "GameOver", false ) then return end
-
- for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
- v:Notice( "The evac chopper has arrived", GAMEMODE.Colors.White, 5 )
+
+ for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
+
+ v:Notice( "The evac chopper has arrived", GAMEMODE.Colors.White, 5 )
v:Notice( "You have 45 seconds to reach the evac zone", GAMEMODE.Colors.White, 5, 2 )
v:Notice( "The location has been marked", GAMEMODE.Colors.White, 5, 4 )
-
- end
-
+
+ end
+
if IsValid( GAMEMODE.Antidote ) then
-
+
GAMEMODE.Antidote:SetOverride()
-
+
end
-
- GAMEMODE:SpawnEvac()
-
+
+ GAMEMODE:SpawnEvac()
+
end )
-
+
timer.Simple( length + 5, function() GAMEMODE:CheckGameOver( true ) end )
-
+
GAMEMODE:WeatherInit()
-
+
if math.random( 1, 10 ) == 1 then
-
+
GAMEMODE.RandomEvent = CurTime() + ( 60 * math.Rand( 1.5, 3.5 ) )
-
+
end
-
+
end
GM.Breakables = {}
@@ -136,11 +136,11 @@ GM.SpawnCounter = 0
GM.LordExists = false
GM.EarlyPick = false
-function GM:InitPostEntity()
+function GM:InitPostEntity()
GAMEMODE.Trader = ents.Create( "info_trader" )
GAMEMODE.Trader:Spawn()
-
+
GAMEMODE.SpecialTrader = ents.Create( "info_trader" )
GAMEMODE.SpecialTrader:SetSpecial( true )
GAMEMODE.SpecialTrader:Spawn()
@@ -153,89 +153,89 @@ function GM:InitPostEntity()
badshit = table.Add( badshit, ents.FindByClass( "env_entity_maker" ) )
badshit = table.Add( badshit, ents.FindByClass( "point_template" ) )
badshit = table.Add( badshit, ents.FindByClass( "game_text" ) )
-
+
for k,v in pairs( ents.FindByClass( "prop_phys*" ) ) do
-
+
if string.find( v:GetModel(), "explosive" ) or string.find( v:GetModel(), "propane" ) or string.find( v:GetModel(), "gascan" ) or string.find( v:GetModel(), "gib" ) then
-
+
table.insert( badshit, v )
-
+
end
-
+
local phys = v:GetPhysicsObject()
-
+
if IsValid( phys ) and table.HasValue( { "wood", "wood_crate", "wood_furniture", "wood_plank", "default" }, phys:GetMaterial() ) and phys:GetMass() > 8 then
-
+
table.insert( GAMEMODE.WoodLocations, { Pos = v:GetPos(), Ang = v:GetAngles(), Model = v:GetModel(), Health = v:Health() } )
-
+
GAMEMODE.WoodCount = GAMEMODE.WoodCount + 1
-
+
v.IsWooden = true
-
+
if v:Health() == 0 then
-
+
v:SetHealth( 100 )
-
+
end
-
+
if phys:IsAsleep() then
-
+
phys:Wake()
-
+
end
-
+
end
-
+
end
for k,v in pairs( badshit ) do
-
+
v:Remove()
-
+
end
-
+
GAMEMODE.WoodPercent = math.floor( table.Count( ents.FindByClass( "prop_phys*" ) ) * GAMEMODE.WoodPercentage )
-
+
for k,v in pairs( ents.FindByClass( "prop_phys*" ) ) do
-
+
local tbl = item.GetByModel( v:GetModel() )
local phys = v:GetPhysicsObject()
-
+
if tbl or ( IsValid( phys ) and phys:GetMass() <= 3 ) then
-
+
v:Remove()
-
+
end
-
+
end
-
+
GAMEMODE:LoadAllEnts()
-
+
local tbl = ents.FindByClass( "prop_door_rotating" )
tbl = table.Add( tbl, ents.FindByClass( "func_breakable*" ) )
tbl = table.Add( tbl, ents.FindByClass( "func_door*" ) )
-
+
GAMEMODE.Breakables = tbl
GAMEMODE.NPCSpawns = ents.FindByClass( "info_npcspawn" )
-
+
local num = #ents.FindByClass( "point_radiation" )
-
+
if num < 5 then return end
-
+
for i=1, math.floor( num * GAMEMODE.RadiationAmount ) do
-
+
local rad = table.Random( ents.FindByClass( "point_radiation" ) )
-
+
while !rad:IsActive() do
-
+
rad = table.Random( ents.FindByClass( "point_radiation" ) )
-
+
end
-
+
rad:SetActive( false )
-
+
end
-
+
end
function GM:SaveAllEnts()
@@ -252,35 +252,35 @@ function GM:SaveAllEnts()
point_radiation = {},
prop_physics = {}
}
-
+
for k,v in pairs( enttbl ) do
-
+
for c,d in pairs( ents.FindByClass( k ) ) do
-
+
if k == "prop_physics" then
-
+
if d.AdminPlaced then
-
+
local phys = d:GetPhysicsObject()
-
+
if IsValid( phys ) then
-
+
table.insert( enttbl[k], { d:GetPos(), d:GetModel(), d:GetAngles(), phys:IsMoveable() } )
-
+
end
-
+
end
-
+
elseif d.AdminPlaced then
-
+
table.insert( enttbl[k], d:GetPos() )
-
+
end
-
+
end
-
+
end
-
+
file.Write( "redead/" .. string.lower( game.GetMap() ) .. "_json.txt", util.TableToJSON( enttbl ) )
end
@@ -290,37 +290,37 @@ function GM:LoadAllEnts()
MsgN( "Loading ReDead map config data..." )
local read = file.Read( "redead/" .. string.lower( game.GetMap() ) .. "_json.txt", "DATA" )
-
+
if not read then
-
+
MsgN( "No map config data found for " .. game.GetMap() .. "." )
-
+
return
-
+
end
-
+
local config = util.JSONToTable( read )
-
- if not config then
-
- MsgN( "ERROR: ReDead map config data file was empty!" )
-
- return
-
- end
-
+
+ if not config then
+
+ MsgN( "ERROR: ReDead map config data file was empty!" )
+
+ return
+
+ end
+
MsgN( "Loaded ReDead map config data successfully!" )
-
+
for k,v in pairs( config ) do
-
+
if v[1] then
-
+
if k == "prop_physics" then
-
+
for c,d in pairs( v ) do
-
+
local function spawnent()
-
+
local ent = ents.Create( k )
ent:SetPos( d[1] )
ent:SetModel( d[2] )
@@ -328,189 +328,189 @@ function GM:LoadAllEnts()
ent:SetSkin( math.random( 0, 6 ) )
ent:Spawn()
ent.AdminPlaced = true
-
+
local phys = ent:GetPhysicsObject()
-
+
if IsValid( phys ) and not d[4] then
-
+
phys:EnableMotion( false )
-
+
end
-
+
end
-
+
timer.Simple( c * 0.1, function() spawnent() end )
-
+
end
-
+
else
-
+
for c,d in pairs( ents.FindByClass( k ) ) do
-
+
d:Remove()
-
+
end
for c,d in pairs( v ) do
-
+
if k != "point_radiation" and k != "info_lootspawn" and k != "info_npcspawn" then
-
+
local function spawnent()
-
+
local ent = ents.Create( k )
ent:SetPos( d )
ent:Spawn()
ent.AdminPlaced = true
-
+
end
-
+
timer.Simple( c * 0.1, function() spawnent() end )
-
+
else
-
+
local ent = ents.Create( k )
ent:SetPos( d )
ent:Spawn()
ent.AdminPlaced = true
-
+
end
end
-
+
end
-
+
end
-
+
end
end
-function GM:AddToZombieList( ply )
+function GM:AddToZombieList( ply )
+
+ if team.NumPlayers( TEAM_ZOMBIES ) > 0 then
- if team.NumPlayers( TEAM_ZOMBIES ) > 0 then
-
ply:ClientSound( "HL1/fvox/buzz.wav", 100 )
ply:Notice( "You cannot be the zombie lord now", GAMEMODE.Colors.Red, 5 )
-
+
return
-
+
end
if not table.HasValue( GAMEMODE.Lords, ply ) and not GAMEMODE.LordExists then
-
+
table.insert( GAMEMODE.Lords, ply )
-
+
local snd = table.Random( GAMEMODE.AmbientScream )
ply:ClientSound( snd, 100 )
ply:Notice( "You have volunteered to be the zombie lord", GAMEMODE.Colors.White, 5 )
-
+
end
end
function GM:PickLord( force )
- if table.Count( player.GetAll() ) < GetConVar( "sv_redead_minimum_players" ):GetInt() and not force then
-
+ if table.Count( player.GetAll() ) < GetConVar( "sv_redead_minimum_players" ):GetInt() and not force then
+
for k,v in pairs( player.GetAll() ) do
-
+
v:Notice( "A zombie lord cannot be chosen at this time", GAMEMODE.Colors.White, 5 )
-
+
end
-
- return
-
+
+ return
+
end
local tbl = team.GetPlayers( TEAM_ZOMBIES )
-
+
for k,v in pairs( GAMEMODE.Lords ) do
-
+
if IsValid( v ) then
-
+
table.insert( tbl, v )
-
+
end
-
+
end
-
+
if table.Count( tbl ) < 1 then
-
+
tbl = team.GetPlayers( TEAM_ARMY )
-
+
end
-
+
local ply = table.Random( tbl )
-
+
local snd = table.Random( GAMEMODE.AmbientScream )
ply:ClientSound( snd, 100 )
-
+
if ply:Team() == TEAM_ZOMBIES then
-
+
ply:Notice( "You have become the zombie lord", GAMEMODE.Colors.White, 5 )
-
+
timer.Simple( 3, function() ply:Gib() ply:SetLord( true ) end )
-
+
else
-
+
ply:Notice( "You will become the zombie lord", GAMEMODE.Colors.White, 5 )
-
+
timer.Simple( 3, function() ply:SetTeam( TEAM_ZOMBIES ) ply:SetPlayerClass( CLASS_RUNNER ) ply:SetCash( 0 ) ply:Gib() ply:SetLord( true ) end )
-
+
end
-
+
for k,v in pairs( player.GetAll() ) do
-
+
if v != ply and not force then
-
+
v:Notice( "A zombie lord has been chosen", GAMEMODE.Colors.White, 5 )
-
+
end
-
+
end
-
+
GAMEMODE.LordExists = true
end
function GM:RespawnAntidote()
-
+
if IsValid( ents.FindByClass( "sent_antidote" )[1] ) and ents.FindByClass( "sent_antidote" )[1]:CuresLeft() > 0 then return end
-
+
if #ents.FindByClass( "info_lootspawn" ) < 3 then return end
local ent = table.Random( ents.FindByClass( "info_lootspawn" ) )
local pos = ent:GetPos()
local close = true
-
+
while close do
-
+
ent = table.Random( ents.FindByClass( "info_lootspawn" ) )
pos = ent:GetPos()
close = false
-
+
for k,v in pairs( ents.FindByClass( "sent_antidote" ) ) do
-
+
if v:GetPos():Distance( pos ) < 500 then
-
+
close = true
-
+
end
-
+
end
-
+
end
-
+
local ant = ents.Create( "sent_antidote" )
ant:SetPos( pos )
ant:Spawn()
-
+
GAMEMODE.Antidote = ant
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
v:Notice( "The antidote resupply location has changed", GAMEMODE.Colors.White, 5 )
-
+
end
end
@@ -520,28 +520,28 @@ function GM:SpawnEvac()
local pos = Vector(0,0,0)
if #ents.FindByClass( "info_evac" ) < 1 then
-
+
local loot = ents.FindByClass( "info_lootspawn" )
-
+
if #loot < 1 then
-
+
MsgN( "ERROR: Map not configured properly." )
-
+
return
-
+
end
-
+
local prop = table.Random( loot )
-
+
pos = prop:GetPos()
-
+
else
-
+
local point = table.Random( ents.FindByClass( "info_evac" ) )
pos = point:GetPos()
-
+
end
-
+
local evac = ents.Create( "point_evac" )
evac:SetPos( pos )
evac:Spawn()
@@ -553,27 +553,27 @@ function GM:GetGeneratedLoot()
local tbl = {}
for k,v in pairs( GAMEMODE.RandomLoot ) do
-
+
if IsValid( v ) then
-
+
table.insert( tbl, v )
-
+
end
-
+
end
-
+
for k,v in pairs( GAMEMODE.RandomLoot ) do
-
+
if not IsValid( v ) then
-
+
table.remove( tbl, k )
-
+
return tbl
-
+
end
-
+
end
-
+
return tbl
end
@@ -581,80 +581,80 @@ end
function GM:LootThink()
for k,v in pairs( ents.FindByClass( "prop_phys*" ) ) do
-
+
if v.Removal and v.Removal < CurTime() and IsValid( v ) then
-
+
v:Remove()
-
+
end
-
+
end
if #ents.FindByClass( "info_lootspawn" ) < 10 then return end
local amt = math.floor( GAMEMODE.MaxLoot * #ents.FindByClass( "info_lootspawn" ) )
local total = 0
-
+
local loots = GAMEMODE:GetGeneratedLoot()
-
+
local num = amt - #loots
-
+
if num > 0 then
-
+
local tbl = { ITEM_SUPPLY, ITEM_LOOT, ITEM_AMMO, ITEM_MISC, ITEM_SPECIAL, ITEM_WPN_COMMON, ITEM_WPN_SPECIAL, ITEM_EXPLOSIVE }
local chancetbl = { 0.60, 0.70, 0.70, 0.95, 0.05, 0.03, 0.02, 0.10 }
-
+
for i=1, num do
-
+
local ent = table.Random( ents.FindByClass( "info_lootspawn" ) )
local pos = ent:GetPos()
local rnd = math.Rand(0,1)
- local choice = math.random( 1, table.Count( tbl ) )
-
+ local choice = math.random( 1, table.Count( tbl ) )
+
while rnd > chancetbl[ choice ] do
-
+
rnd = math.Rand(0,1)
- choice = math.random( 1, table.Count( tbl ) )
-
+ choice = math.random( 1, table.Count( tbl ) )
+
end
-
+
local rand = item.RandomItem( tbl[choice] )
local proptype = "prop_physics"
-
+
if rand.TypeOverride then
-
+
proptype = rand.TypeOverride
-
+
end
-
+
local loot = ents.Create( proptype )
loot:SetPos( pos + Vector(0,0,5) )
loot:SetAngles( VectorRand():Angle() )
-
+
if rand.DropModel then
-
+
loot:SetModel( rand.DropModel )
-
+
else
-
+
loot:SetModel( rand.Model )
-
+
end
-
+
loot:Spawn()
loot.RandomLoot = true
loot.IsItem = true
-
+
if not rand.CollisionOverride then
-
+
loot:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
+
end
-
+
table.insert( GAMEMODE.RandomLoot, loot )
-
+
end
-
+
end
end
@@ -664,8 +664,8 @@ function GM:WoodThink()
if table.Count( GAMEMODE.WoodLocations ) < 1 then return end
if GAMEMODE.WoodCount < GAMEMODE.WoodPercent then
-
- local tbl = table.Random( GAMEMODE.WoodLocations )
+
+ local tbl = table.Random( GAMEMODE.WoodLocations )
local prop = ents.Create( "prop_physics" )
prop:SetPos( tbl.Pos )
prop:SetAngles( tbl.Ang )
@@ -673,22 +673,22 @@ function GM:WoodThink()
prop:SetHealth( math.Clamp( tbl.Health, 50, 500 ) )
prop:Spawn()
prop.IsWooden = true
-
+
GAMEMODE.WoodCount = GAMEMODE.WoodCount + 1
-
+
elseif GAMEMODE.WoodCount > GAMEMODE.WoodPercent then
-
+
local ent = table.Random( ents.FindByClass( "prop_phys*" ) )
local phys = ent:GetPhysicsObject()
-
+
if IsValid( phys ) and not ent.IsItem and ent.IsWooden then
-
+
ent:Remove()
-
+
GAMEMODE.WoodCount = GAMEMODE.WoodCount - 1
-
+
end
-
+
end
end
@@ -696,45 +696,45 @@ end
function GM:EventThink()
if not GAMEMODE.RandomEvent then
-
+
GAMEMODE.RandomEvent = CurTime() + ( 60 * math.Rand( 3.5, 9.5 ) )
-
+
end
-
+
if GAMEMODE.RandomEvent and GAMEMODE.RandomEvent < CurTime() then
-
+
local ev = event.GetRandom()
-
+
while ( ( ev.Type == EVENT_WEATHER and GAMEMODE.WeatherHappened ) or ev.Chance < math.Rand(0,1) ) do
-
+
ev = event.GetRandom()
-
+
end
-
+
if ev.Type == EVENT_WEATHER then
-
+
GAMEMODE.WeatherHappened = true
-
+
end
-
+
ev.Start()
-
+
GAMEMODE.Event = ev
GAMEMODE.RandomEvent = nil
-
+
end
-
+
if GAMEMODE.Event then
-
+
GAMEMODE.Event:Think()
-
+
if GAMEMODE.Event:EndThink() then
-
+
GAMEMODE.Event:End()
GAMEMODE.Event = nil
-
+
end
-
+
end
end
@@ -742,19 +742,19 @@ end
function GM:WaveThink()
if GAMEMODE.NextWave < CurTime() then
-
+
GAMEMODE.NextWave = CurTime() + 60 * GetConVar( "sv_redead_wave_length" ):GetInt()
GAMEMODE.Wave = GAMEMODE.Wave + 1
-
+
if GAMEMODE.Wave > #GAMEMODE.Waves then return end
-
+
for k,v in pairs( player.GetAll() ) do
-
+
v:Notice( "New undead mutations have been spotted", GAMEMODE.Colors.White, 5 )
v:ClientSound( table.Random( GAMEMODE.AmbientScream ) )
-
+
end
-
+
end
end
@@ -763,14 +763,14 @@ function GM:GetZombieClass()
local rand = math.Rand(0,1)
local class = table.Random( GAMEMODE.Waves[ GAMEMODE.Wave ] or { "npc_nb_common" } )
-
+
while #GAMEMODE.Waves[ GAMEMODE.Wave ] != 1 and rand > GAMEMODE.SpawnChance[ class ] do
-
+
rand = math.Rand(0,1)
class = table.Random( GAMEMODE.Waves[ GAMEMODE.Wave ] or { "npc_nb_common" } )
-
+
end
-
+
return class
end
@@ -778,34 +778,34 @@ end
function GM:NPCRespawnThink()
for k,v in pairs( ( GAMEMODE.NPCSpawns or {} ) ) do
-
+
if IsValid( v ) then
-
+
local box = ents.FindInBox( v:GetPos() + Vector( -32, -32, 0 ), v:GetPos() + Vector( 32, 32, 64 ) )
local can = true
-
+
for k,v in pairs( box ) do
-
+
if v.NextBot then
-
+
can = false
-
+
end
-
+
end
-
- if can and GAMEMODE.SpawnCounter > 0 then
-
+
+ if can and GAMEMODE.SpawnCounter > 0 then
+
local ent = ents.Create( GAMEMODE:GetZombieClass() )
ent:SetPos( v:GetPos() )
ent:Spawn()
-
+
GAMEMODE.SpawnCounter = GAMEMODE.SpawnCounter - 1
-
+
end
-
+
end
-
+
end
end
@@ -813,33 +813,33 @@ end
function GM:NPCThink()
if GAMEMODE.Wave > #GAMEMODE.Waves then return end
-
+
local tbl = ents.FindByClass( "npc_nb*" )
-
+
if #tbl < GetConVar( "sv_redead_max_zombies" ):GetInt() and #tbl < GetConVar( "sv_redead_zombies_per_player" ):GetInt() * team.NumPlayers( TEAM_ARMY ) then
-
+
local total = math.Round( GetConVar( "sv_redead_zombies_per_player" ):GetInt() * team.NumPlayers( TEAM_ARMY ) + GetConVar( "sv_redead_zombies_per_player_zombie" ):GetFloat() * team.NumPlayers( TEAM_ZOMBIES ) )
local num = math.Clamp( total, 1, math.Min( GetConVar( "sv_redead_max_zombies" ):GetInt() - #tbl, total ) )
-
+
GAMEMODE.SpawnCounter = num
-
+
--[[for i=1, num do
-
+
local tbl = ents.FindByClass( "info_npcspawn" )
-
+
if #tbl < 1 then return end
-
+
local spawn = table.Random( tbl )
local vec = VectorRand() * 5
-
+
vec.z = 1
-
+
local ent = ents.Create( GAMEMODE:GetZombieClass() )
ent:SetPos( spawn:GetPos() + vec )
ent:Spawn()
-
+
end]]
-
+
end
end
@@ -849,13 +849,13 @@ function GM:Think()
if ( GAMEMODE.NextGameThink or 0 ) < CurTime() then
if ( GAMEMODE.NextZombieThink or 0 ) < CurTime() then
-
+
GAMEMODE:NPCThink()
-
+
GAMEMODE.NextZombieThink = CurTime() + GetConVar( "sv_redead_wave_time" ):GetInt()
-
+
end
-
+
GAMEMODE:NPCRespawnThink()
GAMEMODE:RespawnAntidote()
GAMEMODE:EventThink()
@@ -865,17 +865,17 @@ function GM:Think()
GAMEMODE:WeatherThink()
GAMEMODE:CheckGameOver( false )
GAMEMODE.NextGameThink = CurTime() + 1
-
+
end
for k,v in pairs( player.GetAll() ) do
-
+
if v:Team() != TEAM_UNASSIGNED then
-
+
v:Think()
-
+
end
-
+
end
end
@@ -885,33 +885,33 @@ function GM:PhysgunPickup( ply, ent )
if ply:IsAdmin() or ply:IsSuperAdmin() then return true end
if ent:IsPlayer() then return false end
-
+
if not ent.Placer or ent.Placer != ply then return false end
-
- return true
+
+ return true
end
function GM:PlayerDisconnected( pl )
if pl:Alive() then
-
+
pl:DropLoot()
-
+
end
-
+
if not table.HasValue( GAMEMODE.PlayerIDs, pl:SteamID() ) then
-
+
table.insert( GAMEMODE.PlayerIDs, pl:SteamID() )
-
+
end
-
+
if pl:IsLord() then
-
+
GAMEMODE.LordExists = false
-
+
end
-
+
end
function GM:PlayerInitialSpawn( pl )
@@ -919,67 +919,67 @@ function GM:PlayerInitialSpawn( pl )
pl:GiveAmmo( 200, "Pistol", false )
if table.HasValue( GAMEMODE.PlayerIDs, pl:SteamID() ) then
-
+
pl:SetTeam( TEAM_ZOMBIES )
-
+
elseif pl:IsBot() then
-
+
pl:SetTeam( TEAM_ARMY )
pl:Spawn()
-
+
else
-
+
pl:SetTeam( TEAM_UNASSIGNED )
pl:Spectate( OBS_MODE_ROAMING )
-
+
end
-
+
end
function GM:PlayerSpawn( pl )
if pl:Team() == TEAM_UNASSIGNED then
-
+
pl:Spectate( OBS_MODE_ROAMING )
pl:SetPos( pl:GetPos() + Vector( 0, 0, 50 ) )
-
+
return
-
+
end
-
+
GAMEMODE:RespawnAntidote()
-
+
if pl:Team() == TEAM_ARMY then
-
+
local music = table.Random( GAMEMODE.OpeningMusic )
-
+
pl:ClientSound( music, 100 )
-
+
end
-
+
pl:NoticeOnce( "Press F1 to view the help menu", GAMEMODE.Colors.Blue, 7, 15 )
pl:NoticeOnce( "Press F2 to buy items and weapons", GAMEMODE.Colors.Blue, 7, 17 )
pl:NoticeOnce( "Press F3 to activate the panic button", GAMEMODE.Colors.Blue, 7, 19 )
pl:InitializeInventory()
pl:OnSpawn()
pl:OnLoadout()
-
+
local oldhands = pl:GetHands()
-
+
if IsValid( oldhands ) then
-
+
oldhands:Remove()
-
+
end
-
+
local hands = ents.Create( "gmod_hands" )
-
+
if IsValid( hands ) then
-
+
hands:DoSetup( pl )
hands:Spawn()
-
- end
+
+ end
end
@@ -988,73 +988,73 @@ function GM:PlayerSetModel( pl )
end
function GM:PlayerLoadout( pl )
-
+
end
function GM:PlayerJoinTeam( ply, teamid )
-
+
local oldteam = ply:Team()
-
+
if ply:Alive() and ply:Team() != TEAM_UNASSIGNED then return end
-
+
if teamid != TEAM_UNASSIGNED and ply:Team() == TEAM_UNASSIGNED then
-
+
ply:UnSpectate()
-
+
end
-
+
if teamid == TEAM_SPECTATOR or teamid == TEAM_UNASSIGNED then
-
+
teamid = TEAM_ARMY
-
+
end
-
+
ply:SetTeam( teamid )
-
+
if ply.NextSpawn and ply.NextSpawn > CurTime() then
-
+
ply.NextSpawn = CurTime() + 5
-
+
else
-
+
ply:Spawn()
-
+
end
-
+
end
function GM:PlayerSwitchFlashlight( ply, on )
return ply:Team() == TEAM_ARMY
-
+
end
function GM:GetFallDamage( ply, speed )
if ply:Team() == TEAM_ZOMBIES then
-
+
return 5
-
+
end
local pain = speed * 0.12
-
+
ply:AddStamina( math.floor( pain * -0.25 ) )
return pain
-
+
end
function GM:PlayerDeathSound()
return true
-
+
end
function GM:CanPlayerSuicide( ply )
return false
-
+
end
function GM:KeyRelease( ply, key )
@@ -1062,56 +1062,56 @@ function GM:KeyRelease( ply, key )
if ply:Team() != TEAM_ARMY then return end
if key == IN_JUMP then
-
+
ply:AddStamina( -2 )
-
+
end
-
+
if key != IN_USE then return end
-
+
local trace = {}
trace.start = ply:GetShootPos()
trace.endpos = trace.start + ply:GetAimVector() * 80
trace.filter = ply
-
+
local tr = util.TraceLine( trace )
-
+
if IsValid( tr.Entity ) and tr.Entity:GetClass() == "prop_physics" then
-
+
if IsValid( ply.Stash ) then
-
+
ply.Stash:OnExit( ply )
-
+
return true
-
+
end
-
+
ply:AddToInventory( tr.Entity )
-
+
return true
-
+
elseif IsValid( tr.Entity ) and tr.Entity:GetClass() == "point_stash" then
-
+
if IsValid( ply.Stash ) then
-
+
ply.Stash:OnExit( ply )
-
+
else
-
+
tr.Entity:OnUsed( ply )
-
+
end
-
+
elseif not IsValid( tr.Entity ) then
-
+
if IsValid( ply.Stash ) then
-
+
ply.Stash:OnExit( ply )
-
+
end
-
+
end
-
+
return true
end
@@ -1119,19 +1119,19 @@ end
function GM:PropBreak( att, prop )
local phys = prop:GetPhysicsObject()
-
+
if IsValid( phys ) and prop:GetModel() != "models/props_debris/wood_board04a.mdl" then
-
+
if prop.IsWooden then
-
+
GAMEMODE:SpawnChunk( prop:LocalToWorld( prop:OBBCenter() ) )
GAMEMODE.WoodCount = GAMEMODE.WoodCount - 1
-
+
end
-
+
end
-end
+end
function GM:SpawnChunk( pos )
@@ -1147,273 +1147,273 @@ end
function GM:AllowPlayerPickup( ply, ent )
local tbl = item.GetByModel( ent:GetModel() )
-
+
if tbl and tbl.AllowPickup then
-
+
return true
-
+
end
return false
-
+
end
function GM:PlayerUse( ply, entity )
if ply:Team() == TEAM_ARMY and ( ply.LastUse or 0 ) < CurTime() then
-
- if table.HasValue( { "sent_propane_canister", "sent_propane_tank", "sent_fuel_diesel", "sent_fuel_gas" }, entity:GetClass() ) then
-
+
+ if table.HasValue( { "sent_propane_canister", "sent_propane_tank", "sent_fuel_diesel", "sent_fuel_gas" }, entity:GetClass() ) then
+
ply.LastUse = CurTime() + 0.5
-
- if not IsValid( ply.HeldObject ) and not IsValid( entity.Holder ) then
-
+
+ if not IsValid( ply.HeldObject ) and not IsValid( entity.Holder ) then
+
ply:PickupObject( entity )
ply.HeldObject = entity
entity.Holder = ply
entity:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-
- elseif entity == ply.HeldObject then
-
+
+ elseif entity == ply.HeldObject then
+
ply:DropObject( entity )
ply.HeldObject = nil
entity.Holder = nil
entity:SetCollisionGroup( COLLISION_GROUP_NONE )
-
+
end
-
+
end
-
+
return true
-
+
end
-
+
if ply:Team() != TEAM_ZOMBIES then return false end
-
+
local trace = {}
trace.start = ply:GetShootPos()
trace.endpos = trace.start + ply:GetAimVector() * 80
trace.filter = ply
-
+
local tr = util.TraceLine( trace )
-
+
if entity:GetClass() == "prop_door_rotating" or entity:GetClass() == "func_button" then
return false
-
+
end
-
+
return true
-
+
end
function GM:EntityTakeDamage( ent, dmginfo )
if ent.IsWooden then
-
- ent.WoodHealth = ( ent.WoodHealth or 150 ) - dmginfo:GetDamage()
-
+
+ ent.WoodHealth = ( ent.WoodHealth or 150 ) - dmginfo:GetDamage()
+
if ent.WoodHealth < 1 then
-
+
ent:Fire( "break", 0, 0 )
-
+
end
-
+
end
if not ent:IsPlayer() and ent:IsOnFire() then
-
+
ent:Extinguish()
-
+
end
- if not ent:IsPlayer() and ent.IsItem then
+ if not ent:IsPlayer() and ent.IsItem then
dmginfo:ScaleDamage( 0 )
-
+
return
-
+
end
-
+
local attacker = dmginfo:GetAttacker()
-
+
if ent:IsPlayer() and ent:Team() == TEAM_ARMY and IsValid( attacker ) and ( attacker:IsNPC() or ( ( attacker:IsPlayer() and attacker:Team() == TEAM_ZOMBIES ) or ( attacker:IsPlayer() and attacker == ent ) ) ) then
-
+
if ent:Health() <= 50 then
-
+
ent:NoticeOnce( "Your health has dropped below 30%", GAMEMODE.Colors.Red, 5 )
ent:NoticeOnce( "Health doesn't regenerate when below 30%", GAMEMODE.Colors.Blue, 5, 2 )
-
+
end
-
+
if dmginfo:IsDamageType( DMG_BURN ) then
-
+
ent:ViewBounce( 30 )
-
+
else
-
+
ent:ViewBounce( 25 )
ent:RadioSound( VO_PAIN )
ent:DrawBlood()
-
+
end
-
+
if ent:GetPlayerClass() == CLASS_COMMANDO then
-
+
dmginfo:ScaleDamage( GetConVar( "sv_redead_dmg_scale" ):GetFloat() * 0.85 )
-
+
else
-
- dmginfo:ScaleDamage( GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
-
+
+ dmginfo:ScaleDamage( GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
+
end
-
+
if dmginfo:IsExplosionDamage() and attacker:Team() == TEAM_ZOMBIES then
-
+
dmginfo:ScaleDamage( 0 )
-
+
else
-
+
ent:AddStat( "Damage", math.Round( dmginfo:GetDamage() ) )
-
+
--[[if attacker:IsPlayer() then
-
+
attacker:AddZedDamage( math.Round( dmginfo:GetDamage() ) )
-
+
end]]
-
+
end
-
+
elseif ent:IsPlayer() and ent:Team() == TEAM_ZOMBIES and IsValid( attacker ) and attacker:IsPlayer() and dmginfo:GetDamage() > 30 then
-
+
sound.Play( table.Random( GAMEMODE.GoreBullet ), ent:GetPos() + Vector(0,0,50), 75, math.random( 90, 110 ), 0.8 )
-
+
end
-
+
return self.BaseClass:EntityTakeDamage( ent, dmginfo )
-
+
end
function GM:ScaleNPCDamage( npc, hitgroup, dmginfo ) // obsolete!
if hitgroup == HITGROUP_HEAD then
-
+
npc:EmitSound( "Player.DamageHeadShot" )
npc:SetHeadshotter( dmginfo:GetAttacker(), true )
-
+
local effectdata = EffectData()
effectdata:SetOrigin( dmginfo:GetDamagePosition() )
util.Effect( "headshot", effectdata, true, true )
-
- dmginfo:ScaleDamage( math.Rand( 2.50, 3.00 ) )
+
+ dmginfo:ScaleDamage( math.Rand( 2.50, 3.00 ) )
dmginfo:GetAttacker():NoticeOnce( "Headshot combos earn you more " .. GAMEMODE.CurrencyName .. "s", GAMEMODE.Colors.Blue, 5 )
dmginfo:GetAttacker():AddHeadshot()
-
+
elseif hitgroup == HITGROUP_CHEST then
-
- dmginfo:ScaleDamage( 1.25 )
-
+
+ dmginfo:ScaleDamage( 1.25 )
+
npc:SetHeadshotter( dmginfo:GetAttacker(), false )
dmginfo:GetAttacker():ResetHeadshots()
-
+
elseif hitgroup == HITGROUP_STOMACH then
-
- dmginfo:ScaleDamage( 0.75 )
-
+
+ dmginfo:ScaleDamage( 0.75 )
+
npc:SetHeadshotter( dmginfo:GetAttacker(), false )
dmginfo:GetAttacker():ResetHeadshots()
-
+
else
-
+
dmginfo:ScaleDamage( 0.50 )
-
+
npc:SetHeadshotter( dmginfo:GetAttacker(), false )
dmginfo:GetAttacker():ResetHeadshots()
-
+
end
-
+
return dmginfo
-end
+end
function GM:ScalePlayerDamage( ply, hitgroup, dmginfo )
if IsValid( ply.Stash ) then
-
+
return
-
+
end
if hitgroup == HITGROUP_HEAD then
-
+
ply:EmitSound( "Player.DamageHeadShot" )
ply:ViewBounce( 25 )
-
- dmginfo:ScaleDamage( 1.75 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
-
+
+ dmginfo:ScaleDamage( 1.75 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
+
return
-
+
elseif hitgroup == HITGROUP_CHEST then
-
+
ply:ViewBounce( 15 )
-
- dmginfo:ScaleDamage( 1.50 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
-
+
+ dmginfo:ScaleDamage( 1.50 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
+
return
-
+
elseif hitgroup == HITGROUP_STOMACH then
-
- dmginfo:ScaleDamage( 1.25 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
-
+
+ dmginfo:ScaleDamage( 1.25 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
+
else
-
+
dmginfo:ScaleDamage( 0.50 * GetConVar( "sv_redead_dmg_scale" ):GetFloat() )
-
+
end
-
+
ply:ViewBounce( ( dmginfo:GetDamage() / 20 ) * 10 )
-end
+end
function GM:PlayerShouldTakeDamage( ply, attacker )
if ply:Team() == TEAM_UNASSIGNED then return false end
-
+
if IsValid( attacker ) and attacker:IsPlayer() and attacker != ply then
-
- return ( ply:Team() != attacker:Team() or GetConVar( "sv_redead_team_dmg" ):GetBool() )
-
+
+ return ( ply:Team() != attacker:Team() or GetConVar( "sv_redead_team_dmg" ):GetBool() )
+
end
return true
-
+
end
function GM:OnDamagedByExplosion( ply, dmginfo )
if dmginfo:GetDamage() > 25 then
-
+
ply:SetBleeding( true )
-
+
end
ply:SetDSP( 35, false )
-
+
umsg.Start( "GrenadeHit", ply )
umsg.End()
-
+
end
function GM:PlayerDeathThink( ply )
if ply.NextSpawn and ply.NextSpawn > CurTime() then return end
-
+
if ply:KeyDown( IN_JUMP ) or ply:KeyDown( IN_ATTACK ) or ply:KeyDown( IN_ATTACK2 ) then
ply:Spawn()
-
+
end
-
+
end
function GM:DoPlayerDeath( ply, attacker, dmginfo )
@@ -1421,61 +1421,61 @@ function GM:DoPlayerDeath( ply, attacker, dmginfo )
ply:OnDeath()
if ply:Team() == TEAM_ARMY then
-
+
if team.NumPlayers( TEAM_ZOMBIES ) < 1 then
-
+
ply:AddStat( "Martyr" )
-
+
end
-
+
local music = table.Random( GAMEMODE.DeathMusic )
-
+
ply:ClientSound( music, 100 )
ply:RadioSound( VO_DEATH )
ply:SetTeam( TEAM_ZOMBIES )
-
+
if not GAMEMODE.LordExists and GAMEMODE.EarlyPick then
-
+
GAMEMODE:PickLord( true )
-
+
end
-
+
if IsValid( attacker ) and attacker:IsPlayer() and attacker != ply then
-
+
attacker:AddZedDamage( 50 )
-
+
end
-
+
elseif ply:Team() == TEAM_ZOMBIES then
if IsValid( attacker ) and attacker:IsPlayer() then
-
+
attacker:AddCash( GAMEMODE.PlayerZombieKillValue )
attacker:AddFrags( 1 )
-
+
end
-
+
if ply:IsLord() and ply:GetZedDamage() >= GAMEMODE.RedemptionDamage then
-
+
ply:SetTeam( TEAM_ARMY )
ply:Notice( "Prepare to respawn as a human", GAMEMODE.Colors.Blue, 5, 2 )
-
+
end
-
+
end
if dmginfo:IsExplosionDamage() then
-
+
ply:SetModel( table.Random( GAMEMODE.Corpses ) )
-
+
local ed = EffectData()
ed:SetOrigin( ply:GetPos() )
util.Effect( "gore_explosion", ed, true, true )
-
+
end
-
+
ply:CreateRagdoll()
-
+
end
function GM:SynchStats()
@@ -1484,12 +1484,12 @@ function GM:SynchStats()
net.WriteInt( table.Count( player.GetAll() ), 8 )
for k,v in pairs( player.GetAll() ) do
-
+
net.WriteEntity( v )
net.WriteTable( v:GetStats() )
-
+
end
-
+
net.Broadcast()
end
@@ -1500,38 +1500,38 @@ function GM:EndGame( winner )
SetGlobalBool( "GameOver", true )
SetGlobalInt( "WinningTeam", winner )
-
+
for k,v in pairs( player.GetAll() ) do
-
+
if winner == TEAM_ZOMBIES then
-
+
v:NoticeOnce( "The undead have overwhelmed " .. team.GetName( TEAM_ARMY ) , GAMEMODE.Colors.White, 7, 2 )
-
+
elseif team.NumPlayers( TEAM_ARMY ) > 0 then
-
+
v:NoticeOnce( team.GetName( TEAM_ARMY ) .. " has successfully evacuated", GAMEMODE.Colors.White, 7, 2 )
-
+
end
-
+
if v:Team() == winner and winner == TEAM_ARMY then
-
+
local music = table.Random( GAMEMODE.WinMusic )
-
+
v:ClientSound( music, 100 )
v:GodEnable()
-
+
else
-
+
local music = table.Random( GAMEMODE.LoseMusic )
-
+
v:ClientSound( music, 100 )
-
+
end
-
+
v:NoticeOnce( "Next map: " .. game.GetMapNext() , GAMEMODE.Colors.White, 7, 4 )
-
+
end
-
+
timer.Simple( GetConVar( "sv_redead_post_game_time" ):GetInt(), function() game.LoadNextMap() end )
end
@@ -1541,92 +1541,92 @@ function GM:CheckGameOver( canend )
if GetGlobalBool( "GameOver", false ) then return end
if team.NumPlayers( TEAM_ARMY ) < 1 and team.NumPlayers( TEAM_ZOMBIES ) > 0 then
-
+
GAMEMODE:EndGame( TEAM_ZOMBIES )
-
+
elseif GAMEMODE.Wave > #GAMEMODE.Waves and canend then
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
if not v:IsEvacuated() then
-
+
v:Notice( "The evac chopper left without you", GAMEMODE.Colors.Red, 5 )
v:SetTeam( TEAM_ZOMBIES )
-
+
end
-
+
end
-
+
GAMEMODE:EndGame( TEAM_ARMY )
-
+
end
end
function GM:ShowHelp( ply )
- ply:SendLua( "GAMEMODE:ShowHelp()" )
+ ply:SendLua( "GAMEMODE:ShowHelp()" )
end
function GM:ShowTeam( ply )
if ply:Team() == TEAM_ZOMBIES then
-
+
ply:SendLua( "GAMEMODE:ShowZombieClasses()" )
-
+
return
-
+
end
-
+
if not ply:Alive() then return end
-
+
if ply:IsIndoors() then
-
+
ply:Notice( "You cannot use your radio indoors", GAMEMODE.Colors.Red )
-
+
else
-
+
if ply:GetPlayerClass() == CLASS_SPECIALIST then
-
+
if IsValid( ply.Stash ) then
-
+
GAMEMODE.SpecialTrader:OnExit( ply )
-
+
else
-
+
if GAMEMODE.RadioBlock and GAMEMODE.RadioBlock > CurTime() then
-
+
ply:Notice( "Radio communications are offline", GAMEMODE.Colors.Red )
return
-
+
end
-
+
GAMEMODE.SpecialTrader:OnUsed( ply )
-
+
end
-
+
else
-
+
if IsValid( ply.Stash ) then
-
+
GAMEMODE.Trader:OnExit( ply )
-
+
else
-
+
if GAMEMODE.RadioBlock and GAMEMODE.RadioBlock > CurTime() then
-
+
ply:Notice( "Radio communications are offline", GAMEMODE.Colors.Red )
return
-
+
end
-
+
GAMEMODE.Trader:OnUsed( ply )
-
+
end
-
+
end
-
+
end
end
@@ -1646,7 +1646,7 @@ end
function GM:PanicButton( ply )
if ( ply.Panic or 0 ) > CurTime() or ply:Team() == TEAM_ZOMBIES then return end
-
+
ply.Panic = CurTime() + 0.5
local panic = { { ply:IsBleeding(), { "Bandage" }, "bleeding" },
@@ -1657,29 +1657,29 @@ function GM:PanicButton( ply )
{ ply:GetStamina() < 100, { "Water" }, "fatigued" } }
for k,v in pairs( panic ) do
-
+
if v[1] then
-
+
for c,d in pairs( v[2] ) do
-
+
local tbl = item.GetByName( d )
-
+
if tbl and ply:HasItem( tbl.ID ) then
-
+
tbl.Functions[ 1 ]( ply, tbl.ID )
-
+
ply:Notice( "Panic button detected that you were " .. v[3], GAMEMODE.Colors.Blue )
-
+
return
end
-
+
end
-
+
end
-
+
end
-
+
ply:Notice( "Panic button did not detect any usable items", GAMEMODE.Colors.Red )
ply:ClientSound( "items/suitchargeno1.wav" )
@@ -1689,77 +1689,77 @@ function DropItem( ply, cmd, args )
local id = tonumber( args[1] )
local count = math.Clamp( tonumber( args[2] ), 1, 100 )
-
+
if not ply:HasItem( id ) then return end
-
+
local tbl = item.GetByID( id )
-
+
if count == 1 then
-
+
if ply:HasItem( id ) then
-
+
local makeprop = true
-
+
if tbl.DropFunction then
-
+
makeprop = tbl.DropFunction( ply, id, true )
-
+
end
-
+
if makeprop then
-
+
local prop = ents.Create( "prop_physics" )
prop:SetPos( ply:GetItemDropPos() )
prop:SetAngles( ply:GetAimVector():Angle() )
-
+
if tbl.DropModel then
-
+
prop:SetModel( tbl.DropModel )
-
+
else
-
+
prop:SetModel( tbl.Model )
-
+
end
-
+
prop:SetCollisionGroup( COLLISION_GROUP_WEAPON )
prop:Spawn()
prop.IsItem = true
prop.Removal = CurTime() + 5 * 60
-
+
end
-
+
ply:RemoveFromInventory( id, true )
ply:EmitSound( Sound( "items/ammopickup.wav" ) )
-
+
end
-
+
return
-
+
end
-
+
local itemcount = math.min( ply:GetItemCount( id ), count )
local loot = ents.Create( "sent_lootbag" )
-
+
for i=1, itemcount do
-
+
loot:AddItem( id )
-
+
end
-
+
loot:SetAngles( ply:GetAimVector():Angle() )
loot:SetPos( ply:GetItemDropPos() )
loot:SetRemoval( 60 * 5 )
loot:Spawn()
- //loot:SetUser( ply )
-
+ //loot:SetUser( ply )
+
ply:EmitSound( Sound( "items/ammopickup.wav" ) )
ply:RemoveMultipleFromInventory( loot:GetItems() )
-
+
if tbl.DropFunction then
-
+
tbl.DropFunction( ply, id )
-
+
end
end
@@ -1770,15 +1770,15 @@ function UseItem( ply, cmd, args )
local id = tonumber( args[1] )
local pos = tonumber( args[2] )
-
+
if ply:HasItem( id ) then
-
+
local tbl = item.GetByID( id )
-
+
if not tbl.Functions[pos] then return end
-
+
tbl.Functions[pos]( ply, id )
-
+
end
end
@@ -1789,38 +1789,38 @@ function TakeItem( ply, cmd, args )
local id = tonumber( args[1] )
local count = math.Clamp( tonumber( args[2] ), 1, 100 )
-
+
if not IsValid( ply.Stash ) or not table.HasValue( ply.Stash:GetItems(), id ) or string.find( ply.Stash:GetClass(), "npc" ) then return end
-
+
local tbl = item.GetByID( id )
-
+
if count == 1 then
-
+
ply:AddIDToInventory( id )
ply.Stash:RemoveItem( id )
-
+
return
-
+
end
-
+
local items = {}
-
+
if IsValid( ply.Stash ) then
-
+
for i=1, count do
-
+
if table.HasValue( ply.Stash:GetItems(), id ) then
-
+
table.insert( items, id )
ply.Stash:RemoveItem( id )
-
+
end
-
+
end
-
+
ply:AddMultipleToInventory( items )
ply:EmitSound( Sound( "items/itempickup.wav" ) )
-
+
end
end
@@ -1831,48 +1831,48 @@ function StoreItem( ply, cmd, args )
local id = tonumber( args[1] )
local count = math.Clamp( tonumber( args[2] ), 1, 100 )
-
+
if not IsValid( ply.Stash ) or not ply:HasItem( id ) then return end
-
+
local tbl = item.GetByID( id )
-
+
if count == 1 then
ply.Stash:AddItem( id )
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( Sound( "c4.disarmfinish" ) )
-
+
if tbl.DropFunction then
-
+
tbl.DropFunction( ply, id )
-
+
end
-
+
return
-
+
end
-
+
local items = {}
-
+
for i=1, count do
-
+
if ply:HasItem( id ) then
-
+
table.insert( items, id )
ply.Stash:AddItem( id )
-
+
end
-
+
end
-
+
ply:RemoveMultipleFromInventory( items )
ply:EmitSound( Sound( "c4.disarmfinish" ) )
-
+
if tbl.DropFunction then
-
+
tbl.DropFunction( ply, id )
-
+
end
end
@@ -1884,9 +1884,9 @@ function SellbackItem( ply, cmd, args )
if not IsValid( ply ) then return end
local id = tonumber( args[1] )
-
+
if not table.HasValue( ply:GetShipment(), id ) then return end
-
+
local tbl = item.GetByID( id )
ply:AddCash( tbl.Price )
@@ -1908,49 +1908,49 @@ function BuyItem( ply, cmd, args )
local id = tonumber( args[1] )
local count = tonumber( args[2] )
-
+
if not IsValid( ply.Stash ) or not ply.Stash:GetClass() == "info_trader" or not table.HasValue( ply.Stash:GetItems(), id ) or count < 0 then return end
-
+
local tbl = item.GetByID( id )
-
- if tbl.Price > ply:GetCash() then
-
- return
-
- end
-
+
+ if tbl.Price > ply:GetCash() then
+
+ return
+
+ end
+
if tbl.Price > ply:GetStat( "Pricey" ) then
-
+
ply:SetStat( "Pricey", tbl.Price )
-
+
end
-
+
if count == 1 then
-
+
ply:AddToShipment( { id } )
ply:AddCash( -tbl.Price )
-
+
+ return
+
+ end
+
+ if ( tbl.Price * count ) > ply:GetCash() then
+
return
-
- end
-
- if ( tbl.Price * count ) > ply:GetCash() then
-
- return
-
- end
-
+
+ end
+
local items = {}
-
+
for i=1, count do
-
+
table.insert( items, id )
-
+
end
-
+
ply:AddToShipment( items )
ply:AddCash( -tbl.Price * count )
-
+
end
concommand.Add( "inv_buy", BuyItem )
@@ -1958,11 +1958,11 @@ concommand.Add( "inv_buy", BuyItem )
function DropCash( ply, cmd, args )
local amt = tonumber( args[1] )
-
+
if amt > ply:GetCash() or amt < 5 then return end
-
+
ply:AddCash( -amt )
-
+
local money = ents.Create( "sent_cash" )
money:SetPos( ply:GetItemDropPos() )
money:Spawn()
@@ -1975,9 +1975,9 @@ concommand.Add( "cash_drop", DropCash )
function StashCash( ply, cmd, args )
local amt = tonumber( args[1] )
-
+
if not IsValid( ply.Stash ) or amt > ply:GetCash() or amt < 5 or string.find( ply.Stash:GetClass(), "npc" ) then return end
-
+
ply:AddCash( -amt )
ply:SynchCash( ply.Stash:GetCash() + amt )
ply.Stash:SetCash( ply.Stash:GetCash() + amt )
@@ -1989,9 +1989,9 @@ concommand.Add( "cash_stash", StashCash )
function TakeCash( ply, cmd, args )
local amt = tonumber( args[1] )
-
+
if not IsValid( ply.Stash ) or amt > ply.Stash:GetCash() or amt < 5 or string.find( ply.Stash:GetClass(), "npc" ) then return end
-
+
ply:AddCash( amt )
ply:SynchCash( ply.Stash:GetCash() - amt )
ply.Stash:SetCash( ply.Stash:GetCash() - amt )
@@ -2003,21 +2003,21 @@ concommand.Add( "cash_take", TakeCash )
function SetPlyClass( ply, cmd, args )
local class = tonumber( args[1] )
-
+
if not GAMEMODE.ClassLogos[ class ] then return end
-
+
if ply:Team() == TEAM_ARMY then return end
-
+
if ply:Team() == TEAM_ZOMBIES then
-
+
ply.NextClass = class
-
+
else
-
+
ply:SetPlayerClass( class )
-
+
end
-
+
end
concommand.Add( "changeclass", SetPlyClass )
@@ -2025,40 +2025,40 @@ concommand.Add( "changeclass", SetPlyClass )
function SaveGameItems( ply, cmd, args )
if ( !ply:IsAdmin() or !ply:IsSuperAdmin() ) then return end
-
+
GAMEMODE:SaveAllEnts()
-
+
end
concommand.Add( "sv_redead_save_map_config", SaveGameItems )
function MapSetupMode( ply, cmd, args )
- if not IsValid( ply ) then
-
+ if not IsValid( ply ) then
+
for k, ply in pairs( player.GetAll() ) do
-
+
if ply:IsAdmin() or ply:IsSuperAdmin() then
-
+
ply:Give( "rad_itemplacer" )
ply:Give( "rad_propplacer" )
ply:Give( "weapon_physgun" )
-
+
end
-
+
end
-
+
return
-
+
end
if ply:IsAdmin() or ply:IsSuperAdmin() then
-
+
ply:Give( "rad_itemplacer" )
ply:Give( "rad_propplacer" )
ply:Give( "weapon_physgun" )
ply:AddCash( 500 )
-
+
end
end
@@ -2068,15 +2068,15 @@ concommand.Add( "sv_redead_dev_mode", MapSetupMode )
function ItemListing( ply, cmd, args )
if IsValid( ply ) and ply:IsAdmin() then
-
+
local itemlist = item.GetList()
-
+
for k,v in pairs( itemlist ) do
-
+
print( v.ID .. ": " .. v.Name )
-
+
end
-
+
end
end
@@ -2086,16 +2086,16 @@ concommand.Add( "sv_redead_dev_itemlist", ItemListing )
function TestItem( ply, cmd, args )
if IsValid( ply ) and ply:IsAdmin() then
-
+
local id = tonumber( args[1] )
local tbl = item.GetByID( id )
-
+
if tbl then
-
+
ply:AddIDToInventory( id )
-
+
end
-
+
end
end
diff --git a/gamemode/items.lua b/gamemode/items.lua
index 7b3a057..f3d802c 100644
--- a/gamemode/items.lua
+++ b/gamemode/items.lua
@@ -5,15 +5,15 @@ local ItemTables = {}
local ID = 1
function Register( tbl )
-
+
tbl.Functions = tbl.Functions or {}
tbl.ID = ID
ItemTables[ ID ] = tbl
-
+
util.PrecacheModel( tbl.Model )
-
+
ID = ID + 1
-
+
end
function GetList()
@@ -25,37 +25,37 @@ end
function GetByID( id )
if not id then return end
-
+
if !ItemTables[ id ] then return end
return ItemTables[ id ]
-
+
end
function GetByModel( model )
-
+
for k,v in pairs( ItemTables ) do
-
+
if string.lower( v.Model ) == string.lower( model ) or ( v.DropModel and string.lower( v.DropModel ) == string.lower( model ) ) then
-
+
return v
-
+
end
-
+
end
end
function GetByClass( class )
-
+
for k,v in pairs( ItemTables ) do
-
+
if v.TypeOverride and string.lower( v.TypeOverride ) == string.lower( class ) then
-
+
return v
-
+
end
-
+
end
end
@@ -63,13 +63,13 @@ end
function GetByName( name )
for k,v in pairs( ItemTables ) do
-
+
if string.lower( v.Name ) == string.lower( name ) then
-
+
return v
-
+
end
-
+
end
end
@@ -77,17 +77,17 @@ end
function GetByType( itemtype )
local tbl = {}
-
+
for k,v in pairs( ItemTables ) do
-
+
if v.Type == itemtype then
-
+
table.insert( tbl, v )
-
+
end
-
+
end
-
+
return tbl
end
@@ -98,19 +98,13 @@ function RandomItem( itemtype )
local tbl = GetByType( itemtype )
local rand = table.Random( tbl )
-
+
while math.Rand(0,1) < rand.Rarity do
-
+
rand = table.Random( tbl )
-
+
end
return rand
end
-
-
-
-
-
-
diff --git a/gamemode/items/ammo.lua b/gamemode/items/ammo.lua
index a554382..cd90f8d 100644
--- a/gamemode/items/ammo.lua
+++ b/gamemode/items/ammo.lua
@@ -13,33 +13,33 @@ PRICE_ENERGYCELL = 8
function FUNC_AMMO( ply, id )
local tbl = item.GetByID( id )
-
+
if not tbl.Ammo then return true end
ply:AddAmmo( tbl.Ammo, tbl.Amount )
return true
-
+
end
function FUNC_DROPAMMO( ply, id, drop )
local tbl = item.GetByID( id )
-
+
if not tbl.Ammo then return end
ply:AddAmmo( tbl.Ammo, -tbl.Amount, true )
-
+
return true // we don't want to override spawning the prop
end
-item.Register( {
- Name = "Pistol Rounds",
+item.Register( {
+ Name = "Pistol Rounds",
Description = "40 pistol rounds per box.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 0.75,
+ Weight = 0.75,
Price = PRICE_PISTOL,
Rarity = 0.20,
Model = "models/items/357ammo.mdl",
@@ -48,15 +48,15 @@ item.Register( {
PickupFunction = FUNC_AMMO,
DropFunction = FUNC_DROPAMMO,
CamPos = Vector(14,13,4),
- CamOrigin = Vector(0,0,3)
+ CamOrigin = Vector(0,0,3)
} )
-item.Register( {
- Name = "Buckshot",
+item.Register( {
+ Name = "Buckshot",
Description = "20 shotgun rounds per box.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 0.75,
+ Weight = 0.75,
Price = PRICE_BUCKSHOT,
Rarity = 0.20,
Model = "models/items/boxbuckshot.mdl",
@@ -68,12 +68,12 @@ item.Register( {
CamOrigin = Vector(0,0,4)
} )
-item.Register( {
- Name = "SMG Rounds",
+item.Register( {
+ Name = "SMG Rounds",
Description = "60 SMG rounds per box.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 0.75,
+ Weight = 0.75,
Price = PRICE_SMGROUNDS,
Rarity = 0.50,
Model = "models/items/boxsrounds.mdl",
@@ -85,12 +85,12 @@ item.Register( {
CamOrigin = Vector(0,0,4)
} )
-item.Register( {
- Name = "Rifle Rounds",
+item.Register( {
+ Name = "Rifle Rounds",
Description = "60 automatic rifle rounds per box.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 0.75,
+ Weight = 0.75,
Price = PRICE_RIFLEROUNDS,
Rarity = 0.80,
Model = "models/items/boxmrounds.mdl",
@@ -102,12 +102,12 @@ item.Register( {
CamOrigin = Vector(0,0,5)
} )
-item.Register( {
- Name = "Sniper Rounds",
+item.Register( {
+ Name = "Sniper Rounds",
Description = "30 sniper rounds per box.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 0.75,
+ Weight = 0.75,
Price = PRICE_SNIPERROUNDS,
Rarity = 0.75,
Model = "models/items/boxqrounds.mdl",
@@ -119,12 +119,12 @@ item.Register( {
CamOrigin = Vector(4,0,-1)
} )
-item.Register( {
- Name = "Prototype Energy Cell",
+item.Register( {
+ Name = "Prototype Energy Cell",
Description = "15 energy charges per cell.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_AMMO,
- Weight = 1.25,
+ Weight = 1.25,
Price = PRICE_ENERGYCELL,
Rarity = 0.85,
Model = "models/items/battery.mdl",
@@ -133,6 +133,5 @@ item.Register( {
PickupFunction = FUNC_AMMO,
DropFunction = FUNC_DROPAMMO,
CamPos = Vector(15,15,8),
- CamOrigin = Vector(0,0,5)
+ CamOrigin = Vector(0,0,5)
} )
-
diff --git a/gamemode/items/misc.lua b/gamemode/items/misc.lua
index b15db67..dda95c4 100644
--- a/gamemode/items/misc.lua
+++ b/gamemode/items/misc.lua
@@ -23,7 +23,7 @@ function FUNC_EAT( ply, id, client, icon )
if icon then return "icon16/cake.png" end
if client then return "Eat" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "npc/barnacle/barnacle_crunch2.wav", 100, math.random( 90, 110 ) )
ply:AddHealth( 25 )
@@ -37,7 +37,7 @@ function FUNC_BOOZE( ply, id, client, icon )
if icon then return "icon16/drink.png" end
if client then return "Drink" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( table.Random{ "npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav" }, 100, math.random( 90, 110 ) )
ply:AddRadiation( -2 )
@@ -45,7 +45,7 @@ function FUNC_BOOZE( ply, id, client, icon )
ply:Notice( "+20 Stamina", GAMEMODE.Colors.Green )
ply:Notice( "-2 Radiation", GAMEMODE.Colors.Green )
ply:Notice( "+4 Intoxication", GAMEMODE.Colors.Red )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( 4 )
umsg.End()
@@ -56,13 +56,13 @@ function FUNC_MOONSHINE( ply, id, client, icon )
if icon then return "icon16/drink.png" end
if client then return "Drink" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( table.Random{ "npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav" }, 100, math.random( 90, 110 ) )
ply:AddRadiation( -1 )
ply:Notice( "-1 Radiation", GAMEMODE.Colors.Green )
ply:Notice( "+6 Intoxication", GAMEMODE.Colors.Red )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( 6 )
umsg.End()
@@ -73,13 +73,13 @@ function FUNC_BEER( ply, id, client, icon )
if icon then return "icon16/drink.png" end
if client then return "Drink" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( table.Random{ "npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav" }, 100, math.random( 90, 110 ) )
ply:AddStamina( 15 )
ply:Notice( "+15 Stamina", GAMEMODE.Colors.Green )
ply:Notice( "+2 Intoxication", GAMEMODE.Colors.Red )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( 2 )
umsg.End()
@@ -90,11 +90,11 @@ function FUNC_SPACEBEER( ply, id, client, icon )
if icon then return "icon16/drink.png" end
if client then return "Drink" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( table.Random{ "npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav" }, 100, math.random( 90, 110 ) )
ply:Notice( "+15 Intoxication", GAMEMODE.Colors.Red )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( 15 )
umsg.End()
@@ -105,109 +105,109 @@ function FUNC_UNMUTAGEN( ply, id, client, icon )
if icon then return "icon16/pill.png" end
if client then return "Inject" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "Weapon_SMG1.Special1" )
-
+
local tbl = {}
local inc = 0
-
+
for i=1,math.random(1,3) do
-
+
local rand = math.random(1,6)
-
+
while table.HasValue( tbl, rand ) do
-
+
rand = math.random(1,6)
-
+
end
-
+
table.insert( tbl, rand )
-
+
if rand == 1 then
-
+
ply:Notice( "You feel extremely nauseous", GAMEMODE.Colors.Red, 5, inc * 2 )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( 20 )
umsg.End()
-
+
elseif rand == 2 then
-
+
local rad = math.random(2,5)
-
+
if math.random(1,2) == 1 then
-
+
ply:Notice( "+" .. rad .. " Radiation", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:AddRadiation( rad )
-
+
else
-
+
ply:Notice( "-" .. rad .. " Radiation", GAMEMODE.Colors.Green, 5, inc * 2 )
ply:AddRadiation( -rad )
-
+
end
-
+
elseif rand == 3 then
-
+
if ply:IsInfected() then
-
+
ply:Notice( "Your infection has been cured", GAMEMODE.Colors.Green, 5, inc * 2 )
ply:SetInfected( false )
-
+
else
-
+
ply:Notice( "You were infected by the drug", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:SetInfected( true )
-
+
end
-
+
elseif rand == 4 then
-
+
if math.random(1,2) == 1 then
-
+
ply:Notice( "You feel exhausted", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:AddStamina( -50 )
-
+
else
-
+
ply:Notice( "+20 Stamina", GAMEMODE.Colors.Green, 5, inc * 2 )
ply:AddStamina( 20 )
-
+
end
-
+
elseif rand == 5 then
-
+
ply:Notice( "Your whole body aches", GAMEMODE.Colors.Red, 5, inc * 2 )
-
+
local dmg = math.random(1,5)
-
+
ply:AddHealth( dmg * -10 )
-
+
if math.random(1,20) == 1 then
-
+
local dietime = math.random( 30, 120 )
-
+
timer.Simple( dietime - 5, function() ply:Notice( "You feel a sharp pain in your chest", GAMEMODE.Colors.Red, 5 ) end )
timer.Simple( dietime, function() ply:Kill() end )
-
+
end
-
+
elseif rand == 6 then
-
+
ply:Notice( "Your legs begin to feel weak", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:SetWalkSpeed( GAMEMODE.WalkSpeed - 80 )
ply:SetRunSpeed( GAMEMODE.RunSpeed - 80 )
-
+
local legtime = math.random( 20, 60 )
-
+
timer.Simple( legtime - 5, function() if IsValid( ply ) and ply:Team() == TEAM_ARMY then ply:Notice( "Your legs start to feel better", GAMEMODE.Colors.Green, 5 ) end end )
timer.Simple( legtime, function() if IsValid( ply ) and ply:Team() == TEAM_ARMY then ply:SetWalkSpeed( GAMEMODE.WalkSpeed ) ply:SetRunSpeed( GAMEMODE.RunSpeed ) end end )
-
+
end
-
+
inc = inc + 1
-
+
end
end
@@ -216,7 +216,7 @@ function FUNC_WRENCH( ply, id, client, icon )
if icon then return "icon16/cake.png" end
if client then return "Eat" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "npc/barnacle/barnacle_crunch2.wav", 100, math.random( 90, 110 ) )
ply:EmitSound( "weapons/crowbar/crowbar_impact2.wav", 100, math.random( 90, 110 ) )
@@ -227,20 +227,20 @@ function FUNC_WRENCH( ply, id, client, icon )
end
function FUNC_OPENSUITCASE( ply, id )
-
+
ply:Notice( "You found some " .. GAMEMODE.CurrencyName .. "s", GAMEMODE.Colors.Green )
ply:EmitSound( Sound( "Chain.ImpactSoft" ) )
-
+
if math.random(1,10) == 1 then
-
+
ply:AddCash( math.random(5,50) )
-
+
else
-
+
ply:AddCash( math.random(2,10) )
-
+
end
-
+
return false
end
@@ -249,112 +249,112 @@ function FUNC_OPENBOX( ply, id )
local tbl = { ITEM_SUPPLY, ITEM_AMMO, ITEM_MISC, ITEM_SPECIAL, ITEM_WPN_COMMON, ITEM_WPN_SPECIAL }
local chancetbl = { 0.60, 0.20, 0.50, 0.20, 0.05, 0.03 }
-
+
local rnd = math.Rand(0,1)
- local choice = math.random( 1, table.Count( tbl ) )
-
+ local choice = math.random( 1, table.Count( tbl ) )
+
while rnd > chancetbl[ choice ] do
-
+
rnd = math.Rand(0,1)
- choice = math.random( 1, table.Count( tbl ) )
-
+ choice = math.random( 1, table.Count( tbl ) )
+
end
-
+
local rand = item.RandomItem( tbl[choice] )
-
+
ply:AddIDToInventory( rand.ID )
ply:EmitSound( "Cardboard.Break" )
-
+
return false
end
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box001a.mdl",
+ Model = "models/props_junk/cardboard_box001a.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box001b.mdl",
+ Model = "models/props_junk/cardboard_box001b.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box002a.mdl",
+ Model = "models/props_junk/cardboard_box002a.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box002b.mdl",
+ Model = "models/props_junk/cardboard_box002b.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box003a.mdl",
+ Model = "models/props_junk/cardboard_box003a.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Cardboard Box",
+item.Register( {
+ Name = "Cardboard Box",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.95,
- Model = "models/props_junk/cardboard_box003b.mdl",
+ Model = "models/props_junk/cardboard_box003b.mdl",
PickupFunction = FUNC_OPENBOX,
Functions = {}
} )
-item.Register( {
- Name = "Suitcase",
+item.Register( {
+ Name = "Suitcase",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.50,
- Model = "models/props_c17/suitcase_passenger_physics.mdl",
+ Model = "models/props_c17/suitcase_passenger_physics.mdl",
PickupFunction = FUNC_OPENSUITCASE,
Functions = {}
} )
-item.Register( {
- Name = "Briefcase",
+item.Register( {
+ Name = "Briefcase",
CollisionOverride = true,
Type = ITEM_LOOT,
Rarity = 0.50,
- Model = "models/props_c17/briefcase001a.mdl",
+ Model = "models/props_c17/briefcase001a.mdl",
PickupFunction = FUNC_OPENSUITCASE,
Functions = {}
} )
-item.Register( {
- Name = "Wood",
+item.Register( {
+ Name = "Wood",
Description = "Used in building barricades.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_MISC,
- Weight = 1.50,
+ Weight = 1.50,
Price = 15,
Rarity = 0.15,
Model = "models/props_debris/wood_chunk04a.mdl",
@@ -363,96 +363,96 @@ item.Register( {
CamOrigin = Vector(0,0,-1)
} )
-item.Register( {
- Name = "Water",
+item.Register( {
+ Name = "Water",
Description = "Restores 25 stamina and 10 health.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_MISC,
- Weight = 0.15,
+ Weight = 0.15,
Price = 3,
Rarity = 0.05,
Model = "models/props/cs_office/water_bottle.mdl",
Functions = { FUNC_DRINK },
CamPos = Vector(12,12,1),
- CamOrigin = Vector(0,0,0)
+ CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Canned Food",
+item.Register( {
+ Name = "Canned Food",
Description = "Restores 25 health and 10 stamina.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_MISC,
- Weight = 0.15,
+ Weight = 0.15,
Price = 3,
Rarity = 0.05,
Model = "models/props_junk/garbage_metalcan001a.mdl",
Functions = { FUNC_EAT },
CamPos = Vector(10,10,0),
- CamOrigin = Vector(0,0,0)
+ CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Wrench",
+item.Register( {
+ Name = "Wrench",
Description = "Why would you eat this?",
- Stackable = true,
+ Stackable = true,
Type = ITEM_LOOT,
- Weight = 0.15,
+ Weight = 0.15,
Price = 3,
Rarity = 0.99,
Model = "models/props_c17/tools_wrench01a.mdl",
Functions = { FUNC_WRENCH },
CamPos = Vector(0,0,29),
- CamOrigin = Vector(0,1,4)
+ CamOrigin = Vector(0,1,4)
} )
-item.Register( {
- Name = "Unstable Mutagen",
+item.Register( {
+ Name = "Unstable Mutagen",
Description = "Prototype drug which may cure the infection.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_LOOT,
- Weight = 0.30,
+ Weight = 0.30,
Price = 50,
Rarity = 0.95,
Model = "models/healthvial.mdl",
Functions = { FUNC_UNMUTAGEN },
CamPos = Vector(-16,0,8),
- CamOrigin = Vector(0,0,5)
+ CamOrigin = Vector(0,0,5)
} )
-item.Register( {
- Name = "Beer",
+item.Register( {
+ Name = "Beer",
Description = "Restores 15 stamina.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_LOOT,
- Weight = 0.30,
+ Weight = 0.30,
Price = 5,
Rarity = 0.30,
Model = "models/props_junk/glassbottle01a.mdl",
Functions = { FUNC_BEER },
CamPos = Vector(16,12,1),
- CamOrigin = Vector(0,0,0)
+ CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Tequila",
+item.Register( {
+ Name = "Tequila",
Description = "Don't drink this shit.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_LOOT,
- Weight = 0.30,
+ Weight = 0.30,
Price = 5,
Rarity = 0.85,
Model = "models/props_junk/glassjug01.mdl",
Functions = { FUNC_SPACEBEER },
CamPos = Vector(19,0,6),
- CamOrigin = Vector(0,0,5)
+ CamOrigin = Vector(0,0,5)
} )
-item.Register( {
- Name = "Vodka",
+item.Register( {
+ Name = "Vodka",
Description = "Releives radiation poisoning.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_MISC,
- Weight = 0.30,
+ Weight = 0.30,
Price = 10,
Rarity = 0.10,
Model = "models/props_junk/garbage_glassbottle002a.mdl",
@@ -461,86 +461,86 @@ item.Register( {
CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Moonshine Vodka",
+item.Register( {
+ Name = "Moonshine Vodka",
Description = "Weaker homebrewed vodka.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_BUYABLE,
- Weight = 0.30,
+ Weight = 0.30,
Price = 5,
Rarity = 0.25,
Model = "models/props_junk/garbage_glassbottle003a.mdl",
Functions = { FUNC_MOONSHINE },
CamPos = Vector(16,17,1),
- CamOrigin = Vector(0,0,-1)
+ CamOrigin = Vector(0,0,-1)
} )
---[[item.Register( {
- Name = "Human Skull",
+--[[item.Register( {
+ Name = "Human Skull",
Description = "This human skull looks pretty old. You decided to name it Murray.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_QUEST_ZOMBIE,
- Weight = 2.50,
+ Weight = 2.50,
Price = 1,
Rarity = 0.75,
Model = "models/gibs/hgibs.mdl",
Functions = { },
CamPos = Vector(15,10,0),
- CamOrigin = Vector(0,0,2)
+ CamOrigin = Vector(0,0,2)
} )
-item.Register( {
- Name = "Zombie Claw",
+item.Register( {
+ Name = "Zombie Claw",
Description = "This is the claw of a zombie.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_QUEST_ZOMBIE,
- Weight = 2.50,
+ Weight = 2.50,
Price = 1,
Rarity = 0.25,
Model = "models/gibs/antlion_gib_small_1.mdl",
Functions = { },
CamPos = Vector(10,15,5),
- CamOrigin = Vector(0,0,1)
+ CamOrigin = Vector(0,0,1)
} )
-item.Register( {
- Name = "Zombie Spine",
+item.Register( {
+ Name = "Zombie Spine",
Description = "This is the spine of a zombie.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_QUEST_ZOMBIE,
- Weight = 2.50,
+ Weight = 2.50,
Price = 1,
Rarity = 0.25,
Model = "models/gibs/HGIBS_spine.mdl",
Functions = { },
CamPos = Vector(15,15,5),
- CamOrigin = Vector(0,0,2)
+ CamOrigin = Vector(0,0,2)
} )
-item.Register( {
- Name = "Zombie Rib",
+item.Register( {
+ Name = "Zombie Rib",
Description = "This is the rib of a zombie.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_QUEST_ZOMBIE,
- Weight = 2.50,
+ Weight = 2.50,
Price = 1,
Rarity = 0.25,
Model = "models/gibs/HGIBS_rib.mdl",
Functions = { },
CamPos = Vector(10,15,3),
- CamOrigin = Vector(0,0,0)
+ CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Zombie Flesh",
+item.Register( {
+ Name = "Zombie Flesh",
Description = "This is a chunk of zombie flesh.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_QUEST_ZOMBIE,
- Weight = 2.50,
+ Weight = 2.50,
Price = 1,
Rarity = 0.25,
Model = "models/props_junk/watermelon01_chunk02a.mdl",
Functions = { },
CamPos = Vector(8,8,5),
- CamOrigin = Vector(0,0,2.5)
+ CamOrigin = Vector(0,0,2.5)
} )]]
diff --git a/gamemode/items/misc_explosive.lua b/gamemode/items/misc_explosive.lua
index 9584feb..eedfa44 100644
--- a/gamemode/items/misc_explosive.lua
+++ b/gamemode/items/misc_explosive.lua
@@ -5,10 +5,10 @@ function FUNC_OXYGEN( ply, id, client, icon )
if icon then return "icon16/arrow_turn_right.png" end
if client then return "Throw" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( Sound( "WeaponFrag.Throw" ) )
-
+
local oxy = ents.Create( "sent_oxygen" )
oxy:SetPos( ply:GetItemDropPos() )
oxy:SetAngles( ply:GetAimVector():Angle() )
@@ -18,7 +18,7 @@ end
function FUNC_DROPOXYGEN( ply, id, drop )
-
+
if not drop then return end
local oxy = ents.Create( "sent_oxygen" )
@@ -31,24 +31,24 @@ function FUNC_DROPOXYGEN( ply, id, drop )
end
-item.Register( {
- Name = "Liquid Oxygen",
+item.Register( {
+ Name = "Liquid Oxygen",
Description = "Highly explosive liquid oxygen.",
TypeOverride = "sent_oxygen",
- Stackable = true,
+ Stackable = true,
Type = ITEM_EXPLOSIVE,
- Weight = 1.50,
+ Weight = 1.50,
Price = 50,
Rarity = 0.95,
Model = "models/props_phx/misc/potato_launcher_explosive.mdl",
Functions = { FUNC_OXYGEN },
DropFunction = FUNC_DROPOXYGEN,
CamPos = Vector(24,0,8),
- CamOrigin = Vector(0,0,6)
+ CamOrigin = Vector(0,0,6)
} )
-item.Register( {
- Name = "Gasoline",
+item.Register( {
+ Name = "Gasoline",
TypeOverride = "sent_fuel_gas",
AllowPickup = true,
CollisionOverride = true,
@@ -58,8 +58,8 @@ item.Register( {
Functions = {}
} )
-item.Register( {
- Name = "Diesel Fuel",
+item.Register( {
+ Name = "Diesel Fuel",
TypeOverride = "sent_fuel_diesel",
AllowPickup = true,
CollisionOverride = true,
@@ -69,8 +69,8 @@ item.Register( {
Functions = {}
} )
-item.Register( {
- Name = "Propane Canister",
+item.Register( {
+ Name = "Propane Canister",
TypeOverride = "sent_propane_canister",
AllowPickup = true,
CollisionOverride = true,
@@ -80,8 +80,8 @@ item.Register( {
Functions = {}
} )
-item.Register( {
- Name = "Propane Tank",
+item.Register( {
+ Name = "Propane Tank",
TypeOverride = "sent_propane_tank",
AllowPickup = true,
CollisionOverride = true,
@@ -91,8 +91,8 @@ item.Register( {
Functions = {}
} )
-item.Register( {
- Name = "Radioactive Waste",
+item.Register( {
+ Name = "Radioactive Waste",
TypeOverride = "sent_barrel_radioactive",
AllowPickup = true,
CollisionOverride = true,
@@ -102,8 +102,8 @@ item.Register( {
Functions = {}
} )
-item.Register( {
- Name = "Toxic Waste",
+item.Register( {
+ Name = "Toxic Waste",
TypeOverride = "sent_barrel_biohazard",
AllowPickup = true,
CollisionOverride = true,
diff --git a/gamemode/items/special.lua b/gamemode/items/special.lua
index 8dbab7f..e398ef7 100644
--- a/gamemode/items/special.lua
+++ b/gamemode/items/special.lua
@@ -6,7 +6,7 @@ function FUNC_ANTIRAD( ply, id, client, icon )
if icon then return "icon16/pill.png" end
if client then return "Inject" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "Weapon_SMG1.Special1" )
ply:SetRadiation( 0 )
@@ -18,66 +18,66 @@ end
if icon then return "icon16/lightbulb.png" end
if client then return "Ignite" end
-
+
ply:RemoveFromInventory( id )
-
+
local prop = ents.Create( "sent_flare" )
prop:SetPos( ply:GetItemDropPos() )
prop:Spawn()
end]]
-item.Register( {
- Name = "Anti-Rad",
+item.Register( {
+ Name = "Anti-Rad",
Description = "Releives all radiation poisoning.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SPECIAL,
- Weight = 0.15,
+ Weight = 0.15,
Price = 10,
Rarity = 0.20,
Model = "models/props_lab/jar01b.mdl",
Functions = { FUNC_ANTIRAD },
CamPos = Vector(-17,-9,0),
- CamOrigin = Vector(0,0,-1)
+ CamOrigin = Vector(0,0,-1)
} )
-item.Register( {
- Name = "Respirator",
+item.Register( {
+ Name = "Respirator",
Description = "Filters out chemicals and radiation.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SPECIAL,
- Weight = 1.75,
+ Weight = 1.75,
Price = 40,
Rarity = 0.95,
Model = "models/items/combine_rifle_cartridge01.mdl",
CamPos = Vector(13,-14,0),
- CamOrigin = Vector(0,0,-1)
+ CamOrigin = Vector(0,0,-1)
} )
---[[item.Register( {
- Name = "Sonar Module",
+--[[item.Register( {
+ Name = "Sonar Module",
Description = "Improves your radar detection range.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SPECIAL,
- Weight = 0.75,
+ Weight = 0.75,
Price = 30,
Rarity = 0.90,
Model = "models/gibs/shield_scanner_gib1.mdl",
Functions = {},
CamPos = Vector(2,-9,7),
- CamOrigin = Vector(0,1,-1)
+ CamOrigin = Vector(0,1,-1)
} )
-item.Register( {
- Name = "Flare",
+item.Register( {
+ Name = "Flare",
Description = "Emits a bright red light.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SPECIAL,
- Weight = 0.35,
+ Weight = 0.35,
Price = 3,
Rarity = 0.10,
Model = "models/props_c17/trappropeller_lever.mdl",
Functions = { FUNC_FLARE },
CamPos = Vector(15,6,5),
- CamOrigin = Vector(0,0,0)
-} )]] \ No newline at end of file
+ CamOrigin = Vector(0,0,0)
+} )]]
diff --git a/gamemode/items/supplies.lua b/gamemode/items/supplies.lua
index 122c6a5..bc74a86 100644
--- a/gamemode/items/supplies.lua
+++ b/gamemode/items/supplies.lua
@@ -6,7 +6,7 @@ function FUNC_ENERGY( ply, id, client, icon )
if icon then return "icon16/cup.png" end
if client then return "Drink" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( table.Random{ "npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav" }, 100, math.random( 90, 110 ) )
ply:AddStamina( 50 )
@@ -18,7 +18,7 @@ function FUNC_HEAL( ply, id, client, icon )
if icon then return "icon16/heart.png" end
if client then return "Use" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "HealthVial.Touch" )
ply:AddHealth( 75 )
@@ -30,7 +30,7 @@ function FUNC_SUPERHEAL( ply, id, client, icon )
if icon then return "icon16/heart.png" end
if client then return "Use" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "HealthVial.Touch" )
ply:AddHealth( 150 )
@@ -42,7 +42,7 @@ function FUNC_BANDAGE( ply, id, client, icon )
if icon then return "icon16/heart.png" end
if client then return "Use" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "Cardboard.Strain" )
ply:SetBleeding( false )
@@ -56,131 +56,131 @@ function FUNC_MUTAGEN( ply, id, client, icon )
if icon then return "icon16/pill.png" end
if client then return "Inject" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "Weapon_SMG1.Special1" )
-
+
if ply:IsInfected() then
-
+
ply:Notice( "Your infection has been cured", GAMEMODE.Colors.Green, 5, 0 )
ply:SetInfected( false )
-
+
end
-
+
local tbl = {}
local inc = 0
-
+
for i=1,math.random(1,3) do
-
+
local rand = math.random(1,5)
-
+
while table.HasValue( tbl, rand ) do
-
+
rand = math.random(1,5)
-
+
end
-
+
table.insert( tbl, rand )
-
+
if rand == 1 then
-
+
ply:Notice( "You feel extremely nauseous", GAMEMODE.Colors.Red, 5, inc * 2 )
-
+
umsg.Start( "Drunk", ply )
umsg.Short( math.random( 10, 20 ) )
umsg.End()
-
+
elseif rand == 2 then
-
+
local rad = math.random(2,5)
-
+
if math.random(1,2) == 1 and ply:GetRadiation() < 1 then
-
+
ply:Notice( "+" .. rad .. " Radiation", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:AddRadiation( rad )
-
+
else
-
+
ply:Notice( "-" .. rad .. " Radiation", GAMEMODE.Colors.Green, 5, inc * 2 )
ply:AddRadiation( -rad )
-
+
end
-
+
elseif rand == 3 then
-
+
ply:Notice( "Your whole body aches", GAMEMODE.Colors.Red, 5, inc * 2 )
-
+
local dmg = math.random(2,5)
-
+
ply:AddHealth( dmg * -10 )
-
+
elseif rand == 4 then
-
+
if math.random(1,2) == 1 then
-
+
ply:Notice( "You feel exhausted", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:AddStamina( -50 )
-
+
else
-
+
ply:Notice( "+20 Stamina", GAMEMODE.Colors.Green, 5, inc * 2 )
ply:AddStamina( 20 )
-
+
end
-
+
elseif rand == 5 then
-
+
ply:Notice( "Your legs begin to feel weak", GAMEMODE.Colors.Red, 5, inc * 2 )
ply:SetWalkSpeed( GAMEMODE.WalkSpeed - 80 )
ply:SetRunSpeed( GAMEMODE.RunSpeed - 80 )
-
+
local legtime = math.random( 20, 40 )
-
+
timer.Simple( legtime - 5, function() if IsValid( ply ) and ply:Team() == TEAM_ARMY then ply:Notice( "Your legs start to feel better", GAMEMODE.Colors.Green, 5 ) end end )
timer.Simple( legtime, function() if IsValid( ply ) and ply:Team() == TEAM_ARMY then ply:SetWalkSpeed( GAMEMODE.WalkSpeed ) ply:SetRunSpeed( GAMEMODE.RunSpeed ) end end )
-
+
end
-
+
inc = inc + 1
-
+
end
end
-item.Register( {
- Name = "Energy Drink",
+item.Register( {
+ Name = "Energy Drink",
Description = "Restores 50 stamina.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SUPPLY,
- Weight = 0.25,
+ Weight = 0.25,
Price = 5,
Rarity = 0.25,
Model = "models/props_junk/popcan01a.mdl",
Functions = { FUNC_ENERGY },
CamPos = Vector(10,10,0),
- CamOrigin = Vector(0,0,0)
+ CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "Basic Medikit",
+item.Register( {
+ Name = "Basic Medikit",
Description = "Restores 50% of your health.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SUPPLY,
- Weight = 1.25,
+ Weight = 1.25,
Price = 10,
Rarity = 0.65,
Model = "models/radbox/healthpack.mdl",
Functions = { FUNC_HEAL },
CamPos = Vector(23,8,3),
- CamOrigin = Vector(0,0,-1)
+ CamOrigin = Vector(0,0,-1)
} )
-item.Register( {
- Name = "Advanced Medikit",
+item.Register( {
+ Name = "Advanced Medikit",
Description = "Restores 100% of your health.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SUPPLY,
- Weight = 1.25,
+ Weight = 1.25,
Price = 20,
Rarity = 0.85,
Model = "models/radbox/healthpack2.mdl",
@@ -189,12 +189,12 @@ item.Register( {
CamOrigin = Vector(0,0,-1)
} )
-item.Register( {
- Name = "Alpha Mutagen",
+item.Register( {
+ Name = "Alpha Mutagen",
Description = "Prototype drug which cures the infection.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SUPPLY,
- Weight = 1.25,
+ Weight = 1.25,
Price = 50,
Rarity = 0.95,
Model = "models/items/healthkit.mdl",
@@ -203,12 +203,12 @@ item.Register( {
CamOrigin = Vector(4,0,0)
} )
-item.Register( {
- Name = "Bandage",
+item.Register( {
+ Name = "Bandage",
Description = "Stops all bleeding.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_SUPPLY,
- Weight = 0.35,
+ Weight = 0.35,
Price = 5,
Rarity = 0.50,
Model = "models/radbox/bandage.mdl",
@@ -216,4 +216,3 @@ item.Register( {
CamPos = Vector(18,10,5),
CamOrigin = Vector(0,0,0)
} )
-
diff --git a/gamemode/items/weapons_common.lua b/gamemode/items/weapons_common.lua
index a32f498..11febb3 100644
--- a/gamemode/items/weapons_common.lua
+++ b/gamemode/items/weapons_common.lua
@@ -6,31 +6,31 @@ function FUNC_DROPWEAPON( ply, id, client, icon )
if icon then return "icon16/arrow_down.png" end
if client then return "Drop" end
-
+
local tbl = item.GetByID( id )
-
+
local prop = ents.Create( "sent_droppedgun" )
prop:SetPos( ply:GetItemDropPos() )
-
+
if tbl.DropModel then
-
+
prop:SetModel( tbl.DropModel )
-
+
else
-
+
prop:SetModel( tbl.Model )
-
+
end
-
+
prop:Spawn()
-
+
ply:EmitSound( Sound( "items/ammopickup.wav" ) )
ply:RemoveFromInventory( id )
-
+
if not ply:HasItem( id ) then
-
+
ply:StripWeapon( tbl.Weapon )
-
+
end
end
@@ -38,11 +38,11 @@ end
function FUNC_REMOVEWEAPON( ply, id )
local tbl = item.GetByID( id )
-
+
if not ply:HasItem( id ) then
-
+
ply:StripWeapon( tbl.Weapon )
-
+
end
end
@@ -50,20 +50,20 @@ end
function FUNC_GRABWEAPON( ply, id )
local tbl = item.GetByID( id )
-
+
ply:Give( tbl.Weapon )
-
+
return true
end
-item.Register( {
- Name = "Hammer",
+item.Register( {
+ Name = "Hammer",
Description = "Builds barricades and bashes skulls.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 3,
+ Weight = 3,
Price = 35,
Rarity = 0.40,
Model = "models/weapons/w_hammer.mdl",
@@ -75,13 +75,13 @@ item.Register( {
CamOrigin = Vector(0,0,5)
} )
-item.Register( {
- Name = "Axe",
+item.Register( {
+ Name = "Axe",
Description = "The messiest melee weapon.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 5,
+ Weight = 5,
Price = 50,
Rarity = 0.60,
Model = "models/weapons/w_axe.mdl",
@@ -93,14 +93,14 @@ item.Register( {
CamOrigin = Vector(0,0,8)
} )
-item.Register( {
- Name = "Crowbar",
+item.Register( {
+ Name = "Crowbar",
Description = "Gordon's weapon of choice.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
SaleOverride = true,
- Weight = 5,
+ Weight = 5,
Price = 50,
Rarity = 0.20,
Model = "models/weapons/w_crowbar.mdl",
@@ -112,14 +112,14 @@ item.Register( {
CamOrigin = Vector(0,0,8)
} )
-item.Register( {
- Name = "FN Five-Seven",
+item.Register( {
+ Name = "FN Five-Seven",
Description = "A standard issue sidearm.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
SaleOverride = true,
- Weight = 3,
+ Weight = 3,
Price = 8,
Rarity = 0.90,
Model = "models/weapons/w_pist_fiveseven.mdl",
@@ -131,14 +131,14 @@ item.Register( {
CamOrigin = Vector(2,0,3)
} )
-item.Register( {
- Name = "USP Compact",
+item.Register( {
+ Name = "USP Compact",
Description = "A standard issue sidearm.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
SaleOverride = true,
- Weight = 3,
+ Weight = 3,
Price = 8,
Rarity = 0.90,
Model = "models/weapons/w_pistol.mdl",
@@ -150,14 +150,14 @@ item.Register( {
CamOrigin = Vector(-1,0,-2)
} )
-item.Register( {
- Name = "P228 Compact",
+item.Register( {
+ Name = "P228 Compact",
Description = "A standard issue sidearm.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
SaleOverride = true,
- Weight = 3,
+ Weight = 3,
Price = 8,
Rarity = 0.90,
Model = "models/weapons/w_pist_p228.mdl",
@@ -169,14 +169,14 @@ item.Register( {
CamOrigin = Vector(2,0,3)
} )
-item.Register( {
- Name = "Glock 19",
+item.Register( {
+ Name = "Glock 19",
Description = "A standard issue sidearm.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
SaleOverride = true,
- Weight = 3,
+ Weight = 3,
Price = 8,
Rarity = 0.90,
Model = "models/weapons/w_pist_glock18.mdl",
@@ -188,13 +188,13 @@ item.Register( {
CamOrigin = Vector(2,0,3)
} )
-item.Register( {
- Name = "Dual Berettas",
+item.Register( {
+ Name = "Dual Berettas",
Description = "A gun for each hand.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 3,
+ Weight = 3,
Price = 35,
Rarity = 0.20,
Model = "models/weapons/w_pist_elite_single.mdl",
@@ -207,13 +207,13 @@ item.Register( {
CamOrigin = Vector(2,0,3)
} )
-item.Register( {
- Name = "Colt Python",
+item.Register( {
+ Name = "Colt Python",
Description = "A six shooter that packs a punch.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 40,
Rarity = 0.20,
Model = "models/weapons/w_357.mdl",
@@ -225,13 +225,13 @@ item.Register( {
CamOrigin = Vector(6,0,0)
} )
-item.Register( {
- Name = "Desert Eagle",
+item.Register( {
+ Name = "Desert Eagle",
Description = "What are you compensating for?",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 45,
Rarity = 0.20,
Model = "models/weapons/w_pist_deagle.mdl",
@@ -243,13 +243,13 @@ item.Register( {
CamOrigin = Vector(3,0,4)
} )
-item.Register( {
- Name = "MAC-10",
+item.Register( {
+ Name = "MAC-10",
Description = "A compact SMG with moderate recoil.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 50,
Rarity = 0.20,
Model = "models/weapons/w_smg_mac10.mdl",
@@ -261,13 +261,13 @@ item.Register( {
CamOrigin = Vector(2,0,3)
} )
-item.Register( {
- Name = "UMP45",
+item.Register( {
+ Name = "UMP45",
Description = "A powerful SMG with a smaller magazine.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 6,
+ Weight = 6,
Price = 55,
Rarity = 0.30,
Model = "models/weapons/w_smg_ump45.mdl",
@@ -279,13 +279,13 @@ item.Register( {
CamOrigin = Vector(-2,0,4)
} )
-item.Register( {
- Name = "CMP250",
+item.Register( {
+ Name = "CMP250",
Description = "A prototype burst-fire SMG.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 60,
Rarity = 0.30,
Model = "models/weapons/w_smg1.mdl",
@@ -297,13 +297,13 @@ item.Register( {
CamOrigin = Vector(-1,0,-1)
} )
-item.Register( {
- Name = "Winchester 1887",
+item.Register( {
+ Name = "Winchester 1887",
Description = "Zombies are in season.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 6,
+ Weight = 6,
Price = 65,
Rarity = 0.30,
Model = "models/weapons/w_annabelle.mdl",
@@ -315,13 +315,13 @@ item.Register( {
CamOrigin = Vector(3,0,1)
} )
-item.Register( {
- Name = "TMP",
+item.Register( {
+ Name = "TMP",
Description = "A silent but deadly SMG.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 70,
Rarity = 0.40,
Model = "models/weapons/w_smg_tmp.mdl",
@@ -333,13 +333,13 @@ item.Register( {
CamOrigin = Vector(5,0,3)
} )
-item.Register( {
- Name = "MP5",
+item.Register( {
+ Name = "MP5",
Description = "A well-rounded, reliable SMG.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 6,
+ Weight = 6,
Price = 75,
Rarity = 0.40,
Model = "models/weapons/w_smg_mp5.mdl",
@@ -351,13 +351,13 @@ item.Register( {
CamOrigin = Vector(2,0,5)
} )
-item.Register( {
- Name = "FAMAS",
+item.Register( {
+ Name = "FAMAS",
Description = "The least expensive assault rifle.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 80,
Rarity = 0.50,
Model = "models/weapons/w_rif_famas.mdl",
@@ -369,13 +369,13 @@ item.Register( {
CamOrigin = Vector(-6,0,5)
} )
-item.Register( {
- Name = "FN P90",
+item.Register( {
+ Name = "FN P90",
Description = "A powerful SMG with a large magazine.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 4,
+ Weight = 4,
Price = 85,
Rarity = 0.50,
Model = "models/weapons/w_smg_p90.mdl",
@@ -387,13 +387,13 @@ item.Register( {
CamOrigin = Vector(1,0,5)
} )
-item.Register( {
- Name = "Steyr Scout",
+item.Register( {
+ Name = "Steyr Scout",
Description = "A bolt-action sniper rifle.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 90,
Rarity = 0.60,
Model = "models/weapons/w_snip_scout.mdl",
@@ -405,13 +405,13 @@ item.Register( {
CamOrigin = Vector(0,0,4)
} )
-item.Register( {
- Name = "IMI Galil",
+item.Register( {
+ Name = "IMI Galil",
Description = "Lower accuracy, larger magazine.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 8,
+ Weight = 8,
Price = 100,
Rarity = 0.60,
Model = "models/weapons/w_rif_galil.mdl",
@@ -423,13 +423,13 @@ item.Register( {
CamOrigin = Vector(-1,0,3)
} )
-item.Register( {
- Name = "SPAS-12",
+item.Register( {
+ Name = "SPAS-12",
Description = "Useful for crowd control.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 7,
+ Weight = 7,
Price = 110,
Rarity = 0.70,
Model = "models/weapons/w_shotgun.mdl",
@@ -441,13 +441,13 @@ item.Register( {
CamOrigin = Vector(0,0,0)
} )
-item.Register( {
- Name = "AK-47",
+item.Register( {
+ Name = "AK-47",
Description = "A well-rounded assault rifle.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 7,
+ Weight = 7,
Price = 130,
Rarity = 0.80,
Model = "models/weapons/w_rif_ak47.mdl",
@@ -459,13 +459,13 @@ item.Register( {
CamOrigin = Vector(0,0,3)
} )
-item.Register( {
- Name = "SG 552",
+item.Register( {
+ Name = "SG 552",
Description = "Comes with a free scope.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 8,
+ Weight = 8,
Price = 150,
Rarity = 0.90,
Model = "models/weapons/w_rif_sg552.mdl",
@@ -477,13 +477,13 @@ item.Register( {
CamOrigin = Vector(-4,0,5)
} )
-item.Register( {
- Name = "G3 SG1",
+item.Register( {
+ Name = "G3 SG1",
Description = "An automatic sniper rifle.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 170,
Rarity = 0.90,
Model = "models/weapons/w_snip_g3sg1.mdl",
@@ -495,13 +495,13 @@ item.Register( {
CamOrigin = Vector(-3,0,5)
} )
-item.Register( {
- Name = "HEAT Cannon",
+item.Register( {
+ Name = "HEAT Cannon",
Description = "An experimental long range zombie cooker.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 190,
Rarity = 0.70,
Model = "models/weapons/w_physics.mdl",
@@ -513,13 +513,13 @@ item.Register( {
CamOrigin = Vector(10,0,-1)
} )
-item.Register( {
- Name = "PPW-952",
+item.Register( {
+ Name = "PPW-952",
Description = "An experimental particle projectile weapon.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_COMMON,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 200,
Rarity = 0.70,
Model = "models/weapons/w_irifle.mdl",
diff --git a/gamemode/items/weapons_special.lua b/gamemode/items/weapons_special.lua
index 3d9a6c3..5f4b1b5 100644
--- a/gamemode/items/weapons_special.lua
+++ b/gamemode/items/weapons_special.lua
@@ -5,16 +5,16 @@ ITEM_WPN_SPECIAL = 10
--[[function FUNC_PLANTBOMB( ply, id, client )
if client then return "Arm" end
-
+
ply:RemoveFromInventory( id )
ply:EmitSound( "weapons/c4/c4_plant.wav" )
-
+
local trace = {}
trace.start = ply:GetShootPos()
trace.endpos = ply:GetShootPos() + ply:GetAimVector() * 50
trace.filter = ply
local tr = util.TraceLine( trace )
-
+
local bomb = ents.Create( "sent_c4" )
bomb:SetPos( tr.HitPos )
bomb:SetOwner( ply )
@@ -22,13 +22,13 @@ ITEM_WPN_SPECIAL = 10
end]]
-item.Register( {
- Name = "M1014",
+item.Register( {
+ Name = "M1014",
Description = "Turn everything into ground beef.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 7,
+ Weight = 7,
Price = 160,
Rarity = 0.90,
Model = "models/weapons/w_shot_xm1014.mdl",
@@ -40,13 +40,13 @@ item.Register( {
CamOrigin = Vector(1,0,4)
} )
-item.Register( {
- Name = "M249",
+item.Register( {
+ Name = "M249",
Description = "A belt-fed support machine gun.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 10,
+ Weight = 10,
Price = 180,
Rarity = 0.90,
Model = "models/weapons/w_mach_m249para.mdl",
@@ -58,13 +58,13 @@ item.Register( {
CamOrigin = Vector(2,0,6)
} )
-item.Register( {
- Name = "AWP",
+item.Register( {
+ Name = "AWP",
Description = "The very definition of overkill.",
- Stackable = false,
+ Stackable = false,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 9,
+ Weight = 9,
Price = 200,
Rarity = 0.70,
Model = "models/weapons/w_snip_awp.mdl",
@@ -76,13 +76,13 @@ item.Register( {
CamOrigin = Vector(1,0,4)
} )
-item.Register( {
- Name = "HE Grenade",
+item.Register( {
+ Name = "HE Grenade",
Description = "The fuse lasts 3 seconds.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 1,
+ Weight = 1,
Price = 5,
Rarity = 0.20,
Model = "models/weapons/w_eq_fraggrenade_thrown.mdl",
@@ -94,13 +94,13 @@ item.Register( {
CamOrigin = Vector(0,0,1)
} )
-item.Register( {
- Name = "Incendiary Grenade",
+item.Register( {
+ Name = "Incendiary Grenade",
Description = "Comes with free marshmallows.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 1,
+ Weight = 1,
Price = 8,
Rarity = 0.40,
Model = "models/weapons/w_eq_flashbang.mdl",
@@ -112,17 +112,17 @@ item.Register( {
CamOrigin = Vector(0,0,5)
} )
---[[item.Register( {
- Name = "Timed Explosives",
+--[[item.Register( {
+ Name = "Timed Explosives",
Description = "This is a homemade timed explosive.",
- Stackable = true,
+ Stackable = true,
Type = ITEM_WPN_SPECIAL,
TypeOverride = "sent_droppedgun",
- Weight = 3,
+ Weight = 3,
Price = 10,
Rarity = 0.80,
Model = "models/weapons/w_c4.mdl",
Functions = { FUNC_PLANTBOMB },
CamPos = Vector(-12,-2,0),
CamOrigin = Vector(0,5,0)
-} )]] \ No newline at end of file
+} )]]
diff --git a/gamemode/map_defaults.lua b/gamemode/map_defaults.lua
index dc5bbf1..4d344f8 100644
--- a/gamemode/map_defaults.lua
+++ b/gamemode/map_defaults.lua
@@ -3,8 +3,8 @@
local maps = { "redead/rd_apartmentcomplex_json.txt",
"redead/zombiesurvival_b5_json.txt" }
-
-local data = {
+
+local data = {
[[{"info_lootspawn":{"1":"[728.2679 1204.6923 150.0313]","2":"[1144.7465 1178.7068 150.0313]","3":"[1505.1332 1130.7913 189.961]","4":"[1502.6437 826.1514 150.0313]","5":"[1310.3285 792.6308 150.0313]","6":"[941.4187 1122.0729 189.9808]","7":"[957.3593 832.7668 150.0313]","8":"[631.056 1110.2343 150.0313]","9":"[1315.9518 418.904 150.0313]","10":"[1207.6248 732.3971 150.0313]","11":"[981.574 744.1642 197.0781]","12":"[966.4352 431.9167 150.0313]","13":"[632.3114 217.6249 150.0313]","14":"[941.1967 -184.439 150.0313]","15":"[878.8295 180.3319 150.0313]","16":"[730.5721 -318.0413 150.0313]","17":"[743.6882 -740.4319 150.0313]","18":"[862.9421 -403.1872 150.0313]","19":"[1229.7266 -412.9471 150.0313]","20":"[1515.2794 -695.6165 150.0313]","21":"[1307.6687 -1115.9705 150.0313]","22":"[1503.6578 -793.3757 189.9749]","23":"[1132.3955 -1243.422 150.0313]","24":"[658.6079 -1228.7908 150.0313]","25":"[750.4007 -1121.0291 6.0313]","26":"[931.1493 -791.7018 45.9711]","27":"[947.8159 -709.5466 6.0313]","28":"[846.0848 -699.3538 6.0313]","29":"[1429.4917 -406.2503 6.0313]","30":"[1205.5308 -398.5325 6.0313]","31":"[813.7065 -412.2303 6.0313]","32":"[1016.3391 -367.6704 6.0313]","33":"[1483.894 -368.5908 150.0313]","34":"[874.3385 -61.6505 53.0313]","35":"[874.824 118.9456 53.0313]","36":"[903.7451 29.1854 6.0313]","37":"[756.9775 410.2665 6.0313]","38":"[1011.6741 406.0877 6.0313]","39":"[1536.3606 463.0686 6.0313]","40":"[1345.6189 749.3622 6.0313]","41":"[612.7742 403.4674 6.0313]","42":"[1021.6572 1104.1167 6.0313]","43":"[871.48 788.5372 6.0313]","44":"[907.0815 891.8474 6.0313]","45":"[1150.6467 -1163.4579 6.0313]","46":"[-1428.3389 -975.6552 109.0106]","47":"[-1423.7222 -918.0593 109.0105]","48":"[-1438.9113 -1123.002 108.9811]","49":"[-1289.6064 -1206.7279 70.0313]","50":"[-1103.8529 -1194.277 70.0313]","51":"[-1379.9244 -690.3006 104.0313]","52":"[-1374.4518 -591.9827 104.0313]","53":"[-1043.8094 -525.6351 103.8351]","54":"[-1477.3882 -551.8082 69.0313]","55":"[-1121.1296 -424.2845 101.0313]","56":"[-1392.5243 -11.1805 70.0313]","57":"[-1473.1445 -73.4212 116.078]","58":"[-881.5622 -180.8376 70.0313]","59":"[-888.7677 345.2978 70.0313]","60":"[-1149.3009 -170.9552 232.0486]","61":"[-1081.3892 352.8701 238.5686]","62":"[-942.4716 85.5578 201.0313]","63":"[-835.507 148.3815 69.0313]","64":"[-1169.558 406.1492 69.0313]","65":"[-1587.4739 351.5022 101.0313]","66":"[-1591.588 -180.1971 101.0313]","67":"[-1440.9125 875.4196 101.0313]","68":"[-1319.675 754.0405 108.9794]","69":"[-1240.9662 865.8846 70.0313]","70":"[-870.9526 1164.9552 70.0313]","71":"[-920.0687 851.8335 236.2341]","72":"[-1056.1483 1169.7148 231.0486]","73":"[-863.1475 1039.2596 200.0313]","74":"[-870.0542 890.3504 200.0313]","75":"[-1076.8447 1110.9702 106.975]","76":"[-884.3427 1238.3864 69.0313]","77":"[-1013.5281 532.6072 8.0312]","78":"[-898.6596 -540.4709 70.0313]","79":"[-772.3708 -346.5603 8.0313]","80":"[-59.9806 -1404.9617 5.0313]","81":"[-648.8461 -1365.5369 8.0313]","82":"[650.2933 -1341.6227 8.0313]","83":"[-6.0873 -376.5837 141.0313]","84":"[143.5577 72.6394 141.0313]","85":"[138.882 324.5521 141.0313]","86":"[-146.2948 -173.7491 141.0313]","87":"[1.8558 -406.8785 8.0313]","88":"[74.9934 316.431 8.0313]","89":"[-72.6895 318.8666 8.0313]","90":"[-1309.608 1146.5614 200.0313]","91":"[-796.6145 -1250.14 69.0313]"},"info_player_army":{"1":"[-1367.7357 -1177.1493 197.0313]","2":"[-1285.8579 -1172.001 197.0313]","3":"[-1203.6658 -1169.1372 197.0313]","4":"[-1126.5031 -1166.5089 197.0313]","5":"[-812.4174 -1182.7566 197.0313]","6":"[-862.3701 -1143.08 197.0313]","7":"[-929.8381 -1139.9736 197.0313]","8":"[-990.6744 -1140.7975 197.0313]","9":"[-1082.5376 -1130.9849 197.0313]","10":"[-1088.1488 -1074.5981 197.0313]","11":"[-1018.1358 -1066.804 197.0313]","12":"[-956.0265 -1064.2303 197.0313]","13":"[-884.0614 -1057.9478 197.0313]","14":"[-837.9715 -1013.6509 197.0313]","15":"[-818.4769 -951.3231 197.0313]","16":"[-812.8536 -885.5848 197.0313]","17":"[-880.3511 -881.7681 197.0313]","18":"[-890.6105 -935.2946 197.0313]","19":"[-920.6945 -994.3774 197.0313]","20":"[-988.0549 -992.7564 197.0313]","21":"[-992.2855 -927.2556 197.0313]","22":"[-967.7716 -866.439 197.0313]","23":"[-1052.7389 -998.5204 197.0313]","24":"[-1114.2504 -993.9272 197.0313]","25":"[-1158.3448 -1046.4697 197.0313]","26":"[-1167.5398 -1098.5654 197.0313]","27":"[-1237.3684 -1093.8457 197.0313]","28":"[-1304.9419 -1104.12 197.0313]","29":"[-1278.3973 -1040.1799 197.0313]","30":"[-1231.4478 -998.3747 197.0313]","31":"[-1279.0137 -971.1279 197.0313]","32":"[-1218.8285 -939.4406 197.0313]","33":"[-1159.2891 -923.3546 197.0313]","34":"[-1144.7931 -732.4555 197.0313]","35":"[-1043.0251 -742.0983 197.0313]","36":"[-968.4556 -741.0143 197.0313]","37":"[-929.0648 -676.615 197.0313]"},"point_radiation":[],"point_stash":[],"info_player_zombie":{"1":"[-723.4517 2078.134 8.0313]","2":"[-719.296 2162.2993 8.0313]","3":"[-708.5917 2220.8469 8.0313]","4":"[-619.8789 2220.8584 8.0313]","5":"[-623.3275 2163.1777 8.0313]","6":"[-627.5798 2087.5205 8.0313]","7":"[-562.2644 2088.834 8.0313]","8":"[-557.9258 2154.3428 8.0313]","9":"[-559.5195 2219.3147 8.0313]","10":"[-702.0791 1987.4875 8.0313]","11":"[-720.8421 1795.0205 8.0313]","12":"[-565.1263 1776.8129 8.0313]","13":"[-535.8591 1967.5879 8.0313]","14":"[707.0464 2094.0461 8.0313]","15":"[708.8925 2205.0862 8.0313]","16":"[618.3367 2206.2134 8.0313]","17":"[610.3018 2101.7134 8.0312]","18":"[540.1431 2204.8145 8.0313]","19":"[529.2364 2109.9885 8.0313]","20":"[442.8304 2145.7078 8.0313]"},"info_evac":{"1":"[-6.1673 1156.0032 8.0313]","2":"[-21.0202 -923.1101 8.0313]","3":"[-483.3858 -48.1653 8.0313]","4":"[388.1861 102.1153 8.0313]","5":"[-472.3137 262.0621 8.0312]","6":"[-469.5734 -482.7105 8.0312]"},"info_npcspawn":{"1":"[694.4854 1646.6602 8.0313]","2":"[693.1973 1554.5415 8.0313]","3":"[587.1055 1549.807 8.0313]","4":"[579.6001 1649.3862 8.0313]","5":"[-687.7419 1554.7095 8.0313]","6":"[-685.2443 1654.6686 8.0313]","7":"[-585.218 1659.2363 8.0313]","8":"[-575.3214 1559.7159 8.0313]","9":"[484.1852 1600.1304 8.0313]","10":"[457.184 1677.2731 8.0313]","11":"[397.903 1597.4854 8.0313]","12":"[-459.8139 1560.2728 8.0313]","13":"[-495.0093 1641.8805 8.0313]","14":"[-419.2628 1633.9351 8.0313]"},"prop_physics":{"1":{"1":"[-289.9543 1717.2734 -14.1487]","2":"models/props_c17/door01_left.mdl","3":"{-62.8363 91.2064 0.1306}","4":false}}}]],
@@ -15,11 +15,11 @@ local data = {
file.CreateDir( "redead" )
for k,v in pairs( maps ) do
-
+
if not file.Exists( v, "DATA" ) then
file.Write( v, data[k] )
-
+
end
-end \ No newline at end of file
+end
diff --git a/gamemode/npcfix.lua b/gamemode/npcfix.lua
index b27de8d..a84a57e 100644
--- a/gamemode/npcfix.lua
+++ b/gamemode/npcfix.lua
@@ -155,4 +155,4 @@ ai.GetTaskID = function( taskName )
return sharedtasks_e[taskName]
-end \ No newline at end of file
+end
diff --git a/gamemode/player_class/player_army.lua b/gamemode/player_class/player_army.lua
index 7e20c13..163ac5e 100644
--- a/gamemode/player_class/player_army.lua
+++ b/gamemode/player_class/player_army.lua
@@ -1,7 +1,7 @@
AddCSLuaFile()
-local PLAYER = {}
+local PLAYER = {}
function PLAYER:GetHandsModel()
@@ -13,4 +13,4 @@ function PLAYER:Spawn()
end
-player_manager.RegisterClass( "player_army", PLAYER, "player_baseclass" ) \ No newline at end of file
+player_manager.RegisterClass( "player_army", PLAYER, "player_baseclass" )
diff --git a/gamemode/player_class/player_base.lua b/gamemode/player_class/player_base.lua
index a470104..02733a8 100644
--- a/gamemode/player_class/player_base.lua
+++ b/gamemode/player_class/player_base.lua
@@ -3,7 +3,7 @@ AddCSLuaFile()
DEFINE_BASECLASS( "player_default" )
-local PLAYER = {}
+local PLAYER = {}
function PLAYER:GetHandsModel()
@@ -79,7 +79,7 @@ function PLAYER:HandlePlayerNoClipping( velocity )
if ( self.Player:InVehicle() ) then return end
- if ( self.Player:GetMoveType() != MOVETYPE_NOCLIP ) then
+ if ( self.Player:GetMoveType() != MOVETYPE_NOCLIP ) then
if ( self.Player.m_bWasNoclipping ) then
@@ -110,16 +110,16 @@ function PLAYER:HandlePlayerVaulting( velocity )
if ( velocity:Length() < 1000 ) then return end
if ( self.Player:IsOnGround() ) then return end
- self.Player.CalcIdeal = ACT_MP_SWIM
+ self.Player.CalcIdeal = ACT_MP_SWIM
return true
end
function PLAYER:HandlePlayerSwimming( velocity )
- if ( self.Player:WaterLevel() < 2 ) then
+ if ( self.Player:WaterLevel() < 2 ) then
self.Player.m_bInSwim = false
- return false
+ return false
end
if ( velocity:Length2D() > 10 ) then
@@ -129,12 +129,12 @@ function PLAYER:HandlePlayerSwimming( velocity )
end
self.Player.m_bInSwim = true
-
+
return true
end
-function PLAYER:HandlePlayerLanding( velocity, WasOnGround )
+function PLAYER:HandlePlayerLanding( velocity, WasOnGround )
if ( self.Player:GetMoveType() == MOVETYPE_NOCLIP ) then return end
@@ -147,10 +147,10 @@ end
function PLAYER:HandlePlayerDriving()
return false
-
+
end
-function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
+function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
local len = velocity:Length()
local movement = 1.0
@@ -164,7 +164,7 @@ function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
-- if we're under water we want to constantly be swimming..
if ( self.Player:WaterLevel() >= 2 ) then
rate = math.max( rate, 0.5 )
- elseif ( !self.Player:IsOnGround() && len >= 1000 ) then
+ elseif ( !self.Player:IsOnGround() && len >= 1000 ) then
rate = 0.1;
end
@@ -177,7 +177,7 @@ function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
end
-function PLAYER:GrabEarAnimation()
+function PLAYER:GrabEarAnimation()
self.Player.ChatGestureWeight = self.Player.ChatGestureWeight or 0
@@ -335,4 +335,4 @@ function PLAYER:DoAnimationEvent( event, data )
return nil
end
-player_manager.RegisterClass( "player_base", PLAYER, "player_default" ) \ No newline at end of file
+player_manager.RegisterClass( "player_base", PLAYER, "player_default" )
diff --git a/gamemode/player_class/player_default.lua b/gamemode/player_class/player_default.lua
index 1a5f9b3..cf3cb3d 100644
--- a/gamemode/player_class/player_default.lua
+++ b/gamemode/player_class/player_default.lua
@@ -3,7 +3,7 @@ AddCSLuaFile()
DEFINE_BASECLASS( "player_default" )
-local PLAYER = {}
+local PLAYER = {}
function PLAYER:HandlePlayerJumping( velocity )
@@ -73,7 +73,7 @@ function PLAYER:HandlePlayerNoClipping( velocity )
if ( self.Player:InVehicle() ) then return end
- if ( self.Player:GetMoveType() != MOVETYPE_NOCLIP ) then
+ if ( self.Player:GetMoveType() != MOVETYPE_NOCLIP ) then
if ( self.Player.m_bWasNoclipping ) then
@@ -104,16 +104,16 @@ function PLAYER:HandlePlayerVaulting( velocity )
if ( velocity:Length() < 1000 ) then return end
if ( self.Player:IsOnGround() ) then return end
- self.Player.CalcIdeal = ACT_MP_SWIM
+ self.Player.CalcIdeal = ACT_MP_SWIM
return true
end
function PLAYER:HandlePlayerSwimming( velocity )
- if ( self.Player:WaterLevel() < 2 ) then
+ if ( self.Player:WaterLevel() < 2 ) then
self.Player.m_bInSwim = false
- return false
+ return false
end
if ( velocity:Length2D() > 10 ) then
@@ -123,12 +123,12 @@ function PLAYER:HandlePlayerSwimming( velocity )
end
self.Player.m_bInSwim = true
-
+
return true
end
-function PLAYER:HandlePlayerLanding( velocity, WasOnGround )
+function PLAYER:HandlePlayerLanding( velocity, WasOnGround )
if ( self.Player:GetMoveType() == MOVETYPE_NOCLIP ) then return end
@@ -141,10 +141,10 @@ end
function PLAYER:HandlePlayerDriving()
return false
-
+
end
-function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
+function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
local len = velocity:Length()
local movement = 1.0
@@ -158,7 +158,7 @@ function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
-- if we're under water we want to constantly be swimming..
if ( self.Player:WaterLevel() >= 2 ) then
rate = math.max( rate, 0.5 )
- elseif ( !self.Player:IsOnGround() && len >= 1000 ) then
+ elseif ( !self.Player:IsOnGround() && len >= 1000 ) then
rate = 0.1;
end
@@ -175,7 +175,7 @@ end
-- If you don't want the player to grab his ear in your gamemode then
-- just override this.
--
-function PLAYER:GrabEarAnimation()
+function PLAYER:GrabEarAnimation()
self.Player.ChatGestureWeight = self.Player.ChatGestureWeight or 0
@@ -337,4 +337,4 @@ function PLAYER:DoAnimationEvent( event, data )
return nil
end
-player_manager.RegisterClass( "player_baseclass", PLAYER, "player_default" ) \ No newline at end of file
+player_manager.RegisterClass( "player_baseclass", PLAYER, "player_default" )
diff --git a/gamemode/player_class/player_zombie.lua b/gamemode/player_class/player_zombie.lua
index f8333b1..4167953 100644
--- a/gamemode/player_class/player_zombie.lua
+++ b/gamemode/player_class/player_zombie.lua
@@ -1,29 +1,29 @@
AddCSLuaFile()
-local PLAYER = {}
+local PLAYER = {}
-function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
+function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
local len = velocity:Length()
local movement = 1.0
if len > 0.2 then
-
- movement = len / maxseqgroundspeed
-
+
+ movement = len / maxseqgroundspeed
+
end
rate = math.min( movement, 2 )
if self.Player:WaterLevel() >= 2 then
-
+
rate = math.max( rate, 0.5 )
-
- elseif !self.Player:IsOnGround() and len >= 1000 then
-
+
+ elseif !self.Player:IsOnGround() and len >= 1000 then
+
rate = 0.1
-
+
end
local weapon = self.Player:GetActiveWeapon()
@@ -31,10 +31,10 @@ function PLAYER:UpdateAnimation( velocity, maxseqgroundspeed )
self.Player:SetPlaybackRate( rate )
if CLIENT then
-
+
self:GrabEarAnimation()
self:MouthMoveAnimation()
-
+
end
end
@@ -45,11 +45,11 @@ function PLAYER:CalcMainActivity( velocity )
self.Player.CalcSeqOverride = self.Player:LookupSequence( "zombie_idle" )
local len2d = velocity:Length2D()
-
+
if len2d > 1 then
-
+
self.Player.CalcSeqOverride = self.Player:LookupSequence( "zombie_run" )
-
+
end
return self.Player.CalcIdeal, self.Player.CalcSeqOverride
@@ -73,7 +73,7 @@ function PLAYER:DoAnimationEvent( event, data )
self.Player.m_bJumping = true
self.Player.m_bFirstJumpFrame = true
self.Player.m_flJumpStartTime = CurTime()
-
+
self.Player:AnimRestartMainSequence()
return ACT_INVALID
@@ -90,4 +90,4 @@ function PLAYER:DoAnimationEvent( event, data )
end
-player_manager.RegisterClass( "player_zombie", PLAYER, "player_base" ) \ No newline at end of file
+player_manager.RegisterClass( "player_zombie", PLAYER, "player_base" )
diff --git a/gamemode/resource.lua b/gamemode/resource.lua
index 2aafc2f..49311f2 100644
--- a/gamemode/resource.lua
+++ b/gamemode/resource.lua
@@ -8,11 +8,11 @@ resource.AddFile( "sound/nuke/redead/lastminute.mp3" )
for i=1,4 do
for e=1,5 do
-
+
resource.AddFile( "materials/models/Zed/Male/g" .. i .. "_0" .. e .. "_sheet.vmt" )
-
+
end
-
+
end
local include_sound = { "heartbeat",
@@ -167,4 +167,3 @@ for k,v in pairs( include_model ) do
resource.AddFile( "models/" .. v .. ".mdl" )
end
-
diff --git a/gamemode/shared.lua b/gamemode/shared.lua
index e00c4a1..ce47e16 100644
--- a/gamemode/shared.lua
+++ b/gamemode/shared.lua
@@ -1,5 +1,5 @@
-GM.Name = "ReDead"
+GM.Name = "ReDead"
GM.Author = "twoski"
GM.Email = ""
GM.Website = ""
@@ -20,27 +20,27 @@ TEAM_ARMY = 1
TEAM_ZOMBIES = 2
function GM:CreateTeams()
-
+
team.SetUp( TEAM_ARMY, GAMEMODE.ArmyTeamName, Color( 80, 80, 255 ), true )
- team.SetSpawnPoint( TEAM_ARMY, "info_player_army" )
-
+ team.SetSpawnPoint( TEAM_ARMY, "info_player_army" )
+
team.SetUp( TEAM_ZOMBIES, GAMEMODE.ZombieTeamName, Color( 255, 80, 80 ), true )
- team.SetSpawnPoint( TEAM_ZOMBIES, "info_player_zombie" )
+ team.SetSpawnPoint( TEAM_ZOMBIES, "info_player_zombie" )
end
function GM:ShouldCollide( ent1, ent2 )
if ent1:IsPlayer() and ent1:Team() == TEAM_ARMY and ent2.IsWood then
-
+
return false
-
+
elseif ent2:IsPlayer() and ent2:Team() == TEAM_ARMY and ent1.IsWood then
-
+
return false
-
+
end
-
+
return self.BaseClass:ShouldCollide( ent1, ent2 )
end
@@ -48,55 +48,55 @@ end
function GM:Move( ply, mv )
if ply:Team() == TEAM_ARMY then
-
+
if ply:GetNWFloat( "Stamina", 0 ) <= 5 then
-
+
mv:SetMaxSpeed( 110 )
-
+
end
-
+
else
-
+
if mv:GetSideSpeed() > 0 then
-
+
mv:SetSideSpeed( 175 )
-
+
elseif mv:GetSideSpeed() < 0 then
-
+
mv:SetSideSpeed( -175 )
-
+
end
-
+
end
-
+
return self.BaseClass:Move( ply, mv )
end
function GM:PlayerNoClip( pl, on )
-
+
if ( game.SinglePlayer() ) then return true end
-
+
if pl:IsAdmin() or pl:IsSuperAdmin() then return true end
-
+
return false
-
+
end
function IncludeItems()
-
+
local folder = string.Replace( GM.Folder, "gamemodes/", "" )
- for c,d in pairs( file.Find( folder.."/gamemode/items/*.lua", "LUA" ) ) do
-
+ for c,d in pairs( file.Find( folder.."/gamemode/items/*.lua", "LUA" ) ) do
+
include( folder.."/gamemode/items/"..d )
-
+
if SERVER then
-
+
AddCSLuaFile( folder.."/gamemode/items/"..d )
-
+
end
-
+
end
end
@@ -104,19 +104,19 @@ end
IncludeItems()
function IncludeEvents()
-
+
local folder = string.Replace( GM.Folder, "gamemodes/", "" )
- for c,d in pairs( file.Find( folder.."/gamemode/events/*.lua", "LUA" ) ) do
-
+ for c,d in pairs( file.Find( folder.."/gamemode/events/*.lua", "LUA" ) ) do
+
if SERVER then
-
+
include( folder.."/gamemode/events/"..d )
-
+
end
-
+
end
end
-IncludeEvents() \ No newline at end of file
+IncludeEvents()
diff --git a/gamemode/tables.lua b/gamemode/tables.lua
index c48305a..7fd955f 100644
--- a/gamemode/tables.lua
+++ b/gamemode/tables.lua
@@ -235,20 +235,20 @@ GM.VoiceStart = { "npc/metropolice/vo/off1.wav",
GM.VoiceEnd = { "npc/combine_soldier/vo/off1.wav",
"npc/combine_soldier/vo/off2.wav" }
---[[GM.Pain = {"nuke/gore/pain01.wav",
-"nuke/gore/pain02.wav",
-"nuke/gore/pain03.wav",
+--[[GM.Pain = {"nuke/gore/pain01.wav",
+"nuke/gore/pain02.wav",
+"nuke/gore/pain03.wav",
"nuke/gore/pain04.wav",
"nuke/gore/pain05.wav",
"nuke/gore/die05.wav"}
-
-GM.Death = {"nuke/gore/die01.wav",
-"nuke/gore/die02.wav",
-"nuke/gore/die03.wav",
+
+GM.Death = {"nuke/gore/die01.wav",
+"nuke/gore/die02.wav",
+"nuke/gore/die03.wav",
"nuke/gore/die04.wav",
-"nuke/gore/carnage01.wav",
-"nuke/gore/carnage02.wav",
-"nuke/gore/carnage03.wav",
+"nuke/gore/carnage01.wav",
+"nuke/gore/carnage02.wav",
+"nuke/gore/carnage03.wav",
"nuke/gore/carnage04.wav",
"nuke/gore/carnage05.wav"}]]
@@ -273,8 +273,8 @@ GM.HeadShot = { "player/headshot1.wav",
"player/headshot2.wav",
"physics/flesh/flesh_bloody_break.wav" }
-GM.GoreSplash = { "nuke/gore/blood01.wav",
-"nuke/gore/blood02.wav",
+GM.GoreSplash = { "nuke/gore/blood01.wav",
+"nuke/gore/blood02.wav",
"nuke/gore/blood03.wav",
"npc/antlion_grub/squashed.wav" }
@@ -295,7 +295,7 @@ GM.GoreSplat = { "physics/flesh/flesh_squishy_impact_hard1.wav",
GM.GoreBullet = { "nuke/gore/flesh01.wav",
"nuke/gore/flesh02.wav",
"nuke/gore/flesh03.wav",
-"nuke/gore/flesh04.wav" }
+"nuke/gore/flesh04.wav" }
GM.Drill = { "npc/dog/dog_servo6.wav",
"npc/dog/dog_servo7.wav",
@@ -421,7 +421,7 @@ GM.SmallGibs = {"models/gibs/HGIBS_scapula.mdl",
"models/props/cs_italy/banannagib2.mdl",
"models/props/cs_italy/orangegib1.mdl",
"models/props/cs_italy/orangegib2.mdl" }
-
+
GM.BigGibs = {"models/gibs/HGIBS.mdl",
"models/gibs/HGIBS_spine.mdl",
"models/weapons/w_bugbait.mdl",
@@ -454,7 +454,7 @@ for k, v in pairs( GM.Radio ) do
for c,d in pairs( v ) do
util.PrecacheSound( d )
-
+
end
end
@@ -464,7 +464,7 @@ for k, v in pairs( GM.BarrelGibs ) do
util.PrecacheModel( v )
end
-
+
for k, v in pairs( GM.SmallGibs ) do
util.PrecacheModel( v )
@@ -480,5 +480,5 @@ end
for k,v in pairs( GM.Corpses ) do
util.PrecacheModel( v )
-
-end \ No newline at end of file
+
+end
diff --git a/gamemode/vgui/vgui_categorybutton.lua b/gamemode/vgui/vgui_categorybutton.lua
index 0b45c97..cbc00d1 100644
--- a/gamemode/vgui/vgui_categorybutton.lua
+++ b/gamemode/vgui/vgui_categorybutton.lua
@@ -10,21 +10,21 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
//self:SetDraggable( false )
-
+
self:SetCursor( "hand" )
-
+
self.Image = vgui.Create( "DImageButton", self )
self.Image:SetImage( "icon16/car.png" )
self.Image:SetStretchToFit( false )
self.Image.DoClick = function()
-
+
self:Toggle()
-
+
end
-
+
self.Selected = false
self.Text = ""
-
+
end
function PANEL:SetImage( img )
@@ -42,11 +42,11 @@ end
function PANEL:Toggle( bool )
self:SetSelectedState( bool or !self.Selected )
-
+
if not bool then
-
+
self:OnToggle( self.Selected )
-
+
end
end
@@ -58,13 +58,13 @@ end
function PANEL:DoSound( bool )
if bool then
-
+
surface.PlaySound( self.OnSound )
-
+
else
-
+
surface.PlaySound( self.OffSound )
-
+
end
end
@@ -72,9 +72,9 @@ end
function PANEL:SetSelectedState( bool, ignore )
self.Selected = tobool( bool )
-
+
if ignore then return end
-
+
self:DoSound( bool )
end
@@ -102,7 +102,7 @@ function PANEL:PerformLayout()
self.Image:SetSize( imgsize, imgsize )
self.Image:SetPos( self:GetWide() - imgsize - self:GetPadding(), self:GetPadding() )
-
+
//self:SizeToContents()
end
@@ -114,29 +114,29 @@ function PANEL:Paint()
local imgsize = self:GetTall() - ( 2 * self:GetPadding() )
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 180 ) )
-
+
if self.Selected then
-
+
draw.RoundedBox( 4, self:GetWide() - imgsize - self:GetPadding(), self:GetPadding(), imgsize, imgsize, Color( 100, 100, 100, 100 ) )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx, ty, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT )
-
+
else
draw.RoundedBox( 4, self:GetWide() - imgsize - self:GetPadding(), self:GetPadding(), imgsize, imgsize, Color( 100, 100, 100, 100 ) )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx, ty, Color( 100, 100, 100, 255 ), TEXT_ALIGN_LEFT )
-
+
end
end
diff --git a/gamemode/vgui/vgui_classpicker.lua b/gamemode/vgui/vgui_classpicker.lua
index 5954296..9e1608f 100644
--- a/gamemode/vgui/vgui_classpicker.lua
+++ b/gamemode/vgui/vgui_classpicker.lua
@@ -5,14 +5,14 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
self:ChooseParent()
-
+
self.Items = {}
-
+
for k,v in pairs( { CLASS_SCOUT, CLASS_COMMANDO, CLASS_SPECIALIST, CLASS_ENGINEER } ) do
local desc = GAMEMODE.ClassDescriptions[k] or "TEH"
local logo = GAMEMODE.ClassLogos[k] or "brick/brick_model"
-
+
local button = vgui.Create( "DImageButton", self )
button:SetImage( logo )
button:SetSize( 100, 100 )
@@ -24,11 +24,11 @@ function PANEL:Init()
label:SetText( desc )
label:SetFont( "ItemDisplayFont" )
label:SetSize( 300, 100 )
-
+
table.insert( self.Items, { button, label } )
-
+
end
-
+
end
function PANEL:Think()
@@ -38,13 +38,13 @@ function PANEL:Think()
end
function PANEL:ChooseParent()
-
+
end
function PANEL:GetPadding()
return 5
-
+
end
function PANEL:PerformLayout()
@@ -52,14 +52,14 @@ function PANEL:PerformLayout()
local x,y = self:GetPadding(), self:GetPadding() + 50
for k,v in pairs( self.Items ) do
-
+
v[1]:SetPos( x, y )
v[2]:SetPos( x + 100 + self:GetPadding(), y )
-
+
y = y + 100 + self:GetPadding()
-
+
end
-
+
self:SizeToContents()
end
@@ -68,7 +68,7 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
-
+
//draw.SimpleText( "Class Menu", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/vgui/vgui_dialogue.lua b/gamemode/vgui/vgui_dialogue.lua
index ef76419..1626090 100644
--- a/gamemode/vgui/vgui_dialogue.lua
+++ b/gamemode/vgui/vgui_dialogue.lua
@@ -4,109 +4,109 @@ function PANEL:Init()
//self:ShowCloseButton( false )
self:SetKeyboardInputEnabled( false )
- //self:SetDraggable( true )
-
+ //self:SetDraggable( true )
+
self.Button = vgui.Create( "DButton", self )
self.Button:SetText( "Close" )
self.Button.OnMousePressed = function()
if not InventoryScreen:IsVisible() and not SaleScreen:IsVisible() then
-
+
gui.EnableScreenClicker( false )
-
+
end
-
- self:Remove()
-
+
+ self:Remove()
+
end
-
+
self.TextSizeY = 20
-
+
end
function PANEL:SetText( text )
self.Text = text
self:InvalidateLayout()
-
+
end
function PANEL:GetPadding()
return 20
-
+
end
function PANEL:Think()
if self.Dragging then
-
+
local x = gui.MouseX() - self.Dragging[1]
local y = gui.MouseY() - self.Dragging[2]
-
+
x = math.Clamp( x, 0, ScrW() - self:GetWide() )
y = math.Clamp( y, 0, ScrH() - self:GetTall() )
-
+
self:SetPos( x, y )
-
+
end
end
function PANEL:PerformLayout()
-
+
if self.Button then
-
+
self.Button:SetPos( self:GetWide() * 0.5 - self.Button:GetWide() * 0.5, self.TextSizeY + 16 )
self.Button:SetSize( 48, 18 )
-
+
end
self:SetSize( 400, self.TextSizeY + 42 )
-
+
end
function PANEL:Paint()
Derma_DrawBackgroundBlur( self )
-
+
surface.SetFont( "ItemDisplayFont" )
-
+
local tbl = string.Explode( " ", self.Text )
- local str = { "" }
+ local str = { "" }
local pos = 1
-
+
for k,v in pairs( tbl ) do
-
+
local test = str[pos] .. " " .. v
local size = surface.GetTextSize( test )
-
+
if size > self:GetWide() - 40 then
-
+
str[pos] = string.Trim( str[pos] )
pos = pos + 1
str[pos] = ( str[pos] or "" ) .. v
-
+
else
-
+
str[pos] = str[pos] .. " " .. v
-
+
end
-
+
end
-
+
self.TextSizeY = 20 + ( pos - 1 ) * 15
-
+
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 100 ) )
-
+
draw.RoundedBox( 4, 10, 10, self:GetWide() - 20, self.TextSizeY, Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 11, 11, self:GetWide() - 22, self.TextSizeY - 2, Color( 150, 150, 150, 150 ) )
-
+
for k,v in pairs( str ) do
-
+
draw.SimpleText( v, "ItemDisplayFont", self:GetWide() * 0.5, 20 + ( ( k - 1 ) * 15 ), Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
end
diff --git a/gamemode/vgui/vgui_endgame.lua b/gamemode/vgui/vgui_endgame.lua
index 9ea2974..82be456 100644
--- a/gamemode/vgui/vgui_endgame.lua
+++ b/gamemode/vgui/vgui_endgame.lua
@@ -3,22 +3,22 @@ local PANEL = {}
function PANEL:Init()
self:PerformLayout()
-
+
self.Wait = CurTime() + 5
self.Pos = 1
self.YPos = 220
self.ListMode = true
- self.DrawTbl = {}
+ self.DrawTbl = {}
self.Awards = {}
-
+
self.Lists = {}
- self.Lists[1] = { 5, ScrW() * 0.30, "Survivors", function() return self:GetSurvivors() end, "bot/whoo2.wav" }
- self.Lists[2] = { ScrW() * 0.50 - ScrW() * 0.15, ScrW() * 0.30, "Top Killers", function() return self:GetTopKillers() end, "weapons/357_fire2.wav" }
- self.Lists[3] = { ScrW() - ( ScrW() * 0.30 ) - 5, ScrW() * 0.30, "Big Spenders", function() return self:GetTopSpenders() end, "physics/metal/chain_impact_soft1.wav" }
-
+ self.Lists[1] = { 5, ScrW() * 0.30, "Survivors", function() return self:GetSurvivors() end, "bot/whoo2.wav" }
+ self.Lists[2] = { ScrW() * 0.50 - ScrW() * 0.15, ScrW() * 0.30, "Top Killers", function() return self:GetTopKillers() end, "weapons/357_fire2.wav" }
+ self.Lists[3] = { ScrW() - ( ScrW() * 0.30 ) - 5, ScrW() * 0.30, "Big Spenders", function() return self:GetTopSpenders() end, "physics/metal/chain_impact_soft1.wav" }
+
local x, w = ScrW() * 0.50 - ScrW() * 0.15, ScrW() * 0.65 - 5
-
- self:ListNewAward( { x, w, "Grey Matter:", "got the most headshots.", function() return self:GetStatMax( "Headshot" ) end, "zombie craniums", "player/headshot1.wav" } )
+
+ self:ListNewAward( { x, w, "Grey Matter:", "got the most headshots.", function() return self:GetStatMax( "Headshot" ) end, "zombie craniums", "player/headshot1.wav" } )
self:ListNewAward( { x, w, "Silent Partner:", "got the most kill assists.", function() return self:GetStatMax( "Assist" ) end, "assists", "weapons/357/357_spin1.wav" } )
self:ListNewAward( { x, w, "Longshot:", "got the longest distance kill.", function() return self:GetStatMax( "Longshot" ) end, "feet", "weapons/fx/nearmiss/bulletLtoR05.wav" } )
self:ListNewAward( { x, w, "Big Game Hunter:", "dismembered the most zombies with a shotgun.", function() return self:GetStatMax( "Meat" ) end, "zombies poached", "nuke/gore/blood01.wav", true } )
@@ -37,7 +37,7 @@ function PANEL:Init()
self:ListNewAward( { x, w, "Accident Prone:", "took the most damage from zombies.", function() return self:GetStatMax( "Damage" ) end, "damage", "bot/pain2.wav" } )
self:ListNewAward( { x, w, "Roleplayer:", "did jack shit.", function() return self:GetWorstPlayer() end, "kills", "ambient/sheep.wav" } )
//self:ListNewAward( { x, w, "Piss Poor:", "spent the least " .. GAMEMODE.CurrencyName .. "s.", function() return self:GetStatMin( "Spent" ) end, GAMEMODE.CurrencyName .. "s spent", "bot/i_got_nothing.wav" } )
-
+
end
function PANEL:ListNewAward( tbl )
@@ -52,16 +52,16 @@ function PANEL:GetWorstPlayer()
local ply = NULL
for k,v in pairs( player.GetAll() ) do
-
+
if v:Frags() < min then
-
+
min = v:Frags()
ply = v
-
+
end
-
+
end
-
+
return ply, min
end
@@ -72,16 +72,16 @@ function PANEL:GetStatMin( name )
local ply = NULL
for k,v in pairs( PlayerStats ) do
-
+
if v.Stats and ( v.Stats[ name ] or 0 ) < min then
-
+
min = ( v.Stats[ name ] or 0 )
ply = v.Player
-
+
end
-
+
end
-
+
return ply, min
end
@@ -92,16 +92,16 @@ function PANEL:GetStatMax( name )
local ply = NULL
for k,v in pairs( PlayerStats ) do
-
+
if v.Stats and ( v.Stats[ name ] or 0 ) > max then
-
+
max = ( v.Stats[ name ] or 0 )
ply = v.Player
-
+
end
-
+
end
-
+
return ply, max
end
@@ -109,11 +109,11 @@ end
function PANEL:GetSurvivors()
local tbl = {}
-
+
for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do
-
+
table.insert( tbl, { v } )
-
+
end
return tbl
@@ -125,32 +125,32 @@ function PANEL:GetTopSpenders()
local num = math.min( #player.GetAll(), 5 )
local tbl = {}
local ignore = {}
-
+
for i=1, num do
-
+
local count = -1
local ply = NULL
-
+
for k,v in pairs( PlayerStats ) do
-
+
if v.Stats and ( v.Stats[ "Spent" ] or 0 ) > count and not table.HasValue( ignore, v.Player ) then
-
+
ply = v.Player
count = ( v.Stats[ "Spent" ] or 0 )
-
+
end
-
+
end
-
+
if ply != NULL then
-
+
table.insert( tbl, { ply, count } )
table.insert( ignore, ply )
-
+
end
-
+
end
-
+
return tbl
end
@@ -160,42 +160,42 @@ function PANEL:GetTopKillers()
local num = math.min( #player.GetAll(), 5 )
local plys = player.GetAll()
local tbl = {}
-
+
for i=1, num do
-
+
local count = -1
local ply = NULL
local pos = 0
-
+
for k,v in pairs( plys ) do
-
+
if v:Frags() > count then
-
+
ply = v
pos = k
count = v:Frags()
-
+
end
-
+
end
-
+
if ply != NULL then
-
+
table.remove( plys, pos )
table.insert( tbl, { ply, ply:Frags() } )
-
+
end
-
+
end
-
+
return tbl
end
function PANEL:PerformLayout()
-
+
self:SetSize( ScrW(), ScrH() )
-
+
end
function PANEL:AddList( pos, width, title, players, sound )
@@ -203,11 +203,11 @@ function PANEL:AddList( pos, width, title, players, sound )
surface.PlaySound( sound )
table.insert( self.DrawTbl, { X = pos + width * 0.5, Y = 35, Text = title, Style = TEXT_ALIGN_CENTER, Font = "EndGameBig" } )
-
+
if not players[1] then return end
-
+
local ypos = 60
-
+
for k,v in pairs( players ) do
local list = vgui.Create( "PlayerPanel" )
@@ -215,9 +215,9 @@ function PANEL:AddList( pos, width, title, players, sound )
list:SetCount( v[2] )
list:SetTall( 26 )
list:SetWide( width )
- list:SetPos( pos, ypos )
-
- ypos = ypos + 31
+ list:SetPos( pos, ypos )
+
+ ypos = ypos + 31
end
@@ -225,34 +225,34 @@ end
function PANEL:AddAward( ypos, pos, width, title, desc, ply, amt, append, sound, condition )
- if condition and amt < 1 then
-
+ if condition and amt < 1 then
+
self.Wait = 0
-
- return
-
+
+ return
+
end
-
+
surface.PlaySound( sound )
self.YPos = self.YPos + 31
self.Wait = CurTime() + 1.5
table.insert( self.DrawTbl, { X = pos + 2, Y = ypos + 5, Text = title, Style = TEXT_ALIGN_LEFT, Font = "EndGame" } )
-
+
local offset = 150
-
+
local list = vgui.Create( "PlayerPanel" )
list:SetPlayerEnt( ply )
list:SetDescription( desc )
list:SetTall( 26 )
list:SetWide( width - offset )
- list:SetPos( pos + offset, ypos )
-
+ list:SetPos( pos + offset, ypos )
+
if append then
-
+
list:SetCount( amt .. " " .. append )
-
+
end
end
@@ -260,43 +260,43 @@ end
function PANEL:Think()
if self.Wait and self.Wait < CurTime() then
-
+
self.Wait = CurTime() + 0.5
-
+
if self.ListMode then
-
+
local alist = self.Lists[ self.Pos ]
-
+
self:AddList( alist[1], alist[2], alist[3], alist[4](), alist[5] )
-
+
self.Pos = self.Pos + 1
-
+
if self.Pos > #self.Lists then
-
+
self.ListMode = false
self.Wait = CurTime() + 1.5
self.Pos = 1
-
+
end
-
+
else
-
- local alist = self.Awards[ self.Pos ]
-
+
+ local alist = self.Awards[ self.Pos ]
+
local ply, amt = alist[5]()
-
+
self:AddAward( self.YPos, alist[1], alist[2], alist[3], alist[4], ply, amt, alist[6], alist[7], alist[8] )
-
+
self.Pos = self.Pos + 1
-
+
if self.Pos > #self.Awards then
-
+
self.Wait = nil
-
+
end
-
+
end
-
+
end
end
@@ -304,9 +304,9 @@ end
function PANEL:Paint()
for k,v in pairs( self.DrawTbl ) do
-
+
draw.SimpleText( v.Text, v.Font, v.X, v.Y, Color( 255, 255, 255 ), v.Style, v.Style )
-
+
end
end
diff --git a/gamemode/vgui/vgui_goodmodelpanel.lua b/gamemode/vgui/vgui_goodmodelpanel.lua
index 4434e56..b61c96f 100644
--- a/gamemode/vgui/vgui_goodmodelpanel.lua
+++ b/gamemode/vgui/vgui_goodmodelpanel.lua
@@ -1,6 +1,6 @@
/* _
- ( )
- _| | __ _ __ ___ ___ _ _
+ ( )
+ _| | __ _ __ ___ ___ _ _
/'_` | /'__`\( '__)/' _ ` _ `\ /'_` )
( (_| |( ___/| | | ( ) ( ) |( (_| |
`\__,_)`\____)(_) (_) (_) (_)`\__,_) sucks shit
@@ -25,20 +25,20 @@ function PANEL:Init()
self.NextSetModel = nil
self.LastPaint = 0
self.DirectionalLight = {}
-
+
self:SetCamPos( Vector( 50, 50, 50 ) )
self:SetLookAt( Vector( 0, 0, 40 ) )
self:SetFOV( 70 )
-
+
self:SetText( "" )
self:SetAnimSpeed( 0.5 )
self:SetAnimated( false )
-
+
self:SetAmbientLight( Color( 50, 50, 50 ) )
-
+
self:SetDirectionalLight( BOX_TOP, Color( 255, 255, 255 ) )
self:SetDirectionalLight( BOX_FRONT, Color( 255, 255, 255 ) )
-
+
self:SetColor( Color( 255, 255, 255, 255 ) )
end
@@ -46,7 +46,7 @@ end
function PANEL:SetModel( model )
if self.NextModel == model then return end
-
+
self.NextModel = model
self.StopRender = true
self.NextSetModel = CurTime() + 0.01
@@ -56,37 +56,37 @@ end
function PANEL:Think()
if self.NextSetModel and self.NextSetModel < CurTime() then
-
+
self:SpecialSetModel( self.NextModel )
self.StopRender = false
self.NextSetModel = nil
-
+
end
end
function PANEL:SpecialSetModel( model )
-
+
if IsValid( self.Entity ) then
-
+
self.Entity:Remove()
- self.Entity = nil
-
+ self.Entity = nil
+
end
-
+
if not ClientsideModel then return end
-
+
self.LastModel = model
self.Entity = ClientsideModel( model, RENDERGROUP_OPAQUE )
-
+
if not IsValid( self.Entity ) then return end
-
+
self.Entity:SetNoDraw( true )
-
+
local seq = self:ChooseSequence( model )
-
+
if seq > 0 then self.Entity:ResetSequence( seq ) end
-
+
end
function PANEL:GetSequenceList()
@@ -106,21 +106,21 @@ function PANEL:ChooseSequence( model )
local seq = 0
for k,v in pairs( self:ExcludedModels() ) do
-
+
if string.find( model, v ) then
-
- return self.Entity:LookupSequence( "idle" )
-
+
+ return self.Entity:LookupSequence( "idle" )
+
end
-
+
end
-
+
for k,v in pairs( self:GetSequenceList() ) do
-
+
if seq <= 0 then seq = self.Entity:LookupSequence( v ) end
-
+
end
-
+
return seq
end
@@ -129,62 +129,62 @@ function PANEL:Paint()
if ( !IsValid( self.Entity ) ) then return end
if self.StopRender then return end
-
+
local x, y = self:LocalToScreen( 0, 0 )
local w, h = self:GetSize()
-
+
local sl, st, sr, sb = x, y, x + w, y + h
-
+
local p = self
-
+
while p:GetParent() do
-
+
p = p:GetParent()
-
+
local pl, pt = p:LocalToScreen( 0, 0 )
local pr, pb = pl + p:GetWide(), pt + p:GetTall()
-
+
sl = sl < pl and pl or sl
st = st < pt and pt or st
sr = sr > pr and pr or sr
sb = sb > pb and pb or sb
-
+
end
-
+
render.SetScissorRect( sl, st, sr, sb, true )
-
+
self:LayoutEntity( self.Entity )
-
+
cam.Start3D( self.vCamPos, (self.vLookatPos-self.vCamPos):Angle(), self.fFOV, x, y, self:GetWide(), self:GetTall() )
cam.IgnoreZ( true )
-
+
render.SuppressEngineLighting( true )
render.SetLightingOrigin( self.Entity:GetPos() )
render.ResetModelLighting( self.colAmbientLight.r / 255, self.colAmbientLight.g / 255, self.colAmbientLight.b / 255 )
render.SetColorModulation( self.colColor.r / 255, self.colColor.g / 255, self.colColor.b / 255 )
render.SetBlend( self.colColor.a / 255 )
-
+
for i=0, 6 do
local col = self.DirectionalLight[ i ]
if ( col ) then
render.SetModelLighting( i, col.r / 255, col.g / 255, col.b / 255 )
end
end
-
+
if IsValid( self.Entity ) and not GetGlobalBool( "GameOver", false ) then
-
+
self.Entity:DrawModel()
-
+
end
-
+
render.SuppressEngineLighting( false )
cam.IgnoreZ( false )
cam.End3D()
-
+
render.SetScissorRect( 0, 0, 0, 0, false )
-
+
self.LastPaint = RealTime()
-
+
end
function PANEL:LayoutEntity( Entity )
@@ -194,7 +194,7 @@ function PANEL:LayoutEntity( Entity )
if ( self.bAnimated ) then
self:RunAnimation()
end
-
+
Entity:SetAngles( Angle( 0, RealTime() * 10, 0) )
end
diff --git a/gamemode/vgui/vgui_helpmenu.lua b/gamemode/vgui/vgui_helpmenu.lua
index 6724302..813ca1c 100644
--- a/gamemode/vgui/vgui_helpmenu.lua
+++ b/gamemode/vgui/vgui_helpmenu.lua
@@ -33,33 +33,33 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
self:ChooseParent()
-
+
local text = ""
-
+
for k,v in pairs( self.Text ) do
-
+
text = text .. v
-
+
end
-
+
self.Label = vgui.Create( "HTML", self )
self.Label:SetHTML( text )
-
+
self.Button = vgui.Create( "DButton", self )
self.Button:SetText( table.Random( self.ButtonText ) )
self.Button.OnMousePressed = function()
- self:Remove()
-
+ self:Remove()
+
if LocalPlayer():Team() != TEAM_UNASSIGNED then return end
-
+
local classmenu = vgui.Create( "ClassPicker" )
classmenu:SetSize( 415, 475 )
classmenu:Center()
classmenu:MakePopup()
-
+
end
-
+
end
function PANEL:Think()
@@ -69,25 +69,25 @@ function PANEL:Think()
end
function PANEL:ChooseParent()
-
+
end
function PANEL:GetPadding()
return 5
-
+
end
function PANEL:PerformLayout()
local x,y = self:GetPadding(), self:GetPadding() + 10
-
+
self.Label:SetSize( self:GetWide() - ( self:GetPadding() * 2 ) - 5, self:GetTall() - 50 )
self.Label:SetPos( x + 5, y + 5 )
-
+
self.Button:SetSize( 250, 20 )
self.Button:SetPos( self:GetWide() * 0.5 - self.Button:GetWide() * 0.5, self:GetTall() - 30 )
-
+
self:SizeToContents()
end
@@ -96,7 +96,7 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
-
+
draw.SimpleText( "Help Menu", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/vgui/vgui_itemdisplay.lua b/gamemode/vgui/vgui_itemdisplay.lua
index d4a734b..b9b9998 100644
--- a/gamemode/vgui/vgui_itemdisplay.lua
+++ b/gamemode/vgui/vgui_itemdisplay.lua
@@ -6,15 +6,15 @@ function PANEL:Init()
//self:ShowCloseButton( false )
self:SetKeyboardInputEnabled( false )
- //self:SetDraggable( false )
-
- self.Text = "Click an item to see its description."
+ //self:SetDraggable( false )
+
+ self.Text = "Click an item to see its description."
self.Title = "N/A"
self.Style = "Stash"
self.PriceScale = 1
self.Price = 0
self.Weight = 0
-
+
end
function PANEL:SetItemDesc( text, title, style, scale, price, weight )
@@ -31,50 +31,50 @@ end
function PANEL:SetModel( model, campos, origin )
if not self.ModelPanel then
-
+
self.ModelPanel = vgui.Create( "GoodModelPanel", self )
-
+
end
-
+
self.ModelPanel:SetModel( model )
self.ModelPanel:SetCamPos( Vector(20,10,5) )
self.ModelPanel:SetLookAt( Vector(0,0,0) )
self.ModelPanel.LayoutEntity = function( this, ent ) end
-
+
--[[if string.find( model, "models/weapons/w_" ) then
-
+
self.ModelPanel.LayoutEntity = function( this, ent ) if IsValid( ent ) then ent:SetAngles( Angle( 0, 0, 0 ) ) end end
-
+
else
-
+
self.ModelPanel.LayoutEntity = function( this, ent ) if IsValid( ent ) then ent:SetAngles( Angle( 0, RealTime() * 10, 0 ) ) end end
-
+
end]]
-
+
if CamPosOverride then
-
+
campos = CamPosOverride
-
+
end
-
+
if CamOrigOverride then
-
+
origin = CamOrigOverride
-
+
end
-
+
if campos then
-
+
self.ModelPanel:SetCamPos( campos )
-
+
end
-
+
if origin then
-
+
self.ModelPanel:SetLookAt( origin )
-
+
end
-
+
self:InvalidateLayout()
end
@@ -86,32 +86,32 @@ end
function PANEL:Think()
local tbl, style, scale = GAMEMODE:GetItemToPreview()
-
+
if tbl then
-
+
self:SetModel( tbl.Model, tbl.CamPos, tbl.CamOrigin )
self:SetItemDesc( tbl.Description, tbl.Name, style, scale, tbl.Price, tbl.Weight )
-
+
//GAMEMODE:SetItemToPreview()
-
+
end
end
function PANEL:PerformLayout()
-
+
if self.ModelPanel then
-
+
local size = math.Min( self:GetWide(), self:GetTall() * 0.85 )
local pos = ( self:GetWide() - size ) / 2
-
+
self.ModelPanel:SetPos( pos, 25 )
self.ModelPanel:SetSize( size, size )
-
+
end
self:SizeToContents()
-
+
end
function PANEL:GetPadding()
@@ -124,32 +124,32 @@ function PANEL:Paint()
//draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
//draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 100 ) )
-
+
//draw.RoundedBox( 4, 10, ( self:GetTall() * 0.85 ) - 10, self:GetWide() - 20, self:GetTall() * 0.15, Color( 0, 0, 0, 255 ) )
//draw.RoundedBox( 4, 11, ( self:GetTall() * 0.85 ) - 9, self:GetWide() - 22, self:GetTall() * 0.15 - 2, Color( 150, 150, 150, 150 ) )
-
+
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 180 ) )
draw.RoundedBox( 0, 35, 40, self:GetWide() - 70, self:GetTall() - 80, Color( 80, 80, 80, 50 ) )
-
+
surface.SetDrawColor( 200, 200, 200, 200 )
surface.DrawOutlinedRect( 35, 40, self:GetWide() - 70, self:GetTall() - 80 )
-
+
draw.SimpleText( self.Title or "N/A", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
if self.Style != "Stash" then
-
+
if not self.Price or self.Price == 0 then
-
+
draw.SimpleText( "Cost: N/A", "ItemDisplayFont", self:GetWide() * 0.5, 25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
else
-
+
draw.SimpleText( "Cost: "..self.Price.." "..GAMEMODE.CurrencyName.."s", "ItemDisplayFont", self:GetWide() * 0.5, 25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
end
-
+
draw.SimpleText( self.Text or "N/A", "ItemDisplayFont", self:GetWide() * 0.5, self:GetTall() - 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/vgui/vgui_itempanel.lua b/gamemode/vgui/vgui_itempanel.lua
index d017c71..ffb4879 100644
--- a/gamemode/vgui/vgui_itempanel.lua
+++ b/gamemode/vgui/vgui_itempanel.lua
@@ -4,13 +4,13 @@ function PANEL:Init()
//self:ShowCloseButton( false )
self:SetKeyboardInputEnabled( false )
- //self:SetDraggable( true )
+ //self:SetDraggable( true )
self.FuncList = {}
-
+
self.Stashable = false
self.StashStyle = "Take"
self.PriceScale = 1
-
+
end
function PANEL:SetPriceScale( scale )
@@ -33,36 +33,36 @@ end
function PANEL:OnMousePressed()
self:MouseCapture( true )
-
+
if ( self.NextClick or 0 ) > CurTime() then
-
+
if self.StashStyle == "Buy" then
-
+
if LocalPlayer():GetNWInt( "Cash", 0 ) >= self.ItemTable.Price then
-
+
RunConsoleCommand( "inv_buy", self.ID, 1 )
GAMEMODE:AddToCart( self.ItemTable, 1 )
//SaleScreen:AddItems( self.ID, 1 )
-
+
end
-
+
end
-
+
else
-
+
GAMEMODE:SetItemToPreview( self.ID, self.StashStyle, self.PriceScale, self:GetCount() )
-
+
self.NextClick = CurTime() + 0.3
-
+
end
-
+
end
function PANEL:OnMouseReleased( mc )
self.Dragging = nil
self:MouseCapture( false )
-
+
if mc != MOUSE_RIGHT then return end
self:MouseMenu()
@@ -73,159 +73,159 @@ function PANEL:MouseMenu()
local menu = vgui.Create( "DMenu", self )
menu:AddOption( "Cancel" )
-
+
if self.Stashable then
-
+
if self.StashStyle == "Take" then
-
+
menu:AddOption( self.StashStyle, function() RunConsoleCommand( "inv_take", self.ID, 1 ) end )
-
+
if self:GetCount() > 1 then
-
+
if self:GetCount() > 3 then
-
+
local submenu = menu:AddSubMenu( "Take Multiple" )
-
+
for k,v in pairs{ 3, 5, 10, 20 } do
-
+
if self:GetCount() > v then
-
+
submenu:AddOption( "Take "..v, function() RunConsoleCommand( "inv_take", self.ID, v ) end )
-
+
end
-
+
end
-
+
end
-
+
menu:AddOption( "Take All", function() RunConsoleCommand( "inv_take", self.ID, self:GetCount() ) end )
-
+
end
-
+
menu:Open()
return
-
+
elseif self.StashStyle == "Buy" then
-
+
menu:AddOption( self.StashStyle, function() if LocalPlayer():GetNWInt( "Cash", 0 ) >= self.ItemTable.Price then
-
+
RunConsoleCommand( "inv_buy", self.ID, 1 )
GAMEMODE:AddToCart( self.ItemTable, 1 )
//SaleScreen:AddItems( self.ID, 1 )
-
+
end end )
-
+
local submenu = menu:AddSubMenu( "Buy Multiple" )
-
+
for k,v in pairs{ 3, 5, 10, 20 } do
-
+
submenu:AddOption( "Buy "..v, function() if LocalPlayer():GetNWInt( "Cash", 0 ) >= self.ItemTable.Price * v then
-
+
RunConsoleCommand( "inv_buy", self.ID, v )
GAMEMODE:AddToCart( self.ItemTable, v )
//SaleScreen:AddItems( self.ID, 1 )
-
+
end end )
-
+
end
-
+
menu:Open()
return
-
+
elseif self.StashStyle == "Sell" then
-
+
if !self.NotSellable then
-
+
menu:AddOption( self.StashStyle, function() RunConsoleCommand( "inv_sell", self.ID, 1 ) end )
-
+
if self:GetCount() > 1 then
-
+
if self:GetCount() > 3 then
-
+
local submenu = menu:AddSubMenu( "Sell Multiple" )
-
+
for k,v in pairs{ 3, 5, 10, 20 } do
-
+
if self:GetCount() > v then
-
+
submenu:AddOption( "Sell "..v, function() RunConsoleCommand( "inv_sell", self.ID, v ) end )
-
+
end
-
+
end
-
+
end
-
+
menu:AddOption( "Sell All", function() RunConsoleCommand( "inv_sell", self.ID, self:GetCount() ) end )
-
+
end
-
+
end
-
+
else
-
- menu:AddOption( self.StashStyle, function() RunConsoleCommand( "inv_store", self.ID, 1 ) end )
-
+
+ menu:AddOption( self.StashStyle, function() RunConsoleCommand( "inv_store", self.ID, 1 ) end )
+
if self:GetCount() > 1 then
-
+
if self:GetCount() > 3 then
-
+
local submenu = menu:AddSubMenu( "Stash Multiple" )
-
+
for k,v in pairs{ 3, 5, 10, 20 } do
-
+
if self:GetCount() > v then
-
+
submenu:AddOption( "Stash "..v, function() RunConsoleCommand( "inv_store", self.ID, v ) end )
-
+
end
-
+
end
-
+
end
-
+
menu:AddOption( "Stash All", function() RunConsoleCommand( "inv_store", self.ID, self:GetCount() ) end )
-
+
end
-
+
end
-
+
end
-
+
if not self.IsWeapon then
-
+
menu:AddOption( "Drop", function() RunConsoleCommand( "inv_drop", self.ID, 1 ) end )
-
+
end
-
+
if self:GetCount() > 1 and not self.IsWeapon then
-
+
if self:GetCount() > 3 then
-
+
local submenu = menu:AddSubMenu( "Drop Multiple" )
-
+
for k,v in pairs{ 3, 5, 10, 20 } do
-
+
if self:GetCount() > v then
-
+
submenu:AddOption( "Drop "..v, function() RunConsoleCommand( "inv_drop", self.ID, v ) end )
-
+
end
-
+
end
-
+
end
-
+
menu:AddOption( "Drop All", function() RunConsoleCommand( "inv_drop", self.ID, self:GetCount() ) end )
-
+
end
-
+
for k,v in pairs( self.FuncList ) do
-
+
menu:AddOption( v( 0, 0, true ), function() RunConsoleCommand( "inv_action", self.ID, k ) end )
-
+
end
-
+
menu:Open()
end
@@ -233,15 +233,15 @@ end
function PANEL:SetCount( num )
self.ItemCount = num
-
+
if num > 1 then
-
+
self:SetTitle( tostring( num ) )
-
+
else
-
+
self:SetTitle( "" )
-
+
end
end
@@ -249,7 +249,7 @@ end
function PANEL:GetCount()
return self.ItemCount or 0
-
+
end
function PANEL:AddCount( num )
@@ -261,7 +261,7 @@ end
function PANEL:GetID()
return self.ID or 0
-
+
end
function PANEL:IsStackable()
@@ -280,11 +280,11 @@ function PANEL:SetItemTable( tbl )
self.PanelModel = tbl.Model
self.ItemTable = tbl
self.ItemTable.Price = tbl.Price or 0
-
+
if tbl.Sellable != nil and tbl.Sellable == false then
-
+
self.NotSellable = true
-
+
end
end
@@ -298,31 +298,31 @@ function PANEL:SetModel( model, campos, origin )
self.ModelPanel:SetLookAt( Vector(0,0,0) )
self.ModelPanel.OnMousePressed = function( mc ) self:OnMousePressed( mc ) end
self.ModelPanel.OnMouseReleased = function( mc ) self:OnMouseReleased( mc ) end
-
+
if CamPosOverride then
-
+
campos = CamPosOverride
-
+
end
-
+
if CamOrigOverride then
-
+
origin = CamOrigOverride
-
+
end
-
+
if campos then
-
+
self.ModelPanel:SetCamPos( campos )
self.ModelPos = campos
-
+
end
-
+
if origin then
-
+
self.ModelPanel:SetLookAt( origin )
self.ModelOrigin = origin
-
+
end
end
@@ -334,35 +334,35 @@ function PANEL:SetSizeOverride( size )
end
function PANEL:PerformLayout()
-
+
if self.ModelPanel then
-
+
self.ModelPanel:SetPos( self:GetPadding(), self:GetPadding() )
-
+
if self.SizeOverride then
-
+
self.ModelPanel:SetSize( self.SizeOverride - 2, self.SizeOverride - 2 )
-
+
else
-
+
self.ModelPanel:SetSize( 62, 62 )
-
+
end
-
+
end
self:SizeToContents()
-
+
if self.SizeOverride then
-
+
self:SetSize( self.SizeOverride, self.SizeOverride )
-
+
else
-
+
self:SetSize( 64, 64 )
-
+
end
-
+
end
function PANEL:Paint()
@@ -374,28 +374,28 @@ function PANEL:Paint()
end
//if self.SizeOverride then
-
+
draw.RoundedBox( 0, 3, 3, self:GetWide() - 6, self:GetTall() - 6, Color( 80, 80, 80, 50 ) )
-
+
if self.StashStyle == "Buy" then
-
+
if LocalPlayer():GetNWInt( "Cash", 0 ) >= self.ItemTable.Price then
-
+
surface.SetDrawColor( 100, 200, 100, 200 )
-
+
else
-
+
surface.SetDrawColor( 200, 100, 100, 200 )
-
+
end
-
+
else
-
+
surface.SetDrawColor( 200, 200, 200, 200 )
-
+
end
-
-
+
+
surface.DrawOutlinedRect( 3, 3, self:GetWide() - 6, self:GetTall() - 6 )
diff --git a/gamemode/vgui/vgui_panelbase.lua b/gamemode/vgui/vgui_panelbase.lua
index b7a4d19..83bbc0b 100644
--- a/gamemode/vgui/vgui_panelbase.lua
+++ b/gamemode/vgui/vgui_panelbase.lua
@@ -4,11 +4,11 @@ function PANEL:Init()
//self:SetTitle( "" )
self:ChooseParent()
-
+
end
function PANEL:ChooseParent()
-
+
end
function PANEL:OnMousePressed( mc )
@@ -21,15 +21,15 @@ end
function PANEL:Think()
if self.Dragging then
-
+
local x = gui.MouseX() - self.Dragging[1]
local y = gui.MouseY() - self.Dragging[2]
-
+
x = math.Clamp( x, 0, ScrW() - self:GetWide() )
y = math.Clamp( y, 0, ScrH() - self:GetTall() )
-
+
self:SetPos( x, y )
-
+
end
end
@@ -66,11 +66,11 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
-
+
if self.Title then
-
+
draw.SimpleText( self.Title, "ItemDisplayFont", 5, 5, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
end
diff --git a/gamemode/vgui/vgui_panelsheet.lua b/gamemode/vgui/vgui_panelsheet.lua
index 38771ed..7bb67fc 100644
--- a/gamemode/vgui/vgui_panelsheet.lua
+++ b/gamemode/vgui/vgui_panelsheet.lua
@@ -7,7 +7,7 @@ function PANEL:Init()
self.StashStyle = "Stash"
self.PriceScale = 1
self.Categories = {}
-
+
self:SetDraggableName( "GlobalDPanel" );
self.pnlCanvas = vgui.Create( "DPanel", self )
@@ -16,13 +16,13 @@ function PANEL:Init()
self.pnlCanvas.OnChildRemoved = function() self:OnChildRemoved() end
self.pnlCanvas:SetMouseInputEnabled( true )
self.pnlCanvas.InvalidateLayout = function() self:InvalidateLayout() end
-
+
self.Items = {}
self.YOffset = 0
self.m_fAnimTime = 0;
self.m_fAnimEase = -1; -- means ease in out
self.m_iBuilds = 0
-
+
self:SetSpacing( 0 )
self:SetPadding( 0 )
self:EnableHorizontal( false )
@@ -30,53 +30,53 @@ function PANEL:Init()
self:SetDrawBackground( true )
//self:SetBottomUp( false )
self:SetNoSizing( false )
-
+
self:SetMouseInputEnabled( true )
-
+
-- This turns off the engine drawing
self:SetPaintBackgroundEnabled( false )
self:SetPaintBorderEnabled( false )
-
+
self.ScrollAmt = 0
-
+
end
function PANEL:ToggleVisible( tbl, bool )
if bool then
-
+
local newtbl = {}
-
+
for k,v in pairs( self.Categories ) do // remove all of tbl from categories
-
+
if not table.HasValue( tbl, v ) then
-
+
table.insert( newtbl, v )
-
+
end
-
+
end
-
+
self.Categories = newtbl
-
+
else
-
+
for k,v in pairs( tbl ) do // insert all of tbl into categories
-
+
if not table.HasValue( self.Categories, v ) then
-
+
table.insert( self.Categories, v )
-
+
end
-
+
end
-
+
end
end
function PANEL:ChooseParent()
-
+
end
function PANEL:SetPriceScale( scale )
@@ -90,12 +90,12 @@ function PANEL:SetStashable( bool, style, localinv )
self.Stashable = bool
self.StashStyle = style
self.IsLocalInv = localinv
-
+
for k,v in pairs( self:GetItems() ) do
-
+
v:SetPriceScale( self.PriceScale )
v:SetStashable( bool, style )
-
+
end
end
@@ -109,13 +109,13 @@ end
function PANEL:HasItem( id )
for k,v in pairs( self:GetItems() ) do
-
+
if v:GetID() == id then
-
+
return v
-
+
end
-
+
end
end
@@ -123,12 +123,12 @@ end
function PANEL:GetItemPnlSize() // determine the size of item panels, always needs to add up to 1.0
--[[if self.StashStyle == "Buy" then
-
+
return ( self:GetWide() * 0.2 )
-
+
end]]
- return ( self:GetWide() * 0.25 )
+ return ( self:GetWide() * 0.25 )
end
@@ -136,7 +136,7 @@ function PANEL:IsBlacklisted( id )
local tbl = item.GetByID( id )
local cat = tbl.Type
-
+
return table.HasValue( self.Categories, cat )
end
@@ -144,114 +144,114 @@ end
function PANEL:RefreshItems( tbl )
self:Clear( true )
-
+
for k,v in pairs( tbl ) do
-
+
local pnl = self:HasItem( v )
-
+
if pnl and pnl:IsStackable() then
-
+
pnl:AddCount( 1 )
-
+
elseif not self:IsBlacklisted( v ) then
-
+
local pnl = vgui.Create( "ItemPanel" )
pnl:SetItemTable( item.GetByID( v ) )
pnl:SetCount( 1 )
pnl:SetPriceScale( self.PriceScale )
pnl:SetStashable( self.Stashable, self.StashStyle )
pnl:SetSizeOverride( self:GetItemPnlSize() ) //bigg0r
-
+
self:AddItem( pnl )
-
+
end
-
+
end
-
+
if #tbl < 1 then
-
+
self:InvalidateLayout()
-
+
end
-
+
if self.StashButton then
-
+
self.StashButton:Remove()
self.StashButton = nil
-
+
end
-
+
if self.CashBox then
-
+
self.CashBox:Remove()
self.CashBox = nil
-
+
end
-
+
if self.CashButton then
-
+
self.CashButton:Remove()
self.CashButton = nil
-
+
end
-
+
if self.StashStyle != "Buy" then
-
+
self.CashBox = vgui.Create( "DNumberWang", self )
self.CashBox:SetDecimals( 0 )
self.CashBox:SetValue( math.max( self:GetCash(), 5 ) )
self.CashBox:SetMinMax( 5, math.max( self:GetCash(), 5 ) )
self.CashBox:SetWide( 80 )
-
+
self.CashButton = vgui.Create( "DButton", self )
-
+
if self.StashStyle == "Take" then
-
+
self.CashButton:SetText( self.StashStyle )
self.CashButton.OnMousePressed = function()
-
+
RunConsoleCommand( "cash_take", math.min( tonumber( self.CashBox:GetValue() ) or 0, self:GetCash() ) )
-
+
end
-
+
elseif self.StashStyle == "Stash" and self.Stashable then
-
+
self.CashButton:SetText( self.StashStyle )
self.CashButton.OnMousePressed = function()
-
+
RunConsoleCommand( "cash_stash", math.min( tonumber( self.CashBox:GetValue() ) or 0, self:GetCash() ) )
-
+
end
-
+
else
-
+
self.CashButton:SetText( "Drop" )
self.CashButton.OnMousePressed = function()
-
+
RunConsoleCommand( "cash_drop", math.min( tonumber( self.CashBox:GetValue() ) or 0, self:GetCash() ) )
-
+
end
-
+
end
-
+
end
-
+
if ( self.StashStyle == "Stash" or self.StashStyle == "Take" ) and not self.IsLocalInv and #self:GetItems() > 0 then
-
+
self.StashButton = vgui.Create( "DButton", self )
self.StashButton:SetText( "Take All" )
self.StashButton.OnMousePressed = function()
-
+
if #self:GetItems() < 1 then return end
for k,v in pairs( self:GetItems() ) do
-
+
RunConsoleCommand( "inv_take", v:GetID(), v:GetCount() )
-
+
end
-
+
end
-
+
end
end
@@ -261,26 +261,26 @@ function PANEL:Think()
if self.CashBox then
if self:GetCash() < 5 then
-
+
self.CashBox:SetMinMax( 5, 5 )
self.CashBox:SetValue( 5 )
self.CashButton:SetDisabled( true )
-
+
else
-
+
self.CashBox:SetMinMax( 5, math.max( self:GetCash(), 5 ) )
self.CashButton:SetDisabled( false )
-
+
end
-
+
end
end
function PANEL:AddScroll( amt )
-
+
self.ScrollAmt = self.ScrollAmt + amt
-
+
self.pnlCanvas:SetPos( 0, self.ScrollAmt * self:GetItemPnlSize() )
end
@@ -294,16 +294,16 @@ end
function PANEL:PerformLayout()
local wide = self:GetWide()
-
+
if ( !self.Rebuild ) then
debug.Trace()
end
-
+
self:Rebuild()
self.pnlCanvas:SetPos( 0, self.ScrollAmt * self:GetItemPnlSize() )
self.pnlCanvas:SetWide( wide )
-
+
self:Rebuild()
end
@@ -311,40 +311,40 @@ end
function PANEL:Rebuild()
local Offset = 0
-
+
if ( self.Horizontal ) then
-
+
local x, y = self.Padding, self.Padding
-
+
for k, panel in pairs( self.Items ) do
-
+
if ( panel:IsVisible() ) then
-
+
local w = self:GetItemPnlSize()
local h = self:GetItemPnlSize()
-
+
if ( x + w > self:GetWide() ) then // move down
-
+
x = self.Padding
y = y + h + self.Spacing
-
+
end
-
+
panel:SetPos( x, y )
-
+
x = x + w + self.Spacing
Offset = y + h + self.Spacing
-
+
end
-
+
end
-
+
else
-
+
for k, panel in pairs( self.Items ) do
-
+
if ( panel:IsVisible() ) then
-
+
if ( self.m_bNoSizing ) then
panel:SizeToContents()
panel:SetPos( (self:GetCanvas():GetWide() - panel:GetWide()) * 0.5, self.Padding + Offset )
@@ -352,60 +352,60 @@ function PANEL:Rebuild()
panel:SetSize( self:GetCanvas():GetWide() - self.Padding * 2, panel:GetTall() )
panel:SetPos( self.Padding, self.Padding + Offset )
end
-
+
panel:InvalidateLayout( true )
-
+
Offset = Offset + panel:GetTall() + self.Spacing
-
+
end
-
+
end
-
+
Offset = Offset + self.Padding
-
+
end
-
- self:GetCanvas():SetTall( self:GetTall() + Offset - self.Spacing )
+
+ self:GetCanvas():SetTall( self:GetTall() + Offset - self.Spacing )
if ( self.m_bNoSizing and self:GetCanvas():GetTall() < self:GetTall() ) then
self:GetCanvas():SetPos( 0, (self:GetTall()-self:GetCanvas():GetTall()) * 0.5 )
-
+
end
-
+
if self.StashButton then
-
+
self.StashButton:SetSize( 48, 20 )
self.StashButton:SetPos( self:GetWide() - self:GetPadding() * 2 - self.StashButton:GetWide(), self:GetTall() - self:GetPadding() * 2 - self.StashButton:GetTall() )
-
+
end
-
+
if self.CashBox then
-
+
self.CashBox:SetPos( self:GetPadding() * 2, self:GetTall() - ( self:GetPadding() * 2 ) - 20 )
-
+
end
-
+
if self.CashButton then
-
+
self.CashButton:SetSize( 48, 20 )
self.CashButton:SetPos( ( self:GetPadding() * 2 ) + 5 + self.CashBox:GetWide(), self:GetTall() - ( self:GetPadding() * 2 ) - 20 )
-
+
end
-
+
end
function PANEL:Paint()
//draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
//draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 100 ) )
-
+
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 180 ) )
-
+
if self.StashStyle == "Buy" then return end
-
+
draw.SimpleText( "Cash: $" .. self:GetCash(), "ItemDisplayFont", self:GetPadding() * 2, self:GetTall() - ( self:GetPadding() * 2 ) - 35, Color( 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
//draw.TexturedQuad( { texture = surface.GetTextureID( "radbox/menu_trade" ), x = self:GetPadding() * 2, y = self:GetTall() - ( self:GetPadding() * 2 ) - 40, w = 40, h = 40, color = Color( 200, 200, 200 ) } )
end
diff --git a/gamemode/vgui/vgui_playerdisplay.lua b/gamemode/vgui/vgui_playerdisplay.lua
index b508efb..99cc7d4 100644
--- a/gamemode/vgui/vgui_playerdisplay.lua
+++ b/gamemode/vgui/vgui_playerdisplay.lua
@@ -4,43 +4,43 @@ function PANEL:Init()
//self:ShowCloseButton( false )
self:SetKeyboardInputEnabled( false )
- //self:SetDraggable( false )
-
- self.Text = ""
+ //self:SetDraggable( false )
+
+ self.Text = ""
self.Title = ""
- self.LastModel = ""
-
+ self.LastModel = ""
+
end
function PANEL:SetupCam( campos, origin )
self.CamPos = campos
self.Origin = origin
-
+
end
function PANEL:SetModel( campos, origin )
if not self.ModelPanel then
-
+
self.ModelPanel = vgui.Create( "GoodModelPanel", self )
-
+
end
-
+
self.ModelPanel:SetModel( LocalPlayer():GetModel() )
-
+
if campos then
-
+
self.ModelPanel:SetCamPos( campos )
-
+
end
-
+
if origin then
-
+
self.ModelPanel:SetLookAt( origin )
-
+
end
-
+
self:InvalidateLayout()
end
@@ -50,28 +50,28 @@ function PANEL:Think()
if not IsValid( LocalPlayer() ) then return end
if self.LastModel != LocalPlayer():GetModel() then
-
+
self:SetModel( self.CamPos, self.Origin )
self.LastModel = LocalPlayer():GetModel()
-
+
end
end
function PANEL:PerformLayout()
-
+
if self.ModelPanel then
-
+
local size = math.Min( self:GetWide(), self:GetTall() * 0.85 )
local pos = ( self:GetWide() - size ) / 2
-
+
self.ModelPanel:SetPos( pos, 0 )
self.ModelPanel:SetSize( size, size )
-
+
end
self:SizeToContents()
-
+
end
function PANEL:GetStats()
@@ -79,67 +79,67 @@ function PANEL:GetStats()
local tbl = {}
local weight = math.Round( LocalPlayer():GetNWFloat( "Weight", 0 ) * 100 ) / 100
local cash = LocalPlayer():GetNWInt( "Cash", 0 )
-
+
if cash < 20 then
-
+
table.insert( tbl, { GAMEMODE.CurrencyName .. "s: " .. cash, Color(255,150,50) } )
-
+
else
-
+
table.insert( tbl, { GAMEMODE.CurrencyName .. "s: " .. cash, Color(255,255,255) } )
-
+
end
-
+
if weight < GAMEMODE.OptimalWeight then
-
+
table.insert( tbl, { "Weight: " .. weight .. " lbs", Color(255,255,255) } )
-
+
elseif weight < GAMEMODE.MaxWeight then
-
+
table.insert( tbl, { "Weight: " .. weight .. " lbs", Color(255,150,50) } )
-
+
else
-
+
table.insert( tbl, { "Weight: " .. weight .. " lbs", Color(255,100,100) } )
-
+
end
-
+
if LocalPlayer():GetNWBool( "Infected", false ) then
-
+
table.insert( tbl, { "Health Status: Infected", Color(255,100,100) } )
-
+
elseif LocalPlayer():GetNWBool( "Bleeding", false ) then
-
+
table.insert( tbl, { "Health Status: Bleeding", Color(255,100,100) } )
-
+
elseif LocalPlayer():Health() < 75 then
-
+
table.insert( tbl, { "Health Status: Critical", Color(255,100,100) } )
-
+
elseif LocalPlayer():Health() < 140 then
-
+
table.insert( tbl, { "Health Status: Injured", Color(255,150,50) } )
-
+
else
-
+
table.insert( tbl, { "Health Status: Normal", Color(255,255,255) } )
-
+
end
-
+
if LocalPlayer():GetNWInt( "Radiation", 0 ) > 2 then
-
+
table.insert( tbl, { "Radiation Levels: Lethal", Color(255,100,100) } )
-
+
elseif LocalPlayer():GetNWInt( "Radiation", 0 ) > 0 then
-
+
table.insert( tbl, { "Radiation Levels: Elevated", Color(255,150,50) } )
-
+
else
-
+
table.insert( tbl, { "Radiation Levels: Normal", Color(255,255,255) } )
-
+
end
-
+
return tbl
end
@@ -150,15 +150,15 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 100 ) )
-
+
surface.SetFont( "ItemDisplayFont" )
-
+
for k,v in pairs( self:GetStats() ) do
-
+
draw.SimpleText( v[1], "ItemDisplayFont", self:GetWide() * 0.5, self:GetTall() * 0.83 + ( ( k - 1 ) * 15 ), v[2], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
-
+
end
-
+
draw.SimpleText( LocalPlayer():Name(), "ItemDisplayFont", self:GetWide() * 0.5, 15, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/vgui/vgui_playerpanel.lua b/gamemode/vgui/vgui_playerpanel.lua
index 9779466..910905f 100644
--- a/gamemode/vgui/vgui_playerpanel.lua
+++ b/gamemode/vgui/vgui_playerpanel.lua
@@ -3,23 +3,23 @@ local PANEL = {}
function PANEL:Init()
//self:ShowCloseButton( false )
-
+
self.Avatar = vgui.Create( "AvatarImage", self )
self.PlayerName = "N/A"
self.Desc = ""
-
+
self:PerformLayout()
-
+
end
function PANEL:SetPlayerEnt( ply )
self.Avatar:SetPlayer( ply )
-
+
if IsValid( ply ) then
-
+
self.PlayerName = ply:Nick()
-
+
end
end
@@ -43,24 +43,24 @@ function PANEL:GetPadding()
end
function PANEL:PerformLayout()
-
+
self.Avatar:SetSize( 16, 16 )
self.Avatar:SetPos( self:GetPadding(), self:GetPadding() )
-
+
self:SetTall( 16 + self:GetPadding() * 2 )
-
+
end
function PANEL:Paint()
draw.RoundedBox( 4, 2, 2, self:GetWide() - 4, self:GetTall() - 4, Color( 100, 100, 100, 255 ) )
-
+
draw.SimpleText( self.PlayerName .. " " .. self.Desc, "EndGame", self:GetPadding() * 3 + 16, self:GetTall() * 0.4 - self:GetPadding(), Color( 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT )
-
+
if self.Count then
-
+
draw.SimpleText( self.Count, "EndGame", self:GetWide() - self:GetPadding() * 2, self:GetTall() * 0.4 - self:GetPadding(), Color( 255, 50, 50 ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_RIGHT )
-
+
end
end
diff --git a/gamemode/vgui/vgui_scroller.lua b/gamemode/vgui/vgui_scroller.lua
index 0fb9e51..0730753 100644
--- a/gamemode/vgui/vgui_scroller.lua
+++ b/gamemode/vgui/vgui_scroller.lua
@@ -5,26 +5,26 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
//self:SetDraggable( false )
-
+
self.Image = vgui.Create( "DImageButton", self )
self.Image:SetImage( "icon16/car.png" )
self.Image:SetStretchToFit( false )
self.Image.OnMousePressed = function()
-
+
self.Depressed = true
-
+
end
-
+
self.Image.OnMouseReleased = function()
-
+
self.Depressed = false
-
+
end
-
+
self:SetCursor( "hand" )
self.Up = true
self.MoveTime = 0
-
+
end
function PANEL:SetImage( img )
@@ -42,23 +42,23 @@ end
function PANEL:Think()
if not self.Target then return end
-
+
if self.Depressed and self.MoveTime < CurTime() then
-
+
self.MoveTime = CurTime() + 0.2
-
+
if self.Up then
-
+
self.Target:AddScroll( 1 )
-
+
else
-
+
self.Target:AddScroll( -1 )
-
+
end
-
+
surface.PlaySound( "buttons/lightswitch2.wav" )
-
+
end
end
@@ -91,7 +91,7 @@ function PANEL:PerformLayout()
self.Image:SetSize( self:GetWide() - 10, self:GetTall() - 10 )
self.Image:SetPos( 5, 5 )
-
+
//self:SizeToContents()
end
diff --git a/gamemode/vgui/vgui_shopmenu.lua b/gamemode/vgui/vgui_shopmenu.lua
index 99a201e..beb18dd 100644
--- a/gamemode/vgui/vgui_shopmenu.lua
+++ b/gamemode/vgui/vgui_shopmenu.lua
@@ -5,44 +5,44 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
//self:SetDraggable( false )
-
+
self.Items = {}
-
+
self.List = vgui.Create( "DListView", self )
-
+
local col1 = self.List:AddColumn( "Ordered Item" )
local col2 = self.List:AddColumn( "Cost" )
-
+
col1:SetMinWidth( 150 )
col2:SetMinWidth( 50 )
col2:SetMaxWidth( 100 )
-
+
self.Button = vgui.Create( "DImageButton", self )
self.Button:SetImage( "toxsin/airdrop" )
self.Button.OnMousePressed = function() self.List:Clear() self.Items = {} RunConsoleCommand( "ordershipment" ) RunConsoleCommand( "gm_showteam" ) end
-
+
end
function PANEL:AddItems( id, amt )
local tbl = item.GetByID( id )
-
+
if tbl.Price * amt > LocalPlayer():GetNWInt( "Cash", 0 ) then return end
for i=1,amt do
-
+
table.insert( self.Items, id )
-
+
end
-
+
self.List:Clear()
-
+
for k,v in pairs( self.Items ) do
-
+
local tbl = item.GetByID( v )
-
+
self.List:AddLine( tbl.Name, tbl.Price )
-
+
end
end
@@ -54,13 +54,13 @@ end
function PANEL:PerformLayout()
local x,y = self:GetPadding(), self:GetPadding() + 30
-
+
self.List:SetSize( self:GetWide() * 0.5 - ( 2 * self:GetPadding() ), self:GetTall() - ( 2 * self:GetPadding() ) - 30 )
self.List:SetPos( x, y )
self.Button:SetSize( self:GetWide() * 0.5 - ( 2 * self:GetPadding() ), self:GetTall() - ( 2 * self:GetPadding() ) - 30 )
self.Button:SetPos( x + self.List:GetWide() + self:GetPadding(), self:GetPadding() + 30 )
-
+
self:SizeToContents()
end
@@ -69,7 +69,7 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
-
+
draw.SimpleText( "Shipment Display", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/vgui/vgui_sidebutton.lua b/gamemode/vgui/vgui_sidebutton.lua
index f7de0e6..03d4332 100644
--- a/gamemode/vgui/vgui_sidebutton.lua
+++ b/gamemode/vgui/vgui_sidebutton.lua
@@ -7,21 +7,21 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
//self:SetDraggable( false )
-
+
self.Image = vgui.Create( "DImageButton", self )
self.Image:SetImage( "icon16/car.png" )
self.Image:SetStretchToFit( false )
self.Image.DoClick = function()
-
+
self:DoClick()
-
+
end
-
+
self:SetCursor( "hand" )
self.Text = ""
self.White = 255
self.ColorTime = 0
-
+
end
function PANEL:SetImage( img )
@@ -43,7 +43,7 @@ function PANEL:DoClick()
end
-function PANEL:SetFunction( func )
+function PANEL:SetFunction( func )
self.Func = func
@@ -52,9 +52,9 @@ end
function PANEL:SetSelectedState( bool, ignore )
self.Selected = tobool( bool )
-
+
if ignore then return end
-
+
self:DoSound( bool )
end
@@ -82,7 +82,7 @@ function PANEL:PerformLayout()
self.Image:SetSize( imgsize, imgsize )
self.Image:SetPos( self:GetWide() - imgsize - self:GetPadding(), self:GetPadding() )
-
+
//self:SizeToContents()
end
@@ -94,36 +94,36 @@ function PANEL:Paint()
local imgsize = self:GetTall() - ( 2 * self:GetPadding() )
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 180 ) )
-
+
if self.Hovered then
-
+
draw.RoundedBox( 4, self:GetWide() - imgsize - self:GetPadding(), self:GetPadding(), imgsize, imgsize, Color( 100, 100, 100, 100 ) )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
-
+
if self.ColorTime < CurTime() then
-
+
self.ColorTime = CurTime() + math.Rand( 0, 0.3 )
self.White = math.random( 150, 255 )
-
+
end
-
+
draw.SimpleText( self.Text, "CategoryButton", tx, ty, Color( self.White, self.White, self.White, 255 ), TEXT_ALIGN_LEFT )
-
+
else
draw.RoundedBox( 4, self:GetWide() - imgsize - self:GetPadding(), self:GetPadding(), imgsize, imgsize, Color( 100, 100, 100, 100 ) )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx+1, ty-1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
draw.SimpleText( self.Text, "CategoryButton", tx-1, ty+1, Color( 0, 0, 0, 150 ), TEXT_ALIGN_LEFT )
-
+
draw.SimpleText( self.Text, "CategoryButton", tx, ty, Color( 100, 100, 100, 255 ), TEXT_ALIGN_LEFT )
-
+
end
end
diff --git a/gamemode/vgui/vgui_zombieclasses.lua b/gamemode/vgui/vgui_zombieclasses.lua
index 057c1b6..33c08bd 100644
--- a/gamemode/vgui/vgui_zombieclasses.lua
+++ b/gamemode/vgui/vgui_zombieclasses.lua
@@ -5,14 +5,14 @@ function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
self:ChooseParent()
-
+
self.Items = {}
-
+
for k,v in pairs( GAMEMODE.ZombieNames ) do
local desc = GAMEMODE.ZombieDescriptions[k] or "TEH"
local logo = GAMEMODE.ZombieLogos[k] or "brick/brick_model"
-
+
local button = vgui.Create( "DImageButton", self )
button:SetImage( logo )
button:SetSize( 100, 100 )
@@ -24,11 +24,11 @@ function PANEL:Init()
label:SetText( desc )
label:SetFont( "ItemDisplayFont" )
label:SetSize( 300, 100 )
-
+
table.insert( self.Items, { button, label } )
-
+
end
-
+
end
function PANEL:Think()
@@ -38,13 +38,13 @@ function PANEL:Think()
end
function PANEL:ChooseParent()
-
+
end
function PANEL:GetPadding()
return 5
-
+
end
function PANEL:PerformLayout()
@@ -52,14 +52,14 @@ function PANEL:PerformLayout()
local x,y = self:GetPadding(), self:GetPadding() + 50
for k,v in pairs( self.Items ) do
-
+
v[1]:SetPos( x, y )
v[2]:SetPos( x + 100 + self:GetPadding(), y )
-
+
y = y + 100 + self:GetPadding()
-
+
end
-
+
self:SizeToContents()
end
@@ -68,7 +68,7 @@ function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
-
+
draw.SimpleText( "Class Menu", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
diff --git a/gamemode/weather.lua b/gamemode/weather.lua
index 762ebd5..4ee0aab 100644
--- a/gamemode/weather.lua
+++ b/gamemode/weather.lua
@@ -10,24 +10,24 @@ GM.Weather.New = {}
GM.Weather.New.Rain = 0
GM.Weather.New.Thunder = 0
GM.Weather.New.Lightning = 0
-GM.Weather.New.Wind = 0
+GM.Weather.New.Wind = 0
function GM:EntityKeyValue( ent, key, val )
-
+
if ent:GetClass() == "worldspawn" and key == "skyname" then
-
+
SetGlobalString( "SkyName", val )
-
+
end
-
+
end
function GM:WeatherInit()
if CLIENT then
-
+
RainEmitter = ParticleEmitter( Vector(0,0,0) )
-
+
end
end
@@ -35,25 +35,25 @@ end
function GM:PlayerIndoors( ply )
if SERVER then
-
+
return ply:IsIndoors()
-
+
else
-
+
local tr = util.TraceLine( util.GetPlayerTrace( LocalPlayer(), Vector(0,0,1) ) )
-
- if tr.HitWorld and not tr.HitSky then
-
- GAMEMODE.PlayerIsIndoors = true
-
- return true
-
+
+ if tr.HitWorld and not tr.HitSky then
+
+ GAMEMODE.PlayerIsIndoors = true
+
+ return true
+
end
-
+
end
-
+
GAMEMODE.PlayerIsIndoors = false
-
+
return false
end
@@ -68,50 +68,50 @@ function GM:RandomizeWeather( force )
if math.random(1,5) == 1 and not force then
GAMEMODE:SynchWeather()
-
- return {0,0,0,0}
-
+
+ return {0,0,0,0}
+
end
-
+
for k,v in pairs( GAMEMODE.Weather.New ) do
-
+
if math.random(1,5) > 1 then
-
+
GAMEMODE.Weather.New[k] = math.Rand(0,1)
-
+
if math.random(1,3) == 1 then
-
+
GAMEMODE.Weather.New[k] = 1
-
+
end
-
+
end
-
+
end
-
+
local count = 0
-
+
for k,v in pairs( GAMEMODE.Weather.New ) do
-
+
if v == 0 then
-
+
count = count + 1
-
+
end
-
+
end
-
+
if count == 4 or math.random(1,10) == 1 then
-
+
GAMEMODE.Weather.New.Rain = 1
GAMEMODE.Weather.New.Thunder = 1
GAMEMODE.Weather.New.Lightning = 1
GAMEMODE.Weather.New.Wind = 1
-
+
end
-
+
GAMEMODE:SynchWeather()
-
+
return { GAMEMODE.Weather.New.Rain, GAMEMODE.Weather.New.Thunder, GAMEMODE.Weather.New.Lightning, GAMEMODE.Weather.New.Wind }
end
@@ -122,9 +122,9 @@ function GM:ManualWeather( rain, thunder, lightning, wind )
GAMEMODE.Weather.New.Thunder = thunder
GAMEMODE.Weather.New.Lightning = lightning
GAMEMODE.Weather.New.Wind = wind
-
+
GAMEMODE.Weather.NextShift = CurTime() + math.random( 240, 480 )
-
+
GAMEMODE:SynchWeather()
end
@@ -132,19 +132,19 @@ end
function GM:ShiftWeather()
for k,v in pairs( GAMEMODE.Weather.New ) do
-
+
if v < 0.2 and math.random(1,2) == 1 then
-
+
GAMEMODE.Weather.New[k] = 0
-
+
else
-
+
GAMEMODE.Weather.New[k] = math.Clamp( v + math.Rand( -0.2, math.Rand( 0.2, 0.3 ) ), 0, 1 )
-
+
end
-
+
end
-
+
GAMEMODE:SynchWeather()
end
@@ -152,15 +152,15 @@ end
function GM:WeatherThink()
if not GAMEMODE.Weather.NextShift then
-
+
GAMEMODE.Weather.NextShift = CurTime() + math.random( 120, 600 )
-
+
elseif GAMEMODE.Weather.NextShift < CurTime() then
-
+
GAMEMODE.Weather.NextShift = nil
-
+
GAMEMODE:ShiftWeather()
-
+
end
end
@@ -168,9 +168,9 @@ end
function GM:SynchWeather()
net.Start( "WeatherSynch" )
-
+
net.WriteTable( GAMEMODE.Weather.New )
-
+
net.Broadcast()
end
@@ -182,9 +182,9 @@ net.Receive( "WeatherSynch", function( len )
GAMEMODE.Weather.New = net.ReadTable()
GAMEMODE.Weather.Transition = true
GAMEMODE.Weather.Inc = 0
-
+
//PrintTable( GAMEMODE.Weather.New )
-
+
end )
function GM:ProcessWeather()
@@ -195,37 +195,37 @@ function GM:ProcessWeather()
GAMEMODE:WindThink()
if GAMEMODE.Weather.Transition then
-
+
//local scale = 1 - ( ( GAMEMODE.Weather.Transition - CurTime() ) / GAMEMODE.Weather.TransitionTime )
-
+
if GAMEMODE.Weather.Inc <= CurTime() then
-
+
GAMEMODE.Weather.Inc = CurTime() + 1
local count = 0
-
- for k,v in pairs( GAMEMODE.Weather.New ) do
-
+
+ for k,v in pairs( GAMEMODE.Weather.New ) do
+
local diff = math.abs( GAMEMODE.Weather[k] - GAMEMODE.Weather.New[k] )
local inc = diff / GAMEMODE.Weather.TransitionTime
-
+
GAMEMODE.Weather[k] = math.Approach( GAMEMODE.Weather[k], GAMEMODE.Weather.New[k], inc )
-
+
if GAMEMODE.Weather[k] == GAMEMODE.Weather.New[k] then
-
+
count = count + 1
-
+
end
-
+
end
-
+
if count == 4 then
-
+
GAMEMODE.Weather.Transition = false
-
+
end
-
+
end
-
+
end
end
@@ -235,17 +235,17 @@ RainMat = surface.GetTextureID( "effects/rain_warp" )
function GM:PaintWeather()
if GAMEMODE.Weather.Rain > 0 and render.GetDXLevel() >= 90 then
-
+
for k,v in pairs( GAMEMODE.RainDrops ) do
-
+
local scale = math.Clamp( ( v.Time - CurTime() ) / v.Life, 0, 1 )
-
+
surface.SetDrawColor( 200, 200, 220, 255 * scale )
surface.SetTexture( RainMat )
surface.DrawTexturedRect( v.X, v.Y - v.Movement * scale, v.Size, v.Size )
-
+
end
-
+
end
end
@@ -253,26 +253,26 @@ end
function GM:GetSky()
local tr = util.TraceLine( util.GetPlayerTrace( LocalPlayer(), Vector(0,0,1) ) )
-
+
if tr.HitSky then
-
+
GAMEMODE.LastSkyPos = tr.HitPos
GAMEMODE.PlayerIsIndoors = false
-
+
GAMEMODE:ComputeSkyBounds()
-
+
return tr.HitPos
-
+
elseif GAMEMODE.LastSkyPos then
-
+
GAMEMODE.PlayerIsIndoors = true
-
+
return GAMEMODE.LastSkyPos
-
+
else
-
- return LocalPlayer():GetPos()
-
+
+ return LocalPlayer():GetPos()
+
end
end
@@ -285,29 +285,29 @@ function GM:ComputeSkyBounds()
local trace = {}
trace.start = GAMEMODE.LastSkyPos
trace.endpos = trace.start + Vector( GAMEMODE.RainDist, 0, 0 )
-
+
local tr = util.TraceLine( trace )
-
+
trace = {}
trace.start = tr.HitPos
trace.endpos = trace.start + Vector( 0, GAMEMODE.RainDist, 0 )
-
+
tr = util.TraceLine( trace )
-
+
GAMEMODE.RightSkyBound = tr.HitPos
-
+
trace = {}
trace.start = GAMEMODE.LastSkyPos
trace.endpos = trace.start + Vector( GAMEMODE.RainDist * -1, 0, 0 )
-
+
tr = util.TraceLine( trace )
-
+
trace = {}
trace.start = tr.HitPos
trace.endpos = trace.start + Vector( 0, GAMEMODE.RainDist * -1, 0 )
-
+
tr = util.TraceLine( trace )
-
+
GAMEMODE.LeftSkyBound = tr.HitPos
end
@@ -316,17 +316,17 @@ function GM:GetClosestSkyPos()
local skypos = GAMEMODE:GetSky()
local pos = LocalPlayer():GetPos()
-
+
local trace = {}
trace.start = skypos
trace.endpos = Vector( pos.x, pos.y, skypos.z )
-
+
local tr = util.TraceLine( trace )
-
+
GAMEMODE.LastSkyPos = tr.HitPos
-
+
GAMEMODE:ComputeSkyBounds()
-
+
return tr.HitPos
end
@@ -336,78 +336,78 @@ GM.RainSound = Sound( "ambient/weather/rumble_rain_nowind.wav" )
function GM:RainThink()
for k,v in pairs( GAMEMODE.RainDrops ) do
-
+
if v.Time < CurTime() then
-
+
table.remove( GAMEMODE.RainDrops, k )
-
+
break
-
+
end
-
+
end
if GAMEMODE.Weather.Rain > 0 and ( GAMEMODE.NextRainDrop or 0 ) < CurTime() and not GAMEMODE.PlayerIsIndoors then
-
+
GAMEMODE.NextRainDrop = CurTime() + math.Rand( 1 - GAMEMODE.Weather.Rain, ( 1.2 - GAMEMODE.Weather.Rain ) * 3 )
-
+
for i=1, math.random( 1, math.floor( GAMEMODE.Weather.Rain * 4 ) ) do
-
+
local tbl = {}
-
+
tbl.Size = math.random( 40, 80 ) + math.random( 0, GAMEMODE.Weather.Rain * 20 )
tbl.X = math.random( 0, ScrW() - tbl.Size )
tbl.Y = math.random( 0, ScrH() - tbl.Size )
tbl.Movement = math.random( 20, 80 )
tbl.Life = math.Rand( 1.0, 5.0 )
tbl.Time = CurTime() + tbl.Life
-
+
if math.random(1,5) == 1 then
-
+
tbl.Movement = 10
-
+
end
-
+
table.insert( GAMEMODE.RainDrops, tbl )
-
+
end
-
+
end
if ( GAMEMODE.NextRain or 0 ) < CurTime() then
-
+
GAMEMODE.NextRain = CurTime() + 0.2
-
+
local amt = math.floor( GAMEMODE.Weather.Rain * 175 * CV_Density:GetFloat() )
-
+
GAMEMODE:SpawnRain( amt )
-
+
if not GAMEMODE.RainNoise then
-
- GAMEMODE.RainNoise = CreateSound( LocalPlayer(), GAMEMODE.RainSound )
+
+ GAMEMODE.RainNoise = CreateSound( LocalPlayer(), GAMEMODE.RainSound )
GAMEMODE.RainNoise:PlayEx( GAMEMODE.Weather.Rain * 0.3, 100 )
GAMEMODE.RainVolume = GAMEMODE.Weather.Rain * 0.4
-
+
else
-
+
if GAMEMODE.PlayerIsIndoors then
-
+
GAMEMODE.RainVolume = math.Approach( ( GAMEMODE.RainVolume or 0 ), math.max( GAMEMODE.Weather.Rain * 0.05, 0.02 ), 0.01 )
-
+
elseif GAMEMODE.Weather.Rain == 0 then
-
+
GAMEMODE.RainVolume = math.Approach( ( GAMEMODE.RainVolume or 0 ), 0, 0.002 )
-
+
else
-
+
GAMEMODE.RainVolume = math.Approach( ( GAMEMODE.RainVolume or 0 ), math.max( GAMEMODE.Weather.Rain * 0.4, 0.02 ), 0.002 )
-
+
end
-
+
GAMEMODE.RainNoise:ChangeVolume( GAMEMODE.RainVolume, GAMEMODE.RainVolume )
-
+
end
-
+
end
end
@@ -417,11 +417,11 @@ function GM:SpawnRain( amt )
if amt == 0 and not GetGlobalBool( "Radiation", false ) then return end
local function RainCollision( particle, pos, norm )
-
+
particle:SetDieTime( 0 )
-
+
if math.random(1,6) == 1 then
-
+
local particle = RainEmitter:Add( "effects/blood", pos )
particle:SetVelocity( Vector(0,0,0) )
particle:SetLifeTime( 0 )
@@ -434,34 +434,34 @@ function GM:SpawnRain( amt )
particle:SetAirResistance( 0 )
particle:SetCollide( false )
//particle:SetColor( Color( 200, 200, 250 ) )
-
+
end
-
+
end
-
+
local function CloudCollision( particle, pos, norm )
-
+
particle:SetDieTime( 0 )
-
+
end
-
+
local function RadCollision( particle, pos, norm )
-
+
particle:SetDieTime( math.Rand( 1.0, 3.0 ) )
-
+
end
-
+
local pos = GAMEMODE:GetClosestSkyPos()
-
+
if not pos then return end
-
+
if GetGlobalBool( "Radiation", false ) then
-
+
for i=1, 10 do
-
+
local vec = Vector( math.random( GAMEMODE.LeftSkyBound.x, GAMEMODE.RightSkyBound.x ), math.random( GAMEMODE.LeftSkyBound.y, GAMEMODE.RightSkyBound.y ), pos.z )
-
- local particle = RainEmitter:Add( "effects/rain_cloud", vec )
+
+ local particle = RainEmitter:Add( "effects/rain_cloud", vec )
particle:SetVelocity( Vector( 0, 0, math.random( -1000, -800 ) ) + WindVector * math.Rand( 0, 2.0 ) )
particle:SetLifeTime( 0 )
particle:SetDieTime( 10 )
@@ -474,10 +474,10 @@ function GM:SpawnRain( amt )
particle:SetBounce( 0 )
particle:SetColor( Color( 100, 250, 50 ) )
particle:SetCollideCallback( CloudCollision )
-
+
if i < 3 then
-
- local particle = RainEmitter:Add( "effects/rain_cloud", vec )
+
+ local particle = RainEmitter:Add( "effects/rain_cloud", vec )
particle:SetVelocity( Vector( 0, 0, math.random( -1000, -800 ) ) + WindVector * math.Rand( 0, 2.0 ) )
particle:SetLifeTime( 0 )
particle:SetDieTime( 10 )
@@ -491,21 +491,21 @@ function GM:SpawnRain( amt )
particle:SetCollide( true )
particle:SetCollideCallback( RadCollision )
particle:SetBounce( math.Rand( 0, 0.1 ) )
-
+
end
-
+
end
-
+
end
-
+
if amt == 0 then return end
-
+
for i=1, amt do
-
+
local vec = Vector( math.random( GAMEMODE.LeftSkyBound.x, GAMEMODE.RightSkyBound.x ), math.random( GAMEMODE.LeftSkyBound.y, GAMEMODE.RightSkyBound.y ), pos.z )
local len = math.random( 40, 80 )
-
- local particle = RainEmitter:Add( "particle/Water/WaterDrop_001a", vec )
+
+ local particle = RainEmitter:Add( "particle/Water/WaterDrop_001a", vec )
particle:SetVelocity( Vector( 0, 0, math.random( -1000, -800 ) ) )
particle:SetLifeTime( 0 )
particle:SetDieTime( 10 )
@@ -520,16 +520,16 @@ function GM:SpawnRain( amt )
particle:SetBounce( 0 )
//particle:SetColor( Color( 200, 200, 250 ) )
particle:SetCollideCallback( RainCollision )
-
+
end
-
+
amt = math.floor( amt * 0.05 ) + 1
-
+
for i=1, amt do
-
+
local vec = Vector( math.random( GAMEMODE.LeftSkyBound.x, GAMEMODE.RightSkyBound.x ), math.random( GAMEMODE.LeftSkyBound.y, GAMEMODE.RightSkyBound.y ), pos.z )
-
- local particle = RainEmitter:Add( "effects/rain_cloud", vec )
+
+ local particle = RainEmitter:Add( "effects/rain_cloud", vec )
particle:SetVelocity( Vector( 0, 0, math.random( -1000, -800 ) ) + WindVector * math.Rand( 0, 2.0 ) )
particle:SetLifeTime( 0 )
particle:SetDieTime( 10 )
@@ -542,7 +542,7 @@ function GM:SpawnRain( amt )
particle:SetBounce( 0 )
particle:SetColor( Color( 200, 200, 250 ) )
particle:SetCollideCallback( CloudCollision )
-
+
end
end
@@ -552,20 +552,20 @@ function GM:LightningThink()
if GAMEMODE.Weather.Lightning == 0 then
if GAMEMODE.NextLightning and GAMEMODE.NextLightning > CurTime() then
-
+
GAMEMODE:LightUpSky( false )
GAMEMODE.NextLightning = 0
-
+
end
-
- return
-
+
+ return
+
end
local skyname = GetGlobalString( "SkyName" )
-
+
if skyname and not GAMEMODE.SkyMat then
-
+
GAMEMODE.SkyMat = {}
GAMEMODE.SkyMat[1] = Material("skybox/" .. skyname .. "up")
GAMEMODE.SkyMat[2] = Material("skybox/" .. skyname .. "dn")
@@ -573,12 +573,12 @@ function GM:LightningThink()
GAMEMODE.SkyMat[4] = Material("skybox/" .. skyname .. "rt")
GAMEMODE.SkyMat[5] = Material("skybox/" .. skyname .. "bk")
GAMEMODE.SkyMat[6] = Material("skybox/" .. skyname .. "ft")
-
+
GAMEMODE.OldSky = {}
GAMEMODE.LitUp = {}
-
+
skyname = "sky_day01_01"
-
+
GAMEMODE.NewSky = {}
GAMEMODE.NewSky[1] = Material("skybox/" .. skyname .. "up")
GAMEMODE.NewSky[2] = Material("skybox/" .. skyname .. "dn")
@@ -586,38 +586,38 @@ function GM:LightningThink()
GAMEMODE.NewSky[4] = Material("skybox/" .. skyname .. "rt")
GAMEMODE.NewSky[5] = Material("skybox/" .. skyname .. "bk")
GAMEMODE.NewSky[6] = Material("skybox/" .. skyname .. "ft")
-
+
end
-
+
if ( GAMEMODE.NextLightning or 0 ) < CurTime() then
-
+
if not GAMEMODE.FlashInterval then
-
+
GAMEMODE.FlashInterval = CurTime() + math.Rand( 1.0, 2.5 )
GAMEMODE.FlashTime = CurTime() + math.Rand( 0, 0.2 )
GAMEMODE.FlashToggle = CurTime() + math.Rand( 0, 0.8 )
-
+
sound.Play( table.Random( GAMEMODE.Thunder ), LocalPlayer():GetShootPos(), 150, math.random( 80, 110 ), 0.2 )
-
+
end
-
+
GAMEMODE:LightUpSky( GAMEMODE.FlashTime >= CurTime() )
-
+
if GAMEMODE.FlashToggle < CurTime() then
-
+
GAMEMODE.FlashTime = CurTime() + math.Rand( 0, 0.2 )
GAMEMODE.FlashToggle = CurTime() + math.Rand( 0, 0.8 )
-
+
end
-
- if GAMEMODE.FlashInterval < CurTime() then
-
+
+ if GAMEMODE.FlashInterval < CurTime() then
+
GAMEMODE.FlashInterval = nil
- GAMEMODE.NextLightning = CurTime() + math.random( 4, 8 + ( 1.0 - GAMEMODE.Weather.Lightning ) * 50 )
+ GAMEMODE.NextLightning = CurTime() + math.random( 4, 8 + ( 1.0 - GAMEMODE.Weather.Lightning ) * 50 )
GAMEMODE:LightUpSky( false )
-
+
end
-
+
end
end
@@ -625,34 +625,34 @@ end
function GM:LightUpSky( bool )
if bool then
-
+
for k,v in pairs( GAMEMODE.SkyMat ) do
-
+
if not GAMEMODE.LitUp[k] then
-
+
GAMEMODE.OldSky[k] = v:GetTexture( "$basetexture" )
GAMEMODE.LitUp[k] = true
-
+
v:SetTexture( "$basetexture", GAMEMODE.NewSky[k]:GetTexture( "$basetexture" ) )
-
+
end
-
+
end
-
+
else
-
+
for k,v in pairs( GAMEMODE.SkyMat ) do
-
+
if GAMEMODE.LitUp and GAMEMODE.LitUp[k] then
-
+
GAMEMODE.LitUp[k] = false
-
+
v:SetTexture( "$basetexture", GAMEMODE.OldSky[k] )
-
+
end
-
+
end
-
+
end
end
@@ -660,22 +660,22 @@ end
function GM:WindThink()
if GAMEMODE.Weather.Wind == 0 then return end
-
- if ( GAMEMODE.NextWind or 0 ) < CurTime() then
-
+
+ if ( GAMEMODE.NextWind or 0 ) < CurTime() then
+
local vol = math.max( GAMEMODE.Weather.Wind, 0.2 )
local snd = table.Random( GAMEMODE.Wind )
-
+
if GAMEMODE.PlayerIsIndoors then
-
+
vol = 0.1
-
+
end
-
+
sound.Play( snd, LocalPlayer():GetShootPos(), 150, math.random( 80, 110 ), vol )
-
+
GAMEMODE.NextWind = CurTime() + math.random( 1, SoundDuration( snd ) + ( 1.0 - GAMEMODE.Weather.Wind ) * 30 + math.Rand( -2, 2 ) )
-
+
end
end
@@ -683,21 +683,21 @@ end
function GM:ThunderThink()
if GAMEMODE.Weather.Thunder == 0 then return end
-
+
if ( GAMEMODE.NextThunder or 0 ) < CurTime() then
-
- GAMEMODE.NextThunder = CurTime() + math.random( 4, 8 + ( 1.0 - GAMEMODE.Weather.Thunder ) * 50 )
-
+
+ GAMEMODE.NextThunder = CurTime() + math.random( 4, 8 + ( 1.0 - GAMEMODE.Weather.Thunder ) * 50 )
+
local vol = math.max( GAMEMODE.Weather.Thunder, 0.2 )
-
+
if GAMEMODE.PlayerIsIndoors then
-
+
vol = 0.1
-
+
end
-
+
sound.Play( table.Random( GAMEMODE.Thunder ), LocalPlayer():GetShootPos(), 150, math.random( 80, 110 ), vol )
-
+
end
-end \ No newline at end of file
+end