Esempio n. 1
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)
        }
Esempio n. 2
0
        private static void AddDistanceSetting(UIHelper group)
        {
            UITextField distanceField = null;

            distanceField = group.AddTextfield(Localize.Settings_RenderDistance, RenderDistance.ToString(), OnDistanceChanged, OnDistanceSubmitted) as UITextField;
Esempio n. 3
0
 public static void UpdateDrawDistance()
 {
     DrawDistance = (float)RenderDistance.GetValue();
 }