forked from lznt/p2Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidgetScript2.js
More file actions
39 lines (38 loc) · 1.01 KB
/
Copy pathWidgetScript2.js
File metadata and controls
39 lines (38 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var thingie =
{
highlightName : "MySpecialHighlight",
handleClick : function(ent, button, raycast)
{
print ("Entity clicked: " + ent);
this.toggleHover(ent);
},
toggleHover : function(ent)
{
var h = ent.GetComponent("EC_Highlight", this.highlightName);
if (h == null)
{
print ("- Enabling selection");
h = ent.CreateComponent("EC_Highlight", this.highlightName, 2, false);
h.temporary = true;
}
else
{
print ("- Disabling selection");
ent.RemoveComponent(h, 2);
}
},
getSelectedEntities : function()
{
scene.EntitiesWithComponent("EC_Highlight", this.highlightName);
},
init:
{
print ("client running");
sceneinteract.EntityClicked.connect(this, this.handleClick);
}
};
if (!server.IsRunning())
thingie.init();
// Somewhere in your code
var selected = thingie.getSelectedEntities();
print ("Selected: ", selected);