// // CPT operator / SondeerGame // This source file is (c) by Deltares. // - October 2014 // class dialogSondeerComp extends GeoGUIPage; /// Just a wrapper class. /// Time in GEF: var int sondeertime; /// sondeerfile: var string SondeerFile; /// Maximum number of lines: var int MaximumLines; /// jln - 10-09-2008 are we currently var bool bAutomaticSonderen; const GEF_NONE = -1; const GEF_SondeerLengte = 0; const GEF_ConusWeerstand = 1; const GEF_Wrijving = 2; const GEF_Wrijvingsgetal = 3; const GEF_Waterspanning = 4; const GEF_ResultanteHelling = 5; const GEF_HellingNZ = 6; const GEF_HellingOW = 7; const GEF_Diepte = 8; const GEF_Tijd = 9; const GEF_Snelheid = 10; /// Current maximum speed: var float CurrentMax; /// Performed final nulmeting? var bool bPerformedFinalNulmeting; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); } function SetDisplacement(int what, float value) { /// Do nothing. Let overloaded take care of that. } function FinalNulMeting() { /// Do nothing. Let overloaded take care of that. } function float GetHelling() { /// Do nothing. Let overloaded take care of that. return 0; } function SetBroken() { /// Do nothing. Let overloaded take care of that. } /// jln - 12-12-2008 Don't forget to update the other version of the computer as well!! This is just Geomil. function bool InternalSondeerTimeUpdate() { local int levelnumber; local int time; local bool didpredig, returnedsoil, usedoriginalsoil, usedsand; local bool brokencable, checkedforair, usingcasing; local bool correctcone; local float helling; /// Setting up easy access variables: levelnumber = GeoPC.GetScenarioNumber(); time = sondeertime; didpredig = GeoPC.playeractions.PerformedPreDig; returnedsoil = GeoPC.playeractions.ReturnedSand; usedoriginalsoil = !GeoPC.playeractions.OnlyReturnedSand; usedsand = GeoPC.playeractions.OnlyReturnedSand; /// Cable still broken? brokencable = GeoPC.bCableBroken; /// Fixed? then false. if (GeoPC.playeractions.ReplacedCable == true) { brokencable = false; } checkedforair = GeoPC.playeractions.CheckedForAir; usingcasing = GeoPC.playeractions.UsingCasing; correctcone = GeoPC.playeractions.Hascorrectcone; switch (levelnumber) { case 1: /// Peak at friction: @ 1.5m - 1.6m when not predigged: if (didpredig == false) { if (sondeertime >= 15 && sondeertime <= 16) { /// should be conus weerstand, and wrijvingsgetal: SetDisplacement(GEF_ConusWeerstand, 3000); SetDisplacement(GEF_Wrijvingsgetal, 3000); /// Write that player hit a cable: GeoPC.playeractions.Level1HitCable = true; } else { SetDisplacement(GEF_ConusWeerstand, 1); SetDisplacement(GEF_Wrijvingsgetal, 1); } } /// Player did NOT return sand, so no values for the first 1.5m: if (returnedsoil == false && didpredig == true) { if (sondeertime <= 15) { /// should be at ALL columns SetDisplacement(GEF_ConusWeerstand, 0); SetDisplacement(GEF_Wrijving, 0); SetDisplacement(GEF_Wrijvingsgetal, 0); SetDisplacement(GEF_Waterspanning, 0); } else { /// Reset: SetDisplacement(GEF_ConusWeerstand, 1); SetDisplacement(GEF_Wrijving, 1); SetDisplacement(GEF_Wrijvingsgetal, 1); SetDisplacement(GEF_Waterspanning, 1); } } /// Start increasing the helling 3 meters before the end if (sondeertime > MaximumLines - 30) { helling = 1 + ((float(sondeertime) - (float(MaximumLines) - 30)) / 40); SetDisplacement(GEF_ResultanteHelling, helling); } break; case 2: /// Player did NOT return sand, so no values for the first 1.5m: if (returnedsoil == false && didpredig == true) { if (sondeertime <= 15) { /// should be at ALL columns SetDisplacement(GEF_ConusWeerstand, 0); SetDisplacement(GEF_Wrijving, 0); SetDisplacement(GEF_Wrijvingsgetal, 0); SetDisplacement(GEF_Waterspanning, 0); } else { /// Reset: SetDisplacement(GEF_ConusWeerstand, 1); SetDisplacement(GEF_Wrijving, 1); SetDisplacement(GEF_Wrijvingsgetal, 1); SetDisplacement(GEF_Waterspanning, 1); } } /// Start increasing the helling 3 meters before the end if (sondeertime > MaximumLines - 30) { helling = 1 + ((float(sondeertime) - (float(MaximumLines) - 30)) / 40); SetDisplacement(GEF_ResultanteHelling, helling); } break; case 3: /// Player did NOT return sand, so no values for the first 1.5m: /// Predig not necessary if (returnedsoil == false) { if (sondeertime <= 15) { /// should be at ALL columns SetDisplacement(GEF_ConusWeerstand, 0); SetDisplacement(GEF_Wrijving, 0); SetDisplacement(GEF_Wrijvingsgetal, 0); SetDisplacement(GEF_Waterspanning, 0); } else { /// Reset: SetDisplacement(GEF_ConusWeerstand, 1); SetDisplacement(GEF_Wrijving, 1); SetDisplacement(GEF_Wrijvingsgetal, 1); SetDisplacement(GEF_Waterspanning, 1); } } /// Break at 320. if (usingcasing == false) { if (sondeertime >= 290) { bAutomaticSonderen = false; setTimer(0); /// Disable buttons: SetBroken(); Controller.OpenMenu("GeoInterface.dialogAlert", IL8N("hasbroken")); } } break; case 4: /// Player did NOT return sand, so no values for the first 1.5m: if (returnedsoil == false && didpredig == true) { if (sondeertime <= 15) { /// should be at ALL columns SetDisplacement(GEF_ConusWeerstand, 0); SetDisplacement(GEF_Wrijving, 0); SetDisplacement(GEF_Wrijvingsgetal, 0); SetDisplacement(GEF_Waterspanning, 0); } else { /// Reset: SetDisplacement(GEF_ConusWeerstand, 1); SetDisplacement(GEF_Wrijving, 1); SetDisplacement(GEF_Wrijvingsgetal, 1); SetDisplacement(GEF_Waterspanning, 1); } } /// Start increasing the helling 3 meters before the end if (sondeertime > MaximumLines - 30) { helling = 1 + ((float(sondeertime) - (float(MaximumLines) - 30)) / 40); SetDisplacement(GEF_ResultanteHelling, helling); } break; } // Log("Player has correct cone: " @ CorrectCone); // Log("Brokencable: " @ brokencable); // Log("Correct cone: " @ CorrectCone); if (brokencable == true || CorrectCone == false) { // One column (waterspanning? with only values of 0. SetDisplacement(GEF_Waterspanning, 0); } if (GetHelling() > 13) { bAutomaticSonderen = false; setTimer(0); /// Disable buttons: SetBroken(); Controller.OpenMenu("GeoInterface.dialogAlert", IL8N("hasbroken")); } /// We are nearing the end of the GEf file: if (sondeertime > MaximumLines - 4) { Log("End of file"); // Stop sonderen: bAutomaticSonderen = false; setTimer(0); Controller.OpenMenu("GeoInterface.dialogAlert", IL8N("outofcolumns")); return false; } return true; } defaultproperties { AllowSelect = true bAllowedAsLast=true bDisconnectOnOpen=false bPersistent=false }