├── test.sqf ├── JeroenArsenal ├── Common │ ├── defineCommon.inc │ ├── Array │ │ ├── defineCommon.inc │ │ ├── fn_common_array_add.sqf │ │ └── fn_common_array_remove.sqf │ ├── Vehicle │ │ ├── defineCommon.inc │ │ ├── fn_common_vehicle_getVehicleType.sqf │ │ └── fn_common_vehicle_getSeatNames.sqf │ ├── fn_common_getActionCanceled.sqf │ ├── fn_common_removeActionCancel.sqf │ ├── fn_common_updateActionCancel.sqf │ ├── fn_common_spawnVehicle.sqf │ ├── fn_common_addActionCancel.sqf │ └── fn_common_addActionSelect.sqf ├── JNL │ ├── defineCommon.inc │ ├── Functions │ │ ├── defineCommon.inc │ │ ├── fn_logistics_lockSeats.sqf │ │ ├── fn_logistics_getCargo.sqf │ │ ├── fn_logistics_getCargoType.sqf │ │ ├── fn_logistics_getNodes.sqf │ │ ├── fn_logistics_getCargoOffsetAndDir.sqf │ │ └── fn_logistics_canLoad.sqf │ ├── Actions │ │ ├── defineCommon.inc │ │ ├── fn_logistics_removeActionLoad.sqf │ │ ├── fn_logistics_removeActionUnload.sqf │ │ ├── fn_logistics_removeActionGetinWeapon.sqf │ │ ├── fn_logistics_removeEventGetOutWeapon.sqf │ │ ├── fn_logistics_addEventGetoutWeapon.sqf │ │ ├── fn_logistics_addActionUnload.sqf │ │ ├── fn_logistics_addActionGetinWeapon.sqf │ │ └── fn_logistics_addActionLoad.sqf │ ├── fn_logistics_addAction.sqf │ ├── fn_logistics_removeAction.sqf │ ├── nodefinder.sqf │ ├── recompile.sqf │ ├── fn_logistics_unLoad.sqf │ ├── fn_logistics_load.sqf │ └── fn_logistics_init.sqf ├── Test │ ├── defineCommon.inc │ ├── fn_test_configViewer.sqf │ ├── fn_test_recompile.sqf │ ├── fn_test_init.sqf │ ├── buttonblocker.sqf │ ├── play pickup animation.sqf │ ├── copyFunctions.sqf │ └── fn_test_debugv2.sqf ├── Ammo │ ├── fn_ammo_getCargo.sqf │ ├── fn_ammo_getCargoCapacity.sqf │ ├── fn_ammo_setCargoCapacity.sqf │ ├── fn_ammo_removeCargo.sqf │ ├── fn_ammo_getPylonLoadoutMissing.sqf │ ├── fn_ammo_getCost.sqf │ ├── fn_ammo_set.sqf │ ├── tst.sqf │ ├── fn_ammo_setCargo.sqf │ ├── fn_ammo_rearm.sqf │ ├── fn_ammo_getLoadoutMissing.sqf │ ├── fn_ammo_getLoadoutCost.sqf │ ├── fn_ammo_getLoadoutCurrent.sqf │ ├── defineCommon.inc │ ├── fn_ammo_getLoadoutCfg.sqf │ ├── fn_ammo_init.sqf │ ├── fn_ammo_addActionRearm.sqf │ ├── fn_ammo_getLoadout_old.sqf │ └── fn_ammo_getLoadout.sqf ├── Icons │ ├── JN_loadVehicle2.paa │ └── JN_unloadVehicle.paa ├── Repair │ ├── fn_repair_getCargo.sqf │ ├── fn_repair_getCargoCapacity.sqf │ ├── fn_repair_setCargoCapacity.sqf │ ├── fn_repair_removeCargo.sqf │ ├── fn_repair_setCargo.sqf │ ├── getLoadout.sqf │ ├── defineCommon.inc │ ├── test2.sqf │ ├── fn_repair_repairHitpoint.sqf │ ├── fn_repair_addActionRepairPlayer.sqf │ ├── getWheels.sqf │ ├── fn_repair_getWheelHitPointsWithSelections.sqf │ ├── fn_repair_getVehicleData.sqf │ ├── fn_repair_addActionRepair.sqf │ ├── fn_repair_inventoryEvent.sqf │ └── fn_repair_addSelectRepair.sqf ├── Fuel │ ├── fn_fuel_getCargo.sqf │ ├── fn_fuel_getCapacity.sqf │ ├── fn_fuel_getCargoCapacity.sqf │ ├── fn_fuel_get.sqf │ ├── fn_fuel_setCapacity.sqf │ ├── fn_fuel_setCargoCapacity.sqf │ ├── fn_fuel_consumption_stop.sqf │ ├── fn_fuel_set.sqf │ ├── fn_fuel_removeCargo.sqf │ ├── fn_fuel_remove.sqf │ ├── defineCommon.inc │ ├── fn_fuel_consumption_start.sqf │ ├── fn_fuel_init.sqf │ ├── fn_fuel_vehicleInit.sqf │ ├── fn_fuel_setCargo.sqf │ ├── fn_fuel_consumption_init.sqf │ ├── fn_fuel_addActionRefuel.sqf │ └── fn_fuel_refuel.sqf ├── JNA │ ├── fn_arsenal_getEmptyArray.sqf │ ├── fn_arsenal_getPrimaryWeapons.sqf │ ├── fn_arsenal_getSecondaryWeapons.sqf │ ├── fn_arsenal_itemCount.sqf │ ├── fn_arsenal_inList.sqf │ ├── fn_arsenal_arrayToArsenal.sqf │ ├── fn_arsenal_cargoToArsenal.sqf │ ├── fn_arsenal_requestClose.sqf │ ├── fn_arsenal_requestOpen.sqf │ ├── fn_arsenal_removeItem.sqf │ ├── fn_arsenal_addItem.sqf │ ├── fn_arsenal_initPersistent.sqf │ ├── fn_arsenal_itemType.sqf │ ├── defineCommon.inc │ ├── fn_arsenal_cargoToArray.sqf │ └── fn_arsenal_init.sqf ├── JNG │ ├── fn_garage_updatePoints.sqf │ ├── fn_garage_requestClose.sqf │ ├── fn_garage_removeVehicle.sqf │ ├── fn_garage_lockVehicle.sqf │ ├── fn_garage_releaseVehicle.sqf │ ├── fn_garage_requestOpen.sqf │ ├── fn_garage_canGarageVehicle.sqf │ ├── fn_garage_addVehicle.sqf │ ├── fn_garage_garageVehicle.sqf │ ├── fn_garage_requestVehicle.sqf │ ├── defineCommon.inc │ ├── fn_garage_getVehicleData.sqf │ └── fn_garage_init.sqf ├── defineCommon.inc ├── functions.hpp └── drone.sqf ├── mission.sqm ├── workspace.code-workspace ├── defineCommon.inc ├── init.sqf ├── Description.ext ├── README.md └── stringtable.xml /test.sqf: -------------------------------------------------------------------------------- 1 | 12; -------------------------------------------------------------------------------- /JeroenArsenal/Common/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | -------------------------------------------------------------------------------- /JeroenArsenal/Test/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/Array/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/Vehicle/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | -------------------------------------------------------------------------------- /mission.sqm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeroen-Notenbomer/Limited-Arsenal/HEAD/mission.sqm -------------------------------------------------------------------------------- /workspace.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define INT_MAX_DISTANCE_TO_LOADCARGO 6 -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | _vehicle getVariable ["jn_ammo_cargo",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Icons/JN_loadVehicle2.paa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeroen-Notenbomer/Limited-Arsenal/HEAD/JeroenArsenal/Icons/JN_loadVehicle2.paa -------------------------------------------------------------------------------- /JeroenArsenal/Icons/JN_unloadVehicle.paa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jeroen-Notenbomer/Limited-Arsenal/HEAD/JeroenArsenal/Icons/JN_unloadVehicle.paa -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_getCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle"]; 4 | 5 | _vehicle getVariable ["jn_repair_cargo",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | _vehicle getVariable ["jn_ammo_cargoCapacity",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_getActionCanceled.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object"]; 4 | isNil {_object getVariable "jn_cancelAction_id"} -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_getCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]]]; 4 | 5 | _vehicle getVariable ["jn_fuel_cargo",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_getCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]]]; 4 | 5 | _vehicle getVariable ["jn_fuel_capacity",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_setCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle", "_amount"]; 4 | 5 | _vehicle setVariable ["jn_ammo_cargoCapacity",_amount]; -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_getCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]]]; 4 | 5 | _vehicle getVariable ["jn_fuel_cargoCapacity",0]; -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_getCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params[["_vehicle",objNull,[objNull]]]; 4 | 5 | _vehicle getVariable ["jn_repair_cargoCapacity",0]; -------------------------------------------------------------------------------- /defineCommon.inc: -------------------------------------------------------------------------------- 1 | 2 | #define COLOR_ORANGE [1,0.64,0,1] 3 | #define COLOR_ORANGE_HTML "#FFA300" 4 | #define COLOR_WHITE [1,1,1,1] 5 | #define COLOR_WHITE_HTML "#FFFFFF" 6 | 7 | 8 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_get.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]]]; 4 | 5 | round(fuel _vehicle * (_vehicle getVariable ["jn_fuel_capacity",0])); -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_setCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]]]; 4 | 5 | _vehicle setVariable ["jn_fuel_capacity",_amount]; -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_setCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]]]; 4 | 5 | _vehicle setVariable ["jn_fuel_cargoCapacity",_amount]; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_getEmptyArray.sqf: -------------------------------------------------------------------------------- 1 | // Returns an empty default array with no items 2 | private _return = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]; 3 | _return -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_setCargoCapacity.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]]]; 4 | 5 | _vehicle setVariable ["jn_repair_cargoCapacity",_amount]; 6 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/fn_logistics_addAction.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_object"]; 4 | 5 | //add action to all clients 6 | [_object] remoteExec ["jn_fnc_logistics_addActionLoad",[0, -2] select isDedicated,_object]; 7 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_getPrimaryWeapons.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Returns array with primary weapons from an array. 5 | usage: 6 | _this call ... 7 | */ 8 | 9 | _this select IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_removeActionCancel.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_object",["_text",""]]; 4 | 5 | pr _id = _object getVariable "jn_cancelAction_id"; 6 | 7 | if(isnil "_id")exitWith{}; 8 | _object removeAction _id; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_getSecondaryWeapons.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Returns array with secondary weapons from an array. 5 | usage: 6 | _this call ... 7 | */ 8 | 9 | _this select IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_itemCount.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_item","_array"]; 4 | 5 | pr _return = 0; 6 | { 7 | if((_x select 0) isEqualTo _item)exitWith{_return = (_x select 1)}; 8 | }forEach _array; 9 | 10 | _return; 11 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_consumption_stop.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_unit"]; 4 | 5 | pr _handle = _unit getVariable "fuelConsumtion_handle"; 6 | if(isNil "_handle" )exitWith{}; 7 | terminate _handle; 8 | player setVariable ["fuelConsumtion_handle",nil]; -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_removeCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]]]; 4 | 5 | pr _cargo = (_vehicle call JN_fnc_repair_getCargo) - _amount; 6 | 7 | pr _error = [_vehicle,_cargo] call JN_fnc_repair_setCargo; 8 | 9 | _error; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_inList.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | private["_list","_item","_return"]; 4 | _item = _this select 0; 5 | _list = _this select 1; 6 | _return = false; 7 | { 8 | if(_item isEqualTo (_x select 0))exitwith{_return = true;}; 9 | }foreach _list; 10 | _return; 11 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/fn_logistics_removeAction.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | //Removes the action from the cargo for all clients 4 | 5 | params["_object"]; 6 | 7 | //remove action for all clients 8 | [_object] remoteExec ["jn_fnc_logistics_removeActionLoad",[0, -2] select isDedicated,_object]; 9 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_set.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]],["_global",false]]; 4 | 5 | pr _cap = [_vehicle] call JN_fnc_fuel_getCapacity; 6 | if(_cap==0 || {_amount > _cap} || {_amount < 0})exitWith{}; 7 | 8 | _vehicle setFuel (_amount/_cap); 9 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_removeActionLoad.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object"]; 4 | 5 | pr _loadActionID = _object getVariable ["jnl_loadActionID",nil]; 6 | if(!isnil "_loadActionID") then{ 7 | _object removeAction _loadActionID; 8 | _object setVariable["jnl_loadActionID",nil]; 9 | }; 10 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_removeCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle","_amount"]; 4 | 5 | pr _cargo = _vehicle call JN_fnc_ammo_getCargo; 6 | _cargo = _cargo - _amount; 7 | if(_cargo < 0)exitWith{false};//return failure 8 | 9 | [_vehicle,_cargo]; call JN_fnc_ammo_setCargo; 10 | 11 | //return succes 12 | true; -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_updateActionCancel.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_object",["_text",""]]; 4 | 5 | pr _id = _object getVariable "jn_cancelAction_id"; 6 | 7 | if(isnil "_id")exitWith{}; 8 | 9 | _object setUserActionText [_id, format["%1 %2",localize "STR_JNC_ACT_CANCEL",_text]]; 10 | 11 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_removeCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle","_amount"]; 4 | 5 | pr _cargo = _vehicle call JN_fnc_fuel_getCargo; 6 | _cargo = _cargo - _amount; 7 | if(_cargo < 0)exitWith{false};//return failure 8 | 9 | [_vehicle,_cargo]; call JN_fnc_fuel_setCargo; 10 | 11 | //return succes 12 | true; -------------------------------------------------------------------------------- /JeroenArsenal/Test/fn_test_configViewer.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | [] spawn { 4 | profileNamespace setVariable ["bis_fnc_configviewer_selected", typeOf cursorObject]; 5 | profileNamespace setVariable ["bis_fnc_configviewer_path", ["configfile","CfgVehicles",typeOf cursorObject]]; 6 | sleep 0.1; 7 | call BIS_fnc_configViewer; 8 | }; -------------------------------------------------------------------------------- /init.sqf: -------------------------------------------------------------------------------- 1 | /** 2 | * Arma_not - init 3 | * 4 | * Author: Jeroen%20not 5 | * 6 | * Description: 7 | * Not given 8 | * 9 | * Parameter(s): 10 | * 0: None 11 | * 12 | * Return Value: 13 | * None 14 | * 15 | */ 16 | 17 | 18 | 19 | 20 | call JN_fnc_ammo_init; 21 | 22 | call JN_fnc_fuel_init; 23 | 24 | call JN_fnc_test_init; -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_removeActionUnload.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _unloadActionID = _vehicle getVariable ["jnl_unloadActionID", nil]; 6 | if(!isnil "_unloadActionID")then{ 7 | _vehicle removeAction _unloadActionID; 8 | _vehicle setVariable ["jnl_unloadActionID", nil]; 9 | }; 10 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_remove.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle","_amount"]; 4 | 5 | pr _cargo = _vehicle call JN_fnc_fuel_get; 6 | _cargo = _cargo - _amount; 7 | if(_cargo < 0)then{ 8 | _amount = _cargo; 9 | _cargo = 0; 10 | }; 11 | 12 | [_vehicle,_cargo] call JN_fnc_fuel_set; 13 | 14 | //return removed amount 15 | _amount -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_arrayToArsenal.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | if(!isserver)exitwith{}; 4 | 5 | params [["_object",objNull,[objNull]],"_array"]; 6 | if(isNull _object)exitWith{["Error: wrong input given '%1'",_object] call BIS_fnc_error;}; 7 | 8 | //update datalist on server and client 9 | [_object, _array] call jn_fnc_arsenal_addItem; 10 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_removeActionGetinWeapon.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _getInGunnerActionID = _vehicle getVariable ["jnl_getInGunnerActionID", nil]; 6 | if(!isnil "_getInGunnerActionID")then{ 7 | _vehicle removeAction _getInGunnerActionID; 8 | _vehicle setVariable ["jnl_getInGunnerActionID", nil]; 9 | }; 10 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_removeEventGetOutWeapon.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _getOutEventID = _vehicle setVariable ["jnl_getOutGunnerEventID", nil]; 6 | if(!isnil "_getOutEventID")then{ 7 | _vehicle removeEventHandler ["GetOut",_getOutEventID]; 8 | _vehicle setVariable ["jnl_getOutGunnerEventID", nil]; 9 | }; 10 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_updatePoints.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object","_amount","_type"]; 4 | 5 | //update 6 | pr _playersInGarage = +(_object getVariable ["jng_playersInGarage",[]]); 7 | if!(0 in _playersInGarage)then{_playersInGarage pushBackUnique 2;}; 8 | 9 | ["UpdatePoints",[_amount,_type]] remoteExecCall ["jn_fnc_garage",_playersInGarage]; 10 | -------------------------------------------------------------------------------- /Description.ext: -------------------------------------------------------------------------------- 1 | allowFunctionsLog=1; 2 | allowFunctionsRecompile = 1; 3 | class CfgFunctions { 4 | #include "JeroenArsenal\functions.hpp" 5 | }; 6 | 7 | class Vehicles { 8 | class car1 { 9 | type = "C_Hatchback_01_sport_F"; 10 | fuel = 80; 11 | repair = 2000; 12 | }; 13 | class car2 { 14 | type = "rhsusf_m1025_w_mk19"; 15 | fuel = 80; 16 | repair = 3000; 17 | }; 18 | }; -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_spawnVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_jn_type", _location]; 4 | pr _config = (missionConfigFile >> "Vehicles" >> _jn_type); 5 | pr _type = (_config >> "type"); 6 | pr _fuel = (_config >> "fuel"); 7 | pr _repair = (_config >> "repair"); 8 | 9 | pr _vehicle = _type createVehicle _location; 10 | _vehicle setVariable ["jn_type",_jn_type]; 11 | 12 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_cargoToArsenal.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_objectFrom","_objectTo"]; 4 | 5 | pr _array = _objectFrom call jn_fnc_arsenal_cargoToArray; 6 | 7 | //clear cargo 8 | clearMagazineCargoGlobal _objectFrom; 9 | clearItemCargoGlobal _objectFrom; 10 | clearweaponCargoGlobal _objectFrom; 11 | clearbackpackCargoGlobal _objectFrom; 12 | 13 | 14 | [_objectTo,_array] remoteExec ["jn_fnc_arsenal_arrayToArsenal",2]; -------------------------------------------------------------------------------- /JeroenArsenal/Test/fn_test_recompile.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | { 4 | _tag = configName _x; 5 | _file = getText(_x >> "file"); 6 | { 7 | pr _name = configName _x; 8 | pr _file = _file + "\fn_" + _name + ".sqf"; 9 | _fncName = format["JN_fnc_%1",_name]; 10 | 11 | _fncName = compile preprocessFile _file; 12 | }forEach ("true" configClasses _x); 13 | }forEach ("true" configClasses (missionConfigFile >> "cfgFunctions" >> "JN")) ; 14 | 15 | 16 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getPylonLoadoutMissing.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | //returns [["PylonRack_12Rnd_missiles",12],["PylonRack_12Rnd_missiles",12]] 4 | 5 | params["_veh"]; 6 | 7 | pr _array = []; 8 | { 9 | pr _name = _x; 10 | pr _amountCurrent = _veh ammoOnPylon (_forEachIndex + 1); 11 | pr _amountCfg = getNumber(configfile >> "cfgMagazines">> _name >>"count"); 12 | _array pushBack [_name,(_amountCfg-_amountCurrent)]; 13 | }forEach (getPylonMagazines _veh); 14 | 15 | _array; -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getCost.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Get cost of ammo in a magazine 8 | 9 | Parameter(s): 10 | String: magazine class name 11 | 12 | Returns: 13 | [_magClass] call JN_fnc_ammo_getCost; 14 | 15 | */ 16 | 17 | params ["_magClass"]; 18 | 19 | 20 | pr _ammoClass = getText(configfile >> "CfgMagazines" >> _magClass >> "ammo"); 21 | 22 | getNumber (configfile >> "CfgAmmo" >> _ammoClass >> "cost"); 23 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define INT_MAX_DISTANCE_TO_REFUEL 4 4 | #define INT_FUELCONSUMTION_MULTIPLIER 1//how much more fuel is used per tick; 5 | #define FLOAT_MASSMULTIPLIER 1.3//how much more heavy is a fully loaded fuel truck 6 | #define FLOAT_REFUELINTERVAL 0.5 7 | #define STR_ACTION_REFUEL(FUELCARGO,FUELCARGOCAPACTIY) format ["%1 [%2L/%3L]",localize "STR_JN_FUEL_ACT_REFUEL",FUELCARGO,FUELCARGOCAPACTIY] 8 | -------------------------------------------------------------------------------- /JeroenArsenal/Test/fn_test_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | waituntil {!isnull (finddisplay 46)}; 5 | 6 | 7 | findDisplay 46 displayAddEventHandler ["KeyDown", {if(_this select 1 == 33)then{ 8 | [] spawn { 9 | profileNamespace setVariable ["bis_fnc_configviewer_selected", typeOf cursorObject]; 10 | profileNamespace setVariable ["bis_fnc_configviewer_path", ["configfile","CfgVehicles",typeOf cursorObject]]; 11 | sleep 0.1; 12 | call BIS_fnc_configViewer; 13 | }; 14 | }}]; 15 | */ 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/nodefinder.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | _base = cursorObject; 4 | _basePos = getPosWorld _base; 5 | _array2 =[getText (configfile >> "CfgVehicles" >> typeOf _base >> "model")]; 6 | _array1 = []; 7 | _locBase = getPosWorld _base; 8 | { 9 | _offset = (getPosWorld _x) vectorDiff _basePos; 10 | _dir = vectorDir _x; 11 | _up = vectorUp _x; 12 | _tex = getObjectTextures _x; 13 | _array1 pushBack [1, _offset, []]; 14 | }foreach (attachedObjects _base); 15 | _array2 pushBack _array1; 16 | copyToClipboard str _array2; 17 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_requestClose.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Removes the client from the servers list so it doesnt get called when the garage gets updated. This command needs to be excuted on the server! 7 | 8 | Parameter(s): 9 | ID clientOwner 10 | 11 | Returns: 12 | NOTHING 13 | */ 14 | 15 | if(!isServer)exitWith{}; 16 | params ["_clientOwner","_object"]; 17 | 18 | _temp = _object getVariable ["jng_inUseBy",[]]; 19 | _temp= _temp - [_clientOwner]; 20 | _object setVariable ["jng_inUseBy",_temp]; 21 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_set.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [ 4 | ["_vehicle",objNull,[objNull]], 5 | ["_turretPath",[],[[]]], 6 | ["_magazine","",[""]], 7 | ["_amount",0,[0]], 8 | ["_amountPerMag",0,[0]] 9 | ]; 10 | 11 | _vehicle removeMagazinesTurret [_magazine, _turretPath]; 12 | 13 | while {_amount > _amountPerMag}do{ 14 | _vehicle addMagazineTurret [_magazine, _turretPath, _amountPerMag]; 15 | _amount = _amount - _amountPerMag; 16 | }; 17 | if(_amount > 0)then{ 18 | _vehicle addMagazineTurret [_magazine, _turretPath, _amount]; 19 | }; 20 | 21 | //_vehicle setWeaponReloadingTime -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/tst.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | _vehicle = cursorObject; 4 | 5 | _missingAmmoTurrets = _vehicle call JN_fnc_ammo_getLoadoutMissing; 6 | 7 | _costTotal = []; 8 | { 9 | pr _missingAmmoTurret = _x; 10 | pr _cost = 0; 11 | { 12 | _x params ["_magClass","_amount"]; 13 | pr _ammoClass = getText(configfile >> "CfgMagazines" >> _magClass >> "ammo"); 14 | _cost = _cost + (getNumber (configfile >> "CfgAmmo" >> _ammoClass >> "cost") * _amount); 15 | 16 | }forEach _missingAmmoTurret; 17 | _costTotal pushBack _cost; 18 | }forEach (_missingAmmoTurrets select 1); 19 | 20 | [_missingAmmoTurrets select 0, _costTotal]; -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_addActionCancel.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | 4 | params ["_object",["_script",{}]]; 5 | 6 | pr _actionId = _object addAction [ 7 | "place holder", 8 | { 9 | params ["_target", "_caller", "_actionId", "_arguments"]; 10 | pr _script = _arguments; 11 | 12 | _target removeAction _actionId; 13 | _target setVariable ["jn_cancelAction_id",nil]; 14 | 15 | call _script; 16 | }, 17 | _script, 18 | 7, 19 | true, 20 | false, 21 | "", 22 | "alive _target" 23 | 24 | ]; 25 | 26 | _object setVariable ["jn_cancelAction_id",_actionId]; 27 | 28 | [player,""] call JN_fnc_common_updateActionCancel; -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_lockSeats.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _type = -1; 6 | pr _nodesLocked = []; 7 | { 8 | pr _data = _x getVariable ["jnl_cargo",nil]; 9 | if(!isnil "_data")then{ 10 | _type = _data select 0; 11 | _nodesLocked pushback (_data select 1); 12 | }; 13 | } forEach attachedObjects _vehicle; 14 | 15 | pr _nodes = [_vehicle,_type] call jn_fnc_logistics_getNodes; 16 | _vehicle lockCargo false; 17 | { 18 | _lockSeats = _nodes select _x select 1;//get seats to lock 19 | { 20 | _vehicle lockCargo [_x, true]; 21 | } forEach _lockSeats; 22 | }forEach _nodesLocked; 23 | 24 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_requestClose.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | 4 | /* 5 | Author: Jeroen Notenbomer 6 | 7 | Description: 8 | Removes the client from the servers list so it doesnt get called when the arsenal gets updated. This command needs to be excuted on the server! 9 | 10 | Parameter(s): 11 | ID clientOwner 12 | 13 | Returns: 14 | NOTHING, well it sends a command which contains the JNA_datalist 15 | */ 16 | 17 | if(!isServer)exitWith{}; 18 | params ["_clientOwner","_object"]; 19 | 20 | _temp = _object getVariable ["jna_inUseBy",[]]; 21 | _temp = _temp - [_clientOwner]; 22 | _object setVariable ["jna_inUseBy",_temp,true]; 23 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_consumption_start.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_unit"]; 4 | _handle = [_unit]spawn { 5 | params["_unit"]; 6 | pr _vehicle = vehicle _unit; 7 | pr _fuelOld = fuel _vehicle; 8 | while {alive _vehicle} do{ 9 | pr _fuelNew = fuel _vehicle; 10 | if(isengineon _vehicle)then{ 11 | pr _delta = _fuelOld - _fuelNew; 12 | if(_delta>0)then{ 13 | _fuelNew = _fuelNew - (_delta * INT_FUELCONSUMTION_MULTIPLIER); 14 | _vehicle setfuel _fuelNew; 15 | }; 16 | _fuelOld = _fuelNew; 17 | }; 18 | sleep 1; 19 | }; 20 | }; 21 | _unit setVariable ["fuelConsumtion_handle",_handle]; 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_addEventGetoutWeapon.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object"]; 4 | 5 | pr _getOutEventID = _object getVariable ["jnl_getOutGunnerEventID", nil]; 6 | 7 | //Check if action exists already 8 | if(!isnil "_getOutEventID") then 9 | { 10 | _object removeAction _getOutEventID; 11 | }; 12 | 13 | _getOutEventID = _object addEventHandler ["GetOut", { 14 | _veh = _this select 0; 15 | _unit = _this select 2; 16 | _vehBase = attachedTo _veh; 17 | _v_dir = direction _vehBase; 18 | _new_pos = _veh getPos [2.0, _v_dir-90]; 19 | _unit setPos _new_pos; 20 | }]; 21 | _object setVariable ["jnl_getOutGunnerEventID", _getOutEventID, false]; 22 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_removeVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | if(!isserver)exitWith{}; 3 | 4 | params ["_name","_index","_object"]; 5 | 6 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 7 | pr _vehicleList = (_vehicleLists select _index); 8 | 9 | { 10 | pr _data = _x; 11 | pr _name2 = _data select 0; 12 | if(_name isEqualTo _name2)exitWith{ 13 | _vehicleList deleteAt _foreachindex; 14 | }; 15 | } forEach _vehicleList; 16 | 17 | 18 | //update all clients that are looking in the garage 19 | pr _clients = missionnamespace getVariable ["jng_playersInGarage",[]]; 20 | if!(_clients isEqualTo [])then{ 21 | ["removeVehicle",[_data,_index]] remoteExecCall ["jn_fnc_garage",_clients]; 22 | }; 23 | 24 | 25 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_getCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Sparker 5 | 6 | Description: 7 | Returns an array with objects loaded with JNL 8 | 9 | Parameter(s): 10 | OBJECT _vehicle, 11 | INTEGER _type 12 | 13 | Returns: 14 | ARRAY: [object_0, object_1, etc...] 15 | */ 16 | 17 | params ["_vehicle",["_type",-1]]; 18 | 19 | pr _cargo = []; 20 | pr _jnl_cargo = 0; 21 | { 22 | pr _object = _x; 23 | pr _jnl_cargo = _object getVariable ["jnl_cargo", Nil]; 24 | if (! isNil "_jnl_cargo") then 25 | { 26 | if(_type == -1 || _type == (_jnl_cargo select 0) )then{ 27 | _cargo pushBack _object; 28 | }; 29 | }; 30 | } forEach attachedObjects _vehicle; 31 | 32 | //return 33 | _cargo 34 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | //init fuel stations 4 | 5 | private _size = (worldName call BIS_fnc_mapSize)/2; 6 | private _terrainObjs = nearestTerrainObjects [[_size,_size,0], ["FUELSTATION"], _size*1.42]; 7 | private _loc = []; 8 | { 9 | private _pos = getPos _x; 10 | 11 | //_markerstr = createMarker [str _x, _pos]; 12 | //_markerstr setMarkerShape "ICON"; 13 | //_markerstr setMarkerType "hd_dot"; 14 | _pos deleteAt 2; 15 | _loc pushBack _pos; 16 | 17 | }forEach _terrainObjs; 18 | 19 | { 20 | private _station = nearestObject _x; 21 | _station call jn_fnc_fuel_vehicleInit; 22 | }forEach _loc; 23 | 24 | //init mission file placed vehicles 25 | { 26 | _x call jn_fnc_fuel_vehicleInit; 27 | }forEach vehicles; -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_vehicleInit.sqf: -------------------------------------------------------------------------------- 1 | // init function thats runned from inside the addon config 2 | 3 | params[["_vehicle",objNull,[objNull]]]; 4 | 5 | private _jn_fuel_capacity = getNumber(configfile >> "CfgVehicles" >> typeOf _vehicle>> "jn_fuel_capacity"); 6 | private _jn_fuel_cargoCapacity = getNumber(configfile >> "CfgVehicles" >> typeOf _vehicle>> "jn_fuel_cargoCapacity"); 7 | 8 | if(_jn_fuel_capacity > 0)then{ 9 | [_vehicle,_jn_fuel_capacity] call JN_fnc_fuel_setCapacity; 10 | //set fuel starting condition 11 | _vehicle setFuel random [0.3, 0.6, 0.9]; 12 | }; 13 | 14 | if(_jn_fuel_cargoCapacity > 0)then{ 15 | [_vehicle,_jn_fuel_cargoCapacity,round random[0,0.6*_jn_fuel_cargoCapacity,_jn_fuel_cargoCapacity]] call jn_fnc_fuel_addActionRefuel; 16 | }; 17 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_setCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]]]; 4 | 5 | pr _cap = [_vehicle] call JN_fnc_ammo_getCargoCapacity; 6 | if(_cap==0 || {_amount > _cap} || {_amount < 0})exitWith{false}; 7 | 8 | _vehicle setVariable ["jn_ammo_cargo",_amount]; 9 | 10 | //update vehicle mass 11 | pr _mass = _vehicle getVariable ["jn_mass", getmass _vehicle];//save default mass 12 | _vehicle setVariable ["jn_mass", _mass]; 13 | _vehicle setMass (_mass * (1+((FLOAT_MASSMULTIPLIER-1)*_amount/_cap))); 14 | 15 | pr _id = _vehicle getVariable "rearmAction_id"; 16 | if(!isNil "_id")then{ 17 | ACTION_SET_ICON_AND_TEXT(_vehicle, _id, STR_ACTION_TEXT_REARM(_amount,_cap), STR_ACTION_ICON_REARM); 18 | }; 19 | 20 | true; -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_setCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]],["_amount",0,[0]],["_global",false]]; 4 | 5 | pr _cap = [_vehicle] call JN_fnc_fuel_getCargoCapacity; 6 | if(_cap==0 || {_amount > _cap} || {_amount < 0})exitWith{}; 7 | 8 | _vehicle setVariable ["jn_fuel_cargo",_amount,_global]; 9 | 10 | //update vehicle mass 11 | if(_global)then{ 12 | pr _mass = _vehicle getVariable ["jn_mass", getmass _vehicle];//save default mass 13 | _vehicle setVariable ["jn_mass", _mass]; 14 | _vehicle setMass (_mass * (1+((FLOAT_MASSMULTIPLIER-1)*_amount/_cap))); 15 | }; 16 | 17 | pr _id = _vehicle getVariable "refuelAction_id"; 18 | if(!isNil "_id")then{ 19 | _vehicle setUserActionText [_id, STR_ACTION_REFUEL(_amount,_cap)]; 20 | }; -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_lockVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params[["_name","",[""]],["_index",-1,[1]],["_locked",-1,[1]],"_object"]; 4 | 5 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 6 | pr _vehicleList = (_vehicleLists select _index); 7 | 8 | { 9 | pr _data = _x; 10 | pr _name2 = _x select 0; 11 | if(_name2 isEqualTo _name)exitWith{ 12 | _data set [2,_locked]; 13 | _vehicleList set [_foreachindex,_data]; 14 | }; 15 | } forEach _vehicleList; 16 | 17 | _vehicleLists set [_index,_vehicleList]; 18 | _object setVariable ["jng_vehicleLists", _vehicleLists]; 19 | 20 | //update all clients that are looking in the garage 21 | ["updateVehicleSingleData",[_name,_index,nil,_locked]] remoteExecCall ["jn_fnc_garage",missionnamespace getVariable ["jng_playersInGarage",[]]]; 22 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_rearm.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | rearm vehicle with objects that have ammoCargo. 8 | used by addActionRearm 9 | 10 | Parameter(s): 11 | object: object to rearm 12 | object: object to rearm from 13 | 14 | Returns: 15 | 16 | 17 | */ 18 | 19 | params["_vehicleTo","_vehicleFrom"]; 20 | 21 | //get cost 22 | pr _totalCost = 0; 23 | pr _costs = _vehicleTo call JN_fnc_ammo_getLoadoutCost; 24 | { 25 | _totalCost = _totalCost + _x; 26 | }forEach (_costs select 2); 27 | 28 | pr _cargo = _vehicleFrom call JN_fnc_ammo_getCargo; 29 | if(_totalCost > _cargo)exitWith{hint "to less points"}; 30 | 31 | [_vehicleFrom,(_cargo - _totalCost)] call JN_fnc_ammo_setCargo; 32 | 33 | _vehicleTo setVehicleAmmo 1; 34 | 35 | hint "Vehicle rearmed"; -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_releaseVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | if(!isserver)exitWith{}; 4 | 5 | params["_data","_index","_object"]; 6 | 7 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 8 | pr _vehicleList = (_vehicleLists select _index); 9 | 10 | pr _name = _data select 0; 11 | _data set [1,""];//set beingChanged to non so others can edit it 12 | 13 | { 14 | pr _name2 = _x select 0; 15 | if(_name2 isEqualTo _name)exitWith{ 16 | _vehicleList set [_foreachindex,_data]; 17 | }; 18 | } forEach _vehicleList; 19 | 20 | _vehicleLists set [_index,_vehicleList]; 21 | _object setVariable ["jng_vehicleLists", _vehicleLists]; 22 | 23 | //update all clients that are looking in the garage 24 | ["updateVehicle",[_data,_index]] remoteExecCall ["jn_fnc_garage",missionnamespace getVariable ["jng_playersInGarage",[]]]; 25 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_getCargoType.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Returns the type of object that you want to load 8 | 9 | Parameter(s): 10 | OBJECT vehicle 11 | OBJECT object to load on vehicle 12 | 13 | Returns: 14 | //-1 if type of this is not found, otherwise returns the cargo type 15 | */ 16 | 17 | 18 | params ["_object"]; 19 | 20 | //pr _simulation = tolower gettext (configfile >> "CfgVehicles" >> (typeOf _object) >> "simulation"); 21 | //pr _type = if(_simulation isEqualTo "tankx")then{0}else{1};//0 = weapon, 1 = cargo 22 | _objectModel = getText(configfile >> "CfgVehicles" >> typeOf _object >> "model"); 23 | _return = -1; 24 | { 25 | if(_x select 0 isEqualTo _objectModel) exitWith {_return = _x select 3;}; 26 | }forEach jnl_attachmentOffset; 27 | 28 | _return 29 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadoutMissing.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle"]; 4 | 5 | pr _loadoutCfg = _vehicle call JN_fnc_ammo_getLoadoutCfg; 6 | pr _loadoutCurrent = _vehicle call JN_fnc_ammo_getLoadoutCurrent; 7 | pr _loadoutMissing = []; 8 | pr _turrets = []; 9 | { 10 | pr _turret = _x; 11 | pr _loadoutCurrentIndex = _forEachIndex; 12 | { 13 | 14 | if(_turret isEqualTo _x)exitWith{ 15 | 16 | pr _missing = [ 17 | (_loadoutCfg select 1 select _forEachIndex), 18 | (_loadoutCurrent select 1 select _loadoutCurrentIndex) 19 | ] call jn_fnc_common_array_remove; 20 | if!(_missing isEqualTo [])then{ 21 | 22 | _turrets pushBack _turret; 23 | _loadoutMissing pushBack _missing; 24 | } 25 | 26 | }; 27 | }forEach (_loadoutCfg select 0); 28 | }forEach (_loadoutCurrent select 0); 29 | 30 | [_turrets, _loadoutMissing] 31 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/Vehicle/fn_common_vehicle_getVehicleType.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | 4 | 5 | params["_vehicle"]; 6 | 7 | pr _type = typeOf _vehicle; 8 | pr _cfg = (configfile >> "CfgVehicles" >> _type); 9 | pr _simulation = gettext (_cfg >> "simulation"); 10 | 11 | 12 | pr _index = switch (tolower _simulation) do { 13 | case "car"; 14 | case "carx": { 15 | TYPE_CAR; 16 | }; 17 | case "tank"; 18 | case "tankx": { 19 | if (getnumber (_cfg >> "maxspeed") > 0) then { 20 | TYPE_ARMOR; 21 | } else { 22 | TYPE_STATIC; 23 | }; 24 | }; 25 | case "helicopter"; 26 | case "helicopterx"; 27 | case "helicopterrtd": { 28 | TYPE_HELI; 29 | }; 30 | case "airplane"; 31 | case "airplanex": { 32 | TYPE_PLANE; 33 | }; 34 | case "ship"; 35 | case "shipx"; 36 | case "submarinex": { 37 | TYPE_NAVAL; 38 | }; 39 | default {-1}; 40 | }; 41 | 42 | //return 43 | _index 44 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_setCargo.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_object",objNull,[objNull]],["_amount",0,[0]],["_global",false]]; 4 | 5 | pr _isUnit = _object isKindOf "Man"; 6 | 7 | pr _cap = [_object] call JN_fnc_repair_getCargoCapacity; 8 | if(_amount > _cap || {_amount < 0} || {!_isUnit && _cap==0 })exitWith{false}; 9 | 10 | _object setVariable ["jn_repair_cargo",_amount]; 11 | 12 | //update vehicle mass 13 | if(!_isUnit)then{ 14 | pr _mass = _object getVariable ["jn_mass", getmass _object];//save default mass 15 | _object setVariable ["jn_mass", _mass]; 16 | _object setMass (_mass * (1+((FLOAT_MASSMULTIPLIER-1)*_amount/_cap))); 17 | 18 | pr _id = _object getVariable ["repairAction_id",nil];//error here? you need to initilise action first 19 | if(!isNil "_id")then{ 20 | _object setUserActionText [_id, STR_ACTION_REPAIR(_amount,_cap)]; 21 | }; 22 | }; 23 | 24 | true; -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_addActionUnload.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _unloadActionID = _vehicle getVariable ["jnl_unloadActionID", Nil]; 6 | 7 | //Check if action exists already 8 | if(!isnil "_unloadActionID") then 9 | { 10 | _vehicle removeAction _unloadActionID; 11 | }; 12 | 13 | //add action 14 | _unloadActionID = _vehicle addAction [ 15 | "Unload", 16 | { 17 | //(_this select 0) call jn_fnc_logistics_unLoad 18 | [_this select 0] remoteexec ["jn_fnc_logistics_unload", 2]; 19 | }, Nil, 1, true, false, "", "vehicle player == player && !(_target getVariable ['jnl_isUnloading',false]);", 5, false, "" 20 | ]; 21 | _vehicle setUserActionText [ 22 | _unloadActionID, 23 | "Unload Cargo", 24 | "" 25 | ]; 26 | _vehicle setVariable ["jnl_unloadActionID", _unloadActionID, false]; 27 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_requestOpen.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Sends a command to the client to open the arsenal. It also adds the client to the serverlist so it knows which players need to be updated if a item gets removed/added. This command needs to be excuted on the server! 8 | 9 | Parameter(s): 10 | ID clientOwner 11 | 12 | Returns: 13 | NOTHING, well it sends a command which contains the JNA_datalist 14 | */ 15 | 16 | if(!isServer)exitWith{}; 17 | params ["_clientOwner","_object"]; 18 | 19 | pr _temp = _object getVariable ["jna_inUseBy",[]]; 20 | _temp pushBackUnique _clientOwner; 21 | _object setVariable ["jna_inUseBy",_temp,true]; 22 | 23 | 24 | pr _jna_dataList = _object getVariable "jna_dataList"; 25 | 26 | diag_log ["open arsenal for: clientOwner ",_clientOwner,_object]; 27 | ["Open",[_jna_dataList]] remoteExecCall ["jn_fnc_arsenal", _clientOwner]; 28 | 29 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_addActionGetinWeapon.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle","_object"]; 4 | 5 | pr _getInGunnerActionID = _vehicle getVariable ["jnl_getInGunnerActionID", nil]; 6 | 7 | //Check if action exists already 8 | if(!isnil "_getInGunnerActionID") then 9 | { 10 | _vehicle removeAction _getInGunnerActionID; 11 | }; 12 | 13 | _getInGunnerActionID = _vehicle addAction [ 14 | "Get in Static", 15 | { 16 | pr _vehicle = _this select 0; 17 | player moveInGunner ([_vehicle] call jn_fnc_logistics_getCargo select 0); 18 | }, Nil, 0, true, false, "", "vehicle player == player", 5, false, "" 19 | ]; 20 | _vehicle setUserActionText [ 21 | _getInGunnerActionID, 22 | "Get in "+(getText(configFile>>"cfgVehicles">>typeof _object>>"DisplayName")), 23 | "" 24 | ]; 25 | _vehicle setVariable ["jnl_getInGunnerActionID", _getInGunnerActionID, false]; 26 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_requestOpen.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Sends a command to the client to open the garage. It also adds the client to the serverlist so the server knows which players 7 | need to be updated when vehicles get removed/added/changed. This command needs to be excuted on the server! 8 | 9 | Parameter(s): 10 | ID clientOwner 11 | 12 | Returns: 13 | NOTHING, well it sends a command which contains the jng_vehicleList and jng_ammoList 14 | */ 15 | 16 | if(!isServer)exitWith{}; 17 | params ["_clientOwner","_object"]; 18 | 19 | pr _temp = _object getVariable ["jng_inUseBy",[]]; 20 | _temp pushBackUnique _clientOwner; 21 | _object setVariable ["jng_playersInGarage",_temp,true]; 22 | 23 | diag_log ["open Garage for: clientOwner ",_clientOwner]; 24 | 25 | //call compile preProcessFileLineNumbers "JeroenArsenal\JNG\recompile.sqf"; 26 | ["Open",[_object]] remoteExecCall ["jn_fnc_garage", _clientOwner]; -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadoutCost.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Get loadout cost per turrets 8 | 9 | Parameter(s): 10 | Object 11 | 12 | Returns: 13 | 14 | Usage: No use for end user, use garage_init instead 15 | 16 | */ 17 | 18 | params ["_vehicle"]; 19 | 20 | pr _missingAmmoTurrets = _vehicle call JN_fnc_ammo_getLoadoutMissing; 21 | 22 | pr _turretCost = []; 23 | { 24 | pr _missingAmmoTurret = _x; 25 | pr _cost = 0; 26 | { 27 | _x params ["_magClass","_amount"]; 28 | _cost = _cost + (([_magClass] call JN_fnc_ammo_getCost) * _amount); 29 | 30 | }forEach _missingAmmoTurret; 31 | _turretCost pushBack _cost; 32 | }forEach (_missingAmmoTurrets select 1); 33 | 34 | pr _pylonCost = []; 35 | { 36 | _x params ["_magClass","_amount"]; 37 | _pylonCost pushback (([_magClass] call JN_fnc_ammo_getCost) * _amount); 38 | }foreach (_vehicle call JN_fnc_ammo_getPylonLoadoutMissing); 39 | 40 | [_missingAmmoTurrets select 0, _turretCost, _pylonCost]; -------------------------------------------------------------------------------- /JeroenArsenal/Repair/getLoadout.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle"]; 4 | 5 | pr _currentLoadout = []; 6 | pr _magDetail = magazinesAllTurrets _vehicle; 7 | pr _pylonList = getPylonMagazines _vehicle; 8 | pr _pylonRun = 1; 9 | { 10 | pr _magClass = _x select 0; 11 | pr _turretPath = _x select 1; 12 | pr _ammoCount = _x select 2; 13 | pr _pylon = -1; 14 | if (_magclass in _pylonList) then 15 | {_pylon = _pylonRun;_pylonRun = _pylonRun + 1; 16 | _currentLoadout pushBack [_turretPath, _pylon, _magClass, _ammoCount]; 17 | } else 18 | { 19 | pr ["_tempAmmo", "_inserted"]; 20 | pr _inserted = false; 21 | { 22 | if ((_x select 0) isEqualTo _turretPath && (_x select 2) isEqualTo _magClass) then 23 | { 24 | _tempAmmo = (_x select 3); 25 | _x set [3, (_tempAmmo + _ammoCount)]; 26 | _inserted = true; 27 | }; 28 | } forEach _currentLoadout; 29 | 30 | if (!_inserted) then 31 | { 32 | _currentLoadout pushBack [_turretPath, _pylon, _magClass, _ammoCount]; 33 | }; 34 | }; 35 | } forEach _magDetail; 36 | 37 | _currentLoadout; -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_canGarageVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [ ["_vehicle",objNull,[objNull]], ["_object",objNull,[objNull]]]; 4 | 5 | if (isNull _vehicle) exitWith {"You are not looking at a vehicle"}; 6 | if !(alive _vehicle) exitWith {"You cannot add destroyed vehicles to your garage"}; 7 | if ({isPlayer _x} count crew _vehicle > 0) exitWith {"In order to store vehicle, its crew must disembark."}; 8 | 9 | //check if its a vehicle 10 | pr _index = _vehicle call jn_fnc_common_vehicle_getVehicleType; 11 | if (_index == -1) exitWith {"You are not looking at a vehicle"}; 12 | 13 | //check if vehicle is locked. If not, current player is considered as the valid user to store 14 | _uid = getPlayerUID player; pr _owner = _vehicle getVariable["vehOwner", _uid]; 15 | if!(_owner isEqualTo _uid)exitWith{"This is not my vehicle, I need to ask the owner to unlock it first"}; 16 | 17 | //max distance 18 | if (_vehicle distance _object > MAX_DISTANCE_TO_STORE) exitWith {format["Vehicle must be within %1m of the flag",MAX_DISTANCE_TO_STORE]}; 19 | 20 | //return 21 | ""; 22 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_removeItem.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object"]; 4 | 5 | pr "_array"; 6 | 7 | if(typeName (_this select 1) isEqualTo "SCALAR")then{//[_index, _item] and [_index, _item, _amount]; 8 | params["","_index","_item",["_amount",1]]; 9 | _array = EMPTY_ARRAY; 10 | _array set [_index,[[_item,_amount]]]; 11 | }else{ 12 | _array = _this select 1; 13 | }; 14 | 15 | { 16 | pr _index = _forEachIndex; 17 | { 18 | pr _item = _x select 0; 19 | pr _amount = _x select 1; 20 | 21 | if!(_item isEqualTo "")then{ 22 | 23 | if(_index == -1)exitWith{["ERROR in additemarsenal: %1", _this] call BIS_fnc_error}; 24 | if(_index == IDC_RSCDISPLAYARSENAL_TAB_CARGOMAG)then{_index = IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL}; 25 | 26 | //update 27 | pr _playersInArsenal = +(_object getVariable ["jna_inUseBy",[]]); 28 | if!(0 in _playersInArsenal)then{_playersInArsenal pushBackUnique 2;}; 29 | ["UpdateItemRemove",[_index, _item, _amount,_object]] remoteExecCall ["jn_fnc_arsenal",_playersInArsenal]; 30 | }; 31 | } forEach _x; 32 | }foreach _array; 33 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadoutCurrent.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params[["_vehicle",objNull,[objNull]]]; 4 | 5 | pr _turrets = []; 6 | pr _totalLoadout = []; 7 | pr _magDetail = magazinesAllTurrets _vehicle; 8 | 9 | pr "_turretLoadout"; 10 | { 11 | _x params ["_magClass","_turretPath","_ammoCount"]; 12 | if!(_turretPath in _turrets)then{ 13 | _turrets pushBack _turretPath; 14 | if(!isNil "_turretLoadout")then{_totalLoadout pushBack _turretLoadout;};//skip first one 15 | _turretLoadout = []; 16 | }; 17 | 18 | pr _inserted = false; 19 | { 20 | _x params ["_magClassList","_ammoCountList"]; 21 | if(_magClassList isEqualTo _magClass) then 22 | { 23 | _x set [1, (_ammoCountList + _ammoCount)]; 24 | _inserted = true; 25 | }; 26 | } forEach _turretLoadout; 27 | 28 | if (!_inserted) then 29 | { 30 | _turretLoadout pushBack [_magClass, _ammoCount]; 31 | }; 32 | 33 | } forEach _magDetail; 34 | 35 | _totalLoadout pushBack _turretLoadout; 36 | 37 | _pylonLoadout = []; 38 | { 39 | _pylonLoadout pushBack [_x,_vehicle ammoOnPylon (_forEachIndex + 1)] 40 | }forEach (getPylonMagazines _vehicle); 41 | 42 | 43 | [_turrets,_totalLoadout,_pylonLoadout]; 44 | 45 | 46 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_getNodes.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Returns the nodes that the vehicle has, if the vehicle is not initilized it will be done as well 8 | 9 | Parameter(s): 10 | OBJECT vehicle, 11 | INT (optinal) type, if you only need specific node type 12 | 13 | Returns: 14 | ARRAY nodes 15 | */ 16 | 17 | params ["_vehicle",["_type",-1]]; 18 | 19 | pr _nodes = _vehicle getVariable ["jnl_nodes",nil]; 20 | 21 | if(isNil "_nodes")then{ 22 | _nodes = []; 23 | pr _model = gettext (configfile >> "CfgVehicles" >> (typeOf _vehicle) >> "model"); 24 | { 25 | pr _model2 = _x select 0; 26 | if(_model isEqualTo _model2)exitWith{ 27 | _nodes = _x select 1; 28 | }; 29 | } forEach jnl_vehicleHardpoints; 30 | 31 | _vehicle setVariable ["jnl_nodes",_nodes]; 32 | }; 33 | 34 | if(_type != -1)then{ 35 | _nodesNew = []; 36 | { 37 | _type2 = _x select 0; 38 | if(_type == _type2)then{ 39 | _location = _x select 1; 40 | _lockedSeats = _x select 2; 41 | _nodesNew pushBack [_location,_lockedSeats]; 42 | }; 43 | } forEach _nodes; 44 | _nodes = _nodesNew; 45 | }; 46 | 47 | //return 48 | _nodes 49 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/Vehicle/fn_common_vehicle_getSeatNames.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Gets array of seats with there index and a propper name 8 | 9 | Parameter(s): 10 | Object - vehicle with seats 11 | 12 | Returns: 13 | Array - array of turretId and names [[-1],["Driver"]] 14 | 15 | Usage: object call JN_fnc_common_vehicle_getSeatNames; 16 | 17 | */ 18 | 19 | params["_vehicle"]; 20 | pr _turretsArrayName = [typeof _vehicle, true] call BIS_fnc_allTurrets; 21 | pr _turretCfgs = ([_vehicle] call BIS_fnc_getTurrets); 22 | if(count _turretsArrayName != count _turretCfgs)then{ _turretsArrayName = [[-1]] + _turretsArrayName;}; 23 | pr _turrets = []; 24 | pr _names = []; 25 | { 26 | _x params ["_cfgTurret"]; 27 | pr _arrayName = (_turretsArrayName select _forEachIndex); 28 | pr "_name"; 29 | if(_arrayName isEqualTo [-1])then{ 30 | _name = ["Driver","Pilot"] select(_vehicle isKindOf "Helicopter"); 31 | }else{ 32 | _name = getText(_cfgTurret >> "gunnerName"); 33 | }; 34 | pr _magazineArray = getArray (_cfgTurret >> "magazines"); 35 | 36 | _turrets pushBack _arrayName; 37 | _names pushBack _name; 38 | } forEach _turretCfgs; 39 | 40 | [_turrets,_names]; -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_addVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | if(!isserver)exitWith{}; 4 | 5 | params ["_data","_index","_object"]; 6 | 7 | pr _name = _data select 0; 8 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 9 | pr _vehicleList = _vehicleLists select _index; 10 | 11 | pr _nr = 1; 12 | pr _newName = (_name + " nr:"+ str _nr); 13 | 14 | //check if name is already in the list 15 | pr _nameExist = { 16 | _return = false; 17 | { 18 | _nameCheck = _x select 0; 19 | if(_newName isEqualTo _nameCheck)exitWith{ 20 | _return = true; 21 | }; 22 | } forEach _vehicleList; 23 | _return 24 | }; 25 | 26 | //find a name that doesnt exist yet 27 | while {call _nameExist} do { 28 | _nr = _nr + 1; 29 | _newName = (_name + " nr:" + str _nr); 30 | }; 31 | 32 | //update name and save 33 | _data set [0, _newName]; 34 | 35 | _vehicleList pushback _data; 36 | _vehicleLists set [_index,_vehicleList]; 37 | _object setVariable ["jng_vehicleLists",_vehicleLists]; 38 | 39 | 40 | //update all clients that are looking in the garage 41 | pr _clients = missionnamespace getVariable ["jng_playersInGarage",[]]; 42 | if!(_clients isEqualTo [])then{ 43 | ["addVehicle",[_data,_index]] remoteExecCall ["jn_fnc_garage",_clients]; 44 | }; 45 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define FLOAT_MASSMULTIPLIER 1.3 4 | #define INT_MAX_DISTANCE_TO_REREARM 6 5 | 6 | 7 | //ACTION TEXT AND ICON 8 | #define STR_ACTION_ICON_REARM "\A3\ui_f\data\IGUI\Cfg\Actions\reammo_ca.paa" //TODO 9 | #define STR_ACTION_TEXT_REARM(AMOUNT,TOTAL_AMOUNT) format["%1 [%2/%3]",localize "STR_JN_AMMO_ACT_REARM",AMOUNT,TOTAL_AMOUNT] 10 | 11 | 12 | #define FADE_DELAY 0.15 13 | 14 | #define IDC_AMMO_TAB_SEAT_1 IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON 15 | #define IDC_AMMO_TAB_SEAT_2 IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON 16 | #define IDC_AMMO_TAB_SEAT_3 IDC_RSCDISPLAYARSENAL_TAB_HANDGUN 17 | #define IDC_AMMO_TAB_SEAT_4 IDC_RSCDISPLAYARSENAL_TAB_UNIFORM 18 | #define IDC_AMMO_TAB_SEAT_5 IDC_RSCDISPLAYARSENAL_TAB_VEST 19 | #define IDC_AMMO_TAB_SEAT_6 IDC_RSCDISPLAYARSENAL_TAB_BACKPACK 20 | 21 | #define IDCS [IDC_AMMO_TAB_SEAT_1,IDC_AMMO_TAB_SEAT_2,IDC_AMMO_TAB_SEAT_3,IDC_AMMO_TAB_SEAT_4,IDC_AMMO_TAB_SEAT_5,IDC_AMMO_TAB_SEAT_6] 22 | 23 | #define IDC_AMMO_SEATBUTTON 300 24 | 25 | #define IDC_AMMO_LIST_MAGAZINES IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC 26 | 27 | #define AMMO_SEATBUTTON_WITDH 0.13 28 | 29 | #define MAGAZINE_TEXT(NAME,AMOUNTCURRENT,AMOUNT) format["%1 (%2/%3)",NAME,AMOUNTCURRENT,AMOUNT] -------------------------------------------------------------------------------- /JeroenArsenal/Test/buttonblocker.sqf: -------------------------------------------------------------------------------- 1 | disabledKeys = ["Gear"]; 2 | 3 | clicked = { 4 | params["_ctrl","_dikCode","_shiftKey","_ctrlKey","_altKey"]; 5 | 6 | hint "test"; 7 | { 8 | if(inputAction _x>0) exitWith { 9 | hint format["Key:%1 is disabled",_dikCode]; 10 | true; 11 | }; 12 | } count disabledKeys; 13 | 14 | }; 15 | 16 | _display = finddisplay 46; 17 | waituntil {!isnull _display}; 18 | _display displayAddEventHandler ["KeyDown",{_this call clicked}]; 19 | _display = finddisplay 46; 20 | _display displayAddEventHandler ["MouseButtonDown",{hint "test2"; true}]; 21 | 22 | 23 | 24 | 25 | removeAllActions player; 26 | 27 | player addAction ["", {vehicle player action ["CarBack",vehicle player]}, "", 0, false, true, "CarForward"]; 28 | 29 | //code to disable a weapon from firing 30 | JN_hideEmptyAction = { 31 | params ["_target","_caller","_id"]; 32 | ((_this select 4) isEqualTo ""); 33 | }; 34 | //ACE is using inGameUISetEventHandler and overwrites it. Need to find a fix for this 35 | inGameUISetEventHandler ["PrevAction", "_this call JN_hideEmptyAction;"]; 36 | inGameUISetEventHandler ["NextAction", "_this call JN_hideEmptyAction;"]; 37 | player addAction ["", {}, "", 0, false, true, "DefaultAction"]; -------------------------------------------------------------------------------- /JeroenArsenal/Repair/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define FLOAT_MASSMULTIPLIER 1.1 4 | #define INT_MAX_DISTANCE_TO_REPAIR 5 5 | 6 | #define STR_ACTION_REPAIR(REPAIRCARGO,REPAIRCARGOCAPACTIY) format ["%1 [%2/%3]",localize "STR_JN_REPAIR_ACT_REPAIR",REPAIRCARGO,REPAIRCARGOCAPACTIY] 7 | 8 | 9 | #define TYPE_WHEEL 0 10 | #define TYPE_TRACK 1 11 | #define TYPE_ENGINE 2 12 | #define TYPE_FUEL 3 13 | #define TYPE_BODY 4 14 | #define TYPE_HULL 5 15 | #define TYPE_GLASS 6 16 | #define TYPE_LIGHT 7 17 | 18 | #define TYPE_PARTS ["Wheel","Track","Engine","Fuel tank","Chassis","Body","Glass","Light"] 19 | 20 | //[_displayName,_type,_size,_armor,_wheelSize,_hitpoints,_selections,_hitTypes,_hitpointNames] 21 | #define VEHICLE_DATA_DISPLAYNAME 0 22 | #define VEHICLE_DATA_TYPE 1 23 | #define VEHICLE_DATA_SIZE 2 24 | #define VEHICLE_DATA_ARMOR 3 25 | #define VEHICLE_DATA_WHEELSIZE 4 26 | #define VEHICLE_DATA_HITPOINTS 5 27 | #define VEHICLE_DATA_SELECTIONS 6 28 | #define VEHICLE_DATA_HITTYPES 7 29 | 30 | 31 | #define SKILL_REQUIRED_PART [\ 32 | 0.1,\ 33 | 0.4,\ 34 | 0.2,\ 35 | 0.2,\ 36 | 0.2,\ 37 | 0.2,\ 38 | 0.5,\ 39 | 0.2]\ 40 | 41 | #define SKILL_REQUIRED_VEHICLE [\ 42 | 0.1,\ 43 | 0.5,\ 44 | 0.8,\ 45 | 0.8,\ 46 | 0.3,\ 47 | 0.2]\ 48 | 49 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_garageVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Adds vehicle to garage with checking distance 7 | 8 | Parameter(s): 9 | Object 10 | 11 | Returns: 12 | 13 | Usage: object call jn_fnc_garage_garageVehicle; 14 | 15 | */ 16 | 17 | #include "defineCommon.inc" 18 | 19 | params [ ["_vehicle",objNull,[objNull]] ,["_object",objNull,[objNull]]]; 20 | 21 | //incase you are looking to attached item 22 | if !(isnull (attachedto _vehicle))then{_vehicle = attachedto _vehicle}; 23 | 24 | //close if it couldnt save 25 | _message = [_vehicle,_object] call jn_fnc_garage_canGarageVehicle; 26 | if!(_message isEqualTo "")exitWith {hint _message}; 27 | 28 | //save it on server 29 | pr _data = _vehicle call jn_fnc_garage_getVehicleData; 30 | pr _index = _vehicle call jn_fnc_common_vehicle_getVehicleType; 31 | [_data,_index,_object] remoteExecCall ["jn_fnc_garage_addVehicle",2]; 32 | 33 | //delete attach weapon 34 | pr _attachItems = []; 35 | { 36 | pr _type = (_x getVariable ["jnl_cargo",[-1,0]]) select 0; 37 | if(_type == 0)then{ 38 | _x hideObject true; 39 | detach _x; 40 | deleteVehicle _x; 41 | }; 42 | } forEach attachedObjects _vehicle; 43 | 44 | deleteVehicle _vehicle; 45 | 46 | //set message it was saved 47 | SPLIT_SAVE 48 | hint (_name + " stored in garage"); 49 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_addItem.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_object"]; 4 | 5 | pr "_array"; 6 | 7 | if(typeName (_this select 1) isEqualTo "SCALAR")then{//[_index, _item] and [_index, _item, _amount]; 8 | params["","_index","_item",["_amount",1]]; 9 | _array = EMPTY_ARRAY; 10 | _array set [_index,[[_item,_amount]]]; 11 | }else{ 12 | _array = _this select 1; 13 | }; 14 | 15 | { 16 | pr _index = _forEachIndex; 17 | { 18 | pr _item = _x select 0; 19 | pr _amount = _x select 1; 20 | 21 | 22 | if!(_item isEqualTo "" || {_item isEqualTo "ACE_PreloadedMissileDummy"}) then{ 23 | 24 | if(_index == -1)exitWith{["ERROR in additemarsenal: %1", _this] call BIS_fnc_error}; 25 | if(_index == IDC_RSCDISPLAYARSENAL_TAB_CARGOMAG)then{_index = IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL}; 26 | 27 | //TFAR fix 28 | pr _radioName = getText(configfile >> "CfgWeapons" >> _item >> "tf_parent"); 29 | if!(_radioName isEqualTo "")then{_item = _radioName}; 30 | 31 | //fix for hosted sp 32 | pr _playersInArsenal = +(_object getVariable ["jna_inUseBy",[]]); 33 | if!(0 in _playersInArsenal)then{_playersInArsenal pushBackUnique 2;}; 34 | 35 | //update 36 | ["UpdateItemAdd",[_index, _item, _amount, _object]] remoteExecCall ["jn_fnc_arsenal",_playersInArsenal]; 37 | 38 | }; 39 | } forEach _x; 40 | }foreach _array; 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_consumption_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | increasses fuel consumption for a unit while driving a vehicle. 8 | unit must be local in order for the script to be presistent after respawn 9 | 10 | Parameter(s): 11 | unit object 12 | 13 | Returns: 14 | 15 | Usage: "player call jn_fnc_fuel_consumption_init;" 16 | 17 | */ 18 | 19 | params["_unit"]; 20 | 21 | if((_this select 0) isEqualTo "postInit")then {_unit = player}; 22 | 23 | if(isnil "_unit")ExitWith{diag_log "jn_fnc_fuel_consumption_init error 1"}; 24 | 25 | diag_log ("JNG_FUEL start for player:" + name _unit); 26 | 27 | _unit addEventHandler ["GetInMan", { 28 | params ["_unit", "_role", "_vehicle", "_turret"]; 29 | if(_role isEqualTo "driver")then{ 30 | _unit call jn_fnc_fuel_consumption_start; 31 | }; 32 | }]; 33 | 34 | _unit addEventHandler ["GetOutMan", { 35 | params ["_unit", "_role", "_vehicle", "_turret"]; 36 | if(_role isEqualTo "driver")then{ 37 | _unit call jn_fnc_fuel_consumption_stop; 38 | }; 39 | }]; 40 | 41 | _unit addEventHandler ["SeatSwitchedMan", { 42 | params ["_unit1", "_unit2", "_vehicle"]; 43 | if((assignedVehicleRole _unit1 select 0) isEqualTo "driver")then{ 44 | _unit call jn_fnc_fuel_consumption_start; 45 | }else{ 46 | _unit call jn_fnc_fuel_consumption_stop; 47 | }; 48 | }]; 49 | 50 | 51 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadoutCfg.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle"]; 4 | pr _turretsArrayName = [typeof _vehicle, true] call BIS_fnc_allTurrets; 5 | pr _turretCfgs = ([_vehicle] call BIS_fnc_getTurrets); 6 | if(count _turretsArrayName != count _turretCfgs)then{ _turretsArrayName = [[-1]] + _turretsArrayName;};//add driver 7 | pr _turrets = []; 8 | pr _totalLoadout = []; 9 | 10 | { 11 | pr _turretLoadout = []; 12 | _x params ["_cfgTurret"]; 13 | pr _magazineArray = getArray (_cfgTurret >> "magazines"); 14 | 15 | { 16 | _x params["_magClass"]; 17 | pr _ammoCount = getNumber(configfile >> "CfgMagazines" >> _magClass >> "count"); 18 | pr _inserted = false; 19 | { 20 | _x params ["_magClassList","_ammoCountList"]; 21 | if(_magClassList isEqualTo _magClass) then 22 | { 23 | _x set [1, (_ammoCountList + _ammoCount)]; 24 | _inserted = true; 25 | }; 26 | } forEach _turretLoadout; 27 | 28 | if (!_inserted) then 29 | { 30 | _turretLoadout pushBack [_magClass, _ammoCount]; 31 | }; 32 | }forEach _magazineArray; 33 | if(count _turretLoadout != 0)then{ 34 | _turrets pushBack (_turretsArrayName select _forEachIndex); 35 | _totalLoadout pushBack _turretLoadout; 36 | }; 37 | } forEach _turretCfgs; 38 | 39 | _pylonLoadout = []; 40 | { 41 | _pylonLoadout pushBack [_x, getNumber(configfile >> "CfgMagazines" >> _x >> "count")] 42 | }forEach (getPylonMagazines _vehicle); 43 | 44 | [_turrets,_totalLoadout,_pylonLoadout]; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_initPersistent.sqf: -------------------------------------------------------------------------------- 1 | /* 2 | Extends fn_arsenal_init. 3 | Initializes the arsenal persistently, handles generation of a unique JIP ID string. 4 | Must run on the server. 5 | 6 | Author: Sparker 7 | */ 8 | 9 | #define __JIPID(ID) format ["jna_init_%1", ID] 10 | 11 | if (!isServer) exitWith {}; 12 | 13 | params [["_object", objNull, [objNull]], ["_initialValue", []]]; 14 | 15 | // Bail if a null object is passed (why??) 16 | if (isNull _object) exitWith {}; 17 | 18 | // Set initial arsenal item array value 19 | if (count _initialValue > 0) then { 20 | _object setVariable ["jna_datalist", _initialValue]; 21 | }; 22 | 23 | // Generate a JIP ID 24 | private _ID = 0; 25 | if(isNil "jna_nextID") then { 26 | jna_nextID = 0; 27 | _ID = 0; 28 | } else { 29 | _ID = jna_nextID; 30 | }; 31 | jna_nextID = jna_nextID + 1; 32 | 33 | private _JIPID = __JIPID(_ID); 34 | _object setVariable ["jna_id", _ID]; 35 | [_object] remoteExecCall ["jn_fnc_arsenal_init", 0, _JIPID]; // Execute globally, add to the JIP queue 36 | 37 | // Add an event handler to delete the init from the JIP queue when the object is gone 38 | _object addEventHandler ["Deleted", { 39 | params ["_entity"]; 40 | private _ID = _entity getVariable "jna_id"; 41 | if (isNil "_ID") exitWith { 42 | diag_log format ["JNA arsenal_initPersistent: error: no JIP ID for object %1", _entity]; 43 | }; 44 | private _JIPID = __JIPID(_ID); 45 | remoteExecCall ["", _JIPID]; // Remove it from the queue 46 | }]; -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_getCargoOffsetAndDir.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Returns the location and rotation of a object that needs to be set with attachTo and setVectorDirAndUp 8 | 9 | Parameter(s): 10 | OBJECT vehicle 11 | OBJECT object to load on vehicle 12 | 13 | Returns: 14 | ARRAY [attachTo location, setVectorDir] 15 | */ 16 | 17 | 18 | params ["_vehicle","_object","_nodeID"]; 19 | 20 | diag_log ["node",_nodeID]; 21 | 22 | //Find the location of node 23 | pr _typeNode = _object call jn_fnc_logistics_getCargoType; 24 | pr _nodePos = (([_vehicle,_typeNode] call jn_fnc_logistics_getNodes) select _nodeID) select 0; 25 | 26 | 27 | //Find the offset for _object 28 | pr _objectModel = gettext (configfile >> "CfgVehicles" >> typeOf _object >> "model"); 29 | pr _objectOffset = [0, 0, 0]; 30 | pr _objectDir = [1, 0, 0]; 31 | 32 | if(_typeNode == 0) then //Weapon objects use pre-defined offset 33 | { 34 | { 35 | if((_x select 0) isEqualTo _objectModel) exitWith{_objectOffset = _x select 1; _objectDir = _x select 2;} 36 | } foreach jnl_attachmentOffset; 37 | } 38 | else //Other objects use offset given by boundingCenter 39 | { 40 | { 41 | if((_x select 0) isEqualTo _objectModel) exitWith{_objectOffset = boundingCenter _object; _objectDir = _x select 2;} 42 | } foreach jnl_attachmentOffset; 43 | }; 44 | 45 | _objectOffset = _nodePos vectoradd _objectOffset; 46 | 47 | //return 48 | [_objectOffset,_objectDir] 49 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/test2.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | _vehicle = cursorObject; 3 | pr _cfg = (configfile >> "CfgVehicles" >> typeof _vehicle); 4 | 5 | pr _hitpoints = []; 6 | pr _selections = []; 7 | pr _hitType = []; 8 | pr _loopTurrets = { 9 | diag_log configName _this; 10 | pr _hitpointCfgs = configProperties [_this >> "HitPoints", "isClass _x", true]; 11 | { 12 | pr _selection = getText(_x >> "name"); 13 | if(_selection != "")then{ 14 | if((_vehicle selectionPosition [_selection,"HitPoints"]) isEqualTo [0,0,0])exitWith{}; 15 | pr _hitpoint = configName _x; 16 | _hitpoints pushBack _hitpoint; 17 | _selections pushBack getText(_x >> "name"); 18 | _hitType pushBack (_hitpoint call { 19 | if(_this find "hitfuel" != -1)exitWith{1}; 20 | if(_this find "hitengine" != -1)exitWith{2}; 21 | if(_this find "hitrtrack" != -1)exitWith{3}; 22 | if(_this find "hitltrack" != -1)exitWith{4}; 23 | }); 24 | }; 25 | 26 | }forEach _hitpointCfgs; 27 | 28 | pr _turretCfgs = configProperties [_this >> "Turrets", "isClass _x", true]; 29 | { 30 | _x call _loopTurrets; 31 | }forEach _turretCfgs; 32 | }; 33 | _cfg call _loopTurrets; 34 | 35 | [_hitpoints,_selections,_hitType] 36 | 37 | pr _reflectorsCfgs = configProperties [_cfg >> "Reflectors", "isClass _x", true]; 38 | { 39 | pr _reflectorsCfg = _x; 40 | _hitpoints pushBack ("#" + getText(_reflectorsCfg >> "hitpoint")); 41 | _selections pushBack getText(_reflectorsCfg >> "selection"); 42 | _hitType pushBack "light"; 43 | 44 | }forEach _reflectorsCfgs; -------------------------------------------------------------------------------- /JeroenArsenal/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "\A3\ui_f\hpp\defineDIKCodes.inc" 2 | #include "\A3\Ui_f\hpp\defineResinclDesign.inc" 3 | 4 | #define ERROR_JN_6(A,B,C,D,E,F) diag_log format["JN_ERROR: ,%1,%2,%3,%4,%5,%6",A,B,C,D,E,F] 5 | #define ERROR_JN_5(A,B,C,D,E) diag_log format["JN_ERROR: ,%1,%2,%3,%4,%5",A,B,C,D,E] 6 | #define ERROR_JN_4(A,B,C,D) diag_log format["JN_ERROR: ,%1,%2,%3,%4",A,B,C,D] 7 | #define ERROR_JN_3(A,B,C) diag_log format["JN_ERROR: ,%1,%2,%3",A,B,C] 8 | #define ERROR_JN_2(A,B) diag_log format["JN_ERROR: ,%1,%2",A,B] 9 | #define ERROR_JN_1(A) diag_log format["JN_ERROR: ,%1",A] 10 | 11 | 12 | 13 | 14 | 15 | #define pr private// Sparker Pr(ivate)© all rights resevered 16 | 17 | #define DISPLAYNAME_VEHICLE(OBJ) gettext (configfile >> "CfgVehicles" >> (typeOf OBJ) >> "displayName") 18 | #define DISPLAYNAME_MAG(MAG) gettext (configfile >> "CfgMagazines" >> MAG >> "displayName") 19 | #define DISPLAYNAME_AMMO(AMMO) gettext (configfile >> "CfgAmmo" >> AMMO >> "displayName") 20 | 21 | #define TYPE_CAR 0 22 | #define TYPE_ARMOR 1 23 | #define TYPE_HELI 2 24 | #define TYPE_PLANE 3 25 | #define TYPE_NAVAL 4 26 | #define TYPE_STATIC 5 27 | 28 | #define TYPE_VEHICLES ["Car","Armor","Heli","Plane","Naval","Static"] 29 | 30 | #define COLOR_ORANGE [1,0.64,0,1] 31 | #define COLOR_WHITE [1,1,1,1] 32 | 33 | 34 | #define ACTION_SET_ICON_AND_TEXT(OBJECT_ACTION,ID,NAME,ICON) OBJECT_ACTION setUserActionText [\ 35 | ID,NAME,"",format["",\ 36 | ICON\ 37 | ]\ 38 | ] 39 | 40 | #define ROUND_TO(FLOAT,INT) (round ((FLOAT)*10*(INT)))/(10*(INT)) 41 | 42 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/Array/fn_common_array_add.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | By: Jeroen Notenbomer 5 | 6 | Add amounts of same name togetter 7 | Use amount (-1) to set to unlimited 8 | 9 | Inputs: 10 | 1: list [["name1",amount1],["name2",amount2]] 11 | 2: item "name1" or ["name1",amount1] or [["name1",amount1],["name2",amount2]] 12 | 13 | Outputs 14 | list = Input1+Input2 15 | */ 16 | 17 | params["_list","_add"]; 18 | _list = +_list; 19 | 20 | if(typeName _add isEqualTo "STRING")then{_add = [_add,1];}; 21 | if(typeName (_add select 0) isEqualTo "STRING")then{_add = [_add]}; 22 | 23 | { 24 | pr _index = _forEachIndex; 25 | pr _name = _x select 0; 26 | pr _amount = _x select 1; 27 | 28 | if!(_name isEqualTo "")then{//skip empty 29 | 30 | pr _found = false; 31 | { 32 | pr _index2 = _forEachIndex; 33 | pr _name2 = _x select 0; 34 | pr _amount2 = _x select 1; 35 | 36 | if(_name isEqualTo _name2)exitWith{ 37 | _found = true; //found it, now update amount 38 | if(_amount == -1 || _amount2 == -1)then{ 39 | _list set [_index2, [_name,-1]]; 40 | }else{ 41 | _list set [_index2, [_name,(_amount2 + _amount)]]; 42 | }; 43 | }; 44 | 45 | }forEach _list; 46 | 47 | if(!_found)then{ 48 | _list pushBack [_name, _amount]; //not found add new 49 | }; 50 | }; 51 | }forEach _add; 52 | 53 | _list; //return 54 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_requestVehicle.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | if(!isserver)exitWith{}; 4 | 5 | params["_name","_index","_namePlayer","_uid","_id","_object"]; 6 | 7 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 8 | pr _vehicleList = (_vehicleLists select _index); 9 | diag_log "test1"; 10 | diag_log _vehicleList; 11 | 12 | pr _activePlayers = []; 13 | { 14 | _activePlayers pushBack (name _x); false; 15 | } count (allPlayers - entities "HeadlessClient_F"); 16 | 17 | 18 | pr _message = false; 19 | {//forEach _array 20 | pr _data = _x; 21 | _data params ["_name2", "_beingChanged2"]; 22 | 23 | if(_name2 isEqualTo _name)exitWith{ 24 | if(!(_beingChanged2 in _activePlayers) || _beingChanged2 isEqualTo _namePlayer)then{//check if someone is already changing this vehicle 25 | _locked = _data select 2; 26 | if(_locked isEqualTo "" || {_locked isEqualTo _uid} || {getPlayerUID slowhand isEqualTo _uid})then{//check if vehicle is unlocked or locked by requesting person 27 | _message = true; 28 | 29 | //update datalist 30 | _data set [1,_namePlayer]; 31 | _vehicleList set [_foreachindex,_data]; 32 | _vehicleLists set [_index,_vehicleList]; 33 | _object setVariable ["jng_vehicleLists",_vehicleLists]; 34 | //update all clients that are looking in the garage 35 | ["updateVehicleSingleData",[_name,_index,_namePlayer,nil]] remoteExecCall ["jn_fnc_garage",missionnamespace getVariable ["jng_playersInGarage",[]]]; 36 | }; 37 | }; 38 | 39 | 40 | }; 41 | } forEach _vehicleList; 42 | 43 | //tell client he can or cant take vehicle 44 | [_message] remoteExecCall ["jn_fnc_garage_requestVehicleMessage",[_id]]; 45 | 46 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_repairHitpoint.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_objectTo", "_objectFrom","_data","_hitpointIndex"]; 4 | 5 | pr _displayName = _data select VEHICLE_DATA_DISPLAYNAME; 6 | pr _type = _data select VEHICLE_DATA_TYPE; 7 | pr _wheelSize = _data select VEHICLE_DATA_WHEELSIZE; 8 | pr _hitpoint = _data select VEHICLE_DATA_HITPOINTS select _hitpointIndex; 9 | pr _hitType = _data select VEHICLE_DATA_HITTYPES select _hitpointIndex; 10 | 11 | pr _amountFrom = _objectFrom call JN_fnc_repair_getCargo; 12 | pr _typeName = TYPE_VEHICLES select _type; 13 | 14 | pr _skill = _objectFrom getVariable ["jn_repair_skill",1]; 15 | _repair = 0.5 max _skill;//can only repair with high skill 16 | 17 | 18 | pr _cost = 100; 19 | _cost = _cost * (switch (_hitType) do { 20 | case TYPE_WHEEL: {_repair = 1; _wheelSize/10};//always repair wheels 100% 21 | case TYPE_TRACK: {10}; 22 | case TYPE_ENGINE: {10}; 23 | case TYPE_FUEL: {5}; 24 | case TYPE_BODY: {5}; 25 | case TYPE_HULL: {5}; 26 | case TYPE_GLASS: {2}; 27 | case TYPE_LIGHT: {1}; 28 | }); 29 | _cost = _cost * (switch (_type) do { 30 | case TYPE_CAR:{1}; 31 | case TYPE_ARMOR:{10}; 32 | case TYPE_HELI:{20}; 33 | case TYPE_PLANE:{20}; 34 | case TYPE_NAVAL:{5}; 35 | case TYPE_STATIC:{0.5}; 36 | }); 37 | _cost = round _cost; 38 | 39 | _damage = _vehicle getHitPointDamage _hitpoint; 40 | 41 | if(1-_repair >= _damage)exitWith{hint "cant repair part furter"}; 42 | if(_cost > _amountFrom)exitWith{hint "To less points"}; 43 | 44 | 45 | _vehicle setHitPointDamage [_hitpoint,1-_repair]; 46 | 47 | [_objectFrom,_amountFrom - _cost] call JN_fnc_repair_setCargo; 48 | 49 | hint "repaired"; 50 | 51 | 52 | 53 | 54 | //add cancel action -------------------------------------------------------------------------------- /JeroenArsenal/Common/Array/fn_common_array_remove.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | By: Jeroen Notenbomer 5 | 6 | Add amounts of same namee togetter 7 | Use amount -1 to remove unlimited items 8 | 9 | Inputs: 10 | 1: list [["name1",amount1],["name2",amount2]] 11 | 2: item "name1" or ["name1",amount1] or [["name1",amount1],["name2",amount2]] 12 | 13 | Outputs 14 | list = Input1-Input2 15 | */ 16 | 17 | params["_list","_remove"]; 18 | _list = +_list; 19 | 20 | if(typeName _remove isEqualTo "STRING")then{_remove = [_remove,1];}; 21 | if(typeName (_remove select 0) isEqualTo "STRING")then{_remove = [_remove]}; 22 | 23 | diag_log "1"; 24 | diag_log _list; 25 | diag_log "2"; 26 | diag_log _remove; 27 | { 28 | pr _index = _forEachIndex; 29 | pr _name = _x select 0; 30 | pr _amount = _x select 1; 31 | 32 | if!(_name isEqualTo "")then{//skip items with no nam 33 | { 34 | if!(_x isEqualTo -1)then{ 35 | pr _index2 = _forEachIndex; 36 | pr _name2 = _x select 0; 37 | pr _amount2 = _x select 1; 38 | 39 | if(_name isEqualTo _name2)exitWith{ 40 | 41 | if(_amount == -1 || _amount2 == -1)then{ 42 | if(_amount == -1)then{ 43 | _list set [_forEachIndex, -1]; //remove unlimited item 44 | }; 45 | }else{ 46 | pr _newAmount = (_amount2 - _amount); 47 | if(_newAmount > 0)then{ 48 | _list set [_forEachIndex, [_name, _newAmount]]; 49 | }else{ 50 | _list set [_forEachIndex, -1];//mark for removale 51 | }; 52 | }; 53 | }; 54 | }; 55 | }forEach _list; 56 | }; 57 | }forEach _remove; 58 | 59 | _list = _list - [-1]; 60 | _list; //return this 61 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_addActionRepairPlayer.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | adds repair action to player (local) 7 | 8 | Parameter(s): 9 | (int): repair skill of player [default: 0.1] 10 | 11 | Returns: 12 | Nil 13 | 14 | Usage: [this,0.5] call JN_fnc_repair_addActionRepairPlayer 15 | 16 | */ 17 | params [["_skill",0.1]]; 18 | player setVariable ["jn_repair_skill",_skill]; 19 | 20 | //disable armas repair script 21 | player setUnitTrait ["engineer",false,true]; 22 | 23 | //reinit 24 | uiNamespace setVariable ['jn_repair_draw3d',nil]; 25 | pr _id = player getVariable "repairAction_id"; 26 | if(isnil "_id")then{player removeAction _id}; 27 | 28 | _id = player addaction [ 29 | "", 30 | { 31 | private _vehicle = cursorObject; 32 | 33 | pr _type = _vehicle call JN_fnc_common_vehicle_getVehicleType; 34 | 35 | pr _skill_Vehicle = SKILL_REQUIRED_VEHICLE select _type; 36 | pr _skill = player getVariable ["jn_repair_skill",1]; 37 | pr _typeName = TYPE_VEHICLES select _type; 38 | if(_skill < _skill_Vehicle)exitWith{hint format["I dont know how to work on %1s",toLower _typeName]}; 39 | 40 | pr _points = player call JN_fnc_repair_getCargo; 41 | if(_points == 0)exitWith{hint "no repair points"}; 42 | if(_points < 10)exitWith{hint "to less points"}; 43 | 44 | [_vehicle, player] call JN_fnc_repair_addSelectRepair; 45 | 46 | }, 47 | [], 48 | 10, 49 | true, 50 | false, 51 | "", 52 | "if(alive player && {player distance cursorObject < 5} && {player == vehicle player} && {isNil {uiNamespace getVariable 'jn_repair_draw3d'}} && {cursorObject isKindOf 'AllVehicles'})then{ 53 | player setUserActionText [(player getVariable ['repairAction_id',-1]), 'Repair ' + getText(configfile >> 'CfgVehicles' >> typeof cursorObject >>'displayName')]; 54 | true; 55 | }" 56 | 57 | ]; 58 | player setVariable ["repairAction_id",_id]; 59 | 60 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | #include "\A3\ui_f\hpp\defineDIKCodes.inc" 4 | #include "\A3\Ui_f\hpp\defineResinclDesign.inc" 5 | 6 | /* 7 | Author: Jeroen Notenbomer 8 | 9 | Description: 10 | Init ammo GUI 11 | 12 | Parameter(s): 13 | 14 | Returns: 15 | 16 | */ 17 | 18 | params []; 19 | 20 | 21 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 22 | diag_log ("Init JN_ammo: Start"); 23 | 24 | //preload the ammobox so you dont need to wait the first time 25 | ["Preload"] call jn_fnc_arsenal; 26 | 27 | //server 28 | if(isServer)then{ 29 | 30 | }; 31 | 32 | //player 33 | if(hasInterface)then{ 34 | diag_log ("Init JNA: player"); 35 | 36 | if(missionNamespace getVariable ["jn_ammo_first_init",true])then{ 37 | 38 | //add open event 39 | [missionNamespace, "arsenalOpened", { 40 | disableSerialization; 41 | UINamespace setVariable ["arsanalDisplay",(_this select 0)]; 42 | 43 | //spawn this to make sure it doesnt freeze the game 44 | [] spawn { 45 | disableSerialization; 46 | pr _type = UINamespace getVariable ["jn_type",""]; 47 | if(_type isEqualTo "ammo")then{ 48 | ["CustomInit", [uiNamespace getVariable "arsanalDisplay"]] call jn_fnc_ammo_gui; 49 | }; 50 | 51 | }; 52 | }] call BIS_fnc_addScriptedEventHandler; 53 | 54 | //add close event 55 | [missionNamespace, "arsenalClosed", { 56 | pr _type = UINamespace getVariable ["jn_type",""]; 57 | 58 | if(_type isEqualTo "ammo")then{ 59 | ["Close"] call jn_fnc_ammo_gui; 60 | UINamespace setVariable ["jn_type",""]; 61 | }; 62 | }] call BIS_fnc_addScriptedEventHandler; 63 | }; 64 | }; 65 | 66 | missionNamespace setVariable ["jn_ammo_first_init",false]; 67 | 68 | if(isServer)then{ 69 | diag_log ("Init Server JN_ammo: done"); 70 | }else{ 71 | diag_log ("Init pLayer JN_ammo: done"); 72 | }; 73 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_addActionRefuel.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | adds refuel button to object 7 | 8 | Parameter(s): 9 | Object: to add action to 10 | int: total amount of fuel that object can store in liters 11 | (int): starting amount of fuel in object [default: 0] 12 | 13 | Returns: 14 | Nil 15 | 16 | Usage: [this,1000] call jn_fnc_fuel_addActionRefuel 17 | 18 | */ 19 | 20 | params["_vehicle","_fuelCargoCapacity",["_fuelCargo",0]]; 21 | 22 | //check if it already has a action 23 | if (!isnil{ _vehicle getVariable "refuelAction_id" }) exitWith{diag_log ("JN_fuel already init for object: "+str _vehicle)}; 24 | 25 | pr _id = _vehicle addaction [ 26 | "place holder", 27 | { 28 | pr _vehicle = _this select 0; 29 | //check if object has still fuel 30 | pr _fuelCargo = _vehicle getVariable ["jn_fuel_cargo",0]; 31 | if(_fuelCargo == 0)exitWith{hint "No fuel in object"}; 32 | 33 | //create select action 34 | pr _script = { 35 | params ["_vehicle"]; 36 | pr _vehicle2 = cursorObject; 37 | [_vehicle2,_vehicle] call jn_fnc_fuel_refuel; 38 | }; 39 | 40 | pr _conditionActive = { 41 | params ["_vehicle"]; 42 | alive player; 43 | }; 44 | 45 | pr _conditionColor = { 46 | params ["_vehicle"]; 47 | !isnull cursorObject&&{_vehicle distance cursorObject < INT_MAX_DISTANCE_TO_REFUEL} 48 | }; 49 | 50 | [_script,_conditionActive,_conditionColor,_vehicle] call jn_fnc_common_addActionSelect; 51 | }, 52 | [], 53 | 4, 54 | true, 55 | false, 56 | "", 57 | "alive _target && {_target distance _this < 5} && {player == vehicle player} && {isNil {_target getVariable 'refuelAction_inUse'}}" 58 | 59 | ]; 60 | _vehicle setVariable ["refuelAction_id",_id]; 61 | 62 | _vehicle setFuelCargo 0; //disable Armas shit because its broken 63 | [_vehicle, _fuelCargoCapacity] call JN_fnc_fuel_setCargoCapacity;//call this before setting fuel value 64 | [_vehicle, _fuelCargo] call JN_fnc_fuel_setCargo;//need actionId so we need to run it after we create the action 65 | 66 | 67 | -------------------------------------------------------------------------------- /JeroenArsenal/Test/play pickup animation.sqf: -------------------------------------------------------------------------------- 1 | steal_weapon = { 2 | params["_unit", "_weapon"]; 3 | _groundWeaponHolder = "GroundWeaponHolder" createVehicle [0,0,0]; 4 | _groundWeaponHolder addItemCargo ["None", 1]; 5 | _groundWeaponHolder setPos (position _unit); 6 | 7 | _unit action ["PutWeapon",_groundWeaponHolder,_unit]; 8 | }; 9 | 10 | 11 | [] spawn{ 12 | params["_unit","_disarm"]; 13 | _unit = cursorObject; 14 | _disarm = player; 15 | 16 | 17 | _currentWeapon = currentWeapon _unit; 18 | _animation = call{ 19 | if(_currentWeapon isequalto primaryWeapon _unit)exitWith{ 20 | "amovpercmstpsraswrfldnon_ainvpercmstpsraswrfldnon_putdown" //primary 21 | }; 22 | if(_currentWeapon isequalto secondaryWeapon _unit)exitWith{ 23 | "amovpercmstpsraswlnrdnon_ainvpercmstpsraswlnrdnon_putdown" //launcher 24 | }; 25 | if(_currentWeapon isequalto handgunWeapon _unit)exitWith{ 26 | "amovpercmstpsraswpstdnon_ainvpercmstpsraswpstdnon_putdown" //pistol 27 | }; 28 | if(_currentWeapon isequalto binocular _unit)exitWith{ 29 | "amovpercmstpsoptwbindnon_ainvpercmstpsoptwbindnon_putdown" //bino 30 | }; 31 | "amovpercmstpsnonwnondnon_ainvpercmstpsnonwnondnon_putdown" //non 32 | }; 33 | 34 | waitUntil{ 35 | _pos = (eyeDirection _disarm vectorMultiply 1.6) vectorAdd getpos _disarm; 36 | _unit doMove _pos; 37 | _unit dotarget _disarm; 38 | _pos_disarm = getpos _disarm; 39 | sleep 0.5; 40 | 41 | diag_log ["sleep",(_pos_disarm distance (getpos _disarm))]; 42 | 43 | (_pos_disarm distance (getpos _disarm))<0.1 && {_pos distance getpos _unit < 0.5}; 44 | }; 45 | sleep 0.1; 46 | _unit playMove _animation; 47 | waitUntil {animationState _unit == _animation}; 48 | waitUntil {animationState _unit != _animation}; 49 | 50 | 51 | 52 | //removeWeapon 53 | _disarm removeWeapon currentWeapon _disarm; 54 | 55 | sleep 1; 56 | hint "Now move away"; 57 | 58 | sleep 3; 59 | if(_unit distance _disarm<4)then{ 60 | sleep 1; 61 | hint "Further or I shoot you"; 62 | } 63 | 64 | sleep 3; 65 | 66 | if(_unit distance _disarm<4)then{ 67 | _disarm addRating -20000; 68 | }else{ 69 | _unit doWatch objNull; 70 | }; 71 | 72 | }; 73 | 74 | 75 | 76 | _unit = cursorObject; 77 | _disarm = player; 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TODO! 2 | Untested in mp 3 | Finalize some code. Random errors and hints 4 | 5 | 6 | -------------------------ARSENAL----------------------- 7 | 8 | This is the Arsenal system which i wrote for Antistasi.Its basicly the default arsenal but all weapons are limited in amount. You can add weapons by de-equiping them while inside the arsenal(selecting other weapon or non).The amount of items inside the arsenal is shown next to the name. Included a indicators on every weapon to indicate how much ammo is available for it. 9 | To use it place all files in the your mission(merge/incl. description.extand stringtable with own if needed) 10 | In the editor place a object with "this call jn_fnc_arsenal_init" inside init field. 11 | 12 | -------------------------GARAGE------------------------ 13 | 14 | - Garage part is still WIP, but working 15 | - TODO explain how to use it! 16 | 17 | Allows vehicles to be stored in its current state. When taking the vehicle out of the garage it comes out the why you placed it in(same damgage, fuel, ammo and attachments). There is options to change color, pylon loadout, repair individual parts, refuel and rearm. 18 | When a static weapon and a truck/pickup is stored you have the ability to weld them together! 19 | 20 | ------------------------LOGISTICS---------------------- 21 | 22 | - Mostly done 23 | - Maybe rewrite it to use more realisic loading bahavior based on boundingboxes. 24 | - TODO explain how to use it! 25 | 26 | Load boxes in vehicles with animation in a visable way(not like ace). 27 | 28 | --------------------------Fuel------------------------ 29 | 30 | Added actions to fuel trucks and a indicator of how much fuel they contain. 31 | Gives all fuel containers (trucks, fuel stations) limited amount of fuel. 32 | Make vehicles use more fuel. 33 | 34 | -------------------------Repair----------------------- 35 | 36 | Repair vehicles which requere repair points. 37 | Repair points can be stored in repait trucks and toolkits. 38 | All parts have a repair cost. 39 | Unit is limited in what they can repair based on skill. 40 | 41 | --------------------------Ammo------------------------ 42 | 43 | Added ammo trucks with limited ammo 44 | Added some interface to select what ammo to rearm 45 | 46 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/getWheels.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_type"]; 4 | 5 | //if object was past change it to type 6 | if!(_type isEqualType "")then{_type = typeof __type}; 7 | 8 | pr _wheels = ("true" configClasses (configfile >> "CfgVehicles" >> _type >> "Wheels")); 9 | if (count _wheels == 0 )exitWith{-1}; 10 | 11 | //return 12 | getNumber((_wheels select 1) >> "width"); 13 | 14 | 15 | 16 | 17 | 18 | 19 | configfile >> "CfgVehicles" >> "Offroad_01_armed_base_F" >> "HitPoints" >> "HitRMWheel" >> "name" 20 | configfile >> "CfgVehicles" >> "Offroad_01_armed_base_F" >> "Wheels" >> "LF" >> "center" 21 | /////////////////////////////// 22 | 23 | 24 | _vehicle = cursorObject; 25 | _info = getAllHitPointsDamage _vehicle; 26 | _info params["_hitpoints","_selections","_damages"]; 27 | 28 | { 29 | pr _hitpoint = _hitpoints select _forEachIndex; 30 | pr _selection = _selections select _forEachIndex; 31 | pr _damage = _x; 32 | 33 | if(_selection find "wheel_")then{ 34 | pr _name = [_selection,0,9] call BIS_fnc_trimString; 35 | [_name, "axis"] joinString ""; 36 | 37 | 38 | }else{ 39 | 40 | } 41 | }forEach _damages; 42 | 43 | 44 | 45 | 46 | 47 | [ 48 | ["hithull","hitengine","hitltrack","hitrtrack","hitfuel","hitslat_left_1","hitslat_left_2","hitslat_left_3","hitslat_right_1","hitslat_right_2","hitslat_right_3","hitslat_back","hitslat_front","hitturret","hitgun","#l svetlo","#p svetlo","#cabin_light","#cargo_light_1"], 49 | 50 | ["telo","motor","pas_l","pas_p","palivo","","","","","","","","","vez","zbran","l svetlo","p svetlo","",""], 51 | 52 | [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]] 53 | 54 | [["hitlfwheel","hitlf2wheel","hitrfwheel","hitrf2wheel","hitrglass","hitlglass","hitglass1","hitglass2","hitglass3","hitglass4","hitglass5","hitglass6","hitbody","hitfuel","hitlbwheel","hitlmwheel","hitrbwheel","hitrmwheel","hitengine","hithull","#light_l","#light_l","#light_r","#light_l"], 55 | 56 | ["wheel_1_1_steering","wheel_1_2_steering","wheel_2_1_steering","wheel_2_2_steering","","","glass1","glass2","glass3","glass4","","","karoserie","","","","","","","","light_l","light_l","light_r","light_l"], 57 | 58 | [2.62749e-006,0.000113217,0.530813,0.33082,0,0,0,0.0419672,0,0,0,0,0.258914,0,0,0,0,0,0,0,0,0,0.596068,0]] -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_addActionRearm.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | adds rearm button to object 7 | 8 | Parameter(s): 9 | Object: to add action to 10 | int: total amount of points that object can store 11 | (int): starting amount of points in object [default: 0] 12 | 13 | Returns: 14 | Nil 15 | 16 | Usage: [this,1000] call JN_fnc_ammo_addActionRearm 17 | 18 | */ 19 | 20 | params["_vehicleFrom","_rearmCargoCapacity",["_rearmCargo",0]]; 21 | 22 | //check if it already has a action 23 | if !isnil(_vehicleFrom getVariable "rearmAction_id")exitWith{diag_log ("JN_ammo already init for object: "+str _vehicleFrom)}; 24 | 25 | pr _id = _vehicleFrom addaction [ 26 | "", 27 | { 28 | pr _vehicleFrom = _this select 0; 29 | 30 | //check if object has still ammo 31 | pr _rearmCargo = _vehicleFrom call JN_fnc_ammo_getCargo; 32 | if(_rearmCargo == 0)exitWith{hint "No ammo in object"}; 33 | 34 | //create select action 35 | pr _script = { 36 | params ["_vehicleFrom"]; 37 | 38 | pr _vehicleTo = cursorObject; 39 | ["Open",[_vehicleFrom,_vehicleTo]] call JN_fnc_ammo_gui; 40 | pr _id = _vehicleFrom getVariable "rearmAction_id"; 41 | }; 42 | pr _conditionActive = { 43 | params ["_vehicleFrom"]; 44 | alive player; 45 | }; 46 | pr _conditionColor = { 47 | params ["_vehicleFrom"]; 48 | !isnull cursorObject&&{_vehicleFrom distance cursorObject < INT_MAX_DISTANCE_TO_REREARM} 49 | }; 50 | 51 | [_script,_conditionActive,_conditionColor,_vehicleFrom] call jn_fnc_common_addActionSelect; 52 | }, 53 | [], 54 | 4, 55 | true, 56 | false, 57 | "", 58 | "alive _target && {_target distance _this < 5} && {player == vehicle player}" 59 | 60 | ]; 61 | ACTION_SET_ICON_AND_TEXT(_vehicleFrom, _id, STR_ACTION_TEXT_REARM(_rearmCargo,_rearmCargoCapacity), STR_ACTION_ICON_REARM); 62 | 63 | 64 | _vehicleFrom setVariable ["rearmAction_id",_id]; 65 | 66 | _vehicleFrom setAmmoCargo 0; //disable Armas shit because its broken 67 | [_vehicleFrom, _rearmCargoCapacity] call JN_fnc_ammo_setCargoCapacity;//call this before setting rearm value 68 | [_vehicleFrom, _rearmCargo] call JN_fnc_ammo_setCargo;//need actionId so we need to run it after we create the action 69 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Actions/fn_logistics_addActionLoad.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_object"]; 4 | diag_log ["addactionload"]; 5 | pr _loadActionID = _object getVariable ["jnl_loadActionID",nil]; 6 | 7 | //Check if action exists already 8 | if(!isnil "_loadActionID") then 9 | { 10 | _object removeAction _loadActionID; 11 | }; 12 | 13 | //Check if this vehicle can be loaded with JNL 14 | if((_object call jn_fnc_logistics_getCargoType) == -1) exitWith {}; 15 | 16 | _loadActionID = _object addAction [ 17 | " Load Cargo in Vehicle", 18 | { //Action script 19 | params ["_cargo"]; 20 | 21 | //create select action 22 | pr _script = { 23 | params ["_cargo"]; 24 | 25 | pr _vehicleTo = cursorObject; 26 | 27 | pr _nodeID = [_vehicleTo, _cargo] call jn_fnc_logistics_canLoad; 28 | switch (_nodeID) do { 29 | case -4: 30 | { 31 | hint 'Can not load cargo: passengers have occupied cargo space!'; 32 | }; 33 | case -3: 34 | { 35 | hint 'This vehicle can not carry this cargo!'; 36 | }; 37 | case -2: 38 | { 39 | hint 'There is no space for this cargo!' 40 | }; 41 | case -1: 42 | { 43 | hint 'Can not load this type of cargo!'; 44 | }; 45 | default 46 | { 47 | //[_vehicleTo, _cargo, true] call jn_fnc_logistics_load; 48 | //Executing it on the server works better! 49 | [_vehicleTo, _cargo, true, true] remoteexec ["jn_fnc_logistics_load", 2]; 50 | }; 51 | }; 52 | }; 53 | pr _conditionActive = { 54 | params ["_cargo"]; 55 | alive player; 56 | }; 57 | pr _conditionColor = { 58 | params ["_cargo"]; 59 | !isnull cursorObject&&{_cargo distance cursorObject < INT_MAX_DISTANCE_TO_LOADCARGO}; 60 | }; 61 | 62 | [_script,_conditionActive,_conditionColor,_cargo] call jn_fnc_common_addActionSelect; 63 | 64 | 65 | 66 | }, 67 | nil, 1, true, false, "", "isnull attachedTo _target && vehicle player == player;", 3.5, false, "" 68 | ]; 69 | 70 | _object setUserActionText [ 71 | _loadActionID, 72 | "Load Cargo in Vehicle", 73 | "" 74 | ]; 75 | 76 | _object setVariable ["jnl_loadActionID", _loadActionID, false]; 77 | 78 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/recompile.sqf: -------------------------------------------------------------------------------- 1 | //TODO remove me! 2 | 3 | //main 4 | jn_fnc_logistics_init = compile preProcessFileLineNumbers "JeroenArsenal\JNL\fn_logistics_init.sqf"; 5 | jn_fnc_logistics_load = compile preProcessFileLineNumbers "JeroenArsenal\JNL\fn_logistics_load.sqf"; 6 | jn_fnc_logistics_unLoad = compile preProcessFileLineNumbers "JeroenArsenal\JNL\fn_logistics_unLoad.sqf"; 7 | jn_fnc_logistics_addAction = compile preProcessFileLineNumbers "JeroenArsenal\JNL\fn_logistics_addAction.sqf"; 8 | jn_fnc_logistics_removeAction = compile preProcessFileLineNumbers "JeroenArsenal\JNL\fn_logistics_removeAction.sqf"; 9 | 10 | //functions 11 | //jn_fnc_logistics_canLoad = compile preProcessFileLineNumbers "JeroenArsenal\JNL\functions\fn_logistics_canLoad.sqf"; 12 | //jn_fnc_logistics_getCargo = compile preProcessFileLineNumbers "JeroenArsenal\JNL\functions\fn_logistics_getCargo.sqf"; 13 | //jn_fnc_logistics_getCargoType = compile preProcessFileLineNumbers "JeroenArsenal\JNL\functions\fn_logistics_getCargoType.sqf"; 14 | //jn_fnc_logistics_getNodes = compile preProcessFileLineNumbers "JeroenArsenal\JNL\functions\fn_logistics_getNodes.sqf"; 15 | 16 | //Actions 17 | jn_fnc_logistics_addActionGetInWeapon = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_addActionGetInWeapon.sqf"; 18 | jn_fnc_logistics_addActionLoad = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_addActionLoad.sqf"; 19 | jn_fnc_logistics_addActionUnload = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_addActionUnload.sqf"; 20 | jn_fnc_logistics_addEventGetOutWeapon = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_addEventGetOutWeapon.sqf"; 21 | 22 | jn_fnc_logistics_removeActionGetInWeapon = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_removeActionGetInWeapon.sqf"; 23 | jn_fnc_logistics_removeActionLoad = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_removeActionLoad.sqf"; 24 | jn_fnc_logistics_removeActionUnload = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_removeActionUnload.sqf"; 25 | jn_fnc_logistics_removeEventGetOutWepon = compile preProcessFileLineNumbers "JeroenArsenal\JNL\Actions\fn_logistics_removeEventGetOutWeapon.sqf"; 26 | 27 | call jn_fnc_logistics_init; 28 | 29 | /* 30 | call compile preProcessFileLineNumbers "JeroenArsenal\JNL\recompile.sqf"; 31 | cursorObject call jn_fnc_logistics_addAction; 32 | */ 33 | -------------------------------------------------------------------------------- /JeroenArsenal/Common/fn_common_addActionSelect.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | #define UPDATEINTERVAL 0.1 4 | #define REMOVEAFTER 10 5 | #define TEXTGOOD "'#FFA500'" 6 | #define TEXTBAD "'#808080'" 7 | 8 | 9 | params ["_script","_conditionActive","_conditionColor","_object",["_showCursorObject",true],["_timer",REMOVEAFTER],["_removeScript",{}]]; 10 | 11 | //remove previous action if existing 12 | pr _id = player getVariable "jn_selectAction_id"; 13 | if(!isNil "_id")then{ 14 | player removeAction _id; 15 | player setVariable ["jn_selectAction_id",nil]; 16 | }; 17 | 18 | //removes previous remove after .. timer 19 | pr _handle = player getVariable "jn_selectAction_handle"; 20 | if(!isNil "_handle")then{ 21 | terminate _handle; 22 | }; 23 | 24 | player setVariable ["jn_selectAction_object", _object]; 25 | 26 | //add select action 27 | _id = player addAction [ 28 | "aaa", 29 | { 30 | (_this select 3) params ["_object","_script","_removeScript"]; 31 | 32 | pr _id = _this select 2; 33 | player removeAction _id; 34 | player setVariable ["jn_selectAction_id",nil]; 35 | terminate (player getVariable "jn_selectAction_handle");//remove timer 36 | 37 | _object call _removeScript; 38 | 39 | if(isNil "_object")exitwith{hint localize "STR_JNC_ACT_SELECT_NO_OBJECT"}; 40 | hint ""; //remove select hint if it was still there 41 | 42 | _object call _script; 43 | 44 | }, 45 | [_object,_script,_removeScript], 46 | 7, 47 | true, 48 | false, 49 | "", 50 | format ["if([player getVariable 'jn_selectAction_object'] call %1)then{ 51 | private _color = [player getVariable 'jn_selectAction_object'] call %2; 52 | private _colorCode = [%4,%3] select _color; 53 | private _text = '' + %5; 54 | if(%6 && _color)then{_text = _text + ' (' + getText(configfile >> 'CfgVehicles' >> typeof cursorObject >>'displayName') + ')'}; 55 | player setUserActionText [(player getVariable ['jn_selectAction_id',-1]), _text]; 56 | true 57 | }",_conditionActive,_conditionColor,str TEXTGOOD,str TEXTBAD,str localize 'STR_JNC_ACT_SELECT',_showCursorObject] 58 | 59 | ]; 60 | 61 | player setVariable ["jn_selectAction_id",_id]; 62 | 63 | 64 | //remove timer 65 | _handle = [_id,_timer,_removeScript,_object] spawn { 66 | params["_id","_timer","_removeScript","_object"]; 67 | sleep _timer; 68 | player removeAction _id; 69 | player setVariable ["jn_selectAction_id",nil]; 70 | _object call _removeScript; 71 | hint ""; 72 | }; 73 | 74 | player setVariable ["jn_selectAction_handle",_handle]; 75 | 76 | hint localize "STR_JNC_ACT_SELECT_HINT"; -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_getWheelHitPointsWithSelections.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle"]; 4 | 5 | pr _wheels = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Wheels"; 6 | 7 | 8 | if !(isClass _wheels) exitWith {[]}; 9 | 10 | 11 | (getAllHitPointsDamage _vehicle) params ["_hitPoints", "_hitPointSelections"]; 12 | 13 | 14 | _wheels = "true" configClasses _wheels; 15 | 16 | pr _wheelHitPointsAndSelections = []; 17 | 18 | { 19 | pr _wheelName = configName _x; 20 | pr _wheelCenter = getText (_x >> "center"); 21 | pr _wheelBone = getText (_x >> "boneName"); 22 | pr _wheelBoneNameResized = _wheelBone select [0, 9]; 23 | 24 | pr _wheelHitPoint = ""; 25 | pr _wheelHitPointSelection = ""; 26 | 27 | { 28 | if ((_wheelBoneNameResized != "") && {_x find _wheelBoneNameResized == 0}) exitWith { 29 | _wheelHitPoint = _hitPoints select _forEachIndex; 30 | _wheelHitPointSelection = _hitPointSelections select _forEachIndex; 31 | }; 32 | } forEach _hitPointSelections; 33 | 34 | 35 | if (_vehicle isKindOf "Car") then { 36 | 37 | if (_wheelHitPoint == "") then { 38 | pr _wheelCenterPos = _vehicle selectionPosition _wheelCenter; 39 | if (_wheelCenterPos isEqualTo [0,0,0]) exitWith {}; 40 | 41 | 42 | pr _bestDist = 99; 43 | pr _bestIndex = -1; 44 | { 45 | if (_x != "") then { 46 | if ((toLower (_hitPoints select _forEachIndex)) in ["hitengine", "hitfuel", "hitbody"]) exitWith {}; 47 | pr _xPos = _vehicle selectionPosition _x; 48 | if (_xPos isEqualTo [0,0,0]) exitWith {}; 49 | pr _xDist = _wheelCenterPos distance _xPos; 50 | if (_xDist < _bestDist) then { 51 | _bestIndex = _forEachIndex; 52 | _bestDist = _xDist; 53 | }; 54 | }; 55 | } forEach _hitPointSelections; 56 | 57 | 58 | if (_bestIndex != -1) then { 59 | _wheelHitPoint = _hitPoints select _bestIndex; 60 | _wheelHitPointSelection = _hitPointSelections select _bestIndex; 61 | 62 | }; 63 | }; 64 | }; 65 | 66 | if ((_wheelHitPoint != "") && {_wheelHitPointSelection != ""}) then { 67 | _wheelHitPointsAndSelections pushBack [_wheelHitPoint,_wheelHitPointSelection,_wheelCenter,TYPE_WHEEL,"Wheel"]; 68 | }; 69 | } forEach _wheels; 70 | 71 | _wheelHitPointsAndSelections; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_itemType.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | By: Jeroen Notenbomer 4 | 5 | Get the index of which item is part of 6 | 7 | Inputs: 8 | 1: item "name" 9 | 2: (list) [1,3,10] index to search in, optional 10 | 11 | Outputs 12 | index or -1 if not found 13 | */ 14 | 15 | #include "\A3\ui_f\hpp\defineDIKCodes.inc" 16 | #include "\A3\Ui_f\hpp\defineResinclDesign.inc" 17 | 18 | params [["_item","",[""]]]; 19 | if(_item isEqualTo "")exitWith{diag_log "JNA Warning: empty item received in fnc_arsenal_itemType"}; 20 | 21 | // Try to perform lookup in hashmap first 22 | pr _hm = missionNamespace getVariable ["jna_itemTypeHashmap", locationNull]; 23 | pr _return = _hm getVariable [_item, -1]; 24 | if (_return != -1) exitWith { 25 | _return 26 | }; 27 | 28 | // Item was not found in the hashmap, perform usual type resolution 29 | pr ["_types","_return","_data"]; 30 | _return = -1; 31 | 32 | // Fix for CBA_miscItem-derived classes 33 | if (_item isKindOf ["CBA_MiscItem", configFile >> "cfgWeapons"]) exitWith { IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC }; 34 | 35 | 36 | // Do the usual class resolution 37 | INITTYPES 38 | 39 | (_item call bis_fnc_itemType) params ["_weaponTypeCategory", "_weaponTypeSpecific"]; 40 | 41 | { 42 | if ((_weaponTypeSpecific in _x) || (_item in _x)) exitwith {_return = _foreachindex;}; 43 | } foreach _types; 44 | 45 | 46 | if(_return == -1)then{ 47 | pr _data = (missionnamespace getvariable "bis_fnc_arsenal_data"); 48 | if (isNil "_data") exitWith {}; 49 | { 50 | pr _index = _x; 51 | pr _dataSet = _data select _index; 52 | 53 | { 54 | if((tolower _item)isEqualTo (tolower _x))exitWith{_return = _index}; 55 | } forEach _dataSet; 56 | 57 | if(_return != -1)exitWith{}; 58 | }forEach [ 59 | IDC_RSCDISPLAYARSENAL_TAB_CARGOPUT, 60 | IDC_RSCDISPLAYARSENAL_TAB_CARGOTHROW, 61 | IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL, 62 | IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC, 63 | IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC, 64 | IDC_RSCDISPLAYARSENAL_TAB_ITEMACC, 65 | IDC_RSCDISPLAYARSENAL_TAB_ITEMMUZZLE, 66 | IDC_RSCDISPLAYARSENAL_TAB_ITEMBIPOD 67 | ]; 68 | }; 69 | 70 | //Assigning item to misc if no category was given 71 | if(_return == -1)then{ 72 | _return = IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC; 73 | }; 74 | 75 | // Add the value to hash map, so that later it's faster to look it up 76 | if (isNull _hm) then { // Warn if hashmap was not initialized yet 77 | diag_log "JNA Warning: item type hash map was not initialized"; 78 | } else { 79 | _hm setVariable [_item, _return]; 80 | }; 81 | 82 | _return; 83 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/Functions/fn_logistics_canLoad.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Returns a node the given object can be loaded on 8 | 9 | Parameter(s): 10 | OBJECT vehicle 11 | OBJECT object to load on vehicle 12 | 13 | Returns: 14 | INTEGER node number where object can be loaded on to 15 | or -1 if another type was already loaded 16 | or -2 if there was no more space 17 | or -3 if this vehicle can't have any cargo at all 18 | or -4 if cargo space is occupied (by a passenger) 19 | */ 20 | 21 | params[ ["_vehicle",objNull,[objNull]], ["_object",objNull,[objNull]] ]; 22 | 23 | if(isNull _vehicle || isNull _object)exitWith{["Wrong input given veh:%1 ,obj:%2",_vehicle,_object] call BIS_fnc_error;}; 24 | 25 | pr _typeObject = _object call jn_fnc_logistics_getCargoType; //get _object type 26 | 27 | //check current load 28 | pr _typeLoaded = -1; 29 | pr _nodesLoaded = 0; 30 | { 31 | pr _array = _x getVariable ["jnl_cargo",nil];//returns nr of node if the object was attached by JNL 32 | 33 | if(!isNil "_array")then{ 34 | pr _type = _array select 0; 35 | pr _node = (_array select 1)+1; 36 | 37 | _typeLoaded = _type; 38 | if(_node > _nodesLoaded)then{_nodesLoaded = _node}; 39 | }; 40 | } forEach attachedObjects _vehicle; 41 | 42 | //cant load 2 different types 43 | if(_typeLoaded != _typeObject && _typeLoaded != -1)exitWith{-1}; 44 | 45 | 46 | //==== Get available nodes ==== 47 | pr _nodeTotal = 0; 48 | { 49 | pr _type = _x select 0; 50 | pr _location = _x select 1; 51 | if(_type == _typeObject)then{_nodeTotal = _nodeTotal + 1;}; 52 | } forEach (_vehicle call jn_fnc_logistics_getNodes); 53 | 54 | if(_nodeTotal == 0)exitWith{-3}; 55 | 56 | //there is some node free 57 | if(_nodesLoaded < _nodeTotal) then 58 | { 59 | //==== Check if cargo space is occupied by passengers ==== 60 | //Get occupied cargo nodes 61 | pr _occupiedCargo = []; 62 | { 63 | //[unit,role,cargoIndex,turretPath,personTurret] 64 | _occupiedCargo pushback (_x select 2); //cargo index 65 | }forEach fullCrew _vehicle; 66 | //Get all seats that can be locked by cargo of this type 67 | pr _allCargoLockedSeats = []; 68 | { 69 | _allCargoLockedSeats append (_x select 1); 70 | } forEach ([_vehicle, _typeObject] call jn_fnc_logistics_getNodes); 71 | 72 | //Cargo space is occupied by passengers 73 | if (count (_allCargoLockedSeats arrayintersect _occupiedCargo) > 0) then 74 | { 75 | -4 76 | } 77 | else //Cargo space is not occupied by passengers and there is some free node 78 | { 79 | _nodesLoaded 80 | } 81 | } 82 | else 83 | { 84 | //node type is correct but no nodes were free 85 | -2; 86 | }; 87 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define EMPTY_ARRAY [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] 4 | 5 | 6 | 7 | //STRINGS ACTIONS 8 | 9 | #define STR_ACTION_ICON_ARSENAL "\A3\ui_f\data\GUI\Rsc\RscDisplayArsenal\spaceArsenal_ca.paa" 10 | #define STR_ACTION_TEXT_ARSENAL localize "STR_JNA_ACT_OPEN" 11 | 12 | #define STR_ACTION_ICON_ARSENAL_CONTAINER "JeroenArsenal\Icons\JN_unloadVehicle.paa" 13 | #define STR_ACTION_TEXT_ARSENAL_CONTAINER localize "STR_JNA_ACT_CONTAINER_OPEN" 14 | 15 | #define STR_ACTION_ICON_ARSENAL_UNLOAD "JeroenArsenal\Icons\JN_loadVehicle2.paa" 16 | #define STR_ACTION_TEXT_ARSENAL_UNLOAD localize "STR_JNA_ACT_UNLOAD" 17 | 18 | #define INITTYPES\ 19 | private _types = [];\ 20 | _types set [IDC_RSCDISPLAYARSENAL_TAB_UNIFORM,["Uniform"]];\ 21 | _types set [IDC_RSCDISPLAYARSENAL_TAB_VEST,["Vest"]];\ 22 | _types set [IDC_RSCDISPLAYARSENAL_TAB_BACKPACK,["Backpack"]];\ 23 | _types set [IDC_RSCDISPLAYARSENAL_TAB_HEADGEAR,["Headgear"]];\ 24 | _types set [IDC_RSCDISPLAYARSENAL_TAB_GOGGLES,["Glasses"]];\ 25 | _types set [IDC_RSCDISPLAYARSENAL_TAB_NVGS,["NVGoggles"]];\ 26 | _types set [IDC_RSCDISPLAYARSENAL_TAB_BINOCULARS,["Binocular","LaserDesignator"]];\ 27 | _types set [IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON,["AssaultRifle","MachineGun","SniperRifle","Shotgun","Rifle","SubmachineGun"]];\ 28 | _types set [IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON,["Launcher","MissileLauncher","RocketLauncher"]];\ 29 | _types set [IDC_RSCDISPLAYARSENAL_TAB_HANDGUN,["Handgun"]];\ 30 | _types set [IDC_RSCDISPLAYARSENAL_TAB_MAP,["Map"]];\ 31 | _types set [IDC_RSCDISPLAYARSENAL_TAB_GPS,["GPS","UAVTerminal"]];\ 32 | _types set [IDC_RSCDISPLAYARSENAL_TAB_RADIO,["Radio"]];\ 33 | _types set [IDC_RSCDISPLAYARSENAL_TAB_COMPASS,["Compass"]];\ 34 | _types set [IDC_RSCDISPLAYARSENAL_TAB_WATCH,["Watch"]];\ 35 | _types set [IDC_RSCDISPLAYARSENAL_TAB_FACE,[]];\ 36 | _types set [IDC_RSCDISPLAYARSENAL_TAB_VOICE,[]];\ 37 | _types set [IDC_RSCDISPLAYARSENAL_TAB_INSIGNIA,[]];\ 38 | _types set [IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC,["AccessorySights"]];\ 39 | _types set [IDC_RSCDISPLAYARSENAL_TAB_ITEMMUZZLE,["AccessoryMuzzle"]];\ 40 | _types set [IDC_RSCDISPLAYARSENAL_TAB_ITEMACC,["AccessoryPointer"]];\ 41 | _types set [IDC_RSCDISPLAYARSENAL_TAB_ITEMBIPOD,["AccessoryBipod"]];\ 42 | _types set [IDC_RSCDISPLAYARSENAL_TAB_CARGOMAG,[]];\ 43 | _types set [IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL,[]];\ 44 | _types set [IDC_RSCDISPLAYARSENAL_TAB_CARGOTHROW,[/*"Grenade","SmokeShell"*/]];\ 45 | _types set [IDC_RSCDISPLAYARSENAL_TAB_CARGOPUT,[/*"Mine","MineBounding","MineDirectional"*/]];\ 46 | _types set [IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC,["FirstAidKit","Medikit","MineDetector","Toolkit"]]; 47 | 48 | -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadout_old.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | 4 | params["_vehicle"]; 5 | _vehicle = cursorObject; 6 | pr _turretsArrayName = [typeof _vehicle, true] call BIS_fnc_allTurrets; 7 | pr _turretCfgs = ([_vehicle] call BIS_fnc_getTurrets); 8 | if(count _turretsArrayName != count _turretCfgs)then{ _turretsArrayName = [[-1]] + _turretsArrayName;}; 9 | 10 | pr _magDetail = magazinesAllTurrets _vehicle; 11 | 12 | pr _turrets = []; 13 | pr _totalLoadout = []; 14 | 15 | { 16 | _x params ["_cfgTurret"]; 17 | 18 | pr _turretLoadout = []; 19 | pr _magazineArray = getArray (_cfgTurret >> "magazines"); 20 | pr _weapons = getArray (_cfgTurret >> "weapons"); 21 | { 22 | _x params["_magClass"]; 23 | 24 | pr _ammoCount = getNumber(configfile >> "CfgMagazines" >> _magClass >> "count"); 25 | pr _inserted = false; 26 | { 27 | _x params ["_magClassList","_displayName","_ammoCountCur","_ammoCountMax"]; 28 | if(_magClassList isEqualTo _magClass) exitWith 29 | { 30 | _x set [3, (_ammoCountMax + _ammoCount)]; 31 | _inserted = true; 32 | }; 33 | } forEach _turretLoadout; 34 | 35 | if (!_inserted) then 36 | { 37 | pr _displayName = DISPLAYNAME_MAG(_magClass); 38 | if(_displayName == "")then{ 39 | { 40 | _x params["_weapon"]; 41 | pr _magazinesArray = getArray(configfile >> "CfgWeapons" >> _weapon >> "magazines"); 42 | if(_magazinesArray find _magClass != -1)exitWith{ 43 | _displayName = getText(configFile >> "CfgWeapons" >> _weapon >> "displayName"); 44 | }; 45 | }forEach _weapons; 46 | }; 47 | _turretLoadout pushBack [_magClass, _displayName, 0, _ammoCount]; 48 | }; 49 | }forEach _magazineArray; 50 | if(count _turretLoadout != 0)then{ 51 | _turrets pushBack (_turretsArrayName select _forEachIndex); 52 | _totalLoadout pushBack _turretLoadout; 53 | }; 54 | } forEach _turretCfgs; 55 | 56 | { 57 | _x params ["_magClass","_turretPath","_ammoCount"]; 58 | pr _turretLoadout = _totalLoadout select (_turrets find _turretPath); 59 | { 60 | _x params ["_magClassList","_displayName","_ammoCountCur","_ammoCountMax"]; 61 | if(_magClassList isEqualTo _magClass)exitWith{ 62 | _x set [2, (_ammoCountCur + _ammoCount)]; 63 | }; 64 | }forEach (_turretLoadout); 65 | }forEach _magDetail; 66 | 67 | pr _pylonLoadout = []; 68 | { 69 | _x params ["_magClass"]; 70 | _pylonLoadout pushBack [_magClass,DISPLAYNAME_MAG(_magClass), _vehicle ammoOnPylon (_forEachIndex + 1), getNumber(configfile >> "CfgMagazines" >> _x >> "count")] 71 | }forEach (getPylonMagazines _vehicle); 72 | 73 | 74 | pr _displayNames = []; 75 | pr _allTurretsNames = _vehicle call JN_fnc_common_vehicle_getSeatNames; 76 | { 77 | pr _turretPath = _x; 78 | pr _turretPaths = _allTurretsNames select 0; 79 | pr _names = _allTurretsNames select 1; 80 | _displayNames pushBack (_names select (_turretPaths find _turretPath)); 81 | }forEach _turrets; 82 | 83 | [_turrets,_displayNames,_totalLoadout,_pylonLoadout]; -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_cargoToArray.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Return a array of all items that are in a inventory of a vehicle/crate in the form of the jna_datalist 7 | 8 | Parameter(s): 9 | VEHICLE with a inventory 10 | 11 | Returns: 12 | ARRAY of arrays of arrays of items and amounts 13 | */ 14 | 15 | 16 | #include "\A3\ui_f\hpp\defineDIKCodes.inc" 17 | #include "\A3\Ui_f\hpp\defineResinclDesign.inc" 18 | 19 | params["_container"]; 20 | pr _array = EMPTY_ARRAY; 21 | 22 | 23 | pr _addToArray = { 24 | params ["_array","_index","_item","_amount"]; 25 | 26 | if!(_index == -1 || _item isEqualTo ""|| _amount == 0)then{ 27 | _array set [_index,[_array select _index,[_item,_amount]] call jn_fnc_common_array_add]; 28 | }; 29 | }; 30 | 31 | //recursion function to check all sub containers 32 | pr _unloadContainer = { 33 | _container_sub = _this; 34 | 35 | //magazines(exl. loaded ones) 36 | pr _mags = magazinesAmmoCargo _container_sub; 37 | { 38 | pr _item = _x select 0; 39 | pr _amount = _x select 1; 40 | pr _index = _item call jn_fnc_arsenal_itemType; 41 | [_array,_index,_item,_amount]call _addToArray; 42 | } forEach _mags; 43 | 44 | //items 45 | _items = itemCargo _container_sub; 46 | { 47 | pr _item = _x; 48 | pr _index = _item call jn_fnc_arsenal_itemType; 49 | [_array,_index,_item,1]call _addToArray; 50 | } forEach _items; 51 | 52 | //backpacks 53 | _backpacks = backpackCargo _container_sub; 54 | { 55 | _item = _x call BIS_fnc_basicBackpack; 56 | _index = IDC_RSCDISPLAYARSENAL_TAB_BACKPACK; 57 | [_array,_index,_item,1]call _addToArray; 58 | } forEach _backpacks; 59 | 60 | //weapons and attachmetns 61 | _attItems = weaponsItemsCargo _container_sub; 62 | // [["arifle_TRG21_GL_F","","","optic_DMS",["ammo"],""]] 63 | { 64 | { 65 | private["_index","_item","_amount"]; 66 | if(typename _x isEqualTo "ARRAY")then{ 67 | if(count _x > 0)then{ 68 | _item = _x select 0; 69 | _amount = _x select 1; 70 | _index = IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL; 71 | [_array,_index,_item,_amount]call _addToArray; 72 | }; 73 | }else{ 74 | if!(_x isEqualTo "")then{ 75 | _item = _x; 76 | _amount = 1; 77 | _index = _item call jn_fnc_arsenal_itemType; 78 | 79 | if(_index in [IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON, IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON, IDC_RSCDISPLAYARSENAL_TAB_HANDGUN])then{ 80 | _item = _x call bis_fnc_baseWeapon; 81 | }; 82 | 83 | 84 | if(_index != -1)then{ 85 | [_array,_index,_item,_amount]call _addToArray; 86 | }; 87 | }; 88 | }; 89 | }foreach _x; 90 | }foreach _attItems; 91 | 92 | 93 | 94 | //sub containers; 95 | { 96 | _x select 1 call _unloadContainer; 97 | }foreach (everyContainer _container_sub); 98 | }; 99 | 100 | //startloop 101 | _container call _unloadContainer; 102 | 103 | //return array of items 104 | _array; 105 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_getVehicleData.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [["_vehicle",objNull,[objNull]]]; 4 | 5 | if(isnull _vehicle)exitWith{}; 6 | 7 | pr _cfg = (configfile >> "CfgVehicles" >> typeof _vehicle); 8 | 9 | pr _displayName = getText(_cfg >>"displayname"); 10 | 11 | diag_log _displayName; 12 | 13 | pr _type = _vehicle call JN_fnc_common_vehicle_getVehicleType; 14 | 15 | pr _size = getNumber(_cfg >> "mapsize"); 16 | 17 | pr _armor = getNumber(_cfg >> "armor"); 18 | 19 | 20 | pr _AllHitPointsDamage = getAllHitPointsDamage _vehicle; 21 | pr _hitpoints = []; 22 | pr _selections = []; 23 | pr _hitTypes = []; 24 | 25 | { 26 | pr _hitpoint = _x; 27 | pr _selection = (_AllHitPointsDamage select 1) select _forEachIndex; 28 | if(!(_hitpoint in _hitpoints) && !((_vehicle selectionPosition [_selection,"HitPoints"]) isEqualTo [0,0,0]))then{ 29 | pr _hitType = ([_hitpoint,_selection] call { 30 | params ["_hitpoint","_selection"]; 31 | if(_selection find "wheel" != -1)exitWith{TYPE_WHEEL}; 32 | if(_hitpoint find "hitfuel" != -1)exitWith{TYPE_FUEL}; 33 | if(_hitpoint find "hithull" != -1)exitWith{TYPE_HULL}; 34 | if(_hitpoint find "hitbody" != -1)exitWith{TYPE_BODY}; 35 | if(_hitpoint find "hitglass" != -1)exitWith{TYPE_GLASS}; 36 | if(_hitpoint find "hitengine" != -1)exitWith{TYPE_ENGINE}; 37 | if(_hitpoint find "hitrtrack" != -1)exitWith{TYPE_TRACK}; 38 | if(_hitpoint find "hitltrack" != -1)exitWith{TYPE_TRACK}; 39 | if(_hitpoint find "#" == 0)exitWith{TYPE_LIGHT}; 40 | -1; 41 | }); 42 | 43 | if!(_hitType in [-1, TYPE_LIGHT])then{//we add lights later 44 | _hitpoints pushBack _hitpoint; 45 | _selections pushBack _selection; 46 | _hitTypes pushBack _hitType; 47 | }; 48 | }; 49 | }forEach (_AllHitPointsDamage select 0); 50 | 51 | pr _reflectorsCfgs = configProperties [_cfg >> "Reflectors", "isClass _x", true]; 52 | pr _lights = []; 53 | { 54 | pr _reflectorsCfg = _x; 55 | 56 | pr _hitpoint = ("#" + getText(_reflectorsCfg >> "hitpoint")); 57 | pr _selection = getText(_reflectorsCfg >> "position"); 58 | pr _pos = _vehicle selectionPosition _selection; 59 | pr _distance = _pos distance [0,0,0]; 60 | pr _found = false; 61 | { 62 | _x params ["_hitpoint1","_selection1","_distance1"]; 63 | if(_hitpoint isEqualTo _hitpoint1)then{ 64 | _found = true; 65 | if(_distance < _distance1)then{ 66 | _lights set [_forEachIndex, [_hitpoint,_selection,_distance]]; 67 | }; 68 | } 69 | }forEach _lights; 70 | 71 | if(!_found)then{_lights pushBack [_hitpoint,_selection,_distance]}; 72 | 73 | }forEach _reflectorsCfgs; 74 | 75 | { 76 | _x params ["_hitpoint","_selection"]; 77 | _hitpoints pushBack _hitpoint; 78 | _selections pushBack _selection; 79 | _hitTypes pushBack TYPE_LIGHT; 80 | diag_log [_hitpoint,_selection]; 81 | }forEach _lights; 82 | 83 | 84 | pr _wheelSize = -1; 85 | pr _wheelCfgs = configProperties [_cfg >> "Wheels", "isClass _x", true]; 86 | if(count _wheelCfgs > 0)then{_wheelSize = getNumber(_wheelCfgs select 0 >> "width")}; 87 | 88 | 89 | [_displayName,_type,_size,_armor,_wheelSize,_hitpoints,_selections,_hitTypes] 90 | 91 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/fn_logistics_unLoad.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | Detach the last loaded cargo and places it behind the vehicle. It also removes the action on the vehicle if its not needed anymore 8 | 9 | Parameter(s): 10 | OBJECT vehicle 11 | 12 | Returns: 13 | BOOL true - if it was succesfully unloaded, otherwhise false 14 | */ 15 | 16 | params ["_vehicle"]; 17 | 18 | //find last attached cargo object 19 | pr _object = objNull; 20 | pr _nodeLast = -1; 21 | { 22 | pr _array = _x getVariable ["jnl_cargo",nil];//returns nr of node if the object was attached by JNL 23 | 24 | if(!isNil "_array")then{ 25 | pr _node = _array select 1; 26 | if(_node > _nodeLast)then{ 27 | _nodeLast = _node; 28 | _object = _x; 29 | }; 30 | }; 31 | } forEach attachedObjects _vehicle; 32 | 33 | //todo add better location, maybe some moving animation 34 | _return = false; 35 | 36 | if(!isnull _object)then{ 37 | 38 | //create animation 39 | [_vehicle,_object] spawn { 40 | params ["_vehicle","_object"]; 41 | _vehicle setVariable ["jnl_isUnloading",true, true]; 42 | pr _nodeArray = _object getVariable ["jnl_cargo",[0,0]]; 43 | pr _objectType = _nodeArray select 0; 44 | pr _nodeID = _nodeArray select 1; 45 | 46 | if(_objectType == 0)then{//if its a weapon 47 | _object enableWeaponDisassembly true; 48 | }; 49 | 50 | pr _loc1 = [_vehicle, _object, _nodeID] call jn_fnc_logistics_getCargoOffsetAndDir select 0; 51 | 52 | pr _bbv = (boundingBoxReal _vehicle select 0 select 1) + ((boundingCenter _vehicle) select 1); 53 | pr _bbo = (boundingBoxReal _object select 0 select 1) + ((boundingCenter _object) select 1); 54 | pr _yEnd = _bbv + _bbo - 0.1; 55 | 56 | while {_loc1 select 1 > _yEnd}do{ 57 | sleep 0.1; 58 | _loc1 = _loc1 vectorAdd [0,-0.1,0]; 59 | _object attachto [_vehicle,_loc1]; 60 | }; 61 | 62 | //set speed incase vehicle was moving 63 | pr _vel = velocity _vehicle; 64 | detach _object; 65 | _object setVelocity _vel; 66 | 67 | _vehicle setVariable ["jnl_isUnloading",false, true]; 68 | //Clear object's jnl_cargo variable 69 | _object setVariable ["jnl_cargo", Nil]; 70 | 71 | //re-enable seats 72 | //need to call the function here, since it gets data from jnl_cargo! 73 | [_vehicle] remoteExec ["jn_fnc_logistics_lockSeats",[0, -2] select isDedicated,_vehicle]; 74 | }; 75 | 76 | _return = true; 77 | }; 78 | 79 | //remove action if it was the last peace of cargo on the vehicle 80 | if(_nodeLast == 0)then{ 81 | [_vehicle] remoteExec ["jn_fnc_logistics_removeActionUnload",[0, -2] select isDedicated, _vehicle]; 82 | [_vehicle] remoteExec ["jn_fnc_logistics_removeActionGetInWeapon", [0, -2] select isDedicated, _vehicle]; 83 | [_object] remoteExec ["jn_fnc_logistics_removeEventGetOut", [0, -2] select isDedicated, _object]; 84 | }; 85 | 86 | //reset ACE carry if there was one 87 | _ace_dragging_canDrag = _object getVariable ["ace_dragging_canDrag_old",nil]; 88 | _ace_dragging_canCarry = _object getVariable ["ace_dragging_canCarry_old",nil]; 89 | _ace_cargo_canLoad = _object getVariable ["ace_cargo_canLoad_old",nil]; 90 | _object setVariable ["ace_dragging_canDrag",_ace_dragging_canDrag]; 91 | _object setVariable ["ace_dragging_canCarry",_ace_dragging_canCarry]; 92 | _object setvariable ["ace_cargo_canLoad",_ace_cargo_canLoad]; 93 | 94 | _return 95 | -------------------------------------------------------------------------------- /JeroenArsenal/Test/copyFunctions.sqf: -------------------------------------------------------------------------------- 1 | //copy functions to profileNameSpace 2 | _tags = "true" configClasses (missionConfigFile >> "cfgFunctions" >> "JN"); 3 | 4 | _names = []; 5 | { 6 | _tag = configName _x; 7 | _functions = "true" configClasses _x; 8 | { 9 | _names pushBack (format["JN_fnc_%1",configName _x]); 10 | }forEach _functions; 11 | }forEach _tags ; 12 | 13 | profileNamespace setVariable ["jn_functions",_names]; 14 | 15 | { 16 | _name = _x; 17 | profileNamespace setVariable [_name,call compile _name]; 18 | }forEach _names; 19 | 20 | saveProfileNamespace; 21 | 22 | 23 | //get fuctions from profileNameSpace 24 | 25 | _names = profileNamespace getVariable ["jn_functions",[]]; 26 | { 27 | _name = _x; 28 | if(((toLower _name) find "jn_fnc_fuel_")==0)then{ 29 | _code = profileNamespace getVariable _name; 30 | _string = str _code; 31 | _code = compile _string ; 32 | 33 | MissionNamespace setVariable [_name,call _code]; 34 | publicVariable _name; 35 | }; 36 | }forEach _names; 37 | 38 | if!(name player isEqualTo "JMcStone")exitWith{}; 39 | 40 | //////////////////////////////////////////////////////////TEMP 41 | 42 | _tags = "true" configClasses (missionConfigFile >> "cfgFunctions" >> "a3a"); 43 | 44 | _names = []; 45 | { 46 | _tag = configName _x; 47 | _functions = "true" configClasses _x; 48 | { 49 | _names pushBack (format["A3A_fnc_%1",configName _x]); 50 | }forEach _functions; 51 | }forEach _tags ; 52 | 53 | profileNamespace setVariable ["A3A_functions",_names]; 54 | 55 | { 56 | _name = _x; 57 | profileNamespace setVariable [_name,call compile _name]; 58 | }forEach _names; 59 | 60 | saveProfileNamespace; 61 | 62 | /////////////// 63 | 64 | _names = profileNamespace getVariable ["a3a_functions",[]]; 65 | { 66 | _name = _x; 67 | _code = profileNamespace getVariable _name; 68 | _string = str _code; 69 | _code = compile _string ; 70 | 71 | MissionNamespace setVariable [_name,call _code]; 72 | publicVariable _name; 73 | }forEach _names; 74 | 75 | if!(name player isEqualTo "JMcStone")exitWith{}; 76 | 77 | ["A3A_fnc_arsenal","A3A_fnc_arsenal_addItem","A3A_fnc_arsenal_addToArray","A3A_fnc_arsenal_cargoToArray","A3A_fnc_arsenal_cargoToArsenal","A3A_fnc_arsenal_init","A3A_fnc_arsenal_inList","A3A_fnc_arsenal_itemCount","A3A_fnc_arsenal_itemType","A3A_fnc_arsenal_loadInventory","A3A_fnc_arsenal_removeFromArray","A3A_fnc_arsenal_removeItem","A3A_fnc_arsenal_requestOpen","A3A_fnc_arsenal_requestClose","A3A_fnc_vehicleArsenal","A3A_fnc_garage","A3A_fnc_garage_addVehicle","A3A_fnc_garage_init","A3A_fnc_garage_releaseVehicle","A3A_fnc_garage_removeVehicle","A3A_fnc_garage_requestOpen","A3A_fnc_garage_requestClose","A3A_fnc_garage_requestVehicle","A3A_fnc_common_vehicle_getVehicleType","A3A_fnc_garage_getVehicleData","A3A_fnc_garage_garageVehicle","A3A_fnc_garage_canGarageVehicle","A3A_fnc_logistics_init","A3A_fnc_logistics_load","A3A_fnc_logistics_unLoad","A3A_fnc_logistics_addAction","A3A_fnc_logistics_removeAction","A3A_fnc_logistics_addActionGetInWeapon","A3A_fnc_logistics_addActionLoad","A3A_fnc_logistics_addActionUnload","A3A_fnc_logistics_addEventGetOutWeapon","A3A_fnc_logistics_removeActionGetInWeapon","A3A_fnc_logistics_removeActionLoad","A3A_fnc_logistics_removeActionUnload","A3A_fnc_logistics_removeEventGetOutWeapon","A3A_fnc_logistics_canLoad","A3A_fnc_logistics_getCargo","A3A_fnc_logistics_getCargoOffsetAndDir","A3A_fnc_logistics_getCargoType","A3A_fnc_logistics_getNodes","A3A_fnc_logistics_lockSeats"] -------------------------------------------------------------------------------- /stringtable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Select 7 | Auswählen 8 | 9 | 10 | Cancel 11 | Abbrechen 12 | 13 | 14 | Select an object 15 | Objekt auswählen 16 | 17 | 18 | Not looking at anything 19 | Nichts ausgewählt 20 | 21 | 22 | 23 | 24 | 25 | 26 | Arsenal 27 | Arsenal 28 | 29 | 30 | Load into vehicle 31 | In Fahrzeug laden 32 | 33 | 34 | Unload from vehicle 35 | Fahrzeug entladen 36 | 37 | 38 | Not looking at an object 39 | 40 | 41 | Object too far away 42 | Objekt zu weit entfernt 43 | 44 | 45 | Object does not have any inventory 46 | Objekt hat kein Inventar 47 | 48 | 49 | 50 | 51 | 52 | 53 | Open garage 54 | Garage öffnen 55 | 56 | 57 | Garage Vehicle 58 | Fahrzeug verstauen 59 | 60 | 61 | Vehicle too far away 62 | Fahrzeug zu weit entfernt 63 | 64 | 65 | Not looking at a vehicle 66 | Kein Fahrzeug ausgewählt 67 | 68 | 69 | 70 | 71 | 72 | 73 | Refuel 74 | Betanken 75 | 76 | 77 | Refuel cargo or tank 78 | Tank oder Ladung betanken 79 | 80 | 81 | Tank 82 | Tank 83 | 84 | 85 | Cargo 86 | Ladung 87 | 88 | 89 | 90 | 91 | 92 | 93 | Rearm 94 | Neubewaffnen 95 | 96 | 97 | 98 | 99 | 100 | 101 | Repair 102 | Reparieren 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_addActionRepair.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | adds repair button to object 7 | 8 | Parameter(s): 9 | Object: to add action to 10 | int: total amount of points that object can store 11 | (int): starting amount of points in object [default: 0] 12 | 13 | Returns: 14 | Nil 15 | 16 | Usage: [this,1000] call JN_fnc_repair_addActionRepair 17 | 18 | */ 19 | 20 | params[["_vehicle",objNull,[objNull]],["_repairCargoCapacity",0,[0]],["_repairCargo",0,[0,nil]]]; 21 | 22 | //check if it already has a action 23 | if !isnil(_vehicle getVariable "repairAction_id")exitWith{diag_log ("JN_repair already init for object: "+str _vehicle)}; 24 | 25 | pr _id = _vehicle addaction [ 26 | STR_ACTION_REPAIR(_repairCargo,_repairCargoCapacity), 27 | { 28 | pr _vehicle = _this select 0; 29 | 30 | //check if object has still repair 31 | pr _repairCargo = _vehicle call JN_fnc_repair_getCargo; 32 | if(_repairCargo == 0)exitWith{hint "No repair in object"}; 33 | 34 | //create select action 35 | pr _script = { 36 | params ["_vehicleFrom"]; 37 | pr _vehicleTo = cursorObject; 38 | pr _type = _vehicleTo call JN_fnc_common_vehicle_getVehicleType; 39 | 40 | pr _skill_Vehicle = SKILL_REQUIRED_VEHICLE select _type; 41 | pr _skill = _vehicleFrom getVariable ["jn_repair_skill",1]; 42 | pr _typeName = TYPE_VEHICLES select _type; 43 | if(_skill < _skill_Vehicle)exitWith{hint format["I dont know how to work on %1s",toLower _typeName]}; 44 | 45 | pr _points = player call JN_fnc_repair_getCargo; 46 | if(_points == 0)exitWith{hint "no repair points"}; 47 | if(_points < 10)exitWith{hint "to less points"}; 48 | 49 | [_vehicleTo, player] call JN_fnc_repair_addSelectRepair; 50 | 51 | 52 | 53 | [_vehicle2,_vehicle] call JN_fnc_repair_repair; 54 | pr _id = _vehicle getVariable "repairAction_id"; 55 | }; 56 | pr _conditionActive = { 57 | params ["_vehicle"]; 58 | alive player; 59 | }; 60 | pr _conditionColor = { 61 | params ["_vehicle"]; 62 | !isnull cursorObject&&{_vehicle distance cursorObject < INT_MAX_DISTANCE_TO_REPAIR} 63 | }; 64 | 65 | [_script,_conditionActive,_conditionColor,_vehicle] call jn_fnc_common_addActionSelect; 66 | }, 67 | [], 68 | 4, 69 | true, 70 | false, 71 | "", 72 | "alive _target && {_target distance _this < 5} && {player == vehicle player}" 73 | 74 | ]; 75 | _vehicle setVariable ["repairAction_id",_id]; 76 | 77 | _vehicle setAmmoCargo 0; //disable Armas shit because its broken 78 | [_vehicle, _repairCargoCapacity] call JN_fnc_repair_setCargoCapacity;//call this before setting repair value 79 | [_vehicle, _repairCargo] call JN_fnc_repair_setCargo;//need actionId so we need to run it after we create the action 80 | 81 | 82 | pr _id = _vehicle addaction [ 83 | "Refill toolkit", 84 | { 85 | pr _vehicle = _this select 0; 86 | 87 | pr _pointsPlayer = player call JN_fnc_repair_getCargo; 88 | pr _pointsCapPlayer = player call JN_fnc_repair_getCargoCapacity; 89 | 90 | pr _pointsVehicle = _vehicle call JN_fnc_repair_getCargo; 91 | 92 | 93 | if(_pointsPlayer >= _pointsCapPlayer)exitWith{hint "already full"}; 94 | if(_pointsVehicle == 0)exitWith{hint "No more points in object"}; 95 | 96 | pr _amount = _pointsCapPlayer-_pointsPlayer; 97 | if(_amount > _pointsVehicle)then{_amount = _pointsVehicle; hint "partly refilled"}else{hint "fully refilled"}; 98 | 99 | [player,_pointsPlayer+_amount] call JN_fnc_repair_setCargo; 100 | [_vehicle,_pointsVehicle-_amount] call JN_fnc_repair_setCargo; 101 | 102 | }, 103 | [], 104 | 5, 105 | true, 106 | false, 107 | "", 108 | "alive _target && {_target distance _this < 5} && {player == vehicle player} && {itemCargo backpackContainer player find 'ToolKit' != -1}" 109 | 110 | ]; -------------------------------------------------------------------------------- /JeroenArsenal/Ammo/fn_ammo_getLoadout.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params[["_vehicle",objNull,[objNull]]]; 4 | pr _turretsPaths = [typeof _vehicle, true] call BIS_fnc_allTurrets; 5 | pr _turretsCfgs = ([_vehicle] call BIS_fnc_getTurrets); 6 | if(count _turretsPaths != count _turretsCfgs)then{_turretsPaths = [[-1]] + _turretsPaths;}; 7 | 8 | pr _magDetail = magazinesAllTurrets _vehicle; 9 | 10 | pr _seatName = _vehicle call JN_fnc_common_vehicle_getSeatNames; 11 | 12 | pr _data = []; 13 | pr _index = 0; 14 | { 15 | 16 | pr _turretCfg = _x; 17 | pr _turretPath = (_turretsPaths select _forEachIndex); 18 | 19 | pr _turretWeapons = getArray (_turretCfg >> "weapons"); 20 | private _turretDisplayName = _seatName select 1 select ((_seatName select 0) find _turretPath); 21 | pr _turretMagazines = getArray (_turretCfg >> "magazines"); 22 | 23 | pr _turretData = []; 24 | { 25 | pr _weapon = _x; 26 | pr _weaponDisplayName = gettext (configfile >> "CfgWeapons" >> _weapon >> "displayName"); 27 | pr _weaponMagazines = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); 28 | 29 | pr _dataWeapon = []; 30 | { 31 | pr _turretMagazine = _x; 32 | pr _turretMagazineDisplayName = getText (configfile >> "CfgMagazines" >> _turretMagazine >> "displayNameShort"); 33 | if(_turretMagazineDisplayName == "")then{_turretMagazineDisplayName = "Ammo"}; 34 | pr _turretMagazineSizeMax = getNumber(configfile >> "CfgMagazines" >> _turretMagazine >> "count"); 35 | 36 | pr _inserted = false; 37 | { 38 | _x params["_turretMagazineL","_turretMagazineDisplayNameL","_turretMagazineSizeL","_turretMagazineSizeMaxL"]; 39 | if(_turretMagazineL isEqualTo _turretMagazine)exitWith{ 40 | _x set [3,_turretMagazineSizeMaxL+_turretMagazineSizeMax]; 41 | _inserted = true; 42 | }; 43 | }forEach _dataWeapon; 44 | 45 | pr _index = _weaponMagazines find _turretMagazine; 46 | if(!_inserted && {_index != -1})then{ 47 | _dataWeapon pushBack [_turretMagazine,_turretMagazineDisplayName,0,_turretMagazineSizeMax,_turretMagazineSizeMax,-1]; 48 | }; 49 | 50 | }forEach _turretMagazines; 51 | 52 | _turretData pushBack [_weaponDisplayName, _dataWeapon]; 53 | }forEach _turretWeapons; 54 | 55 | if(!isnil"_turretPath")then{ 56 | _data pushBack [_turretPath, _turretDisplayName, _turretData]; 57 | }; 58 | } forEach _turretsCfgs; 59 | 60 | { 61 | _x params ["_magType","_magPath","_magAmount"]; 62 | scopeName "data"; 63 | { 64 | _x params ["_turretPath","_turretDisplayName","_turretData"]; 65 | pr _turretIndex = _forEachIndex; 66 | if(_turretPath isEqualTo _magPath)exitWith{ 67 | { 68 | _x params ["_weaponDisplayName", "_dataWeapon"]; 69 | pr _weaponIndex = _forEachIndex; 70 | { 71 | _x params ["_turretMagazine","_turretMagazineDisplayName","_turretMagazineSize","_turretMagazineSizeMax"]; 72 | pr _magazineIndex = _forEachIndex; 73 | if(_turretMagazine isEqualTo _magType)exitWith{ 74 | _x set [2, _turretMagazineSize + _magAmount]; 75 | //_turretData set [_magazineIndex,_x]; 76 | //_data set [_turretIndex,_turretData]; 77 | breakTo "data"; 78 | }; 79 | }forEach _dataWeapon; 80 | }forEach _turretData; 81 | }; 82 | }forEach _data; 83 | }forEach _magDetail; 84 | 85 | pr _turretDataDriver = _data select 0 select 2; 86 | { 87 | _x params ["_magazine"]; 88 | pr _pylonId = (_forEachIndex + 1); 89 | pr _magazineDisplayName = getText(configfile >> "CfgMagazines" >> _magazine >> "displayNameShort"); 90 | pr _weapon = getText(configfile >> "CfgMagazines" >> _magazine >> "pylonWeapon"); 91 | pr _weaponDisplayName = getText(configfile >> "CfgWeapons" >> _weapon >> "displayName"); 92 | pr _currentAmount = _vehicle ammoOnPylon _pylonId; 93 | pr _maxAmount = getNumber(configfile >> "CfgMagazines" >> _x >> "count"); 94 | 95 | _turretDataDriver pushBack [format["Pylon %1 (%2)",_pylonId,_weaponDisplayName], [[_magazine,_magazineDisplayName,_currentAmount,_maxAmount,_maxAmount,_pylonId]]]; 96 | 97 | }forEach (getPylonMagazines _vehicle); 98 | 99 | _data; 100 | -------------------------------------------------------------------------------- /JeroenArsenal/Fuel/fn_fuel_refuel.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | /* 4 | Author: Jeroen Notenbomer 5 | 6 | Description: 7 | refuel vehicle with objects fuelCargo. 8 | used by addActionRefuel 9 | 10 | Parameter(s): 11 | _object: object to refuel 12 | _object: object to refuel from 13 | 14 | Returns: 15 | 16 | 17 | */ 18 | _this spawn { 19 | params[["_vehicleTo",objNull,[objNull]], ["_vehicleFrom",objNull,[objNull]]]; 20 | 21 | if(_vehicleTo distance _vehicleFrom > INT_MAX_DISTANCE_TO_REFUEL)exitwith{hint "vehicle to far away"}; 22 | 23 | //check if objects are in use by other players 24 | if(!isNil {_vehicleTo getVariable "refuelAction_inUse"})exitWith{hint "Vehicle is already being refueld"}; 25 | if(!isNil {_vehicleFrom getVariable "refuelAction_inUse"})exitWith{hint "Object in use"}; 26 | 27 | 28 | //check the options we have where fuel needs to go to and select one 29 | pr _cargoCapacity = _vehicleTo call jn_fnc_fuel_getCargoCapacity; 30 | pr _capacity = _vehicleTo call jn_fnc_fuel_getCapacity; 31 | 32 | if(_cargoCapacity == 0 && {_capacity == 0})exitWith{hint "cant refuel vehicle"}; 33 | 34 | pr _hasBoth = (_cargoCapacity != 0 && {_capacity != 0}); 35 | pr "_anserMsg"; 36 | if _hasBoth then{ 37 | if(_vehicleTo isEqualTo _vehicleFrom)then{ 38 | _anserMsg = true 39 | }else{ 40 | _anserMsg = [ 41 | localize "STR_JN_FUEL_ACT_REFUELOPTION", localize "STR_JN_FUEL_ACT_REFUEL", localize "STR_JN_FUEL_ACT_FUELTANK", localize "STR_JN_FUEL_ACT_FUELCARGO" 42 | ] call BIS_fnc_guiMessage; 43 | }; 44 | }; 45 | 46 | //exit when object is for example a fuelstation 47 | if(_vehicleTo isEqualTo _vehicleFrom && !_hasBoth)exitwith{hint "object has no fuel tank"}; 48 | 49 | if(isNil "_anserMsg")then{ 50 | _anserMsg = (_cargoCapacity == 0); 51 | }; 52 | 53 | 54 | pr _get = [jn_fnc_fuel_getCargo, jn_fnc_fuel_get] select _anserMsg; 55 | pr _set = [jn_fnc_fuel_setCargo, jn_fnc_fuel_set] select _anserMsg; 56 | _capacity = [_cargoCapacity, _capacity] select _anserMsg; 57 | 58 | pr _amount = _vehicleTo call _get; 59 | pr _amountFrom = _vehicleFrom call jn_fnc_fuel_getCargo; 60 | 61 | //check if tank is already full 62 | if(_capacity == _amount)exitwith{hint "vehicle is already full"}; 63 | 64 | //all checks are done vehicle can be refueled 65 | 66 | //disable refuel for other players 67 | _vehicleTo setVariable ["refuelAction_inUse",name player,true]; 68 | _vehicleFrom setVariable ["refuelAction_inUse",name player,true]; 69 | 70 | pr _completeRefuel = true; 71 | 72 | pr _refuelAmount = _capacity - _amount; //required for full refuel 73 | 74 | if(_refuelAmount > _amountFrom)then{_refuelAmount= _amountFrom;_completeRefuel = false;}; 75 | 76 | [player,{}] call JN_fnc_common_addActionCancel; 77 | 78 | //0L 10sec 10000L 60sec 79 | pr _delta = round( (FLOAT_REFUELINTERVAL*_capacity)/(10+(40*_capacity/10000))) + 1; 80 | 81 | while{_refuelAmount > 0}do{ 82 | if (player call JN_fnc_common_getActionCanceled)exitWith{}; 83 | 84 | //update 85 | 86 | if(_delta > _refuelAmount)then{_delta = _refuelAmount}; 87 | _refuelAmount = _refuelAmount - _delta; 88 | 89 | [_vehicleTo,(_vehicleTo call _get)+_delta] call _set; 90 | [_vehicleFrom,(_vehicleFrom call jn_fnc_fuel_getCargo)-_delta] call jn_fnc_fuel_setCargo; 91 | [player,("(" + str round(((_vehicleTo call _get)/ _capacity)*100) +"%)")] call JN_fnc_common_updateActionCancel; 92 | sleep FLOAT_REFUELINTERVAL; 93 | }; 94 | 95 | //update Global 96 | [_vehicleTo,(_vehicleTo call _get),true] call _set; 97 | [_vehicleFrom,(_vehicleFrom call jn_fnc_fuel_getCargo),true] call jn_fnc_fuel_setCargo; 98 | 99 | //message 100 | if(player call JN_fnc_common_getActionCanceled)then{ 101 | hint "Refuel canceled"; 102 | }else{ 103 | if(_completeRefuel)then{ 104 | hint "Vehicle refueled"; 105 | }else{ 106 | hint "Object ran out of fuel" 107 | }; 108 | }; 109 | 110 | //cleanup 111 | player call JN_fnc_common_removeActionCancel; 112 | _vehicleTo setVariable ["refuelAction_inUse",nil,true]; 113 | _vehicleFrom setVariable ["refuelAction_inUse",nil,true]; 114 | 115 | 116 | };//spawn -------------------------------------------------------------------------------- /JeroenArsenal/JNG/defineCommon.inc: -------------------------------------------------------------------------------- 1 | #include "..\defineCommon.inc" 2 | 3 | #define STATTYPE_DAMAGE 0 4 | #define STATTYPE_FUEL 1 5 | #define STATTYPE_FUELCARGO 2 6 | #define STATTYPE_AMMOCARGO 3 7 | #define STATTYPE_REPAIRCARGO 4 8 | #define STATTYPES [STATTYPE_FUEL,STATTYPE_FUELCARGO,STATTYPE_AMMO,STATTYPE_REPAIR] 9 | 10 | #define FADE_DELAY 0.15 11 | 12 | #define IDC_JNG_TAB_CAR TYPE_CAR 13 | #define IDC_JNG_TAB_ARMOR TYPE_ARMOR 14 | #define IDC_JNG_TAB_HELI TYPE_HELI 15 | #define IDC_JNG_TAB_PLANE TYPE_PLANE 16 | #define IDC_JNG_TAB_NAVAL TYPE_NAVAL 17 | #define IDC_JNG_TAB_STATIC TYPE_STATIC 18 | 19 | #define IDC_JNG_TAB_REARM IDC_RSCDISPLAYARSENAL_TAB_CARGOMAG 20 | #define IDC_JNG_TAB_REPAIR IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL 21 | #define IDC_JNG_TAB_REFUEL IDC_RSCDISPLAYARSENAL_TAB_ITEMACC 22 | #define IDC_JNG_TAB_TEXTURE IDC_RSCDISPLAYARSENAL_TAB_ITEMMUZZLE 23 | #define IDC_JNG_TAB_COMPONENT IDC_RSCDISPLAYARSENAL_TAB_ITEMBIPOD 24 | #define IDC_JNG_TAB_PYLON IDC_RSCDISPLAYARSENAL_TAB_CARGOPUT 25 | #define IDC_JNG_TAB_HARDPOINT IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC //uses the same tab id as IDC_JNG_TAB_PYLON 26 | 27 | #define IDC_JNG_TAB_REARM_SORT IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC 28 | 29 | 30 | #define IDCS_LEFT\ 31 | IDC_JNG_TAB_CAR,\ 32 | IDC_JNG_TAB_ARMOR,\ 33 | IDC_JNG_TAB_HELI,\ 34 | IDC_JNG_TAB_PLANE,\ 35 | IDC_JNG_TAB_NAVAL,\ 36 | IDC_JNG_TAB_STATIC 37 | 38 | #define IDCS_RIGHT\ 39 | IDC_JNG_TAB_REARM,\ 40 | IDC_JNG_TAB_REPAIR,\ 41 | IDC_JNG_TAB_REFUEL,\ 42 | IDC_JNG_TAB_TEXTURE,\ 43 | IDC_JNG_TAB_COMPONENT,\ 44 | IDC_JNG_TAB_PYLON,\ 45 | IDC_JNG_TAB_HARDPOINT 46 | 47 | #define IDCS [IDCS_LEFT,IDCS_RIGHT] 48 | 49 | #define DECOMPILE_DATA\ 50 | pr _data = if(_dataStr =="")then{[]}else{parseSimpleArray _dataStr}; 51 | 52 | #define SPLIT_SAVE\ 53 | _data params [\ 54 | "_name",\ 55 | "_beingChanged",\ 56 | "_locked",\ 57 | "_lockedName",\ 58 | "_type",\ 59 | "_texture",\ 60 | "_animations",\ 61 | "_ammoClassic",\ 62 | "_ammoPylon",\ 63 | "_damage",\ 64 | "_attachItem",\ 65 | "_fuel",\ 66 | "_fuelCap",\ 67 | "_fuelcargo",\ 68 | "_fuelcargoCap",\ 69 | "_ammocargo",\ 70 | "_ammocargoCap",\ 71 | "_repaircargo",\ 72 | "_repaircargoCap"\ 73 | ];\ 74 | 75 | #define COMPILE_SAVE\ 76 | if(isnil "_name" || isnil "_beingChanged" || isnil "_locked" || isnil "_lockedName" || isnil "_type" || isnil "_texture" || isnil "_animations" || isnil "_ammoClassic"|| isnil "_ammoPylon"|| isnil "_ammoClassic" || isnil "_damage" || isnil "_fuel" || isnil "_fuelCap" || isnil "_fuelcargo" || isnil "_fuelcargoCap" || isnil "_ammocargo" || isnil "_ammocargoCap" || isnil "_repaircargo" || isnil "_repaircargoCap")then{\ 77 | ["ERROR COMPILE_SAVE JGA"] call BIS_fnc_error;\ 78 | diag_log "ERROR COMPILE_SAVE JGA";\ 79 | };\ 80 | pr _data = [_name, _beingChanged, _locked, _lockedName, _type, _texture, _animations, _ammoClassic, _ammoPylon, _damage, _attachItem, _fuel, _fuelCap,_fuelcargo,_fuelcargoCap,_ammocargo,_ammocargoCap,_repaircargo,_repaircargoCap];\ 81 | pr _datastr = str _data; 82 | 83 | #define SPLIT_REARM\ 84 | pr _magazine = _data select 0;\ 85 | pr _currentAmount = _data select 1;\ 86 | pr _maxAmount = _data select 2;\ 87 | pr _displayName = _data select 3; 88 | 89 | #define COMPILE_REARM\ 90 | pr _data = [_magazine, _currentAmount, _maxAmount, _displayName];\ 91 | pr _datastr = str _data; 92 | 93 | 94 | #define AMOUTTOTEXT\ 95 | {\ 96 | pr _amount = _this;\ 97 | if(_amount == -1)exitWith{" ∞ ";};\ 98 | pr _suffix = "";\ 99 | pr _prefix = "";\ 100 | if(_amount > 9999)then{\ 101 | _amount = round(_amount/1000);_suffix="k";\ 102 | _prefix = switch true do{\ 103 | case(_amount>=1000):{_amount = 9999; "";};\ 104 | case(_amount>=100):{"0";};\ 105 | case(_amount>=10):{"00";};\ 106 | case(_amount>=0):{"000";};\ 107 | };\ 108 | }else{\ 109 | _prefix = switch true do{\ 110 | case(_amount>=1000):{"";};\ 111 | case(_amount>=100):{"0";};\ 112 | case(_amount>=10):{"00";};\ 113 | case(_amount>=0):{"000";};\ 114 | };\ 115 | };\ 116 | (_prefix + (str _amount) + _suffix);\ 117 | }; 118 | 119 | 120 | #define MAX_DISTANCE_TO_STORE 40 121 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_getVehicleData.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params [ ["_vehicle",objNull,[objNull]] ]; 4 | 5 | pr _index = _vehicle call jn_fnc_common_vehicle_getVehicleType; 6 | if (_index == -1) exitWith {nil}; 7 | 8 | pr _type = typeOf _vehicle; 9 | pr _cfg = (configfile >> "CfgVehicles" >> _type); 10 | pr _displayName = gettext(_cfg >> "displayName"); 11 | pr _name = _vehicle getVariable ["JNA_Name",_displayName]; 12 | 13 | 14 | 15 | //damage 16 | pr _damage = getAllHitPointsDamage _vehicle; 17 | if(_damage isEqualTo [])then{ 18 | _damage = getDammage _vehicle; 19 | }else{ 20 | _damage = _damage select 2; 21 | }; 22 | 23 | 24 | 25 | 26 | //Ammo 27 | pr _ammoClassic = []; 28 | { 29 | //magazinesAllTurrets type 30 | pr _magazine = _x select 0; 31 | pr _turret = _x select 1; 32 | pr _ammo = _x select 2; 33 | 34 | //skip pylon ammo 35 | if (gettext (configfile >> "CfgMagazines" >> _magazine >> "pylonWeapon") isEqualTo "")then{ 36 | pr _found = false; 37 | { 38 | pr _turret2 = _x select 0; 39 | pr _magazine2 = _x select 1; 40 | pr _ammo2 = _x select 2; 41 | if(_turret isEqualTo _turret2 && _magazine2 isEqualTo _magazine)exitWith{ 42 | _found = true; 43 | _ammoClassic set [_foreachindex,[_turret, _magazine, (_ammo + _ammo2)]]; 44 | }; 45 | } forEach _ammoClassic; 46 | 47 | if(!_found)then{ 48 | _ammoClassic pushback [_turret, _magazine, _ammo]; 49 | }; 50 | }; 51 | } forEach magazinesAllTurrets _vehicle; 52 | 53 | //pylon ammo 54 | pr _ammoPylon = []; 55 | { 56 | pr _type = _x; 57 | pr _amount = _vehicle ammoOnPylon (_foreachindex + 1); 58 | _ammoPylon pushback [_type,_amount]; 59 | } forEach getPylonMagazines _vehicle; 60 | 61 | //texture 62 | 63 | pr _toPlain = { 64 | _this = tolower _this; 65 | //remove first \ 66 | if(_this select [0,1] isEqualTo "\")then{_this = _this select [1,count _this];}; 67 | //remove .paa 68 | if(_this select [(count _this)-4,count _this] isEqualTo ".paa")then{ 69 | _this = _this select [0,(count _this)-4]; 70 | }; 71 | _this//return 72 | }; 73 | pr _texture = ""; 74 | pr _currentTexture = getObjectTextures _vehicle; 75 | { 76 | _currentTexture set [_foreachindex, _x call _toPlain]; 77 | } forEach _currentTexture; 78 | 79 | { 80 | pr _configName = configname _x; 81 | pr _displayName = gettext (_x >> "displayName"); 82 | pr _found = false; 83 | if (_displayName != "") then { 84 | _found = true; 85 | { 86 | pr _texture = _x call _toPlain; 87 | if!(_texture in _currentTexture)exitWith{_found = false;}; 88 | } forEach getarray (_x >> "textures"); 89 | }; 90 | if(_found) exitWith{_texture = _configName;}; 91 | 92 | } foreach (configproperties [_cfg >> "textureSources","isclass _x",true]); 93 | 94 | //animations 95 | pr _animations = []; 96 | { 97 | pr _configName = configname _x; 98 | if(_vehicle animationPhase _configName == 1)then{ 99 | _animations pushback _configName; 100 | }; 101 | } foreach (configproperties [_cfg >> "animationSources","isclass _x",true]); 102 | 103 | //attachtedWeapons 104 | pr _attachItem = []; 105 | { 106 | pr _typeAndNodeID = _x getVariable ["jnl_cargo",[-1,0]]; 107 | pr _type = _typeAndNodeID select 0; 108 | pr _nodeID = _typeAndNodeID select 1; 109 | if(_type == 0)exitWith{ 110 | _attachItem = ((_x call jn_fnc_garage_getVehicleData) select 0); 111 | }; 112 | } forEach attachedObjects _vehicle; 113 | 114 | //fuel 115 | pr _fuel = _vehicle call JN_fnc_fuel_get; 116 | pr _fuelCap = _vehicle call JN_fnc_fuel_getCapacity; 117 | 118 | //fuel cargo 119 | pr _fuelcargo = _vehicle call JN_fnc_fuel_getCargo; 120 | pr _fuelcargoCap = _vehicle call JN_fnc_fuel_getCargoCapacity; 121 | 122 | //fuel cargo 123 | pr _ammocargo = _vehicle call JN_fnc_ammo_getCargo; 124 | pr _ammocargoCap = _vehicle call JN_fnc_ammo_getCargoCapacity; 125 | 126 | //fuel cargo 127 | pr _repaircargo = _vehicle call JN_fnc_repair_getCargo; 128 | pr _repaircargoCap = _vehicle call JN_fnc_repair_getCargoCapacity; 129 | 130 | //set defaults 131 | pr _beingChanged = ""; 132 | pr _locked = getPlayerUID player; 133 | pr _lockedName = name player; 134 | 135 | //return 136 | COMPILE_SAVE 137 | 138 | _data 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_inventoryEvent.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | #define TOOLKITSIZE 400 4 | 5 | 6 | pr _count = {"ToolKit" isEqualTo _x}count (itemCargo backpackContainer player); 7 | [player,_count * TOOLKITSIZE] call JN_fnc_repair_setCargoCapacity; 8 | 9 | 10 | player addEventHandler ["InventoryOpened", { 11 | 12 | _h = _this spawn { 13 | params ["_unit", "_container"]; 14 | disableSerialization; 15 | waitUntil { !(isNull (findDisplay 602)) }; 16 | _display = (findDisplay 602); 17 | 18 | _ctrl_backpack = (_display displayctrl 619); 19 | _ctrl_ground = (_display displayctrl 632); 20 | _ctrl_crate = (_display displayctrl 640); 21 | _ctrls = [_ctrl_backpack,_ctrl_ground,_ctrl_crate]; 22 | uiNamespace setVariable ["JN_event_Toolbox_ctrl",_ctrls]; 23 | 24 | _container_backpack = backpackContainer player; 25 | _container_ground = if (cursorObject isKindOf "GroundWeaponHolder" && {cursorObject distance player <=3})then{cursorObject}else{getpos player nearestObject "GroundWeaponHolder"}; 26 | _container_crate = _container; 27 | _containers = [_container_backpack,_container_ground,_container_crate]; 28 | uiNamespace setVariable ["JN_event_Toolbox_container",_containers]; 29 | 30 | _object_backpack = player; 31 | _object_ground = _container_ground; 32 | _object_crate = _container_crate; 33 | _objects = [_object_backpack,_object_ground,_object_crate]; 34 | uiNamespace setVariable ["JN_event_Toolbox_object",_objects]; 35 | 36 | uiNamespace setVariable ["JN_event_Toolbox_listSize",[-1,-1,-1]]; 37 | 38 | pr _toolKitCounts = []; 39 | { 40 | _container = _x; 41 | _toolKitCounts pushBack ({"ToolKit" isEqualTo _x}count (itemCargo _container)); 42 | }foreach _containers; 43 | uiNamespace setVariable ["JN_event_Toolbox_count",_toolKitCounts]; 44 | 45 | _id = addMissionEventHandler ["EachFrame", { 46 | pr _ctrls = uiNamespace getVariable "JN_event_Toolbox_ctrl"; 47 | pr _containers = uiNamespace getVariable "JN_event_Toolbox_container"; 48 | pr _objects = uiNamespace getVariable "JN_event_Toolbox_object"; 49 | pr _toolKitCounts = uiNamespace getVariable "JN_event_Toolbox_count"; 50 | 51 | pr "_addedTo"; 52 | pr "_removedFrom"; 53 | { 54 | pr _container = _x; 55 | pr _count = {"ToolKit" isEqualTo _x}count (itemCargo _container); 56 | pr _countOld = _toolKitCounts select _forEachIndex; 57 | 58 | if(_count != _countOld)then{ 59 | 60 | _toolKitCounts set [_forEachIndex,_count]; 61 | if(_count > _countOld)then{_addedTo = _forEachIndex}else{_removedFrom = _forEachIndex}; 62 | 63 | }; 64 | }foreach _containers; 65 | 66 | if(!isnil "_addedTo" && {!isnil "_removedFrom"})then{ 67 | pr _objectTo = _objects select _addedTo; 68 | pr _objectFrom = _objects select _removedFrom; 69 | pr _toolKitCountTo = _toolKitCounts select _addedTo; 70 | pr _toolKitCountFrom = _toolKitCounts select _removedFrom; 71 | 72 | pr _amountTo = _objectTo call JN_fnc_repair_getCargo; 73 | pr _amountFrom = _objectFrom call JN_fnc_repair_getCargo; 74 | 75 | [_objectTo,_toolKitCountTo * TOOLKITSIZE] call JN_fnc_repair_setCargoCapacity; 76 | [_objectFrom, _toolKitCountFrom * TOOLKITSIZE] call JN_fnc_repair_setCargoCapacity; 77 | 78 | pr _amount = TOOLKITSIZE; 79 | if(_amount>_amountFrom)then{_amount = _amountFrom}; 80 | 81 | _amountTo = _amountTo + _amount; 82 | _amountFrom = _amountFrom - _amount; 83 | 84 | [_objectTo, _amountTo] call JN_fnc_repair_setCargo; 85 | [_objectFrom, _amountFrom] call JN_fnc_repair_setCargo; 86 | }; 87 | 88 | { 89 | pr _ctrl = _x; 90 | pr _object = _objects select _foreachIndex; 91 | for "_i" from 0 to lbSize _ctrl do{ 92 | pr _name = _ctrl lbText _i; 93 | if(_name isEqualTo "Toolkit")then{ 94 | pr _amount = _object call JN_fnc_repair_getCargo; 95 | pr _cap = _object call JN_fnc_repair_getCargoCapacity; 96 | _ctrl lbSetText [_i, format["Toolkit [%1/%2]",_amount,_cap]]; 97 | }; 98 | } 99 | }foreach _ctrls; 100 | 101 | }]; 102 | 103 | missionNamespace setVariable ["JN_event_Toolbox_id",_id]; 104 | }; 105 | }]; 106 | 107 | player addEventHandler ["InventoryClosed", { 108 | removeMissionEventHandler ["EachFrame", missionNamespace getVariable "JN_event_Toolbox_id"]; 109 | missionNamespace setVariable ["JN_event_Toolbox_id",nil]; 110 | }]; 111 | 112 | -------------------------------------------------------------------------------- /JeroenArsenal/JNL/fn_logistics_load.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params["_vehicle","_object", ["_allowUnload", true],["_playAnimation",true]]; 4 | 5 | /* 6 | Loads the _object on the _vehicle. 7 | Author: Sparker and Jeroen 8 | Returns: 9 | INTEGER node number where object can be loaded on to 10 | or -1 if a other type was already loaded 11 | or -2 if there was no more space 12 | or -3 if this vehicle can't have any cargo at all 13 | */ 14 | 15 | //Get the id of the node to load the _object 16 | 17 | pr _nodeID = [_vehicle, _object] call jn_fnc_logistics_canLoad; 18 | 19 | if(_nodeID < 0) exitWith {_nodeID;}; //Can't load the _object 20 | 21 | pr _objectType = _object call jn_fnc_logistics_getCargoType; 22 | _object setVariable ["jnl_cargo", [_objectType, _nodeID], true]; 23 | 24 | 25 | //disable the user action to disassable the weapon while its loaded 26 | if(_objectType == 0)then{ 27 | _object enableWeaponDisassembly false;//global 28 | }; 29 | 30 | 31 | //attach objects with or without animation 32 | if _playAnimation then{ 33 | //create animation 34 | [_vehicle,_object] spawn { 35 | params ["_vehicle","_object"]; 36 | _vehicle setVariable ["jnl_isUnloading",true, true]; 37 | pr _nodeArray = _object getVariable ["jnl_cargo",[0,0]]; 38 | pr _objectType = _nodeArray select 0; 39 | pr _nodeID = _nodeArray select 1; 40 | 41 | /* 42 | if(_objectType == 0)then{//if its a weapon 43 | _object enableWeaponDisassembly true; 44 | }; 45 | */ 46 | 47 | pr _bbv = (boundingBoxReal _vehicle select 0 select 1) + ((boundingCenter _vehicle) select 1); 48 | pr _bbo = (boundingBoxReal _object select 0 select 1) + ((boundingCenter _object) select 1); 49 | pr _yEnd = _bbv + _bbo - 0.1; //Y end(rear) of the car 50 | pr _cargoOffsetAndDir = [_vehicle, _object, _nodeID] call jn_fnc_logistics_getCargoOffsetAndDir; 51 | pr _locEnd = _cargoOffsetAndDir select 0; 52 | pr _locStart = [_locEnd select 0, _yEnd, _locEnd select 2]; 53 | //Set initial position 54 | _object attachto [_vehicle, _locStart]; 55 | _object setVectorDirAndUp [_cargoOffsetAndDir select 1, [0, 0, 1]]; 56 | pr _step = 0.1; 57 | 58 | //lock seats 59 | //Need to call the function here, because it gets data from objects attached to the vehicle 60 | sleep 0.1; 61 | [_vehicle] remoteExec ["jn_fnc_logistics_lockSeats",[0, -2] select isDedicated,_vehicle]; 62 | 63 | //Push it in till it's in place! 64 | while {_locStart select 1 < _locEnd select 1}do{ 65 | _locStart = _locStart vectorAdd [0, _step, 0]; 66 | _object attachto [_vehicle, _locStart]; 67 | _object setVectorDirAndUp [_cargoOffsetAndDir select 1, [0, 0, 1]]; 68 | sleep 0.1; 69 | }; 70 | 71 | 72 | //lock seats 73 | //_vehicle call jn_fnc_logistics_lockSeats;//needs to be called after detach 74 | 75 | _vehicle setVariable ["jnl_isUnloading",false, true]; 76 | }; 77 | }else{ 78 | pr _offsetAndDir = [_vehicle,_object,_nodeID] call jn_fnc_logistics_getCargoOffsetAndDir; 79 | _object hideObject true;//hide ugly rotation (to N and back to propper rotation) 80 | _object attachTo [_vehicle, _offsetAndDir select 0]; 81 | _object SetVectorDirAndUp [_offsetAndDir select 1, [0, 0, 1]]; 82 | _object hideObject false; 83 | }; 84 | 85 | //Add action to unload 86 | if(_allowUnload) then 87 | { 88 | [_vehicle] remoteExec ["jn_fnc_logistics_addActionUnload",[0, -2] select isDedicated,_vehicle]; 89 | }; 90 | 91 | //Add getOut event hanldler and getin Action 92 | if(_objectType == 0) then 93 | { 94 | [_object] remoteExec ["jn_fnc_logistics_addEventGetoutWeapon",[0, -2] select isDedicated,_object]; 95 | 96 | [_vehicle,_object] remoteExec ["jn_fnc_logistics_addActionGetinWeapon",[0, -2] select isDedicated,_vehicle]; 97 | }; 98 | 99 | //save ACE settings to we can reset them when we unload 100 | _ace_dragging_canDrag = _object getVariable ["ace_dragging_canDrag",false]; 101 | _ace_dragging_canCarry = _object getVariable ["ace_dragging_canCarry",false]; 102 | _ace_cargo_canLoad = _object getVariable ["ace_cargo_canLoad",false]; 103 | 104 | _object setVariable ["ace_dragging_canDrag_old",_ace_dragging_canDrag, true]; 105 | _object setVariable ["ace_dragging_canCarry_old",_ace_dragging_canCarry, true]; 106 | _object setvariable ["ace_cargo_canLoad_old",_ace_cargo_canLoad, true]; 107 | 108 | //disable ACE dragging 109 | _object setVariable ["ace_dragging_canDrag",false, true]; 110 | _object setVariable ["ace_dragging_canCarry",false, true]; 111 | _object setvariable ["ace_cargo_canLoad",false, true]; 112 | 113 | _nodeID 114 | -------------------------------------------------------------------------------- /JeroenArsenal/Repair/fn_repair_addSelectRepair.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | params ["_vehicle","_repairVehicle"]; 4 | 5 | pr _skill = _repairVehicle getVariable ["jn_repair_skill",1]; 6 | pr _data = _vehicle call jn_fnc_repair_getVehicleData; 7 | pr _hitpoints = _data select VEHICLE_DATA_HITPOINTS; 8 | pr _hitTypes = _data select VEHICLE_DATA_HITTYPES; 9 | uiNamespace setVariable ["jn_repair_vehicle_data",_data]; 10 | uiNamespace setVariable ["jn_repair_vehicle",_vehicle]; 11 | 12 | 13 | pr _display = (uiNamespace getVariable ["RscStanceInfo", []]); 14 | pr _icons = []; 15 | 16 | { 17 | pr _hitpoint = _x; 18 | pr _hitType = _hitTypes select _forEachIndex; 19 | pr _skill_part = SKILL_REQUIRED_PART select _hitType; 20 | if(_skill>=_skill_part)then{ 21 | pr _icon = _display ctrlCreate ["RscButton",-1];//we use a button for now TODO 22 | pr _pos = ctrlPosition _icon; 23 | _pos set [2,0.2]; 24 | _icon ctrlSetPosition _pos; 25 | _icon ctrlCommit 0; 26 | _icon setVariable ["_index",_forEachIndex]; 27 | _icons pushBack _icon; 28 | }; 29 | }forEach _hitpoints; 30 | 31 | uiNamespace setVariable ["jn_repair_icons",_icons]; 32 | 33 | pr _draw3D = addMissionEventHandler ["Draw3D", { 34 | pr _icons = uiNamespace getVariable "jn_repair_icons"; 35 | pr _vehicle = uiNamespace getVariable "jn_repair_vehicle"; 36 | pr _vehicleData = uiNamespace getVariable "jn_repair_vehicle_data"; 37 | pr _selections = _vehicleData select VEHICLE_DATA_SELECTIONS; 38 | pr _hitpoints = _vehicleData select VEHICLE_DATA_HITPOINTS; 39 | pr _hitTypes = _vehicleData select VEHICLE_DATA_HITTYPES; 40 | 41 | pr _array_pos = []; 42 | pr _closest = controlNull; 43 | pr _distance_closed = 10; 44 | pr _index_closest = -1; 45 | { 46 | pr _icon = _x; 47 | pr _index = _icon getVariable "_index"; 48 | pr _selection = _selections select _index; 49 | pr _hitpoint = _hitpoints select _index; 50 | pr _hitType = _hitTypes select _index; 51 | pr _hitname = TYPE_PARTS select _hitType; 52 | pr _pos_selection = (_vehicle selectionPosition _selection); 53 | pr _moveUp = { 54 | { 55 | if(_x isEqualTo _pos_selection)exitWith{ 56 | _pos_selection set [2,(_pos_selection select 2)+0.2]; 57 | call _moveUp; 58 | }; 59 | }foreach _array_pos; 60 | _array_pos pushBack _pos_selection; 61 | }; 62 | call _moveUp; 63 | 64 | 65 | 66 | 67 | pr _pos = worldToScreen (_vehicle modelToWorld _pos_selection); 68 | if(!(_pos isEqualTo []))then{ 69 | _pos set [0, (_pos select 0) - 0.1]; 70 | _icon ctrlSetPosition _pos; 71 | _icon ctrlShow true; 72 | _icon ctrlCommit 0; 73 | _icon ctrlSetText (format["%1 %2",_hitname, round ((_vehicle getHitPointDamage _hitpoint) *100)]+"%"); 74 | 75 | pr _distance = _pos distance [0.5 - 0.1, 0.5]; 76 | if(_distance < 0.1)then{ 77 | 78 | if(_distance<_distance_closed)then{ 79 | _distance_closed = _distance; 80 | _closest = _icon; 81 | _index_closest = _index; 82 | }; 83 | }; 84 | }else{ 85 | _icon ctrlShow false; 86 | }; 87 | }forEach _icons; 88 | //uiNamespace setVariable ["jn_repair_selected_icon",_closest]; 89 | uiNamespace setVariable ["jn_repair_selected_index",_index_closest]; 90 | 91 | //color icons 92 | { 93 | if(_closest isEqualTo _x)then{ 94 | _x ctrlSetTextColor COLOR_ORANGE; 95 | }else{ 96 | _x ctrlSetTextColor COLOR_WHITE; 97 | }; 98 | }forEach _icons; 99 | 100 | 101 | }]; 102 | 103 | uiNamespace setVariable ["jn_repair_draw3d",_draw3D]; 104 | 105 | 106 | //create select action 107 | 108 | pr _script = { 109 | params ["_vehicle"]; 110 | 111 | pr _index = uiNamespace getVariable ["jn_repair_selected_index",-1]; 112 | if(_index == -1)exitWith{hint "nothing selected";}; 113 | 114 | pr _data = uiNamespace getVariable "jn_repair_vehicle_data"; 115 | 116 | [_vehicle, player,_data,_index] call JN_fnc_repair_repairHitpoint; 117 | 118 | }; 119 | pr _conditionActive = { 120 | params ["_vehicle"]; 121 | alive player; 122 | }; 123 | pr _conditionColor = { 124 | params ["_vehicle"]; 125 | pr _index = uiNamespace getVariable ["jn_repair_selected_index",-1]; 126 | _index != -1; 127 | }; 128 | 129 | pr _removeScript = { 130 | removeMissionEventHandler ["Draw3D",(uiNamespace getVariable ["jn_repair_draw3d",-1])]; 131 | uiNamespace setVariable ["jn_repair_draw3d",nil]; 132 | { 133 | ctrlDelete _x; 134 | }forEach (uiNamespace getVariable ["jn_repair_icons",[]]); 135 | }; 136 | 137 | [_script,_conditionActive,_conditionColor,_vehicle,false,5,_removeScript] call jn_fnc_common_addActionSelect; 138 | 139 | 140 | -------------------------------------------------------------------------------- /JeroenArsenal/functions.hpp: -------------------------------------------------------------------------------- 1 | class JN { 2 | 3 | class Test { 4 | file = "JeroenArsenal\Test"; 5 | class test_init {preinit = 1;}; 6 | class test_recompile {}; 7 | class test_configViewer {}; 8 | class test_debugv2 {postinit = 1;}; 9 | }; 10 | class Common { 11 | file = "JeroenArsenal\Common"; 12 | class common_addActionSelect {}; 13 | class common_addActionCancel {}; 14 | class common_updateActionCancel {}; 15 | class common_removeActionCancel {}; 16 | class common_getActionCanceled {}; 17 | }; 18 | class Common_Vehicle { 19 | file = "JeroenArsenal\Common\vehicle"; 20 | class common_vehicle_getSeatNames {}; 21 | class common_vehicle_getVehicleType {}; 22 | }; 23 | class Common_Array { 24 | file = "JeroenArsenal\Common\array"; 25 | class common_array_add {}; 26 | class common_array_remove {}; 27 | }; 28 | class JNA { 29 | file = "JeroenArsenal\JNA"; 30 | class arsenal {}; 31 | class arsenal_addItem {}; 32 | class arsenal_cargoToArray {}; 33 | class arsenal_arrayToArsenal {}; 34 | class arsenal_cargoToArsenal {}; 35 | class arsenal_container {}; 36 | class arsenal_init {}; 37 | class arsenal_initPersistent {}; 38 | class arsenal_inList {}; 39 | class arsenal_itemCount {}; 40 | class arsenal_itemType {}; 41 | class arsenal_loadInventory {}; 42 | class arsenal_removeItem {}; 43 | class arsenal_requestOpen {}; 44 | class arsenal_requestClose {}; 45 | class arsenal_getEmptyArray {}; 46 | class arsenal_getPrimaryWeapons {}; 47 | class arsenal_getSecondaryWeapons {}; 48 | }; 49 | class JNG { 50 | file = "JeroenArsenal\JNG"; 51 | class garage {}; 52 | class garage_addVehicle {}; 53 | class garage_init {}; 54 | class garage_releaseVehicle {}; 55 | class garage_removeVehicle {}; 56 | class garage_requestOpen {}; 57 | class garage_requestClose {}; 58 | class garage_requestVehicle {}; 59 | class garage_getVehicleData {}; 60 | class garage_garageVehicle {}; 61 | class garage_canGarageVehicle {}; 62 | class garage_updatePoints {}; 63 | }; 64 | 65 | /* 66 | // Sorry had to disable that, it seems to desynchronize and nullify fual amounts sometimes 67 | class Fuel { 68 | file = "JeroenArsenal\Fuel"; 69 | class fuel_init {postinit = 1;}; 70 | class fuel_vehicleInit {}; 71 | class fuel_consumption_init {postInit = 1;}; 72 | class fuel_consumption_start {}; 73 | class fuel_consumption_stop {}; 74 | class fuel_refuel {}; 75 | class fuel_addActionRefuel {}; 76 | class fuel_get {}; 77 | class fuel_set {}; 78 | class fuel_getCapacity {}; 79 | class fuel_setCapacity {}; 80 | class fuel_getCargo {}; 81 | class fuel_setCargo {}; 82 | class fuel_getCargoCapacity {}; 83 | class fuel_setCargoCapacity {}; 84 | }; 85 | */ 86 | 87 | class Ammo { 88 | file = "JeroenArsenal\Ammo"; 89 | class ammo_init {preinit = 1;}; 90 | class ammo_getLoadout {}; 91 | class ammo_getPylonLoadoutMissing {}; 92 | class ammo_addActionRearm {}; 93 | class ammo_rearm {}; 94 | class ammo_gui {}; 95 | class ammo_set {}; 96 | class ammo_getCost {}; 97 | class ammo_getCargo {}; 98 | class ammo_setCargo {}; 99 | class ammo_getCargoCapacity {}; 100 | class ammo_setCargoCapacity {}; 101 | }; 102 | 103 | class Repair { 104 | file = "JeroenArsenal\Repair"; 105 | class repair_addActionRepair {}; 106 | class repair_addActionRepairPlayer {}; 107 | class repair_addSelectRepair {}; 108 | class repair_getWheelHitPointsWithSelections {}; 109 | class repair_getVehicleData {}; 110 | class repair_inventoryEvent {}; 111 | class repair_repairHitpoint {}; 112 | class repair_removeCargo {}; 113 | class repair_getCargo {}; 114 | class repair_setCargo {}; 115 | class repair_getCargoCapacity {}; 116 | class repair_setCargoCapacity {}; 117 | }; 118 | 119 | class JNL { 120 | file = "JeroenArsenal\JNL"; 121 | class logistics_init {preinit = 1;}; 122 | class logistics_load {}; 123 | class logistics_unLoad {}; 124 | class logistics_addAction {}; 125 | class logistics_removeAction {}; 126 | }; 127 | 128 | class JNL_Actions { 129 | file = "JeroenArsenal\JNL\Actions"; 130 | class logistics_addActionGetInWeapon {}; 131 | class logistics_addActionLoad {}; 132 | class logistics_addActionUnload {}; 133 | class logistics_addEventGetOutWeapon {}; 134 | class logistics_removeActionGetInWeapon {}; 135 | class logistics_removeActionLoad {}; 136 | class logistics_removeActionUnload {}; 137 | class logistics_removeEventGetOutWeapon {}; 138 | }; 139 | 140 | class JNL_Functions { 141 | file = "JeroenArsenal\JNL\Functions"; 142 | class logistics_canLoad {}; 143 | class logistics_getCargo {}; 144 | class logistics_getCargoOffsetAndDir {}; 145 | class logistics_getCargoType {}; 146 | class logistics_getNodes {}; 147 | class logistics_lockSeats {}; 148 | }; 149 | }; 150 | -------------------------------------------------------------------------------- /JeroenArsenal/JNG/fn_garage_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Adds garage to a given object 7 | 8 | Parameter(s): 9 | Object 10 | 11 | Returns: 12 | 13 | Usage: object call jn_fnc_garage_init; 14 | 15 | */ 16 | 17 | #include "defineCommon.inc" 18 | 19 | /////////////////////////////////////////////////////////////////////////////////////////// 20 | 21 | params [["_object",objNull,[objNull]]]; 22 | diag_log ("Init JNG: Start " + str _object); 23 | if(isNull _object)exitWith{["Error: wrong input given '%1'",_object] call BIS_fnc_error;}; 24 | 25 | //check if it was already initialised 26 | if(_object getVariable ["jng_init",false])exitWith{diag_log ("Init JNG: Already initialised " + str _object) }; 27 | _object setVariable ["jng_init", true]; 28 | 29 | 30 | 31 | //server 32 | if(isServer)then{ 33 | diag_log ("Init JNG: server " + str _object); 34 | 35 | //load default if it was not loaded from savegame 36 | pr _vehicleLists = _object getVariable "jng_vehicleLists"; 37 | if(isnil "_vehicleLists")then{ 38 | _object setVariable ["jng_vehicleLists" ,[[],[],[],[],[],[]]]; 39 | }; 40 | pr _fuel = _object getVariable "jng_fuel"; 41 | if(isnil "_fuel")then{ 42 | _object setVariable ["jng_fuel" ,0]; 43 | }; 44 | pr _ammoPoints = _object getVariable "jng_ammoPoints"; 45 | if(isnil "_ammoPoints")then{ 46 | _object setVariable ["jng_ammoPoints" ,0]; 47 | }; 48 | pr _repairPoints = _object getVariable "jng_repairPoints"; 49 | if(isnil "_repairPoints")then{ 50 | _object setVariable ["jng_repairPoints" ,0]; 51 | }; 52 | }; 53 | 54 | 55 | //player 56 | if(hasInterface)then{ 57 | diag_log ("Init JNG: player "+ str _object); 58 | 59 | //add open garage button to object 60 | _object addaction [ 61 | format ["%1",localize "STR_JNG_ACT_OPEN"], 62 | { 63 | pr _object = _this select 0; 64 | 65 | //start loading screen 66 | ["jn_fnc_garage", "Loading Nutz™ Arsenal"] call bis_fnc_startloadingscreen; 67 | [] spawn { 68 | uisleep 10; 69 | pr _ids = missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]]; 70 | if("jn_fnc_garage" in _ids)then{ 71 | pr _display = uiNamespace getVariable ["arsanalDisplay","No display"]; 72 | titleText["ERROR DURING LOADING GARAGE", "PLAIN"]; 73 | _display closedisplay 2; 74 | ["jn_fnc_garage"] call BIS_fnc_endLoadingScreen; 75 | }; 76 | }; 77 | 78 | //set type and object to use later 79 | UINamespace setVariable ["jn_type","garage"]; 80 | UINamespace setVariable ["jn_object",_object]; 81 | 82 | //request server to open garage 83 | [clientOwner,_object] remoteExecCall ["jn_fnc_garage_requestOpen",2]; 84 | }, 85 | [], 86 | 6, 87 | true, 88 | false, 89 | "", 90 | "alive _target && {_target distance _this < 5}" 91 | ]; 92 | 93 | //add garage vehicle option 94 | _object addaction [ 95 | format ["%1",localize "STR_JNG_ACT_STOREVEHICLE"], 96 | { 97 | pr _object = _this select 0; 98 | 99 | pr _script = { 100 | params ["_object"]; 101 | pr _vehicle = cursorObject; 102 | [_vehicle,_object] call jn_fnc_garage_garageVehicle; 103 | }; 104 | pr _conditionActive = { 105 | params ["_object"]; 106 | alive player; 107 | }; 108 | pr _conditionColor = { 109 | params ["_object"]; 110 | !isnull cursorObject && {!(_object isEqualTo cursorObject)}&&{_object distance cursorObject < MAX_DISTANCE_TO_STORE} 111 | }; 112 | 113 | [_script,_conditionActive,_conditionColor,_object] call jn_fnc_common_addActionSelect; 114 | }, 115 | [], 116 | 6, 117 | true, 118 | false, 119 | "", 120 | "alive _target && {_target distance _this < 5}" 121 | 122 | ]; 123 | 124 | 125 | if(missionNamespace getVariable ["jng_first_init",true])then{ 126 | 127 | //add open event 128 | [missionNamespace, "arsenalOpened", { 129 | disableSerialization; 130 | UINamespace setVariable ["arsanalDisplay",(_this select 0)]; 131 | 132 | //spawn this to make sure it doesnt freeze the game 133 | [] spawn { 134 | disableSerialization; 135 | _type = UINamespace getVariable ["jn_type",""]; 136 | if(_type isEqualTo "garage")then{ 137 | ["CustomInit", [uiNamespace getVariable "arsanalDisplay"]] call jn_fnc_garage; 138 | }; 139 | }; 140 | }] call BIS_fnc_addScriptedEventHandler; 141 | 142 | //add close event 143 | [missionNamespace, "arsenalClosed", { 144 | _type = UINamespace getVariable ["jn_type",""]; 145 | 146 | if(_type isEqualTo "garage")then{ 147 | [clientOwner, UINamespace getVariable "jn_object"] remoteExecCall ["jn_fnc_garage_requestClose",2]; 148 | }; 149 | 150 | UINamespace setVariable ["jn_type",""]; 151 | }] call BIS_fnc_addScriptedEventHandler; 152 | 153 | }; 154 | 155 | }; 156 | 157 | missionNamespace setVariable ["jng_first_init",false]; 158 | 159 | if(isServer)then{ 160 | diag_log ("Init Server JNG: done" + str _object); 161 | }else{ 162 | diag_log ("Init pLayer JNG: done" + str _object); 163 | }; 164 | 165 | -------------------------------------------------------------------------------- /JeroenArsenal/Test/fn_test_debugv2.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | fnc_debugv2_overwrite = { 4 | //waitUntil {!isNull findDisplay 49}; // no please don't waitUntil in unscheduled, by now display 49 already exists 5 | _display = findDisplay 49; 6 | 7 | _ctrl_debug = _display displayCtrl 13184; 8 | _pos_debug = ctrlposition _ctrl_debug;// [x, y, w, h] 9 | _pos_debug set [2, 1-safeZoneX- _pos_debug#0-0.03]; 10 | _ctrl_debug ctrlSetPosition _pos_debug; 11 | _ctrl_debug ctrlCommit 0; 12 | 13 | 14 | _ctrl_expressionBackground = _display displayCtrl 11885; 15 | _pos_expressionBackground = ctrlposition _ctrl_expressionBackground;// [x, y, w, h] 16 | _pos_expressionBackground set [2,_pos_debug#2]; 17 | _ctrl_expressionBackground ctrlSetPosition _pos_expressionBackground; 18 | _ctrl_expressionBackground ctrlCommit 0; 19 | 20 | _ctrl_expression = _display displayCtrl 12284; 21 | _pos_expression = ctrlposition _ctrl_expression;// [x, y, w, h] 22 | _pos_expression set [2,_pos_debug#2 - (_pos_expression#0 *2)]; 23 | _ctrl_expression ctrlSetPosition _pos_expression; 24 | _ctrl_expression ctrlCommit 0; 25 | 26 | _ctrl_expressionText = _display displayCtrl 11892; 27 | _pos_expressionText = ctrlposition _ctrl_expressionText;// [x, y, w, h] 28 | _pos_expressionText set [2,_pos_expression#2]; 29 | _ctrl_expressionText ctrlSetPosition _pos_expressionText; 30 | _ctrl_expressionText ctrlCommit 0; 31 | 32 | _ctrl_expressionOutputBackground = _display displayCtrl 13191; 33 | _pos_expressionOutputBackground = ctrlposition _ctrl_expressionOutputBackground; 34 | _pos_expressionOutputBackground set [2,_pos_expression#2]; 35 | _ctrl_expressionOutputBackground ctrlSetPosition _pos_expressionOutputBackground; 36 | _ctrl_expressionOutputBackground ctrlCommit 0; 37 | 38 | _ctrl_expressionOutput = _display displayCtrl 13190; 39 | _ctrl_expressionOutput ctrlSetPosition _pos_expressionOutputBackground; 40 | _ctrl_expressionOutput ctrlCommit 0; 41 | 42 | _ctrl_title = _display displayCtrl 11884; 43 | _pos_title = ctrlposition _ctrl_title; 44 | _pos_title set [2,_pos_expressionBackground#2]; 45 | _ctrl_title ctrlSetPosition _pos_title; 46 | _ctrl_title ctrlCommit 0; 47 | _ctrl_title ctrlsettext "Ultra Wide Extended Debug Console With Extra Save Buttens!"; 48 | 49 | _ctrl_links = _display displayCtrl 11891; 50 | _pos_links = ctrlposition _ctrl_links; 51 | _pos_links set [2,_pos_title#2]; 52 | _ctrl_links ctrlSetPosition _pos_links; 53 | _ctrl_links ctrlCommit 0; 54 | 55 | //update text because we have change the size and it doesnt update automaticly 56 | _ctrl_expression ctrlsettext ctrltext _ctrl_expression; 57 | 58 | 59 | 60 | _ctrl_watchBackground = _display displayCtrl 11886; 61 | _pos_watchBackground = ctrlposition _ctrl_watchBackground; 62 | 63 | _ctrl_localButton = _display displayCtrl 13484; 64 | _pos_localButton = ctrlposition _ctrl_localButton; // [x, y, w, h] 65 | _button_hieght = _pos_localButton#3; 66 | 67 | _ctrl_nextButton = _display displayCtrl 90111; 68 | _pos_nextButton = ctrlposition _ctrl_nextButton; 69 | 70 | 71 | _spacingY = (_pos_localButton#1 - _pos_nextButton#1)-_button_hieght ; 72 | _posXFINAL = _pos_watchBackground #0 + _pos_watchBackground #2 + _spacingY; 73 | _posYFINAL = _pos_expressionBackground #1 + _pos_expressionBackground #3 + _spacingY; 74 | 75 | _xSpaceButtons = (_pos_expressionBackground#0+_pos_expressionBackground#2-_posXFINAL); 76 | 77 | uiNameSpace setVariable ["jn_debugConsole_expression",_ctrl_expression]; 78 | uiNameSpace setVariable ["jn_debugConsole_buttons",[]]; 79 | 80 | _color= getarray(configfile >> "RscDisplayDebugPublic" >> "Controls" >> "DebugConsole" >> "controls" >> "ButtonExecuteLocal" >> "colorBackground"); 81 | 82 | _button_length = 0.06; 83 | _button_lengthRun = _xSpaceButtons - (3*_button_length) - (3*_spacingY); 84 | 85 | 86 | private _array = [ 87 | [ 88 | "...", 89 | _spacingY, 90 | _button_lengthRun, 91 | { 92 | params ["_index"]; 93 | _input = profilenamespace getVariable [format["jn_debugConsole_%1",_index],""]; 94 | 95 | _length = count _input; 96 | _start = -1; 97 | while {_start = _input find "/*"; _start > -1} do { 98 | _end = _input find "*/"; 99 | if(_end == -1)exitWith{}; 100 | _input = (_input select [0,_start]) + (_input select [_end+2,_length]); 101 | 102 | }; 103 | 104 | 105 | private _strings = []; 106 | private _start = -1; 107 | 108 | while {_start = _input find "//"; _start > -1} do 109 | { 110 | _input select [0, _start] call 111 | { 112 | private _badQuotes = _this call 113 | { 114 | private _qtsGood = []; 115 | private _qtsInfo = []; 116 | private _arr = toArray _this; 117 | 118 | { 119 | _qtsGood pushBack ((count _arr - count (_arr - [_x])) % 2 == 0); 120 | _qtsInfo pushBack [_this find toString [_x], _x]; 121 | } 122 | forEach [34, 39]; 123 | 124 | if (_qtsGood isEqualTo [true, true]) exitWith {0}; 125 | 126 | _qtsInfo sort true; 127 | _qtsInfo select 0 select 1 128 | }; 129 | 130 | if (_badQuotes > 0) exitWith 131 | { 132 | _last = _input select [_start] find toString [_badQuotes]; 133 | 134 | if (_last < 0) exitWith 135 | { 136 | _strings = [_input]; 137 | _input = ""; 138 | }; 139 | 140 | _last = _start + _last + 1; 141 | _strings pushBack (_input select [0, _last]); 142 | 143 | _input = _input select [_last]; 144 | }; 145 | 146 | _strings pushBack _this; 147 | _input = _input select [_start]; 148 | 149 | private _end = _input find toString [10]; 150 | 151 | if (_end < 0) exitWith {_input = ""}; 152 | 153 | _input = _input select [_end + 1]; 154 | }; 155 | }; 156 | 157 | _input = (_strings joinString "") + _input; 158 | 159 | call compile _input; 160 | } 161 | ],[ 162 | "Load", 163 | _spacingY, 164 | _button_length, 165 | { 166 | params ["_index"]; 167 | _text = profilenamespace getVariable [format["jn_debugConsole_%1",_index],""]; 168 | (UiNameSpace getVariable "jn_debugConsole_expression") ctrlsettext _text; 169 | } 170 | ],[ 171 | "Save", 172 | _spacingY, 173 | _button_length, 174 | { 175 | params ["_index"]; 176 | 177 | _text = ctrltext (UiNameSpace getVariable "jn_debugConsole_expression"); 178 | _name = "no name"; 179 | if(_text find "//" == 0)then{ 180 | _enter = _text find (toString [10]); 181 | if(_enter >0)then{ 182 | _name = _text select [2, _enter-2]; 183 | }; 184 | }; 185 | diag_log ["Save",_text]; 186 | 187 | uiNameSpace setVariable ["jn_debugConsole_index_saved",_index]; 188 | uiNameSpace setVariable [format ["jn_debugConsole_%1",_index],profilenamespace getVariable (format ["jn_debugConsole_%1",_index])]; 189 | uiNameSpace setVariable [format ["jn_debugConsole_%1_name",_index],profilenamespace getVariable (format ["jn_debugConsole_%1_name",_index])]; 190 | 191 | profilenamespace setVariable [format ["jn_debugConsole_%1",_index],_text]; 192 | profilenamespace setVariable [format ["jn_debugConsole_%1_name",_index],_name]; 193 | 194 | ((UiNameSpace getVariable "jn_debugConsole_buttons") # _index) ctrlSetText _name; 195 | } 196 | ],[ 197 | "Del", 198 | _spacingY*10, 199 | _button_length, 200 | { 201 | params ["_index"]; 202 | 203 | uiNameSpace setVariable ["jn_debugConsole_index_saved",_index]; 204 | uiNameSpace setVariable [format ["jn_debugConsole_%1",_index],profilenamespace getVariable (format ["jn_debugConsole_%1",_index])]; 205 | uiNameSpace setVariable [format ["jn_debugConsole_%1_name",_index],profilenamespace getVariable (format ["jn_debugConsole_%1_name",_index])]; 206 | 207 | 208 | profilenamespace setVariable [format ["jn_debugConsole_%1",_index],nil]; 209 | profilenamespace setVariable [format ["jn_debugConsole_%1_name",_index],nil]; 210 | ((UiNameSpace getVariable "jn_debugConsole_buttons") # _index) ctrlSetText "..."; 211 | } 212 | ] 213 | ]; 214 | 215 | _posX = 0; 216 | _posY = _posYFINAL; 217 | for "_index" from 0 to 9 do{ 218 | _posX = _posXFINAL; 219 | 220 | _nameP = profilenamespace getVariable [format['jn_debugConsole_%1_name',_index],""]; 221 | { 222 | _x params ["_name","_button_spacing","_button_width","_code"]; 223 | 224 | _ctrl = _display ctrlCreate ["RscButtonMenu", -1,_ctrl_debug]; 225 | _ctrl ctrlSetPosition [_posX,_posY,_button_width,_button_hieght]; 226 | 227 | _ctrl ctrlCommit 0; 228 | 229 | if(_foreachIndex == 0)then{ 230 | if(_nameP != "")then{_name = _nameP}; 231 | _buttonArray = UiNameSpace getVariable ["jn_debugConsole_buttons",[]]; 232 | _buttonArray pushBack _ctrl; 233 | }; 234 | 235 | _ctrl ctrlSetText _name; 236 | _ctrl ctrlAddEventHandler ["ButtonClick", format["0 spawn { isNil {%1 call %2}};",_index,_code]]; 237 | 238 | 239 | _posX = _posX + _button_width + _spacingY; 240 | }forEach _array; 241 | _posY = _posY + _spacingY + _button_hieght; 242 | }; 243 | 244 | _posY = _posY +_spacingY + _spacingY; 245 | _ctrl = _display ctrlCreate ["RscButtonMenu", -1,_ctrl_debug]; 246 | _ctrl ctrlSetPosition [_posXFINAL,_posY,_posX-_posXFINAL- _spacingY,_button_hieght]; 247 | 248 | _ctrl ctrlCommit 0; 249 | _ctrl ctrlSetText "-- Undo last save --"; 250 | _ctrl ctrlAddEventHandler ["ButtonClick", { 251 | 252 | _index = uiNameSpace getVariable ["jn_debugConsole_index_saved",-1]; 253 | 254 | if(_index == -1)exitWith{}; 255 | 256 | _text = uiNameSpace getVariable (format ["jn_debugConsole_%1",_index]); 257 | _name = uiNameSpace getVariable (format ["jn_debugConsole_%1_name",_index]); 258 | 259 | profilenamespace setVariable [format ["jn_debugConsole_%1",_index],_text]; 260 | profilenamespace setVariable [format ["jn_debugConsole_%1_name",_index],_name]; 261 | 262 | ((UiNameSpace getVariable "jn_debugConsole_buttons") # _index) ctrlSetText _name; 263 | }]; 264 | 265 | }; 266 | 267 | 268 | if (hasInterface) then { 269 | [] spawn { 270 | 271 | waitUntil {!isNull findDisplay 46}; 272 | 273 | (findDisplay 46) displayAddEventHandler ["KeyDown", { 274 | params ["_display", "_key", "_shift", "_ctrl", "_alt"]; 275 | 276 | if(_key == 1)then{ 277 | 0 spawn { 278 | waitUntil {!isNull (findDisplay 49)}; 279 | isNil {call fnc_debugv2_overwrite;}; // Wrap it into isNil to make it do the job in one frame 280 | }; 281 | }; 282 | }]; 283 | 284 | }; 285 | }; -------------------------------------------------------------------------------- /JeroenArsenal/JNL/fn_logistics_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | 3 | //The list of hardpoints for vehicles 4 | /* 5 | the last element is the list of seats to disable for specific node 6 | */ 7 | jnl_vehicleHardpoints = [ 8 | //Offroad 9 | ["\A3\soft_f\Offroad_01\Offroad_01_unarmed_F", [ 10 | //type, location locked seats 11 | [0, [-0.04,-1.7,-0.72], [1,2,3,4]], //weapon node 12 | [1, [-0.04,-1.7,-0.72], [1,2,3,4]] //cargo node 13 | ]], 14 | 15 | //Civi and FIA green truck 16 | ["\A3\soft_f_gamma\van_01\Van_01_transport_F.p3d", [ 17 | [0, [0,-1.60422,-0.63], [2,3,4,5,6,7,8,9]], 18 | [1, [0,-1.06937,-0.63], [2,3,4,5]], 19 | [1, [0,-2.61185,-0.63], [6,7,8,9,10,11]] 20 | ]], 21 | 22 | //AAF Zamak open 23 | ["\A3\soft_f_beta\Truck_02\Truck_02_transport_F", [ 24 | [0, [-0.000671387,-1.31882,-0.81], [2,3,4,5,6,7,8,9,10,11,12,13]], 25 | [1, [0,0,-0.81], [2,3,4,5,6,7,8]], 26 | [1, [0,-2.1,-0.81], [9,10,11,12,13]] 27 | ]], 28 | 29 | //AAF Zamak closed STEF 27/10 30 | ["\A3\soft_f_beta\Truck_02\Truck_02_covered_F.p3d", [ 31 | [1, [0,0,-0.81], [2,3,4,5,6,7,8]], 32 | [1, [0,-2.1,-0.81], [9,10,11,12,13]] 33 | ]], 34 | 35 | //RHS Gaz-66 truck 36 | ["\rhsafrf\addons\rhs_gaz66\rhs_gaz66.p3d", [ 37 | [0, [0,-0.88974,-0.610707], []], //Weapon node 38 | [1, [0,-0.135376,-0.610707], []], //Cargo node 39 | [1, [0,-1.73634,-0.610707], []] 40 | ]], 41 | 42 | //RHS Ural-4320 truck 43 | ["\rhsafrf\addons\rhs_a2port_car\Ural\Ural_open2.p3d", [ 44 | [0, [0,-1.36476,-0.19277], []], //Weapon 45 | [1, [0,-0.207184,-0.19277], []], //Cargo 46 | [1, [0,-1.78506,-0.19277], []] 47 | ]], 48 | 49 | //RHS Ural closed with seats VV 50 | ["\vsmafrf\addons\rhs_a2port_car\Ural\Ural.p3d", [ 51 | [1, [0,-0.207184,-0.19277], []], //Cargo 52 | [1, [0,-1.78506,-0.19277], []] 53 | ]], 54 | 55 | //Speedboat minigun 56 | ["\A3\Boat_F\Boat_Armed_01\Boat_Armed_01_minigun_F.p3d", [ 57 | [1, [0,2.63701,-2.16123], []] 58 | ]], 59 | 60 | //Transport rubber boat 61 | ["\A3\boat_f\Boat_Transport_01\Boat_Transport_01_F.p3d", [ 62 | [1, [0,0.0189972,-1.04965], []] 63 | ]], 64 | 65 | //Civilian transport boat 66 | ["\A3\Boat_F_Exp\Boat_Transport_02\Boat_Transport_02_F.p3d", [ 67 | [1, [0,1.233,-0.72029], []] 68 | ]] 69 | ]; 70 | 71 | //lock seats when cargo is added 72 | jnl_vehicleLockedSeats = [ 73 | ["\A3\soft_f\Offroad_01\Offroad_01_unarmed_F",[1,2,3,4]], 74 | ["\A3\soft_f_gamma\van_01\Van_01_transport_F.p3d",[]], 75 | ["\A3\soft_f_beta\Truck_02\Truck_02_transport_F",[2,3,4,5,6,7,8,9,10,11,12,13]] 76 | ]; 77 | 78 | //The list of static weapons that can be attached to a certain vehicle 79 | jnl_allowedWeapons = [ 80 | //Offroad 81 | ["\A3\soft_f\Offroad_01\Offroad_01_unarmed_F", [ 82 | "\A3\Static_F_Gamma\AT_01\AT_01.p3d", //AT titan, facing to the right 83 | "\A3\Static_F_Gamma\GMG_01\GMG_01_high_F.p3d", //Static GMG 84 | "\A3\Static_F_Gamma\HMG_01\HMG_01_high_F.p3d", //Static HMG 85 | "rhsusf\addons\rhsusf_heavyweapons\TOW\TOW_static", //RHS TOW launcher 86 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg", //RHS M2HB machinegun 87 | "\rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg", //RHS DShKM 88 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\KORD_6u16sp", //RHS Kord 89 | "\rhsafrf\addons\rhs_heavyweapons\kornet\kornet.p3d", //RHS kornet, facing to the right 90 | "\rhsafrf\addons\rhs_heavyweapons\spg9\spg9.p3d", //RHS SPG-9, facing 75 degrees to the left 91 | "rhsafrf\addons\rhs_heavyweapons\igla\igla_AA_pod" //RHS double Igla launcher 92 | ]], 93 | //Boxer truck 94 | ["\A3\soft_f_gamma\van_01\Van_01_transport_F.p3d", [ 95 | "\A3\Static_F_Gamma\AT_01\AT_01.p3d", //AT titan, facing to the right 96 | "\A3\Static_F_Gamma\GMG_01\GMG_01_high_F.p3d", //Static GMG 97 | "\A3\Static_F_Gamma\HMG_01\HMG_01_high_F.p3d", //Static HMG 98 | "rhsusf\addons\rhsusf_heavyweapons\TOW\TOW_static", //RHS TOW launcher 99 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg", //RHS M2HB machinegun 100 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg2", //RHS M2HB sitting machinegun 101 | "\rhsusf\addons\rhsusf_heavyweapons\Mk19_minitripod\mk19_stat", //RHS mk.19 GMG, facing to the right 102 | "\rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg", //RHS DShKM 103 | "rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg2", //RHS DShKM sitting, facing to the right 104 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\KORD_6u16sp", //RHS Kord 105 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\kord", //RHS Kord sitting, facing to the right 106 | "\rhsafrf\addons\rhs_heavyweapons\mg\rhs_nsv_tripod", //RHS NSV sitting, facing to the right 107 | "\rhsafrf\addons\rhs_heavyweapons\kornet\kornet.p3d", //RHS kornet, facing to the right 108 | "\rhsafrf\addons\rhs_heavyweapons\spg9\spg9.p3d", //RHS SPG-9, facing 75 degrees to the left 109 | "\rhsafrf\addons\rhs_heavyweapons\AGS30\AGS_static", //RHS AGS-30 the russian GMG, facing to the right 110 | "rhsafrf\addons\rhs_heavyweapons\igla\igla_AA_pod" //RHS double Igla launcher 111 | ]], 112 | //Zamak 113 | ["\A3\soft_f_beta\Truck_02\Truck_02_transport_F", [ 114 | "\A3\Static_F_Gamma\AT_01\AT_01.p3d", //AT titan, facing to the right 115 | "\A3\Static_F_Gamma\GMG_01\GMG_01_high_F.p3d", //Static GMG 116 | "\A3\Static_F_Gamma\HMG_01\HMG_01_high_F.p3d", //Static HMG 117 | "rhsusf\addons\rhsusf_heavyweapons\TOW\TOW_static", //RHS TOW launcher 118 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg", //RHS M2HB machinegun 119 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg2", //RHS M2HB sitting machinegun 120 | "\rhsusf\addons\rhsusf_heavyweapons\Mk19_minitripod\mk19_stat", //RHS mk.19 GMG, facing to the right 121 | "\rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg", //RHS DShKM 122 | "rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg2", //RHS DShKM sitting, facing to the right 123 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\KORD_6u16sp", //RHS Kord 124 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\kord", //RHS Kord sitting, facing to the right 125 | "\rhsafrf\addons\rhs_heavyweapons\mg\rhs_nsv_tripod", //RHS NSV sitting, facing to the right 126 | "\rhsafrf\addons\rhs_heavyweapons\kornet\kornet.p3d", //RHS kornet, facing to the right 127 | "\rhsafrf\addons\rhs_heavyweapons\spg9\spg9.p3d", //RHS SPG-9, facing 75 degrees to the left 128 | "\rhsafrf\addons\rhs_heavyweapons\AGS30\AGS_static", //RHS AGS-30 the russian GMG, facing to the right 129 | "rhsafrf\addons\rhs_heavyweapons\igla\igla_AA_pod" //RHS double Igla launcher 130 | ]], 131 | //RHS Gaz-66 truck 132 | ["\rhsafrf\addons\rhs_gaz66\rhs_gaz66.p3d", [ 133 | "\A3\Static_F_Gamma\AT_01\AT_01.p3d", //AT titan, facing to the right 134 | "\A3\Static_F_Gamma\GMG_01\GMG_01_high_F.p3d", //Static GMG 135 | "\A3\Static_F_Gamma\HMG_01\HMG_01_high_F.p3d", //Static HMG 136 | "rhsusf\addons\rhsusf_heavyweapons\TOW\TOW_static", //RHS TOW launcher 137 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg", //RHS M2HB machinegun 138 | "\rhsusf\addons\rhsusf_heavyweapons\m2_mg2", //RHS M2HB sitting machinegun 139 | "\rhsusf\addons\rhsusf_heavyweapons\Mk19_minitripod\mk19_stat", //RHS mk.19 GMG, facing to the right 140 | "\rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg", //RHS DShKM 141 | "rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg2", //RHS DShKM sitting, facing to the right 142 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\KORD_6u16sp", //RHS Kord 143 | "\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\kord", //RHS Kord sitting, facing to the right 144 | "\rhsafrf\addons\rhs_heavyweapons\mg\rhs_nsv_tripod", //RHS NSV sitting, facing to the right 145 | "\rhsafrf\addons\rhs_heavyweapons\kornet\kornet.p3d", //RHS kornet, facing to the right 146 | "\rhsafrf\addons\rhs_heavyweapons\spg9\spg9.p3d", //RHS SPG-9, facing 75 degrees to the left 147 | "\rhsafrf\addons\rhs_heavyweapons\AGS30\AGS_static", //RHS AGS-30 the russian GMG, facing to the right 148 | "rhsafrf\addons\rhs_heavyweapons\igla\igla_AA_pod" //RHS double Igla launcher 149 | ]] 150 | ]; 151 | 152 | //The list of offsets for static weapons. To attach a weapon to a vehicle you get the hardpoint position and add the attachment offset to it, then pass this to attachTo command. 153 | //Each element is: [model name, offset, vectorDir] 154 | jnl_attachmentOffset = [ 155 | 156 | //weapons //location //rotation //type //discription 157 | ["\A3\Static_F_Gamma\AT_01\AT_01.p3d", [-0.5, 0.0, 1.05], [1, 0, 0], 0], //AT titan, facing to the right 158 | ["\A3\Static_F_Gamma\GMG_01\GMG_01_high_F.p3d", [0.2, -0.3, 1.7], [0, 1, 0], 0], //Static GMG 159 | ["\A3\Static_F_Gamma\HMG_01\HMG_01_high_F.p3d", [0.2, -0.3, 1.7], [0, 1, 0], 0], //Static HMG 160 | ["rhsusf\addons\rhsusf_heavyweapons\TOW\TOW_static", [0.0, -0.3, 1.1], [0, 1, 0], 0], //RHS TOW launcher 161 | ["\rhsusf\addons\rhsusf_heavyweapons\m2_mg", [0.35, -0.35, 1.7], [0, 1, 0], 0], //RHS M2HB machinegun 162 | ["\rhsusf\addons\rhsusf_heavyweapons\m2_mg2", [0.3, -0.2, -0.03], [1, 0, 0], 0], //RHS M2HB sitting machinegun 163 | ["\rhsusf\addons\rhsusf_heavyweapons\Mk19_minitripod\mk19_stat",[-0.4, -0.25, 0.95], [1, 0, 0], 0], //RHS mk.19 GMG, facing to the right 164 | ["\rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg", [0.3, -0.3, 1.7], [0, 1, 0], 0], //RHS DShKM 165 | ["rhsafrf\addons\rhs_heavyweapons\DShKM\DShKM_mg2", [-0.25, -0.25, 1.3], [1, 0, 0], 0], //RHS DShKM sitting, facing to the right 166 | ["\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\KORD_6u16sp", [0.22, -0.42, 1.65], [0, 1, 0], 0], //RHS Kord 167 | ["\rhsafrf\addons\rhs_heavyweapons\mg\bis_kord\kord", [0.05, -0.2, 1.3], [1, 0, 0], 0], //RHS Kord sitting, facing to the right 168 | ["\rhsafrf\addons\rhs_heavyweapons\mg\rhs_nsv_tripod", [0, -0.2, 1.25], [1, 0, 0], 0], //RHS NSV sitting, facing to the right 169 | ["\rhsafrf\addons\rhs_heavyweapons\kornet\kornet.p3d", [0.0, 0, 0.5], [1, 0, 0], 0], //RHS kornet, facing to the right 170 | ["\rhsafrf\addons\rhs_heavyweapons\spg9\spg9.p3d", [-0.5, 0, 0.00], [-0.965926,0.258819,0], 0], //RHS SPG-9, facing 75 degrees to the left 171 | ["\rhsafrf\addons\rhs_heavyweapons\AGS30\AGS_static", [-0.3, 0, 1.20], [0.939693,-0.34202,0], 0], //RHS AGS-30 the russian GMG, facing right 172 | ["rhsafrf\addons\rhs_heavyweapons\igla\igla_AA_pod", [0.3, 0, 1.50], [0, 1, 0], 0], //RHS double Igla launcher 173 | 174 | //medium size crate //location //rotation //type //discription 175 | ["A3\Weapons_F\Ammoboxes\AmmoVeh_F", [0,0,0.85], [1,0,0], 1], //Vehicle ammo create 176 | ["\A3\Props_F_Orange\Humanitarian\Supplies\PaperBox_01_open_boxes_F.p3d", [0,0,0.85], [1,0,0], 1], //Stef test supplybox 177 | ["\A3\Structures_F_Heli\Items\Luggage\PlasticCase_01_medium_F.p3d", [0,0,0.85], [1,0,0], 1], //Stef test Devin crate1 178 | ["\A3\Weapons_F\Ammoboxes\Proxy_UsBasicAmmoBox.p3d", [0,0,0.85], [1,0,0], 1], //Stef test Devin crate2 179 | ["\A3\Weapons_F\Ammoboxes\Proxy_UsBasicExplosives.p3d", [0,0,0.85], [1,0,0], 1], //Stef test Devin crate3 180 | ["\A3\Weapons_F\Ammoboxes\Supplydrop.p3d", [0, 0, 0.95], [1,0,0], 1], //Ammodrop crate 181 | ["\A3\Soft_F\Quadbike_01\Quadbike_01_F.p3d", [0, 0, 1.4], [0,1,0], 1] //Quadbike 182 | ]; 183 | 184 | 185 | //todo replace with real items that are avalable 186 | jng_staticWeaponList = []; 187 | _defaultCrew = gettext (configfile >> "cfgvehicles" >> "all" >> "crew"); 188 | { 189 | _simulation = gettext (_x >> "simulation"); 190 | if(tolower _simulation isEqualTo "tankx")then{ 191 | if !(getnumber (_x >> "maxspeed") > 0) then { 192 | jng_staticWeaponList pushBack configName _x;; 193 | }; 194 | }; 195 | } foreach ("isclass _x && {getnumber (_x >> 'scope') == 2} && {gettext (_x >> 'crew') != _defaultCrew}" configclasses (configfile >> "cfgvehicles")); 196 | -------------------------------------------------------------------------------- /JeroenArsenal/JNA/fn_arsenal_init.sqf: -------------------------------------------------------------------------------- 1 | #include "defineCommon.inc" 2 | /* 3 | Author: Jeroen Notenbomer 4 | 5 | Description: 6 | Adds arsenal to a given object if run on client. 7 | Initilizes server 8 | 9 | Parameter(s): 10 | Object 11 | 12 | Returns: 13 | 14 | Usage: object call jn_fnc_arsenal_init; 15 | 16 | */ 17 | params [["_object",objNull,[objNull]]]; 18 | 19 | 20 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 21 | diag_log ("Init JNA: Start " + str _object); 22 | if(isNull _object)exitWith{["Error: wrong input given '%1'",_object] call BIS_fnc_error;}; 23 | 24 | //check if it was already initialised 25 | if(_object getVariable ["jna_init",false])exitWith{diag_log ("Init JNA: Already initialised " + str _object) }; 26 | _object setVariable ["jna_init", true]; 27 | 28 | 29 | 30 | /* Indexes in the array correspond to these tabs: DO NOT UNCOMMENT THIS BIT. THESE ARE ALREADY DEFINED 31 | IDC_RSCDISPLAYARSENAL_TAB_PRIMARYWEAPON 0 32 | IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON 1 33 | IDC_RSCDISPLAYARSENAL_TAB_HANDGUN 2 34 | IDC_RSCDISPLAYARSENAL_TAB_UNIFORM 3 35 | IDC_RSCDISPLAYARSENAL_TAB_VEST 4 36 | IDC_RSCDISPLAYARSENAL_TAB_BACKPACK 5 37 | IDC_RSCDISPLAYARSENAL_TAB_HEADGEAR 6 38 | IDC_RSCDISPLAYARSENAL_TAB_GOGGLES 7 39 | IDC_RSCDISPLAYARSENAL_TAB_NVGS 8 40 | IDC_RSCDISPLAYARSENAL_TAB_BINOCULARS 9 41 | IDC_RSCDISPLAYARSENAL_TAB_MAP 10 42 | IDC_RSCDISPLAYARSENAL_TAB_GPS 11 43 | IDC_RSCDISPLAYARSENAL_TAB_RADIO 12 44 | IDC_RSCDISPLAYARSENAL_TAB_COMPASS 13 45 | IDC_RSCDISPLAYARSENAL_TAB_WATCH 14 46 | IDC_RSCDISPLAYARSENAL_TAB_FACE 15 47 | IDC_RSCDISPLAYARSENAL_TAB_VOICE 16 48 | IDC_RSCDISPLAYARSENAL_TAB_INSIGNIA 17 49 | IDC_RSCDISPLAYARSENAL_TAB_ITEMOPTIC 18 50 | IDC_RSCDISPLAYARSENAL_TAB_ITEMACC 19 51 | IDC_RSCDISPLAYARSENAL_TAB_ITEMMUZZLE 20 52 | IDC_RSCDISPLAYARSENAL_TAB_ITEMBIPOD 25 53 | IDC_RSCDISPLAYARSENAL_TAB_CARGOMAG 21 54 | IDC_RSCDISPLAYARSENAL_TAB_CARGOTHROW 22 55 | IDC_RSCDISPLAYARSENAL_TAB_CARGOPUT 23 56 | IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC 24 57 | IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL 26 58 | */ 59 | 60 | //change this for items that members can only take 61 | jna_minItemMember = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]; 62 | //jna_minItemMember = [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,20,20,20,10,10]; 63 | 64 | //preload the ammobox so you dont need to wait the first time 65 | ["Preload"] call jn_fnc_arsenal; 66 | 67 | //server 68 | if(isServer)then{ 69 | diag_log ("Init JNA: server " + str _object); 70 | 71 | //load default if it was not loaded from savegame 72 | pr _datalist = _object getVariable "jna_dataList"; 73 | if(isnil "_datalist")then{ 74 | _object setVariable ["jna_dataList" ,EMPTY_ARRAY]; 75 | }; 76 | }; 77 | 78 | //player 79 | if(hasInterface)then{ 80 | diag_log ("Init JNA: player "+ str _object); 81 | 82 | //add arsenal button 83 | _id = _object addaction [ 84 | (format ["", STR_ACTION_ICON_ARSENAL] + format[" %1", STR_ACTION_TEXT_ARSENAL]), 85 | { 86 | pr _object = _this select 0; 87 | 88 | //start loading screen 89 | ["jn_fnc_arsenal", "Loading Nutz™ Arsenal"] call bis_fnc_startloadingscreen; 90 | [] spawn { 91 | uisleep 5; 92 | pr _ids = missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]]; 93 | if("jn_fnc_arsenal" in _ids)then{ 94 | pr _display = uiNamespace getVariable ["arsanalDisplay","No display"]; 95 | titleText["ERROR DURING LOADING ARSENAL", "PLAIN"]; 96 | _display closedisplay 2; 97 | ["jn_fnc_arsenal"] call BIS_fnc_endLoadingScreen; 98 | }; 99 | 100 | //TODO this is a temp fix for rhs because it freezes the loading screen if no primaryWeapon was equiped. This will be fix in rhs 0.4.9 101 | if("bis_fnc_arsenal" in _ids)then{ 102 | pr _display = uiNamespace getVariable ["arsanalDisplay","No display"]; 103 | diag_log "JNA: Non Fatal Error, RHS?"; 104 | titleText["Non Fatal Error, RHS?", "PLAIN"]; 105 | ["bis_fnc_arsenal"] call BIS_fnc_endLoadingScreen; 106 | }; 107 | 108 | }; 109 | //save proper ammo because BIS arsenal rearms it, and I will over write it back again 110 | missionNamespace setVariable ["jna_magazines_init", [ 111 | magazinesAmmoCargo (uniformContainer player), 112 | magazinesAmmoCargo (vestContainer player), 113 | magazinesAmmoCargo (backpackContainer player) 114 | ]]; 115 | 116 | //Save attachments in containers, because BIS arsenal removes them 117 | pr _attachmentsContainers = [[],[],[]]; 118 | { 119 | pr _container = _x; 120 | pr _weaponAtt = weaponsItemsCargo _x; 121 | pr _attachments = []; 122 | 123 | if!(isNil "_weaponAtt")then{ 124 | 125 | { 126 | pr _atts = [_x select 1,_x select 2,_x select 3,_x select 5]; 127 | _atts = _atts - [""]; 128 | _attachments = _attachments + _atts; 129 | } forEach _weaponAtt; 130 | _attachmentsContainers set [_foreachindex,_attachments]; 131 | }; 132 | } forEach [uniformContainer player,vestContainer player,backpackContainer player]; 133 | 134 | UINamespace setVariable ["jna_containerCargo_init", _attachmentsContainers]; 135 | UINamespace setVariable ["jn_type","arsenal"]; 136 | UINamespace setVariable ["jn_object",_object]; 137 | 138 | 139 | //request server to open arsenal 140 | [clientOwner,_object] remoteExecCall ["jn_fnc_arsenal_requestOpen",2]; 141 | }, 142 | [], 143 | 6, 144 | true, 145 | false, 146 | "", 147 | "alive _target && {_target distance _this < 5} && {vehicle player == player}" 148 | ]; 149 | //ACTION_SET_ICON_AND_TEXT(_object, _id, STR_ACTION_TEXT_ARSENAL, STR_ACTION_ICON_ARSENAL); 150 | 151 | //add vehicle/box filling button 152 | _id = _object addaction [ 153 | (format ["", STR_ACTION_ICON_ARSENAL_CONTAINER] + format[" %1", STR_ACTION_TEXT_ARSENAL_CONTAINER]), 154 | { 155 | pr _object = _this select 0; 156 | 157 | pr _script = { 158 | params ["_object"]; 159 | 160 | //check if player is looking at some object 161 | _object_selected = cursorObject; 162 | if(isnull _object_selected)exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR1"; }; 163 | 164 | //check if object is in range 165 | if(_object distance cursorObject > 10)exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR2";}; 166 | 167 | //check if object has inventory 168 | pr _className = typeOf _object_selected; 169 | pr _tb = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxbackpacks"); 170 | pr _tm = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxmagazines"); 171 | pr _tw = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxweapons"); 172 | if !(_tb > 0 || _tm > 0 || _tw > 0) exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR3";}; 173 | 174 | 175 | //set type and object to use later 176 | UINamespace setVariable ["jn_type","container"]; 177 | UINamespace setVariable ["jn_object",_object]; 178 | UINamespace setVariable ["jn_object_selected",_object_selected]; 179 | 180 | 181 | //start loading screen and timer to close it if something breaks 182 | ["jn_fnc_arsenal", "Loading Nutz™ Arsenal"] call bis_fnc_startloadingscreen; 183 | [] spawn { 184 | uisleep 5; 185 | pr _ids = missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]]; 186 | if("jn_fnc_arsenal" in _ids)then{ 187 | pr _display = uiNamespace getVariable ["arsanalDisplay","No display"]; 188 | titleText["ERROR DURING LOADING ARSENAL", "PLAIN"]; 189 | _display closedisplay 2; 190 | ["jn_fnc_arsenal"] call BIS_fnc_endLoadingScreen; 191 | }; 192 | 193 | //TODO this is a temp fix for rhs because it freezes the loading screen if no primaryWeapon was equiped. This will be fix in rhs 0.4.9 194 | if("bis_fnc_arsenal" in _ids)then{ 195 | pr _display = uiNamespace getVariable ["arsanalDisplay","No display"]; 196 | diag_log "JNA: Non Fatal Error, RHS?"; 197 | titleText["Non Fatal Error, RHS?", "PLAIN"]; 198 | ["bis_fnc_arsenal"] call BIS_fnc_endLoadingScreen; 199 | }; 200 | 201 | }; 202 | 203 | //request server to open arsenal 204 | [clientOwner,_object] remoteExecCall ["jn_fnc_arsenal_requestOpen",2]; 205 | }; 206 | pr _conditionActive = { 207 | params ["_object"]; 208 | alive player; 209 | }; 210 | pr _conditionColor = { 211 | params ["_object"]; 212 | 213 | !isnull cursorObject 214 | &&{ 215 | _object distance cursorObject < 10; 216 | }&&{ 217 | //check if object has inventory 218 | pr _className = typeOf cursorObject; 219 | pr _tb = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxbackpacks"); 220 | pr _tm = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxmagazines"); 221 | pr _tw = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxweapons"); 222 | if (_tb > 0 || _tm > 0 || _tw > 0) then {true;} else {false;}; 223 | 224 | }//return 225 | }; 226 | 227 | [_script,_conditionActive,_conditionColor,_object] call jn_fnc_common_addActionSelect; 228 | }, 229 | [], 230 | 6, 231 | true, 232 | false, 233 | "", 234 | "alive _target && {_target distance _this < 5} && {vehicle player == player}" 235 | 236 | ]; 237 | //ACTION_SET_ICON_AND_TEXT(_object, _id, STR_ACTION_TEXT_ARSENAL_CONTAINER, STR_ACTION_ICON_ARSENAL_CONTAINER); 238 | 239 | //add Action to unload object 240 | _id = _object addaction [ 241 | (format ["", STR_ACTION_ICON_ARSENAL_UNLOAD] + format[" %1", STR_ACTION_TEXT_ARSENAL_UNLOAD]), 242 | { 243 | pr _object = _this select 0; 244 | 245 | pr _script = { 246 | params ["_object"];//object action was attached to 247 | 248 | //check if player is looking at some object 249 | _object_selected = cursorObject;//selected object 250 | 251 | if(isnull _object_selected)exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR1"; }; 252 | 253 | //check if object is in range 254 | if(_object distance cursorObject > 10)exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR2";}; 255 | 256 | //check if object has inventory 257 | pr _className = typeOf _object_selected; 258 | pr _tb = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxbackpacks"); 259 | pr _tm = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxmagazines"); 260 | pr _tw = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxweapons"); 261 | if !(_tb > 0 || _tm > 0 || _tw > 0) exitWith{hint localize "STR_JNA_ACT_CONTAINER_SELECTERROR3";}; 262 | 263 | 264 | [_object_selected,_object] call jn_fnc_arsenal_cargoToArsenal; 265 | }; 266 | pr _conditionActive = { 267 | params ["_object"]; 268 | alive player; 269 | }; 270 | pr _conditionColor = { 271 | params ["_object"]; 272 | 273 | !isnull cursorObject 274 | &&{ 275 | _object distance cursorObject < 10; 276 | }&&{ 277 | //check if object has inventory 278 | pr _className = typeOf cursorObject; 279 | pr _tb = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxbackpacks"); 280 | pr _tm = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxmagazines"); 281 | pr _tw = getNumber (configFile >> "CfgVehicles" >> _className >> "transportmaxweapons"); 282 | if (_tb > 0 || _tm > 0 || _tw > 0) then {true;} else {false;}; 283 | 284 | }//return 285 | }; 286 | 287 | [_script,_conditionActive,_conditionColor,_object] call jn_fnc_common_addActionSelect; 288 | }, 289 | [], 290 | 6, 291 | true, 292 | false, 293 | "", 294 | "alive _target && {_target distance _this < 5} && {vehicle player == player}" 295 | 296 | ]; 297 | //ACTION_SET_ICON_AND_TEXT(_object, _id, STR_ACTION_TEXT_ARSENAL_UNLOAD, STR_ACTION_ICON_ARSENAL_UNLOAD); 298 | 299 | 300 | if(missionNamespace getVariable ["jna_first_init",true])then{ 301 | 302 | //add open event 303 | [missionNamespace, "arsenalOpened", { 304 | disableSerialization; 305 | UINamespace setVariable ["arsanalDisplay",(_this select 0)]; 306 | 307 | //spawn this to make sure it doesnt freeze the game 308 | [] spawn { 309 | disableSerialization; 310 | _type = UINamespace getVariable ["jn_type",""]; 311 | if(_type isEqualTo "arsenal")then{ 312 | ["CustomInit", [uiNamespace getVariable "arsanalDisplay"]] call jn_fnc_arsenal; 313 | }; 314 | 315 | if(_type isEqualTo "container")then{ 316 | ["CustomInit", [uiNamespace getVariable "arsanalDisplay"]] call jn_fnc_arsenal_container; 317 | }; 318 | 319 | }; 320 | }] call BIS_fnc_addScriptedEventHandler; 321 | 322 | //add close event 323 | [missionNamespace, "arsenalClosed", { 324 | 325 | _type = UINamespace getVariable ["jn_type",""]; 326 | 327 | if(_type isEqualTo "arsenal")then{ 328 | [clientOwner, UINamespace getVariable "jn_object"] remoteExecCall ["jn_fnc_arsenal_requestClose",2]; 329 | UINamespace setVariable ["jn_type",""]; 330 | }; 331 | 332 | if(_type isEqualTo "container")then{ 333 | ["Close"] call jn_fnc_arsenal_container; 334 | [clientOwner, UINamespace getVariable "jn_object"] remoteExecCall ["jn_fnc_arsenal_requestClose",2]; 335 | UINamespace setVariable ["jn_type",""]; 336 | }; 337 | }] call BIS_fnc_addScriptedEventHandler; 338 | }; 339 | }; 340 | 341 | missionNamespace setVariable ["jna_first_init",false]; 342 | 343 | if(isServer)then{ 344 | diag_log ("Init Server JNA: done" + str _object); 345 | }else{ 346 | diag_log ("Init pLayer JNA: done" + str _object); 347 | }; 348 | -------------------------------------------------------------------------------- /JeroenArsenal/drone.sqf: -------------------------------------------------------------------------------- 1 | 2 | //common 3 | Drone_fnc_isSaveToFire = { 4 | params["_turret","_saveAngleMin","_saveAngleMax",["_saveAngleDown",90]]; 5 | private _drone = attachedTo _turret; 6 | 7 | _vector = (_turret weaponDirection currentWeapon _turret); 8 | 9 | _dir = (1-(vectordir _drone vectorcos _vector))*90; //0-180 10 | 11 | _elevation = -(_vector vectorcos vectorUp _drone) * 90; 12 | 13 | (_dir > _saveAngleMin) && (_dir < _saveAngleMax) && (_elevation < _saveAngleDown ); 14 | }; 15 | 16 | Drone_fnc_random_target = { 17 | selectRandom(allUnits select {side _x == EAST}); 18 | }; 19 | 20 | Drone_fnc_screenTarget = { 21 | params["_turret"]; 22 | private _pos = terrainIntersectAtASL [ 23 | getPosASL _turret, 24 | (getPosASL _turret) vectorAdd ((_turret weaponDirection currentWeapon _turret) vectorMultiply 5000) 25 | ]; 26 | 27 | _pos set [2,0]; 28 | _pos 29 | }; 30 | 31 | //vls 32 | Drone_fnc_VLS_init = { 33 | params["_vls"]; 34 | _vls addEventHandler ["Fired", { 35 | params ["_vls", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 36 | 37 | 38 | 39 | //set starting speed 40 | 41 | //_projectile setVelocity ((vectorDir _projectile vectorMultiply 30) vectorAdd (velocity _vls vectorMultiply 5)); 42 | 43 | private _pos = (getpos _projectile) vectorAdd (vectorDir _projectile vectorMultiply 10); 44 | _projectile setpos _pos; 45 | cc= _projectile; 46 | _vls setWeaponReloadingTime [_gunner, _muzzle, 0]; 47 | //_torpedo setVehicleAmmo 1; 48 | 49 | }]; 50 | 51 | _vls addEventHandler ["Killed", { 52 | params ["_vls", "_killer", "_instigator", "_useEffects"]; 53 | detach _vls; 54 | }]; 55 | 56 | _vls disableAI "AUTOTARGET"; 57 | 58 | }; 59 | 60 | 61 | Drone_fnc_VLS_fire = { 62 | 63 | params ["_base",["_target",objNull,[objNull]]]; 64 | vlss = _base getVariable ["vlss",[]]; 65 | 66 | if(!alive _target)exitWith{}; 67 | { 68 | _vls = _x; 69 | 70 | _vls setVariable ["target",_target]; 71 | west reportRemoteTarget [_target, 3600]; 72 | _target confirmSensorTarget [west, true]; 73 | _vls fireAtTarget [_target, "weapon_vls_01"]; 74 | }forEach vlss; 75 | 76 | 77 | }; 78 | 79 | //hammer 80 | Drone_fnc_Hammer_init = { 81 | params ["_hammer"]; 82 | 83 | private _drone = attachedto _hammer; 84 | private _first = count (_drone getVariable ["hammers",[]]) == 1;//first turret can shoot forward 85 | 86 | //disable turrent if its aiming at other guns 87 | [_hammer,_first] spawn { 88 | params["_hammer","_first"]; 89 | 90 | private _rearmed = false; 91 | while{alive _hammer}do{ 92 | if([_hammer,[15,0] select _first,165] call Drone_fnc_isSaveToFire)then{ 93 | if(!_rearmed)then{ 94 | _rearmed = true; 95 | _hammer setWeaponReloadingTime [gunner _hammer, "cannon_120mm_long", 0]; 96 | _hammer setWeaponReloadingTime [gunner _hammer, "weapon_ShipCannon_120mm", 0]; 97 | } 98 | }else{ 99 | _rearmed = false; 100 | _hammer setWeaponReloadingTime [gunner _hammer, "cannon_120mm_long", 1]; 101 | _hammer setWeaponReloadingTime [gunner _hammer, "weapon_ShipCannon_120mm", 1]; 102 | }; 103 | sleep 0.1; 104 | }; 105 | }; 106 | 107 | _hammer loadMagazine [[0],"weapon_ShipCannon_120mm","magazine_ShipCannon_120mm_HE_cluster_shells_x2"];//set default mag 108 | _hammer setWeaponReloadingTime [gunner _hammer, currentMuzzle (gunner _hammer), 0]; 109 | 110 | _hammer addWeaponTurret ["cannon_120mm_long",[0]]; 111 | _hammer addMagazineTurret ["12Rnd_120mm_HE_shells_Tracer_Red",[0]]; 112 | 113 | _hammer disableAI "AUTOTARGET"; 114 | _hammer addEventHandler ["Fired", { 115 | params ["_hammer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 116 | 117 | hint "reload!"; 118 | _hammer setWeaponReloadingTime [_gunner, _muzzle, 0.1]; 119 | _hammer setVehicleAmmo 1; 120 | 121 | _velocity = velocity _projectile vectordiff velocity _hammer; 122 | 123 | if(_weapon == "weapon_ShipCannon_120mm")then{_velocity = _velocity vectorMultiply 4};//make slow mortar round move a bit faster 124 | _projectile setVelocity _velocity; 125 | }]; 126 | }; 127 | 128 | Drone_fnc_Hammer_changeType = { 129 | params ["_hammer","_magName"]; 130 | 131 | 132 | }; 133 | 134 | Drone_fnc_Hammer_Artillery = { 135 | params ["_drone","_pos",["_amount",1],["_type",0]]; 136 | 137 | if(_pos isEqualType objNull)then{_pos = getpos _pos}; 138 | 139 | private _type = ["magazine_ShipCannon_120mm_HE_shells_x32","magazine_ShipCannon_120mm_HE_cluster_shells_x2"] select _type; 140 | private _hammers = _drone getVariable ["hammers",[]]; 141 | private _amountFired = 0; 142 | { 143 | private _hammer = _x; 144 | if(_amountFired > _amount)exitWith{}; 145 | _hammer doArtilleryFire [_pos, _type, 1]; 146 | _hammer setWeaponReloadingTime [gunner _hammer, currentMuzzle (gunner _hammer), 0]; 147 | _amountFired = _amountFired +1; 148 | }forEach _hammers; 149 | 150 | 151 | 152 | 153 | 154 | }; 155 | 156 | Drone_fnc_Hammer_fire = { 157 | params [["_drone",objNull,[objNull]],["_pos",objNull,[[],objNull]],["_type",0,[0]]]; 158 | 159 | if(_pos isEqualType objNull)then{_pos = getpos _pos}; 160 | 161 | [_drone,_pos,_type] spawn { 162 | params["_drone","_pos","_type"]; 163 | private _hammers = _drone getVariable ["hammers",[]]; 164 | { 165 | private _hammer = _x; 166 | _magazine = ["12Rnd_120mm_HE_shells_Tracer_Red","magazine_ShipCannon_120mm_HE_cluster_shells_x2"] select _type; 167 | [_hammer, _magazine] call Drone_fnc_Hammer_changeType;//fast change 168 | _hammer doWatch _pos; 169 | }forEach _hammers; 170 | 171 | sleep 2;//wait for weapon to aim 172 | 173 | { 174 | private _hammer = _x; 175 | _hammer fire (["cannon_120mm_long","weapon_ShipCannon_120mm"] select _type); 176 | sleep 0.5; 177 | }forEach _hammers; 178 | 179 | 180 | }; 181 | 182 | }; 183 | 184 | //torpedo 185 | Drone_fnc_Torpedo_init = { 186 | params ["_torpedo"]; 187 | 188 | _torpedo addEventHandler ["Fired", { 189 | params ["_torpedo", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 190 | 191 | hint "reload!"; 192 | _torpedo setWeaponReloadingTime [_gunner, _muzzle, 0]; 193 | _torpedo setVehicleAmmo 1; 194 | gunner _torpedo disableAI "ALL"; 195 | 196 | //_velocity = velocity _projectile vectordiff velocity _sam; 197 | //_projectile setVelocity _velocity; 198 | }]; 199 | }; 200 | 201 | Drone_fnc_Torpedo_fire = { 202 | params [["_drone",objNull,[objNull]],["_target",objNull,[objNull]],["_amount",1,[1]]]; 203 | 204 | [_drone, _target, _amount] spawn { 205 | params [["_drone",objNull,[objNull]],["_target",objNull,[objNull]],["_amount",1,[1]]]; 206 | 207 | private _torpedos = _drone getVariable["torpedos", []]; 208 | 209 | for "_1" from 1 to _amount do { 210 | private _side = _drone getVariable["torpedo_side", false]; 211 | _torpedo = _torpedos select _side; 212 | 213 | private _missle = "M_Titan_AP" createVehicle (_torpedo modelToWorld [0,4,0]); 214 | _missle setVectorDir (vectorDir _drone vectorAdd [random 0.05-0.025,random 0.05-0.025,random 0.05-0.025]); 215 | _missle setVelocity (velocity _torpedo)vectorMultiply 1.5; 216 | 217 | //switch side for next time 218 | _drone setVariable ["torpedo_side", !_side]; 219 | sleep 0.1; 220 | }; 221 | }; 222 | }; 223 | 224 | 225 | //sam 226 | Drone_fnc_SAM_init = { 227 | params ["_sam"]; 228 | 229 | _sam disableAI "AUTOTARGET"; 230 | 231 | //disable turrent if its aiming at other guns 232 | [_sam] spawn { 233 | params["_sam"]; 234 | private _rearmed = false; 235 | while{alive _sam}do{ 236 | if([_sam,10,175,18] call Drone_fnc_isSaveToFire)then{ 237 | if(!_rearmed)then{ 238 | _rearmed = true; 239 | _sam setWeaponReloadingTime [gunner _sam, "weapon_rim116Launcher", 0]; 240 | } 241 | }else{ 242 | _rearmed = false; 243 | _sam setWeaponReloadingTime [gunner _sam, "weapon_rim116Launcher", 1]; 244 | }; 245 | sleep 0.1; 246 | }; 247 | }; 248 | 249 | 250 | _sam addEventHandler ["Fired", { 251 | params ["_sam", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; 252 | 253 | 254 | private _pos = _sam getVariable ["target",[0,0,0]]; 255 | 256 | private _pos_projectile = (getpos _projectile) vectorAdd (vectorDir _projectile vectorMultiply 5); 257 | _projectile setpos _pos_projectile; 258 | 259 | private _velocity = velocity _projectile vectorAdd velocity _sam; 260 | _projectile setVelocity _velocity; 261 | 262 | //if you shoot manualy; 263 | if(isplayer (UAVControl _sam select 0))then{ 264 | _pos = terrainIntersectAtASL [ 265 | getPosASL _sam, 266 | (getPosASL _sam) vectorAdd ((_sam weaponDirection currentWeapon _sam) vectorMultiply 2000) 267 | ]; 268 | }; 269 | 270 | //shooting automaticly at planes and helies so target is not set; 271 | if(_pos isEqualTo [0,0,0])exitWith{}; 272 | 273 | _sam setWeaponReloadingTime [_gunner, _muzzle, 0]; 274 | _sam setVehicleAmmo 1; 275 | 276 | [_projectile,_pos]spawn { 277 | 278 | 279 | params["_projectile","_pos"]; 280 | 281 | _p = 0; 282 | _y = 0; 283 | 284 | while {alive _projectile}do{ 285 | _yT = ([_pos,_projectile] call BIS_fnc_DirTo) + 180; 286 | _yC = direction _projectile; 287 | _yD = _yT - _yC; 288 | if(_yD > 180)then{_yD = _yD - 360}else{ 289 | if(_yD < -180)then{_yD = _yD + 360}; 290 | }; 291 | _y = _yC; 292 | if(_yD < 0)then{_y = _y - 4}else{_y = _y + 4}; 293 | _y = _y + (random 10) -5; 294 | 295 | _pT = -atan (((getPosWorld _projectile vectorDiff _pos) select 2) / (_pos distance2d getPosWorld _projectile)); 296 | _pD = _p - _pT; 297 | if(_pD < 0)then{_p = _p + 15}else{_p = _p - 15}; 298 | 299 | _p = _p + (random 10) -5; 300 | _r = 0; 301 | _projectile setVectorDirAndUp [ 302 | [ sin _y * cos _p,cos _y * cos _p,sin _p], 303 | [ [ sin _r,-sin _p,cos _r * cos _p],-_y] call BIS_fnc_rotateVector2D 304 | ]; 305 | 306 | sleep (0.2); 307 | }; 308 | };//end missle guildence 309 | 310 | 311 | }]; 312 | }; 313 | 314 | Drone_fnc_SAM_fire = { 315 | 316 | params [["_drone",objNull,[objNull]],["_pos",[0,0,0],[[],objNull]],["_amount",1,[1]]]; 317 | 318 | if(_pos isEqualType objNull)then{_pos = getpos _pos}; 319 | private _sams = _drone getVariable ["sams",[]]; 320 | private _sam = _sams#0;//we only have one 321 | diag_log str ["_pos",_pos]; 322 | _sam setVariable ["target",_pos]; 323 | 324 | [_sam,_pos,_amount]spawn { 325 | params["_sam","_pos","_amount"]; 326 | 327 | _sam doWatch _pos; 328 | sleep 2; 329 | for "_i" from 1 to _amount do{ 330 | _sam fire "weapon_rim116Launcher"; 331 | sleep 0.2; 332 | }; 333 | _sam setVariable ["target",objNull]; 334 | }; 335 | }; 336 | 337 | //miniguns 338 | Drone_fnc_Minigun_init = { 339 | params ["_minigun"]; 340 | private _drone = attachedTo _minigun; 341 | private _first = count (_drone getVariable ["miniguns",[]]) == 1;//first turret can shoot forward 342 | 343 | if(_first)then{ 344 | _minigun addAction ["VLS", {params ["_target"]; [aa, call Drone_fnc_random_target] call Drone_fnc_VLS_fire;}]; 345 | _minigun addAction ["Sam", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,20] call Drone_fnc_SAM_fire}]; 346 | _minigun addAction ["Hammer", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,0] call Drone_fnc_Hammer_fire;}]; 347 | _minigun addAction ["Hammer Cluster", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,1] call Drone_fnc_Hammer_fire;}]; 348 | }; 349 | 350 | 351 | [_minigun] spawn { 352 | params["_minigun"]; 353 | 354 | _rearmed = false; 355 | 356 | while{alive _minigun}do{ 357 | if([_minigun,15,165] call Drone_fnc_isSaveToFire)then{ 358 | if(!_rearmed)then{ 359 | _rearmed = true; 360 | _minigun addMagazineTurret ["magazine_Cannon_Phalanx_x1550",[0]]; 361 | _minigun setWeaponReloadingTime [gunner _minigun, "weapon_Cannon_Phalanx", 0]; 362 | } 363 | }else{ 364 | if(_rearmed)then{ 365 | _rearmed = false; 366 | _minigun removeMagazineTurret ["magazine_Cannon_Phalanx_x1550",[0]]; 367 | _minigun removeMagazineTurret ["magazine_Cannon_Phalanx_x1550",[0]]; 368 | _minigun removeMagazineTurret ["magazine_Cannon_Phalanx_x1550",[0]]; 369 | }; 370 | }; 371 | sleep 0.1; 372 | }; 373 | }; 374 | }; 375 | 376 | Drone_fnc_Minigun_fire = { 377 | params [["_drone",objNull,[objNull]],["_target",objNull,[objNull]]]; 378 | 379 | _miniguns = _drone getVariable ["miniguns",[]]; 380 | 381 | { 382 | _minigun = _x; 383 | 384 | _minigun doSuppressiveFire _target; 385 | }forEach _miniguns; 386 | 387 | }; 388 | 389 | 390 | 391 | //events 392 | 393 | Drone_fnc_damage_event = { 394 | params["_obj"]; 395 | 396 | _obj addEventHandler ["FiredNear", { 397 | params ["_obj", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"]; 398 | 399 | private _drone = attachedto _obj; 400 | hint "Dammage"; 401 | //[_drone,_firer] call Drone_fnc_Miniguns_fire; 402 | }]; 403 | }; 404 | 405 | Drone_fnc_IncomingMissile_event = { 406 | params["_obj"]; 407 | _obj addEventHandler ["IncomingMissile", { 408 | params ["_target", "_ammo", "_vehicle", "_instigator"]; 409 | 410 | private _missle = _vehicle nearObjects ["MissileBase",10] select 0; 411 | 412 | hint str [_missle]; 413 | 414 | private _target = "O_UAV_02_F" createVehicle [0,0,0]; 415 | createVehicleCrew _target; 416 | 417 | _target attachto [_missle, [0,0,3]]; 418 | 419 | }]; 420 | }; 421 | 422 | droneData = [ 423 | ["B_UAV_02_dynamicLoadout_F",[0,1,0],[0,0,1]], 424 | [ 425 | ["Submarine_01_F",[0,-0.0518756,1.9469],[-8.74228e-008,-1,0],[0,0,1]], 426 | ["B_Ship_MRLS_01_F",[5.32176,-11.2801,3.19051],[0.5,-4.37114e-008,-0.866025],[0.866025,0,0.5]], 427 | ["B_SAM_System_02_F",[-5.008,41.457,-1.05034],[0.258819,0.965926,1.48943e-009],[-0.965926,0.258819,-1.13133e-008]], 428 | ["B_Ship_Gun_01_F",[0,34.9014,6.11816],[0,1,0],[0,0,1]], 429 | ["B_SAM_System_01_F",[0,-17.3679,6.90189],[1,-4.37114e-008,0],[0,0,1]], 430 | ["B_SAM_System_02_F",[5.008,41.457,-1.05034],[-0.258819,0.965926,-5.41468e-008],[0.965926,0.258819,-1.13133e-008]], 431 | ["B_Ship_Gun_01_F",[0,25.945,6.4919],[0,1,0],[0,0,1]], 432 | ["B_AAA_System_01_F",[0,18.695,11.1488],[0,1,0],[0,0,1]], 433 | ["B_AAA_System_01_F",[0,9.91799,11.1488],[-8.74228e-008,-1,0],[0,0,1]], 434 | ["B_Ship_MRLS_01_F",[-5.43206,-11.2801,3.19051],[-0.5,1.19249e-008,-0.866025],[-0.866025,0,0.5]], 435 | ["B_Ship_Gun_01_F",[0,-3.23976,6.7991],[0,1,0],[0,0,1]] 436 | ] 437 | ]; 438 | 439 | 440 | Drone_fnc_spawn = { 441 | params ["_baseType","_attached"]; 442 | 443 | _base = createVehicle [ (_baseType#0), getpos player, [],0,"fly"]; 444 | //_base = createVehicle [ (_baseType#0), [100,0,0], [],0]; 445 | 446 | _base setVectorDirAndUp [_baseType#1,_baseType#2]; 447 | createVehicleCrew _base; 448 | _base call Drone_fnc_IncomingMissile_event; 449 | { 450 | _obj = _x#0 createVehicle [0,0,0]; 451 | _obj attachTo [_base,_x#1]; 452 | _obj setVectorDirAndUp [_x#2,_x#3]; 453 | 454 | 455 | if(typeof _obj != "B_SAM_System_02_F")then{ 456 | createVehicleCrew _obj; 457 | }; 458 | 459 | 460 | _obj call Drone_fnc_IncomingMissile_event; 461 | _obj call Drone_fnc_damage_event; 462 | 463 | switch (typeof _obj) do { 464 | case "B_Ship_MRLS_01_F": { 465 | _old = _base getVariable ["vlss",[]]; 466 | _old pushBack _obj; 467 | _base setVariable ["vlss", _old]; 468 | _obj call Drone_fnc_VLS_init; 469 | }; 470 | case "B_Ship_Gun_01_F": { 471 | _old = _base getVariable ["hammers",[]]; 472 | _old pushBack _obj; 473 | _base setVariable ["hammers", _old]; 474 | _obj call Drone_fnc_Hammer_init; 475 | }; 476 | case "B_SAM_System_02_F": { 477 | _old = _base getVariable ["torpedos",[]]; 478 | _old pushBack _obj; 479 | _base setVariable ["torpedos", _old]; 480 | _obj call Drone_fnc_Torpedo_init; 481 | }; 482 | case "B_SAM_System_01_F": { 483 | _old = _base getVariable ["sams",[]]; 484 | _old pushBack _obj; 485 | _base setVariable ["sams", _old]; 486 | _obj call Drone_fnc_SAM_init; 487 | }; 488 | case "B_AAA_System_01_F": { 489 | _old = _base getVariable ["miniguns",[]]; 490 | _old pushBack _obj; 491 | _base setVariable ["miniguns", _old]; 492 | _obj call Drone_fnc_Minigun_init 493 | }; 494 | default { }; 495 | }; 496 | 497 | 498 | }foreach _attached; 499 | 500 | _base setVelocity [0,110,0]; 501 | aa = _base; 502 | }; 503 | 504 | Drone_fnc_delete = { 505 | params ["_base"]; 506 | private _objects = attachedObjects _base; 507 | _objects pushBack _base; 508 | { 509 | deleteVehicle _x; 510 | }foreach _objects; 511 | 512 | }; 513 | 514 | 515 | 516 | 517 | aa call Drone_fnc_delete; 518 | 519 | droneData call Drone_fnc_spawn; 520 | player allowDamage false; 521 | 522 | 523 | 524 | removeAllActions player; 525 | player addAction ["VLS cursor", { 526 | private _target = "ArtilleryTargetE" createVehicle (player call Drone_fnc_screenTarget); 527 | [aa, _target] call Drone_fnc_VLS_fire; 528 | }]; 529 | player addAction ["VLS random target", { 530 | [aa, call Drone_fnc_random_target] call Drone_fnc_VLS_fire; 531 | }]; 532 | player addAction ["Minigun", { 533 | private _target = "ArtilleryTargetE" createVehicle (player call Drone_fnc_screenTarget); 534 | [aa, _target] call Drone_fnc_Minigun_fire; 535 | }]; 536 | player addAction ["Sam", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,20] call Drone_fnc_SAM_fire}]; 537 | player addAction ["Hammer", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,0] call Drone_fnc_Hammer_fire;}]; 538 | player addAction ["Hammer Cluster", {params ["_target"];[aa, _target call Drone_fnc_screenTarget,1] call Drone_fnc_Hammer_fire;}]; 539 | 540 | --------------------------------------------------------------------------------