From ba23e4d79a40d59dd3fb8484397e050f143a4ca9 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sat, 15 Feb 2020 18:22:05 +0100 Subject: [PATCH] Nodes update & removed unused code --- entities/entities/q_node/init.lua | 12 ++--- entities/weapons/quantum_tool/shared.lua | 61 ------------------------ gamemode/engine/lib/sh_node.lua | 4 -- gamemode/init.lua | 4 ++ 4 files changed, 9 insertions(+), 72 deletions(-) delete mode 100644 entities/weapons/quantum_tool/shared.lua diff --git a/entities/entities/q_node/init.lua b/entities/entities/q_node/init.lua index b0f661a..bd4fc33 100644 --- a/entities/entities/q_node/init.lua +++ b/entities/entities/q_node/init.lua @@ -26,17 +26,15 @@ end function ENT:OnTakeDamage( dmgInfo ) if( !self.m_bApplyingDamage ) then - - self:SetHealth( self:Health() - dmgInfo:GetDamage() ) - if( self:Health() <= 0 ) then - Quantum.Node.Remove( self ) - end - local attacker = dmgInfo:GetAttacker() local wep = attacker:GetActiveWeapon() if( IsValid( wep ) && IsValid( attacker ) ) then Quantum.Node.Gather( attacker, wep:GetClass(), self ) - end + self:SetHealth( self:Health() - dmgInfo:GetDamage() ) + if( self:Health() <= 0 ) then + Quantum.Node.Remove( self ) + end + end end end \ No newline at end of file diff --git a/entities/weapons/quantum_tool/shared.lua b/entities/weapons/quantum_tool/shared.lua deleted file mode 100644 index f23c4ad..0000000 --- a/entities/weapons/quantum_tool/shared.lua +++ /dev/null @@ -1,61 +0,0 @@ --- __ _ _______ _ __ --- / / /\ | | |__ __| | | \ \ --- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ --- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > --- \ \ / ____ \| | | | | | | | __/ (__| | | | / / --- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ - -AddCSLuaFile() - -if CLIENT then - SWEP.PrintName = "Quantum Tool" - SWEP.Slot = 0 - SWEP.SlotPos = 1 - SWEP.DrawAmmo = false - SWEP.DrawCrosshair = false -end - -SWEP.WorldModel = "models/weapons/w_crowbar.mdl" -SWEP.ViewModel = "models/weapons/c_crowbar.mdl" -SWEP.UseHands = true -SWEP.Weight = 4 - -SWEP.Primary.ClipSize = -1 -SWEP.Primary.DefaultClip = -1 -SWEP.Primary.Automatic = false -SWEP.Primary.Ammo = "" - -SWEP.Secondary.ClipSize = -1 -SWEP.Secondary.DefaultClip = -1 -SWEP.Secondary.Automatic = false -SWEP.Secondary.Ammo = "" - -function SWEP:Initialize() - self:SetHoldType( "melee" ) -end - -function SWEP:Deploy() - if( CLIENT || !IsValid(self:GetOwner()) ) then return true end - self:GetOwner():DrawWorldModel( self.WorldModel != "" && self.WorldModel != nil ) - return true -end - -function SWEP:Holster() - return true -end - -function SWEP:PreDrawViewModel() - return true -end - -function SWEP:PrimaryAttack() - return -end - -function SWEP:SecondaryAttack() - return -end - -function SWEP:Reload() - return false -end \ No newline at end of file diff --git a/gamemode/engine/lib/sh_node.lua b/gamemode/engine/lib/sh_node.lua index f1c0105..894122e 100644 --- a/gamemode/engine/lib/sh_node.lua +++ b/gamemode/engine/lib/sh_node.lua @@ -103,10 +103,6 @@ if SERVER then Quantum.Node.SpawnAllRegistered() end - if( #player.GetAll() > 0 ) then - Quantum.Node.UpdateAll() -- update all nodes on lua refresh - end - hook.Add( "PlayerInitialSpawn", "Quantum_Init_Nodes_Load", function() Quantum.Debug( "Spawning registered nodes..." ) diff --git a/gamemode/init.lua b/gamemode/init.lua index 6c8d509..c21607a 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -160,6 +160,10 @@ if SERVER then Quantum.Server.Loaded = true + if( #player.GetAll() > 0 ) then + Quantum.Node.UpdateAll() -- update all nodes on lua refresh + end + end Quantum.Server.Load()