-
Notifications
You must be signed in to change notification settings - Fork 0
/
isinworld.txt
38 lines (33 loc) · 1006 Bytes
/
isinworld.txt
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
@name isinworld
@inputs Vec:vector
@outputs SafeVec:vector VecCheck:vector
#This attempts to find a location around the targetted vector that is inside the world-
#=If the targetted vector is outside the world
if(first()){
holoCreate(1) #you dont need this, this is just visual for the safepos
}
if(changed(Vec) & Vec != vec(0,0,0)){
if(Vec:isInWorld()){
#print("startinworld")
}
else{
#print(owner():name()+" fell out of the world") #I wouldn't recommend uncommenting this
timer("retryvec",10)
}}
if(clk("retryvec")){
VecCheck = Vec+vec(randint(-100,100),randint(-100,100),randint(-100,100))
timer("checksafe",10)
}
if(clk("checksafe")){
if(VecCheck:isInWorld()){
#print("newinworld")
SafeVec = Vec
stoptimer("retryvec")
stoptimer("checksafe")
holoPos(1,SafeVec)
}
else{
#print(owner():name()+" fell out of the world") #I wouldn't recommend uncommenting this
timer("retryvec",10)
}
}