-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEntityScript.js
41 lines (30 loc) · 1.01 KB
/
EntityScript.js
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
40
41
/*
Not used for anything atm.
*/
function EntityScript(entity, comp){
this.me = entity;
frame.Updated.connect(this, this.Update);
console.LogInfo('Entityscript initialized');
//This print works. It prints AnimationController name: "", DynamicComponent name: ""
console.LogInfo(this.me.dynamiccomponent);
}
EntityScript.prototype.CheckAnims = function(){
if(this.me.animationcontroller.GetAvailableAnimations().length > 0){
this.EnableAnims();
this.me.dynamiccomponent.CreateAttribute()
}else
frame.DelayedExecute(0.1).Triggered.connect(this, this.CheckAnims);
}
EntityScript.prototype.EnableAnims = function(){
this.me.animationcontroller.EnableAnimation('PropAnim');
this.me.animationcontroller.EnableAnimation('SceneAnim');
}
EntityScript.prototype.Update = function(frametime){
if(server.IsRunning()){
}else{
if(!this.me.dynamiccomponent)
console.LogInfo('Wtf');
else if(this.me.dynamiccomponent.GetAttribute('Placed') == true)
this.CheckAnims();
}
}