private VectorType() : base("Vector") { CanBeDeleted = false; CanBeExtended = false; Kind = "struct"; X = CreateInternalVar("X", "The X component of the vector."); Y = CreateInternalVar("Y", "The Y component of the vector."); Z = CreateInternalVar("Z", "The Z component of the vector."); HorizontalAngle = CreateInternalVar("HorizontalAngle", "The horizontal angle of the vector."); VerticalAngle = CreateInternalVar("VerticalAngle", "The vertical angle of the vector."); Zero = CreateInternalVar("Zero", "Equal to `Vector(0, 0, 0)`.", true); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <DistanceTo>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <CrossProduct>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <DotProduct>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <Normalize>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <DirectionTowards>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <FarthestPlayer>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <ClosestPlayer>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <IsInLineOfSight>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <Towards>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <AsLocalVector>()); objectScope.AddNativeMethod(CustomMethodData.GetCustomMethod <AsWorldVector>()); }
public AssetClass() : base("Asset") { Description = "Contains functions for displaying assets in the world."; StaticScope.AddNativeMethod(CustomMethodData.GetCustomMethod <ShowModel>()); StaticScope.AddNativeMethod(CustomMethodData.GetCustomMethod <CreateTextWithFont>()); StaticScope.AddNativeMethod(CustomMethodData.GetCustomMethod <CreateTextFancy>()); StaticScope.AddNativeMethod(CustomMethodData.GetCustomMethod <CreateText>()); }
public IMethod GetMethod(ScopeGroup getter, string name, Location location) { // Get the method by it's name. IMethod method = GetScopeable <UserMethod>(getter, name) // If it is not found, check if its a workshop method. ?? (IMethod)Element.GetElement(name) // Then check if its a custom method. ?? (IMethod)CustomMethodData.GetCustomMethod(name); // Throw if not found. if (method == null && location != null) { throw SyntaxErrorException.NonexistentMethod(name, location); } return(method); }
public override void ResolveElements() { if (elementsResolved) { return; } base.ResolveElements(); serveObjectScope.AddMethod(CustomMethodData.GetCustomMethod <Pathfind>(), null, null); serveObjectScope.AddMethod(CustomMethodData.GetCustomMethod <PathfindAll>(), null, null); serveObjectScope.AddMethod(CustomMethodData.GetCustomMethod <GetPath>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <StopPathfind>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <IsPathfinding>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <IsPathfindStuck>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <FixPathfind>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <NextNode>(), null, null); staticScope.AddMethod(CustomMethodData.GetCustomMethod <WalkPath>(), null, null); }
public PathmapClass() : base("Pathmap") { this.Constructors = new Constructor[] { new PathmapClassConstructor(this) }; Description = "A pathmap can be used for pathfinding."; ObjectScope = new Scope("class Pathmap"); ObjectScope.AddMethod(CustomMethodData.GetCustomMethod <Pathfind>(), null, null); ObjectScope.AddMethod(CustomMethodData.GetCustomMethod <PathfindAll>(), null, null); ObjectScope.AddMethod(CustomMethodData.GetCustomMethod <GetPath>(), null, null); StaticScope = new Scope("class Pathmap"); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <StopPathfind>(), null, null); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <IsPathfinding>(), null, null); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <IsPathfindStuck>(), null, null); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <FixPathfind>(), null, null); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <NextNode>(), null, null); StaticScope.AddMethod(CustomMethodData.GetCustomMethod <WalkPath>(), null, null); }
public IMethod GetMethod(string name) { return((IMethod)UserMethods?.FirstOrDefault(um => um.Name == name) ?? (IMethod)CustomMethodData.GetCustomMethod(name) ?? (IMethod)Element.GetElement(name)); }