Skip to content

Commit

Permalink
Add auto shotgun swep (#16)
Browse files Browse the repository at this point in the history
* Add files via upload

* Add files via upload

* removed the fast shotgun because it might be op for even truested and changed the dmg output of the gun

* Fixed most of the comments on my PR

* Made it so it gives you ammo

* Added the resources

* Added resource to a if server then

* added a new swep called magic sword

* added better instructions

* Added InfoHud and updated weapon_magicsword

* Removed unessary shit

* fixed blockers and warnings

---------

Co-authored-by: Derpius <49565664+Derpius@users.noreply.github.com>
  • Loading branch information
yousifhub and Derpius authored Dec 20, 2023
1 parent 3a8d17b commit 7356b33
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/autorun/tas_weapons_init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
TASWeapons = {
Category = "TAS Weapons",
Authors = { Derpius = "Derpius", Kilo = "Kilo", El_Patito = "el_patito" }, --STEAM_0:0:547731733 Derpius, STEAM_0:0:84051936 Kilo, STEAM_0:0:572655757 el_patito_loco
Authors = {
Derpius = "Derpius", -- STEAM_0:0:547731733 Derpius
Kilo = "Kilo", -- STEAM_0:0:84051936 Kilo
El_Patito = "el_patito", -- STEAM_0:0:572655757 el_patito_loco
yousifgaming = "yousifgaming", -- STEAM_0:0:193345966 yousifgaming
},
}
118 changes: 118 additions & 0 deletions lua/weapons/weapon_autoshotgun.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
SWEP.PrintName = "Auto Shotgun"
SWEP.Author = TASWeapons.Authors.yousifgaming
SWEP.Instructions = "Gotta Go Faster"
SWEP.Purpose = "To play with dingus"
SWEP.Contact = "Don't Contact me i dont like people"

SWEP.Category = TASWeapons.Category
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.BounceWeaponIcon = false
SWEP.IconOverride = "autoshotgun/cat.jpg"
if CLIENT then
local TextureName = "autoshotgun/cat"
SWEP.IconOverride = TextureName
SWEP.WepSelectIcon = surface.GetTextureID(TextureName)
killicon.Add("weapon_autoshotgun", TextureName, Color(255, 255, 255))
end

SWEP.Primary.ClipSize = 30
SWEP.Primary.DefaultClip = 56
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "Buckshot"

SWEP.Secondary.Ammo = "None"
SWEP.Secondary.Automatic = true

SWEP.ReloadInProgress = false

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.Slot = 3
SWEP.SlotPos = 0
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true

SWEP.ViewModel = "models/weapons/c_shotgun.mdl"
SWEP.WorldModel = "models/weapons/w_shotgun.mdl"
SWEP.UseHands = true

SWEP.ShootSound = Sound("weapons/xm1014/xm1014-1.wav")

if SERVER then
resource.AddFile("materials/autoshotgun/cat.vmt")
resource.AddFile("materials/autoshotgun/cat.jpg")
end

function SWEP:Initialize()
self:SetHoldType("shotgun")
end

function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() then
return
end

self:SetNextPrimaryFire(CurTime() + 0.5)
self:SetNextSecondaryFire(CurTime() + 1)

self:ShootBullet(10, 10, 0.1)

self:EmitSound(self.ShootSound)

self:TakePrimaryAmmo(1)
end

function SWEP:SecondaryAttack()
if self:Clip1() < 3 then
self:SetNextSecondaryFire(CurTime() + 0.3)
self:Reload()
return
end

self:SetNextPrimaryFire(CurTime() + 1)
self:SetNextSecondaryFire(CurTime() + 1)

self:ShootBullet(10, 30, 0.1)
self:EmitSound(self.ShootSound)

self:TakePrimaryAmmo(3)
end

function SWEP:Reload()
local ply = self:GetOwner()
local roundsToReload = self.Primary.ClipSize - self:Clip1()
if
self:GetOwner():GetAmmoCount(self:GetPrimaryAmmoType()) <= 0
or self:Clip1() >= self.Primary.ClipSize
or self.ReloadInProgress
then
return
end

if ply:GetAmmoCount(self:GetPrimaryAmmoType()) < roundsToReload then
roundsToReload = ply:GetAmmoCount(self:GetPrimaryAmmoType())
end

if roundsToReload <= 0 then
return
end

self.ReloadInProgress = true

self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
self:SetNextPrimaryFire(CurTime() + self:SequenceDuration())

timer.Simple(self:SequenceDuration(), function()
if IsValid(self) and IsValid(self:GetOwner()) then
self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_FINISH)
self:DefaultReload(380)
self:EmitSound("weapons/shotgun/shotgun_reload" .. math.random(1, 3) .. ".wav")
self:SetClip1(self:Clip1() + roundsToReload)
self:GetOwner():RemoveAmmo(roundsToReload, self:GetPrimaryAmmoType())
self.ReloadInProgress = false
end
end)
end
Binary file added materials/autoshotgun/cat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions materials/autoshotgun/cat.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"UnlitGeneric"
{
"$basetexture" "autoshotgun/cat"
}
Binary file added materials/autoshotgun/cat.vtf
Binary file not shown.

0 comments on commit 7356b33

Please sign in to comment.