Last active
June 2, 2016 20:47
-
-
Save bosoy/532385ee71878dabc53e2a35b532d022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Функция замены зданий на Черноруссии. | |
Автор: Dimon | |
Параметры: | |
0. | |
0 - полная замена домов на А3 дома | |
1 - микс | |
2 - депрессивные тона | |
по умолчанию - 0. | |
1. - точка старта замены домов. | |
обьект,маркер или координаты | |
по умолчанию - getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition") | |
2. - радиус замены домов | |
по умолчанию - 15000м | |
3. - откл/вкл моделирование обьектов | |
по умолчанию откл | |
4. - откл/вкл дамага обьектов | |
по умолчанию вкл | |
Примеры запуска в ините | |
[2,player,500,false,true] call compile preprocessFileLineNumbers "chernarusedit_v2.sqf"; | |
call compile preprocessFileLineNumbers "chernarusedit_v2.sqf"; | |
[0,[0,0,0],1500,nil,false] call compile preprocessFileLineNumbers "chernarusedit_v2.sqf"; | |
[1,"Mark_1",5000] call compile preprocessFileLineNumbers "chernarusedit_v2.sqf"; | |
[2] call compile preprocessFileLineNumbers "chernarusedit_v2.sqf"; | |
*/ | |
private ["_var", "_center", "_dist", "_sim", "_dam", "_FFA_CLOSEHOUSE", "_box", "_nBuilding", "_type", "_xx", "_house", "_hcenter", "_px", "_py"]; | |
if (!isServer) exitwith {}; | |
_var= if (!isnil "_this" && {count (_this) >0} && {!isnil {_this select 0}}) then {_this select 0}else{0}; | |
_center= if (!isnil "_this" && {count (_this) >1} && {!isnil {_this select 1}}) then {_this select 1}else{getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition")}; | |
if (!isnil "_this" && {!isnil {_this select 1}}) then{ if (_center isEqualTo []) then {_center} else {if (typeName _center == "") then {markerpos _center}else{getposasl _center};};}; | |
_dist= if (!isnil "_this" && {count (_this) >2} && {!isnil {_this select 2}}) then {_this select 2}else{15000}; | |
_sim= if (!isnil "_this" && {count (_this) >3} && {!isnil {_this select 3}}) then {_this select 3}else{false}; | |
_dam= if (!isnil "_this" && {count (_this) >4} && {!isnil {_this select 4}}) then {_this select 4}else{true}; | |
_FFA_CLOSEHOUSE=["Land_HouseV_1I1","Land_HouseV_1I2","Land_HouseV_2L","Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1", | |
"Land_houseV_2T1","Land_houseV_2T2","Land_HouseV_1T","Land_HouseV_2I","Land_HouseV_1I4","Land_HouseV_1I3","Land_HouseV_1L2","Land_HouseV2_03B","Land_HouseV2_03", | |
"Land_HouseV2_01A","Land_HouseV2_01B","Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05","Land_SS_hangar","Land_A_Office02","Land_A_Hospital", | |
"Land_Ind_Workshop01_03","Land_Ind_Pec_03b","Land_Ind_Pec_03a","Land_Ind_Pec_02","Land_Ind_SawMill"]; | |
_box = []; | |
call { | |
if (isnil "_var" || (!isnil "_var" && {_var == 0})) exitwith | |
{ | |
_box=[[["Land_HouseV_1I1","Land_HouseV_1I2"],["Land_i_Stone_Shed_V2_F","Land_i_Stone_Shed_V3_F"]], | |
[["Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1"],["Land_i_Stone_HouseBig_V2_F","Land_i_Stone_HouseBig_V3_F","Land_i_House_Small_01_V1_F","Land_i_House_Small_01_V2_F","Land_i_House_Small_01_V3_F"]], | |
[["Land_houseV_2T2"],["Land_i_House_Small_02_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]], | |
[["Land_houseV_2T1"],["Land_i_House_Small_02_V1_F","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]], | |
[["Land_HouseV_2L"],["Land_Sara_domek05"]], | |
[["Land_HouseV_2I","Land_HouseV_1I4","Land_HouseV_1I3","Land_HouseV_1L2"],["Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"]], | |
[["Land_HouseV_1T","Land_HouseV2_03B","Land_HouseV2_01A","Land_HouseV2_01B"],["Land_i_Stone_HouseSmall_V2_F","Land_i_Stone_HouseSmall_V2_F","Land_i_Shop_01_V1_F","Land_i_House_Big_02_V1_F","Land_i_House_Big_02_V2_F","Land_i_House_Big_02_V3_F"]], | |
[["Land_HouseV2_03"],["Land_i_Barracks_V2_F"]], | |
[["Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05"],["Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"]], | |
[["Land_A_Hospital","Land_A_Office02","Land_Ind_SawMill"],["Land_Offices_01_V1_F"]], | |
[["Land_Ind_Workshop01_03"],["Land_Ind_Workshop01_04"]], | |
[[ "Land_Ind_Pec_03b","Land_Ind_Pec_02","Land_Ind_Pec_03a"],["Land_Offices_01_V1_F"]]]; | |
}; | |
if (!isnil "_var" && {_var == 1}) exitwith | |
{ | |
_box=[[["Land_HouseV_1I1","Land_HouseV_1I2"],["Land_deutshe_mini","Land_i_Stone_Shed_V2_F","Land_i_Stone_Shed_V3_F", "Land_dum_rasovna" ,"Land_hruzdum"]], | |
[["Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1"],["Land_cihlovej_dum_in","Land_hruzdum","Land_Sara_domek05","Land_sara_Domek_sedy","Land_i_Stone_HouseBig_V2_F","Land_i_Stone_HouseBig_V3_F","Land_dum_mesto_in","Land_i_House_Small_01_V1_F","Land_i_House_Small_01_V2_F","Land_i_House_Small_01_V3_F"]], | |
[["Land_houseV_2T2"],["Land_i_House_Small_02_V1_F","Land_i_Shop_02_V1_F","Land_i_Shop_02_V2_F","Land_i_Shop_02_V3_F","Land_sara_domek_zluty","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]], | |
[["Land_houseV_2T1"],["Land_i_House_Small_02_V1_F","Land_i_House_Small_02_V2_F","Land_i_House_Small_02_V3_F"]], | |
[["Land_HouseV_2L"],["Land_Sara_domek05"]], | |
[["Land_HouseV_2I","Land_HouseV_1I4","Land_HouseV_1I3","Land_HouseV_1L2"],["Land_dum_mesto2","Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"]], | |
[["Land_HouseV_1T","Land_HouseV2_03B","Land_HouseV2_01A","Land_HouseV2_01B"],["Land_dum_mesto_in","Land_afbarabizna","Land_dum_mesto_in","Land_i_Stone_HouseSmall_V2_F","Land_i_Stone_HouseSmall_V2_F","Land_i_Shop_01_V1_F","Land_i_House_Big_02_V1_F","Land_i_House_Big_02_V2_F","Land_i_House_Big_02_V3_F"]], | |
[["Land_HouseV2_03"],["Land_i_Barracks_V2_F"]], | |
[["Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05"],["Land_Hospoda_mesto","Land_i_House_Big_01_V1_F","Land_i_House_Big_01_V2_F","Land_i_House_Big_01_V3_F"]], | |
[["Land_A_Hospital","Land_A_Office02","Land_Ind_SawMill"],["Land_Offices_01_V1_F"]], | |
[["Land_Ind_Workshop01_03"],["Land_Ind_Workshop01_04"]], | |
[[ "Land_Ind_Pec_03b","Land_Ind_Pec_02","Land_Ind_Pec_03a"],["Land_Offices_01_V1_F"]]]; | |
}; | |
if (!isnil "_var" && {_var == 2}) exitwith | |
{ | |
_box=[[["Land_HouseV_1I1","Land_HouseV_1I2"],["Land_deutshe_mini","Land_i_Stone_Shed_V1_F", "Land_dum_rasovna" ,"Land_hruzdum"]], | |
[["Land_HouseV_3I3","Land_HouseV_3I1","Land_HouseV_3I4","Land_HouseV_3I2","Land_HouseV_1L1"],["Land_cihlovej_dum_in","Land_hruzdum","Land_Sara_domek05","Land_sara_Domek_sedy","Land_i_Stone_HouseBig_V1_F","Land_dum_mesto_in"]], | |
[["Land_houseV_2T2"],["Land_u_House_Small_02_V1_F","Land_u_Shop_02_V1_F","Land_sara_domek_zluty"]], | |
[["Land_houseV_2T1"],["Land_u_House_Small_02_V1_F"]], | |
[["Land_HouseV_2L"],["Land_Sara_domek05"]], | |
[["Land_HouseV_2I","Land_HouseV_1I3","Land_HouseV_1L2"],["Land_dum_mesto2","Land_u_House_Big_01_V1_F","Land_Unfinished_Building_02_F"]], | |
[["Land_HouseV_1I4"],["Land_Unfinished_Building_01_F"]], | |
[["Land_HouseV_1T","Land_HouseV2_03B","Land_HouseV2_01A","Land_HouseV2_01B"],["Land_dum_mesto_in","Land_afbarabizna","Land_dum_mesto_in","Land_i_Stone_HouseSmall_V1_F","Land_u_Shop_01_V1_F","Land_u_House_Big_02_V1_F"]], | |
[["Land_HouseV2_03"],["Land_i_Barracks_V1_F"]], | |
[["Land_HouseV2_02_Interier","Land_HouseV2_04_interier","Land_HouseV2_05"],["Land_Hospoda_mesto","Land_u_House_Big_01_V1_F","Land_Unfinished_Building_02_F"]], | |
[["Land_A_Hospital","Land_A_Office02","Land_Ind_SawMill"],["Land_Offices_01_V1_F"]], | |
[["Land_Ind_Workshop01_03"],["Land_Ind_Workshop01_04"]], | |
[[ "Land_Ind_Pec_03b","Land_Ind_Pec_02","Land_Ind_Pec_03a"],["Land_Offices_01_V1_F"]]]; | |
}; | |
}; | |
{ | |
if ((typeof _x) in _FFA_CLOSEHOUSE) then | |
{ | |
_nBuilding =_x; | |
_center = boundingCenter _nBuilding; | |
_pos = getPosWorld _nBuilding; | |
call { | |
if ((typeof _nBuilding) =="Land_Ind_Pec_03a") exitwith { _pos set [0,(_pos select 0)-2]; _pos set [1,(_pos select 1)-4];}; | |
if ((typeof _nBuilding) =="Land_Ind_Pec_02") exitwith { _pos set [0,(_pos select 0)-7];}; | |
}; | |
_pos set [2,0]; | |
_nBuilding hideObjectGlobal true; | |
_type=""; | |
{ | |
_xx=_x; | |
if ((typeof _nBuilding) in (_xx select 0)) exitwith {_type=(_xx select 1) select (floor random (count (_xx select 1)));}; | |
} foreach _box; | |
_house = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; | |
_hcenter = boundingCenter _house; | |
_house setdir (getdir _nBuilding); | |
_px= (_hcenter select 0) - (_center select 0); | |
_py= (_hcenter select 1) - (_center select 1); | |
if ((typeof _house) !="Land_Offices_01_V1_F") then { | |
_house setposatl [((getposatl _house)select 0) - _px,((getposatl _house) select 1) - _py,(getposatl _house) select 2]; | |
}; | |
call { | |
if ((typeof _house) in ((_box select 4) select 1) && ((typeof _nBuilding) in ((_box select 4) select 0))) exitwith {_house setdir ((getdir _nBuilding)-90);}; | |
if ((typeof _house) in ((_box select ((count _box)-1)) select 1) && ((typeof _nBuilding) in ((_box select ((count _box)-1)) select 0))) exitwith {_house setdir ((getdir _nBuilding)+90);}; | |
if ((typeof _house) =="Land_i_Shop_01_V1_F") exitwith {_house setdir ((getdir _nBuilding)-90);}; | |
}; | |
call compile format ["_house enableSimulationGlobal %1",_sim]; | |
call compile format ["_house allowDamage %1",_dam]; | |
}; | |
} foreach (_center nearObjects ["House", _dist]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment