├── 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 | //[