Skip to content

Commit 7fd288b

Browse files
committed
Position 3D2D text based on hitbox height
1 parent 4d33852 commit 7fd288b

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

lua/autorun/ucs_config.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ MineableEntity["rock"] = {
4242
"models/props_debris/barricade_tall01a.mdl"
4343
},
4444
Tools = { ["weapon_crowbar"] = 5 },
45-
Drops = { ["ucs_iron"] = 100 },
46-
TextOffset = Vector( 20, 0, 0 )
45+
Drops = { ["ucs_iron"] = 100 }
4746
}
4847

4948
--Template crafting table; All options except name and model have fallbacks and are not required
@@ -75,8 +74,7 @@ CraftingTable["hl2"] = {
7574
Name = "HL2 Weapons Table",
7675
Model = "models/props_wasteland/controlroom_desk001b.mdl",
7776
ShouldExplode = true,
78-
AllowAutomation = true,
79-
TextOffset = Vector( 0, 0, 30 )
77+
AllowAutomation = true
8078
}
8179

8280
--Template Ingredient

lua/entities/ucs_mineable/cl_init.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ function ENT:Draw()
1212
local name = data.Name or "Unnamed Mineable Entity"
1313
local health = self:Health()
1414
local maxHealth = self:GetMaxHealth()
15+
16+
local min,max = self:GetHitBoxBounds( 0, 0 )
17+
if max then
18+
local converted = self:LocalToWorld( max )
19+
origin.z = converted.z + 15
20+
end
21+
1522
local pos = origin + offset
1623
local ang = ( ply:EyePos() - pos ):Angle()
1724
ang.p = 0

lua/entities/ucs_table/cl_init.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,13 @@ function ENT:Draw()
327327
local name = data.Name or "Unnamed Crafting Table"
328328
local health = self:Health()
329329
local maxHealth = self:GetMaxHealth()
330+
331+
local min,max = self:GetHitBoxBounds( 0, 0 )
332+
if max then
333+
local converted = self:LocalToWorld( max )
334+
origin.z = converted.z + 15
335+
end
336+
330337
local pos = origin + offset
331338
local ang = ( ply:EyePos() - pos ):Angle()
332339
ang.p = 0

lua/entities/ucs_table/shared.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ function ENT:GetData()
2020
return CraftingTable[typ]
2121
end
2222

23-
local version = "2.0"
23+
local version = "2.0.1"
2424
print( "Universal Crafting System v"..version.." by OPGman successfully loaded.\n" )

0 commit comments

Comments
 (0)