{

// --- Engines

"bug_engine_1.8_hrb": {
    "information":{
        "authors":"53_herbie_53 & Fufsgfen",
        "name":"Herbie F4 Engine", // depending on the player behaviour
        "value":80000,
    },
    "slotType" : "bug_engine",
    "slots": [
        ["type", "default", "description"],

        ["bug_battery","bug_battery", "Battery", {"coreSlot": true}],
        ["bug_intake","bug_intake", "Intake", {"coreSlot":true}],
        ["bug_oilpan","bug_oilpan", "Oil Pan", {"coreSlot":true}],
        ["bug_exhaust","bug_exhaust", "Exhaust"],
        
        ["bug_oilcooler","", "Oil Cooler"],
        
        // These parts don't make sense with this engine and cause more problems then they solve.
        //["bug_engine_internals","bug_engine_internals", "Engine Long Block", {"coreSlot":true}],
        //["bug_engine_ecu","", "Engine Management"],

        ["bug_transaxle","bug_transaxle_4M", "Transaxle"],
        ["n2o_system","", "Nitrous Oxide System"],
    ],
    "variables": [
        ["name", "type", "unit", "category", "default", "min", "max", "title", "description"],
        ["$torque", "range", "", "Engine", 0.5, 0.10, 1.0, "Torque", "Engine Torque multiplier", {"minDis":10, "maxDis":100}],
        ["$maxrpm", "range", "rpm", "Engine", 6300, 3000, 14000, "RPM Limit", "Max RPM limit", {"stepDis":100}],
	],
    "powertrain": [
        ["type", "name", "inputName", "inputIndex"],
        ["combustionEngine", "mainEngine", "dummy", 0],
    ],
    "mainEngine": {
        "torque":[
            ["rpm", "torque"],
            [	0		,  	"$=$torque*0.0"		],
			[	500		,  	"$=$torque*268.38"	],
			[	1000	, 	"$=$torque*366.27"	],
			[	1500	, 	"$=$torque*428.61"	],
			[	2000	, 	"$=$torque*474.07"	],
			[	2500	, 	"$=$torque*509.63"	],
			[	3000	, 	"$=$torque*538.71"	],
			[	3500	, 	"$=$torque*563.20"	],
			[	4000	, 	"$=$torque*584.31"	],
			[	4500	, 	"$=$torque*602.83"	],
			[	5000	, 	"$=$torque*619.28"	],
			[	6000	, 	"$=$torque*647.47"	],
			[	6500	, 	"$=$torque*683.34"	],

		],
		"idleRPM":850,
        "idleRPMRoughness":150,
        "maxRPM":"$maxrpm",
        "hasRevLimiter":false,
        "inertia":0.124, 
        // Causes issues with the lua part
//        "friction":14.5,
//        "dynamicFriction":0.032,
//        "engineBrakeTorque":30,
        "friction":1,
        "dynamicFriction":0.025,

        //"burnEfficiency":0.29
        "burnEfficiency":[
            [0, 0.08],
            [0.05, 0.18],
            [0.4, 0.25],
            [0.7, 0.32],
            [1, 0.23],
        ],

        "energyStorage": "mainTank",
        "requiredEnergyType":"gasoline",

        //cooling and oil system
        "thermalsEnabled":false,
        "isAirCooledOnly":true,
        "airRegulatorTemperature":85,
        "airRegulatorClosedCoef":0.1,
		"engineBlockAirCoolingEfficiency":280,
		"blockFanMaxAirSpeed":8,
        "engineBlockAirflowCoef":1.25,
        "engineBlockMaterial":"aluminium",
        "oilVolume":4,
        "radiatorFanType":"mechanical",
		"oilRadiatorArea":0.45,
		"oilRadiatorEffectiveness":200000,

        //engine durability
        "cylinderWallTemperatureDamageThreshold":5000,
        "headGasketDamageThreshold":15000000,
        "pistonRingDamageThreshold":15000000,
        "connectingRodDamageThreshold":20000000,
        "maxTorqueRating": 6500,
        "maxOverTorqueDamage": 6500,
        "maxOverRevDamage": 45000,

        //exhaust
        // Using defaults for now, as they seems to sound weird?
        //"instantAfterFireSound": "event:>Vehicle>Afterfire>box4_01>single",
        //"sustainedAfterFireSound": "event:>Vehicle>Afterfire>box4_01>multi",
        //"shiftAfterFireSound": "event:>Vehicle>Afterfire>box4_01>shift",
        "particulates":1,
        "instantAfterFireCoef": 0.5,
        "sustainedAfterFireCoef": 0.75,
        "instantAfterFireVolumeCoef": 0.6,
        "sustainedAfterFireVolumeCoef": 0.3,
        "shiftAfterFireVolumeCoef": 0.5,

        //node beam interface
        "torqueReactionNodes:":["e1l","e2l","e4r"],
        //"waterDamage": {"[engineGroup]:":["engine_intake"]},
        "radiator": {"[engineGroup]:":["radiator"]},
        "engineBlock": {"[engineGroup]:":["engine_block"]},
        "breakTriggerBeam":"engine",
        "uiName":"Engine",
        "soundConfig": "soundConfig",
        "soundConfigExhaust": "soundConfigExhaust",

        //starter motor
        "starterSample":"event:>Engine>Starter>box4_1960_eng",
        "starterSampleExhaust":"event:>Engine>Starter>box4_1960_exh",
        "shutOffSampleEngine":"event:>Engine>Shutoff>box4_1960_eng",
        "shutOffSampleExhaust":"event:>Engine>Shutoff>box4_1960_exh",
        "starterVolume":0.76,
        "starterVolumeExhaust":0.76,
        "shutOffVolumeEngine":0.76,
        "shutOffVolumeExhaust":0.76,
        "starterThrottleKillTime":1.0,
        "idleRPMStartRate":1.5,
        "idleRPMStartCoef":1.25,
        "maxIdleThrottle":0.1,

        // electric power
        "generatorPower": 700,   // Watt
        "enginePower": 40,       // Watt
        "starterPower": 800,     // Watt

        //engine deform groups
        "deformGroups":["mainEngine", "mainEngine_intake"]
    },
    "soundConfig": {
        "sampleName": "f4beetle_hrb",
        "intakeMuffling": 0.3,

        "mainGain": -16,
        "onLoadGain":1.0,
        "offLoadGain":0.67,

        "maxLoadMix": 0.7,
        "minLoadMix": 0,

        "lowShelfGain":0,
        "lowShelfFreq":100,

        "highShelfGain":8,
        "highShelfFreq":5500,

        "eqLowGain": 0,
        "eqLowFreq": 450,
        "eqLowWidth": 0.2,

        "eqHighGain": 0,
        "eqHighFreq": 2200,
        "eqHighWidth": 0.3,

        "fundamentalFrequencyCylinderCount": 4,
        "eqFundamentalGain": -1,
    },
    "soundConfigExhaust": {
        "sampleName": "f4beetle_eexh",

        "mainGain":-2.5,
        "onLoadGain":0.5,
        "offLoadGain":0.1,

        "maxLoadMix": 0.7,
        "minLoadMix": 0.0,

        "lowShelfGain":-1,
        "lowShelfFreq":140,

        "highShelfGain":-5,
        "highShelfFreq":8500,

        "eqLowGain": 2,
        "eqLowFreq": 350,
        "eqLowWidth": 0.1,

        "eqHighGain": 5,
        "eqHighFreq": 16000,
        "eqHighWidth": 0.05,

        "fundamentalFrequencyCylinderCount":4,
        "eqFundamentalGain": 0,
    },
    "vehicleController": {
        "clutchLaunchStartRPM":1900,
        "clutchLaunchTargetRPM":2600,
        //**highShiftDown can be overwritten by automatic transmissions**
        "highShiftDownRPM":[0,0,0,2500,2900,3200,3300],
        //**highShiftUp can be overwritten by intake modifications**
        "highShiftUpRPM":6500
    },
    "flexbodies": [
        ["mesh", "[group]:", "nonFlexMaterials"],

        ["bug_engine_cover",                ["bug_engine"]],
        ["bug_engine_cover_front",          ["bug_engine"]],
        ["bug_engine_fan_housing",          ["bug_engine"]],
        ["bug_engine_valve_cap",            ["bug_engine"]],
        ["bug_engine_valve_housing",        ["bug_engine"]],

        ["bug_engine_crank_case",           ["bug_engine"]],
        ["bug_engine_cylinders",            ["bug_engine"]],
        ["bug_engine_push_rods",            ["bug_engine"]],
        ["bug_engine_valve_cap_holder",     ["bug_engine"]],
        
        ["bug_engine_ignition",             ["bug_engine"]],
        ["bug_engine_alternator",           ["bug_engine"]],
        ["bug_engine_alternator_regulator", ["bug_engine"]],
        ["bug_engine_alternator_stand",     ["bug_engine"]],
        ["bug_engine_belt",                 ["bug_engine"]],
        ["bug_engine_fuel_pump",            ["bug_engine"]],
        ["bug_engine_oil_dipstick",         ["bug_engine"]],
        ["bug_engine_oil_inlet",            ["bug_engine"]],
        ["bug_engine_pipe",                 ["bug_engine"]],
        ["bug_engine_heat_exchanger",       ["bug_engine"]],
    ],
    "props": [
        ["func"      , "mesh"                        , "idRef:", "idX:", "idY:", "baseRotation"        , "rotation"                 , "translation"        , "min", "max", "offset", "multiplier"],

        // pedal
        ["throttle", "bug_inputs_pedals_throttle",         "f3mr","f3ml","f3tm",       {"x":25, "y":0, "z":0}, {"x":20, "y":0, "z":0}, {"x":0, "y":0, "z":0}, 	0, 1, 0, 1],

        // engine 
        ["rpmspin",  "bug_engine_alternator_belt_pulley",  "e2r","e2l","e4r",        {"x":0, "y":0, "z":0},  {"x":0, "y":1, "z":0}, {"x":0, "y":0, "z":0}, -360,     360, 0,  -1],
        ["rpmspin",  "bug_engine_belt_pulley",             "e2r","e2l","e4r",        {"x":0, "y":0, "z":0},  {"x":0, "y":1, "z":0}, {"x":0, "y":0, "z":0}, -360,     360, 0,  -1],
        ["rpmspin",  "bug_engine_fan",                     "e2r","e2l","e4r",        {"x":0, "y":0, "z":0},  {"x":0, "y":1, "z":0}, {"x":0, "y":0, "z":0}, -360,     360, 0,  -1]
    ],
    "nodes": [
        ["id", "posX", "posY", "posZ"],

        {"frictionCoef":0.5},
        {"nodeMaterial":"|NM_METAL"},
        {"selfCollision":false},
        {"collision":true},
        {"group":"bug_engine"},
        {"nodeWeight":6.0},
        {"engineGroup":"engine_block"},
        ["e1l",  0.36, 1.37, 0.22,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.1,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e1r", -0.36, 1.37, 0.22],
        ["e2l",  0.36, 1.68, 0.22,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.1,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e2r", -0.36, 1.68, 0.22],
        {"engineGroup":"engine_block"},
        {"nodeWeight":6.0},
        ["e3l",  0.34, 1.37, 0.56,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.1,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e3r", -0.34, 1.37, 0.56],
        ["e4l",  0.34, 1.68, 0.56, {"isExhaust":"mainEngine","chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.1,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e4r", -0.34, 1.68, 0.56, {"isExhaust":"mainEngine","chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.1,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        {"engineGroup":["engine_block","engine_intake"]},
        {"nodeWeight":1.3},
        ["e5l",  0.18, 1.37, 0.79,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.5,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e5r", -0.18, 1.37, 0.79,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.5,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e6l",  0.18, 1.68, 0.79,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.5,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        ["e6r", -0.18, 1.68, 0.79,{"chemEnergy":2000,"burnRate":0.39,"flashPoint":800,"specHeat": 0.5,"selfIgnitionCoef":false,"smokePoint":650,"baseTemp":"thermals","conductionRadius":0.13}],
        {"engineGroup":""},
        {"group":""},
    ],
    "beams": [
        ["id1:", "id2:"],

        {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
        {"beamSpring":9001000,"beamDamp":500},
        {"beamDeform":175000,"beamStrength":"FLT_MAX"},
        {"deformGroup":"mainEngine", "deformationTriggerRatio":0.001},
        //engine
        ["e1r","e1l"],
        ["e2r","e2l"],
        ["e3r","e3l"],
        ["e4r","e4l"],

        ["e1r","e2r"],
        ["e1l","e2l"],
        ["e3r","e4r"],
        ["e3l","e4l"],

        ["e1r","e3r"],
        ["e1l","e3l"],
        ["e2r","e4r", {"isExhaust":"mainEngine","deformLimitExpansion":1.1}],
        ["e2l","e4l", {"isExhaust":"mainEngine","deformLimitExpansion":1.1}],

        ["e2r","e3r"],
        ["e2l","e3l"],
        ["e2r","e3l"],
        ["e2l","e3r"],

        ["e1r","e4r"],
        ["e1l","e4l"],
        ["e1r","e4l"],
        ["e1l","e4r"],

        ["e1r","e2l"],
        ["e1l","e2r"],
        ["e3r","e4l"],
        ["e3l","e4r"],

        ["e1r","e3l"],
        ["e1l","e3r"],
        ["e2r","e4l"],
        ["e2l","e4r"],

        {"beamSpring":1840460,"beamDamp":145},
        {"beamDeform":85800,"beamStrength":"FLT_MAX"},
        ["e4l", "e6l"],
        ["e3l", "e5l"],
        ["e6l", "e5l"],
        ["e6l", "e2l"],
        ["e5l", "e1l"],

        ["e6l", "e3l"],
        ["e5l", "e4l"],
        ["e6l", "e1l"],
        ["e2l", "e5l"],

        ["e4r", "e6r"],
        ["e3r", "e5r"],
        ["e6r", "e5r"],
        ["e6r", "e2r"],
        ["e5r", "e1r"],

        ["e6r", "e3r"],
        ["e5r", "e4r"],
        ["e6r", "e1r"],
        ["e2r", "e5r"],

        ["e4l", "e6r"],
        ["e3l", "e5r"],
        ["e4r", "e6l"],
        ["e3r", "e5l"],

        ["e5l", "e5r"],
        ["e6l", "e6r"],
        ["e5l", "e6r"],
        ["e5r", "e6l"],

        //engine mounting
        {"optional":true},
        {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
        {"beamSpring":801000,"beamDamp":200},
        {"beamDeform":15000,"beamStrength":165000},
        {"dampCutoffHz":200},
        {"breakGroup":"enginemount"},
        ["e1l", "f7tml", {"name": "engine"}],
        ["e1l", "f7ml"],
        ["e1l", "f6tml"],
        ["e1l", "f6ml"],
        ["e5l", "f2r", {"beamStrength":50000,"breakGroup":"frameFloorR"}],
        ["e5l", "f2l", {"beamStrength":50000,"breakGroup":"frameFloorL"}],
        ["e5l", "f5r"],
        ["e5l", "f5l"],
        ["e1r", "f7tmr"],
        ["e1r", "f7mr"],
        ["e1r", "f6tmr"],
        ["e1r", "f6mr"],
        ["e5r", "f2l", {"beamStrength":50000,"breakGroup":"frameFloorL"}],
        ["e5r", "f2r", {"beamStrength":50000,"breakGroup":"frameFloorR"}],
        ["e5r", "f5l"],
        ["e5r", "f5r"],
        {"breakGroup":""},
    ],
    "triangles": [
            ["id1:","id2:","id3:"],
            {"groundModel":"metal"},
            {"dragCoef":0},
            /*
            ["e5l", "e1l", "e3l"],
            ["e4r", "e3r", "e2r"],
            ["e3r", "e1r", "e2r"],
            ["e1r", "e1l", "e2r"],
            ["e2r", "e1l", "e2l"],
            ["e3l", "e1l", "e3r"],
            ["e3r", "e1l", "e1r"],
            ["e4r", "e4l", "e3l"],
            ["e4r", "e3l", "e3r"],
            ["e4r", "e2r", "e4l"],
            ["e4l", "e2r", "e2l"],
            ["e4l", "e2l", "e6l"],
            ["e6l", "e3l", "e4l"],
            ["e6l", "e2l", "e5l"],
            ["e6l", "e5l", "e3l"],
            ["e2l", "e1l", "e5l"],
            */
            {"triangleType":"NONCOLLIDABLE"},
            ["e2l", "e2r", "e1r"],
            ["e1r", "e1l", "e2l"],
            {"triangleType":"NORMALTYPE"},
    ],
},

}