add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,58 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local StartPos
local StartAng
function ENT:Initialize()
self:SetMoveType(MOVETYPE_NONE)
StartPos = self:GetPos()
StartAng = self:GetAngles()
self:SetNWInt('MaxHp',self.hp)
end
function ENT:Think()
self:SetNWInt('Hp',self.hp)
if self:GetNWInt("Hp") > self:GetNWInt("MaxHp") then
self:SetNWInt('Hp',self:GetNWInt("MaxHp"))
end
if SERVER then
if self.poscoef == 0 and self.building then
self.Owner:Freeze(false)
self.Owner.building = false
self:PhysicsInitStatic(6)
self:SetCollisionGroup(0)
self.building = false
end
if self.building then
self.Owner.building = true
self.poscoef = self.poscoef + 1
self.Owner:Freeze(true)
self:SetAngles(StartAng)
self:SetPos(StartPos - self:GetAngles():Up() * -self.poscoef)
end
end
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_INS2_RPG7.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,8 @@
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,9 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,58 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local StartPos
local StartAng
function ENT:Initialize()
self:SetMoveType(MOVETYPE_NONE)
StartPos = self:GetPos()
StartAng = self:GetAngles()
self:SetNWInt('MaxHp',self.hp)
end
function ENT:Think()
self:SetNWInt('Hp',self.hp)
if self:GetNWInt("Hp") > self:GetNWInt("MaxHp") then
self:SetNWInt('Hp',self:GetNWInt("MaxHp"))
end
if SERVER then
if self.poscoef == 0 and self.building then
self.Owner:Freeze(false)
self.Owner.building = false
self:PhysicsInitStatic(6)
self:SetCollisionGroup(0)
self.building = false
end
if self.building then
self.Owner.building = true
self.poscoef = self.poscoef + 1
self.Owner:Freeze(true)
self:SetAngles(StartAng)
self:SetPos(StartPos - self:GetAngles():Up() * -self.poscoef)
end
end
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_INS2_RPG7.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,8 @@
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,29 @@
include("shared.lua")
surface.CreateFont( "PlayerTagFont", {
font = "Arial",
size = 72,
} )
function ENT:Draw()
self:DrawModel()
angle = self:GetAngles() + Angle(0,90,90)
pos = self:GetPos() + angle:Forward() * 0 + angle:Up() * 0 + angle:Right() * -30
cam.Start3D2D( pos, angle, 0.05 )
surface.SetFont( "PlayerTagFont" )
local tW, tH = surface.GetTextSize( self.DisplayName )
local padX = 20
local padY = 5
surface.SetDrawColor( 0, 0, 0, 200 )
surface.DrawRect( -tW / 2 - padX, -padY, tW + padX * 2, tH + padY * 2 )
draw.SimpleText( self.DisplayName, "PlayerTagFont", -tW / 2, 0, color_white )
cam.End3D2D()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,43 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.hp = 500
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit(6)
end
function ENT:Think()
end
function ENT:OnRemove()
end
function ENT:Use(activator, caller)
if activator:GetActiveWeapon():GetClass() == "engineertool" or "engineertoolfpv" or "engineertoolmines" then
print(activator:GetActiveWeapon().Structures)
activator:GetActiveWeapon().Structures[self.ItemId].count = activator:GetActiveWeapon().Structures[self.ItemId].count + self.ItemCount
net.Start('additem')
net.WriteInt(self.ItemId, 13)
net.WriteInt(self.ItemCount, 13)
net.Send(activator)
self:Remove()
end
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,12 @@
ENT.Type = "anim"
ENT.PrintName = "Ящик с припасами"
ENT.Category = "Engineer Kit"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = true
ENT.Model = "models/Items/ammocrate_smg1.mdl"
ENT.ItemId = 1
ENT.ItemCount = 1
ENT.DisplayName = "ПТРК 'Корнет'"

View File

@@ -0,0 +1,251 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "Мешки с песком",
icon = "entities/closebutton.png",
cat = 1,
hp = 10000,
model = "models/props_fortifications/sandbags_corner1.mdl",
count = 3,
corrangle = Angle(0,0,0)
},
{
name = "Большие мешки с песком",
icon = "entities/closebutton.png",
cat = 1,
hp = 20000,
model = "models/props_fortifications/sandbags_corner1_tall.mdl",
count = 2,
corrangle = Angle(0,0,0)
},
{
name = "Противотанковые ёжи",
icon = "entities/closebutton.png",
cat = 1,
hp = 50000,
model = "models/test_sborka_props/barricades/ezi_antitank_2.mdl",
count = 2,
corrangle = Angle(0,-90,0)
},
{
name = "Танковый окоп",
icon = "entities/closebutton.png",
cat = 2,
hp = 100000,
model = "models/trenches/prop/tank_cover/tank_cover.mdl",
count = 3,
corrangle = Angle(0,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
if item.id != nil then
if item.Owner == self:GetOwner() then
if (item:GetClass() == self.Structures[item.id].entity) or (item:GetModel() == self.Structures[item.id].model) then
item:Remove()
self.Structures[item.id].count = self.Structures[item.id].count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("buildtrench", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
net.Start("buildanim")
net.WriteEntity(item)
net.Send(self:GetOwner())
local item = ents.Create("util_structure")
item:SetPos(ply:GetEyeTrace().HitPos)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + Angle(90,ply:EyeAngles().y,0))
item:SetModel(self.Structures[id].model)
item.hp = self.Structures[id].hp
item.id = id
item.poscoef = -100
item.building = true
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
local item = ents.Create(self.Structures[id].entity)
item:SetPos(ply:GetEyeTrace().HitPos + ply:GetEyeTrace().HitNormal * 40)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + self.Structures[id].corrangle)
item.id = id
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,231 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool FPV"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "FPV-дрон",
icon = "entities/entity.png",
cat = 0,
entity = "entity_drone_bomb",
count = 2,
id = 1,
corrangle = Angle(90,0,0)
},
{
name = "Разведывательный дрон",
icon = "entities/entity.png",
cat = 0,
entity = "entity_drone_base",
count = 1,
id = 2,
corrangle = Angle(90,0,0)
},
{
name = "РЭБ",
icon = "entities/entity.png",
cat = 0,
entity = "entity_dronejammer",
count = 1,
id = 3,
corrangle = Angle(90,0,0)
},
{
name = "Зарядная станция для дрона",
icon = "entities/entity.png",
cat = 0,
entity = "entity_dronepad",
count = 1,
id = 4,
corrangle = Angle(90,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
local structure_id = item.structure_id
if structure_id != nil then
if item:GetOwner() == self:GetOwner() then
local struct = self.Structures[structure_id]
if (item:GetClass() == struct.entity) or (item:GetModel() == struct.model) then
item:Remove()
struct.count = struct.count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() ~= "engineertoolfpv" then return end
local id = net.ReadInt(13)
local struct = self.Structures[id]
if struct and struct.count > 0 then
local trace = ply:GetEyeTrace()
if (trace.HitPos - trace.StartPos):Length() > 300 then return end
local item = ents.Create(struct.entity)
item:SetPos(trace.HitPos + trace.HitNormal * 10)
item:SetAngles(trace.HitNormal:Angle() + struct.corrangle)
item:Spawn()
struct.count = struct.count - 1
item.structure_id = id
if IsValid(ply) and ply:IsPlayer() then
item:SetOwner(ply)
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,225 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool MINES"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "Мина 'ТМ-62'",
icon = "entities/entity.png",
cat = 0,
entity = "sw_mine_tm62_v3",
count = 10,
corrangle = Angle(90,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
if item.id != nil then
if item.Owner == self:GetOwner() then
if (item:GetClass() == self.Structures[item.id].entity) or (item:GetModel() == self.Structures[item.id].model) then
item:Remove()
self.Structures[item.id].count = self.Structures[item.id].count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
--print(1)
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
print(2)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("buildtrench", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
net.Start("buildanim")
net.WriteEntity(item)
net.Send(self:GetOwner())
local item = ents.Create("util_structure")
item:SetPos(ply:GetEyeTrace().HitPos)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + Angle(90,ply:EyeAngles().y,0))
item:SetModel(self.Structures[id].model)
item.hp = self.Structures[id].hp
item.id = id
item.poscoef = -100
item.building = true
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertoolmines" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
local item = ents.Create(self.Structures[id].entity)
item:SetPos(ply:GetEyeTrace().HitPos + ply:GetEyeTrace().HitNormal * 40)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + self.Structures[id].corrangle)
item.id = id
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,122 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Repair Tool"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
if self:GetOwner():GetEyeTrace().Entity.hp != self:GetOwner():GetEyeTrace().Entity.MaxHp then
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.hp + 100
if self:GetOwner():GetEyeTrace().Entity.hp == self:GetOwner():GetEyeTrace().Entity.MaxHp then
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.MaxHp
end
end
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
end
function SWEP:DrawHUD()
if self:GetOwner():GetEyeTrace().Entity:GetClass() == 'util_structure'then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 300, 60, Color( 50, 50, 50 , 180) )
local tW, tH = surface.GetTextSize(tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")))
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")*(290/self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), "Font3", ScrW()/2, ScrH()/2-15, Color( 255, 255, 255 ,255), 1 )
end
end
function SWEP:Think()
if SERVER then
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end