Epoch/Sources/epoch_code/compile/setup/EPOCH_clientInit.sqf

111 lines
3.2 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Initalize player variables
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
2016-06-13 16:54:19 +00:00
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/setup/EPOCH_clientInit.sqf
2015-12-07 16:24:52 +00:00
Example:
call EPOCH_clientInit;
Parameter(s):
NONE
Returns:
NOTHING
*/
2015-09-14 20:55:36 +00:00
EPOCH_buildMode = 0;
EPOCH_buildDirection = 0;
EPOCH_buildDirectionPitch = 0;
EPOCH_buildDirectionRoll = 0;
EPOCH_target_attachedTo = player;
2015-09-14 20:55:36 +00:00
EPOCH_debugMode = false;
EPOCH_snapDirection = 0;
EPOCH_stabilityTarget = objNull;
EPOCH_equippedItem_PVS = [];
EPOCH_pendingP2ptradeTarget = objNull;
EPOCH_lastNPCtradeTarget = objNull;
EPOCH_lastJumptime = diag_tickTime;
EPOCH_lastAGTime = diag_tickTime;
EPOCH_lastMineRocks = diag_tickTime;
EPOCH_target = objNull;
EPOCH_Z_OFFSET = 0;
EPOCH_X_OFFSET = 0;
EPOCH_Y_OFFSET = 5;
2015-11-22 23:52:24 +00:00
EPOCH_arr_snapPoints = [];
EPOCH_arr_snapObjects = [];
2015-09-14 20:55:36 +00:00
EPOCH_prevTarget = objNull;
EPOCH_interactOption = 0;
EPOCH_playerStaminaMax = 100;
2018-05-06 00:07:56 +00:00
Epoch_ActiveCam = objnull;
Epoch_AutoCam = true;
Epoch_CamAdjust = [0,0,0];
2015-09-14 20:55:36 +00:00
{
missionNamespace setVariable [format ["EPOCH_player%1",_x],EPOCH_defaultVars select _forEachIndex];
}forEach EPOCH_customVars;
// suppress group chatter
0 fadeRadio 0;
enableSentences false;
enableRadio false;
player setVariable["BIS_noCoreConversations", true];
CfgActions overriding - fire on/off req - a3 hooking ++ [FIXED] BurnBarrel and FirePlace02 UserActions requiring lighter_epoch did not need lighter when performed. [NEW] CfgActions event handler for "Action" ("PrevAction" and "NextAction" - not implemented yet) -Allows ability to override any of the CfgActions/UserActions in Arma 3 and other mods. [ADDED] usedItemRepack function to remove 1 use from the lighter. [ADDED] Require fire extinguisher to "Put Out Fire" on the Burn Barrel [CHANGED] ItemFireExtinguisher now has count = 5 for 5 uses to put out a small fire [ADDED] ItemFireExtinguisher to CfgItemSort and CfgPricing [ADDED] Arma Sling Loading requires ItemRope to sling and returns rope upon release.. [ADDED] Checks for R3F can_lift and Advanced Slingload InitVar. [ADDED] If above mod/script is present disable Arma SlingLoad Hook/Unhook action and key press. [CHANGED] While working with keyDown EH, debug logs show the DIKCodes are being pushed as whole numbers and not the 0x01 as the escape keyDown handler was setup to use and why my tests were failing using the 0x30 for the letter B(Hook/Unhook). [UPGRADED] Changed over the 0x01 and 0x30 to the actionKeys name in order to properly handle those with client using custom keys. [TEASED] Have a commented line in the Light Fire case showing future plans for a fire system(BURN BABY BURN!). [NEW] EPOCH_usedItemRepack Description: Allows adjusting of "ammo" counts in a magazine. Can be used locally and on the server for a remote unit. ``` [_player,_magazine,_change] call EPOCH_usedItemRepack;
2017-12-06 00:20:08 +00:00
EPOCH_ArmaSlingLoad = true;
_r3fON = if(!isNil "R3F_LOG_CFG_can_lift")then{if!(R3F_LOG_CFG_can_lift isEqualTo [])then{true}else{false}}else{false};
_advSling = if(!isNil "ASL_ROPE_INIT")then{if(ASL_ROPE_INIT)then{true}else{false}}else{false};
if (_r3fON || _advSling)then{
EPOCH_ArmaSlingLoad = false;
};
// handle actions, prevactions, nextactions
inGameUISetEventHandler ["Action", "if(!(_this isEqualTo []) && !(_this select 10 in ['PrevAction','NextAction']))then{_this call EPOCH_handleUIActions}"];
//inGameUISetEventHandler ["NextAction", "_this call EPOCH_handleUIActions"];
//inGameUISetEventHandler ["PrevAction", "_this call EPOCH_handleUIActions"];
// Load / Overwrite Vars from ProfileNamespace
_cfg = "e_pad_config" call EPOCH_returnConfig;
_startvars = getarray (_cfg >> "LoadVarsFromProfile");
_arr = profilenamespace getvariable ["Epoch_ToggleVars",[[],[]]];
_todelete = [];
{
_x params ["_varname",["_default","false",[""]]];
if (_varname isequaltype "" && !(_varname isequalto "")) then {
_value = if ((tolower _default) isequalto "true") then {true} else {false};
_find = (_arr select 0) find _varname;
if (_find > -1) then {
_tmpvalue = (_arr select 1 select _find);
if (_tmpvalue isequaltype true) then {
_value = _tmpvalue;
}
else {
_todelete pushback _x;
};
}
else {
(_arr select 0) pushback _varname;
(_arr select 1) pushback _default;
};
missionnamespace setvariable [_varname,_value];
};
} foreach _startvars;
{
_find = (_arr select 0) find _x ;
if (_find > -1) then {
(_arr select 0) deleteat _find;
(_arr select 1) deleteat _find;
};
} foreach _todelete;
if !(_arr isequalto (profilenamespace getvariable ["Epoch_ToggleVars",[[],[]]])) then {
profilenamespace setvariable ["Epoch_ToggleVars",_arr];
saveprofilenamespace;
};