From 015a5a00656f52a6b860c3879997c917a2ac6981 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Mon, 17 Feb 2020 18:41:27 +0100 Subject: [PATCH] Mined items now spawn infront of player --- gamemode/engine/lib/sh_node.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gamemode/engine/lib/sh_node.lua b/gamemode/engine/lib/sh_node.lua index c6d7cab..c297834 100644 --- a/gamemode/engine/lib/sh_node.lua +++ b/gamemode/engine/lib/sh_node.lua @@ -159,12 +159,15 @@ if SERVER then local itemTbl = Quantum.Item.Get( loot ) Quantum.Notify.ItemGathered( pl, itemTbl, amount ) else - local basepos = ent:GetPos() - -- calculate the entities collision bounds height - local p, q = ent:GetCollisionBounds() -- Z is the height - local height = q.z - p.z + local eyepos = pl:GetEyeTraceNoCursor() + if( eyepos.Entity == ent ) then + -- calculate the entities collision bounds height + local p, q = ent:GetCollisionBounds() -- Z is the height - Quantum.Server.Item.SpawnItem( basepos + Vector(0, 0, height), loot, amount ) + local pos = LerpVector( 0.75, eyepos.StartPos, eyepos.HitPos ) + + Quantum.Server.Item.SpawnItem( pos, loot, amount ) + end end else return