1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-04 00:52:33 +00:00
This commit is contained in:
g_brzhezinskiy
2021-01-02 12:51:45 +03:00
commit 1d05caf866
613 changed files with 337020 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
include("shared.lua")
SWEP.PrintName = "Button presser"
SWEP.Slot = 3
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.HoldType = "normal"
function SWEP:Holster()
return true
end
function SWEP:OnRemove()
end
function SWEP:Initialize()
end
function SWEP:Reload()
end
function SWEP:PrimaryAttack()
if IsFirstTimePredicted() then
end
self:SetNextPrimaryFire( CurTime() + 10 )
end
function SWEP:SecondaryAttack()
self:SetNextSecondaryFire( CurTime() + 0.5 )
end
function SWEP:Deploy()
end
function SWEP:Think()
end
function SWEP:DrawHUD()
if self:GetNW2Int("Type") == 1 then
draw.SimpleText("Current button:"..self:GetNW2String("Name","Unknown"),"CloseCaption_Bold",ScrW()/2, 0,Color(127,255,0),1)
end
end

View File

@@ -0,0 +1,50 @@
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
SWEP.Weight = 1
SWEP.PrimAttack = false
function SWEP:Initialize()
end
function SWEP:Think()
local tr = util.GetPlayerTrace( self.Owner )
tr.ignoreworld = true
tr.filter = function(ent) if (ent:GetClass() == "func_button" or ent:GetClass() == "momentary_rot_button") and not ent:GetName():find("adminlock") then return true end end
if self.PrimAttack and IsValid(self.Entity) and self.Entity:GetClass() == "momentary_rot_button" then
self.Entity:Fire("Use")
end
if self.PrimAttack ~= self.OldPrimAttack then
local trace = util.TraceLine( tr )
local rot
if IsValid(trace.Entity) then
rot = trace.Entity:GetClass() == "momentary_rot_button"
end
if trace.Hit and rot ~= nil and not IsValid(self.Entity) then
self.Entity = trace.Entity
if not rot then
self.Entity:Fire("Press")
end
elseif not self.PrimAttack and IsValid(self.Entity) then
self.Entity = nil
end
self.OldPrimAttack = self.PrimAttack
end
self.PrimAttack = false
local trace = util.TraceLine( tr )
if not trace.Hit or not IsValid(trace.Entity) then
self:SetNW2String("Name","")
self:SetNW2Int("Type",0)
return
end
self:SetNW2Int("Type",1)
self:SetNW2String("Name",trace.Entity:GetName())
end
function SWEP:PrimaryAttack()
self.PrimAttack = true
end

View File

@@ -0,0 +1,23 @@
--include("shared.lua")
--AddCSLuaFile("shared.lua")
--AddCSLuaFile("cl_init.lua")
SWEP.Author = "glebqip"
SWEP.Contact = ""
SWEP.Purpose = "Button presser"
SWEP.Instructions = "Button presser"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Category = "Metrostroi"
SWEP.UseHands = false
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"