Esempio n. 1
0
        public static IEnumerable <CodeInstruction> Transpiler(ILGenerator il, IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);
            int searchInstruction        = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Call, CheckSegmentProblemsMethod()), 0, 1, 3);

            if (searchInstruction != -1 &&
                codes[searchInstruction + 1].opcode.Equals(OpCodes.Ldc_I4_1) &&
                codes[searchInstruction + 2].opcode.Equals(OpCodes.Ret))
            {
                int startTarget         = searchInstruction + 3; //first instruction to remove, contains labels to copy
                int createPathCallIndex = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Callvirt, CreatePathMethod()), startTarget);

                if (createPathCallIndex != -1 && codes[createPathCallIndex + 1].opcode.Equals(OpCodes.Brfalse))
                {
                    List <Label> labels = codes[startTarget].labels;
                    codes.RemoveRange(startTarget, createPathCallIndex + 1 - startTarget);
                    codes.InsertRange(startTarget, GetInjectInstructions(labels));
                }
                else
                {
                    throw new Exception("Could not find CreatePath call or instructions has been patched");
                }
            }
            else
            {
                throw new Exception("Could not find 3rd. CheckSegmentProblems call or instructions has been patched");
            }

            return(codes);
        }
        public static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            int minus1OpIndex = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Ldc_I4_M1), 0);

            //check index and previous instruction
            if (minus1OpIndex != -1 && codes[minus1OpIndex + 1].opcode.Equals(OpCodes.Bne_Un))
            {
                int ldArg0Index = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Ldarg_0), minus1OpIndex);
                //check index and previous instruction
                if (ldArg0Index != -1 && codes[ldArg0Index - 1].opcode.Equals(OpCodes.Stfld))
                {
                    int targetIndex = minus1OpIndex + 2;//move index to first item to remove
                    // replace all instruction between targetIndex and Ldarg_0
                    codes.RemoveRange(targetIndex, ldArg0Index - targetIndex);

                    var newInstructions = new[] {
                        new CodeInstruction(OpCodes.Ldarg_1), // load node id
                        new CodeInstruction(OpCodes.Call, typeof(ClickNodeButtonPatch).GetMethod(nameof(ClickNodeButtonPatch.ToggleTrafficLight))),
                    };
                    codes.InsertRange(targetIndex, newInstructions);
                }
                else
                {
                    throw new Exception("Could not found Ldarg_0 Instruction or instruction was already patched!");
                }
            }
            else
            {
                throw new Exception("Could not found Ldc_I4_M1 Instruction or previous instruction was already patched!");
            }

            return(codes);
        }
Esempio n. 3
0
        internal static ResidentAIConnection GetConnection()
        {
            try {
                GetTaxiProbabilityResidentDelegate getTaxiProbability =
                    TranspilerUtil.CreateDelegate <GetTaxiProbabilityResidentDelegate>(
                        typeof(ResidentAI),
                        "GetTaxiProbability",
                        true);
                GetBikeProbabilityResidentDelegate getBikeProbability =
                    TranspilerUtil.CreateDelegate <GetBikeProbabilityResidentDelegate>(
                        typeof(ResidentAI),
                        "GetBikeProbability",
                        true);
                GetCarProbabilityResidentDelegate getCarProbability =
                    TranspilerUtil.CreateDelegate <GetCarProbabilityResidentDelegate>(
                        typeof(ResidentAI),
                        "GetCarProbability",
                        true);
                GetElectricCarProbabilityResidentDelegate getElectricCarProbability =
                    TranspilerUtil.CreateDelegate <GetElectricCarProbabilityResidentDelegate>(
                        typeof(ResidentAI),
                        "GetElectricCarProbability",
                        true);


                return(new ResidentAIConnection(
                           getTaxiProbability,
                           getBikeProbability,
                           getCarProbability,
                           getElectricCarProbability));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
        // code from: https://github.com/Strdate/SmartIntersections/blob/master/SmartIntersections/Patch/LoadPathsPatch.cs
        public static IEnumerable <CodeInstruction> Transpiler(ILGenerator il, IEnumerable <CodeInstruction> instructions)
        {
            var fTempNodeBuffer = AccessTools.DeclaredField(typeof(NetManager), nameof(NetManager.m_tempNodeBuffer))
                                  ?? throw new Exception("cound not find NetManager.m_tempNodeBuffer");
            var mClear = AccessTools.DeclaredMethod(fTempNodeBuffer.FieldType, nameof(FastList <ushort> .Clear))
                         ?? throw new Exception("cound not find m_tempNodeBuffer.Clear");
            var mAfterIntersectionBuilt = AccessTools.DeclaredMethod(
                typeof(LoadPathsPatch), nameof(AfterIntersectionBuilt))
                                          ?? throw new Exception("cound not find AfterIntersectionBuilt()");

            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            bool comp(int i) =>
            codes[i].opcode == OpCodes.Ldfld && codes[i].operand == fTempNodeBuffer &&
            codes[i + 1].opcode == OpCodes.Callvirt && codes[i + 1].operand == mClear;

            int index = TranspilerUtil.SearchGeneric(codes, comp, index: 0, counter: 2);

            index -= 1; // index to insert instructions.

            var newInstructions = new[] {
                new CodeInstruction(OpCodes.Ldarg_0), // load argument info
                new CodeInstruction(OpCodes.Call, mAfterIntersectionBuilt),
            };

            TranspilerUtil.InsertInstructions(codes, newInstructions, index);
            return(codes);
        }
Esempio n. 5
0
        internal static VehicleAIConnection GetConnection()
        {
            try {
                CalculateTargetSpeedDelegate      calculateTargetSpeedDelegate  = TranspilerUtil.CreateDelegate <CalculateTargetSpeedDelegate>(typeof(VehicleAI), "CalculateTargetSpeed", true);
                PathfindFailureDelegate           pathfindFailureDelegate       = TranspilerUtil.CreateDelegate <PathfindFailureDelegate>(typeof(CarAI), "PathfindFailure", true);
                PathfindSuccessDelegate           pathfindSuccessDelegate       = TranspilerUtil.CreateDelegate <PathfindSuccessDelegate>(typeof(CarAI), "PathfindSuccess", true);
                InvalidPathDelegate               invalidPathDelegate           = TranspilerUtil.CreateDelegate <InvalidPathDelegate>(typeof(VehicleAI), "InvalidPath", true);
                ParkVehicleDelegate               parkVehicleDelegate           = TranspilerUtil.CreateDelegate <ParkVehicleDelegate>(typeof(VehicleAI), "ParkVehicle", true);
                NeedChangeVehicleTypeDelegate     needChangeVehicleTypeDelegate = TranspilerUtil.CreateDelegate <NeedChangeVehicleTypeDelegate>(typeof(VehicleAI), "NeedChangeVehicleType", true);
                CalculateSegmentPositionDelegate  calculateSegmentPosition      = TranspilerUtil.CreateDelegate <CalculateSegmentPositionDelegate>(typeof(VehicleAI), "CalculateSegmentPosition", true);
                CalculateSegmentPositionDelegate2 calculateSegmentPosition2     = TranspilerUtil.CreateDelegate <CalculateSegmentPositionDelegate2>(typeof(VehicleAI), "CalculateSegmentPosition", true);
                ChangeVehicleTypeDelegate         changeVehicleTypeDelegate     = TranspilerUtil.CreateDelegate <ChangeVehicleTypeDelegate>(typeof(VehicleAI), "ChangeVehicleType", true);
                UpdateNodeTargetPosDelegate       updateNodeTargetPosDelegate   = TranspilerUtil.CreateDelegate <UpdateNodeTargetPosDelegate>(typeof(VehicleAI), "UpdateNodeTargetPos", true);
                ArrivingToDestinationDelegate     arrivingToDestinationDelegate = TranspilerUtil.CreateDelegate <ArrivingToDestinationDelegate>(typeof(VehicleAI), "ArrivingToDestination", true);
                LeftHandDriveDelegate             leftHandDriveDelegate         = TranspilerUtil.CreateDelegate <LeftHandDriveDelegate>(typeof(VehicleAI), "LeftHandDrive", true);

                return(new VehicleAIConnection(calculateTargetSpeedDelegate,
                                               pathfindFailureDelegate,
                                               pathfindSuccessDelegate,
                                               invalidPathDelegate,
                                               parkVehicleDelegate,
                                               needChangeVehicleTypeDelegate,
                                               calculateSegmentPosition,
                                               calculateSegmentPosition2,
                                               changeVehicleTypeDelegate,
                                               updateNodeTargetPosDelegate,
                                               arrivingToDestinationDelegate,
                                               leftHandDriveDelegate));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
Esempio n. 6
0
        public static IEnumerable <CodeInstruction> Transpiler(ILGenerator il, IEnumerable <CodeInstruction> instructions)
        {
            var fTempSegmentBuffer = AccessTools.DeclaredField(typeof(NetManager), nameof(NetManager.m_tempSegmentBuffer))
                                     ?? throw new Exception("Could not find NetManager.m_tempSegmentBuffer");
            var mSize = AccessTools.DeclaredField(fTempSegmentBuffer.FieldType, nameof(FastList <ushort> .m_size))
                        ?? throw new Exception("Could not find m_tempSegmentBuffer.m_size");
            var mAfterIntersectionBuilt = AccessTools.DeclaredMethod(
                typeof(LoadPathsPatch), nameof(AfterIntersectionBuilt))
                                          ?? throw new Exception("Could not find AfterIntersectionBuilt()");

            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            bool predicate(int i) =>
            codes[i].opcode == OpCodes.Blt &&
            codes[i - 1].opcode == OpCodes.Ldfld && codes[i - 1].operand == mSize &&
            codes[i - 2].opcode == OpCodes.Ldfld && codes[i - 2].operand == fTempSegmentBuffer;

            int index = TranspilerUtil.SearchGeneric(codes, predicate, index: 0, counter: 1);

            index += 1; // index to insert instructions. (end of the loop)

            var newInstructions = new[] {
                new CodeInstruction(OpCodes.Ldarg_0), // load argument info
                new CodeInstruction(OpCodes.Call, mAfterIntersectionBuilt),
            };

            TranspilerUtil.InsertInstructions(codes, newInstructions, index);
            return(codes);
        }
Esempio n. 7
0
        public static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            int minus1OpIndex = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Ldc_I4_M1), 0);

            //check index and previous instruction
            if (minus1OpIndex != -1 && codes[minus1OpIndex + 1].opcode.Equals(OpCodes.Bne_Un))
            {
                int ldArg0Index = TranspilerUtil.SearchInstruction(codes, new CodeInstruction(OpCodes.Ldarg_0), minus1OpIndex);
                //check index and previous instruction
                if (ldArg0Index != -1 && codes[ldArg0Index - 1].opcode.Equals(OpCodes.Stfld))
                {
                    int targetIndex = minus1OpIndex + 2;//move index to first item to remove
                    // replace all instruction between targetIndex and Ldarg_0
                    codes.RemoveRange(targetIndex, ldArg0Index - targetIndex);
                    codes.InsertRange(targetIndex, GetReplacementInstructions());
                }
                else
                {
                    throw new Exception("Could not found Ldarg_0 Instruction or instruction was already patched!");
                }
            }
            else
            {
                throw new Exception("Could not found Ldc_I4_M1 Instruction or previous instruction was already patched!");
            }

            return(codes);
        }
Esempio n. 8
0
        public static IEnumerable <CodeInstruction> Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes             = TranspilerUtil.ToCodeList(instructions);
            MethodInfo             calcStopPosAndDir = typeof(NetLane).GetMethod(nameof(NetLane.CalculateStopPositionAndDirection));

            CodeInstruction searchInstr = new CodeInstruction(OpCodes.Call, calcStopPosAndDir);
            int             index       = codes.FindIndex(instr => TranspilerUtil.IsSameInstruction(instr, searchInstr));

            if (index > -1)
            {
                int targetIndex     = index + 1;
                int replace1stIndex = targetIndex + 3;
                if (codes[replace1stIndex].opcode.Equals(OpCodes.Ldarg_2))
                {
                    codes.RemoveRange(replace1stIndex + 1, 6);
                    codes.Insert(replace1stIndex + 1, new CodeInstruction(OpCodes.Ldloc_3));
                }
                else
                {
                    throw new Exception("Could not find Ldarg.2 instruction or instructions has been patched");
                }
                codes.InsertRange(targetIndex, GetInstructions());
            }
            else
            {
                throw new Exception("Could not find CalculateStopPositionAndDirection call or instructions has been patched");
            }

            return(codes);
        }
Esempio n. 9
0
        internal static TrainAIConnection GetConnection()
        {
            try {
                UpdatePathTargetPositionsDelegate updatePathTargetPositionsDelegate =
                    TranspilerUtil.CreateDelegate <UpdatePathTargetPositionsDelegate>(
                        typeof(TrainAI),
                        "UpdatePathTargetPositions",
                        true);
                GetNoiseLevelDelegate getNoiseLevelDelegate =
                    TranspilerUtil.CreateDelegate <GetNoiseLevelDelegate>(
                        typeof(TrainAI),
                        "GetNoiseLevel",
                        true);
                GetMaxSpeedDelegate getMaxSpeedDelegate =
                    TranspilerUtil.CreateDelegate <GetMaxSpeedDelegate>(
                        typeof(TrainAI),
                        "GetMaxSpeed",
                        false);
                CalculateMaxSpeedDelegate calculateMaxSpeedDelegate =
                    TranspilerUtil.CreateDelegate <CalculateMaxSpeedDelegate>(
                        typeof(TrainAI),
                        "CalculateMaxSpeed",
                        false);
                ReverseDelegate reverseDelegate =
                    TranspilerUtil.CreateDelegate <ReverseDelegate>(
                        typeof(TrainAI),
                        "Reverse",
                        false);
                CalculateTargetSpeedTrainDelegate calculateTargetSpeedDelegate =
                    TranspilerUtil.CreateDelegate <CalculateTargetSpeedTrainDelegate>(
                        typeof(TrainAI),
                        "CalculateTargetSpeed",
                        true);
                CheckOverlapDelegate checkOverlapDelegate =
                    TranspilerUtil.CreateDelegate <CheckOverlapDelegate>(
                        typeof(TrainAI),
                        "CheckOverlap",
                        false);
                ForceTrafficLightsDelegate forceTrafficLightsDelegate =
                    TranspilerUtil.CreateDelegate <ForceTrafficLightsDelegate>(
                        typeof(TrainAI),
                        "ForceTrafficLights",
                        true);

                return(new TrainAIConnection(
                           updatePathTargetPositionsDelegate,
                           getNoiseLevelDelegate,
                           getMaxSpeedDelegate,
                           calculateMaxSpeedDelegate,
                           reverseDelegate,
                           calculateTargetSpeedDelegate,
                           checkOverlapDelegate,
                           forceTrafficLightsDelegate));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
        internal static HumanAIConnection GetConnection()
        {
            try {
                StartPathFindDelegate startPathFindCitizenAI =
                    TranspilerUtil.CreateDelegate <StartPathFindDelegate>(
                        typeof(CitizenAI),
                        "StartPathFind",
                        true);
                SimulationStepDelegate simulationStepCitizenAI =
                    AccessTools.MethodDelegate <SimulationStepDelegate>(
                        TranspilerUtil.DeclaredMethod <SimulationStepTarget>(typeof(CitizenAI), "SimulationStep"),
                        null,
                        false);
                ArriveAtDestinationDelegate arriveAtDestination =
                    TranspilerUtil.CreateDelegate <ArriveAtDestinationDelegate>(
                        typeof(HumanAI),
                        "ArriveAtDestination",
                        true);
                SpawnDelegate spawnCitizenAI =
                    TranspilerUtil.CreateDelegate <SpawnDelegate>(
                        typeof(HumanAI),
                        "Spawn",
                        true);
                InvalidPathHumanAIDelegate invalidPath =
                    TranspilerUtil.CreateDelegate <InvalidPathHumanAIDelegate>(
                        typeof(CitizenAI),
                        "InvalidPath",
                        true);
                PathfindFailureHumanAIDelegate pathfindFailure =
                    TranspilerUtil.CreateDelegate <PathfindFailureHumanAIDelegate>(
                        typeof(HumanAI),
                        "PathfindFailure",
                        true);
                PathfindSuccessHumanAIDelegate pathfindSuccess =
                    TranspilerUtil.CreateDelegate <PathfindSuccessHumanAIDelegate>(
                        typeof(HumanAI),
                        "PathfindSuccess",
                        true);

                return(new HumanAIConnection(
                           spawnCitizenAI,
                           startPathFindCitizenAI,
                           simulationStepCitizenAI,
                           arriveAtDestination,
                           invalidPath,
                           pathfindFailure,
                           pathfindSuccess));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Inserts MayDespawn call into the instruction chain
        /// </summary>
        /// <param name="instructions"></param>
        /// <returns></returns>
        public static IEnumerable <CodeInstruction> ReplaceSimulationStepIsCongestedCheck(IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            bool found = false;

            foreach (CodeInstruction instruction in codes)
            {
                if (!found && (instruction.opcode.Equals(OpCodes.Brfalse_S) || instruction.opcode.Equals(OpCodes.Brfalse)))
                {
                    found = true;
                    yield return(instruction);                                                                // return found instruction

                    yield return(new CodeInstruction(OpCodes.Ldsfld, _vehicleBehaviourManagerInstanceField)); // loadInstFiled

                    yield return(new CodeInstruction(OpCodes.Ldarg_1));                                       // vehicleID

                    yield return(new CodeInstruction(OpCodes.Ldarg_2));                                       // loadVehicleData

                    yield return(new CodeInstruction(OpCodes.Callvirt, _mayDespawnMethod));                   // callMayDespawn

                    yield return(instruction.Clone());                                                        //brfalse_s || brfalse - clone including label!
                }
                else
                {
                    yield return(instruction);
                }
            }

            /*
             * -----------------------------------------------------------------------------------
             * SimulationStep(ushort vehicleId, ref Vehicle vehicleData, Vector3 physicsLodRefPos)
             * -----------------------------------------------------------------------------------
             *
             * IL_0000: ldarg.2      // vehicleData
             * IL_0001: ldfld        valuetype ['Assembly-CSharp']Vehicle/Flags ['Assembly-CSharp']Vehicle::m_flags
             * IL_0006: ldc.i4       67108864 // 0x04000000
             * IL_000b: and
             * IL_000c: brfalse.s    IL_0027
             *
             * // NON-STOCK CODE START
             * IL_000e: ldsfld       class TrafficManager.Manager.Impl.VehicleBehaviorManager TrafficManager.Manager.Impl.VehicleBehaviorManager::Instance
             * IL_0013: ldarg.1     // vehicleID
             * IL_0013: ldarg.2      // vehicleData
             * IL_0014: callvirt     instance bool TrafficManager.Manager.Impl.VehicleBehaviorManager::MayDespawn(valuetype ['Assembly-CSharp']Vehicle&)
             * IL_0019: brfalse.s    IL_0027
             * // NON-STOCK CODE STOP
             *
             * ...
             */
        }
        public static bool ApplyPatch(Harmony harmonyInstance, Type simulationStepPatch1Type)
        {
            try {
                var original = TranspilerUtil.DeclaredMethod <TargetDelegate>(simulationStepPatch1Type, "Prefix");
                if (original == null)
                {
                    return(false);
                }

                var transpiler = typeof(RTramAIModPatch).GetMethod("TranspileRTramSimulationStepPatch1");
                harmonyInstance.Patch(original, transpiler: new HarmonyMethod(transpiler));
                return(true);
            }
            catch (Exception ex) {
                ex.LogException();
                return(false);
            }
        }
        internal static PassengerCarAIConnection GetConnection()
        {
            try {
                FindParkingSpaceDelegate findParkingSpaceDelegate =
                    AccessTools.MethodDelegate <FindParkingSpaceDelegate>(TargetMethod());
                FindParkingSpacePropDelegate findParkingSpacePropDelegate =
                    AccessTools.MethodDelegate <FindParkingSpacePropDelegate>(TargetMethodProp());
                FindParkingSpaceRoadSideDelegate findParkingSpaceRoadSideDelegate =
                    AccessTools.MethodDelegate <FindParkingSpaceRoadSideDelegate>(TargetMethodRoadSide());
                GetDriverInstanceDelegate getDriverInstanceDelegate =
                    TranspilerUtil.CreateDelegate <GetDriverInstanceDelegate>(typeof(PassengerCarAI), "GetDriverInstance", true);

                return(new PassengerCarAIConnection(findParkingSpaceDelegate,
                                                    findParkingSpacePropDelegate,
                                                    findParkingSpaceRoadSideDelegate,
                                                    getDriverInstanceDelegate));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Revrites instructions adding necessary TMPE calls
        /// </summary>
        /// <param name="il"> Il Generator</param>
        /// <param name="instructions">List of instructions</param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        public static IEnumerable <CodeInstruction> TranspileTramTrainSimulationStep(ILGenerator il, IEnumerable <CodeInstruction> instructions)
        {
            List <CodeInstruction> codes = TranspilerUtil.ToCodeList(instructions);

            MethodBase trySpawnCall = TranspilerUtil.DeclaredMethod <TrySpawnDelegate>(typeof(VehicleAI), "TrySpawn");

            CodeInstruction searchInstruction = new CodeInstruction(OpCodes.Callvirt, trySpawnCall);
            int             index             = codes.FindIndex(instruction => TranspilerUtil.IsSameInstruction(instruction, searchInstruction));

            if (index > -1)
            {
                int          target1   = index + 2;
                Label        label     = il.DefineLabel();
                List <Label> oldLabels = codes[target1].labels.ToList();
                codes[target1].labels.Clear();                 // clear labels -> they are moved to new instruction
                codes[target1].labels.Add(label);              //add label to next instruction (if() false jump)
                List <CodeInstruction> newInstructions = GetUpdatePositionInstructions(label);
                newInstructions[0].labels.AddRange(oldLabels); // add old labels to redirect here
                codes.InsertRange(target1, newInstructions);   // insert new instructions

                CodeInstruction searchInstruction2 = new CodeInstruction(OpCodes.Ldfld, typeof(Vehicle).GetField(nameof(Vehicle.m_blockCounter)));
                int             index2             = codes.FindIndex(instruction => TranspilerUtil.IsSameInstruction(instruction, searchInstruction2));
                if (index2 > -1 && codes[index2 + 1].opcode.Equals(OpCodes.Ldc_I4) && codes[index2 + 2].opcode.Equals(OpCodes.Bne_Un))
                {
                    int   target2  = index2 + 2;
                    Label retLabel = (Label)codes[target2].operand;
                    codes.InsertRange(target2 + 1, GetModifiedBlockCounterInstructions(retLabel));
                }
                else
                {
                    throw new Exception("Could not find m_blockCounter field usage or instructions has been patched");
                }
            }
            else
            {
                throw new Exception("Could not find TrySpawn call or instructions has been patched");
            }

            return(codes);
        }
Esempio n. 15
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(PathFind), nameof(PathFind.CalculatePath));
Esempio n. 16
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <SimulationStepDelegate>(typeof(TrainAI), "SimulationStep");
Esempio n. 17
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(HumanAI), "CheckTrafficLights");
Esempio n. 18
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(ResidentAI), "GetVehicleInfo");
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(TramBaseAI), nameof(TramBaseAI.SimulationStep));
Esempio n. 20
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(TrainAI), "ForceTrafficLights");
Esempio n. 21
0
 public static MethodBase TargetMethod() =>
 TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(PathManager), nameof(PathManager.CreatePath));
Esempio n. 22
0
 public static MethodBase TargetMethod2 <T>() =>
 TranspilerUtil.DeclaredMethod <TargetDelegate2>(typeof(T), "StartPathFind");
Esempio n. 23
0
 public static MethodBase GetCitizenAITargetMethod() =>
 TranspilerUtil.DeclaredMethod <CitizenAITargetDelegate>(typeof(CitizenAI), "StartPathFind");
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(TrainAI), "CheckNextLane");
 private static MethodInfo TargetMethod() =>
 TranspilerUtil.DeclaredMethod <FindParkingSpaceDelegate>(typeof(PassengerCarAI), "FindParkingSpace");
Esempio n. 26
0
 private static MethodBase CreatePathMethod() => TranspilerUtil.DeclaredMethod <CreatePathDelegate>(typeof(PathManager), "CreatePath");
Esempio n. 27
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <TargetDelegate>(typeof(PassengerCarAI), nameof(PassengerCarAI.GetLocalizedStatus));
Esempio n. 28
0
 public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod <CalculatePositionDelegate>(typeof(CarAI), "CalculateSegmentPosition");
Esempio n. 29
0
 private static MethodBase CheckSegmentProblemsMethod() => TranspilerUtil.DeclaredMethod <CheckSegmentProblemsDelegate>(typeof(TransportLineAI), "CheckSegmentProblems");