public TES5ObjectProperty CreateObjectProperty(string parentReferenceName, string childReferenceName, TES5ReferenceFactory referenceFactory, TES5LocalScope localScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            ITES5Referencer    parentReference = referenceFactory.CreateReference(parentReferenceName, globalScope, multipleScriptsScope, localScope);
            TES5ObjectProperty childReference  = CreateObjectProperty(parentReference, childReferenceName, multipleScriptsScope);//Todo rethink the prefix adding

            return(childReference);
        }
Пример #2
0
 public TES5ValueFactory(TES5ObjectCallFactory objectCallFactory, TES5ReferenceFactory referenceFactory, ESMAnalyzer esmAnalyzer)
 {
     this.objectCallFactory = objectCallFactory;
     this.referenceFactory  = referenceFactory;
     this.esmAnalyzer       = esmAnalyzer;
 }
Пример #3
0
 public TES5ObjectCall CreateGetActorBaseOfPlayer(TES5GlobalScope globalScope)
 {
     return(CreateGetActorBase(TES5ReferenceFactory.CreateReferenceToPlayer(globalScope)));
 }
Пример #4
0
        private void CreateActiveStateBlock(TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope, out TES5State state, out TES5EventCodeBlock onUpdate)
        {
            state = CreateState("ActiveState", false);
            TES5EventCodeBlock onBeginState = CreateEventCodeBlock("OnBeginState");

            onBeginState.CodeScope.CodeChunks.Add(this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToSelf(globalScope), "OnUpdate", multipleScriptsScope));
            state.AddBlock(onBeginState);
            onUpdate = CreateEventCodeBlock("OnUpdate");
            state.AddBlock(onUpdate);
        }
Пример #5
0
        /*
         * Add initial code to the blocks and return the scope in which conversion should occur
         * Sometimes, we want to add a bit of code before the converted code, or want to encapsulate whole converted code
         * with a branch or so - this is a place to do it.
         *
         *
         *
         *  Scope in which we want for conversion to happen
         */
        public TES5CodeScope AddInitialCode(TES5GlobalScope globalScope, TES5EventCodeBlock eventCodeBlock)
        {
            if (eventCodeBlock.BlockName == "OnUpdate")
            {
                if (globalScope.ScriptHeader.ScriptType.NativeType == TES5BasicType.T_QUEST)
                {
                    //Even though we"d like this script to not do anything at this time, it seems like sometimes condition races, so we"re putting it into a loop anyways but with early return bailout
                    TES5Branch branch = TES5BranchFactory.CreateSimpleBranch(TES5ExpressionFactory.CreateComparisonExpression(this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToSelf(globalScope), "IsRunning", new TES5ObjectCallArguments()), TES5ComparisonExpressionOperator.OPERATOR_EQUAL, new TES5Bool(false)), eventCodeBlock.CodeScope.LocalScope);
                    if (!globalScope.QuestHasOnUpdateRegisterForSingleUpdate)//WTM:  Change:  Added
                    {
                        //If quest has RegisterForSingleUpdate already, preventing adding it again.
                        //Previously, RegisterForSingleUpdate was being called multiple times in OnUpdate because of how CombineRepeatedEventCodeBlockNames splits multiple OnUpdate methods into separate functions.
                        //See TES4tutorialscript.psc for an example.
                        globalScope.QuestHasOnUpdateRegisterForSingleUpdate = true;
                        branch.MainBranch.CodeScope.AddChunk(this.objectCallFactory.CreateRegisterForSingleUpdate(globalScope));
                    }
                    branch.MainBranch.CodeScope.AddChunk(new TES5Return());
                    eventCodeBlock.AddChunk(branch);
                    return(eventCodeBlock.CodeScope);
                }

                /*else if (globalScope.ScriptHeader.BasicScriptType == TES5BasicType.T_OBJECTREFERENCE)
                 * {
                 *  TES5LocalScope localScope = eventCodeBlock.CodeScope.LocalScope;
                 *  TES5Branch branch = TES5BranchFactory.CreateSimpleBranch(TES5ExpressionFactory.CreateComparisonExpression(this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToSelf(globalScope), "GetParentCell", multipleScriptsScope, new TES5ObjectCallArguments()), TES5ComparisonExpressionOperator.OPERATOR_EQUAL, this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToPlayer(), "GetParentCell", multipleScriptsScope, new TES5ObjectCallArguments())), localScope);
                 *  eventCodeBlock.AddChunk(branch);
                 *  return branch.MainBranch.CodeScope;
                 * }*/
            }
            return(eventCodeBlock.CodeScope);
        }