Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions
71438fe393 v1.0.0 Build 32 2025-06-15 16:58:29 +00:00
Jacob Schmidt
39d080fca5 Merge branch 'master' of https://gitea.innovativedevsolutions.org/IDSolutions/client
All checks were successful
Build / Build (push) Successful in 41s
2025-06-15 11:56:18 -05:00
Jacob Schmidt
b5bd3c6cb8 feat: Add core functionality for player and vehicle state management 2025-06-15 11:56:13 -05:00
16 changed files with 204 additions and 1 deletions

View File

@ -0,0 +1 @@
z\forge_client\addons\common

View File

@ -0,0 +1,19 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
serverInit = QUOTE(call COMPILE_FILE(XEH_preInit_server));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
clientInit = QUOTE(call COMPILE_FILE(XEH_postInit_client));
};
};

View File

@ -0,0 +1,3 @@
PREP(actorStateGet);
PREP(actorStateSet);
PREP(getPlayer);

View File

@ -0,0 +1 @@
#include "script_component.hpp"

View File

@ -0,0 +1 @@
#include "script_component.hpp"

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
ADDON = true;

View File

@ -0,0 +1 @@
#include "script_component.hpp"

View File

@ -0,0 +1,2 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

16
addons/common/config.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"forge_client_main"};
authors[] = {"J. Schmidt", "Creedcoder"};
author = "IDSolutions";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"

View File

@ -0,0 +1,43 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Gets the current state of a player
*
* Arguments:
* 0: Player <OBJECT>
*
* Return Value:
* Player State <HASHMAP>
*
* Example:
* _state = [player] call forge_client_common_fnc_actorStateGet
*
* Public: No
*/
params [["_player", objNull, [objNull]]];
private _loadout = getUnitLoadout _player;
private _pos = getPosASL _player;
private _dir = getDir _player;
private _stance = stance _player;
private _phone = GETVAR(_player,FORGE_Phone,QUOTE(000-000-0000));
private _email = GETVAR(_player,FORGE_Email,QUOTE(player@example.com));
private _bank = GETVAR(_player,FORGE_Bank,0);
private _cash = GETVAR(_player,FORGE_Cash,0);
private _state = lifeState _player;
private _hash = createHashMap;
_hash set ["loadout", _loadout];
_hash set ["position", _pos];
_hash set ["direction", _dir];
_hash set ["stance", _stance];
_hash set ["phone", _phone];
_hash set ["email", _email];
_hash set ["bank", _bank];
_hash set ["cash", _cash];
_hash set ["state", _state];
_hash

View File

@ -0,0 +1,65 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Sets the state of a player
*
* Arguments:
* 0: Player <OBJECT>
* 1: Data <STRING>
*
* Return Value:
* Unit State <HASHMAP>
*
* Example:
* [player, _data] call forge_client_common_fnc_actorStateSet
*
* Public: No
*/
params [["_player", objNull, [objNull]], ["_data", "", [""]]];
private _hash = createHashMap;
if (isNull _player || _data isEqualTo "") exitWith {
diag_log text format ["[FORGE:Player:Actor] Invalid player or data: %1", _player];
};
(parseSimpleArray _data) params ["_uid", "_loadout", "_pos", "_dir", "_stance", "_email", "_phone", "_bank", "_cash", "_state"];
_player setUnitLoadout _loadout;
if !(isNil "_pos") then {
_player setPosASL _pos;
private _pAlt = ((getPosATLVisual player) select 2);
private _pVelZ = ((velocity player) select 2);
if (_pAlt > 5 && _pVelZ < 0) then {
player setVelocity [0, 0, 0];
player setPosATL [((getPosATLVisual player) select 0), ((getPosATLVisual player) select 1), 1];
hint "You logged off mid air. You were moved to a safe position on the ground.";
};
};
if !(isNil "_dir") then {
_player setDir _dir;
};
_player playAction _stance;
SETPVAR(_player,FORGE_Phone,_phone);
SETPVAR(_player,FORGE_Email,_email);
SETPVAR(_player,FORGE_Bank,_bank);
SETPVAR(_player,FORGE_Cash,_cash);
SETPVAR(_player,FORGE_State,_state);
_hash set ["uid", _uid];
_hash set ["loadout", _loadout];
_hash set ["position", _pos];
_hash set ["direction", _dir];
_hash set ["stance", _stance];
_hash set ["phone", _phone];
_hash set ["email", _email];
_hash set ["bank", _bank];
_hash set ["cash", _cash];
_hash set ["state", _state];
_hash

View File

@ -0,0 +1,27 @@
#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Gets a player object by UID.
*
* Arguments:
* 0: Player UID <STRING>
*
* Return Value:
* Player object or objNull if not found <OBJECT>
*
* Example:
* ["76561198012345678"] call forge_client_common_fnc_getPlayer
*
* Public: Yes
*/
params ["_uid"];
private _player = objNull;
{
if ((getPlayerUID _x) isEqualTo _uid) exitWith { _player = _x; };
} forEach allPlayers;
_player

View File

@ -0,0 +1,16 @@
#define COMPONENT common
#define COMPONENT_BEAUTIFIED Common
#include "\z\forge_client\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
#ifdef DEBUG_ENABLED_COMMON
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_COMMON
#define DEBUG_SETTINGS DEBUG_SETTINGS_COMMON
#endif
#include "\z\forge_client\addons\main\script_macros.hpp"

View File

@ -1,4 +1,4 @@
#define MAJOR 1 #define MAJOR 1
#define MINOR 0 #define MINOR 0
#define PATCH 0 #define PATCH 0
#define BUILD 31 #define BUILD 32