master
E. Almqvist 5 years ago
parent 495a0d0023
commit f0f4154e1b
  1. 7
      entities/entities/q_node/init.lua
  2. 10
      gamemode/engine/lib/sh_node.lua
  3. 16
      plugins/plugin_spawnvehicles.lua

@ -29,12 +29,7 @@ function ENT:OnTakeDamage( dmgInfo )
local attacker = dmgInfo:GetAttacker() local attacker = dmgInfo:GetAttacker()
local wep = attacker:GetActiveWeapon() local wep = attacker:GetActiveWeapon()
if( IsValid( wep ) && IsValid( attacker ) ) then if( IsValid( wep ) && IsValid( attacker ) ) then
Quantum.Node.Gather( attacker, wep:GetClass(), self ) Quantum.Node.Gather( attacker, wep:GetClass(), self, dmgInfo )
self:SetHealth( self:Health() - dmgInfo:GetDamage() )
if( self:Health() <= 0 ) then
Quantum.Node.Remove( self )
end
end end
end end
end end

@ -126,7 +126,7 @@ if SERVER then
end end
end end
function Quantum.Node.Gather( pl, tool, ent ) function Quantum.Node.Gather( pl, tool, ent, dmgInfo )
local nodeTbl = ent.node local nodeTbl = ent.node
if( ent.node != nil ) then if( ent.node != nil ) then
@ -144,6 +144,14 @@ if SERVER then
end end
if( canGather ) then 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 ) local loot, amount = randomizeLootTable( nodeTbl.give, nodeTbl.giveprobability )
if( loot != nil ) then if( loot != nil ) then
Quantum.Server.Inventory.GiveItem( pl, loot, amount ) Quantum.Server.Inventory.GiveItem( pl, loot, amount )

@ -6,6 +6,8 @@ if SERVER then
plugin.vechilesTypes = { plugin.vechilesTypes = {
["jeep"] = function( pos, ang ) ["jeep"] = function( pos, ang )
local ent = simfphys.SpawnVehicleSimple( "sim_fphys_jeep", pos, ang ) local ent = simfphys.SpawnVehicleSimple( "sim_fphys_jeep", pos, ang )
ent:SetFuel( 99999 )
print( ent:IsInitialized() )
return ent return ent
end, end,
["duke"] = function( pos, ang ) ["duke"] = function( pos, ang )
@ -14,20 +16,6 @@ if SERVER then
end, end,
["couch"] = function( pos, ang ) ["couch"] = function( pos, ang )
local ent = simfphys.SpawnVehicleSimple( "sim_fphys_couch", 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 return ent
end end
} }

Loading…
Cancel
Save