Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Zeus Support #350

Merged
merged 62 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6abc184
fixed category typo
y0014984 May 2, 2023
30b3e0d
basic-zeus-support-wip
y0014984 Jun 6, 2023
e2031f9
added silent/curator mode for generator turn on/off
y0014984 Jun 6, 2023
85eb96c
added setFuelLevel function
y0014984 Jun 6, 2023
e0c931c
added zeus interface for generators
y0014984 Jun 6, 2023
f7437cd
added conditional functions for all assets
y0014984 Jun 6, 2023
ccf68ac
beautified zeus interface
y0014984 Jun 10, 2023
d8d20fc
added interface for zeus addFile module
y0014984 Jun 10, 2023
27ca2f9
changed all generator names to original ones
y0014984 Jun 10, 2023
a702021
changed module addUser program flow
y0014984 Jun 11, 2023
05b4809
added zeus support for addSecurityCommands module
y0014984 Jun 11, 2023
2f467ad
added zeus support for addGames module
y0014984 Jun 11, 2023
19a2ed1
added zeus support for addFile module
y0014984 Jun 11, 2023
9c79607
added zeus support for addDir module
y0014984 Jun 11, 2023
94793a2
Added asset infos to zeus dialog
y0014984 Jun 11, 2023
933457c
fixed termination of status update script
y0014984 Jun 12, 2023
24df0ba
added deletion of eden editor modules after processing
y0014984 Jun 12, 2023
b506d68
added support for connections to zeus
y0014984 Jun 12, 2023
916bcb5
Merge branch 'dev' into basic-zeus-support
y0014984 Jun 12, 2023
9f85a99
added code from merge conflict
y0014984 Jun 12, 2023
b9998c7
added turning off devices when deleted
y0014984 Jun 12, 2023
4f5ef2e
added removal of power connections on deleted devices
y0014984 Jun 13, 2023
541d1fe
added removal of network connections on deleted devices
y0014984 Jun 13, 2023
8025af2
added curator inface to routers
y0014984 Jun 13, 2023
3e5fcba
fixed an if statement
y0014984 Jun 13, 2023
3a0bbc6
fixed module processing in zeus
y0014984 Jun 14, 2023
589b09e
changed display id's
y0014984 Jun 14, 2023
59b26fb
changed user feedback functions
y0014984 Jun 14, 2023
52920b9
added function headers
y0014984 Jun 14, 2023
496251e
fixed generator soundhandle handling
y0014984 Jun 14, 2023
938020b
fixed power capacity value after provider turn off
y0014984 Jun 14, 2023
1ea5da9
removed unnecessary code
y0014984 Jun 14, 2023
9dfc7cc
fixed reset of ip address if network connection removed
y0014984 Jun 14, 2023
eb59f56
fixed initAttributes for zeus to rounded values
y0014984 Jun 14, 2023
5e4a1d8
added localization strings to zeus UI
y0014984 Jun 15, 2023
e1fafa7
fixed localization string
y0014984 Jun 16, 2023
38f8df2
added checks for valid connections in zeus
y0014984 Jun 16, 2023
2b2a772
added hiding addConnection UI in Zeus on first start
y0014984 Jun 16, 2023
24efbe2
fixed missing Zeus UI headline for desk
y0014984 Jun 16, 2023
ecd07e3
added encryption support to addFile Zeus module
y0014984 Jun 18, 2023
b942b9d
changed function priorities of addFile/addDir modules
y0014984 Jul 4, 2023
15e096b
added ui error messages to addUser/addFile/addDir exceptions
y0014984 Jul 4, 2023
24a4b32
changed deletion of modules
y0014984 Jul 4, 2023
5fb4111
fixed some module related bugs
y0014984 Jul 4, 2023
339ff2a
added server check
y0014984 Jul 7, 2023
811184a
changed zeus module functions to trigger server
y0014984 Jul 7, 2023
05d232b
added checks for spaces in paths and usernames
y0014984 Jul 7, 2023
1eefe88
removed unnecessary event handler calls
y0014984 Jul 7, 2023
3e089a2
changed "Init" to "InitPost"
y0014984 Jul 7, 2023
3d0015e
added new power var "initDone" for related checks
y0014984 Jul 8, 2023
aac89a3
changed setBatteryLevel to serverside execution
y0014984 Jul 8, 2023
c890e1b
added missing localization strings
y0014984 Jul 8, 2023
cfbab4e
changed eden attribute updates for zeus mode
y0014984 Jul 8, 2023
fa78071
added power device check to terminateDevice func
y0014984 Jul 8, 2023
1aeba7c
fixed eden editor module addGames
y0014984 Jul 8, 2023
968416f
added ACE3 cargo name to Zeus UI title bar
y0014984 Jul 8, 2023
df6d915
added back again workaround eh on rugged lamps
y0014984 Jul 9, 2023
85b251f
fixed not working network disconnect condition
y0014984 Jul 9, 2023
1362bac
changed getBatteryLevel function to allow suspend modes
y0014984 Jul 9, 2023
e8571d9
added new var isDevice to check if it's a power device
y0014984 Jul 9, 2023
b537146
fixed some network related bugs and harmonized code
y0014984 Jul 9, 2023
b6f4b37
changed conditional blocks in getBatteryLevel function
y0014984 Jul 11, 2023
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
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];
y0014984 marked this conversation as resolved.
Show resolved Hide resolved
["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