Last active
March 9, 2022 00:52
-
-
Save metacoma/c8d27b755b46a8a7268453f85608e6cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- register line | |
minetest.registry_line({ | |
initial_properties = { | |
color = "black", | |
width = "10" | |
}, | |
on_touch = function(player, ....) { | |
} | |
}, "minetest:simple_line") | |
local entity1 = minetest.add_entity(pos1, "minetest:entity1") | |
local entity2 = minetest.add_entity(pos2, "minetest:entity1") | |
-- draw the edge between two entities | |
local line = minetest.add_line(entity1, entity2, "minetest.simple_vector") | |
-- in an ideal world, after entities with an edge change position, the line redrawn too | |
entity1:set_pos(pos3) | |
-- when one of the entities is deleted, the vector between entities should be removed too. | |
-- for eample | |
entity2:remove() --should call line:remove() somewhere in minetest engine | |
-- change line color and width | |
line:set_properties({ | |
color: "red", | |
width: "11", | |
}) | |
-- some useful things | |
local lines = entity1.get_lines() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment