Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "Vehicle"
- {
- "WheelsPerAxle" "2"
- "Body"
- {
- "CounterTorqueFactor" "0.9"
- "MassCenterOverride" "0 -3 13"
- "MassOverride" "1467"
- "AddGravity" "0.7"
- "MaxAngularVelocity" "720"
- }
- "Engine"
- {
- "HorsePower" "301"
- "MaxRPM" "4200"
- "MaxSpeed" "95"
- "MaxReverseSpeed" "28"
- "AutobrakeSpeedGain" "1.1"
- "AutobrakeSpeedFactor" "3"
- "Autotransmission" "0"
- "AxleRatio" "4.56"
- "Gear" "3.2"
- "Gear" "2.4"
- "Gear" "1.5"
- "Gear" "1"
- "Gear" "0.84"
- "ShiftUpRPM" "3800"
- "ShiftDownRPM" "1600"
- }
- "Steering"
- {
- "DegreesSlow" "40"
- "DegreesFast" "12"
- "DegreesBoost" "11"
- "FastDampen" "0"
- "SteeringExponent" "1.4"
- "SlowCarSpeed" "12"
- "FastCarSpeed" "60"
- "SlowSteeringRate" "3"
- "FastSteeringRate" "2"
- "SteeringRestRateSlow" "3"
- "SteeringRestRateFast" "2"
- "TurnThrottleReduceSlow" "0.01"
- "TurnThrottleReduceFast" "0.6"
- "BrakeSteeringRateFactor" "3"
- "ThrottleSteeringRestRateFactor" "2"
- "BoostSteeringRestRateFactor" "1.7"
- "BoostSteeringRateFactor" "1.7"
- "PowerSlideAccel" "250"
- "SkidAllowed" "1"
- "DustCloud" "1"
- }
- "Axle"
- {
- "Wheel"
- {
- "Radius" "15"
- "Mass" "270"
- "Inertia" "0"
- "Damping" "0.3"
- "RotDamping" "0.2"
- "Material" "jeeptire"
- "SkidMaterial" "slidingrubbertire"
- "BrakeMaterial" "brakingrubbertire"
- }
- "Suspension"
- {
- "SpringConstant" "90"
- "SpringDamping" "0.5"
- "StabilizerConstant" "0"
- "SpringDampingCompression" "7"
- "MaxBodyForce" "10"
- }
- "TorqueFactor" "0.95"
- "BrakeFactor" "0.4"
- }
- "Axle"
- {
- "Wheel"
- {
- "Radius" "15"
- "Mass" "230"
- "Inertia" "0"
- "Damping" "0"
- "RotDamping" "0"
- "Material" "jeeptire"
- "SkidMaterial" "slidingrubbertire"
- "BrakeMaterial" "brakingrubbertire"
- }
- "Suspension"
- {
- "SpringConstant" "70"
- "SpringDamping" "0.5"
- "StabilizerConstant" "0"
- "SpringDampingCompression" "7"
- "MaxBodyForce" "15"
- }
- "TorqueFactor" "0"
- "BrakeFactor" "0.6"
- }
- }
- "Vehicle_Sounds"
- {
- "Gear"
- {
- "Max_Speed" "0.06"
- "Speed_Approach_Factor" "1"
- }
- "Gear"
- {
- "Max_Speed" "0.25"
- "Speed_Approach_Factor" "0.08"
- }
- "Gear"
- {
- "Max_Speed" "0.35"
- "Speed_Approach_Factor" "0.05"
- }
- "Gear"
- {
- "Max_Speed" "0.55"
- "Speed_Approach_Factor" "0.035"
- }
- "Gear"
- {
- "Max_Speed" "1"
- "Speed_Approach_Factor" "0.01"
- }
- "State"
- {
- "Name" "SS_SHUTDOWN_WATER"
- "Sound" "atv_stall_in_water"
- "Min_Time" "0"
- }
- "State"
- {
- "Name" "SS_GEAR_2_RESUME"
- "Sound" "vehiclestdmcarsfocusrsthird.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_START_WATER"
- "Sound" "atv_start_in_water"
- "Min_Time" "0"
- }
- "State"
- {
- "Name" "SS_GEAR_3_RESUME"
- "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_REVERSE"
- "Sound" "vehiclestdmcarsfocusrsrev.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_IDLE"
- "Sound" "vehiclestdmcarsfocusrsidle.wav"
- "Min_Time" "0"
- }
- "State"
- {
- "Name" "SS_GEAR_1_RESUME"
- "Sound" "vehiclestdmcarsfocusrsfirst.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_GEAR_4"
- "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_GEAR_1"
- "Sound" "vehiclestdmcarsfocusrsfirst.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_SLOWDOWN_HIGHSPEED"
- "Sound" "vehiclestdmcarsfocusrsthrottle_off.wav"
- "Min_Time" "0"
- }
- "State"
- {
- "Name" "SS_SHUTDOWN"
- "Sound" "vehiclestdmcarsslsamgengineoff.mp3"
- "Min_Time" "0"
- }
- "State"
- {
- "Name" "SS_START_IDLE"
- "Sound" "vehiclestdmcarsslsamgenginestart.mp3"
- "Min_Time" "0.3"
- }
- "State"
- {
- "Name" "SS_GEAR_4_RESUME"
- "Sound" "vehiclestdmcarsfocusrsfourth_cruise.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_GEAR_3"
- "Sound" "vehiclestdmcarsfocusrsthird.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_GEAR_0_RESUME"
- "Sound" "vehiclestdmcarsfocusrsfirst.wav"
- "Min_Time" "0.75"
- }
- "State"
- {
- "Name" "SS_GEAR_0"
- "Sound" "vehiclestdmcarsfocusrsidle.wav"
- "Min_Time" "0.08"
- }
- "State"
- {
- "Name" "SS_GEAR_2"
- "Sound" "vehiclestdmcarsfocusrssecond.wav"
- "Min_Time" "0.5"
- }
- "State"
- {
- "Name" "SS_SLOWDOWN"
- "Sound" "vehiclestdmcarsfocusrsidle.wav"
- "Min_Time" "0"
- }
- "CrashSound"
- {
- "Min_Speed" "350"
- "Min_Speed_Change" "250"
- "Sound" "atv_impact_medium"
- "Gear_Limit" "1"
- }
- "CrashSound"
- {
- "Min_Speed" "450"
- "Min_Speed_Change" "350"
- "Sound" "atv_impact_heavy"
- "Gear_Limit" "0"
- }
- "Skid_LowFriction" ""
- "Skid_NormalFriction" ""
- "Skid_HighFriction" ""
- }
- <?php
- // simple demo parser that will parse tokens surrounded by " from a file that
- // only contains whitespace in the form of spaces or newlines aside from these
- // tokens
- // For example something like this:
- /*
- "hello"
- "this"
- "is"
- "a"
- "Test"
- "10.9"
- */
- // parse a token from the string
- // assume opening " has already been encountered
- // note the pass by reference!
- function parse_token($textData, &$index, &$token) {
- $token = "";
- $length = strlen($textData);
- while ($index < $length) {
- // get next character
- $char = $textData{$index};
- // increment for next round
- // do this here because we want to increment before breaking
- // out of the loop
- $index++;
- // anything that is not " is part of the token
- if (""" != $char) {
- $token .= $char;
- } else {
- break;
- }
- }
- }
- // main function to do the parsing
- // note the pass by reference!
- function do_parse($textData, &$index, &$output) {
- $output = [];
- $char = NULL;
- $length = strlen($textData);
- $token = NULL;
- while ($index < $length) {
- // get next character
- $char = $textData{$index};
- // if we encounter an opening "
- if (""" == $char) {
- // parse the rest as a token, and store it in our output array
- $output[] = parse_token($textData, ++$index, $token);
- } else if (" " == $char || "n" == $char) {
- // skip whitespace, go on to next char
- $index++;
- } else {
- throw new Exception('unexpected character ' . $char);
- }
- }
- }
- // read file into string
- $data = file_get_contents ("data.txt");
- // perform actual parsing
- $index = 0;
- do_parse($data, $index, $parsed);
- // print result
- print_r($parsed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement