|
|
|
@ -165,42 +165,42 @@ local function GetNodeInfo(objectId) |
|
|
|
|
return nodes[objectId] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local function DrawCrystalNode(draw, nx, ny, nz, color) |
|
|
|
|
draw:SetColor(unpack(color)) |
|
|
|
|
draw:SetWidth(2) |
|
|
|
|
draw:SetAlpha(200) |
|
|
|
|
|
|
|
|
|
-- Define the crystal shape once, outside of the function |
|
|
|
|
local baseSize = 1.5 |
|
|
|
|
local height = 3 |
|
|
|
|
local bobHeight = math.sin(GetTime() * 4) * 0.5 |
|
|
|
|
local baseZ = nz + 5 + bobHeight |
|
|
|
|
local halfHeight = height / 2 |
|
|
|
|
|
|
|
|
|
-- Bottom pyramid |
|
|
|
|
local v1 = {nx, ny, baseZ} |
|
|
|
|
local v2 = {nx - baseSize, ny - baseSize, baseZ + height/2} |
|
|
|
|
local v3 = {nx + baseSize, ny - baseSize, baseZ + height/2} |
|
|
|
|
local v4 = {nx + baseSize, ny + baseSize, baseZ + height/2} |
|
|
|
|
local v5 = {nx - baseSize, ny + baseSize, baseZ + height/2} |
|
|
|
|
local crystal_shape = { |
|
|
|
|
-- Lines from v1 to v2, v3, v4, v5 |
|
|
|
|
{0, 0, 0, -baseSize, -baseSize, halfHeight}, |
|
|
|
|
{0, 0, 0, baseSize, -baseSize, halfHeight}, |
|
|
|
|
{0, 0, 0, baseSize, baseSize, halfHeight}, |
|
|
|
|
{0, 0, 0, -baseSize, baseSize, halfHeight}, |
|
|
|
|
|
|
|
|
|
-- Top pyramid |
|
|
|
|
local v6 = {nx, ny, baseZ + height} |
|
|
|
|
-- Lines between v2-v3, v3-v4, v4-v5, v5-v2 |
|
|
|
|
{-baseSize, -baseSize, halfHeight, baseSize, -baseSize, halfHeight}, |
|
|
|
|
{ baseSize, -baseSize, halfHeight, baseSize, baseSize, halfHeight}, |
|
|
|
|
{ baseSize, baseSize, halfHeight, -baseSize, baseSize, halfHeight}, |
|
|
|
|
{-baseSize, baseSize, halfHeight, -baseSize, -baseSize, halfHeight}, |
|
|
|
|
|
|
|
|
|
-- Draw bottom pyramid |
|
|
|
|
draw:Line(v1[1], v1[2], v1[3], v2[1], v2[2], v2[3]) |
|
|
|
|
draw:Line(v1[1], v1[2], v1[3], v3[1], v3[2], v3[3]) |
|
|
|
|
draw:Line(v1[1], v1[2], v1[3], v4[1], v4[2], v4[3]) |
|
|
|
|
draw:Line(v1[1], v1[2], v1[3], v5[1], v5[2], v5[3]) |
|
|
|
|
-- Lines from v2, v3, v4, v5 to v6 |
|
|
|
|
{-baseSize, -baseSize, halfHeight, 0, 0, height}, |
|
|
|
|
{ baseSize, -baseSize, halfHeight, 0, 0, height}, |
|
|
|
|
{ baseSize, baseSize, halfHeight, 0, 0, height}, |
|
|
|
|
{-baseSize, baseSize, halfHeight, 0, 0, height}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
draw:Line(v2[1], v2[2], v2[3], v3[1], v3[2], v3[3]) |
|
|
|
|
draw:Line(v3[1], v3[2], v3[3], v4[1], v4[2], v4[3]) |
|
|
|
|
draw:Line(v4[1], v4[2], v4[3], v5[1], v5[2], v5[3]) |
|
|
|
|
draw:Line(v5[1], v5[2], v5[3], v2[1], v2[2], v2[3]) |
|
|
|
|
-- Modify the DrawCrystalNode function |
|
|
|
|
local function DrawCrystalNode(draw, nx, ny, nz, color) |
|
|
|
|
draw:SetColor(color) |
|
|
|
|
draw:SetWidth(2) |
|
|
|
|
draw:SetAlpha(200) |
|
|
|
|
|
|
|
|
|
local bobHeight = math.sin(GetTime() * 4) * 0.5 |
|
|
|
|
local baseZ = nz + 5 + bobHeight |
|
|
|
|
|
|
|
|
|
-- Draw top pyramid |
|
|
|
|
draw:Line(v2[1], v2[2], v2[3], v6[1], v6[2], v6[3]) |
|
|
|
|
draw:Line(v3[1], v3[2], v3[3], v6[1], v6[2], v6[3]) |
|
|
|
|
draw:Line(v4[1], v4[2], v4[3], v6[1], v6[2], v6[3]) |
|
|
|
|
draw:Line(v5[1], v5[2], v5[3], v6[1], v6[2], v6[3]) |
|
|
|
|
-- Use the pre-defined crystal_shape and position offsets |
|
|
|
|
draw:Array(crystal_shape, nx, ny, baseZ) |
|
|
|
|
|
|
|
|
|
-- Draw a small sphere at the top for emphasis |
|
|
|
|
draw:Circle(nx, ny, baseZ + height + 0.5, 0.3) |
|
|
|
@ -226,7 +226,7 @@ local function DrawNode(draw, nodeInfo, nx, ny, nz, objectId) |
|
|
|
|
DrawCrystalNode(draw, nx, ny, nz, color) |
|
|
|
|
|
|
|
|
|
if Builder:GetConfig("draw_lines") == "yes" then |
|
|
|
|
draw:SetColor(unpack(color)) |
|
|
|
|
draw:SetColor(color) |
|
|
|
|
draw:Line(px, py, pz, nx, ny, nz) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|