public override void OnNewGame() { SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "pulleySaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "beltSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "turbineSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "pipeSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "pipe_rac_carbSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "turbinegaugeSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "pipe_2_carbSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "switch_buttonSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "headgasketSaveInfo"); SaveLoad.SerializeSaveFile <PartSaveInfo>(this, null, "filterSaveInfo"); SaveLoad.SerializeSaveFile <Safeinfo>(this, null, "Safeinfo"); ModConsole.Print("Supercharger for Satsuma was resetting."); }
public override void Run(string[] args) { ModConsole.Print(string.Format("Unity: <b>{0}</b>", Application.unityVersion)); try { ModConsole.Print(string.Format("MSC buildID: <b>{0}</b>", Steamworks.SteamApps.GetAppBuildId())); // Get steam buildID } catch (Exception e) { ModConsole.Error( string.Format("<color=red>Failed to get build ID:</color> <b>{0}</b>", e.Message)); // Show steamworks error } ModConsole.Print( string.Format("MSCLoader: <b>{0}</b>", ModLoader.MSCLoader_Ver)); ModConsole.Print(string.Format("Runtime: <b>{0}</b>", System.Reflection.Assembly.GetExecutingAssembly().ImageRuntimeVersion)); }
private void Load() { //ModConsole.Print("Load()"); string path = Path.Combine(Application.persistentDataPath, "trailer.xml"); //ModConsole.Print("Save Patch:" + path); if (File.Exists(path)) { TrailerBehaviour.SaveData saveData = SaveUtil.DeserializeReadFile <SaveData>(path); //ModConsole.Print("Set save Location: " + saveData.posX + "," + saveData.posY + "," + saveData.posZ); base.transform.position = (new Vector3(saveData.posX, saveData.posY, saveData.posZ)); base.transform.rotation = (Quaternion.Euler(saveData.rotX, saveData.rotY, saveData.rotZ)); } else { //ModConsole.Print("Set base Location"); base.transform.position = (new Vector3(-1551.468f, 2.93f, 1178.136f)); base.transform.rotation = (Quaternion.Euler(0F, 323.95f, 0f)); } Support = transform.FindChild("Support"); Support.localScale = new Vector3(1f, 1f, 1f); wheelColliders[0] = base.transform.FindChild("WheelColliders/WheelColliderL").GetComponent <WheelCollider>(); wheelColliders[1] = base.transform.FindChild("WheelColliders/WheelColliderR").GetComponent <WheelCollider>(); for (int i = 0; i < 2; i++) { WheelFrictionCurve foward = wheelColliders[i].forwardFriction; foward.extremumSlip = 0.001f; wheelColliders[i].forwardFriction = foward; } tireMeshes[0] = base.transform.FindChild("Mesh/Tires/TireL").GetComponent <Transform>(); tireMeshes[1] = base.transform.FindChild("Mesh/Tires/TireR").GetComponent <Transform>(); if (GameObject.Find("SATSUMA(557kg, 248)") != null) { //ModConsole.Print("Carregou Satsuma"); SATSUMA = GameObject.Find("SATSUMA(557kg, 248)"); } if (GameObject.Find("PLAYER/Pivot/Camera/FPSCamera/1Hand_Assemble/Hand") != null) { //ModConsole.Print("Carregou CAMERA"); CAMERA = GameObject.Find("PLAYER/Pivot/Camera/FPSCamera/1Hand_Assemble/Hand"); } else { ModConsole.Print("Player NULL"); } }
//Called when mod is loading public override void OnLoad() { ModConsole.Print("Initializing OpenVR"); if (!OpenVRInit()) { return; } mainCamera = Camera.main; /*ModConsole.Print(mainCamera.cullingMask); * mainCamera.cullingMask = ~mainCamera.cullingMask; * * mainCamera.enabled = false;*/ ModConsole.Print(SystemInfo.graphicsDeviceVersion); System.Diagnostics.Trace.WriteLine("Initializing our own D3D11 device"); d3d11Device = new SharpDX.Direct3D11.Device(SharpDX.Direct3D.DriverType.Hardware, SharpDX.Direct3D11.DeviceCreationFlags.Debug); hook = new D3D11Hook(); hook.Create(); System.Diagnostics.Trace.WriteLine("Getting RenderTarget Size"); uint w = 0, h = 0; vrSystem.GetRecommendedRenderTargetSize(ref w, ref h); vrRig = new VRRig((int)w, (int)h); System.Diagnostics.Trace.WriteLine("Fetching Unity D3D11 Device"); var devChild = vrRig.leftTexture.QueryInterface <SharpDX.Direct3D11.DeviceChild>(); unityRenderer = devChild.Device; devChild.Dispose(); ModConsole.Print(unityRenderer.CreationFlags & SharpDX.Direct3D11.DeviceCreationFlags.SingleThreaded); vrRenderer = new VRRenderer(d3d11Device, unityRenderer, vrRig); hook.OnRender += HookRender; System.Diagnostics.Trace.WriteLine("All done"); ModConsole.Print("MSCVR initialized"); }
/* "Debug" */ private void DumpObjects() { //We put it in a try block. try { //Path to debug.txt dump. (Same folder as mysummercar.exe) string file_path = "ChildObjects.txt"; //Declare an array and define its name. GameObject[] allObjects; //Declare an StreamWriter and define its name but also initialize it with given parmiters System.IO.StreamWriter sr = System.IO.File.CreateText(file_path); //We Initialize allObjects and give it the array values of GameObjects allObjects = UnityEngine.Object.FindObjectsOfType <GameObject>(); //We write first line of the document to give it a "header" like appearance. sr.WriteLine("SceneObjects=>FindObjectsOfType<GameObject>:"); //For every GameObject in allObjects we print the name of the object in to the file "SceneObjects.txt" foreach (var fsm in Resources.FindObjectsOfTypeAll <PlayMakerFSM>()) { var fsmfloat = new Func <string, FsmFloat>(fsm.FsmVariables.FindFsmFloat); { if (fsm.gameObject.transform.root.name == "Database") { sr.WriteLine(fsm.gameObject.name); } } } //We write down the name of each object in the array. foreach (GameObject obj in allObjects) { sr.WriteLine(obj.name); } //We close the StreamWriter... sr.Close(); //Clean up console.. ModConsole.Clear(); //Print out a success message in console. ModConsole.Print("SceneObjects: Success creating " + file_path); } catch (System.Exception) { ModConsole.Print("Something went wrong..."); } }
public override void SecondPassOnLoad() { // Written, 20.09.2021 GameObject satsuma = GameObject.Find("SATSUMA(557kg, 248)"); GameObject[] wheels = Object.FindObjectsOfType <GameObject>().Where(go => vaildWheelNames.Any(vwn => vwn == go.name)).ToArray(); wheelParts = new Part[wheels.Length]; saveData = loadData(); Trigger trigger = new Trigger("spareTireTrigger", satsuma, new Vector3(0, -0.053f, -1.45f), Vector3.forward * 90); AssemblyTypeJointSettings jointSettings = new AssemblyTypeJointSettings(satsuma.GetComponent <Rigidbody>()); PartSettings settings = new PartSettings() { assembleType = AssembleType.joint, setPositionRotationOnInitialisePart = false, assemblyTypeJointSettings = jointSettings, setPhysicsMaterialOnInitialisePart = true }; for (int i = 0; i < wheels.Length; i++) { GameObject wheel = wheels[i]; PlayMakerFSM useFsm = wheel.GetPlayMaker("Use"); PlayMakerFSM removalFsm = wheel.GetPlayMaker("Removal"); string wheelID = useFsm.FsmVariables.GetFsmString("ID").Value; bool isThisWheelInstall = false; if (saveData?.installedWheelID == wheelID) { isThisWheelInstall = useFsm.FsmVariables.GetFsmString("Corner").Value == ""; } wheelParts[i] = wheel.AddComponent <Part>(); wheelParts[i].defaultSaveInfo = new PartSaveInfo() { installed = wheelID == "wheel_steel5" && !removalFsm.enabled }; wheelParts[i].initPart(isThisWheelInstall ? new PartSaveInfo() { installed = true } : null, settings, trigger); } ModConsole.Print(string.Format("{0} v{1}: Loaded.", Name, Version)); }
public override void OnLoad() { // Add keybinds Keybind.Add(this, _pickUpKey); Keybind.Add(this, _dropAllKey); Keybind.Add(this, _dropSelectedKey); Keybind.Add(this, _toggleGuiKey); Keybind.Add(this, _toggleSettingsKey); // Find gameobjects and variables _playerInMenu = PlayMakerGlobals.Instance.Variables.FindFsmBool("PlayerInMenu"); _pauseMenu = Resources.FindObjectsOfTypeAll <GameObject>().Single(o => o.name == "OptionsMenu"); // Welcome text ModConsole.Print("[Backpack] Loaded!"); ModConsole.Print("[Backpack] Settings can be accessed by pressing Ctrl + X."); }
public override void Update() { { if (saveKey.GetKeybind()) { PLAYER = GameObject.Find("PLAYER"); PlayMakerFSM[] componentsInChildren = PLAYER.GetComponentsInChildren <PlayMakerFSM>(); ModConsole.Print("PlayMakerFSM"); for (int i = 0; i < componentsInChildren.Length; i++) { PlayMakerFSM playMakerFSM = componentsInChildren[i]; } PlayMakerFSM.BroadcastEvent("SAVEGAME"); Application.LoadLevel("MainMenu"); } } }
//Noclip Toggle private void NoclipToggle() { if (_flyEnabled == false) { justEnabled = false; justDisabled = false; showToggleTextTimer.Stop(); showToggleTextTimer.Enabled = false; _flyEnabled = true; this.justEnabled = true; var player = GameObject.Find("PLAYER"); foreach (var fsm in player.GetComponents <Collider>()) { fsm.enabled = false; } this.showToggleTextTimer.Enabled = true; this.showToggleTextTimer.Elapsed += this.HideNoclipEnabledLabel; } else { justEnabled = false; justDisabled = false; showToggleTextTimer.Stop(); showToggleTextTimer.Enabled = false; _flyEnabled = false; this.justDisabled = true; ModConsole.Print(this.justDisabled); var player = GameObject.Find("PLAYER"); foreach (var fsm in player.GetComponents <Collider>()) { fsm.enabled = true; } this.showToggleTextTimer.Enabled = true; this.showToggleTextTimer.Elapsed += this.HideNoclipDisabledLabel; } }
/// <summary> /// Occurs on mod load (Game load). /// </summary> public override void OnLoad() { // Written, 10.03.2019 // Creating input data in cInput.. cInput.SetKey(QUICKSAVE_CINPUT_NAME, "F5", "None"); cInput.SetKey(QUICKLOAD_CINPUT_NAME, "F6", "None"); GameObject quickSaveLoad = new GameObject(this.ID); // Removing experimental warning as you get this every time you reset MSCLoader (when quick save/load). if (!(bool)ModSettings_menu.expWarning.Value) { ModSettings_menu.expWarning.Value = true; } this.quickSaveLoadInstance = quickSaveLoad.AddComponent <QuickSaveLoadMono>(); // initializing quicksaveload instance. ModConsole.Print(string.Format("{0} v{1}: Loaded", this.Name, this.Version)); }
public void OnGUI() { if (show) { try { StartCoroutine(DisapearBoxAfter()); } catch (Exception e) { ModConsole.Print(e); throw; } // GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 100, 20), "Hello Worldasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!"); } }
public override void OnLoad() { // Written, 11.05.2019 this.timerSaveData = this.LoadData(); if (this.timerSaveData is null) { this.timerSaveData = new GameSaveTimerSaveData() { startedFromNewGame = false }; } GameSaveTimerSaveData.gameStartTime = this.timerSaveData.timePassed; ModConsole.Print(this.Name + ": Loaded"); }
public override void Run(string[] args) { if (args.Length < 1) { return; } if (args[0] == "flicker") { if (args.Length == 2) { _mod._flickerTimer = float.Parse(args[1]); _mod._flickerLength = 1.0f; } else if (args.Length == 3) { _mod._flickerTimer = float.Parse(args[1]); _mod._flickerLength = float.Parse(args[2]); } ModConsole.Print($"Timer: {_mod._flickerTimer.ToString("0")}, length: {_mod._flickerLength.ToString("0")}"); } if (args[0] == "health") { if (args.Length == 2) { _mod._bulbHealth = int.Parse(args[1]); } ModConsole.Print($"Bulb health: {_mod._bulbHealth}"); } if (args[0] == "info") { ModConsole.Print("\n-- Floodlight info --"); ModConsole.Print(_mod._battery == null ? "Battery is disconnected" : $"Battery is connected, {_mod._batteryCharge.Value.ToString("0.0")} charge"); ModConsole.Print($"Light is {(_mod._on ? "on" : "off")}, tilted {(-_mod._pitch).ToString("0")}°"); ModConsole.Print($"Bulb health is {_mod._bulbHealth}, costs {_mod._bulbHealth}"); ModConsole.Print($"Flickering after {_mod._flickerTimer}, for {_mod._flickerLength} seconds"); } if (args[0] == "help") { ModConsole.Print(_helpString); } }
/// <summary> /// Occurs when a purchase contains one or more vaild fluid containers. /// </summary> private void fluidContainerSpawned() { // Written, 02.05.2019 Thread spawnThread = new Thread(delegate() { Thread.Sleep(delay); // 2.5f second delay (allows time for items to spawn). if (this.shoppingBagSpawn) { GameObject shoppingBagSpawn = GameObject.Find("STORE/LOD/Shop/ShoppingBagSpawn"); // Location of all shopping bags in game. for (int i = 0; i < shoppingBagSpawn.transform.childCount; i++) // enumerating over all child gameobjets (a shopping bag) of bag spawn. { GameObject shoppingBag = shoppingBagSpawn.transform.GetChild(i).gameObject; GameObject spawnBag = shoppingBag.transform.GetChild(shoppingBag.transform.childCount - 1).gameObject; // SpawnBag child contains all items purchased (with an id). for (int j = 0; j < spawnBag.transform.childCount; j++) { GameObject child = spawnBag.transform.GetChild(j).gameObject; // maybe brake fluid conatiner. if (child.name.Contains("brakefluid")) { FsmHook.FsmInject(shoppingBag, "Play anim", this.fluidContainerSpawned); #if DEBUG ModConsole.Print(string.Format("<b>[fluidContainerSpawned] -</b> Injected shopping bag, (index: {0}).", i)); #endif break; } } } this.shoppingBagSpawn = false; } EnchancedFluidContainersMod.setFluidContainers(); }); spawnThread.Start(); #if DEBUG ModConsole.Print("<b>[fluidContainerSpawned] -</b> One or more vaild fluid container/s purchased; efcm component addition delayed by, " + delay + "ms"); if (this.shoppingBagSpawn) { ModConsole.Print("<b>[fluidContainerSpawned] -</b> Shopping bag will be injected."); } #endif }
public override void OnLoad() { // Called once, when mod is loading after game is fully loaded timerlastcheck = Time.deltaTime; warningfirst = false; warningsecond = false; // We're storing the player and Fittan transforms on load. // Looking for objects every frame is very expensive. player = GameObject.Find("PLAYER").transform; fittan = GameObject.Find("TRAFFIC").transform.Find("VehiclesDirtRoad/Rally/FITTAN").transform; playerCurrentVehicleFsmString = FsmVariables.GlobalVariables.FindFsmString("PlayerCurrentVehicle"); ModConsole.Print("<color=yellow>Cousin Tracker v" + Version + " loaded</color>"); }
private void WheelieRun() { //Find PV and front fork try { GameObject jonne = GameObject.Find("JONNEZ ES(Clone)"); GameObject fork = GameObject.Find("ForkFront"); Rigidbody jonneRB = jonne.GetComponent <Rigidbody>(); //WheelieForce jonneRB.AddForceAtPosition(jonne.transform.up * this._wheelieSensitivity, fork.transform.position, ForceMode.Acceleration); } catch (Exception e) { ModConsole.Print(e); throw; } }
private static void Move(string thingToMove, bool inverted = false, int distance = 5) //5 is ideal for 16:9 { try { GameObject selected = GameObject.Find(thingToMove); if (!inverted) { distance *= -1; } var pos = selected.transform.position + new Vector3(distance, 0, 0); selected.transform.position = pos; ModConsole.Print("UI Mover Moved: " + thingToMove); } catch { ModConsole.Print("UI Mover Moved: " + thingToMove + " does not exist!"); } }
private void Start() { try { //ModConsole.Print("Load Hitch"); base.gameObject.name = "hitch"; base.gameObject.layer = LayerMask.NameToLayer("Parts"); base.gameObject.tag = "PART"; //ModConsole.Print("Find Trailer"); Load(); // ModConsole.Print("Hitch Loaded"); }catch (Exception E) { ModConsole.Print("Start Hitch Error: " + E.ToString()); } }
public void StopServer() { try { ModConsole.Print("Stopping server"); if (Server != null) { Server.Stop(); Server = null; } ModConsole.Print("Server is not running"); } catch (Exception ex) { ModConsole.Error("Could not stop server:\n" + ex.ToString()); } ModConsole.Print("Server stopped"); }
private void OnBagTriggerStay(Collider collider) { // bail out if this collider was connected or it has a parent (carried in hand) if (_joints.ContainsKey(collider) || collider.transform.parent != null) { return; } // bail out if collider object has no rigidbody var rigidbody = collider.GetComponent <Rigidbody>(); if (rigidbody == null) { rigidbody = collider.GetComponentInParent <Rigidbody>(); } if (rigidbody == null) { #if DEBUG ModConsole.Print("no rigidbody"); #endif return; } // bail if rigidbody is still moving if (rigidbody.velocity.sqrMagnitude > 0.001f) { #if DEBUG ModConsole.Print("still moving"); #endif return; } // all good attach to car and disable collision var joint = transform.parent.gameObject.AddComponent <FixedJoint>(); joint.connectedBody = collider.attachedRigidbody; joint.enableCollision = false; joint.breakForce = 5000f; _joints.Add(collider, joint); #if DEBUG ModConsole.Print($"connected {collider.gameObject.name}"); #endif }
List <CarPart> MkParts(IEnumerable <GameObject> allParts) { var ps = new List <CarPart>(); foreach (var part in allParts) { var p = CarPart.TryCreate(part); if (p == null) { ModConsole.Print("Can't make part: " + part.name); continue; } ps.Add(p); } return(ps); }
public override void OnLoad() { // Original AssetBundle ab = LoadAssets.LoadBundle(this, "pack.unity3d"); GameObject original = ab.LoadAsset <GameObject>("pack.prefab"); _pack = GameObject.Instantiate <GameObject>(original); _pack.name = "nicotine gum"; Material m = new Material(Shader.Find("Standard")); m.mainTexture = original.GetComponent <Renderer>().material.mainTexture; _pack.GetComponent <Renderer>().material = m; GameObject.Destroy(original); ab.Unload(false); // Load save GumSaveData data = GumSaveData.Deserialize <GumSaveData>(GumSaveData.SavePath); for (int i = 0; i < data.Pos.Count; ++i) { GameObject gum = GameObject.Instantiate <GameObject>(_pack); gum.transform.position = data.Pos[i]; gum.transform.rotation = data.Rot[i]; GumBehaviour c = gum.AddComponent <GumBehaviour>(); c.ShopList = _list; c.Count = data.GumCount[i]; c.Activate(); c.SetBought(); } // Setup FatigueFsm = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerFatigue"); StressFsm = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerStress"); StressRateFsm = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerStressRate"); DrunkFsm = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerDrunk"); ThirstFsm = PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerThirst"); InitShop(); ConsoleCommand.Add(new GumCommand(this)); ModConsole.Print($"[Gum] has loaded without issue"); }
private IEnumerator TrashTeleporter() { if (cube1 && notcreated && !trashEmptied) { trashEmptied = true; Collider[] hitColliders = Physics.OverlapSphere(cube1.transform.position, cube1.transform.localScale.x); foreach (var VARIABLE in hitColliders) { if (VARIABLE.GetComponent <Rigidbody>()) { ModConsole.Print(string.Format("<color=lime><b>TRASHCAN: </b></color><color=#6495ED><b>" + VARIABLE.name.ToUpper() + " </b></color><color=orange><b>SENT TO LANDFILL!</b></color>")); // VARIABLE.transform.position = new Vector3(0,-50000,0); foreach (var fsm in GameObject.Find("PLAYER").GetComponentsInChildren <PlayMakerFSM>()) { foreach (var evento in fsm.FsmEvents) { if (evento.Name == "PROCEED Drop") { fsm.SendEvent(evento.Name); } } } foreach (var vector3 in PlayMakerGlobals.Instance.Variables.GameObjectVariables) { ModConsole.Print(vector3.Name + " | " + vector3.Value); } Object.Destroy(VARIABLE.gameObject); File.Delete(Application.persistentDataPath + "/items.txt"); } } yield return(new WaitForSeconds(10)); trashEmptied = false; } }
void Update() { try { if (_386Games.nextGameKey.IsDown()) { m_softwareIndex++; if (m_softwareIndex >= m_software.Length) { m_softwareIndex = 0; } BorkSounds(); for (var i = 0; i < m_software.Length; ++i) { m_computer.transform.FindChild("SYSTEM/" + m_software[i]).gameObject.SetActive(i == m_softwareIndex); } } if (_386Games.prevGameKey.IsDown()) { m_softwareIndex--; if (m_softwareIndex < 0) { m_softwareIndex = m_software.Length - 1; } BorkSounds(); for (var i = 0; i < m_software.Length; ++i) { m_computer.transform.FindChild("SYSTEM/" + m_software[i]).gameObject.SetActive(i == m_softwareIndex); } } } catch (Exception e) { ModConsole.Print(e.ToString()); throw; } }
private void CreateJoint() { try { //ModConsole.Print("Criando Joint Hitch"); FixedJoint Joint = base.gameObject.GetComponent <FixedJoint>(); if (Joint != null) { if (SATSUMA.GetComponent <Rigidbody>() != null) { Joint.connectedBody = SATSUMA.GetComponent <Rigidbody>(); } // ModConsole.Print("Joint Criada"); } } catch (Exception e) { ModConsole.Print(e.ToString()); } }
public override void Update() { if (AmountLeft > 0) { float d = FatigueSpeed * Time.deltaTime; FatigueFsm.Value += d; AmountLeft -= d; } if (OverdoseAmount > 0.0f) { OverdoseAmount -= 0.3f * Time.deltaTime; } if (OverdoseAmount >= 100.0f) { StressFsm.Value = 800.0f; DrunkFsm.Value = 3.0f; ModConsole.Print($"[Pills] Overdose"); OverdoseAmount = 50.0f; } }
public override void OnLoad() { Keybind.Add(this, tpToCar); Keybind.Add(this, tpCarToMe); Keybind.Add(this, tpToMuscle); Keybind.Add(this, tpMuscleToMe); Keybind.Add(this, tpToTruck); Keybind.Add(this, tpTruckToMe); Keybind.Add(this, tpToTractor); Keybind.Add(this, tpTractorToMe); Keybind.Add(this, tpToVan); Keybind.Add(this, tpVanToMe); Keybind.Add(this, tpToHome); Keybind.Add(this, tpToStore); Keybind.Add(this, tpToRepair); Keybind.Add(this, tpToDrag); ModConsole.Print("Teleport Plugin has been loaded!"); }
public override void OnLoad() { Keybind.Add(this, towingMenuKey); Keybind.Add(this, towingAcceptKey); ModConsole.Print("Towing Mod has been loaded!"); foreach (CarDynamics car in GameObject.FindObjectsOfType <CarDynamics>()) { if (!blacklistedCars.Contains(car.name)) { cars.Add(car.gameObject); } } player = GameObject.Find("PLAYER"); playerCam = player.transform.Find("Pivot/AnimPivot/Camera/FPSCamera/FPSCamera").gameObject.GetComponent <Camera>(); TowVehicle += TowingMod_TowVehicle; isLoaded = true; }
internal void Setup(string path) { try { m_magazineDirectory = new FileInfo(path).Directory.Name; Load(); GameHook.InjectStateHook(GameObject.Find("STORE/StoreCashRegister/Register"), "Purchase", OnBuyHook); m_baseFile = path; m_data = SaveUtil.DeserializeReadFile <Magazine>(m_baseFile); GameHook.InjectStateHook(GameObject.Find("ITEMS"), "Save game", Save); ModConsole.Print("Setting up " + m_data.name); m_guiUseBool = PlayMakerGlobals.Instance.Variables.FindFsmBool("GUIuse"); m_guiBuyBool = PlayMakerGlobals.Instance.Variables.FindFsmBool("GUIbuy"); m_guiInteractString = PlayMakerGlobals.Instance.Variables.FindFsmString("GUIinteraction"); m_rigidbody = GetComponent <Rigidbody>(); if (IsBought) { MakeInteractable(); transform.position = new Vector3(m_saveData.posX, m_saveData.posY, m_saveData.posZ); transform.rotation = Quaternion.Euler(m_saveData.rotX, m_saveData.rotY, m_saveData.rotZ); } else { // add this for sale Magazines.Instance.Rack.AddMagazineForSale(this); } m_files = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(path), "Pages")); m_files = m_files.ToList().OrderBy(f => int.Parse(Path.GetFileNameWithoutExtension(f))).ToArray(); StartCoroutine(Magazines.LoadImage(m_files[0], SetCover)); } catch (Exception e) { ModConsole.Error(e.ToString()); } }
public override void Run(string[] args) { if (args.Length < 1) { return; } try { if (args[0] == "flicker") { if (args.Length == 2) { _comp.SetFlicker(float.Parse(args[1]), -1.0f); } else if (args.Length == 3) { _comp.SetFlicker(float.Parse(args[1]), float.Parse(args[2])); } } if (args[0] == "health") { _comp.SetHealth(int.Parse(args[1])); } if (args[0] == "info") { _comp.PrintInfo(); } if (args[0] == "help") { ModConsole.Print(_helpString); } } catch (Exception ex) { ModConsole.Error(ex.Message); } }