commit 593a971b19752459e12a64ccf8794a467454f195 Author: Niklas Date: Wed Jan 15 19:18:38 2020 +0100 initial commit diff --git a/functions/Arsenal/fn_addFullArsenal.sqf b/functions/Arsenal/fn_addFullArsenal.sqf new file mode 100644 index 0000000..8782b97 --- /dev/null +++ b/functions/Arsenal/fn_addFullArsenal.sqf @@ -0,0 +1,28 @@ +/* + Author: Djeeberjr + + Description: + Enables a full Arsenal on a object + + Effect: local + + Parameter(s): + 0: OBJECT - the object of the arsenal +*/ +params ["_obj"]; + +//Check if the is already an arsenal on it +if( isNull (_obj getVariable ["DLib_arsenal",objNull]))then{ + + _bisArsenal = _obj addAction ["BIS Arsenal",{ + [ "Open", [ true ] ] call BIS_fnc_arsenal; + },[],1.5,true,true,"","true",5]; + + _obj setvariable ["DLib_arsenal",_bisArsenal]; + + if (isClass(configFile >> "CfgPatches" >> "ace_main")) then { + [_obj, true] call ace_arsenal_fnc_initBox; + }; + + +}; diff --git a/functions/Arsenal/fn_removeFullArsenal.sqf b/functions/Arsenal/fn_removeFullArsenal.sqf new file mode 100644 index 0000000..bb70e3c --- /dev/null +++ b/functions/Arsenal/fn_removeFullArsenal.sqf @@ -0,0 +1,27 @@ +/* + Author: Djeeberjr + + Description: + Disables a full Arsenal on a object + + Effect: local + + Parameter(s): + 0: OBJECT - the object of the arsenal +*/ + +params ["_obj"]; + +//Check if the arsenal is already removes +if(typeName (_obj getVariable ["DLib_arsenal",objNull]) == "SCALAR")then{ + + _obj removeAction (_obj getVariable "DLib_arsenal"); + + if (isClass(configFile >> "CfgPatches" >> "ace_main")) then { + [_obj, true] call ace_arsenal_fnc_removeBox; + }; + + // Remove arsenal actionId + _obj setVariable ["DLib_arsenal",objNull]; + +}; diff --git a/functions/Barricade/fn_barricade.sqf b/functions/Barricade/fn_barricade.sqf new file mode 100644 index 0000000..30b2a33 --- /dev/null +++ b/functions/Barricade/fn_barricade.sqf @@ -0,0 +1,43 @@ +/* + 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]]; diff --git a/functions/Barricade/fn_disableBarricade.sqf b/functions/Barricade/fn_disableBarricade.sqf new file mode 100644 index 0000000..e69de29 diff --git a/functions/Barricade/fn_enableBarricade.sqf b/functions/Barricade/fn_enableBarricade.sqf new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/functions/Barricade/fn_enableBarricade.sqf @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/functions/Base/fn_missionPostInit.sqf b/functions/Base/fn_missionPostInit.sqf new file mode 100644 index 0000000..305b7c4 --- /dev/null +++ b/functions/Base/fn_missionPostInit.sqf @@ -0,0 +1,16 @@ +/* + Author: Djeeberjr + + Description: + Initialize stuff AFTER object initialization. + +*/ + +DLib_isInit = true; + + +if(not isNil "DLib_post_calls") then{ + { + (_x select 0) call (_x select 1); + }forEach DLib_post_calls; +}; diff --git a/functions/Base/fn_missionPreInit.sqf b/functions/Base/fn_missionPreInit.sqf new file mode 100644 index 0000000..58d6bfe --- /dev/null +++ b/functions/Base/fn_missionPreInit.sqf @@ -0,0 +1,8 @@ +/* + Author: Djeeberjr + + Description: + Initialize stuff BEFOR object initialization. + +*/ +DLib_isInit = false; diff --git a/functions/Interactables/fn_addVoiceLine.sqf b/functions/Interactables/fn_addVoiceLine.sqf new file mode 100644 index 0000000..2819b1c --- /dev/null +++ b/functions/Interactables/fn_addVoiceLine.sqf @@ -0,0 +1,26 @@ +/* + Author: Djeeberjr + + Description: + Init a zeus player. + + Parameter(s): + 0: OBJECT - the unit + 1: STRING - Conversation to play (.bikb) + 2 (optonal) : CODE - code called when started (local to caller) + https://community.bistudio.com/wiki/kbAddTopic for the eventhandler +*/ + +params ["_unit","_voiceline","_cb"]; + +//TODO: img locationPosition +_unit addAction ["",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + _voiceline = _arguments select 0; + _cb = _arguments select 1; + + [_target,"npc_talk","conversations.bikb","",_cb] remoteExec ["kbAddTopic"]; + [_target,_caller,"npc_talk",_voiceline,"DIRECT"] remoteExec ["kbTell"]; + [_target,_actionId] remoteExec ["removeAction"]; + +},[_voiceline,_cb],true,true,"","true",3]; \ No newline at end of file diff --git a/functions/Interactables/fn_createTeleporter.sqf b/functions/Interactables/fn_createTeleporter.sqf new file mode 100644 index 0000000..8aee976 --- /dev/null +++ b/functions/Interactables/fn_createTeleporter.sqf @@ -0,0 +1,56 @@ +/* + Author: Djeeberjr + + Description: + Makes object a teleporter + + Effect: Local + + Parameter(s): + 0: OBJECT - the gamelogic + 1 (optional): STRING - Teleport name +*/ + +params ["_gl",["_name",""]]; + +if(_name == "")then{ + _name = (getPos _gl) call BIS_fnc_locationDescription; +}; + +_pushArray = [ + getPos _gl, //Pos + DLib_fnc_teleporterCallback, //code + _name, //name + "", //description + "", //mission's player ??? + "", //Path to overview image + 1, //Size multiplier for overview image + [_gl] //Params +]; + +if(isNil "DLIB_teleport")then{ + DLIB_teleport = [_pushArray]; +}else{ + DLIB_teleport pushBack _pushArray; +}; + +{ + + _x addAction ["Open map",{ + params ['_target', '_caller', '_actionId', '_arguments']; + [ + findDisplay 46, + getPos _target, + DLIB_teleport, + [], + [], + [], + 0, + false, + 1, + false, + "Teleport to location" + ] call BIS_fnc_StrategicMapOpen; + },[],5,true,true,"","true",5]; + +} forEach (synchronizedObjects _gl); diff --git a/functions/Interactables/fn_makeAiDoctor.sqf b/functions/Interactables/fn_makeAiDoctor.sqf new file mode 100644 index 0000000..4442cf9 --- /dev/null +++ b/functions/Interactables/fn_makeAiDoctor.sqf @@ -0,0 +1,28 @@ +/* + Author: Djeeberjr + + Description: + Makes an ai a Medic so injured players can heal themself a the base. + + Parameter(s): + 0: OBJECT - the ai unit +*/ + +params ["_self"]; + +_self setUnitTrait ["medic",1]; +//TODO: make unit ace3 doctor + +_self addAction ["Rrequest medical attention",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + + //TODO: heal player + //[objNull, player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal; + //ace_medical_level + //https://github.com/acemod/ACE3/tree/master/addons/medical/functions + //http://www.armaholic.com/forums.php?m=posts&q=35327 + + +},nil,1.5,true,true,"","true",2]; + + diff --git a/functions/Interactables/fn_makeCram.sqf b/functions/Interactables/fn_makeCram.sqf new file mode 100644 index 0000000..c75a83a --- /dev/null +++ b/functions/Interactables/fn_makeCram.sqf @@ -0,0 +1,91 @@ +/* + Author: Djeeberjr + + Description: + Set up a C-RAM defence system + + Parameter(s): + 0: OBJECT - The C-RAM. must be "B_AAA_System_01_F" + 1: NUMBER - the radius + + Returns: + Script Handle - for the main loop +*/ +params ["_self","_radius"]; + +{_self removeWeapon _x} forEach weapons _self; +_self addWeapon "Gatling_30mm_Plane_CAS_01_F"; +_self addMagazine "1000Rnd_Gatling_30mm_Plane_CAS_01_F"; +_self disableAI "TARGET"; +_self disableAI "AUTOTARGET"; + + +//start loop (see https://forums.bohemia.net/forums/topic/215598-release-c-ram-script/) +_handle = [_self,_radius,_guns] spawn { + params ["_self","_radius","_guns"]; + + _incoming = []; + _isEngaging = false; + + while {true} do { + sleep 1; + + _incoming = _incoming + ((getPos _self) nearObjects ["MissileBase",_radius]); + _incoming = _incoming + ((getPos _self) nearObjects ["RocketBase",_radius]); + _incoming = _incoming + ((getPos _self) nearObjects ["ShellBase",_radius]); + + if(count _incoming > 0)then{ + if(not _isEngaging)then{ + _self say3D ["DLib_idf",1000]; + }; + + _incomingRound = _incoming select 0; + _isEngaging = true; + _fromTarget = _incomingRound getDir _self; + _targetDir = direction _incomingRound; + + _roundChanche = 100; + //Start shooting + + + while {alive _incomingRound && (getPosATL _incomingRound select 2) > 50}do{ + _target = "Land_HelipadEmpty_F" createVehicle [0,0,0]; + _leadPrediction = (((_self distance _incomingRound) / 4032) * (speed _incomingRound)) / (_self distance _incomingRound); + _zeroing = ((_self distance _incomingRound) / 100) * 8; + _target attachTo [_incomingRound,[0,_leadPrediction,_zeroing]]; + _self doWatch _target; + + if(alive _incomingRound)then{ + if(_roundChanche == 100)then{ + sleep 2; + }; + _self fire "Gatling_30mm_Plane_CAS_01_F"; + }; + + sleep 0.5; + deleteVehicle _target; + + if(alive _incomingRound)then{ + _roundChanche = _roundChanche - random[0,25,100]; + + if(_roundChanche <= 0)then{ + "helicopterexplosmall" createVehicle getPos _incomingRound; + deleteVehicle _incomingRound; + }; + }; + }; + + _incoming deleteAt 0; + }else{ + if(_isEngaging)then{ + _isEngaging = false; + //No more targets + }; + }; + + }; +}; + +_handle; + + diff --git a/functions/Interactables/fn_mannequin.sqf b/functions/Interactables/fn_mannequin.sqf new file mode 100644 index 0000000..e69de29 diff --git a/functions/Interactables/fn_readNews.sqf b/functions/Interactables/fn_readNews.sqf new file mode 100644 index 0000000..653a748 --- /dev/null +++ b/functions/Interactables/fn_readNews.sqf @@ -0,0 +1,23 @@ +/* + Author: Djeeberjr + + Description: + Adds an action to read a AAN news report. See https://community.bistudio.com/wiki/BIS_fnc_showAANArticle + + Parameter(s): + 0: OBJECT - to add the action to + 1: ARRAY - The article + + Returns: + actionID +*/ + +params ["_obj","_acticle"]; + +_obj setObjectTextureGlobal [0,"DLib\res\AAN.paa"]; +_obj addAction ["Read news",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + [_arguments] call bis_fnc_showAANArticle; + +},_acticle,6,true,true,"","true",2]; + diff --git a/functions/Interactables/fn_teleporterCallback.sqf b/functions/Interactables/fn_teleporterCallback.sqf new file mode 100644 index 0000000..b6bde3e --- /dev/null +++ b/functions/Interactables/fn_teleporterCallback.sqf @@ -0,0 +1,2 @@ +_gl = (_this#9)#0; +player setPosATL (getPosATL _gl); \ No newline at end of file diff --git a/functions/Orbat/fn_createTactialMission.sqf b/functions/Orbat/fn_createTactialMission.sqf new file mode 100644 index 0000000..09ce670 --- /dev/null +++ b/functions/Orbat/fn_createTactialMission.sqf @@ -0,0 +1,18 @@ +/* + Author: Djeeberjr + + Description: + Makes a object a tactial terminal to access orbat and tactial map. See https://community.bistudio.com/wiki/BIS_fnc_StrategicMapOpen + + Parameters: + 0 OBJECT or ARRAY: a gamelogic or a position (used for position) + 1 CODE: Expression executed when user clicks on mission icon + 2 STRING: Mission name + 3 STRING: Short description + 4 STRING: Name of mission's player + 5 PATH: Path to overview image + 6 NUMBER: Size multiplier for overview image + 7 ARRAY: Parameters for on-click action. Can be accessed in code with _this # 9 + +*/ + diff --git a/functions/Orbat/fn_makeTacticalTerminal.sqf b/functions/Orbat/fn_makeTacticalTerminal.sqf new file mode 100644 index 0000000..eac1b73 --- /dev/null +++ b/functions/Orbat/fn_makeTacticalTerminal.sqf @@ -0,0 +1,55 @@ +/* + Author: Djeeberjr + + Description: + Makes a object a tactial terminal to access orbat and tactial map. + + Parameter(s): + 0: OBJECT - the unit + +*/ + +params ["_obj"]; + +_obj addAction ["Open tactical map",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + + [ + findDisplay 46, + getPos _target, + DLib_orbat_missions, + [ + [ + [3000,3000,0], + configFile >> "CfgORBAT" >> "BIS" >> "B_1_A_1_2", + configFile >> "CfgORBAT" >> "BIS" >> "B_1", + [], + 10 + ] + ], + [ + + ], + [ + [ + "\A3\Ui_f\data\Logos\arma3_white_ca.paa", + [0,0,0,1], + [4000,4000,0], + 8, + 8, + 0, + "Arma 3 Logo", + true + ] + ], + 0, + false, + 1, + true, + "Strategic Map Example", + false, + "\A3\Ui_f\data\Logos\arma3_white_ca.paa" + ] call BIS_fnc_StrategicMapOpen; + +},[],5,true,true,"","true",2]; + diff --git a/functions/PlaneJump/fn_pj_closeRamp.sqf b/functions/PlaneJump/fn_pj_closeRamp.sqf new file mode 100644 index 0000000..02fbbd5 --- /dev/null +++ b/functions/PlaneJump/fn_pj_closeRamp.sqf @@ -0,0 +1,17 @@ +/* + Author: Djeeberjr + + Description: + Closes the cargo door of the plane + + Parameter(s): + 0: OBJECT - the main gamelogic +*/ +params ["_gl"]; + +_plane = _gl getVariable "DLib_pj_plane"; + +playSound3D ["cup\airvehicles\cup_airvehicles_ch53e\data\sfx\Heli_CH53_ramp.wss",_plane,false,AGLToASL (_plane modelToWorld [0,4,-3.8])]; + +_plane animate ["ramp_bottom",0]; +_plane animate ["ramp_top",0]; diff --git a/functions/PlaneJump/fn_pj_greenLight.sqf b/functions/PlaneJump/fn_pj_greenLight.sqf new file mode 100644 index 0000000..012bed6 --- /dev/null +++ b/functions/PlaneJump/fn_pj_greenLight.sqf @@ -0,0 +1,20 @@ +/* + Author: Djeeberjr + + Description: + Turns the light green inside of the plane + + Parameter(s): + 0: OBJECT - the main gamelogic +*/ +params ["_gl"]; + +_lightSource = _gl getVariable "DLib_pj_lightSource"; +_redLight = _gl getVariable "DLib_pj_redLight"; +_greenLight = _gl getVariable "DLib_pj_greenLight"; + +_lightsource setLightAmbient [0.0, 1.0, 0.0]; +_lightsource setLightColor [0.0, 1.0, 0.0]; + +_greenLight setObjectMaterial [0,"a3\data_f\lights\building_landinglights_green.rvmat"]; +_redLight setObjectMaterial [0,"a3\structures_f_heli\items\airport\data\portablehelipadlight_01.rvmat"]; \ No newline at end of file diff --git a/functions/PlaneJump/fn_pj_init.sqf b/functions/PlaneJump/fn_pj_init.sqf new file mode 100644 index 0000000..5ee67af --- /dev/null +++ b/functions/PlaneJump/fn_pj_init.sqf @@ -0,0 +1,68 @@ +/* + Author: Djeeberjr + + Description: + Inits a plane to be ready to use + + Parameter(s): + 0: OBJECT - the main gamelogic + 1: SCALAR - the hight of the plane +*/ +params ["_gl","_hight"]; + +// Get synced objects +_trigger = ([_gl,"myPlanetNeedsMe"] call Dlib_fnc_getSyncTypeTrigger)#0; +_greenLight = ([_gl,"PortableHelipadLight_01_green_F"] call DLib_fnc_getSyncClass)#0; +_redLight = ([_gl,"PortableHelipadLight_01_red_F"] call DLib_fnc_getSyncClass)#0; +_spawn = ([_gl,"spawn"] call DLib_fnc_getSyncType)#0#0; +_plane = ([_gl,"C130J_static_EP1"] call DLib_fnc_getSyncClass)#0; + +// Attach light to plane +[_greenLight,_plane] call DLIB_fnc_attachToRelative; +[_redLight,_plane] call DLIB_fnc_attachToRelative; + +// Move all the stuff up into the air +_plane setPos ((getPos _plane) vectorAdd [0,0,_hight]); +_spawn setPos ((getPos _spawn) vectorAdd [0,0,_hight]); +_trigger setPos ((getPos _trigger) vectorAdd [0,0,_hight]); + +// create sound source +_soundSources = []; +{ + _soundSources pushBack (createSoundSource ["DLIB_pj_planeLoop", (getpos (_x#0)) vectorAdd [0,0,_hight] , [], 0]); +} forEach ([_gl,"soundSource"] call DLib_fnc_getSyncType); + +// Setup trigger +_trigger setTriggerStatements ["this"," + { + _x setVelocity "+ str (vectorDir _plane vectorMultiply 50) + "; + } forEach thisList; + resetCamShake; +",""]; + +// setup lights +_greenLight setDamage 1; +_redLight setDamage 1; + +// _greenLight setObjectMaterial [0,"a3\structures_f_heli\items\airport\data\portablehelipadlight_01.rvmat"]; +_redLight setObjectMaterial [0,"a3\data_f\lights\building_landinglights_green.rvmat"]; + +// Create light source + +_lightsource = "#lightpoint" createVehicleLocal (getPos _redLight); +_lightsource setLightBrightness 0.2; +_lightsource setLightAmbient [1.0, 0.0, 0.0]; +_lightsource setLightColor [1.0, 0.0, 0.0]; +_lightsource lightAttachObject [_redLight, [0,0,0]]; + +// Save objects in gl +_gl setVariable ["DLib_pj_trigger",_trigger]; +_gl setVariable ["DLib_pj_greenLight",_greenLight]; +_gl setVariable ["DLib_pj_redLight",_redLight]; +_gl setVariable ["DLib_pj_spawn",_spawn]; +_gl setVariable ["DLib_pj_plane",_plane]; +_gl setVariable ["DLib_pj_lightSource",_lightSource]; +_gl setVariable ["DLib_pj_soundSource",_soundSources]; + + + diff --git a/functions/PlaneJump/fn_pj_initPlayer.sqf b/functions/PlaneJump/fn_pj_initPlayer.sqf new file mode 100644 index 0000000..f1199e7 --- /dev/null +++ b/functions/PlaneJump/fn_pj_initPlayer.sqf @@ -0,0 +1,28 @@ +/* + Author: Djeeberjr + + Description: + Prepares a player to jump + + Parameter(s): + 0: OBJECT - the unit + 1: OBJECT - the main gamelogic +*/ + +params ["_unit","_planeGl"]; + +_spawn = _planeGl getVariable "DLib_pj_spawn"; +_unit setPosATL (getPosATL _spawn); +_unit playAction "PlayerStand"; +enableCamShake true; +addCamShake [2, 9999, 4]; + +// Prevent player from opeing the cargo door +inGameUISetEventHandler ["Action", " + params ['_attachedObj','_caller','_index','_actionName','_localized','_priority','_showWindow','_hideOnUse','_shortcut','_visable','_ehName']; + if (typeOf _attachedObj isEqualTo 'C130J_static_EP1')then{ + true; + } +"]; + +[_unit] spawn DLib_fnc_playerParaBackpack; diff --git a/functions/PlaneJump/fn_pj_openRamp.sqf b/functions/PlaneJump/fn_pj_openRamp.sqf new file mode 100644 index 0000000..a49bf79 --- /dev/null +++ b/functions/PlaneJump/fn_pj_openRamp.sqf @@ -0,0 +1,17 @@ +/* + Author: Djeeberjr + + Description: + Opens the cargo door of the plane + + Parameter(s): + 0: OBJECT - the main gamelogic +*/ +params ["_gl"]; + +_plane = _gl getVariable "DLib_pj_plane"; + +playSound3D ["cup\airvehicles\cup_airvehicles_ch53e\data\sfx\Heli_CH53_ramp.wss",_plane,false,AGLToASL (_plane modelToWorld [0,4,-3.8])]; + +_plane animate ["ramp_bottom",1]; +_plane animate ["ramp_top",1]; diff --git a/functions/PlaneJump/fn_pj_redLight.sqf b/functions/PlaneJump/fn_pj_redLight.sqf new file mode 100644 index 0000000..7bf289c --- /dev/null +++ b/functions/PlaneJump/fn_pj_redLight.sqf @@ -0,0 +1,20 @@ +/* + Author: Djeeberjr + + Description: + Turns the light red inside of the plane + + Parameter(s): + 0: OBJECT - the main gamelogic +*/ +params ["_gl"]; + +_lightSource = _gl getVariable "DLib_pj_lightSource"; +_redLight = _gl getVariable "DLib_pj_redLight"; +_greenLight = _gl getVariable "DLib_pj_greenLight"; + +_lightsource setLightAmbient [1.0, 0.0, 0.0]; +_lightsource setLightColor [1.0, 0.0, 0.0]; + +_redLight setObjectMaterial [0,"a3\data_f\lights\building_landinglights_red.rvmat"]; +_greenLight setObjectMaterial [0,"a3\structures_f_heli\items\airport\data\portablehelipadlight_01.rvmat"]; \ No newline at end of file diff --git a/functions/PlaneJump/fn_pj_startJump.sqf b/functions/PlaneJump/fn_pj_startJump.sqf new file mode 100644 index 0000000..db6528a --- /dev/null +++ b/functions/PlaneJump/fn_pj_startJump.sqf @@ -0,0 +1,18 @@ +/* + Author: Djeeberjr + + Description: + Start the jump sequenze + + Parameter(s): + 0: OBJECT - the main gamelogic + 1 (Optional): SCALAR - the delay between opening the ramp and green light + 2 (Optional): BOOL - use radio voice lines from ai +*/ +_this spawn { + params ["_gl",["_delay",10],["_useRadio",false]]; + [_gl] call DLib_fnc_pj_openRamp; + sleep _delay; + [_gl] call DLib_fnc_pj_greenLight; +}; + diff --git a/functions/PlaneJump/fn_playerParaBackpack.sqf b/functions/PlaneJump/fn_playerParaBackpack.sqf new file mode 100644 index 0000000..5dc5c36 --- /dev/null +++ b/functions/PlaneJump/fn_playerParaBackpack.sqf @@ -0,0 +1,58 @@ +/* + Author: Djeeberjr (Kex (based on cobra4v320's Ai HALO Jump script)) + + Description: + Puts the backpack on the chest and adds a parachute. + THIS FUNCTION HAS TO BE EXECUTED WHERE THE UNIT IS LOCAL! + + Parameter(s): + 1: OBJECT - the unit + +*/ + +params ["_unit"]; + +_backpack_class = backpack _unit; + +// Holtser weapon +_unit action ["SWITCHWEAPON",_unit,_unit,-1]; + +// Unit already has a parachute +if (backpack _unit != "" and {getText (configfile >> "CfgVehicles" >> backpack _unit >> "backpackSimulation") isEqualTo "ParachuteSteerable"}) then {_backpack_class = "";}; + +if (_backpack_class != "") then{ + _container = backpackContainer _unit; + _weapon_cargo = getWeaponCargo _container; + _magazine_cargo = getMagazineCargo _container; + _item_cargo = getItemCargo _container; + + removeBackpack _unit; + _unit addBackpack "b_parachute"; + _packHolder = createVehicle ["groundWeaponHolder", [0,0,0], [], 0, "can_collide"]; + _packHolder addBackpackCargoGlobal [_backpack_class, 1]; + + _packHolder attachTo [vehicle _unit,[-0.07,0.65,-0.55],"spine3"]; + [_packHolder, [[0,-0.2,-1],[0,1,0]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder]; + + sleep 5; // Wait because sometime when you teleport a player high up on a plane he is going in "HaloFreeFall_non" state + + waitUntil {animationState _unit == "HaloFreeFall_non" or (!alive _unit)}; + _packHolder attachTo [_unit,[-0.12,-0.02,-.74],"pelvis"]; + [_packHolder, [[0,-1,-0.05],[0,0,-1]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder]; + + waitUntil {animationState _unit == "para_pilot" or (!alive _unit)}; + _packHolder attachTo [vehicle _unit,[-0.07,0.67,-0.13],"pelvis"]; + [_packHolder, [[0,-0.2,-1],[0,1,0]]] remoteExecCall ["setVectorDirAndUp", 0, _packHolder]; + + waitUntil {isTouchingGround _unit or (getPos _unit select 2) < 1 or (!alive _unit)}; + deleteVehicle _packHolder; + _unit addBackpack _backpack_class; + clearAllItemsFromBackpack _unit; + _container = backpackContainer _unit; + {_container addWeaponCargo [_x, (_weapon_cargo select 1) select _forEachIndex]} forEach (_weapon_cargo select 0); + {_container addMagazineCargo [_x, (_magazine_cargo select 1) select _forEachIndex]} forEach (_magazine_cargo select 0); + {_container addItemCargo [_x, (_item_cargo select 1) select _forEachIndex]} forEach (_item_cargo select 0); +}else +{ + _unit addBackpack "b_parachute"; +}; diff --git a/functions/Radio/fn_carRadio.sqf b/functions/Radio/fn_carRadio.sqf new file mode 100644 index 0000000..465ade5 --- /dev/null +++ b/functions/Radio/fn_carRadio.sqf @@ -0,0 +1,54 @@ +/* + Author: Djeeberjr + + Description: + Installs a very simple radio in the vehicle + + Parameter(s): + 0: OBJECT - the vehicle + 1: STRING or ARRAY - song or array of songs +*/ + +params ["_veh","_songs",["_offset",[0,0,0]]]; + +if((typeName _songs) == "STRING")then{ + _songs = [_songs]; +}; + +_veh addEventHandler ["Killed", { + params ["_unit"]; + if(not isNull (_unit getVariable ["DLib_radio_source",objNull]))then{ + deleteVehicle (_unit getVariable "DLib_radio_source"); + }; +}]; + +_startId = _veh addAction ["Press play",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + _song = selectRandom (_arguments#0); + _offset = _arguments#1; + if(not isNull (_target getVariable ["DLib_radio_source",objNull]))then{ + deleteVehicle (_target getVariable "DLib_radio_source"); + }; + + _source = "Land_Can_V1_F" createVehicle [0,0,0]; + _target setVariable ["DLib_radio_source",_source,true]; + _source hideObjectGlobal true; + + if((typeName _offset) == "STRING")then{ + _source attachTo [_target,[0,0,0],_offset]; + }else{ + _source attachTo [_target,_offset]; + }; + + [_source,[_song,120]] remoteExec ["say3D"]; + +},[_songs,_offset],1.5,false,true,"","driver _target == _this"]; + +_stopId = _veh addAction ["Press Stop",{ + params ["_target", "_caller", "_actionId", "_arguments"]; + + deleteVehicle (_target getVariable ["DLib_radio_source",objNull]); + +},[],1.5,false,true,"","driver _target == _this"]; + +_veh setVariable ["DLib_radio_actions",[_startId,_stopId],true]; \ No newline at end of file diff --git a/functions/Radio/fn_removeCarRadio.sqf b/functions/Radio/fn_removeCarRadio.sqf new file mode 100644 index 0000000..c39112d --- /dev/null +++ b/functions/Radio/fn_removeCarRadio.sqf @@ -0,0 +1,16 @@ +/* + Author: Djeeberjr + + Description: + Removes the car radio + + Parameter(s): + 0: OBJECT - the vehicle +*/ + +params ["_veh"]; + +_actions = _veh getVariable "DLib_radio_actions"; +deleteVehicle (_veh getVariable ["DLib_radio_source",objNull]); +[_veh,_actions select 0] remoteExec ["removeAction"]; +[_veh,_actions select 1] remoteExec ["removeAction"]; diff --git a/functions/Util/fn_attachToRelative.sqf b/functions/Util/fn_attachToRelative.sqf new file mode 100644 index 0000000..da34342 --- /dev/null +++ b/functions/Util/fn_attachToRelative.sqf @@ -0,0 +1,45 @@ +/* + Author: Djeeberjr (code based on killzonekid) + + Description: + Attaches an object realtive to its current position. + + Parameter(s): + 0: OBJECT - to attach + 1: OBJECT - to attach to + +*/ + +params ["_child","_parent"]; + +_vis = _parent worldToModelVisual [0,0,0]; +_vector = [ + _parent worldToModelVisual vectorDirVisual _child vectorDiff _vis, + _parent worldToModelVisual vectorUpVisual _child vectorDiff _vis + ]; + +_child attachTo [_parent]; +_child setVectorDirAndUp _vector; + +/* +KK_fnc_attachToRelative = { + private ["_o","_v"]; + _o = _this select 0; + _v = _this call KK_fnc_vectorDirAndUpRelative; + _o attachTo [_this select 1]; + _o setVectorDirAndUp _v; +}; + +KK_fnc_vectorDirAndUpRelative = { + private ["_o1","_o2","_v"]; + _o1 = _this select 0; + _o2 = _this select 1; + _v = _o2 worldToModelVisual [0,0,0]; + [ + _o2 worldToModelVisual vectorDirVisual _o1 vectorDiff _v, + _o2 worldToModelVisual vectorUpVisual _o1 vectorDiff _v + ] +}; + +[child,parent] call KK_fnc_attachToRelative; +*/ diff --git a/functions/Util/fn_getSyncClass.sqf b/functions/Util/fn_getSyncClass.sqf new file mode 100644 index 0000000..0e7eba1 --- /dev/null +++ b/functions/Util/fn_getSyncClass.sqf @@ -0,0 +1,33 @@ +/* + Author: Djeeberjr + + Description: + Get all object from synchronizedObjects with. + + Parameter(s): + 0: OBJECT - self + 1: ARRAY or STRING - className or array of classnames + + Return: + ARRAY - [obj1,...] +*/ + +params ["_self","_filter"]; + +if(typeName _filter == "STRING")then{ + _filter = [_filter]; +}; + +_returnValue = []; + +{ + _y = _x; + { + if(typeOf _y == _x)then{ + _returnValue pushBack _y; + }; + } forEach _filter; + +} forEach synchronizedObjects _self; + +_returnValue; diff --git a/functions/Util/fn_getSyncType.sqf b/functions/Util/fn_getSyncType.sqf new file mode 100644 index 0000000..e97e057 --- /dev/null +++ b/functions/Util/fn_getSyncType.sqf @@ -0,0 +1,31 @@ +/* + Author: Djeeberjr + + Description: + Gets all object from "synchronizedObjects" by the type + + + Parameter(s): + 0: OBJECT - most of the time: "this" + 1: STRING - type + + Returns: + ARRAY - [[syncedObject,parametr],...] +*/ + +params ["_self","_type"]; + +_syncedObjects = synchronizedObjects _self; +_returnValue = []; +{ + _e = _x getVariable ["DLib_SType",objNull]; + if( (typeName _e ) == "ARRAY")then{ + if((_e select 0) == _type)then{ + _returnValue pushBack [_x,_e select 1]; + }; + + }; + +} forEach _syncedObjects; + +_returnValue; diff --git a/functions/Util/fn_getSyncTypeTrigger.sqf b/functions/Util/fn_getSyncTypeTrigger.sqf new file mode 100644 index 0000000..82b7da9 --- /dev/null +++ b/functions/Util/fn_getSyncTypeTrigger.sqf @@ -0,0 +1,28 @@ +/* + Author: Djeeberjr + + Description: + Gets all Trigger from "synchronizedObjects" by the type. Type is set in the editor unter Text + + + Parameter(s): + 0: OBJECT - most of the time: "this" + 1: STRING - type + + Returns: + ARRAY - [[syncedTrigger],...] +*/ +params ["_self","_type"]; + +_syncedObjects = synchronizedObjects _self; +_returnValue = []; +{ + if(_x isKindOf "EmptyDetector")then{ + if(triggerText _x == _type)then{ + _returnValue pushBack _x; + }; + }; + +} forEach _syncedObjects; + +_returnValue; diff --git a/functions/Util/fn_holsterWeapon.sqf b/functions/Util/fn_holsterWeapon.sqf new file mode 100644 index 0000000..e75b2ee --- /dev/null +++ b/functions/Util/fn_holsterWeapon.sqf @@ -0,0 +1,17 @@ +/* + Author: Djeeberjr + + Description: + Holsters the weapons for a unit. + + Parameter(s): + 0: OBJECT - the unit + +*/ +params ["_unit"]; + +if(DLib_isInit) then{ + [_unit,{_this action ["SwitchWeapon", _this,_this,-1];}] call DLib_fnc_runPost; +}else{ + _unit action ["SwitchWeapon", _unit,_unit,-1]; +} diff --git a/functions/Util/fn_runPost.sqf b/functions/Util/fn_runPost.sqf new file mode 100644 index 0000000..2d4f019 --- /dev/null +++ b/functions/Util/fn_runPost.sqf @@ -0,0 +1,19 @@ +/* + Author: Djeeberjr + + Description: + Calls the function on "postInit". See https://community.bistudio.com/wiki/Initialization_Order + + Parameters: + 0: ANY - arguments + 1: CODE + +*/ + +params ["_args","_code"]; + +if (isNil "DLib_post_calls") then { + DLib_post_calls = []; +}; + +DLib_post_calls pushBack [_args,_code]; diff --git a/functions/Util/fn_setSyncType.sqf b/functions/Util/fn_setSyncType.sqf new file mode 100644 index 0000000..e7af831 --- /dev/null +++ b/functions/Util/fn_setSyncType.sqf @@ -0,0 +1,16 @@ +/* + Author: Djeeberjr + + Description: + Sets the "type" of an object so you can better get it from "synchronizedObjects". + + Parameter(s): + 0: OBJECT - most of the time: "this" + 1: STRING - type + 2 (optional): ANY - optional parameters +*/ + +params ["_self","_type",["_params",objNull]]; + +_self setVariable ["DLib_SType",[_type,_params]]; + diff --git a/functions/Zeus/fn_initZeus.sqf b/functions/Zeus/fn_initZeus.sqf new file mode 100644 index 0000000..5ae0924 --- /dev/null +++ b/functions/Zeus/fn_initZeus.sqf @@ -0,0 +1,35 @@ +/* + Author: Djeeberjr + + Description: + Init a zeus player. + + Parameter(s): + 0: OBJECT - zeus unit +*/ +params ["_unit"]; + +//Command can only be executed on the server. +if(!isServer)exitWith{}; + +//Check if unit is alredy a curator +if(_unit call BIS_fnc_isCurator)exitWith{}; + +//Create Zeus module if not created yet. +if(isNil "DLib_zeusModule")then{ + _sideLogic = createCenter sidelogic; + _group_logic = createGroup _sideLogic; + DLib_zeusModule = _group_logic createUnit ["ModuleCurator_F", [0,0,0], [],0, "NONE"]; + DLib_zeusModule addCuratorEditableObjects [allUnits,true]; + publicVariable "DLib_zeusModule"; +}; + +_unit assignCurator DLib_zeusModule; + +//Add vision modes +[_unit,[-1,-2,0,1,2,3,4,5,6,7]] call BIS_fnc_setCuratorVisionModes; + +//godmode +_unit allowDamage false; + + diff --git a/includes/Arsenal/CfgFunctions.hpp b/includes/Arsenal/CfgFunctions.hpp new file mode 100644 index 0000000..d99c0c8 --- /dev/null +++ b/includes/Arsenal/CfgFunctions.hpp @@ -0,0 +1,5 @@ +class Arsenal{ + file="DLib\functions\Arsenal"; + class addFullArsenal{}; + class removeFullArsenal{}; +}; \ No newline at end of file diff --git a/includes/Barricade/CfgFunctions.hpp b/includes/Barricade/CfgFunctions.hpp new file mode 100644 index 0000000..460dd9e --- /dev/null +++ b/includes/Barricade/CfgFunctions.hpp @@ -0,0 +1,6 @@ +class Barricade{ + file="DLib\functions\Barricade"; + class barricade{}; + class enableBarricade{}; + class disableBarricade{}; +}; \ No newline at end of file diff --git a/includes/Base/CfgFunctions.hpp b/includes/Base/CfgFunctions.hpp new file mode 100644 index 0000000..3659dc7 --- /dev/null +++ b/includes/Base/CfgFunctions.hpp @@ -0,0 +1,11 @@ +class Base{ + file="DLib\functions\Base"; + + class missionPreInit{ + preInit = 1; + }; + + class missionPostInit{ + postInit = 1; + } +} diff --git a/includes/CfgFunctions.hpp b/includes/CfgFunctions.hpp new file mode 100644 index 0000000..38d822c --- /dev/null +++ b/includes/CfgFunctions.hpp @@ -0,0 +1,11 @@ +class DLib{ + #include "Base\CfgFunctions.hpp" + #include "Arsenal\CfgFunctions.hpp" + #include "Barricade\CfgFunctions.hpp" + #include "Interactables\CfgFunctions.hpp" + #include "Orbat\CfgFunctions.hpp" + #include "PlaneJump\CfgFunctions.hpp" + #include "Radio\CfgFunctions.hpp" + #include "Util\CfgFunctions.hpp" + #include "Zeus\CfgFunctions.hpp" +} \ No newline at end of file diff --git a/includes/CfgSFX.hpp b/includes/CfgSFX.hpp new file mode 100644 index 0000000..c1aa334 --- /dev/null +++ b/includes/CfgSFX.hpp @@ -0,0 +1 @@ +#include "PlaneJump\CfgSFX.hpp" \ No newline at end of file diff --git a/includes/CfgVehicles.hpp b/includes/CfgVehicles.hpp new file mode 100644 index 0000000..305dc41 --- /dev/null +++ b/includes/CfgVehicles.hpp @@ -0,0 +1 @@ +#include "PlaneJump\CfgVehicles.hpp" \ No newline at end of file diff --git a/includes/Interactables/CfgFunctions.hpp b/includes/Interactables/CfgFunctions.hpp new file mode 100644 index 0000000..ff380c9 --- /dev/null +++ b/includes/Interactables/CfgFunctions.hpp @@ -0,0 +1,10 @@ +class Interactables{ + file="DLib\functions\Interactables"; + class makeAiDoctor{}; //TODO + class addVoiceLine{}; //TODO + class makeCram{}; + class mannequin{}; + class readNews{}; + class createTeleporter{}; + class teleporterCallback{}; +} \ No newline at end of file diff --git a/includes/MIS_functions.hpp b/includes/MIS_functions.hpp new file mode 100644 index 0000000..24140ee --- /dev/null +++ b/includes/MIS_functions.hpp @@ -0,0 +1,7 @@ +file="functions"; +class preInit{ + preInit = 1; +}; +class postInit{ + postInit = 1; +}; \ No newline at end of file diff --git a/includes/Orbat/CfgFunctions.hpp b/includes/Orbat/CfgFunctions.hpp new file mode 100644 index 0000000..db0d948 --- /dev/null +++ b/includes/Orbat/CfgFunctions.hpp @@ -0,0 +1,6 @@ +class Orbat{ + file="DLib\functions\Orbat"; + + class makeTacticalTerminal{}; + class createTactialMission{}; +}; diff --git a/includes/PlaneJump/CfgFunctions.hpp b/includes/PlaneJump/CfgFunctions.hpp new file mode 100644 index 0000000..b27f543 --- /dev/null +++ b/includes/PlaneJump/CfgFunctions.hpp @@ -0,0 +1,11 @@ +class PlaneJump{ + file="DLib\functions\PlaneJump"; + class pj_init{}; + class pj_initPlayer{}; + class playerParaBackpack{}; + class pj_openRamp{}; + class pj_closeRamp{}; + class pj_greenLight{}; + class pj_redLight{}; + class pj_startJump{}; +} \ No newline at end of file diff --git a/includes/PlaneJump/CfgSFX.hpp b/includes/PlaneJump/CfgSFX.hpp new file mode 100644 index 0000000..89e28ce --- /dev/null +++ b/includes/PlaneJump/CfgSFX.hpp @@ -0,0 +1,6 @@ +class DLIB_pj_planeSound +{ + sound0[] = {"@CUP\AirVehicles\CUP_AirVehicles_C130J\data\sound\int_engine_hi", db+10, 1.0, 250, 1, 0, 0, 0}; + sounds[] = {sound0}; + empty[] = {"", 0, 0, 0, 0, 0, 0, 0}; +}; \ No newline at end of file diff --git a/includes/PlaneJump/CfgVehicles.hpp b/includes/PlaneJump/CfgVehicles.hpp new file mode 100644 index 0000000..356d0dc --- /dev/null +++ b/includes/PlaneJump/CfgVehicles.hpp @@ -0,0 +1,4 @@ +class DLIB_pj_planeLoop +{ + sound = "DLIB_pj_planeSound"; // reference to CfgSFX class +}; \ No newline at end of file diff --git a/includes/Radio/CfgFunctions.hpp b/includes/Radio/CfgFunctions.hpp new file mode 100644 index 0000000..92e2bfb --- /dev/null +++ b/includes/Radio/CfgFunctions.hpp @@ -0,0 +1,5 @@ +class Radio{ + file="DLib\functions\Radio"; + class carRadio{}; + class removeCarRadio{}; +}; \ No newline at end of file diff --git a/includes/Util/CfgFunctions.hpp b/includes/Util/CfgFunctions.hpp new file mode 100644 index 0000000..f0750ba --- /dev/null +++ b/includes/Util/CfgFunctions.hpp @@ -0,0 +1,10 @@ +class Util{ + file="DLib\functions\Util"; + class setSyncType{}; + class getSyncType{}; + class getSyncClass{}; + class getSyncTypeTrigger{}; + class runPost{}; + class holsterWeapon{}; + class attachToRelative{}; +} diff --git a/includes/Zeus/CfgFunctions.hpp b/includes/Zeus/CfgFunctions.hpp new file mode 100644 index 0000000..c59f3dc --- /dev/null +++ b/includes/Zeus/CfgFunctions.hpp @@ -0,0 +1,4 @@ +class Zeus{ + file="DLib\functions\Zeus"; + class initZeus{}; +} \ No newline at end of file