This commit is contained in:
2022-04-21 16:15:41 +03:00
commit 9d4fc88901
601 changed files with 66252 additions and 0 deletions

View File

@ -0,0 +1,287 @@
local _Ratio1 = 1;
local _Ratio2 = 2;
local _Ratio3 = 3;
if (MaxVehicleLimit > 300) then {
_Ratio1 = round(MaxVehicleLimit * 0.0034);
_Ratio2 = round(MaxVehicleLimit * 0.0067);
_Ratio3 = round(MaxVehicleLimit * 0.01);
};
AllowedVehiclesList = [
["AH6X_DZ",_Ratio3],
["AN2_DZ",_Ratio1], //Green
["AN2_2_DZ",_Ratio1], //Red and white
["An2_2_TK_CIV_EP1_DZ",_Ratio1], //Green and white
["ArmoredSUV_PMC_DZE",_Ratio1],
["ATV_CZ_EP1_DZE",_Ratio1],
["BAF_ATV_W_DZE",_Ratio1],
["car_hatchback_DZE",_Ratio3],
["car_sedan_DZE",_Ratio3],
["CH_47F_EP1_DZE",_Ratio1],
["CH53_DZE",_Ratio1],
["CSJ_GyroC_DZE",_Ratio3],
["CSJ_GyroCover",_Ratio3],
["CSJ_GyroP",_Ratio3],
["MTVR_Bird_DZE",_Ratio2],
["datsun1_civil_1_open_DZE",_Ratio3],
["datsun1_civil_2_covered_DZE",_Ratio3],
["datsun1_civil_3_open_DZE",_Ratio3],
["GAZ_Vodnik_DZE",_Ratio1],
["GAZ_Vodnik_MedEvac_DZE",_Ratio1],
["GLT_M300_LT_DZE",_Ratio3],
["GLT_M300_ST_DZE",_Ratio3],
["GNT_C185_DZ",_Ratio1],
["GNT_C185C_DZ",_Ratio1],
["GNT_C185R_DZ",_Ratio1],
["GNT_C185U_DZ",_Ratio1],
["hilux1_civil_1_open_DZE",_Ratio3],
["hilux1_civil_2_covered_DZE",_Ratio3],
["hilux1_civil_3_open_DZE",_Ratio3],
["HMMWV_Ambulance_DZE",_Ratio1],
["HMMWV_Ambulance_CZ_DES_EP1_DZE",_Ratio1],
["HMMWV_DES_EP1_DZE",_Ratio3],
["HMMWV_DZ",_Ratio3],
["HMMWV_M1035_DES_EP1_DZE",_Ratio1],
["HMMWV_M1151_M2_CZ_DES_EP1_DZE",_Ratio1],
["HMMWV_M998A2_SOV_DES_EP1_DZE",_Ratio1],
["Ikarus_DZE",_Ratio3],
["Ikarus_TK_CIV_EP1_DZE",_Ratio3],
["Kamaz_DZE",_Ratio3],
["KamazRefuel_DZ",_Ratio1],
["Lada1_DZE",_Ratio3],
["Lada1_TK_CIV_EP1_DZE",_Ratio3],
["Lada2_DZE",_Ratio3],
["Lada2_TK_CIV_EP1_DZE",_Ratio3],
["LadaLM_DZE",_Ratio3],
["Jeep_DZE",_Ratio3],
["LandRover_CZ_EP1_DZE",_Ratio3],
["LandRover_MG_TK_EP1_DZE",_Ratio1],
["LandRover_Special_CZ_EP1_DZE",_Ratio1],
["LandRover_TK_CIV_EP1_DZE",_Ratio3],
["M1030_US_DES_EP1_DZE",_Ratio3],
["MH6J_DZ",_Ratio3],
["Mi17_Civilian_DZ",_Ratio1],
["Mi17_DZE",_Ratio1],
["MMT_Civ_DZE",(_Ratio3 * 2)],
["MtvrRefuel_DES_EP1_DZ",_Ratio1],
["MTVR_DES_EP1_DZE",_Ratio3],
["MTVR_DZE",_Ratio3],
["MTVR_Open_DZE",_Ratio3],
["MV22_DZ",_Ratio1],
["Offroad_DSHKM_Gue_DZE",_Ratio3],
["Old_moto_TK_Civ_EP1_DZE",_Ratio3],
["Pickup_PK_GUE_DZE",_Ratio3],
["Pickup_PK_INS_DZE",_Ratio3],
["Pickup_PK_TK_GUE_EP1_DZE",_Ratio3],
["S1203_ambulance_EP1_DZE",_Ratio3],
["S1203_TK_CIV_EP1_DZE",_Ratio3],
["Skoda_DZE",_Ratio3],
["SkodaBlue_DZE",_Ratio3],
["SkodaGreen_DZE",_Ratio3],
["SkodaRed_DZE",_Ratio3],
["SUV_Blue",_Ratio1],
["SUV_Camo",_Ratio1],
["SUV_Charcoal",_Ratio1],
["SUV_Green",_Ratio1],
["SUV_Orange",_Ratio1],
["SUV_Pink",_Ratio1],
["SUV_Red",_Ratio1],
["SUV_Silver",_Ratio1],
["SUV_TK_CIV_EP1_DZE",_Ratio1],
["SUV_White",_Ratio1],
["SUV_Yellow",_Ratio1],
["Tractor_DZE",_Ratio3],
["TT650_Civ_DZE",_Ratio3],
["TT650_Ins_DZE",_Ratio3],
["TT650_TK_CIV_EP1_DZE",_Ratio3],
["UAZ_CDF_DZE",_Ratio3],
["UAZ_INS_DZE",_Ratio3],
["UAZ_MG_TK_EP1_DZE",_Ratio3],
["UAZ_RU_DZE",_Ratio3],
["UAZ_Unarmed_TK_CIV_EP1_DZE",_Ratio3],
["UAZ_Unarmed_TK_EP1_DZE",_Ratio3],
["UAZ_Unarmed_UN_EP1_DZE",_Ratio3],
["UH1H_DZE",_Ratio2],
["UH1Y_DZE",_Ratio1],
["UH60M_EP1_DZE",_Ratio1],
["UralRefuel_TK_EP1_DZ",_Ratio1],
["Ural_CDF_DZE",_Ratio3],
["Ural_TK_CIV_EP1_DZE",_Ratio3],
["Ural_UN_EP1_DZE",_Ratio3],
["V3S_Open_TK_CIV_EP1_DZE",_Ratio3],
["V3S_Open_TK_EP1_DZE",_Ratio3],
["V3S_Camper_DZE",_Ratio3],
["V3S_Refuel_TK_GUE_EP1_DZ",_Ratio1],
["V3S_RA_TK_GUE_EP1_DZE",_Ratio1],
["VolhaLimo_TK_CIV_EP1_DZE",_Ratio3],
["Volha_1_TK_CIV_EP1_DZE",_Ratio3],
["Volha_2_TK_CIV_EP1_DZE",_Ratio3],
["VWGolf_DZE",_Ratio3],
["Mini_Cooper_DZE",_Ratio3],
["ScrapAPC_DZE",_Ratio3],
["ATV_CIV_CP_DZE",_Ratio1],
["ATV_CIV_Grey_CP_DZE",_Ratio1],
["ATV_CIV_Red_CP_DZE",_Ratio1],
["ATV_CIV_Green_CP_DZE",_Ratio1],
["ATV_CIV_Blue_CP_DZE",_Ratio1],
["ATV_CIV_Yellow_CP_DZE",_Ratio1],
["ATV_CIV_Purple_CP_DZE",_Ratio1],
["ATV_CIV_Black_CP_DZE",_Ratio1],
["Ikarus_White_DZE",_Ratio1],
["car_hatchback_red_DZE",_Ratio1],
["datsun1_red_covered_DZE",_Ratio1],
["datsun1_green_open_DZE",_Ratio1],
["Octavia_ACR_DZE",_Ratio1],
["T810A_ACR_DZE",_Ratio1],
["T810A_ACR_DES_DZE",_Ratio1],
["T810A_ACR_OPEN_DZE",_Ratio1],
["T810A_ACR_DES_OPEN_DZE",_Ratio1],
["T810A_ACR_REFUEL_DZE",_Ratio1],
["T810A_ACR_REFUEL_DES_DZE",_Ratio1],
["T810_ACR_REAMMO_DZE",_Ratio1],
["T810_ACR_REAMMO_DES_DZE",_Ratio1],
["T810_ACR_REPAIR_DZE",_Ratio1],
["T810_ACR_REPAIR_DES_DZE",_Ratio1],
["CH_47F_EP1_Black_DZE",_Ratio1],
["CH_47F_EP1_GREY_DZE",_Ratio1],
["CH_47F_EP1_DES_DZE",_Ratio1],
["UH1H_2_DZE",_Ratio1],
["UH1H_CDF_DZE",_Ratio1],
["UH1H_WD_DZE",_Ratio1],
["UH1H_DES_DZE",_Ratio1],
["UH1H_GREY_DZE",_Ratio1],
["UH1H_BLACK_DZE",_Ratio1],
["UH1H_SAR_DZE",_Ratio1],
["Mi17_TK_EP1_DZE",_Ratio1],
["Mi17_UN_CDF_EP1_DZE",_Ratio1],
["Mi17_CDF_DZE",_Ratio1],
["Mi171Sh_CZ_EP1_DZE",_Ratio1],
["Mi17_DES_DZE",_Ratio1],
["Mi17_GREEN_DZE",_Ratio1],
["Mi17_BLUE_DZE",_Ratio1],
["Mi17_BLACK_DZE",_Ratio1],
["Mi17_GREEN_DZE",_Ratio1],
["Mi17_medevac_CDF_DZ",_Ratio1],
["Mi17_medevac_Ins_DZ",_Ratio1],
["Mi17_medevac_RU_DZ",_Ratio1],
["pook_medevac_DZE",_Ratio1],
["pook_medevac_CDF_DZE",_Ratio1],
["pook_medevac_CIV_DZE",_Ratio1],
["pook_gunship_DZE",_Ratio1],
["pook_gunship_CDF_DZE",_Ratio1],
["pook_transport_DZE",_Ratio1],
["pook_transport_CDF_DZE",_Ratio1],
["pook_H13_civ_DZE",_Ratio1],
["pook_H13_civ_white_DZE",_Ratio1],
["pook_H13_civ_slate_DZE",_Ratio1],
["pook_H13_civ_black_DZE",_Ratio1],
["pook_H13_civ_yellow_DZE",_Ratio1],
["MH60S_DZE",_Ratio1],
["UH60M_MEV_EP1_DZ",_Ratio1],
["BAF_Merlin_DZE",_Ratio1],
["Ka60_GL_PMC_DZE",_Ratio1],
["AW159_Lynx_BAF_DZE",_Ratio1],
["BTR40_MG_TK_GUE_EP1_DZE",_Ratio1],
["BTR40_MG_TK_INS_EP1_DZE",_Ratio1],
["BRDM2_HQ_TK_GUE_EP1_DZE",_Ratio1],
["HMMWV_Armored_DZE",_Ratio1],
["HMMWV_M2_DZE",_Ratio1],
["T810A_PKT_ACR_DZE",_Ratio1],
["T810A_PKT_DES_ACR_DZE",_Ratio1],
["BAF_Jackal2_L2A1_D_DZE",_Ratio1],
["BAF_Jackal2_L2A1_W_DZE",_Ratio1],
["BAF_Jackal2_GMG_D_DZE",_Ratio1],
["BAF_Jackal2_GMG_W_DZE",_Ratio1],
["Hummer_DZE",_Ratio1],
["Tractor_Armored_DZE",_Ratio1],
["Ikarus_Armored_DZE",_Ratio1]
];
// There are no good spawn locations for C130 on Namalsk or Caribou Frontier.
if !(toLower worldName in ["namalsk","caribou"]) then {
AllowedVehiclesList set [count AllowedVehiclesList, ["C130J_US_EP1_DZ",_Ratio1]];
};
if (toLower worldName in ["caribou","chernarus","cmr_ovaron","dayznogova","dingor","dzhg","fallujah","fapovo","fdf_isle1_a","isladuala","lingor","mbg_celle2","namalsk","napf","oring","panthera2","ruegen","sara","sauerland","smd_sahrani_a2","tasmania2010","tavi","trinity","utes"]) then {
// water map, add boats
AllowedVehiclesList = AllowedVehiclesList + [
["Fishing_Boat_DZE",_Ratio3],
["JetSkiYanahui_Case_Blue",_Ratio1],
["JetSkiYanahui_Case_Green",_Ratio1],
["JetSkiYanahui_Case_Red",_Ratio1],
["JetSkiYanahui_Case_Yellow",_Ratio1],
["PBX_DZE",_Ratio3],
["RHIB_DZE",_Ratio1],
["RHIB2Turret_DZE",_Ratio1],
["Smallboat_1_DZE",_Ratio3],
["Smallboat_2_DZE",_Ratio3],
["Zodiac_DZE",_Ratio3],
["Submarine_DZE",_Ratio3]
];
};
DZE_Hangar_positions = [];
DZE_Runway_Positions = [];
// Runway and hangar positions for plane spawning
call {
if (toLower worldName in ["chernarus","chernarus_winter"]) exitWith {
DZE_Hangar_positions = [[[4974.1201, 10012.304],240],[[4948.4419, 10055.036],240],[[4927.4048, 10098.72],240],[[4874.5693, 10179.009],240],[[4848.5073, 10218.326],240],[[4899.5508, 10138.02],240],[[4526.0156, 10783.658],240],[[4587.6855, 10685.194],240],[[4796.3179, 2584.4021],210],[[4762.417, 2606.4893],210],[[12007.119, 12628.267],18.522324]];
DZE_Runway_Positions = [[[4825.3115, 9606.0107],351.2749786],[[4962.5381, 9685.8887],308.361824],[[4244.3516, 10919.782],164.96837],[[4124.9233, 10850.859],122.84861],[[4498.4043, 10694.304],170.83557],[[4452.0508, 10799.156],293.729195],[[11794.814, 12848.633],132.00909],[[12433.607, 12511.798],322],[[4644.8433, 2578.2515],138.79065],[[4598.5522, 2492.5886],80.181107],[[5262.187, 2244.1062],270]];
};
if (toLower worldName == "napf") exitWith {
DZE_Hangar_positions = [[[18302.373, 2296.6174],128.92664],[[18219.572, 2201.1204],131.85796],[[18163.936, 2138.0906],130.08537],[[5012.1724, 4871.896],260.887802],[[4651.1582, 4806.9653],77.901695],[[4782.9136, 4831.3003],260.053566],[[14391.086, 16890.748],139.26932],[[14482.736, 16787.213],317.649258]];
DZE_Runway_Positions = [[[14339.543, 17166.994],138.43173],[[14254.993, 17096.977],78.634995],[[14742.884, 16617.965],135.36357],[[15147.044, 16147.293],345.509653],[[18139.805, 1965.5642],39.729259],[[3902.3901, 4476.9971],79.775864],[[3876.8308, 4604.3208],128.58391],[[3930.5286, 4311.0532],16.60323],[[3888.5801, 4372.7026],51.806969],[[5208.6802, 4621.9556],286.741859]];
};
if (toLower worldName == "panthera2") exitWith {
DZE_Hangar_positions = [[[1949.4359, 3594.7795],180],[[793.6474, 9659.5859],270],[[740.60645, 9729.6523],180],[[4215.5635, 7454.7695],0],[[4141.9292, 7458.936],0]];
DZE_Runway_Positions = [[[1906.2429, 3540.8784],180],[[1863.5885, 3541.5037],180],[[2119.3586, 3533.1587],90],[[2356.3647, 3533.0906],90],[[2610.7517, 3528.6604],180],[[2208.2322, 3389.563],0],[[2162.8445, 3388.5747],0],[[728.3725, 9558.4209],270],[[690.87726, 9716.6924],233],[[690.87726, 9716.6924],270],[[742.43134, 9412.1094],270],[[742.31244, 9453.2158],270],[[746.93304, 9279.5293],270],[[684.96716, 8895.043],310],[[703.25922, 8938.5254],310],[[534.59473, 9684.0137],142],[[4847.2583, 7483.0718],0],[[4847.2583, 7483.0718],337],[[4926.7358, 7521.2285],300],[[4866.1216, 7679.3901],220],[[4783.2251, 7689.8706],191],[[4422.0762, 7677.5386],190],[[4259.5239, 7489.2754],0],[[4179.1602, 7478.1289],0],[[4052.2502, 7517.8276],30]];
};
if (toLower worldName in ["tavi","taviana"]) exitWith {
DZE_Hangar_positions = [[[16779.148, 10230.397],270],[[16778.303, 10280.438],270],[[16780.025, 10330.855],270],[[16781.834, 10380.041],270],[[16780.201, 10430.32],270],[[16782.045, 10480.558],270],[[16774.957, 10530.657],270],[[16779.676, 10580.657],270],[[10351.289, 18383.271],244],[[10327.586, 18427.346],244],[[10305.973, 18472.592],244],[[10283.948, 18518.41],244],[[10258.651, 18567.479],244],[[10234.805, 18616.689],244],[[7779.6982, 7893.582],219],[[7746.2954, 7931.6772],220],[[7705.2095, 7963.9487],220],[[7666.1587, 7995.0244],220],[[7628.3447, 8026.1821],220],[[7588.1636, 8055.9268],220],[[7547.3433, 8089.1045],220],[[7507.02, 8118.4521],220]];
DZE_Runway_Positions = [[[16653.684, 11617.686],180],[[16612.551, 11617.791],180],[[16570.965, 11617.984],180],[[16529.477, 11618.151],180],[[16366.49, 11397.132],119],[[16664.465, 11363.812],240],[[16666.48, 11312.685],240],[[16371.202, 10807.039],0],[[16363.222, 10648.133],0],[[16368.655, 11096.011],0],[[10595.511, 17683.322],244],[[10578.067, 17720],244],[[10560.043, 17756.557],244],[[10541.788, 17792.898],244],[[10317.844, 18244.363],155],[[10192.272, 18643.762],244],[[10175.395, 18680.395],244],[[10050.024, 18803.342],210],[[9991.7871, 18794.641],187],[[7792.293, 7816.6943],236],[[7572.9966, 7544.4141],39],[[7449.0269, 7597.1348],77],[[7408.0615, 7634.4272],77],[[7367.7822, 7673.5029],77],[[7073.5825, 7933.1563],308],[[6590.1455, 8270.4609],39],[[6827.6729, 8570.6074],215],[[6866.8408, 8542.7178],218],[[6935.6777, 8489.0615],218],[[6901.3486, 8515.8848],218],[[7120.8623, 8347.0342],218],[[7253.2144, 8233.7725],189],[[7344.647, 8161.6055],218],[[7381.7729, 8133.5376],218],[[7612.292, 7825.8555],270],[[7583.9072, 7875.2861],270]];
};
if (toLower worldName == "namalsk") exitWith {
//DZE_Hangar_positions = []; // No hangars on Namalsk
DZE_Runway_Positions = [[[6290.9497, 9623.7148],262],[[6292.8301, 9602.7422],267],[[6293.0767, 9582.04],269],[[6302.499, 9272.9336],283],[[6298.9512, 9304.6895],265],[[6296.9683, 9527.4414],265],[[6305.7607, 9235.8584],263],[[6305.5845, 9196.5742],258],[[6308.4282, 9171.084],272],[[6316.1602, 9120.333],289]];
};
if (toLower worldName == "lingor") exitWith {
DZE_Hangar_positions = [[[4157.8389, 1733.3982],90],[[4159.2427, 1694.8923],90],[[6132.001, 6867.8154],0],[[6171.1382, 6866.2905],0],[[6551.5654, 6747.1553],0],[[6596.1216, 6745.4463],0]];
DZE_Runway_Positions = [[[4210.1953, 1008.3441],60],[[4195.4409, 1051.4297],60],[[4344.1079, 1135.9297],275],[[4157.6406, 1367.108],90],[[4224.4678, 1908.2092],126],[[4205.958, 1865.4332],123],[[4171.7158, 1768.3271],90],[[4381.0615, 1797.5585],270],[[4378.8569, 1755.0103],270],[[4379.6816, 1577.699],270],[[4346.5088, 1201.3105],272],[[6843.6704, 6906.4585],0],[[6803.332, 6906.2168],0],[[6717.9673, 6906.7051],0],[[6676.981, 6907.2285],0],[[6444.7749, 6863.8208],0],[[6539.0391, 6910.8267],0],[[6093.625, 6887.2275],0],[[6027.8408, 6887.0762],0],[[5956.3789, 6938.2183],24],[[7010.3965, 6939.4941],0],[[3008.9871, 6429.1279],47],[[3098.365, 6597.5874],265],[[2989.0854, 6636.6699],87],[[2986.136, 6677.3818],85],[[2943.5073, 7171.521],112],[[2950.8511, 6930.5005],42]];
};
if (toLower worldName == "sauerland") exitWith {
DZE_Hangar_positions = [[[15262.892, 18276.533],0],[[15226.063, 18277.277],0],[[15374.349, 18520.734],270],[[15380.229, 18557.535],270],[[15206.892, 18562.439],270],[[15204.131, 18525.342],270],[[15090.723, 18594.041],90],[[15093.469, 18631.123],90],[[15262.248, 18589.803],90],[[15261.465, 18626.906],90],[[17105.355, 1730.1416],0],[[17064.814, 1726.3314],0],[[16989.188, 1756.3535],0],[[16942.273, 1757.369],0]];
DZE_Runway_Positions = [[[15359.572, 18635.889],236],[[15255.382, 18536.854],180],[[15595.105, 18334.383],321],[[15532.063, 18447.068],225],[[15487.508, 18335.965],330],[[15391.456, 18302.332],0],[[15173.691, 18314.725],0],[[15081.61, 18312.48],0],[[14944.665, 18320.264],0],[[14773.483, 18339.674],40],[[15091.576, 18540.818],184],[[15189.433, 18640.248],229],[[16782.379, 1774.917],0],[[17181.027, 1798.4741],320],[[17097.693, 1875.9081],180],[[16916.193, 1877.0327],229],[[16612.512, 1797.4282],0],[[16682.809, 1890.4918],181]];
};
if (toLower worldName == "fdf_isle1_a") exitWith { // Podagorsk
DZE_Hangar_positions = [[[9788.2529, 4244.8711],184],[[9800.8926, 3881.4368],62],[[9663.9092, 4086.3181],90],[[8109.9312, 4661.8569],31],[[8163.625, 4629.3784],31],[[8370.3965, 4681.3882],110],[[8499.707, 4834.9629],249],[[8479.6836, 4881.9771],249],[[8464.2666, 4930.7236],249],[[8094.8618, 4197.229],270]];
DZE_Runway_Positions = [[[8268.7236, 4562.5786],70],[[8306.2471, 4505.3193],138],[[8655.916, 4443.8525],252],[[8341.2051, 4915.9854],119],[[8529.582, 4736.3374],349.5],[[8601.5479, 4573.9819],218.5],[[9291.082, 4222.4561],0],[[9749.0908, 4031.1191],28.5],[[9647.9492, 4210.8892],44.6],[[9017.3711, 4345.874],202.5],[[8752.8799, 4343.0947],197.5],[[8559.9521, 4389.9805],30.7],[[8210.1367, 4376.4561],168],[[8467.5479, 4603.2041],203.7]];
};
if (toLower worldName == "takistan") exitWith {
DZE_Hangar_positions = [[[8185.729, 2072.853],148],[[8144.0083, 2049.1345],149.5],[[5762.7642, 11248.219],315],[[5804.0205, 11293.321],315],[[5845.9746, 11334.919],315]];
DZE_Runway_Positions = [[[8097.0645, 1971.9525],96],[[8037.8257, 1941.2324],197],[[7964.6133, 1903.0758],187],[[7847.5947, 1836.0383],208],[[7771.8823, 1784.0323],190],[[7731.0894, 1605.4257],60],[[8181.1729, 1752.5686],330],[[8222.8252, 1776.8198],330],[[8263.2832, 1800.2097],330],[[5944.2656, 11488.032],9],[[6044.8335, 11584.635],0],[[6105.9688, 11646.589],0],[[6139.2588, 11787.021],250],[[5978.5229, 11787.973],187],[[5878.377, 11707.521],134],[[5916.1074, 11746.493],134],[[5840.6494, 11669.358],134],[[5627.48, 11151.527],270],[[5333.2065, 10913.021],320],[[5417.6602, 10938.269],300],[[5480.7227, 11000.981],311],[[5542.3745, 11066.867],317]];
};
if (toLower worldName == "caribou") exitWith {
DZE_Hangar_positions = [[[1931.1724, 3222.0276],231]];
DZE_Runway_Positions = [[[1907.5873, 3248.3806],242],[[1897.8859, 3266.9893],242],[[1804.6925, 3462.7156],87],[[1874.5695, 3857.1729],211],[[1825.8583, 3931.4707],146],[[1747.6074, 3627.5881],90],[[1876.1652, 3567.8455],270],[[1876.1274, 3546.8982],270],[[1876.2861, 3524.1584],270],[[1874.3091, 3470.6697],270],[[1798.4554, 3059.9192],27],[[1884.0266, 3146.2952],321],[[1871.2059, 3344.2656],270],[[1872.6899, 3398.9255],270],[[1873.6082, 3439.7576],270]];
};
if (toLower worldName == "cmr_ovaron") exitWith {
DZE_Hangar_positions = [[[484.29846, 7396.8892],88.6],[[484.28625, 7430.1152],88.6],[[508.64578, 7556.8716],124],[[9758.9688, 2844.075],270],[[9759.8779, 2809.9143],270],[[9734.4736, 2680.5979],303.4]];
DZE_Runway_Positions = [[[641.89874, 7583.2739],270],[[660.71973, 7531.5244],270],[[706.20728, 7412.0298],270],[[663.34924, 7095.9355],270],[[664.23773, 7054.3511],270],[[641.50488, 6885.5479],270],[[658.19489, 6995.0098],242],[[649.28943, 6940.707],242],[[668.6698, 7450.6777],226],[[531.98523, 7361.5596],61],[[536.2215, 7492.4556],90],[[9597.3701, 2655.803],87],[[9571.1973, 2795.7207],73],[[9546.9268, 2840.2507],73],[[9573.9385, 2940.2646],73],[[9580.2891, 3156.8792],87],[[9581.7305, 3248.5847],87],[[9593.2344, 3355.6165],90],[[9717.9961, 2879.8501],240],[[9701.8115, 2755.5862],270]];
};
if (toLower worldName == "isladuala") exitWith {
DZE_Hangar_positions = [[[4206.3638, 2137.2808],0],[[4125.5474, 2134.4885],0],[[5952.8066, 6126.1646],0],[[5856.9976, 6154.4399],0],[[5825.5732, 6149.5454],0]];
DZE_Runway_Positions = [[[4056.5996, 2155.8013],0],[[4092.5444, 2323.322],181],[[4167.5967, 2154.3792],0],[[4251.6528, 2168.9683],0],[[4363.4614, 2159.783],0],[[4419.4434, 2159.2407],0],[[4551.4912, 2157.761],0],[[5082.5586, 2174.3755],0],[[5029.6553, 2174.2185],0],[[4974.084, 2174.7053],0],[[4928.833, 2174.7107],0],[[4881.8442, 2174.7852],0],[[4835.6523, 2175.2559],0],[[4507.2793, 2348.5867],174],[[4551.2729, 2350.7454],180],[[4606.3218, 2351.1897],180],[[4678.4517, 2343.6565],180],[[4732.3481, 2345.4229],177],[[4808.1777, 2350.335],180],[[7134.8789, 2308.7634],77],[[7180.7354, 2194.2275],38],[[7151.7651, 2250.1301],77],[[6806.7422, 6186.7549],0],[[6756.6646, 6186.2607],0],[[6710.748, 6186.0947],0],[[6652.3911, 6187.0112],0],[[6588.5942, 6184.8599],0],[[6016.4927, 6179.5308],0],[[6071.5977, 6177.2432],0],[[6145.7241, 6173.9126],0],[[5759.4888, 6167.3564],0],[[5785.1899, 6347.1733],180],[[5885.7339, 6345.1587],185],[[2934.3931, 6180.5464],110],[[2954.2786, 6238.8765],110],[[3036.1111, 6584.4858],110],[[3106.0913, 6337.4688],294],[[2901.9998, 6026.458],100]];
};
if (toLower worldName == "smd_sahrani_a2") exitWith {
DZE_Hangar_positions = [[[9838.8105, 9948.7129],0],[[9804.4814, 9949.8838],0],[[9767.9063, 9960.3486],0],[[19221.193, 13884.556],42.5],[[19196.141, 13909.83],42.5]];
DZE_Runway_Positions = [[[18968.033, 14320.386],223],[[19008.047, 14295.18],223],[[19046.576, 14255.652],223],[[19122.35, 14216.478],223],[[19187.141, 14165.009],223],[[19225.107, 14119.406],223],[[19306.145, 14021.929],223],[[19273.789, 14078.427],223],[[19017.391, 14124.187],76],[[9627.5947, 9961.833],0],[[9565.3711, 9952.9395],0],[[9495.8574, 9957.5947],0],[[9441.2363, 9959.6631],0],[[9330.1396, 9982.6484],0],[[9250.7705, 10024.167],0],[[9261.8711, 10211.065],180],[[9311.2334, 10200.271],180],[[9674.8145, 10203.702],180],[[9749.0088, 10211.506],180],[[9816.8672, 10206.438],180],[[10162.383, 10202.894],180],[[10229.846, 9974.875],0],[[10178.965, 9975.7041],0],[[10025.214, 9955.583],10],[[10110.359, 9975.7979],353],[[10213.082, 10205.972],180]];
};
if (toLower worldName == "ruegen") exitWith {
DZE_Hangar_positions = [[[5152.5142, 21600.607],148.90527],[[5018.2661, 21518.488],148.90527],[[4951.4629, 21472.211],148.90527]];
DZE_Runway_Positions = [[[5241.4678, 21601.275],148],[[5115.0171, 21508.145],146],[[5009.5713, 21455.387],146],[[4884.1641, 21360.277],146],[[4762.4004, 21271.303],146],[[4702.1157, 21237.779],146],[[4657.9302, 21203.23],146],[[4836.416, 20986.725],356],[[5205.2969, 21224.213],324],[[5259.4844, 21255.742],324],[[5323.1025, 21302.303],324],[[5495.7344, 21422.35],324],[[5664.5303, 21546.35],324],[[5584.3071, 21722.311],145],[[5358.6919, 21663.223],145],[[5630.3857, 21754.127],145]];
};
};
DZE_AllAircraftPositions = DZE_Hangar_positions + DZE_Runway_Positions;

View File

@ -0,0 +1,46 @@
// (c) facoptere@gmail.com, licensed to DayZMod for the community
private ["_blocked","_fires","_flame","_position"];
_fires = [];
if (dayz_townGenerator) then {
_fires = _fires + [
[11911.8,9101.2,0.597935], [11983,9162.89,0.597931], [12013.1,9159.38,0.597931], [12197.2,9499.66,0.603302], [12210.8,9728.83,0.597929],
[12218.7,9752.14,0.597929], [12247,9746.97,0.597929], [12271.7,9719.5,0.597929], [12407.3,9549.83,0.599188], [4889.27,2234.81,0.272388],
[4892.66,2235.29,0.272345], [6043.67,7781.65,0.597931], [6177.52,2125.36,0.598278], [6291.18,7808.69,0.597961], [6317.3,7835.18,0.597961],
[6428.26,2244.95,0.59796], [6513.29,2298.32,0.597929], [6536.12,2639.35,0.597929], [6545.71,2630.16,0.597929], [6663.22,2286.33,0.597929],
[6706.46,3012.04,0.59866], [6725.35,2576.59,0.597929], [6754.5,2780.37,0.597929], [6760.03,2727.7,0.597929], [6789.35,2692.69,0.597929],
[6796.09,2726.09,0.597929], [6810.51,2499.86,0.597929], [6822.79,2482.01,0.597929], [6832.25,2500.24,0.597929], [6833.6,3176.97,0.59797],
[6835.19,2694.23,0.597929], [6856.71,2522.75,0.597929], [6864.41,2464.66,0.597929], [7065.12,2622.94,0.597929], [7095.99,2740.68,0.597929]
];
};
if (dayz_POIs) then {
_fires = _fires + [
[11580.2,3391.72,-1.20629], [11604.4,3389.41,0.0161071], [11664.6,3415.82,-0.524297], [11678.4,3421.32,-0.526046], [11681.4,3409.25,0.028707],
[11700.9,3416.6,-0.433657], [11707.7,3431.61,0.597957], [11817.8,12693.7,-0.131821], [11844.7,12749.8,-0.109467], [11845.2,12747.7,-0.119843],
[11846.3,12751.1,-0.234741], [11862.3,12748.1,-0.31282], [11863,12748.5,-0.302368], [11863.9,12749.1,-0.279175], [12698.9,9523.05,0.039454],
[12700.7,9515.4,7.22985], [12701.1,9516.98,7.29042], [12704,9511.34,0.0394101], [12706.2,9510.56,0.0394883], [12706,9513.22,0.0393739],
[12707.3,9520.42,0.03929], [12707.4,9537.02,0.0394235], [12710.4,9548.67,9.79484], [12712.2,9544.37,9.98028], [12714.3,9535.06,-0.634063],
[12715.2,9539.4,0.039432], [12715.5,9536.36,0.0393863], [12718.4,9550.81,-0.633002], [12718.6,9550.53,0.0454731], [12721.6,9502.26,0.0394025],
[1689.3,11754.5,-0.640869], [1693.15,11750.4,0.0564575], [1698.03,11751.3,0.0558929], [1700.78,11733,0.0564728], [1704.94,11761.2,0.0585327],
[1705.92,11728.9,0.0565643], [1709.39,11727.4,0.0566864], [1713.98,11724.6,0.0566711], [1724.37,11729.1,0.054306], [1725.6,11729.7,0.0551147],
[1727.1,11727.7,0.0535278], [1727.33,11724.1,-0.64357], [1728.14,11729.9,-0.644043], [1729.12,11729.2,0.0558777], [1730.91,11729.7,-0.644058],
[1731.99,11728.5,0.0557709], [1746.26,11721.7,0.0542297], [1782.34,11754.6,0.598038]
];
};
{
_blocked = false;
_position = _x;
{if (_position distance _x < 150) exitWith {_blocked = true;};} forEach dayz_townGeneratorBlackList;
if (!_blocked && (random 1 < 0.33)) then {
_flame = "flamable_DZ" createVehicle [0,0,0]; //200x faster https://community.bistudio.com/wiki/Code_Optimisation#createVehicle.28Local.29
_flame setPosATL _x;
_flame inflame true;
_flame setVariable ["permaLoot",true]; // = won't be removed by the cleaner, cf. sched_lootpiles.sqf
};
uiSleep 0.001;
} count _fires;
//[6847.45,2360.25,0.597929] removed for now, see https://github.com/DayZMod/DayZ/issues/869

View File

@ -0,0 +1,218 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
if (isNil "DZE_NPC_CleanUp_Time") then {DZE_NPC_CleanUp_Time = -1;};
sched_co_deleteVehicle = {
private "_group";
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "Local";
_this removeAllEventHandlers "Respawn";
clearVehicleInit _this;
_group = group _this;
deleteVehicle _this;
if (count units _group == 0) then {
deleteGroup _group;
};
_this = nil;
};
sched_corpses = {
private ["_delQtyG","_delQtyZ","_delQtyP","_addFlies","_x","_deathTime","_onoff","_delQtyAnimal","_sound","_deathPos","_cpos","_animal","_nearPlayer","_delQtyV","_delQtyAI"];
// EVERY 2 MINUTE
// DELETE UNCONTROLLED ZOMBIES --- PUT FLIES ON FRESH PLAYER CORPSES --- REMOVE OLD FLIES & CORPSES
_delQtyZ = 0;
_delQtyP = 0;
_delQtyG = 0;
_delQtyV = 0;
_addFlies = 0;
_delQtyAI = 0;
{
if (local _x && {_x isKindOf "CAManBase"}) then {
if (_x isKindOf "zZombie_Base") then {
_x call sched_co_deleteVehicle;
_delQtyZ = _delQtyZ + 1;
} else {
//Only spawn flies on actual dead player, otherwise delete the body (clean up left over ghost from relogging, sometimes it is not deleted automatically by Arma or onPlayerDisconnect)
//AI mods will need to setVariable "bodyName" on their dead units to prevent them being cleaned up
_deathTime = _x getVariable ["sched_co_deathTime", -1];
if (_x getVariable["bodyName",""] != "") then {
if (_deathTime == -1) then {
/*_deathPos = _x getVariable ["deathPos",respawn_west_original];
_cpos = getPosATL _x;
// forbid a move further than 50 meters, or burried body (antihack)
if (_deathPos distance _cpos > 50 or _deathPos select 2 < -0.2) then {
diag_log [ __FILE__, "Corpse should have been moved! CID#",(_x getVariable["characterID", "?"]),"from:", _cpos, "to:", _deathPos ];
//_x setPosATL _deathPos;
};*/
_deathTime = diag_tickTime;
_x setVariable ["sched_co_deathTime", _deathTime];
if (dayz_enableFlies) then {
_x setVariable ["sched_co_fliesAdded", true];
_addFlies = _addFlies + 1;
};
};
// 60 * DZE_NPC_CleanUp_Time = how long an NPC corpse stays on the map
if (DZE_NPC_CleanUp_Time != -1 && {diag_tickTime - _deathTime > (60 * DZE_NPC_CleanUp_Time)} && {_x getVariable["bodyName",""] == "NPC"}) then {
if (_x getVariable["sched_co_fliesDeleted",false] or !dayz_enableFlies) then {
// flies have been switched off, we can delete body
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
};
_x call sched_co_deleteVehicle;
_delQtyAI = _delQtyAI + 1;
} else {
PVCDZ_flies = [ 0, _x ];
publicVariable "PVCDZ_flies";
_x setVariable ["sched_co_fliesDeleted", true];
// body will be deleted at next round
};
};
// 40 minutes = how long a player corpse stays on the map
if ((diag_tickTime - _deathTime > 40*60) && {_x getVariable["bodyName",""] != "NPC"}) then {
if (_x getVariable["sched_co_fliesDeleted",false] or !dayz_enableFlies) then {
// flies have been switched off, we can delete body
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
};
_x call sched_co_deleteVehicle;
_delQtyP = _delQtyP + 1;
} else {
PVCDZ_flies = [ 0, _x ];
publicVariable "PVCDZ_flies";
_x setVariable ["sched_co_fliesDeleted", true];
// body will be deleted at next round
};
} else {
// Do not spawn flies immediately after death. Wait 10 minutes.
if ((diag_tickTime - _deathTime < 10*60) or !dayz_enableFlies) exitWith {};
_onoff = 1;
// remove flies on heavy rain.
if (rain > 0.25) then { _onoff = 0; };
// switch flies sound on/off.
// sound must be deleted/respawned periodically because new players won't ear it otherwise,
// and other players would ear it several times (very loud noise)
_sound = _x getVariable ["sched_co_fliesSource", nil];
if !(isNil "_sound") then {
detach _sound;
deleteVehicle _sound;
_x setVariable ["sched_co_fliesSource", nil];
//diag_log "delete sound";
};
if (_onoff == 1) then {
_sound = createSoundSource["Sound_Flies",getPosATL _x,[],0];
_sound attachTo [_x];
_x setVariable ["sched_co_fliesSource", _sound];
//diag_log "create sound";
};
// broadcast flies status for everyone periodically, to update visible swarm
PVCDZ_flies = [ _onoff, _x ];
publicVariable "PVCDZ_flies";
};
} else {
if (_deathTime == -1) then {
_deathTime = diag_tickTime;
_x setVariable ["sched_co_deathTime", _deathTime];
} else {
// Wait 30s to make sure the server had time to setVariable "bodyName". PVDZ_plr_Death can be delayed by a few seconds.
if (diag_tickTime - _deathTime > 30) then {
_x call sched_co_deleteVehicle;
_delQtyG = _delQtyG + 1;
};
};
};
};
};
if (_x in vehicles) then {
_deathTime = _x getVariable ["sched_co_deathTime", -1];
if (_deathTime == -1) then {
_deathTime = diag_tickTime;
_x setVariable ["sched_co_deathTime", _deathTime];
};
// 5 minutes = how long a destroyed vehicle stays on the map
if (diag_tickTime - _deathTime > 5*60) then {
{deleteVehicle _x} forEach (_x nearObjects ["CraterLong",50]);
_x call sched_co_deleteVehicle;
_delQtyV = _delQtyV + 1;
};
};
} forEach allDead;
_delQtyAnimal = 0;
{
_animal = _x;
if (local _animal) then {
_nearPlayer = {isPlayer _x} count (_animal nearEntities ["CAManBase",150]);
if (_nearPlayer == 0) then {
_animal call sched_co_deleteVehicle;
_delQtyAnimal = _delQtyAnimal + 1;
};
};
} forEach entities "CAAnimalBase";
_delQtyGrp=0;
{
if (count units _x==0) then {
deleteGroup _x;
_delQtyGrp = _delQtyGrp + 1;
};
} forEach allGroups;
#ifdef SERVER_DEBUG
if (_delQtyZ+_delQtyP+_addFlies+_delQtyGrp+_delQtyG+_delQtyV > 0) then {
diag_log format ["%1: Deleted %2 uncontrolled zombies, %3 uncontrolled animals, %4 dead character bodies, %7 ghosts, %8 destroyed vehicles, %9 dead mission ai and %5 empty groups. Added %6 flies.",__FILE__,
_delQtyZ,_delQtyAnimal,_delQtyP,_delQtyGrp,_addFlies,_delQtyG,_delQtyV,_delQtyAI];
};
#endif
objNull
};
/*
sched_disconnectedPlayers = {
private ["_x","_disconnectTime"];
{
diag_log (_x);
if (local _x) then {
_disconnectTime = _x getVariable ["sched_co_disconnectTime", -1];
if (_disconnectTime == -1) then {
_disconnectTime = diag_tickTime;
_x setVariable ["sched_co_disconnectTime", _disconnectTime];
};
if (diag_tickTime - _disconnectTime > dayz_ghostTimer) then {
if (alive _x) then {
[_x,nil] call server_playerSync;
};
dayz_disconnectPlayers = dayz_disconnectPlayers - [_x];
_x call sched_co_deleteVehicle;
};
diag_log format["%1 - %2",_x,_disconnectTime];
};
} forEach dayz_disconnectPlayers;
objNull
};
*/

View File

@ -0,0 +1,52 @@
/*
This scheduled task checks for running DZMS missions and starts them appropriately.
*/
sched_dzms_init = {
diag_log("[DZMS]: Scheduler Started");
local _array = +DZMSMissionArray;
local _timeBandit = ((random(DZMSBanditMax - DZMSBanditMin) + DZMSBanditMin) * 60);
local _timeHero = ((random(DZMSHeroMax - DZMSHeroMin) + DZMSHeroMin) * 60);
[_array,_timeBandit,_timeHero]
};
sched_dzms = {
local _array = _this select 0;
local _timeBandit = _this select 1;
local _timeHero = _this select 2;
local _varName = "";
// Bandit mission timer
if (((diag_tickTime - DZMSBanditEndTime) >= _timeBandit) && {DZMSBanditRunning < DZMSBanditLimit} && {DZMSMarkerReady}) then {
DZMSMarkerReady = false;
_varName = _array call BIS_fnc_selectRandom;
DZMSMissionData = DZMSMissionData + [[0,[],[],[],[],[]]];
DZMSBanditEndTime = diag_tickTime;
DZMSBanditRunning = DZMSBanditRunning + 1;
["Bandit"] execVM format ["\z\addons\dayz_server\DZMS\Missions\%1.sqf",_varName];
if (DZMSDebug) then {diag_log text format ["[DZMS]: Running Bandit Mission %1.",_varName];};
};
// Hero mission timer
if (((diag_tickTime - DZMSHeroEndTime) >= _timeHero) && {DZMSHeroRunning < DZMSHeroLimit} && {DZMSMarkerReady}) then {
DZMSMarkerReady = false;
_varName = _array call BIS_fnc_selectRandom;
DZMSMissionData = DZMSMissionData + [[0,[],[],[],[],[]]];
DZMSHeroEndTime = diag_tickTime;
DZMSHeroRunning = DZMSHeroRunning + 1;
["Hero"] execVM format ["\z\addons\dayz_server\DZMS\Missions\%1.sqf",_varName];
if (DZMSDebug) then {diag_log text format ["[DZMS]: Running Hero Mission %1.",_varName];};
};
// Remove mission from array and reset array if necessary
_array = _array - [_varName];
if (count _array == 0) then {
_array = +DZMSMissionArray;
};
// Reset times
_timeBandit = ((random(DZMSBanditMax - DZMSBanditMin) + DZMSBanditMin) * 60);
_timeHero = ((random(DZMSHeroMax - DZMSHeroMin) + DZMSHeroMin) * 60);
[_array,_timeBandit,_timeHero]
};

View File

@ -0,0 +1,74 @@
/*
DayZ Epoch Event Scheduler
Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
*/
epoch_eventIsAny = {
private ["_boolReturn","_event","_date","_bool","_index"];
_event = _this select 0;
_date = _this select 1;
_boolReturn = false;
_index = 0;
{
_bool = false;
if (typeName _x == "STRING") then {
_boolReturn = true;
} else {
_boolReturn = ((_date select _index) == _x);
};
if (!_boolReturn) exitWith {};
_index = _index + 1;
} count _event;
_boolReturn
};
sched_event_init = {
diag_log("EPOCH EVENTS INIT");
""
};
sched_event = {
private ["_date","_key","_result","_outcome","_handle","_datestr","_lastTime"];
// Find current time from server
_lastTime = _this;
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
_date = _result select 1;
_datestr = str(_date);
if (_lastTime != _datestr) then {
// internal timestamp
ServerCurrentTime = _date;
// Once a minute.
_lastTime = _datestr;
//diag_log ("EVENTS: Local Time is: " + _datestr);
if (count EpochEvents == 0) exitWith {};
{
// Run event at server start when minutes are set to -1
if ((_x select 4) == -1) then {
diag_log ("RUNNING EVENT: " + (_x select 5) + " on " + _datestr);
_handle = [] execVM "\z\addons\dayz_server\modules\" + (_x select 5) + ".sqf";
// Remove event from array so it doesn't run again.
_lastIndex = (count EpochEvents) - 1;
if (_lastIndex != _forEachIndex) then {EpochEvents set [_forEachIndex, EpochEvents select _lastIndex];};
EpochEvents resize _lastIndex;
} else {
if([[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4)],_date] call epoch_eventIsAny) then {
diag_log ("RUNNING EVENT: " + (_x select 5) + " on " + _datestr);
_handle = [] execVM "\z\addons\dayz_server\modules\" + (_x select 5) + ".sqf";
};
};
} forEach EpochEvents;
};
};
_lastTime
};

View File

@ -0,0 +1,37 @@
#define PATH "z\addons\dayz_server\system\scheduler\"
call compile preprocessFileLineNumbers (PATH+"sched_corpses.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_lootpiles.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_sync.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_safetyVehicle.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_dzms.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_wai.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_event.sqf");
call compile preprocessFileLineNumbers (PATH+"sched_traps.sqf");
[
// period offset code <-> ctx init code ->ctx
[ 60, 0, sched_event, sched_event_init ],
[ 60, 224, sched_corpses ],
[ 300, 336, sched_lootpiles_5m, sched_lootpiles_5m_init ],
[ 90, 60, sched_dzms, sched_dzms_init ],
[ 90, 60, sched_wai, sched_wai_init ],
[ 6, 340, sched_lootpiles ],
[ 900, 0, sched_sync ],
[ 120, 48, sched_safetyVehicle ],
[ 360, 480, sched_fps ],
[ 30, 60, sched_traps, sched_traps_init ]
] execFSM ("z\addons\dayz_code\system\scheduler\scheduler.fsm");
//diag_log [ __FILE__, "Scheduler started"];
/*
// (see ViralZeds.hpp -> zombie_agent.fsm -> zombie_findOwner.sqf), called when a zombie becomes "local" to the server after the player disconnected
zombie_findOwner = {
(_this select 0) call fa_deleteVehicle;
};
*/

View File

@ -0,0 +1,115 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
sched_lootpiles_5m_init = {
sched_lp_state = 0;
sched_lp_var1 = 0;
sched_lp_lootTotal = 0;
sched_lp_delqty = 0;
sched_lp_players = [];
sched_lp_list = [];
objNull
};
sched_lootpiles_5m = {
private ["_created","_kind","_x"];
if (sched_lp_state == 0) then {
sched_lp_list = [];
sched_lp_lootTotal = 0;
{
_kind = _x;
{
_created = _x getVariable ["created",-1];
if (_created == -1) then {
_created = diag_tickTime;
_x setVariable ["created",_created];
};
if (!(_x getVariable ["permaLoot",false]) AND {(diag_tickTime - _created > 1500)}) then {
sched_lp_list set [ count sched_lp_list, _x ];
};
sched_lp_lootTotal = sched_lp_lootTotal + 1;
} forEach allMissionObjects _kind;
} forEach [ "Blood_Trail_DZ", "ReammoBox", "Land_Fire_DZ", "flamable_DZ" ];
#ifdef SERVER_DEBUG
diag_log ["sched_lootpiles_5mn: reset lootpiles check, total visited:", sched_lp_lootTotal, "listed:", count sched_lp_list];
#endif
if (count sched_lp_list > 0) then {
sched_lp_state = 1;
sched_lp_var1 = 0;
sched_lp_players = +(playableUnits);
};
};
objNull
};
sched_lootpiles = {
private ["_plrBatch","_chunkSize","_imax","_plr","_i","_x", "_changed"];
// EVERY 5 MINUTES, ONE OF THESE TASKS SPACED BY 5 SECONDS:
// LOOK FOR OLD LOOTPILES -OR- IGNORE LOOTPILES NEAR _plrBatch PLAYERS -OR- REMOVE REMAINING _chunkSize LOOTPILES
_chunkSize = 50;
_plrBatch = 10;
switch true do {
case (sched_lp_state == 1): { // forEach players -> ignore nearby loot
_imax = (count sched_lp_players) min (sched_lp_var1 + _plrBatch);
//diag_log format ["%1: lootpiles foreach players from:%2 to:%3 players:%4 old:%5 total:%6", __FILE__, sched_lp_var1, _imax, count sched_lp_players, count sched_lp_list, sched_lp_lootTotal ];
for "_i" from sched_lp_var1 to _imax-1 do {
_plr = (sched_lp_players select _i);
if (!(isNull _plr) AND {(isPlayer _plr)}) then {
_plr = vehicle _plr;
{
if (_x IN sched_lp_list) then {
sched_lp_list = sched_lp_list - [_x];
};
} forEach ((getPosATL _plr) nearObjects ["ReammoBox",250]);
}/*
else {
diag_log format [ "%1 player left? %2", __FILE__, _x ];
}*/;
};
sched_lp_var1 = _imax;
_changed = false;
if (_imax == count sched_lp_players) then { // catch the few players who entered meanwhile
{
if !(_x in sched_lp_players) then {
sched_lp_players set [ count sched_lp_players, _x ];
_changed = true;
};
} forEach playableUnits;
};
if (!_changed) then {
sched_lp_state = 2;
sched_lp_var1 = 0;
sched_lp_delqty = count sched_lp_list;
#ifdef SERVER_DEBUG
diag_log [ "sched_lootpiles:Will delete",sched_lp_delqty,"lootpiles"];
#endif
}
else {
#ifdef SERVER_DEBUG
diag_log [ "sched_lootpiles:Extended loop for new players", _imax, count sched_lp_players];
#endif
};
};
case (sched_lp_state == 2): { // forEAch remaining lootpiles -> delete
_imax = (sched_lp_delqty) min (sched_lp_var1 + _chunkSize);
//diag_log format ["%1: lootpiles foreach loot to del from:%2 to:%3 old:%4 total:%5", __FILE__, sched_lp_var1, _imax, sched_lp_delqty, sched_lp_lootTotal ];
for "_i" from sched_lp_var1 to _imax-1 do {
_x = sched_lp_list select _i;
if (!isNull _x) then {
deleteVehicle _x;
};
};
sched_lp_var1 = _imax;
if (_imax == sched_lp_delqty) then {
sched_lp_state = 0;
sched_lp_list = [];
#ifdef SERVER_DEBUG
diag_log format ["%1: deleted %2 lootpiles from %3 total", __FILE__, sched_lp_delqty, sched_lp_lootTotal ];
#endif
};
};
}; // switch
objNull
};

View File

@ -0,0 +1,12 @@
sched_safetyVehicle = {
{
if (vehicle _x != _x && !(vehicle _x in dayz_serverObjectMonitor) && !((typeOf vehicle _x) in DZE_safeVehicle)) then {
diag_log [ __FILE__, "KILLING A HACKER", name _x, " IN ", typeOf vehicle _x ];
(vehicle _x) setDamage 1;
_x setDamage 1;
};
} forEach allUnits;
objNull
};

View File

@ -0,0 +1,62 @@
/*
Instructions for using day/night schedule.
1. In your server config folder, edit file HiveExt.ini. Change [Time] Type to Local...Type = Local.
2. Uncomment line 16 in this file: //#define DAY_NIGHT_SCHEDULE
3. Adjust the hours of the day that you want to have night time in the arrays.
NOTES:
The date/time is local to the server's time zone.
The days referred to here are days of the month, not days of the week.
You can configure odd and even days of the month to have different night time hours.
Coordinate the hours with BEC server restarts defined in scheduler.xml.
The default arrays alternate between day and night on a 4 hour schedule based on 0000, 0400, 0800, 1200, 1600, and 2000 restarts.
*/
//#define DAY_NIGHT_SCHEDULE // Uncomment this line to enable day/night schedule.
#define EVEN_DAY_NIGHT_HOURS [0,1,2,3,8,9,10,11,16,17,18,19] // These are the hours of the even numbered monthly days you wish to have night.
#define ODD_DAY_NIGHT_HOURS [0,1,2,3,8,9,10,11,16,17,18,19] // These are the hours of the odd numbered monthly days you wish to have night.
sched_sync = {
private ["_date","_hour","_minute"];
// RESYNC TIME ON ALL MACHINES EVERY 15 MINUTES
// Date format [Year,Month,Day of the month,Hour,Minute]
_date = ServerCurrentTime; // ServerCurrentTime is set at server start in sched_event and updated every 60 seconds.
_day = _date select 2;
_hour = _date select 3;
_minute = _date select 4;
#ifdef DAY_NIGHT_SCHEDULE
_date set[3, 12]; // daytime unless overwritten below.
if (_day % 2 == 0) then { // check if day of the month is divisible by 2.
if (_hour in EVEN_DAY_NIGHT_HOURS) then {
_date set[3, 20]; // set hour to 20.
};
} else {
if (_hour in ODD_DAY_NIGHT_HOURS) then {
_date set[3, 20]; // set hour to 20.
};
};
#endif
if(dayz_ForcefullmoonNights) then {
_date = [2012,8,2,(_date select 3),_minute];
};
dayz_storeTimeDate = _date; // dayz_storeTimeDate is used to set the date on client connections.
setDate _date;
dayzSetDate = _date;
publicVariable "dayzSetDate";
diag_log [ __FILE__, "TIME SYNC: Local Time set to:", _date, "Fullmoon:",dayz_ForcefullmoonNights, "Date given by HiveExt.dll:", _date];
objNull
};
sched_fps = {
diag_log format["SERVER FPS: %1 PLAYERS: %2",round diag_fps,playersNumber west];
objNull
};

View File

@ -0,0 +1,49 @@
/*
This scheduled task checks for changes in the number of bear traps set by players.
It is set to run every 30 seconds by default in sched_init.
For each of the traps, it gets the "armed" variable and calls the appropriate script
to arm or disarm the bear trap. Lazy eval has been added so that the function evaluates
quickly. Bear traps are not a popular feature in DayZ Epoch.
*/
sched_traps_init = {
//diag_log("Bear Trap Monitor Started");
[str dayz_traps,str dayz_traps_active,str dayz_traps_trigger]
};
sched_traps = {
private ["_array","_array2","_array3","_script","_armed"];
_array = _this select 0;
_array2 = _this select 1;
_array3 = _this select 2;
if ((str dayz_traps != _array) || {str dayz_traps_active != _array2} || {str dayz_traps_trigger != _array3}) then {
_array = str dayz_traps;
_array2 = str dayz_traps_active;
_array3 = str dayz_traps_trigger;
//diag_log "DEBUG: traps";
//diag_log format["dayz_traps (%2) -> %1", dayz_traps, count dayz_traps];
//diag_log format["dayz_traps_active (%2) -> %1", dayz_traps_active, count dayz_traps_active];
//diag_log format["dayz_traps_trigger (%2) -> %1", dayz_traps_trigger, count dayz_traps_trigger];
//diag_log "DEBUG: end traps";
};
{
if (isNull _x) then {
dayz_traps = dayz_traps - [_x];
_armed = false;
_script = {};
} else {
_armed = _x getVariable ["armed", false];
_script = call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
};
if (_armed) then {
if !(_x in dayz_traps_active) then {["arm", _x] call _script;};
} else {
if (_x in dayz_traps_active) then {["disarm", _x] call _script;};
};
} forEach dayz_traps;
[_array,_array2,_array3]
};

View File

@ -0,0 +1,78 @@
/*
This scheduled task checks for running WAI missions and starts them appropriately.
*/
sched_wai_init = {
diag_log("WAI: Scheduler Started");
local _hArray = +wai_hero_missions;
local _bArray = +wai_bandit_missions;
local _hTime = (random((wai_mission_timer select 1) - (wai_mission_timer select 0)) + (wai_mission_timer select 0)) * 60;
local _bTime = (random((wai_mission_timer select 1) - (wai_mission_timer select 0)) + (wai_mission_timer select 0)) * 60;
[_hArray,_bArray,_bTime,_hTime]
};
sched_wai = {
local _hArray = _this select 0;
local _bArray = _this select 1;
local _bTime = _this select 2;
local _hTime = _this select 3;
local _mission = "";
// Bandit mission timer
if (WAI_MarkerReady && {diag_tickTime - wai_b_starttime >= _bTime} && {b_missionsrunning < wai_bandit_limit}) then {
WAI_MarkerReady = false;
local _selected = false;
while {!_selected} do {
if (wai_debug_mode) then {diag_log format["WAI: Bandit Array: %1",_bArray];};
_mission = _bArray select (floor (random (count _bArray)));
_index = [_bArray, (_mission select 0)] call BIS_fnc_findNestedElement select 0;
_bArray = [_bArray,_index] call fnc_deleteAt;
if (count _bArray == 0) then {_bArray = +wai_bandit_missions;};
if ((_mission select 1) >= random 1) then {
_selected = true;
if (wai_debug_mode) then {diag_log format["WAI: Bandit mission %1 selected.",(_mission select 0)];};
} else {
if (wai_debug_mode) then {diag_log format["WAI: Bandit mission %1 NOT selected.",(_mission select 0)];};
};
};
b_missionsrunning = b_missionsrunning + 1;
wai_b_starttime = diag_tickTime;
wai_mission_markers set [(count wai_mission_markers), ("MainBandit" + str(count wai_mission_data))];
wai_mission_data = wai_mission_data + [[0,[],[],[],[],[],[]]];
["MainBandit","Hero"] execVM format ["\z\addons\dayz_server\WAI\missions\missions\%1.sqf",(_mission select 0)];
};
// Hero mission timer
if (WAI_MarkerReady && {diag_tickTime - wai_h_starttime >= _hTime} && {h_missionsrunning < wai_hero_limit}) then {
WAI_MarkerReady = false;
local _selected = false;
while {!_selected} do {
if (wai_debug_mode) then {diag_log format["WAI: Hero Array: %1",_hArray];};
_mission = _hArray select (floor (random (count _hArray)));
_index = [_hArray, (_mission select 0)] call BIS_fnc_findNestedElement select 0;
_hArray = [_hArray,_index] call fnc_deleteAt;
if (count _hArray == 0) then {_hArray = +wai_hero_missions;};
if ((_mission select 1) >= random 1) then {
_selected = true;
if (wai_debug_mode) then {diag_log format["WAI: Hero mission %1 selected.",(_mission select 0)];};
} else {
if (wai_debug_mode) then {diag_log format["WAI: Hero mission %1 NOT selected.",(_mission select 0)];};
};
};
h_missionsrunning = h_missionsrunning + 1;
wai_h_starttime = diag_tickTime;
wai_mission_markers set [(count wai_mission_markers), ("MainHero" + str(count wai_mission_data))];
wai_mission_data = wai_mission_data + [[0,[],[],[],[],[],[]]];
["MainHero","Bandit"] execVM format ["\z\addons\dayz_server\WAI\missions\missions\%1.sqf",(_mission select 0)];
};
// Reset times
_hTime = (random((wai_mission_timer select 1) - (wai_mission_timer select 0)) + (wai_mission_timer select 0)) * 60;
_bTime = (random((wai_mission_timer select 1) - (wai_mission_timer select 0)) + (wai_mission_timer select 0)) * 60;
[_hArray,_bArray,_bTime,_hTime]
};

View File

@ -0,0 +1,470 @@
private ["_legacyStreamingMethod","_hiveLoaded","_timeStart","_i","_key","_result","_shutdown","_res","_myArray","_val","_status","_fileName","_lastFN",
"_VehicleQueue","_vQty","_idKey","_type","_ownerID","_worldspace","_inventory","_damage","_storageMoney","_vector","_vecExists","_ownerPUID",
"_wsCount","_ws2TN","_ws3TN","_dir","_posATL","_wsDone","_object","_doorLocked","_isPlot","_isTrapItem","_isSafeObject",
"_weaponcargo","_magcargo","_backpackcargo","_weaponqty","_magqty","_backpackqty","_lockable","_codeCount","_codeCount","_isTrapItem","_xTypeName","_x1",
"_isAir","_selection","_dam","_hitpoints","_fuel","_pos"];
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
waitUntil {!isNil "BIS_MPF_InitDone" && initialized};
if (!isNil "sm_done") exitWith {}; // prevent server_monitor be called twice (bug during login of the first player)
sm_done = false;
_legacyStreamingMethod = false; //use old object streaming method, more secure but will be slower and subject to the callExtension return size limitation.
dayz_serverIDMonitor = [];
dayz_versionNo = getText (configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber (configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_hiveLoaded = false;
_serverVehicleCounter = [];
diag_log "HIVE: Starting";
//Stream in objects
/* STREAM OBJECTS */
//Send the key
_timeStart = diag_tickTime;
for "_i" from 1 to 5 do {
diag_log "HIVE: trying to get objects";
_key = format["CHILD:302:%1:%2:",dayZ_instance, _legacyStreamingMethod];
_result = _key call server_hiveReadWrite;
if (typeName _result == "STRING") then {
_shutdown = format["CHILD:400:%1:",(profileNamespace getVariable "SUPERKEY")];
_res = _shutdown call server_hiveReadWrite;
diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
} else {
diag_log ("HIVE: found "+str(_result select 1)+" objects" );
_i = 99; // break
};
};
if (typeName _result == "STRING") exitWith {
diag_log "HIVE: Connection error. Server_monitor.sqf is exiting.";
};
diag_log "HIVE: Request sent";
_myArray = [];
_val = 0;
_status = _result select 0; //Process result
_val = _result select 1;
if (_legacyStreamingMethod) then {
if (_status == "ObjectStreamStart") then {
profileNamespace setVariable ["SUPERKEY",(_result select 2)];
_hiveLoaded = true;
//Stream Objects
diag_log ("HIVE: Commence Object Streaming...");
for "_i" from 1 to _val do {
_result = _key call server_hiveReadWriteLarge;
_status = _result select 0;
_myArray set [count _myArray,_result];
};
};
} else {
if (_val > 0) then {
_fileName = _key call server_hiveReadWrite;
_lastFN = profileNamespace getVariable["lastFN",""];
profileNamespace setVariable["lastFN",_fileName];
saveProfileNamespace;
if (_status == "ObjectStreamStart") then {
profileNamespace setVariable ["SUPERKEY",(_result select 2)];
_hiveLoaded = true;
_myArray = Call Compile PreProcessFile _fileName;
_key = format["CHILD:302:%1:%2:",_lastFN, _legacyStreamingMethod];
_result = _key call server_hiveReadWrite; //deletes previous object data dump
};
} else {
if (_status == "ObjectStreamStart") then {
profileNamespace setVariable ["SUPERKEY",(_result select 2)];
_hiveLoaded = true;
};
};
};
//Stream objects first then load in the vehicles
_VehicleQueue = [];
_vQty = 0;
diag_log ("HIVE: Streamed " + str(count _myArray) + " Objects.");
// Don't spawn objects if no clients are online (createVehicle fails with Ref to nonnetwork object)
if ((playersNumber west + playersNumber civilian) == 0) exitWith {
diag_log "All clients disconnected. Server_monitor.sqf is exiting.";
};
//spawn objects
{
//Parse Array
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;
_worldspace = _x select 4;
_inventory = _x select 5;
_damage = _x select 8;
_storageMoney = _x select 9;
if ((_type isKindOf "AllVehicles")) then {
_VehicleQueue set [_vQty,_x];
_vQty = _vQty + 1;
} else {
_dir = 90;
_pos = [0,0,0];
_wsDone = false;
_wsCount = count _worldspace;
//Vector building
_vector = [[0,0,0],[0,0,0]];
_vecExists = false;
_ownerPUID = "0";
call {
if (_wsCount == 4) exitwith {
_dir = _worldspace select 0;
_posATL = _worldspace select 1;
if (count _posATL == 3) then {
_pos = _posATL;
_wsDone = true;
};
_ws2TN = typename (_worldspace select 2);
_ws3TN = typename (_worldspace select 3);
if (_ws3TN == "STRING") then {
_ownerPUID = _worldspace select 3;
} else {
if (_ws2TN == "STRING") then {
_ownerPUID = _worldspace select 2;
};
};
if (_ws2TN == "ARRAY") then {
_vector = _worldspace select 2;
_vecExists = true;
} else {
if (_ws3TN == "ARRAY") then {
_vector = _worldspace select 3;
_vecExists = true;
};
};
};
if (_wsCount == 3) exitwith {
_dir = _worldspace select 0;
_posATL = _worldspace select 1;
if (count _posATL == 3) then {
_pos = _posATL;
_wsDone = true;
};
_ws2TN = typename (_worldspace select 2);
_ws3TN = typename (_worldspace select 3);
if (_ws2TN == "STRING") then {
_ownerPUID = _worldspace select 2;
} else {
if (_ws2TN == "ARRAY") then {
_vector = _worldspace select 2;
_vecExists = true;
};
};
};
if (_wsCount == 2) then {
_dir = _worldspace select 0;
_posATL = _worldspace select 1;
if (count _posATL == 3) then {
_pos = _posATL;
_wsDone = true;
};
};
if (_wsCount < 2) exitwith {
_worldspace set [count _worldspace, "0"];
};
};
if (!_wsDone) then {
if ((count _posATL) >= 2) then {
_pos = [_posATL select 0,_posATL select 1,0];
diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: %4",_idKey,_type,_worldspace,_pos];
} else {
diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: [0,0,0]",_idKey,_type,_worldspace];
};
};
_object = _type createVehicle [0,0,0]; //more than 2x faster than createvehicle array
_object setDir _dir;
_object setPosATL _pos;
_object setDamage _damage;
if (_vecExists) then {
_object setVectorDirAndUp _vector;
};
_object enableSimulation false;
_doorLocked = _type in DZE_DoorsLocked;
_isPlot = _type == "Plastic_Pole_EP1_DZ";
// prevent immediate hive write when vehicle parts are set up
_object setVariable ["lastUpdate",diag_ticktime];
_object setVariable ["ObjectID", _idKey, true];
_object setVariable ["OwnerPUID", _ownerPUID, true];
if (Z_SingleCurrency && {_type in DZE_MoneyStorageClasses}) then {
_object setVariable ["cashMoney", _storageMoney, true];
};
dayz_serverIDMonitor set [count dayz_serverIDMonitor,_idKey];
if (!_wsDone) then {[_object,"position",true] call server_updateObject;};
if (_type == "Base_Fire_DZ") then {_object spawn base_fireMonitor;};
_isTrapItem = _object isKindOf "TrapItems";
_isSafeObject = _type in DayZ_SafeObjects;
//Dont add inventory for traps.
if (!_isTrapItem) then {
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
clearBackpackCargoGlobal _object;
if( (count _inventory > 0) && !_isPlot && !_doorLocked) then {
if (_type in DZE_LockedStorage) then {
// Do not send big arrays over network! Only server needs these
_object setVariable ["WeaponCargo",(_inventory select 0),false];
_object setVariable ["MagazineCargo",(_inventory select 1),false];
_object setVariable ["BackpackCargo",(_inventory select 2),false];
} else {
_weaponcargo = _inventory select 0 select 0;
_magcargo = _inventory select 1 select 0;
_backpackcargo = _inventory select 2 select 0;
_weaponqty = _inventory select 0 select 1;
{_object addWeaponCargoGlobal [_x, _weaponqty select _foreachindex];} foreach _weaponcargo;
_magqty = _inventory select 1 select 1;
{if (_x != "CSGAS") then {_object addMagazineCargoGlobal [_x, _magqty select _foreachindex];};} foreach _magcargo;
_backpackqty = _inventory select 2 select 1;
{_object addBackpackCargoGlobal [_x, _backpackqty select _foreachindex];} foreach _backpackcargo;
};
} else {
if (DZE_permanentPlot && _isPlot) then {
_object setVariable ["plotfriends", _inventory, true];
};
if (DZE_doorManagement && _doorLocked) then {
_object setVariable ["doorfriends", _inventory, true];
};
};
};
// Fix for leading zero issues on safe codes after restart
_lockable = getNumber (configFile >> "CfgVehicles" >> _type >> "lockable");
_codeCount = count (toArray _ownerID);
call {
if (_lockable == 4) exitwith {
call {
if (_codeCount == 3) exitwith {_ownerID = format["0%1",_ownerID];};
if (_codeCount == 2) exitwith {_ownerID = format["00%1",_ownerID];};
if (_codeCount == 1) exitwith {_ownerID = format["000%1",_ownerID];};
};
};
if (_lockable == 3) exitwith {
call {
if (_codeCount == 2) exitwith {_ownerID = format["0%1",_ownerID];};
if (_codeCount == 1) exitwith {_ownerID = format["00%1",_ownerID];};
};
};
};
_object setVariable ["CharacterID", _ownerID, true];
if (_isSafeObject && !_isTrapItem) then {
_object setVariable["memDir",_dir,true];
if (DZE_GodModeBase && {!(_type in DZE_GodModeBaseExclude)}) then {
_object addEventHandler ["HandleDamage",{false}];
} else {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
_object setVariable ["OEMPos",_pos,true]; // used for inplace upgrades and lock/unlock of safe
} else {
_object enableSimulation true;
};
if (_isTrapItem) then {
//Use inventory traps armed state
{
_xTypeName = typeName _x;
if (_xTypeName == "ARRAY") then {
_x1 = _x select 1;
_object setVariable ["armed", _x1, true];
} else {
_object setVariable ["armed", _x, true];
};
} count _inventory;
};
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; //Monitor the object
};
} foreach _myArray;
//spawn vehicles
{
//Parse Array
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;
_worldspace = _x select 4;
_inventory = _x select 5;
_hitPoints = _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
_storageMoney = _x select 9;
_dir = 90;
_pos = [0,0,0];
_wsDone = false;
_wsCount = count _worldspace;
call {
if (_wsCount == 2) exitwith {
_dir = _worldspace select 0;
_posATL = _worldspace select 1;
if (count _posATL == 3) then {
_pos = _posATL;
_wsDone = true;
};
};
if (_wsCount < 2) exitwith {
_worldspace set [count _worldspace, "0"];
};
};
if (!_wsDone) then {
if ((count _posATL) >= 2) then {
_pos = [_posATL select 0,_posATL select 1,0];
diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: %4",_idKey,_type,_worldspace,_pos];
} else {
diag_log format["MOVED OBJ: %1 of class %2 with worldspace array = %3 to pos: [0,0,0]",_idKey,_type,_worldspace];
};
};
_object = _type createVehicle [0,0,0]; //more than 2x faster than createvehicle array
_object setDir _dir;
_object setPosATL _pos;
_object setDamage _damage;
_object enableSimulation false;
// prevent immediate hive write when vehicle parts are set up
_object setVariable ["lastUpdate",diag_ticktime];
_object setVariable ["ObjectID", _idKey, true];
if (Z_SingleCurrency && ZSC_VehicleMoneyStorage) then {
_object setVariable ["cashMoney", _storageMoney, true];
};
dayz_serverIDMonitor set [count dayz_serverIDMonitor,_idKey];
if (!_wsDone) then {[_object,"position",true] call server_updateObject;};
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
clearBackpackCargoGlobal _object;
if (count _inventory > 0) then {
_weaponcargo = _inventory select 0 select 0;
_magcargo = _inventory select 1 select 0;
_backpackcargo = _inventory select 2 select 0;
_weaponqty = _inventory select 0 select 1;
{_object addWeaponCargoGlobal [_x, _weaponqty select _foreachindex];} foreach _weaponcargo;
_magqty = _inventory select 1 select 1;
{if (_x != "CSGAS") then {_object addMagazineCargoGlobal [_x, _magqty select _foreachindex];};} foreach _magcargo;
_backpackqty = _inventory select 2 select 1;
{_object addBackpackCargoGlobal [_x, _backpackqty select _foreachindex];} foreach _backpackcargo;
};
_object setVariable ["CharacterID", _ownerID, true];
_isAir = _object isKindOf "Air";
{
_selection = _x select 0;
_dam = [_x select 1,(_x select 1) min 0.8] select (!_isAir && {_selection in dayZ_explosiveParts});
_object setHit [_selection,_dam];
} count _hitpoints;
[_object,"damage"] call server_updateObject;
_object setFuel _fuel;
_object call fnc_veh_ResetEH;
if (_ownerID != "0" && {!(_object isKindOf "Bicycle")}) then {
_object setVehicleLock "locked";
//_object setVariable ["MF_Tow_Cannot_Tow",true,true];
};
_serverVehicleCounter set [count _serverVehicleCounter,_type]; // total each vehicle
_object enableSimulation true;
_object setVelocity [0,0,1];
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object]; //Monitor the object
} foreach _VehicleQueue;
diag_log ("HIVE: Streamed " + str((count _myArray) -_vQty) + " Objects and " + str(_vQty) + " Vehicles.");
diag_log format["HIVE: BENCHMARK - Server_monitor.sqf finished streaming %1 objects in %2 seconds (unscheduled)",_val,diag_tickTime - _timeStart];
// # END OF STREAMING #
if (dayz_townGenerator) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_plantSpawner.sqf"; // Draw the pseudo random seeds
};
#ifndef OBJECT_DEBUG
object_debug = false;
#else
object_debug = true;
#endif
execFSM "\z\addons\dayz_server\system\server_vehicleSync.fsm";
execVM "\z\addons\dayz_server\system\scheduler\sched_init.sqf"; // launch the new task scheduler
execFSM "\z\addons\dayz_server\system\server_weather.fsm"; // new weather system for 1.0.7
createCenter civilian;
actualSpawnMarkerCount = 0;
// count valid spawn markers, since different maps have different amounts
for "_i" from 0 to 10 do {
if ((getMarkerPos format["spawn%1",_i]) distance [0,0,0] > 0) then {
actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
} else {
_i = 11; // exit since we did not find any further markers
};
};
diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
if (isDedicated) then {endLoadingScreen;};
allowConnection = true;
sm_done = true;
publicVariable "sm_done";
execVM "\z\addons\dayz_server\system\lit_fireplaces.sqf";
if (_hiveLoaded) then {
_serverVehicleCounter spawn {
private ["_startTime","_cfgLootFile","_vehLimit"];
// spawn_vehicles
// Get all buildings and roads only once. Very taxing, but only on first startup
_serverVehicleCounter = _this;
_vehiclesToUpdate = [];
_startTime = diag_tickTime;
_buildingList = [];
_cfgLootFile = missionConfigFile >> "CfgLoot" >> "Buildings";
{
if (isClass (_cfgLootFile >> typeOf _x)) then {
_buildingList set [count _buildingList,_x];
};
} count (getMarkerPos "center" nearObjects ["building",((getMarkerSize "center") select 1)]);
_roadList = getMarkerPos "center" nearRoads ((getMarkerSize "center") select 1);
//diag_log format ["_serverVehicleCounter: %1",_serverVehicleCounter];
_vehLimit = MaxVehicleLimit - (count _serverVehicleCounter);
if (_vehLimit > 0) then {
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
for "_x" from 1 to _vehLimit do {call spawn_vehicles;};
} else {
diag_log "HIVE: Vehicle Spawn limit reached!";
_vehLimit = 0;
};
if (dayz_townGenerator) then {
// Vanilla town generator spawns debris locally on each client
MaxDynamicDebris = 0;
} else {
// Epoch global dynamic debris
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
for "_x" from 1 to MaxDynamicDebris do {call spawn_roadblocks;};
};
diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
for "_x" from 1 to MaxAmmoBoxes do {call spawn_ammosupply;};
diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
for "_x" from 1 to MaxMineVeins do {call spawn_mineveins;};
diag_log format["HIVE: BENCHMARK - Server finished spawning %1 DynamicVehicles, %2 Debris, %3 SupplyCrates and %4 MineVeins in %5 seconds (scheduled)",_vehLimit,MaxDynamicDebris,MaxAmmoBoxes,MaxMineVeins,diag_tickTime - _startTime];
//Update gear last after all dynamic vehicles are created to save random loot to database (low priority)
{[_x,"gear"] call server_updateObject} count _vehiclesToUpdate;
};
};

View File

@ -0,0 +1,135 @@
/*%FSM<COMPILE "scriptedFSM.cfg, DayZ Server Vehicle Sync">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-75.000000,-425.000000,25.000000,-375.000000,0.000000,"init"};
item1[] = {"true",8,218,-75.000000,-200.000000,25.000000,-150.000000,0.000000,"true"};
item2[] = {"waiting",2,250,-75.000000,-125.000000,25.000000,-75.000000,0.000000,"waiting"};
item3[] = {"true",8,218,-75.000000,250.000000,25.000000,300.000000,0.000000,"true"};
item4[] = {"",7,210,-204.000015,271.000000,-195.999985,279.000031,0.000000,""};
item5[] = {"",7,210,-204.000015,-104.000000,-196.000000,-96.000000,0.000000,""};
item6[] = {"initialized",4,218,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"initialized"};
item7[] = {"prepare",2,4346,-75.000000,-275.000000,25.000000,-225.000000,0.000000,"prepare"};
item8[] = {"update_objects",2,250,-75.220673,77.428261,24.779324,127.428261,0.000000,"update objects"};
item9[] = {"Objects_need_upd",4,218,-75.220726,-1.214130,24.779320,48.785873,1.000000,"Objects" \n "need update"};
link0[] = {0,6};
link1[] = {1,2};
link2[] = {2,9};
link3[] = {3,4};
link4[] = {4,5};
link5[] = {5,2};
link6[] = {6,7};
link7[] = {7,1};
link8[] = {8,3};
link9[] = {9,8};
globals[] = {0.000000,0,0,0,0,640,480,1,15,6316128,1,-285.818726,406.559204,464.760406,-344.050812,779,910,1};
window[] = {2,-1,-1,-1,-1,858,130,1459,130,3,797};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "DayZ Server Vehicle Sync";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "initialized">*/
class initialized
{
priority = 0.000000;
to="prepare";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "waiting">*/
class waiting
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Objects_need_upd">*/
class Objects_need_upd
{
priority = 1.000000;
to="update_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastVehicleUpdate> 5) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING Vehicle SCRIPT"");" \n
"" \n
"_lastVehicleUpdate = diag_tickTime;" \n
"" \n
"" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "update_objects">*/
class update_objects
{
name = "update_objects";
init = /*%FSM<STATEINIT""">*/"if (object_debug) then {" \n
" diag_log format[""INFO: needUpdate_objects=%1"",needUpdate_objects];" \n
"};" \n
"" \n
"{" \n
" needUpdate_objects = needUpdate_objects - [_x];" \n
" [_x,""damage"",true] call server_updateObject;" \n
"} forEach needUpdate_objects;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
};
};
/*%FSM</COMPILE>*/

View File

@ -0,0 +1,472 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, dze_weather">*/
/*%FSM<HEAD>*/
/*
item0[] = {"Init",0,250,-40.348839,-141.860458,49.651161,-91.860458,0.000000,"Init"};
item1[] = {"Winter",4,218,-188.538055,-142.324219,-98.538559,-92.324203,0.000000,"Winter"};
item2[] = {"Summer",4,218,102.997711,-141.329483,192.997635,-91.329491,0.000000,"Summer"};
item3[] = {"Initial_Weather",2,250,-188.646942,-61.923744,-98.647324,-11.923735,0.000000,"Initial" \n "Weather" \n "Settings"};
item4[] = {"Initial_Weather_1",2,250,102.293213,-59.535393,192.293106,-9.535398,0.000000,"Initial" \n "Weather" \n "Settings"};
item5[] = {"Dynamic",4,218,-329.250580,71.166527,-239.250580,121.166656,0.000000,"Dynamic"};
item6[] = {"Dynamic",4,218,218.953949,71.415863,308.953918,121.415939,0.000000,"Dynamic"};
item7[] = {"Wait",2,250,-328.546112,168.298981,-238.546051,218.298904,0.000000,"Wait"};
item8[] = {"Wait_1",2,250,218.914642,170.498108,308.914825,220.498215,0.000000,"Wait"};
item9[] = {"Ready",4,218,-328.654816,242.721832,-238.654816,292.721832,0.000000,"Ready"};
item10[] = {"Static",4,218,-157.608826,11.221905,-67.609406,61.222015,0.000000,"Static"};
item11[] = {"Static",4,218,75.503952,10.589214,165.503632,60.589310,0.000000,"Static"};
item12[] = {"Ready",4,218,219.836456,249.480164,309.836395,299.480164,0.000000,"Ready"};
item13[] = {"End",1,250,-40.321423,10.661306,49.678623,60.661461,0.000000,"End"};
item14[] = {"Invalid_Option",4,218,-40.038357,-66.470139,49.961643,-16.470152,0.000000,"Invalid" \n "Option"};
item15[] = {"Set_Weather",2,250,-211.722900,243.535065,-121.722931,293.535065,0.000000,"Set Weather"};
item16[] = {"Return",8,218,-211.614197,168.298981,-121.614273,218.298737,0.000000,"Return"};
item17[] = {"Set_Weather_1",2,250,106.104187,248.682190,196.104202,298.682190,0.000000,"Set Weather"};
item18[] = {"Return",8,218,106.772743,172.461502,196.772736,222.461502,0.000000,"Return"};
item19[] = {"PV_Delay",2,250,-328.769989,335.746979,-238.769974,385.746979,0.000000,"PV Delay"};
item20[] = {"Delay",4,218,-212.201813,335.746979,-122.201813,385.746979,0.000000,"Delay"};
item21[] = {"PV_Delay_1",2,4346,219.507141,333.036072,309.507141,383.036072,0.000000,"PV Delay"};
item22[] = {"Delay",4,218,107.005257,333.713837,197.005264,383.713837,0.000000,"Delay"};
link0[] = {0,1};
link1[] = {0,2};
link2[] = {0,14};
link3[] = {1,3};
link4[] = {2,4};
link5[] = {3,5};
link6[] = {3,10};
link7[] = {4,6};
link8[] = {4,11};
link9[] = {5,7};
link10[] = {6,8};
link11[] = {7,9};
link12[] = {8,12};
link13[] = {9,19};
link14[] = {10,13};
link15[] = {11,13};
link16[] = {12,21};
link17[] = {14,13};
link18[] = {15,16};
link19[] = {16,7};
link20[] = {17,18};
link21[] = {18,8};
link22[] = {19,20};
link23[] = {20,15};
link24[] = {21,22};
link25[] = {22,17};
globals[] = {0.000000,0,0,0,0,640,480,1,26,6316128,1,-441.001495,496.288025,744.435730,-164.875015,1178,910,1};
window[] = {2,-1,-1,-1,-1,785,26,1466,26,3,1196};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "dze_weather";
class States
{
/*%FSM<STATE "Init">*/
class Init
{
name = "Init";
init = /*%FSM<STATEINIT""">*/"_minChangeTime = DZE_WeatherVariables select 0;" \n
"_maxChangeTime = DZE_WeatherVariables select 1;" \n
"_minFog = DZE_WeatherVariables select 2;" \n
"_maxFog = DZE_WeatherVariables select 3;" \n
"_minOvercast = DZE_WeatherVariables select 4;" \n
"_maxOvercast = DZE_WeatherVariables select 5;" \n
"_minRain = DZE_WeatherVariables select 6;" \n
"_maxRain = DZE_WeatherVariables select 7;" \n
"_minWind = DZE_WeatherVariables select 8;" \n
"_maxWind = DZE_WeatherVariables select 9;" \n
"_windProb = DZE_WeatherVariables select 10;" \n
"_minSnow = DZE_WeatherVariables select 11;" \n
"_maxSnow = DZE_WeatherVariables select 12;" \n
"_blizzardProb = DZE_WeatherVariables select 13;" \n
"_blizzardInterval = DZE_WeatherVariables select 14;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Summer">*/
class Summer
{
priority = 0.000000;
to="Initial_Weather_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather in [1,2]"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Invalid_Option">*/
class Invalid_Option
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"!(DZE_Weather in [1,2,3,4])"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log ""Weather Error: invalid option for variable DZE_Weather!"";" \n
"" \n
"DZE_serverWeatherArray = [0, 0, 0, 0, 0, 0, ""none"", false];"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Winter">*/
class Winter
{
priority = 0.000000;
to="Initial_Weather";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather in [3,4]"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Initial_Weather">*/
class Initial_Weather
{
name = "Initial_Weather";
init = /*%FSM<STATEINIT""">*/"_fog = (_minFog + random (_maxFog - _minFog));" \n
"_overcast = (_minOvercast + random (_maxOvercast - _minOvercast));" \n
"_rain = 0;" \n
"_snow = 0;" \n
"_type = ""NONE"";" \n
"_blizzard = false;" \n
"" \n
"if (_overcast > .70) then {" \n
" _snow = (_minSnow + random (_maxSnow - _minSnow));" \n
" if (_blizzardProb > 0) then {_blizzard = (random 1 <= _blizzardProb);};" \n
"};" \n
"" \n
"_windX = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"_windY = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"" \n
"_changeTime = _minChangeTime * 60 + random ((_maxChangeTime - _minChangeTime) * 60);" \n
"if (_blizzard && {_blizzardInterval > 0}) then {_changeTime = _blizzardInterval * 60};" \n
"" \n
"// Populate the server's global array" \n
"PVDZE_SetWeather = [_overcast, _fog, _rain, _windX, _windY, _snow, _type, _blizzard];" \n
"" \n
"// Set weather parameters locally on the server - I'm not sure if this is necessary because weather is not synced in A2OA." \n
"0 setRain _rain;" \n
"0 setOvercast _overcast;" \n
"0 setFog _fog;" \n
"setWind [_windX, _windY, true];" \n
"" \n
"diag_log text format [""Weather Forecast: Overcast: %1, Fog: %2, Rain: %3, WindX: %4, WindY: %5, Snow: %6, Blizzard: %7, Change Time: %8"",_overcast,_fog,_rain,_windX,_windY,_snow,_blizzard,_changeTime];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Static">*/
class Static
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather == 3"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log ""Static Winter Weather Enabled"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Dynamic">*/
class Dynamic
{
priority = 0.000000;
to="Wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather == 4"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log ""Dynamic Winter Weather Starting"";" \n
"" \n
"_bypassOvercast = _minOvercast == _maxOvercast; // if values are the same then bypass." \n
"_bypassFog = _minFog == _maxFog; // if values are the same then bypass."/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Initial_Weather_1">*/
class Initial_Weather_1
{
name = "Initial_Weather_1";
init = /*%FSM<STATEINIT""">*/"_fog = (_minFog + random (_maxFog - _minFog));" \n
"_overcast = (_minOvercast + random (_maxOvercast - _minOvercast));" \n
"_rain = 0;" \n
"_snow = 0;" \n
"_type = ""NONE"";" \n
"_blizzard = false;" \n
"" \n
"if (_overcast > .70) then {" \n
" _rain = (_minRain + random (_maxRain - _minRain));" \n
"};" \n
"" \n
"_windX = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"_windY = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"" \n
"_changeTime = _minChangeTime * 60 + random ((_maxChangeTime - _minChangeTime) * 60);" \n
"" \n
"// Populate the server's global array" \n
"PVDZE_SetWeather = [_overcast, _fog, _rain, _windX, _windY, _snow, _type, _blizzard];" \n
"" \n
"// Set weather parameters locally on the server - I'm not sure if this is necessary because weather is not synced in A2OA." \n
"0 setRain _rain;" \n
"0 setOvercast _overcast;" \n
"0 setFog _fog;" \n
"setWind [_windX, _windY, true];" \n
"" \n
"diag_log text format [""Weather Forecast: Overcast: %1, Fog: %2, Rain: %3, WindX: %4, WindY: %5, Snow: %6, Blizzard: %7, Change Time: %8"",_overcast,_fog,_rain,_windX,_windY,_snow,_blizzard,_changeTime];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Static">*/
class Static
{
priority = 0.000000;
to="End";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather == 1"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log ""Static Summer Weather Enabled"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "Dynamic">*/
class Dynamic
{
priority = 0.000000;
to="Wait_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"DZE_Weather == 2" \n
""/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"diag_log ""Dynamic Summer Weather Starting"";" \n
"" \n
"_bypassOvercast = _minOvercast == _maxOvercast; // if values are the same then bypass." \n
"_bypassFog = _minFog == _maxFog; // if values are the same then bypass."/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Wait">*/
class Wait
{
name = "Wait";
init = /*%FSM<STATEINIT""">*/"_time = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Ready">*/
class Ready
{
priority = 0.000000;
to="PV_Delay";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _time) > _changeTime"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"DZE_WeatherEndThread = true; // Used to end existing rain, snow, and blizzard threads on the clients." \n
"publicVariable ""DZE_WeatherEndThread"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Wait_1">*/
class Wait_1
{
name = "Wait_1";
init = /*%FSM<STATEINIT""">*/"_time = diag_tickTime;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Ready">*/
class Ready
{
priority = 0.000000;
to="PV_Delay_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _time) > _changeTime"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"DZE_WeatherEndThread = true; // Used to end existing rain, snow, and blizzard threads on the clients." \n
"publicVariable ""DZE_WeatherEndThread"";"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "End">*/
class End
{
name = "End";
init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Set_Weather">*/
class Set_Weather
{
name = "Set_Weather";
init = /*%FSM<STATEINIT""">*/"diag_log ""DEBUG Weather: Setting Weather."";" \n
"" \n
"// Change one type, fog or overcast, per cycle." \n
"_type = call {" \n
" if (_bypassFog && !_bypassOvercast) exitWith {""OVERCAST""};" \n
" if (_bypassOvercast && !_bypassFog) exitWith {""FOG""};" \n
" // Select random type of weather to change if no bypass. Make overcast changes 75% of the time." \n
" [""FOG"",""OVERCAST""] select (random 1 < .75);" \n
"};" \n
"" \n
"if (_type == ""FOG"") then {" \n
" _fog = (_minFog + random (_maxFog - _minFog));" \n
"};" \n
"" \n
"if (_type == ""OVERCAST"") then {" \n
" _overcast = (_minOvercast + random (_maxOvercast - _minOvercast));" \n
" if (_overcast > 0.70) then {" \n
" _snow = (_minSnow + random (_maxSnow - _minSnow));" \n
" if (_blizzardProb > 0) then {_blizzard = (random 1 <= _blizzardProb);};" \n
" } else {" \n
" _snow = 0;" \n
" _blizzard = false;" \n
" };" \n
"};" \n
"" \n
"// On average every one fourth of weather changes, change wind too" \n
"if (random 1 < _windProb) then {" \n
" _windX = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
" _windY = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"};" \n
"" \n
"_changeTime = _minChangeTime * 60 + random ((_maxChangeTime - _minChangeTime) * 60);" \n
"if (_blizzard && {_blizzardInterval > 0}) then {_changeTime = _blizzardInterval * 60};" \n
"" \n
"// Set weather parameters on all clients" \n
"PVDZE_SetWeather = [_overcast, _fog, _rain, _windX, _windY, _snow, _type, _blizzard];" \n
"publicVariable ""PVDZE_SetWeather"";" \n
"" \n
"// Set weather parameters locally on the server - I'm not sure if this is necessary because weather is not synced in A2OA." \n
"0 setRain _rain;" \n
"0 setOvercast _overcast;" \n
"0 setFog _fog;" \n
"setWind [_windX, _windY, true];" \n
"" \n
"diag_log text format [""Weather Forecast: Overcast: %1, Fog: %2, Rain: %3, WindX: %4, WindY: %5, Snow: %6, Blizzard: %7, Change Time: %8"",_overcast,_fog,_rain,_windX,_windY,_snow,_blizzard,_changeTime];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Return">*/
class Return
{
priority = 0.000000;
to="Wait";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "Set_Weather_1">*/
class Set_Weather_1
{
name = "Set_Weather_1";
init = /*%FSM<STATEINIT""">*/"// Change one type, fog or overcast, per cycle." \n
"_type = call {" \n
" if (_bypassFog && !_bypassOvercast) exitWith {""OVERCAST""};" \n
" if (_bypassOvercast && !_bypassFog) exitWith {""FOG""};" \n
" // Select random type of weather to change if no bypass. Make overcast changes 75% of the time." \n
" [""FOG"",""OVERCAST""] select (random 1 < .75);" \n
"};" \n
"" \n
"if (_type == ""FOG"") then {" \n
" _fog = (_minFog + random (_maxFog - _minFog));" \n
"};" \n
"" \n
"if (_type == ""OVERCAST"") then {" \n
" _overcast = (_minOvercast + random (_maxOvercast - _minOvercast));" \n
" if (_overcast > 0.70) then {" \n
" _rain = (_minRain + random (_maxRain - _minRain));" \n
" } else {" \n
" _rain = 0;" \n
" };" \n
"};" \n
"" \n
"// On average every one fourth of weather changes, change wind too" \n
"if (random 1 < _windProb) then {" \n
" _windX = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
" _windY = [(_minWind + random (_maxWind - _minWind)),-(_minWind + random (_maxWind - _minWind))] select (random 1 < .50);" \n
"};" \n
"" \n
"_changeTime = _minChangeTime * 60 + random ((_maxChangeTime - _minChangeTime) * 60);" \n
"" \n
"// Set weather parameters on all clients" \n
"PVDZE_SetWeather = [_overcast, _fog, _rain, _windX, _windY, _snow, _type, _blizzard];" \n
"publicVariable ""PVDZE_SetWeather"";" \n
"" \n
"// Set weather parameters locally on the server - I'm not sure if this is necessary because weather is not synced in A2OA." \n
"0 setRain _rain;" \n
"0 setOvercast _overcast;" \n
"0 setFog _fog;" \n
"setWind [_windX, _windY, true];" \n
"" \n
"diag_log text format [""Weather Forecast: Overcast: %1, Fog: %2, Rain: %3, WindX: %4, WindY: %5, Snow: %6, Blizzard: %7, Change Time: %8"",_overcast,_fog,_rain,_windX,_windY,_snow,_blizzard,_changeTime];"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Return">*/
class Return
{
priority = 0.000000;
to="Wait_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "PV_Delay">*/
class PV_Delay
{
name = "PV_Delay";
init = /*%FSM<STATEINIT""">*/"_time = diag_tickTime;" \n
"" \n
"// Need to sleep the loop for 5 seconds to ensure that the clients have time to react to the PV"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Delay">*/
class Delay
{
priority = 0.000000;
to="Set_Weather";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _time) > 5"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "PV_Delay_1">*/
class PV_Delay_1
{
name = "PV_Delay_1";
init = /*%FSM<STATEINIT""">*/"_time = diag_tickTime;" \n
"" \n
"// Need to sleep the loop for 5 seconds to ensure that the clients have time to react to the PV"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "Delay">*/
class Delay
{
priority = 0.000000;
to="Set_Weather_1";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(diag_tickTime - _time) > 5"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="Init";
finalStates[] =
{
"End",
};
};
/*%FSM</COMPILE>*/