Mined items now spawn infront of player

master
E. Almqvist 5 years ago
parent d70ccb4c27
commit 015a5a0065
  1. 13
      gamemode/engine/lib/sh_node.lua

@ -159,12 +159,15 @@ if SERVER then
local itemTbl = Quantum.Item.Get( loot ) local itemTbl = Quantum.Item.Get( loot )
Quantum.Notify.ItemGathered( pl, itemTbl, amount ) Quantum.Notify.ItemGathered( pl, itemTbl, amount )
else else
local basepos = ent:GetPos() local eyepos = pl:GetEyeTraceNoCursor()
-- calculate the entities collision bounds height if( eyepos.Entity == ent ) then
local p, q = ent:GetCollisionBounds() -- Z is the height -- calculate the entities collision bounds height
local height = q.z - p.z 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 end
else else
return return

Loading…
Cancel
Save