public override string GetBody(EditorScope scope)
        {
            var op     = (VMSetMotiveChangeOperand)Operand;
            var result = new StringBuilder();

            if (op.ClearAll)
            {
                result.Append("Clear all");
            }
            else
            {
                result.Append(scope.GetVarScopeDataName(VMVariableScope.MyMotives, (short)op.Motive));
                result.Append(" += ");
                result.Append(scope.GetVarName(op.DeltaOwner, op.DeltaData));

                if (!op.Once)
                {
                    result.Append(" (per hr)");
                }

                result.Append("\r\n Stop at ");
                result.Append(scope.GetVarName(op.MaxOwner, op.MaxData));
            }

            return(result.ToString());
        }
Beispiel #2
0
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMSleepOperand)Operand;
            var result = new StringBuilder();

            result.Append("for ticks in ");
            result.Append(scope.GetVarScopeDataName(VMVariableScope.Parameters, op.StackVarToDec));
            return(result.ToString());
        }
        public override string GetBody(EditorScope scope)
        {
            var op = (VMIdleForInputOperand)Operand;
            var result = new StringBuilder();
            result.Append("for ticks in ");
            result.Append(scope.GetVarScopeDataName(SimAntics.Engine.Scopes.VMVariableScope.Parameters, op.StackVarToDec));

            if (op.AllowPush > 0) result.Append(", Allow Push");

            return result.ToString();
        }
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMRelationshipOperand)Operand;
            var result = new StringBuilder();

            var old = (Operand is VMOldRelationshipOperand);

            if (op.SetMode == 0)
            {
                result.Append(scope.GetVarName(op.VarScope, op.VarData));
                result.Append(" := ");
            }
            result.Append(" Relationship Var #");
            result.Append(op.RelVar);
            result.Append("\r\n of ");
            result.Append(EditorScope.Behaviour.Get <STR>((ushort)(old?170:235)).GetString((int)op.Mode));
            if (op.Mode > 1)
            {
                result.Append(" (" + scope.GetVarScopeDataName(SimAntics.Engine.Scopes.VMVariableScope.Local, op.Local) + ")");
            }

            if (op.SetMode > 0)
            {
                result.Append("\r\n ");
                result.Append((op.SetMode == 1) ? ":= " : "+= ");
                result.Append(scope.GetVarName(op.VarScope, op.VarData));
            }

            var    flagStr = new StringBuilder();
            string prepend = "";

            if (op.FailIfTooSmall)
            {
                flagStr.Append(prepend + "Fail if too small"); prepend = ",";
            }
            if (op.UseNeighbor)
            {
                flagStr.Append(prepend + "Use Neighbor"); prepend = ",";
            }
            if (op.FSONeverPersist)
            {
                flagStr.Append(prepend + "Never Persist (FSO)"); prepend = ",";
            }

            if (flagStr.Length != 0)
            {
                result.Append("\r\n(");
                result.Append(flagStr);
                result.Append(")");
            }

            return(result.ToString());
        }
        public override string GetBody(EditorScope scope)
        {
            var op     = (VMIdleForInputOperand)Operand;
            var result = new StringBuilder();

            result.Append("for ticks in ");
            result.Append(scope.GetVarScopeDataName(SimAntics.Engine.Scopes.VMVariableScope.Parameters, op.StackVarToDec));

            if (op.AllowPush > 0)
            {
                result.Append(", Allow Push");
            }

            return(result.ToString());
        }
        public override string GetBody(EditorScope scope)
        {
            var op = (VMSetMotiveChangeOperand)Operand;
            var result = new StringBuilder();

            if (op.ClearAll) result.Append("Clear all");
            else
            {
                result.Append(scope.GetVarScopeDataName(VMVariableScope.MyMotives, (short)op.Motive));
                result.Append(" += ");
                result.Append(scope.GetVarName(op.DeltaOwner, op.DeltaData));

                if (!op.Once) result.Append(" (per hr)");

                result.Append("\r\n Stop at ");
                result.Append(scope.GetVarName(op.MaxOwner, op.MaxData));
            }

            return result.ToString();
        }
        public override string GetBody(EditorScope scope)
        {
            var op = (VMRelationshipOperand)Operand;
            var result = new StringBuilder();

            var old = (Operand is VMOldRelationshipOperand);

            if (op.SetMode == 0)
            {
                result.Append(scope.GetVarName(op.VarScope, op.VarData));
                result.Append(" := ");
            }
            result.Append(" Relationship Var #");
            result.Append(op.RelVar);
            result.Append("\r\n of ");
            result.Append(EditorScope.Behaviour.Get<STR>((ushort)(old?170:235)).GetString((int)op.Mode));
            if (op.Mode>1) result.Append(" ("+scope.GetVarScopeDataName(SimAntics.Engine.Scopes.VMVariableScope.Local, op.Local)+")");

            if (op.SetMode > 0)
            {
                result.Append("\r\n ");
                result.Append((op.SetMode == 1) ? ":= " : "+= ");
                result.Append(scope.GetVarName(op.VarScope, op.VarData));
            }

            var flagStr = new StringBuilder();
            string prepend = "";
            if (op.FailIfTooSmall) { flagStr.Append(prepend + "Fail if too small"); prepend = ","; }
            if (op.UseNeighbor) { flagStr.Append(prepend + "Use Neighbor"); prepend = ","; }

            if (flagStr.Length != 0)
            {
                result.Append("\r\n(");
                result.Append(flagStr);
                result.Append(")");
            }

            return result.ToString();
        }