From f0f4154e1b922e42ca9a7ee5f14552884dbced84 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sat, 15 Feb 2020 19:15:31 +0100 Subject: [PATCH] Bug fixes --- entities/entities/q_node/init.lua | 7 +------ gamemode/engine/lib/sh_node.lua | 10 +++++++++- plugins/plugin_spawnvehicles.lua | 16 ++-------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/entities/entities/q_node/init.lua b/entities/entities/q_node/init.lua index bd4fc33..1c2c126 100644 --- a/entities/entities/q_node/init.lua +++ b/entities/entities/q_node/init.lua @@ -29,12 +29,7 @@ function ENT:OnTakeDamage( dmgInfo ) local attacker = dmgInfo:GetAttacker() local wep = attacker:GetActiveWeapon() if( IsValid( wep ) && IsValid( attacker ) ) then - Quantum.Node.Gather( attacker, wep:GetClass(), self ) - - self:SetHealth( self:Health() - dmgInfo:GetDamage() ) - if( self:Health() <= 0 ) then - Quantum.Node.Remove( self ) - end + Quantum.Node.Gather( attacker, wep:GetClass(), self, dmgInfo ) end end end \ No newline at end of file diff --git a/gamemode/engine/lib/sh_node.lua b/gamemode/engine/lib/sh_node.lua index 894122e..a39652b 100644 --- a/gamemode/engine/lib/sh_node.lua +++ b/gamemode/engine/lib/sh_node.lua @@ -126,7 +126,7 @@ if SERVER then end end - function Quantum.Node.Gather( pl, tool, ent ) + function Quantum.Node.Gather( pl, tool, ent, dmgInfo ) local nodeTbl = ent.node if( ent.node != nil ) then @@ -144,6 +144,14 @@ if SERVER then end if( canGather ) then + + if( dmgInfo != nil ) then + self:SetHealth( self:Health() - dmgInfo:GetDamage() ) + if( self:Health() <= 0 ) then + Quantum.Node.Remove( self ) + end + end + local loot, amount = randomizeLootTable( nodeTbl.give, nodeTbl.giveprobability ) if( loot != nil ) then Quantum.Server.Inventory.GiveItem( pl, loot, amount ) diff --git a/plugins/plugin_spawnvehicles.lua b/plugins/plugin_spawnvehicles.lua index 1abe36c..98d4918 100644 --- a/plugins/plugin_spawnvehicles.lua +++ b/plugins/plugin_spawnvehicles.lua @@ -6,6 +6,8 @@ if SERVER then plugin.vechilesTypes = { ["jeep"] = function( pos, ang ) local ent = simfphys.SpawnVehicleSimple( "sim_fphys_jeep", pos, ang ) + ent:SetFuel( 99999 ) + print( ent:IsInitialized() ) return ent end, ["duke"] = function( pos, ang ) @@ -14,20 +16,6 @@ if SERVER then end, ["couch"] = function( pos, ang ) local ent = simfphys.SpawnVehicleSimple( "sim_fphys_couch", pos, ang ) - return ent - end, - ["heli"] = function( pos, ang ) - local ent = ents.Create( "wac_hc_littlebird_mh6" ) - if( !IsValid(ent) ) then - Quantum.Error( "Failed to create WAC helicopter" ) - return - end - ent:SetPos( pos ) - ent:SetAngles( Angle( 0, 0, 0 ) ) - - ent:Spawn() - ent:Activate() - return ent end }