Skip to content

Commit

Permalink
Altered for "Death" Issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCraigTunstall committed Mar 1, 2018
1 parent f074bfb commit c105a68
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ end
function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon("weapon_zs_arsenalcrate")
pl:GiveAmmo(1, "airboatgun")

if pl:HasWeapon("weapon_zs_arsenalcrate") then
pl:GiveAmmo(1, "airboatgun")
else
pl:Give("weapon_zs_arsenalcrate")
end

pl:PushPackedItem(self:GetClass(), self:GetObjectHealth())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,13 @@ function ENT:AltUse(activator, tr)
end

function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon("weapon_zs_gunturret")
pl:GiveAmmo(1, "thumper")


if pl:HasWeapon("weapon_zs_gunturret") then
pl:GiveAmmo(1, "thumper")
else
pl:Give("weapon_zs_gunturret")
end

pl:PushPackedItem(self:GetClass(), self:GetObjectHealth())
pl:GiveAmmo(self:GetAmmo(), "smg1")

Expand All @@ -216,4 +220,4 @@ function ENT:OnTakeDamage(dmginfo)
self:ResetLastBarricadeAttacker(attacker, dmginfo)
self:SetObjectHealth(self:GetObjectHealth() - dmginfo:GetDamage())
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ function ENT:PhysicsCollide(data, phys)
end

function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon(self.WeaponClass)
pl:GiveAmmo(1, self.AmmoType)
if pl:HasWeapon(self.WeaponClass) then
pl:GiveAmmo(1, self.AmmoType)
else
pl:Give(self.WeaponClass)
end

pl:PushPackedItem(self:GetClass(), self:GetObjectHealth())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ function ENT:AltUse(activator, tr)
end

function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon("weapon_zs_messagebeacon")
pl:GiveAmmo(1, "striderminigun")
if pl:HasWeapon("weapon_zs_messagebeacon") then
pl:GiveAmmo(1, "striderminigun")
else
pl:Give("weapon_zs_messagebeacon")
end


pl:PushPackedItem(self:GetClass(), self.m_Health)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ function ENT:AltUse(activator, tr)
end

function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon("weapon_zs_resupplybox")
pl:GiveAmmo(1, "helicoptergun")
if pl:HasWeapon("weapon_zs_resupplybox") then
pl:GiveAmmo(1, "helicoptergun")
else
pl:Give("weapon_zs_resupplybox")
end

pl:PushPackedItem(self:GetClass(), self:GetObjectHealth())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ function ENT:AltUse(activator, tr)
end

function ENT:OnPackedUp(pl)
pl:GiveEmptyWeapon("weapon_zs_spotlamp")
pl:GiveAmmo(1, "spotlamp")
if pl:HasWeapon("weapon_zs_spotlamp") then
pl:GiveAmmo(1, "spotlamp")
else
pl:Give("weapon_zs_spotlamp")
end

pl:PushPackedItem(self:GetClass(), self:GetObjectHealth())

Expand Down
21 changes: 15 additions & 6 deletions gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -830,37 +830,46 @@ function meta:GiveWeaponByType(weapon, plyr, ammo)
if wep:IsValid() then
local primary = wep:ValidPrimaryAmmo()
if primary and 0 < wep:Clip1() then
self:GiveAmmo(wep:Clip1(), primary, true)
wep:SetClip1(0)
if wep.AmmoIfHas ~= true then
self:GiveAmmo(wep:Clip1(), primary, true)
end
wep:SetClip1(0)
end
local secondary = wep:ValidSecondaryAmmo()
if secondary and 0 < wep:Clip2() then
self:GiveAmmo(wep:Clip2(), secondary, true)
if wep.AmmoIfHas ~= true then
self:GiveAmmo(wep:Clip2(), secondary, true)
end
wep:SetClip2(0)
end

self:StripWeapon(weapon:GetClass())

local wep2 = plyr:Give(weapon:GetClass())
if wep2 and wep2:IsValid() then
if wep2.Primary then
local primary = wep2:ValidPrimaryAmmo()
if primary then
wep2:SetClip1(0)
if wep.AmmoIfHas ~= true then
wep2:SetClip1(0)
end
plyr:RemoveAmmo(math.max(0, wep2.Primary.DefaultClip - wep2.Primary.ClipSize), primary)
end
end
if wep2.Secondary then
local secondary = wep2:ValidSecondaryAmmo()
if secondary then
wep2:SetClip2(0)
if wep.AmmoIfHas ~= true then
wep2:SetClip2(0)
end
plyr:RemoveAmmo(math.max(0, wep2.Secondary.DefaultClip - wep2.Secondary.ClipSize), secondary)
end
end
end
end
end


function meta:Gib()
local pos = self:WorldSpaceCenter()
local headoffset = self:LocalToWorld(self:OBBMaxs()).z - pos.z
Expand Down
13 changes: 9 additions & 4 deletions gamemodes/zombiesurvival/gamemode/sh_options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@ GM:AddStartingItem("medgun", "Medic Gun", nil, ITEMCAT_TOOLS, 25, "weapon_zs_med
GM:AddStartingItem("150mkit", "150 Medical Kit power", "150 extra power for the Medical Kit.", ITEMCAT_TOOLS, 15, nil, function(pl) pl:GiveAmmo(150, "Battery", true) end, "models/healthvial.mdl")
GM:AddStartingItem("arscrate", "Arsenal Crate", nil, ITEMCAT_TOOLS, 15, "weapon_zs_arsenalcrate").Countables = "prop_arsenalcrate"
GM:AddStartingItem("resupplybox", "Resupply Box", nil, ITEMCAT_TOOLS, 30, "weapon_zs_resupplybox").Countables = "prop_resupplybox"
local item = GM:AddStartingItem("infturret", "Infrared Gun Turret", nil, ITEMCAT_TOOLS, 65, nil, function(pl)
local item = GM:AddStartingItem("infturret", "Infrared Gun Turret", "This automated turret requires constant upkeep to be useful.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your SMG ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it.",
ITEMCAT_TOOLS, 65, nil, function(pl)
pl:GiveEmptyWeapon("weapon_zs_gunturret")
pl:GiveAmmo(1, "thumper")
pl:GiveAmmo(250, "smg1")
end)
end, "models/combine_turrets/floor_turret.mdl")
item.Countables = {"weapon_zs_gunturret", "prop_gunturret"}
item.NoClassicMode = true
item.Countables = {"weapon_zs_gunturret", "prop_gunturret"}
item.NoClassicMode = true
local item = GM:AddStartingItem("manhack", "Manhack", nil, ITEMCAT_TOOLS, 20, "weapon_zs_manhack")
Expand Down Expand Up @@ -241,11 +244,13 @@ GM:AddPointShopItem("crphmr", "Carpenter's Hammer", nil, ITEMCAT_TOOLS, 20, "wea
GM:AddPointShopItem("wrench", "Mechanic's Wrench", nil, ITEMCAT_TOOLS, 15, "weapon_zs_wrench").NoClassicMode = true
GM:AddPointShopItem("arsenalcrate", "Arsenal Crate", nil, ITEMCAT_TOOLS, 30, "weapon_zs_arsenalcrate")
GM:AddPointShopItem("resupplybox", "Resupply Box", nil, ITEMCAT_TOOLS, 35, "weapon_zs_resupplybox")
local item = GM:AddPointShopItem("infturret", "Infrared Gun Turret", nil, ITEMCAT_TOOLS, 60, nil, function(pl)
local item = GM:AddPointShopItem("infturret", "Infrared Gun Turret", "This automated turret requires constant upkeep to be useful.\nPress PRIMARY ATTACK to deploy the turret.\nPress SECONDARY ATTACK and RELOAD to rotate the turret.\nPress USE on a deployed turret to give it some of your SMG ammunition.\nPress USE on a deployed turret with no owner (blue light) to reclaim it.",
ITEMCAT_TOOLS, 65, nil, function(pl)
pl:GiveEmptyWeapon("weapon_zs_gunturret")
pl:GiveAmmo(1, "thumper")
pl:GiveAmmo(250, "smg1")
end)
end, "models/combine_turrets/floor_turret.mdl")
item.NoClassicMode = true
item.NoClassicMode = true
GM:AddPointShopItem("manhack", "Manhack", nil, ITEMCAT_TOOLS, 30, "weapon_zs_manhack")
GM:AddPointShopItem("barricadekit", "'Aegis' Barricade Kit", nil, ITEMCAT_TOOLS, 70, "weapon_zs_barricadekit")
Expand Down

0 comments on commit c105a68

Please sign in to comment.