From 8132e35e2e625b1a12269bcb74b447cf7e24a2aa Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 17 Feb 2020 18:26:08 +0100 Subject: [PATCH] Nodes bug fix & added alternate mining mode --- gamemode/engine/lib/sh_items.lua | 1 + gamemode/engine/lib/sh_node.lua | 17 +++++++++++------ gamemode/settings/sv_settings.lua | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gamemode/engine/lib/sh_items.lua b/gamemode/engine/lib/sh_items.lua index d77f4f4..906c488 100644 --- a/gamemode/engine/lib/sh_items.lua +++ b/gamemode/engine/lib/sh_items.lua @@ -61,4 +61,5 @@ if SERVER then function Quantum.Server.Item.SpawnItemAtPlayer( pl, itemid, amount ) -- Quantum.Server.Item.SpawnItemAtPlayer( Entity(1), "potatoe", 1 ) Quantum.Server.Item.SpawnItem( pl:GetPos() + ( pl:GetForward() * 40 ) + Vector( 0, 0, 40 ), itemid, amount ) -- Quantum.Server.Item.SpawnItemAtPlayer( Entity(1), "jetpack", 1 ) 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 a39652b..2d99700 100644 --- a/gamemode/engine/lib/sh_node.lua +++ b/gamemode/engine/lib/sh_node.lua @@ -146,17 +146,22 @@ if SERVER then if( canGather ) then if( dmgInfo != nil ) then - self:SetHealth( self:Health() - dmgInfo:GetDamage() ) - if( self:Health() <= 0 ) then - Quantum.Node.Remove( self ) + ent:SetHealth( ent:Health() - dmgInfo:GetDamage() ) + if( ent:Health() <= 0 ) then + Quantum.Node.Remove( ent ) end end local loot, amount = randomizeLootTable( nodeTbl.give, nodeTbl.giveprobability ) if( loot != nil ) then - Quantum.Server.Inventory.GiveItem( pl, loot, amount ) - local itemTbl = Quantum.Item.Get( loot ) - Quantum.Notify.ItemGathered( pl, itemTbl, amount ) + if( !Quantum.Server.Settings.ItemsGatheredSpawnInWorld ) then + Quantum.Server.Inventory.GiveItem( pl, loot, amount ) + local itemTbl = Quantum.Item.Get( loot ) + Quantum.Notify.ItemGathered( pl, itemTbl, amount ) + else + local basepos = ent:GetPos() + Quantum.Server.Item.SpawnItem( basepos, loot, amount ) + end else return end diff --git a/gamemode/settings/sv_settings.lua b/gamemode/settings/sv_settings.lua index 70bab77..c56f475 100644 --- a/gamemode/settings/sv_settings.lua +++ b/gamemode/settings/sv_settings.lua @@ -19,6 +19,8 @@ Quantum.Server.Settings.ItemDespawnTimer = 300 Quantum.Server.Settings.ItemPickupSound = "physics/cardboard/cardboard_box_impact_hard2.wav" +Quantum.Server.Settings.ItemsGatheredSpawnInWorld = true + Quantum.Server.Settings.InitSpawnLocation = { pos = Vector( 12418.626953125, 9959.9345703125, 320.03125 ), ang = Angle( 0, -2.1179277896881, 0 )