forked from LeenkxTeam/LNXSDK
34 lines
849 B
Haxe
34 lines
849 B
Haxe
package leenkx.logicnode;
|
|
|
|
#if lnx_navigation
|
|
import leenkx.trait.navigation.Navigation;
|
|
import leenkx.trait.NavMesh;
|
|
import leenkx.trait.NavCrowd;
|
|
#end
|
|
|
|
import iron.object.Object;
|
|
import iron.math.Vec4;
|
|
|
|
class CrowdSetLocationNode extends LogicNode {
|
|
|
|
public function new(tree: LogicTree) {
|
|
super(tree);
|
|
}
|
|
|
|
override function run(from: Int) {
|
|
var navMeshId: String = inputs[1].get();
|
|
var object: Object = inputs[2].get();
|
|
var location: Vec4 = inputs[3].get();
|
|
|
|
#if lnx_navigation
|
|
var activeNavMesh: NavMesh = Navigation.active.navMeshes.get(navMeshId);
|
|
assert(Error, activeNavMesh != null, "No Navigation Mesh Present");
|
|
|
|
var crowdAgent: NavCrowd = object.getTrait(NavCrowd);
|
|
assert(Error, crowdAgent != null, "Object does not have a NavCrowd trait");
|
|
crowdAgent.crowdAgentTeleport(location);
|
|
#end
|
|
runOutput(0);
|
|
}
|
|
}
|