mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
MIssion Updates
Add allowed vehicle check and destroy option for missions, i.e. military crash site..
This commit is contained in:
parent
be2622abbc
commit
b033a852a1
@ -12,17 +12,19 @@
|
|||||||
Github:
|
Github:
|
||||||
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf
|
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_missions/EPOCH_Server_createObject.sqf
|
||||||
*/
|
*/
|
||||||
private ["_grp","_driver","_gunner","_commander","_crew","_missionVehList","_obj","_cfgPricing","_objClass","_vehicles","_backpacks","_weapons","_items","_magazines"];
|
private ["_grp","_driver","_gunner","_commander","_crew","_missionVehList","_obj","_cfgPricing","_objClass","_vehicles","_backpacks","_weapons","_items","_magazines","_vehAllowed"];
|
||||||
params ["_player",["_token","",[""]],["_objArr",[]],["_pos",[]],["_wepHolder",objNull],["_clearCargo",true],["_objSpc","CAN_COLLIDE"],["_driverType",""],["_gunnerType",""],["_commanderType",""],["_crewType",""]];
|
params ["_player",["_token","",[""]],["_objArr",[]],["_pos",[]],["_wepHolder",objNull],["_clearCargo",true],["_objSpc","CAN_COLLIDE"],["_driverType",""],["_gunnerType",""],["_commanderType",""],["_crewType",""],["_doDamage",false]];
|
||||||
|
|
||||||
if !([_player,_token]call EPOCH_server_getPToken) exitWith {};
|
if !([_player,_token]call EPOCH_server_getPToken) exitWith {};
|
||||||
|
if (typeName _objArr != "ARRAY")then{_objArr = [_objArr];};
|
||||||
if (count _objArr < 1) exitWith {};
|
if (count _objArr < 1) exitWith {};
|
||||||
|
|
||||||
diag_log format["Epoch: Server_CreateObject: %1 for %2",_objArr, name _player];
|
diag_log format["Epoch: Attempt Create Object: %1 for %2",_objArr, name _player];
|
||||||
|
|
||||||
_cfgPricing = 'CfgPricing' call EPOCH_returnConfig;
|
_cfgPricing = 'CfgPricing' call EPOCH_returnConfig;
|
||||||
_allowedVehicleListName = ["allowedVehiclesList","allowedVehiclesList_CUP"] select EPOCH_modCUPVehiclesEnabled;
|
_allowedVehicleListName = ["allowedVehiclesList","allowedVehiclesList_CUP"] select EPOCH_modCUPVehiclesEnabled;
|
||||||
_allowedVehiclesList = getArray(configFile >> "CfgEpoch" >> worldName >> _allowedVehicleListName);
|
_allowedVehiclesList = getArray(configFile >> "CfgEpoch" >> worldName >> _allowedVehicleListName);
|
||||||
|
//diag_log format ["DEBUG: Allowed Vehs: %1",_allowedVehiclesList];
|
||||||
_vehicles = [];
|
_vehicles = [];
|
||||||
_backpacks = [];
|
_backpacks = [];
|
||||||
_weapons = [];
|
_weapons = [];
|
||||||
@ -57,7 +59,7 @@ _pos set [2,0];
|
|||||||
//Magazines
|
//Magazines
|
||||||
if(isClass (configFile >> "CfgMagazines" >> _x))then{
|
if(isClass (configFile >> "CfgMagazines" >> _x))then{
|
||||||
|
|
||||||
diag_log format["Epoch: Server_CreateObject: %1 Magaxine Found",_x];
|
diag_log format["Epoch: Server_CreateObject: %1 Magazine Found",_x];
|
||||||
|
|
||||||
if("ItemCore" in ([configFile >> "CfgMagazines" >> _x, true] call BIS_fnc_returnParents))then{
|
if("ItemCore" in ([configFile >> "CfgMagazines" >> _x, true] call BIS_fnc_returnParents))then{
|
||||||
_items pushBack _x;
|
_items pushBack _x;
|
||||||
@ -73,25 +75,34 @@ _pos set [2,0];
|
|||||||
_backpacks pushBack _x;
|
_backpacks pushBack _x;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
diag_log format["Epoch: Server_CreateObject: Vehicle Found %1 - Allowed: %2",_x, _x in _allowedVehiclesList];
|
_vehAllowed = true;
|
||||||
|
|
||||||
//if(_x in _allowedVehiclesList)then{
|
//If not destroying vehcile then check if allowed
|
||||||
//Not working ?
|
if!(_doDamage)then{
|
||||||
|
_veh = _x;
|
||||||
|
_vehAllowed = false;
|
||||||
|
{
|
||||||
|
if (_veh in _x)then{_vehAllowed = true;};
|
||||||
|
} forEach _allowedVehiclesList;
|
||||||
|
};
|
||||||
|
|
||||||
_posOut = _pos;
|
|
||||||
|
|
||||||
if(_x isKindOf "CAR" || _x isKindOf "AIR")then{
|
if(_vehAllowed)then{
|
||||||
_pos = [position _player, 0, 250, 6, 0, 1000, 0] call BIS_fnc_findSafePos;
|
//If not destroying (mission object) then find safe position
|
||||||
_pos = _pos findEmptyPosition [1,75,_x];
|
if!(_doDamage)then{
|
||||||
};
|
if(_x isKindOf "CAR" || _x isKindOf "AIR")then{
|
||||||
|
_pos = [position _player, 0, 250, 6, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||||
|
_pos = _pos findEmptyPosition [1,75,_x];
|
||||||
|
};
|
||||||
|
|
||||||
if(_x isKindOf "SHIP")then{
|
if(_x isKindOf "SHIP")then{
|
||||||
_pos = [position _player, 0, EPOCH_dynamicVehicleArea, 10, 1, 1000, 0] call BIS_fnc_findSafePos;
|
_pos = [position _player, 0, EPOCH_dynamicVehicleArea, 10, 1, 1000, 0] call BIS_fnc_findSafePos;
|
||||||
_pos = _pos findEmptyPosition [1,75,_x];
|
_pos = _pos findEmptyPosition [1,75,_x];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_vehicles pushBack [_x,_pos];
|
||||||
};
|
};
|
||||||
|
|
||||||
_vehicles pushBack [_x,_pos];
|
|
||||||
//};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,7 +193,9 @@ if(count _vehicles > 0)then{
|
|||||||
};
|
};
|
||||||
_obj allowdamage true;
|
_obj allowdamage true;
|
||||||
|
|
||||||
|
if(_doDamage)then{_obj setDamage 1;};
|
||||||
|
|
||||||
}forEach _vehicles;
|
}forEach _vehicles;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user