energy fixes

This commit is contained in:
vbawol 2017-10-03 09:04:30 -05:00
parent 18dd7a5d80
commit bbd958ed52
4 changed files with 24 additions and 10 deletions

View File

@ -22,7 +22,7 @@
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_allowedSnapObjects","_allowedSnapPoints","_cfgBaseBuilding","_class","_create","_currentTarget","_dir2","_direction","_disallowed","_distance","_distanceMod","_distanceNear","_energyCost","_isSnap","_lastCheckTime","_maxHeight","_nearestObject","_nearestObjectRaw","_newObj","_objSlot","_objType","_object","_oemType","_offset","_onContactEH","_pOffset","_playerdistance","_pos2","_prevSnapDistance","_previousDistanceNear","_rejectMove","_return","_simulClassConfig","_snapArrayPara","_snapArrayPerp","_snapDistance","_snapObjects","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPosition","_snapType","_textureSlot","_up2","_vel2","_velocityTransformation","_worldspace"];
private ["_allowedSnapObjects","_allowedSnapPoints","_cfgBaseBuilding","_class","_create","_currentTarget","_dir2","_direction","_disallowed","_distance","_distanceMod","_distanceNear","_energyCost","_isSnap","_lastCheckTime","_maxHeight","_nearestObject","_nearestObjectRaw","_newObj","_objSlot","_objType","_object","_oemType","_offset","_onContactEH","_pOffset","_playerEnergy","_playerEnergyKeyFinal","_playerdistance","_pos2","_prevSnapDistance","_previousDistanceNear","_rejectMove","_return","_simulClassConfig","_snapArrayPara","_snapArrayPerp","_snapDistance","_snapObjects","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPosition","_snapType","_textureSlot","_up2","_vel2","_velocityTransformation","_worldspace"];
//[[[end]]]
if !(isNil "EPOCH_simulSwap_Lock") exitWith{};
@ -34,7 +34,11 @@ _objType = typeOf _object;
_isSnap = false;
if (EPOCH_playerEnergy <= 0) exitWith {
_playerEnergyKeyFinal = "EPOCH_playerEnergy";
if !(isNil "_playerEnergyKey") then {_playerEnergyKeyFinal = _playerEnergyKey};
_playerEnergy = missionNamespace getVariable [_playerEnergyKeyFinal,[]];
if (_playerEnergy <= 0) exitWith {
["Need Energy", 5] call Epoch_message;
};
if !(_object call EPOCH_isBuildAllowed) exitWith{};
@ -106,7 +110,8 @@ if (isText(_simulClassConfig)) then {
EPOCH_Z_OFFSET = _offset select 2;
_lastCheckTime = diag_tickTime;
while {EPOCH_target == _currentTarget} do {
if (EPOCH_playerEnergy <= 0) exitWith { EPOCH_target = objNull; };
_playerEnergy = missionNamespace getVariable [_playerEnergyKeyFinal,[]];
if (_playerEnergy <= 0) exitWith { EPOCH_target = objNull; };
_rejectMove = false;
if ((diag_tickTime - _lastCheckTime) > 10) then {
_lastCheckTime = diag_tickTime;
@ -226,7 +231,7 @@ if (isText(_simulClassConfig)) then {
};
};
};
EPOCH_playerEnergy = (EPOCH_playerEnergy - _energyCost) max 0;
[_playerEnergyKeyFinal, -_energyCost, 2500 , 0] call EPOCH_fnc_setVariableLimited;
uiSleep 0.1;
};
_currentTarget removeEventHandler["EpeContactStart", _onContactEH];

View File

@ -23,7 +23,7 @@
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_AnchorPos","_EPOCH_1","_EPOCH_2","_MoveObject","_Snapdirection","_allowedSnapObjects","_allowedSnapPoints","_arr_snapPoints","_baselineSnapPos","_cfgBaseBuilding","_class","_currentOffSet","_currentPos","_currentTarget","_currentTargetAttachedTo","_dir2","_direction","_distance","_energyCost","_helper","_ins","_isSnap","_lastCheckTime","_maxHeight","_maxSnapDistance","_nearestObject","_nearestObjects","_newDirAndUp","_numberOfContacts","_objSlot","_objType","_offSet","_offsetZPos","_pOffset","_pos1_snap","_pos2","_pos2ATL","_pos2_snap","_pos_snapObj","_rejectMove","_simulClass","_snapChecks","_snapConfig","_snapDistance","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPos1","_snapPosition","_snapType","_snapped","_stabilityCheck","_worldspace","_snapMemoryPoint","_vectorDir","_vectorUp","_tempClass","_newDir"];
private ["_AnchorPos","_EPOCH_1","_EPOCH_2","_MoveObject","_Snapdirection","_allowedSnapObjects","_allowedSnapPoints","_arr_snapPoints","_baselineSnapPos","_cfgBaseBuilding","_class","_currentOffSet","_currentPos","_currentTarget","_currentTargetAttachedTo","_dir2","_direction","_distance","_energyCost","_helper","_ins","_isSnap","_lastCheckTime","_maxHeight","_maxSnapDistance","_nearestObject","_nearestObjects","_newDir","_newDirAndUp","_numberOfContacts","_objSlot","_objType","_offSet","_offsetZPos","_pOffset","_playerEnergy","_playerEnergyKeyFinal","_pos1_snap","_pos2","_pos2ATL","_pos2_snap","_pos_snapObj","_rejectMove","_simulClass","_snapChecks","_snapConfig","_snapDistance","_snapMemoryPoint","_snapPointsPara","_snapPointsPerp","_snapPos","_snapPos1","_snapPosition","_snapType","_snapped","_stabilityCheck","_tempClass","_tiltFB","_tiltLR","_vectorDir","_vectorUp","_worldspace"];
//[[[end]]]
if !(isNil "EPOCH_simulSwap_Lock") exitWith{};
@ -37,7 +37,11 @@ if (isNull _object) exitWith{ EPOCH_target = objNull; };
// exit if item is not given
if (_item == "") exitWith{ EPOCH_target = objNull; };
if (EPOCH_playerEnergy <= 0) exitWith{
_playerEnergyKeyFinal = "EPOCH_playerEnergy";
if !(isNil "_playerEnergyKey") then {_playerEnergyKeyFinal = _playerEnergyKey};
_playerEnergy = missionNamespace getVariable [_playerEnergyKeyFinal,[]];
if (_playerEnergy <= 0) exitWith{
["Need Energy", 5] call Epoch_message;
};
@ -172,7 +176,7 @@ if (_class != "") then {
_EPOCH_1 = diag_tickTime;
if !(isNull EPOCH_target) then {
_nearestObjects = nearestObjects[EPOCH_target, _allowedSnapObjects, 12];
["EPOCH_playerEnergy", -_energyCost, 5000 , 0] call EPOCH_fnc_setVariableLimited;
[_playerEnergyKeyFinal, -_energyCost, 2500 , 0] call EPOCH_fnc_setVariableLimited;
};
};
if !(_currentTargetAttachedTo isequalto EPOCH_target_attachedTo) then {

View File

@ -26,12 +26,14 @@
BOOL
*/
//[[[cog import generate_private_arrays ]]]
private ["_adj","_currentPos","_handled","_playerStaminaKeyFinal","_step"];
private ["_adj","_currentPos","_handled","_playerEnergy","_playerEnergyKeyFinal","_playerStaminaKeyFinal","_step"];
//[[[end]]]
params ["_display","_dikCode","_shift","_ctrl","_alt"];
_playerStaminaKeyFinal = "EPOCH_playerStamina";
_playerEnergyKeyFinal = "EPOCH_playerEnergy";
if !(isNil "_playerStaminaKey") then {_playerStaminaKeyFinal = _playerStaminaKey};
if !(isNil "_playerEnergyKey") then {_playerEnergyKeyFinal = _playerEnergyKey};
_handled = false;
@ -253,7 +255,8 @@ if (_dikCode in (actionKeys "TacticalView")) then {
_handled = true;
};
if (_dikCode in (actionKeys "NightVision")) then {
if (EPOCH_playerEnergy == 0) then {
_playerEnergy = missionNamespace getVariable [_playerEnergyKeyFinal,[]];
if (_playerEnergy == 0) then {
["Night Vision Goggles: Need Energy", 5] call Epoch_message;
_handled = true;
};

View File

@ -57,7 +57,9 @@ class CfgClientFunctions
class countdown {};
class fnc_SelectTargetBuild {};
class isBuildAllowed {};
class simulSwap {};
class simulSwap {
customHeader = 1;
};
class staticMove {
customHeader = 1;
};