コード例 #1
0
        public void Setup(SetupSelfContainedClass setup)
        {
            ParentArray = setup.AddObjectVariable(new InternalVar("ParentArray", _supplier.Any()));
            Pathmap     = setup.AddObjectVariable(new InternalVar("OriginMap", _pathfinderTypes.Pathmap.Instance));
            Destination = setup.AddObjectVariable(new InternalVar("Destination", _supplier.Vector()));

            setup.ObjectScope.AddNativeMethod(PathfindFunction);
            setup.ObjectScope.AddNativeMethod(Next);
        }
コード例 #2
0
 public static bool IsAny(ITypeSupplier supplier, CodeType type) => type.Implements(supplier.Any());
コード例 #3
0
        public void GetMeta()
        {
            _objectScope = PlayerVariableScope.Child();
            AddSharedFunctionsToScope(_objectScope);

            AddFunc(new FuncMethodBuilder()
            {
                Name          = "IsButtonHeld",
                Parameters    = new[] { new CodeParameter("button", _supplier.EnumType("Button")) },
                ReturnType    = _supplier.Boolean(),
                Action        = (set, call) => Element.Part("Is Button Held", set.CurrentObject, call.ParameterValues[0]),
                Documentation = "Determines if the target player is holding a button."
            });
            AddFunc(new FuncMethodBuilder()
            {
                Name          = "IsCommunicating",
                Parameters    = new[] { new CodeParameter("communication", _supplier.EnumType("Communication")) },
                ReturnType    = _supplier.Boolean(),
                Action        = (set, call) => Element.Part("Is Communicating", set.CurrentObject, call.ParameterValues[0]),
                Documentation = "Determines if the target player is communicating."
            });
            AddFunc(new FuncMethodBuilder()
            {
                Name          = "Stat",
                Parameters    = new[] { new CodeParameter("stat", _supplier.EnumType("PlayerStat")) },
                ReturnType    = _supplier.Number(),
                Action        = (set, call) => Element.Part("Player Stat", set.CurrentObject, call.ParameterValues[0]),
                Documentation = "Provides a statistic of the specified Player (limited to the current match). Statistics are only gathered when the game is in progress. Dummy bots do not gather statistics.",
            });
            AddFunc(new FuncMethodBuilder()
            {
                Name          = "HeroStat",
                Parameters    = new[] { new CodeParameter("hero", _supplier.Hero()), new CodeParameter("stat", _supplier.EnumType("PlayerHeroStat")) },
                ReturnType    = _supplier.Number(),
                Action        = (set, call) => Element.Part("Player Hero Stat", set.CurrentObject, call.ParameterValues[0], call.ParameterValues[1]),
                Documentation = "Provides a statistic of the specified Player's time playing a specific hero (limited to the current match). Statistics are only gathered when the game is in progress. Dummy bots do not gather statistics.",
            });
            AddFunc("Position", _supplier.Vector(), set => Element.PositionOf(set.CurrentObject), "The position of the player.");
            AddFunc("EyePosition", _supplier.Vector(), set => Element.EyePosition(set.CurrentObject), "The position of the player's head.");
            AddFunc("Team", _supplier.Any(), set => Element.Part("Team Of", set.CurrentObject), "The team of the player.");
            AddFunc("Health", _supplier.Number(), set => Element.Part("Health", set.CurrentObject), "The health of the player.");
            AddFunc("MaxHealth", _supplier.Number(), set => Element.Part("Max Health", set.CurrentObject), "The maximum health of the player.");
            AddFunc("FacingDirection", _supplier.Vector(), set => Element.FacingDirectionOf(set.CurrentObject), "The facing direction of the player.");
            AddFunc("Hero", _supplier.Any(), set => Element.Part("Hero Of", set.CurrentObject), "The hero of the player.");
            AddFunc("IsHost", _supplier.Boolean(), set => Element.Compare(set.CurrentObject, Operator.Equal, Element.Part("Host Player")), "Determines if the player is the host.");
            AddFunc("IsAlive", _supplier.Boolean(), set => Element.Part("Is Alive", set.CurrentObject), "Determines if the player is alive.");
            AddFunc("IsDead", _supplier.Boolean(), set => Element.Part("Is Dead", set.CurrentObject), "Determines if the player is dead.");
            AddFunc("IsCrouching", _supplier.Boolean(), set => Element.Part("Is Crouching", set.CurrentObject), "Determines if the player is crouching.");
            AddFunc("IsDummy", _supplier.Boolean(), set => Element.Part("Is Dummy Bot", set.CurrentObject), "Determines if the player is a dummy bot.");
            AddFunc("IsFiringPrimary", _supplier.Boolean(), set => Element.Part("Is Firing Primary", set.CurrentObject), "Determines if the player is firing their primary weapon.");
            AddFunc("IsFiringSecondary", _supplier.Boolean(), set => Element.Part("Is Firing Secondary", set.CurrentObject), "Determines if the player is using their secondary attack.");
            AddFunc("IsInAir", _supplier.Boolean(), set => Element.Part("Is In Air", set.CurrentObject), "Determines if the player is in the air.");
            AddFunc("IsOnGround", _supplier.Boolean(), set => Element.Part("Is On Ground", set.CurrentObject), "Determines if the player is on the ground.");
            AddFunc("IsInSpawnRoom", _supplier.Boolean(), set => Element.Part("Is In Spawn Room", set.CurrentObject), "Determines if the player is in the spawn room.");
            AddFunc("IsMoving", _supplier.Boolean(), set => Element.Part("Is Moving", set.CurrentObject), "Determines if the player is moving.");
            AddFunc("IsOnObjective", _supplier.Boolean(), set => Element.Part("Is On Objective", set.CurrentObject), "Determines if the player is on the objective.");
            AddFunc("IsOnWall", _supplier.Boolean(), set => Element.Part("Is On Wall", set.CurrentObject), "Determines if the player is on a wall.");
            AddFunc("IsPortraitOnFire", _supplier.Boolean(), set => Element.Part("Is Portrait On Fire", set.CurrentObject), "Determines if the player's portrait is on fire.");
            AddFunc("IsStanding", _supplier.Boolean(), set => Element.Part("Is Standing", set.CurrentObject), "Determines if the player is standing.");
            AddFunc("IsUsingAbility1", _supplier.Boolean(), set => Element.Part("Is Using Ability 1", set.CurrentObject), "Determines if the player is using their ability 1.");
            AddFunc("IsUsingAbility2", _supplier.Boolean(), set => Element.Part("Is Using Ability 2", set.CurrentObject), "Determines if the player is using their ability 2.");
        }
コード例 #4
0
        private TypeOperation GetDefaultOperation(string op, ITypeSupplier supplier)
        {
            if (Left.Type() == null || Right.Type() == null || Left.Type().IsConstant() || Right.Type().IsConstant())
            {
                return(null);
            }

            return(new TypeOperation(supplier, TypeOperation.TypeOperatorFromString(op), supplier.Any()));
        }
コード例 #5
0
 void ISelfContainedClass.Setup(SetupSelfContainedClass setup)
 {
     NodeBake = setup.AddObjectVariable(new InternalVar("NodeBake", Types.Any()));
     Pathmap  = setup.AddObjectVariable(new InternalVar("Pathmap", _pathfinderTypes.Pathmap.Instance));
     setup.ObjectScope.AddNativeMethod(Pathfind);
 }