Пример #1
0
        /// <summary>
        /// Creates a function which runs on a player if they have they get a score of the given type
        /// </summary>
        /// <param name="objectiveType">The score objective type. (See <see cref="ID.Objective"/> for a list of objectives)</param>
        /// <param name="creater">The function writer</param>
        /// <param name="functionName">The name of the function</param>
        /// <param name="setting">The setting used for writing the function file</param>
        /// <param name="runForEachScore">True if it should run the function for each number in the score. False if it only should run the function once when the score is higher than 1.</param>
        /// <returns>The newly created function</returns>
        public Function EventFunction(string objectiveType, Function.FunctionWriter creater, bool runForEachScore = false, string?functionName = null, BaseFile.WriteSetting setting = BaseFile.WriteSetting.LockedAuto)
        {
            Function outFunction = EventFunction(objectiveType, runForEachScore, functionName, setting);

            creater(outFunction);

            return(outFunction);
        }
Пример #2
0
        /// <summary>
        /// Creates a new randomly named function with the commands to the function
        /// </summary>
        /// <param name="creater">a method creating the function</param>
        /// <param name="setting">The settings for how to write the file</param>
        /// <returns>The newly created function</returns>
        public Function Function(Function.FunctionWriter creater, BaseFile.WriteSetting setting = BaseFile.WriteSetting.LockedAuto)
        {
            Function function = Function((string?)null, setting);

            creater(function);

            return(function);
        }
Пример #3
0
        /// <summary>
        /// Creates a function which runs on a player when all the given triggers gets triggered.
        /// </summary>
        /// <param name="triggers">The triggers to trigger</param>
        /// <param name="creater">The function writer</param>
        /// <param name="functionName">The name of the function</param>
        /// <param name="advancementName">The name of the advancement</param>
        /// <param name="setting">The settings for how to write the file</param>
        /// <returns>The newly created function</returns>
        public Function EventFunction(BaseTrigger[] triggers, Function.FunctionWriter creater, string?functionName = null, string?advancementName = null, BaseFile.WriteSetting setting = BaseFile.WriteSetting.LockedAuto)
        {
            Function outFunction = EventFunction(triggers, functionName, advancementName, setting);

            creater(outFunction);

            return(outFunction);
        }
Пример #4
0
 /// <summary>
 /// Runs the given commands as a function (The function is made as a sibling function)
 /// </summary>
 /// <param name="name">The name of the sibling function</param>
 /// <param name="writer">the commands to run</param>
 /// <param name="delay">the amount of time to function execution should be delayed. null doesnt delay it.
 /// (If value is other than null the function will ignore the arguments send in the execute command which executed it)</param>
 /// <param name="append">If the function is being scheduled: if false replace the last time the function was scheduled</param>
 /// <returns>The function</returns>
 public Function Function(string name, Function.FunctionWriter writer, NoneNegativeTime <int>?delay = null, bool append = true)
 {
     return((Function)Function(ForFunction.NewSibling(name, writer), delay, append));
 }