Example #1
0
 public static void UpdateDrawDistance()
 {
     DrawDistance = (float)RenderDistance.GetValue();
 }
Example #2
0
        public override void OnLoad()
        {
            gameObjects = new List <Objects>();

            //Player Vehicles
            // For each vehicle in the game, a new instance of Vehicle class is initialized.
            SATSUMA      = new Vehicle("SATSUMA(557kg, 248)");
            FLATBED      = new Vehicle("FLATBED");
            GIFU         = new Gifu("GIFU(750/450psi)");
            HAYOSIKO     = new Vehicle("HAYOSIKO(1500kg, 250)");
            JONNEZ       = new Vehicle("JONNEZ ES(Clone)");
            KEKMET       = new Vehicle("KEKMET(350-400psi)");
            RUSKO        = new Vehicle("RCO_RUSCKO12(270)");
            FERNDALE     = new Vehicle("FERNDALE(1630kg)");
            CABIN        = GameObject.Find("CABIN");
            AXLES        = SATSUMA.Object.GetComponent <Axles>();
            CAR_DYNAMICS = SATSUMA.Object.GetComponent <CarDynamics>();

            ModConsole.Print("Cars Done");

            //Locations and objects that can be enabled and disabled easily on proximity
            gameObjects.Add(new Objects(GameObject.Find("BOAT"))); //Boat is not a Car, oddly enough.
            gameObjects.Add(new Objects(GameObject.Find("COTTAGE")));
            gameObjects.Add(new Objects(GameObject.Find("DANCEHALL")));
            gameObjects.Add(new Objects(GameObject.Find("INSPECTION")));
            gameObjects.Add(new Objects(GameObject.Find("LANDFILL")));
            gameObjects.Add(new Objects(GameObject.Find("PERAJARVI")));
            gameObjects.Add(new Objects(GameObject.Find("RYKIPOHJA")));
            gameObjects.Add(new Objects(GameObject.Find("SOCCER")));
            gameObjects.Add(new Objects(GameObject.Find("WATERFACILITY")));
            gameObjects.Add(new Objects(GameObject.Find("TREES1_COLL")));
            gameObjects.Add(new Objects(GameObject.Find("TREES2_COLL")));
            gameObjects.Add(new Objects(GameObject.Find("TREES3_COLL")));

            // Initialize Store class
            STORE      = new Store();
            REPAIRSHOP = new RepairShop();
            gameObjects.Add(new Objects(GameObject.Find("DRAGRACE"), 1100));

            Transform buildings = GameObject.Find("Buildings").transform;

            // Find house of Teimo and detach it from Perajarvi, so it can be loaded and unloaded separately
            // It shouldn't cause any issues, but that needs testing.
            GameObject perajarvi = GameObject.Find("PERAJARVI");

            perajarvi.transform.Find("HouseRintama4").parent = buildings;
            // Same for chicken house
            perajarvi.transform.Find("ChickenHouse").parent = buildings;

            // Chicken house (barn) close to player's house
            Transform playerChickenHouse = GameObject.Find("Buildings").transform.Find("ChickenHouse");

            playerChickenHouse.parent = null;

            // Fix for church wall. Changing it's parent ot NULL, so it will not be loaded or unloaded.
            // It used to be changed to CHURCH gameobject,
            // but the Amis cars (yellow and grey cars) used to end up in the graveyard area.
            GameObject.Find("CHURCHWALL").transform.parent = null;

            // Fix for old house on the way from Perajarvi to Ventti's house (HouseOld5)
            perajarvi.transform.Find("HouseOld5").parent = buildings;

            // Perajarvi fixes for multiple objects with the same name.
            // Instead of being the part of Perajarvi, we're changing it to be the part of Buildings.
            foreach (Transform trans in perajarvi.GetComponentsInChildren <Transform>())
            {
                // Fix for disappearing grain processing plant
                // https://my-summer-car.fandom.com/wiki/Grain_processing_plant
                if (trans.gameObject.name.Contains("silo"))
                {
                    trans.parent = buildings;
                    continue;
                }

                // Fix for Ventti's and Teimo's mailboxes (and pretty much all mailboxes that are inside of Perajarvi)
                if (trans.gameObject.name == "MailBox")
                {
                    trans.parent = buildings;
                    continue;
                }

                // Fix for greenhouses on the road from Perajarvi to Ventti's house
                if (trans.name == "Greenhouse")
                {
                    trans.parent = buildings;
                    continue;
                }
            }

            // Possible fix for Jokke.
            // Needs testing
            foreach (Transform trans in GameObject.Find("KILJUGUY").transform.GetComponentsInChildren <Transform>())
            {
                gameObjects.Add(new Objects(trans.gameObject));
            }

            // Removes the mansion from the Buildings, so the tires will not land under the mansion.
            GameObject.Find("autiotalo").transform.parent = null;

            ModConsole.Print("GameObjects Done");

            //Things that should be enabled when out of proximity of the house
            gameObjects.Add(new Objects(GameObject.Find("NPC_CARS"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("RALLY"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("TRAFFIC"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("TRAIN"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("Buildings"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("TrafficSigns"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("ELEC_POLES"), awayFromHouse: true));
            gameObjects.Add(new Objects(GameObject.Find("StreetLights"), awayFromHouse: true));

            //TODO: Solve Bugs from Unloading/Reloading Satsuma
            // Bugs:
            // Can't open doors
            // May randomly fall through floor

            //TODO:
            // (*2) Figure out how to make repairs works at Fleetari's without loading it
            // (*1) Figure out how to trigger a restock at Tiemos on Thursdays without loading it.

            //NOTES:
            // (*1) Partially addressed the Teimo's issue, by unloading part of the shop
            // (*2) Partially addressed the same way as for Teimo's shop

            //Camera.main.farClipPlane = (int)RenderDistance.Value; //Helps with lower end GPU's. This specific value. Any others are wrong.
            PLAYER    = GameObject.Find("PLAYER");
            YARD      = GameObject.Find("YARD");                //Used to find out how far the player is from the Object
            KINEMATIC = SATSUMA.Object.GetComponent <Rigidbody>();

            // Initialize MinorObjects
            new MinorObjects();

            ModConsole.Print("[KruFPS] Found all objects");
            DrawDistance = float.Parse(RenderDistance.GetValue().ToString()); //Update saved draw distance variable
            HookAllSavePoints();                                              //Hook all save points (it's before first pass of Update)

            //Camera.main.gameObject.AddComponent<CameraHook>();
        }
Example #3
0
        public override void OnLoad()
        {
            gameObjects = new List <GameObject>();

            //Player Vehicles
            // For each vehicle in the game, a new instance of Vehicle class is initialized.
            SATSUMA      = new Vehicle("SATSUMA(557kg, 248)");
            SATSUMA_2    = GameObject.Find("SATSUMA(557kg, 248)");
            FLATBED      = new Vehicle("FLATBED");
            GIFU         = new Gifu("GIFU(750/450psi)");
            HAYOSIKO     = new Vehicle("HAYOSIKO(1500kg, 250)");
            JONNEZ       = new Vehicle("JONNEZ ES(Clone)");
            KEKMET       = new Vehicle("KEKMET(350-400psi)");
            RUSKO        = new Vehicle("RCO_RUSCKO12(270)");
            FERNDALE     = new Vehicle("FERNDALE(1630kg)");
            CABIN        = GameObject.Find("CABIN");
            AXLES        = SATSUMA_2.GetComponent <Axles>();
            CAR_DYNAMICS = SATSUMA_2.GetComponent <CarDynamics>();
            ModConsole.Print("Cars Done");

            //Locations and objects that can be enabled and disabled easily on proximity
            gameObjects.Add(GameObject.Find("BOAT")); //Boat is not a Car, oddly enough.
            //gameObjects.Add(GameObject.Find("CABIN"));
            gameObjects.Add(GameObject.Find("COTTAGE"));
            gameObjects.Add(GameObject.Find("DANCEHALL"));
            //gameObjects.Add(GameObject.Find("DRAGRACE")); //Is broken when disabled, so leave enabled
            gameObjects.Add(GameObject.Find("INSPECTION"));
            gameObjects.Add(GameObject.Find("LANDFILL"));
            gameObjects.Add(GameObject.Find("PERAJARVI"));
            //gameObjects.Add(GameObject.Find("REPAIRSHOP")); //Has to be loaded for repairs and such - Maybe fixable
            gameObjects.Add(GameObject.Find("RYKIPOHJA"));
            gameObjects.Add(GameObject.Find("SOCCER"));
            gameObjects.Add(GameObject.Find("WATERFACILITY"));
            gameObjects.Add(GameObject.Find("KILJUGUY"));
            gameObjects.Add(GameObject.Find("CHURCHWALL"));
            gameObjects.Add(GameObject.Find("TREES1_COLL"));
            gameObjects.Add(GameObject.Find("TREES2_COLL"));
            gameObjects.Add(GameObject.Find("TREES3_COLL"));

            // Initialize Store class
            STORE      = new Store();
            REPAIRSHOP = new RepairShop();

            // Find house of Teimo and detach it from Perajarvi, so it can be loaded and unloaded separately
            // It shouldn't cause any issues, but that needs testing.
            GameObject perajarvi   = GameObject.Find("PERAJARVI");
            GameObject TEIMO_HOUSE = perajarvi.transform.Find("HouseRintama4").gameObject;

            TEIMO_HOUSE.transform.parent = null;
            // Same for chicken house
            GameObject CHICKEN_HOUSE = perajarvi.transform.Find("ChickenHouse").gameObject;

            CHICKEN_HOUSE.transform.parent = null;

            // Now that Teimo's house and chicken house is separated from Perajarvi, we can manage them separately. We're throwing them to gameObjects.
            // Fixes the bug with both dissapearing when leaving Perajarvi, even tho logically they should still load when approached.
            gameObjects.Add(TEIMO_HOUSE);
            gameObjects.Add(CHICKEN_HOUSE);

            // Fix for disappearing grain processing plant
            // https://my-summer-car.fandom.com/wiki/Grain_processing_plant
            //
            // It also puts them to farGameObjects - objects that are larger and need to be rendered from further distance
            foreach (Transform trans in perajarvi.GetComponentsInChildren <Transform>())
            {
                if (trans.gameObject.name.Contains("silo"))
                {
                    trans.parent = null;
                    farGameObjects.Add(trans.gameObject);
                }
            }

            // Chicken house (barn) close to player's house
            Transform playerChickenHouse = GameObject.Find("Buildings").transform.Find("ChickenHouse");

            playerChickenHouse.parent = null;
            gameObjects.Add(playerChickenHouse.gameObject);

            ModConsole.Print("GameObjects Done");

            //Things that should be enabled when out of proximity of the house
            awayFromHouse = new List <GameObject>();
            awayFromHouse.Add(GameObject.Find("NPC_CARS"));
            awayFromHouse.Add(GameObject.Find("RALLY"));
            awayFromHouse.Add(GameObject.Find("TRAFFIC"));
            awayFromHouse.Add(GameObject.Find("TRAIN"));
            awayFromHouse.Add(GameObject.Find("Buildings"));
            awayFromHouse.Add(GameObject.Find("TrafficSigns"));
            awayFromHouse.Add(GameObject.Find("ELEC_POLES"));

            //TODO: Solve Bugs from Unloading/Reloading Satsuma
            // Bugs:
            // Can't open doors
            // May randomly fall through floor

            //TODO:
            // Figure out how to make repairs works at Fleetari's without loading it
            // (*1) Figure out how to trigger a restock at Tiemos on Thursdays without loading it.

            //NOTES:
            // (*1) Partially addressed the Teimo's issue, by unloading part of the shop

            //Camera.main.farClipPlane = (int)RenderDistance.Value; //Helps with lower end GPU's. This specific value. Any others are wrong.
            PLAYER    = GameObject.Find("PLAYER");
            YARD      = GameObject.Find("YARD");                //Used to find out how far the player is from the Object
            KINEMATIC = SATSUMA.Object.GetComponent <Rigidbody>();

            // Get all minor objects from the game world (like beer cases, sausages)
            // Only items that are in the listOfMinorObjects list, and also contain "(itemx)" in their name will be loaded
            // UPDATED: added support for (Clone) items
            GameObject[] allObjects = Object.FindObjectsOfType <GameObject>();
            foreach (GameObject gameObject in allObjects)
            {
                foreach (string itemName in listOfMinorObjects)
                {
                    if (gameObject.name.Contains(itemName) && gameObject.name.ContainsAny("(itemx)", "(Clone)"))
                    {
                        minorObjects.Add(gameObject);
                    }
                }
            }

            ModConsole.Print("[KruFPS] Found all objects");
            DrawDistance = float.Parse(RenderDistance.GetValue().ToString()); //Update saved draw distance variable
            HookAllSavePoints();                                              //Hook all save points (it's before first pass of Update)
        }