Last active
June 5, 2016 05:34
-
-
Save bosoy/048445dabd1b33bcefb65058ebe7d6e3 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
/* | |
chernarusedit_3v | |
Функция замены зданий на Черноруссии. | |
Автор: Dimon | |
Параметры: | |
0. | |
0 - полная замена домов на А3 дома | |
1 - микс | |
2 - депрессивные тона | |
по умолчанию - 0. | |
1. - точка старта замены домов. | |
обьект,маркер или координаты | |
по умолчанию - getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition") | |
2. - радиус замены домов | |
по умолчанию - 15000м | |
3. - true/false - откл/вкл дамага обьектов | |
по умолчанию вкл | |
4. - true/false - откл/вкл локальные обьекты | |
по умолчанию выкл | |
5. - index субмассива локальных обьектов | |
требуется только при вкл 4 | |
Примеры запуска в ините | |
[2,player,500,false,true,2] call compile preprocessFileLineNumbers "chernarusedit_2v.sqf"; | |
call compile preprocessFileLineNumbers "chernarusedit_2v.sqf"; | |
[0,[0,0,0],1500,nil,false] call compile preprocessFileLineNumbers "chernarusedit_2v.sqf"; | |
[1,"Mark_1",5000] call compile preprocessFileLineNumbers "chernarusedit_2v.sqf"; | |
[2] call compile preprocessFileLineNumbers "chernarusedit_2v.sqf"; | |
*/ | |
private ["_var", "_center", "_dist", "_dam", "_local", "_index", "_FFA_CLOSEHOUSE", "_vm", "_box", "_nBuilding", "_type", "_xx", "_house", "_hcenter", "_px", "_py"]; | |
_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}; | |
_dam= if (!isnil "_this" && {count (_this) >3} && {!isnil {_this select 3}}) then {_this select 3}else{true}; | |
_local = if (!isnil "_this" && {count (_this) >4} && {!isnil {_this select 4}}) then {_this select 4}else{false}; | |
_index = if (!isnil "_this" && {count (_this) >5} && {!isnil {_this select 5}}) then {_this select 5}else{0}; | |
_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"]; | |
if (_local && {isServer}) then {{if ((typeof _x) in _FFA_CLOSEHOUSE) then {_x hideObjectGlobal true;};} foreach (_center nearObjects ["House", _dist]);}; | |
_vm = if _local then {hasInterface}else{isserver}; | |
if (call compile format [" %1",_vm]) then | |
{ | |
_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; | |
if (!_local) then {_nBuilding hideObjectGlobal true;}; | |
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]; | |
_type=""; | |
{ | |
_xx=_x; | |
if ((typeof _nBuilding) in (_xx select 0)) exitwith | |
{ | |
call { | |
if (!_local) exitwith {_type=(_xx select 1) select (floor random (count (_xx select 1)));}; | |
if (_local && {_index >= count (_xx select 1)}) exitwith {_type = (_xx select 1) select (count (_xx select 1)-1);}; | |
if (_local && {_index < count (_xx select 1)}) exitwith {_type = (_xx select 1) select _index;}; | |
}; | |
}; | |
} foreach _box; | |
if _local then | |
{ | |
_house =_type createVehicleLocal _pos; | |
}else{ | |
_house =_type createVehicle _pos; | |
}; | |
_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 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