Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
51 changes: 46 additions & 5 deletions ArmA_3/A3_EPOCH_virtualGarage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,54 @@ This script/menu gives any EPOCH player the ability to have a "cloud-storage" ve
The amount of garage slots can be changed by the admin that installs this script onto his/her server.<br />
All vehicles inside the garage are saved to the database (Redis) and are persistent IF inside the garage. <br />
Which means that when the player takes it out and does not put it back before the server restarts; it will be gone.<br />

<br />
<br />
#### Whats New?
<br />
**Server Side**<br />
[REMOVED] PublicVariable Event Handler<br />
[REMOVED] Spawn loop for generating keys for each <br />
[ADDED] 3 new functions to handle the removed PVEH(ReadFrom/WriteTo/TrashFrom)<br />
[ADDED] 2 new functions to spit out client vgs key and client garage on join<br />
[ADDED] Debug config option to log every use/request<br />
<br />
**Client Side**<br />
[FIXED] Global.hpp missing and caused hosts issues getting the script setup and running<br />
[ADDED] Ships are now searched for and listed for storage in the garage<br />
[FIXED] System searched for "Air", but listed only "Helicopters" (now planes and VTOL will show up).<br />
[ADDED] Scroll Wheel config option to disable/enable<br />
[ADDED] Dyna Menu self interaction<br />
[ADDED] Jammer requirement config option along with max distance from jammer entry<br />
[ADDED] Scroll Wheel will follow Jammer Requirements and Max Distance if enabled<br />
[ADDED] Dyna Menu will follow Jammer Requirements and Max Distance if enabled<br />
[ADDED] Debug config option to log each client vgs event<br />
[ADDED] New Function to handle the receipt of data from VGS server<br />
[FIXED] Refreshing of VGS GUI on Move IN and Move OUT was not refreshing both sides properly.<br />
<br />
**Configs**<br />
// Settings here<br />
debug = 0; // 1 = ON // 0 = OFF<br />
range = 25; // Vehicles within this range of player can be moved into garage<br />
useScrollWheel = 1; // Scroll Wheel VGS Menu<br />
requireJammer = 0; // 1 = ON // 0 = OFF<br />
maxDistanceFromJammer = 300; // meters, only applies if requireJammer = 1<br />
<br />
<br />
#### Installation
**clientSide:** move the folder called `scarCODE` into the root of your mission file. Then open your description.ext and merge the content of the description.ext provided with this repository. Make sure you do not have `class cfgFunctions {` twice nor `tag="SC";` twice.<br />
**serverSide:** move the folder called `a3_epoch_virtualGarage` into your server's `@epochhive\addons` folder. When done with configuration, you can pack the contents of `a3_epoch_virtualGarage` into a pbo named exactly the same. <br />

**clientSide:**<br />
move the folder called `scarCODE` into the root of your mission file.<br />
Then open your description.ext and merge the content of the description.ext provided with this repository.<br />
Then open your epoch_configs\configs\cfgRemoteExec.hpp and merge the content of the cfgRemoteExec.hpp provided with this repository.<br />
Then open your epoch_configs\configs\cfgActionMenu_self.hpp and merge the content of the cfgActionMenu_self.hpp provided with this repository.<br />
Then open your epoch_configs\configs\cfgFunctions.hpp and merge the content of the cfgFunctions.hpp provided with this repository.<br />
Make sure you do not have `tag="SC";` twice.<br />
<br />
**serverSide:**<br />
move the folder called `a3_epoch_virtualGarage` into your server's `@epochhive\addons` folder.<br />
When done with configuration, you can pack the contents of `a3_epoch_virtualGarage` into a pbo named exactly the same.<br />
<br />
#### Configuration
**clientSide:** open `config_VGS.hpp` located in `scarCODE\VGS` and edit its settings to your likings <br />
**serverSide:** open `config.cpp` located in `@epochhive\addons` and edit its setting to your likings <br />
**serverSide:** open `config.cpp` located in `@epochhive\addons\a3_epoch_virtualGarage` and edit its setting to your likings <br />
<br />
*Want to help me out with making more stuff in the future? You can donate here: (PayPal) http://scarcode.com/donate/*
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
class cfgVGSclient
{
// Settings here
debug = 1; // 1 = ON // 0 = OFF
range = 25; // Vehicles within this range of player can be moved into garage
useScrollWheel = 1; // Scroll Wheel VGS Menu
requireJammer = 0; // 1 = ON // 0 = OFF
maxDistanceFromJammer = 300; // meters, only applies if requireJammer = 1
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Author: DirtySanchez from DonkeyPunch.INFO

Description:
Condition file for allowing DynaMenu or addAction

Returns:
BOOLEAN
*/
private["_nearestJammer", "_jammer", "_maxDist"];
_result = false;
_nearestJammer = objNull;
_jammer = "requireJammer" call SC_fnc_vgsGetClientSetting;
if(_jammer isEqualTo 1)then
{
_maxDist = "maxDistanceFromJammer" call SC_fnc_vgsGetClientSetting;
_jammer = nearestObjects[player, ["PlotPole_EPOCH"], _maxDist];
if !(_jammer isEqualTo []) then
{
{
if (alive _x && (_x distance player) <= _maxDist) exitWith{
_nearestJammer = _x;
};
} foreach _jammer;
if !(isNull _nearestJammer) then
{
if((_nearestJammer getVariable["BUILD_OWNER", "-1"]) in[getPlayerUID player, Epoch_my_GroupUID])then
{
_result = true;
};
};
};
};
if(_jammer isEqualTo 0)then
{
_result = true;
};
_result
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/*
Author: IT07


Contributor: DirtySanchez from DonkeyPunch.INFO

Description:
init file for Virtual Garage System menu
Client init file for Virtual Garage System menu
*/

if not hasInterface exitWith {};
Expand All @@ -15,14 +17,29 @@ if not hasInterface exitWith {};
["[EPOCH VGS] ERROR! fn_initClientVGS called when display 46 AND EPOCH_loadingScreenDone are not(isNull/isNil)"] call BIS_fnc_errorMsg
};
};

waitUntil { uiSleep 2; (not(isNull(findDisplay 46)) AND not(isNil"EPOCH_loadingScreenDone")) };
_aa = player addAction ["<t size='2' shadow='0'>VGS</t>",{createDialog'SC_vgsDiag';}, "", -1, false, true];
"DynamicBlur" ppEffectEnable true;
waitUntil { uiSleep 0.5; not isNil"EPOCH_vgsMyKey" };
if not(EPOCH_vgsMyKey isEqualTo "") then

EPOCH_vgsMyKey = "";
[player, Epoch_personalToken] remoteExec ["VGS_fnc_vgsRequestKey",2];

_debug = "debug" call SC_fnc_vgsGetClientSetting;
if(_debug isEqualTo 1) then {diag_log format["[EPOCH VGS]: ClientInit requesting key = %1", EPOCH_vgsMyKey]};

_addAction = "useScrollWheel" call SC_fnc_vgsGetClientSetting;
if(_addAction isEqualTo 1)then
{
EPOCH_vgsPV = ["Request",[player,EPOCH_vgsMyKey]];
publicVariableServer "EPOCH_vgsPV";
EPOCH_vgsPV = nil;
_aa = player addAction ["<t size='2' shadow='0'>VGS</t>",{createDialog'SC_vgsDiag';}, "", -1, false, true,"","call SC_fnc_dynaMenuCondition",("maxDistanceFromJammer" call SC_fnc_vgsGetClientSetting)];
if(_debug isEqualTo 1) then {diag_log format["[EPOCH VGS]: ClientInit added action = %1", _aa]};
};

waitUntil { uiSleep 0.5; not(EPOCH_vgsMyKey isEqualTo "") };
if(_debug isEqualTo 1) then {diag_log format["[EPOCH VGS]: ClientInit received key = %1", EPOCH_vgsMyKey]};

EPOCH_vgsMyGarage = [];
[player, EPOCH_vgsMyKey] remoteExec ["VGS_fnc_vgsRequestGarage",2];
if(_debug isEqualTo 1) then {diag_log format["[EPOCH VGS]: ClientInit requesting garage = %1", EPOCH_vgsMyGarage]};

waitUntil { uiSleep 0.5; not(EPOCH_vgsMyGarage isEqualTo []) };
if(_debug isEqualTo 1) then {diag_log format["[EPOCH VGS]: ClientInit received garage = %1", EPOCH_vgsMyGarage]};
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Author: IT07

Contributor: DirtySanchez from DonkeyPunch.INFO

Description:
moves given selected vehicle INTO the virtual garage
Expand Down Expand Up @@ -27,7 +29,7 @@ if not isNil"_dsp" then
_ctrlFeedback ctrlSetText "Selected vehicle check #1 complete.";
_ctrlFeedback ctrlSetText "Building check complete.";
_range = "range" call SC_fnc_vgsGetClientSetting;
_vehs = (position player) nearEntities [['Air','Car','MotorCycle','Tank'], _range];
_vehs = (position player) nearEntities [['Air','Car','MotorCycle','Tank','Ship'], _range];
if (_index < (count _vehs)) then
{
_ctrlFeedback ctrlSetText "Selected vehicle check #2 complete.";
Expand Down Expand Up @@ -115,26 +117,9 @@ if not isNil"_dsp" then
if (typeName EPOCH_vgsMyKey isEqualTo "STRING") then
{
_ctrlFeedback ctrlSetText "Key has correct typeName.";
EPOCH_vgsPV = ["Write",[_slot, _veh, player, EPOCH_vgsMyKey]];
publicVariableServer "EPOCH_vgsPV";
EPOCH_vgsPV = nil;
[_slot, _veh, player, EPOCH_vgsMyKey] remoteExec ["VGS_fnc_vgsWriteToGarage",2];
_ctrlFeedback ctrlSetText "Requesting data from server...";
_changed = [_vehs, "EPOCH_vgsMyGarage"] call SC_fnc_vgsWaitForChange;
if _changed then
{
_ctrlFeedback ctrlSetText "Reloading outside vehicles...";
_refreshed = ["Outside"] call SC_fnc_vgsRefresh;
if _refreshed then
{
_ctrlFeedback ctrlSetText "Reloading garage vehicles...";
_refreshed = ["Inside"] call SC_fnc_vgsRefresh;
if _refreshed then
{
_lbInsideGarage ctrlEnable true;
_ctrlFeedback ctrlSetText "Loading done.";
};
};
};
_lbInsideGarage ctrlEnable true;
};
};
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*
Author: IT07

Contributor: DirtySanchez from DonkeyPunch.INFO

Description:
moves given selected vehicle OUT of the virtual garage

Expand Down Expand Up @@ -40,25 +42,8 @@ if not isNil"_dsp" then
if (typeName EPOCH_vgsMyKey isEqualTo "STRING") then
{
_ctrlFeedback ctrlSetText "Key has correct typeName.";
EPOCH_vgsPV = ["Read",[_slot, player, EPOCH_vgsMyKey]];
publicVariableServer "EPOCH_vgsPV";
EPOCH_vgsPV = nil;
[_slot, player, EPOCH_vgsMyKey] remoteExec ["VGS_fnc_vgsReadFromGarage",2];
_ctrlFeedback ctrlSetText "Requesting data from server...";
_changed = [_vehs, "EPOCH_vgsMyGarage"] call SC_fnc_vgsWaitForChange;
if _changed then
{
_ctrlFeedback ctrlSetText "Server data received!";
_refreshed = ["Inside"] call SC_fnc_vgsRefresh;
if _refreshed then
{
_ctrlFeedback ctrlSetText "Garage vehicles reloaded.";
_refreshed = ["Outside"] call SC_fnc_vgsRefresh;
if _refreshed then
{
_ctrlFeedback ctrlSetText "Loading done.";
};
};
};
};
};
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Author: DirtySanchez from DonkeyPunch.INFO

Description:
Handles data from the VGS Server
*/
private[];
params [ "_type", "_data" ];

diag_log str([_type, _data]);

switch _type do {
case "Key" : {EPOCH_vgsMyKey = _data};
case "Garage" : {EPOCH_vgsMyGarage = _data};
};

disableSerialization;
_dsp = uiNamespace getVariable "VGSdisplay";
if not isNil"_dsp" then
{
if not isNull _dsp then
{
_ctrlFeedback = _dsp displayCtrl 1002;
_ctrlFeedback ctrlSetText "Reloading garage vehicles...";
_inside = ["Inside"] call SC_fnc_vgsRefresh;
if _inside then
{
_ctrlFeedback ctrlSetText "Reloading outside vehicles...";
_outside = ["Outside"] call SC_fnc_vgsRefresh;
if _outside then
{
_ctrlFeedback ctrlSetText "Loading done.";
};
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if not isNil"_dsp" then
_ctrlNoVehs = _dsp displayCtrl 1006;
_ctrlFeedBack = _dsp displayCtrl 1002;
_range = "range" call SC_fnc_vgsGetClientSetting;
_vehs = (position player) nearEntities [['Air','Car','MotorCycle','Tank'], _range];
_vehs = (position player) nearEntities [['Air','Car','MotorCycle','Tank','Ship'], _range];
if (count _vehs > 0) then
{
private ["_remVeh"];
Expand Down Expand Up @@ -92,11 +92,15 @@ if not isNil"_dsp" then
{
_add = true
};
case (_x isKindOf "Helicopter"):
case (_x isKindOf "Air"):
{
_add = true
};
case (_x isKindOf "MotorCycle"):
{
_add = true
};
case (_x isKindOf "Ship"):
{
_add = true
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ if not isNil"_dsp" then
if (typeName EPOCH_vgsMyKey isEqualTo "STRING") then
{
_ctrlFeedback ctrlSetText "Key has correct typeName.";
EPOCH_vgsPV = ["Trash",[_curSel, player, EPOCH_vgsMyKey]];
publicVariableServer "EPOCH_vgsPV";
EPOCH_vgsPV = nil;
[_curSel, player, EPOCH_vgsMyKey] remoteExec ["VGS_fnc_vgsTrashFromGarage",2];
_ctrlFeedback ctrlSetText "Requesting data from server...";
_changed = [_vehs, "EPOCH_vgsMyGarage"] call SC_fnc_vgsWaitForChange;
if _changed then
{
_reload = ["Inside"] call SC_fnc_vgsRefresh;
_ctrlFeedback ctrlSetText "Vehicle deleted.";
};
};
Expand Down
Loading