44 lines
1022 B
Plaintext
44 lines
1022 B
Plaintext
|
/*
|
||
|
Author: Djeeberjr
|
||
|
|
||
|
Description:
|
||
|
Buildable barricade. If there is a object synced to it, it will use this as the "controller".
|
||
|
|
||
|
Parameter(s):
|
||
|
0: OBJECT - the barricade
|
||
|
1: STRING - barrcade group
|
||
|
2: NUMBER - cost
|
||
|
*/
|
||
|
|
||
|
params ["_obj","_group","_cost"];
|
||
|
|
||
|
_ctl = objNull;
|
||
|
if ((count synchronizedObjects _obj) == 1)then{
|
||
|
_ctl = (synchronizedObjects _obj) # 0;
|
||
|
}else{
|
||
|
//Create controller
|
||
|
_ctl = createVehicle ["Marker_Use_ACR", position _obj, [], 0, "CAN_COLLIDE"];
|
||
|
_ctl setVectorDirAndUp [vectorDir _obj, vectorUp _obj];
|
||
|
};
|
||
|
|
||
|
dbg = synchronizedObjects _obj;
|
||
|
|
||
|
//create action
|
||
|
_action = _ctl addAction ["Build barricade",{
|
||
|
params ["_target", "_caller", "_actionId", "_arguments"];
|
||
|
_obj = _arguments # 0;
|
||
|
_group = _arguments #1;
|
||
|
_cost = _arguments #2;
|
||
|
|
||
|
_target removeAction _actionId; //TODO: remoteExec
|
||
|
|
||
|
_obj hideObjectGlobal false;
|
||
|
|
||
|
deleteVehicle _target;
|
||
|
|
||
|
},[_obj,_group,_cost],2.5,true,true,"","true",2];
|
||
|
|
||
|
//Hide it
|
||
|
_obj hideObjectGlobal true;
|
||
|
_obj setVariable ["DLib_barricade",[_group,_cost,_action]];
|