public void ApplyParameters()
        {
            // Set the return type to the Vector class if the value returns a vector.
            if (ElementValueType == ValueType.Vector)
            {
                CodeType = VectorType.Instance;
            }

            // Get the parameters.
            Parameters = new Parse.CodeParameter[WorkshopParameters.Length];
            for (int i = 0; i < Parameters.Length; i++)
            {
                string name        = WorkshopParameters[i].Name.Replace(" ", "");
                string description = Wiki?.GetWikiParameter(WorkshopParameters[i].Name)?.Description;

                if (WorkshopParameters[i] is VarRefParameter)
                {
                    Parameters[i] = new VariableParameter(
                        name,
                        description,
                        ((VarRefParameter)WorkshopParameters[i]).IsGlobal ? VariableType.Global : VariableType.Player,
                        new VariableResolveOptions()
                    {
                        CanBeIndexed = false,
                        FullVariable = true
                    }
                        );
                }
                else
                {
                    CodeType codeType = null;

                    // If the parameter is an enum, get the enum CodeType.
                    if (WorkshopParameters[i] is EnumParameter)
                    {
                        codeType = ValueGroupType.GetEnumType(((EnumParameter)WorkshopParameters[i]).EnumData);
                    }

                    var defaultValue = WorkshopParameters[i].GetDefault();

                    Parameters[i] = new CodeParameter(
                        name,
                        description,
                        codeType,
                        defaultValue == null ? null : new ExpressionOrWorkshopValue(defaultValue)
                        );

                    // If the default parameter value is an Element and the Element is restricted,
                    if (defaultValue is Element parameterElement && parameterElement.ElementList.Restricted != null)
                    {
                        // ...then add the restricted call type to the parameter's list of restricted call types.
                        Parameters[i].RestrictedCalls.Add((RestrictedCallType)parameterElement.ElementList.Restricted);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override CodeParameter[] Parameters() => new CodeParameter[]
 {
     new EconomicTextParameter("text", "The text to display. This is a string constant."),
     new CodeParameter("visibleTo", "The array of players that the text will be visible to."),
     new CodeParameter("location", "The location to display the text."),
     new CodeParameter("rotation", "The rotation of the text."),
     new CodeParameter("scale", "The scale of the text."),
     new CodeParameter("reevaluation", "Specifies which of this methods inputs will be continuously reevaluated, the text will keep asking for and using new values from reevaluated inputs.", ValueGroupType.GetEnumType <EffectRev>()),
     new ConstBoolParameter("getEffectIDs", "If true, the method will return the effect IDs used to create the text. Use `DestroyEffectArray()` to destroy the effect. This is a boolean constant.", false)
 };
Ejemplo n.º 3
0
 public override CodeParameter[] Parameters() => new CodeParameter[]
 {
     new ModelParameter("model", "File path of the model to use. Must be a `.obj` file."),
     new CodeParameter("visibleTo", "The array of players that the model will be visible to."),
     new CodeParameter("location", "The location that the model will be shown."),
     new CodeParameter("rotation", "The rotation of the model."),
     new CodeParameter("scale", "The scale of the model."),
     new CodeParameter("reevaluation", "Specifies which of this methods' inputs will be continuously reevaluated, the model will keep asking for and using new values from reevaluated inputs.", ValueGroupType.GetEnumType <EffectRev>()),
     new ConstBoolParameter("getEffectIDs", "If true, the method will return the effect IDs used to create the model. Use `DestroyEffectArray()` to destroy the effect. This is a boolean constant.", false)
 };
 public override CodeParameter[] Parameters() => new CodeParameter[]
 {
     new VariableParameter("variable", "The variable to manipulate. Player variables will chase the event player's variable. Must be a variable defined on the rule level.", VariableType.Dynamic, new VariableResolveOptions()
     {
         CanBeIndexed = false, FullVariable = true
     }),
     new CodeParameter("destination", "The value that the variable will eventually reach. The type of this value may be either a number or a vector, through the variable’s existing value must be of the same type before the chase begins. Can use number or vector based values."),
     new CodeParameter("rate", "The amount of change that will happen to the variable’s value each second."),
     new CodeParameter("reevaluation", "Specifies which of this action's inputs will be continuously reevaluated. This action will keep asking for and using new values from reevaluated inputs.", ValueGroupType.GetEnumType <RateChaseReevaluation>(), new ExpressionOrWorkshopValue(EnumData.GetEnumValue(RateChaseReevaluation.DestinationAndRate)))
 };
Ejemplo n.º 5
0
 public override CodeParameter[] Parameters() => new CodeParameter[]
 {
     new CodeParameter("waitBehavior", ValueGroupType.GetEnumType <WaitBehavior>(), new ExpressionOrWorkshopValue(EnumData.GetEnumValue(WaitBehavior.IgnoreCondition)))
 };
 public override CodeParameter[] Parameters() => new CodeParameter[]
 {
     new VariableParameter("variable", "The variable to modify. Player variables will modify the event player's variable."),
     new CodeParameter("operation", "The way in which the variable’s value will be changed. Options include standard arithmetic operations as well as array operations for appending and removing values.", ValueGroupType.GetEnumType <Operation>()),
     new CodeParameter("value", "The value used for the modification. For arithmetic operations, this is the second of two operands, with the other being the variable’s existing value. For array operations, this is the value to append or remove.")
 };