Skip to content

Commit

Permalink
Bugfix/startup order (#417)
Browse files Browse the repository at this point in the history
* Initial Commit

added in PCL checks for starter to engage
HAVE NOT TESTED, CANNOT TEST LOCAL DUE TO SCONS ISSUE

* Logic Error fixed, tested local and ready for merge back to main

* Adjusted ESIS logic

* Added in standby insturments battery

* Adjusted variables so they affect globaly
  • Loading branch information
AdozenBABYdogs authored Nov 3, 2023
1 parent d424680 commit 35e8544
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 4 deletions.
5 changes: 4 additions & 1 deletion addons/uh60_engine/functions/fnc_acftBattery.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ private _battSwitch1State = _vehicle getVariable "vtx_uh60_acft_batt1SwitchSt
private _battSwitch2State = _vehicle getVariable "vtx_uh60_acft_batt2SwitchState";
private _battBusState = _vehicle getVariable "vtx_uh60_acft_battBusState";
private _stbyInstSwitchState = _vehicle getVariable "vtx_uh60_acft_stbyInstSwitchState";
private _ACBusState = _vehicle getVariable "vtx_uh60_acft_ACBusState";
private _stbyInstBatt = _vehicle getVariable "vtx_uh60_acft_stbyInstBatt"; //1800

if (_battSwitch1State == "ON" || _battSwitch2State == "ON") then {
_battBusState = "ON";
Expand All @@ -20,7 +22,8 @@ _vehicle setVariable ["vtx_uh60_acft_battBusState", _battBusState];
if (_battBusState == "ON") then {
_vehicle animate ["PowerOnOff", 1];
//Stby inst switch
if (_stbyInstSwitchState == "ON") then {
//eng on or apu on or switch on
if ((_stbyInstSwitchState == "ON" || _ACBusState == "ON") && _stbyInstBatt > 0) then {
_vehicle animate ["ESIS_hide", 0];
} else { _vehicle animate ["ESIS_hide", 1]; };
} else {
Expand Down
1 change: 1 addition & 0 deletions addons/uh60_engine/functions/fnc_setup.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ player addEventHandler ["SelectedRotorLibActionPerformed", {
SET_GLOBAL_DEFAULT("vtx_uh60_acft_mikSwitchState", "OFF");
//--Standby instrument switch
SET_GLOBAL_DEFAULT("vtx_uh60_acft_stbyInstSwitchState", "OFF");
SET_GLOBAL_DEFAULT("vtx_uh60_acft_stbyInstBatt", 1800);
//--Battery
SET_GLOBAL_DEFAULT("vtx_uh60_acft_batt1SwitchState", "OFF");
SET_GLOBAL_DEFAULT("vtx_uh60_acft_batt2SwitchState", "OFF");
Expand Down
6 changes: 4 additions & 2 deletions addons/uh60_engine/functions/fnc_starterState.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ params ["_vehicle", "_animName", "_animEndState"];
//SFM+
private _mikSwitchState = _vehicle getVariable "vtx_uh60_acft_mikSwitchState";
private _dcBusState = _vehicle getVariable "vtx_uh60_acft_DCBusState";
private _eng1PwrCtrlLeverState = _vehicle getVariable "vtx_uh60_acft_eng1PwrCtrlLeverState";
private _eng2PwrCtrlLeverState = _vehicle getVariable "vtx_uh60_acft_eng2PwrCtrlLeverState";

if (_animName == "STARTER1") then {
if (_mikSwitchState == "ON" && _dcBusState == "ON") then {
if (_mikSwitchState == "ON" && _dcBusState == "ON" && _eng1PwrCtrlLeverState == "OFF") then {
[_vehicle, 0] call vtx_uh60_sfmplus_fnc_interactStartSwitch;
};
};

if (_animName == "STARTER2") then {
if (_mikSwitchState == "ON" && _dcBusState == "ON") then {
if (_mikSwitchState == "ON" && _dcBusState == "ON" && _eng2PwrCtrlLeverState == "OFF") then {
[_vehicle, 1] call vtx_uh60_sfmplus_fnc_interactStartSwitch;
};
};
1 change: 1 addition & 0 deletions addons/uh60_sfmplus/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CfgFunctions
class getArea {R;};
class getInput {R;};
class linearInterp {R;};
class standbyInst {R;};
//class perFrame {R;};
class setArrayVariable {R;};
//class setup {R;};
Expand Down
5 changes: 4 additions & 1 deletion addons/uh60_sfmplus/functions/core/fn_coreUpdate.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,7 @@ hintsilent format ["v0.11
_heli getVariable "vtx_uh60_sfmplus_engFF", //12
_heli getVariable "vtx_uh60_sfmplus_engBaseNG"]; //13
*/
#endif
#endif

//Standby Inst
[_heli, _deltaTime] call vtx_uh60_sfmplus_fnc_standbyInst;
40 changes: 40 additions & 0 deletions addons/uh60_sfmplus/functions/fn_standbyInst.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* ----------------------------------------------------------------------------
Function: vtx_uh60_sfmplus_fnc_standbyInst
Description:
Simulates the Standby Insturment's 30 minuet battery
Parameters:
_heli - The helicopter to get information from [Unit].
_deltaTime - delta time passed from core
Returns:
...
Examples:
...
Author:
Donov C.
---------------------------------------------------------------------------- */

params ["_heli", "_deltaTime"];

private _ACBusState = _vehicle getVariable "vtx_uh60_acft_ACBusState";
private _stbyInstBatt = _vehicle getVariable "vtx_uh60_acft_stbyInstBatt"; //1800 seconds
private _stbyInstSwitchState = _vehicle getVariable "vtx_uh60_acft_stbyInstSwitchState";

if (_ACBusState != "ON" && _stbyInstSwitchState == "ON") then {
if (_stbyInstBatt >= 0) then {
_stbyInstBatt = _stbyInstBatt - _deltaTime;
_vehicle setVariable ["vtx_uh60_acft_stbyInstBatt", _stbyInstBatt, true];
};
};
if (_ACBusState == "ON") then {
if (_stbyInstBatt < 1800) then {
_stbyInstBatt = _stbyInstBatt + _deltaTime;
_vehicle setVariable ["vtx_uh60_acft_stbyInstBatt", _stbyInstBatt, true];
};
};

//systemChat format ["_stbyInstBatt: %1", _stbyInstBatt];

0 comments on commit 35e8544

Please sign in to comment.