Skip to content

Commit

Permalink
Merge pull request #350 from y0014984/basic-zeus-support
Browse files Browse the repository at this point in the history
Basic Zeus Support
  • Loading branch information
y0014984 authored Jul 11, 2023
2 parents 28a1674 + b6f4b37 commit 403ac01
Show file tree
Hide file tree
Showing 102 changed files with 5,619 additions and 1,132 deletions.
9 changes: 0 additions & 9 deletions addons/armaos/CfgFactionClasses.hpp

This file was deleted.

92 changes: 55 additions & 37 deletions addons/armaos/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ class CfgVehicles
class Land_Laptop_03_black_F;
class Land_Laptop_03_black_F_AE3: Land_Laptop_03_black_F
{
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.

editorCategory = "AE3_Assets";

curatorInfoTypeEmpty = "AE3_UserInterface_Zeus_Asset_Details";

// Eden Editor Attributes
class Attributes
{
Expand All @@ -29,12 +35,6 @@ class CfgVehicles
};
};

// Event Handlers
class EventHandlers
{
//init = "params ['_entity']; call compile preprocessFileLineNumbers '\z\ae3\addons\main\init\initLaptop.sqf';";
};

class AE3_Equipment
{
displayName = "$STR_AE3_ArmaOS_Config_LaptopDisplayName";
Expand All @@ -48,20 +48,20 @@ class CfgVehicles
closeAction = "_this call AE3_interaction_fnc_laptop_close;";
closeActionCondition = "isNull (_this getVariable ['AE3_computer_mutex', objNull])";

class AE3_ace3Interactions
class AE3_ace3Interactions
{
class AE3_aceCarrying
{
// Carrying
ae3_dragging_canCarry = 1; // Can be dragged (0-no, 1-yes)
ae3_dragging_carryPosition[] = {0, 1, 1}; // Offset of the model from the body while dragging (same as attachTo)
ae3_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo)
};
class AE3_aceCargo
{
ae3_cargo_canLoad = 1; // Enables the object to be loaded (1-yes, 0-no)
ae3_cargo_size = 1; // Cargo space the object takes
};
class AE3_aceCarrying
{
// Carrying
ae3_dragging_canCarry = 1; // Can be dragged (0-no, 1-yes)
ae3_dragging_carryPosition[] = {0, 1, 1}; // Offset of the model from the body while dragging (same as attachTo)
ae3_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo)
};
class AE3_aceCargo
{
ae3_cargo_canLoad = 1; // Enables the object to be loaded (1-yes, 0-no)
ae3_cargo_size = 1; // Cargo space the object takes
};
};
};

Expand Down Expand Up @@ -134,7 +134,13 @@ class CfgVehicles
class Land_Laptop_03_olive_F;
class Land_Laptop_03_olive_F_AE3: Land_Laptop_03_olive_F
{
// Eden Editor Attributes
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.

editorCategory = "AE3_Assets";

curatorInfoTypeEmpty = "AE3_UserInterface_Zeus_Asset_Details";

// Eden Editor Attributes
class Attributes
{
class AE3_EdenAttribute_PowerLevel
Expand All @@ -157,12 +163,6 @@ class CfgVehicles
};
};

// Event Handlers
class EventHandlers
{
//init = "params ['_entity']; call compile preprocessFileLineNumbers '\z\ae3\addons\main\init\initLaptop.sqf';";
};

class AE3_Equipment
{
displayName = "$STR_AE3_ArmaOS_Config_LaptopDisplayName";
Expand All @@ -176,7 +176,7 @@ class CfgVehicles
closeAction = "_this call AE3_interaction_fnc_laptop_close;";
closeActionCondition = "isNull (_this getVariable ['AE3_computer_mutex', objNull])";

class AE3_ace3Interactions
class AE3_ace3Interactions
{
class AE3_aceCarrying
{
Expand Down Expand Up @@ -262,7 +262,13 @@ class CfgVehicles
class Land_Laptop_03_sand_F;
class Land_Laptop_03_sand_F_AE3: Land_Laptop_03_sand_F
{
// Eden Editor Attributes
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.

editorCategory = "AE3_Assets";

curatorInfoTypeEmpty = "AE3_UserInterface_Zeus_Asset_Details";

// Eden Editor Attributes
class Attributes
{
class AE3_EdenAttribute_PowerLevel
Expand All @@ -285,12 +291,6 @@ class CfgVehicles
};
};

// Event Handlers
class EventHandlers
{
//init = "params ['_entity']; call compile preprocessFileLineNumbers '\z\ae3\addons\main\init\initLaptop.sqf';";
};

class AE3_Equipment
{
displayName = "$STR_AE3_ArmaOS_Config_LaptopDisplayName";
Expand Down Expand Up @@ -410,6 +410,7 @@ class CfgVehicles
{
// Standard object definitions
scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.
displayName = "$STR_AE3_ArmaOS_Config_AddUserDisplayName"; // Name displayed in the menu
icon = "\z\ae3\addons\armaos\ui\AE3_Module_Icons_addUser.paa"; // Map icon. Delete this entry to use the default icon
category = "AE3_armaosModules";
Expand All @@ -428,7 +429,7 @@ class CfgVehicles
is3DEN = 0;

// Menu displayed when the module is placed or double-clicked on by Zeus
curatorInfoType = "RscDisplayAttributeModuleUserlist";
curatorInfoType = "AE3_UserInterface_Zeus_Module_AddUser";

// Module attributes, uses https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Entity_Specific
class Attributes: AttributesBase
Expand Down Expand Up @@ -484,10 +485,13 @@ class CfgVehicles
{
// Standard object definitions
scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.
displayName = "$STR_AE3_ArmaOS_Config_AddSecurityCommandsDisplayName"; // Name displayed in the menu
icon = "\z\ae3\addons\armaos\ui\AE3_Module_Icon_addSecurityCommands_v2.paa"; // Map icon. Delete this entry to use the default icon
category = "AE3_armaosModules";

portrait = "\z\ae3\addons\armaos\ui\AE3_Module_Icon_addSecurityCommands_v2.paa"; // seems to be used by Zeus as icon

// Name of function triggered once conditions are met
function = "AE3_armaos_fnc_module_addSecurityCommands";
// Execution priority, modules with lower number are executed first. 0 is used when the attribute is undefined
Expand All @@ -502,7 +506,7 @@ class CfgVehicles
is3DEN = 0;

// Menu displayed when the module is placed or double-clicked on by Zeus
curatorInfoType = "RscDisplayAttributeModuleAddSecurityCommands";
curatorInfoType = "AE3_UserInterface_Zeus_Module_AddSecurityCommands";

// Module attributes, uses https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Entity_Specific
class Attributes: AttributesBase
Expand Down Expand Up @@ -563,6 +567,7 @@ class CfgVehicles
{
// Standard object definitions
scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
scopeCurator = 2; // Zeus visability; 2 will show it in the menu, 0 will hide it.
displayName = "$STR_AE3_ArmaOS_Config_AddGamesDisplayName"; // Name displayed in the menu
icon = "\z\ae3\addons\armaos\ui\AE3_Module_Icons_addGames.paa"; // Map icon. Delete this entry to use the default icon
category = "AE3_armaosModules";
Expand All @@ -581,11 +586,24 @@ class CfgVehicles
is3DEN = 0;

// Menu displayed when the module is placed or double-clicked on by Zeus
curatorInfoType = "RscDisplayAttributeModuleAddGames";
curatorInfoType = "AE3_UserInterface_Zeus_Module_AddGames";

// Module attributes, uses https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Entity_Specific
class Attributes: AttributesBase
{

// Arguments shared by specific module type (have to be mentioned in order to be present)
class AE3_ModuleAddGames_IsSnake: Checkbox
{
property = "AE3_Module_AddGames_Snake";
displayName = "snake";
tooltip = "$STR_AE3_ArmaOS_Config_ModuleAddGamesSnakeTooltip";
typeName = "BOOL"; // Value type, can be "NUMBER", "STRING" or "BOOL"
// Default text filled in the input box
// Because it is an expression, to return a String one must have a string within a string
defaultValue = true;
};

class ModuleDescription: ModuleDescription{}; // Module description should be shown last
};

Expand Down
4 changes: 4 additions & 0 deletions addons/armaos/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ PREP(computer_standby);
PREP(computer_turnOn);
PREP(computer_turnOff);

PREP(computer_addUser);
PREP(computer_addSecurityCommands);
PREP(computer_addGames);

PREP(computer_getLocality);

/* OS Link Functions */
Expand Down
13 changes: 10 additions & 3 deletions addons/armaos/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ class CfgPatches
class ADDON
{
name = QUOTE(COMPONENT);
units[] = {"AE3_Filesystem"};
units[] =
{
"Land_Laptop_03_black_F_AE3",
"Land_Laptop_03_olive_F_AE3",
"Land_Laptop_03_sand_F_AE3",
"AE3_AddUser",
"AE3_AddSecurityCommands",
"AE3_AddGames"
};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"A3_Modules_F", "cba_main", "ace_main", "acex_main", "ae3_main", "ae3_network", "ae3_filesystem", "ae3_interaction"};
Expand All @@ -15,7 +23,6 @@ class CfgPatches
};

#include "CfgEventHandlers.hpp"
#include "CfgFactionClasses.hpp"
#include "CfgVehicles.hpp"
#include "Cfg3DEN.hpp"

Expand All @@ -29,5 +36,5 @@ class CfgPatches
// Grid Macros and Styles
#include "defines.inc"

// Advanced Equipment 3 Dialog Definitions
// Advanced Equipment Dialog Definitions
#include "dialog.hpp"
27 changes: 27 additions & 0 deletions addons/armaos/functions/fnc_computer_addGames.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* PUBLIC
*
* Adds selected games to a given computer. Currently only Snake supported.
* Needs to run on server.
*
* Arguments:
* 1: Computer <OBJECT>
* 2: Snake <BOOL>
*
* Results:
* None
*
* Example:
* [_computer, true] call AE3_armaos_fnc_computer_addGames;
*
*/

params ["_computer", "_isSnake"];

if (!isServer) exitWith {};

if (_isSnake) then
{
//--- add all games to all synced computers
[_computer, "CfgGames", ["snake"]] call AE3_armaos_fnc_link_init;
};
33 changes: 33 additions & 0 deletions addons/armaos/functions/fnc_computer_addSecurityCommands.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* PUBLIC
*
* Adds selected security commands to a given computer.
* Needs to run on server.
*
* Arguments:
* 1: Computer <OBJECT>
* 2: Crypto <BOOL>
* 3: Crack <BOOL>
*
* Results:
* None
*
* Example:
* [_computer, true, true] call AE3_armaos_fnc_computer_addSecurityCommands;
*
*/

params ["_computer", "_isCrypto", "_isCrack"];

if (!isServer) exitWith {};

if (_isCrypto) then
{
//--- add 'crypto' command to all synced computers
[_computer, "CfgSecurityCommands", ["crypto"]] call AE3_armaos_fnc_link_init;
};
if (_isCrack) then
{
//--- add 'crack' command to all synced computers
[_computer, "CfgSecurityCommands", ["crack"]] call AE3_armaos_fnc_link_init;
};
55 changes: 55 additions & 0 deletions addons/armaos/functions/fnc_computer_addUser.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* PUBLIC
*
* Adds a user to a given computer by providing username and password. Also a user directory will be created.
* Needs to run on server.
*
* Arguments:
* 1: Computer <OBJECT>
* 2: Username <STRING>
* 3: Password <STRING>
*
* Results:
* None
*
* Example:
* [_computer, "admin", "admin123"] call AE3_armaos_fnc_computer_addUser;
*
*/

params ["_computer", "_username", "_password"];

if (!isServer) exitWith {};

// Get userlist and filesystem from computer
private _userlist = _computer getVariable ["AE3_Userlist", createHashMap];
private _filesystem = _computer getVariable ["AE3_filesystem", []];

// Add user to userlist
_userlist set [_username, _password];

// Add user directory in /home/
if(!(_username isEqualTo "root")) then
{
try
{
[[], _filesystem, "/home/" + _username, "root", _username] call AE3_filesystem_fnc_createDir;
}
catch
{
private _normalizedException = _exception regexReplace ["'(.+)'", "'%1'"];
if (_normalizedException isEqualTo (localize "STR_AE3_Filesystem_Exception_AlreadyExists")) then
{
diag_log format ["AE3 exception: %1", _exception];
["AE3 exception: %1", _exception] call BIS_fnc_error;
}
else
{
throw _exception;
};
};
};

// resync userlist and filesystem
_computer setVariable ["AE3_filesystem", _filesystem];
_computer setVariable ["AE3_Userlist", _userlist, true];
Loading

0 comments on commit 403ac01

Please sign in to comment.