mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial commit scuba
This commit is contained in:
1
addons/scuba/$PBOPREFIX$
Normal file
1
addons/scuba/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\scuba
|
11
addons/scuba/CfgEventHandlers.hpp
Normal file
11
addons/scuba/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
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));
|
||||
};
|
||||
};
|
3
addons/scuba/XEH_PREP.hpp
Normal file
3
addons/scuba/XEH_PREP.hpp
Normal file
@ -0,0 +1,3 @@
|
||||
PREP(calculateSafePressure);
|
||||
PREP(pfhMain);
|
||||
PREP(updateCompartments);
|
19
addons/scuba/XEH_preInit.sqf
Normal file
19
addons/scuba/XEH_preInit.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
GVAR(inertGasTypes) = ["nitrogen", "helium"];
|
||||
GVAR(inertGasHalftimes) = [
|
||||
[4, 8, 12.5, 18.5, 27, 38.3, 54.3, 77, 109, 146, 187, 239, 305, 390, 498, 635],
|
||||
[1.5, 3.0, 4.7, 7.0, 10.2, 14.5, 20.5, 29.1, 41.1, 55.1, 70.6, 90.2, 115.1, 147.2, 187.9, 239.6]
|
||||
];
|
||||
GVAR(interGasAValues) = GVAR(inertGasHalftimes) apply {_x apply {
|
||||
2 * _x ^ (-1/3)
|
||||
}};
|
||||
GVAR(interGasBValues) = GVAR(inertGasHalftimes) apply {_x apply {
|
||||
1.005 - (_x ^ (-1/2))
|
||||
}};
|
||||
|
||||
ADDON = true;
|
3
addons/scuba/XEH_preStart.sqf
Normal file
3
addons/scuba/XEH_preStart.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
17
addons/scuba/config.cpp
Normal file
17
addons/scuba/config.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
name = COMPONENT_NAME;
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author = ECSTRING(common,ACETeam);
|
||||
authors[] = {"BaerMitUmlaut"};
|
||||
url = ECSTRING(main,URL);
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
23
addons/scuba/functions/fnc_calculateSafePressure.sqf
Normal file
23
addons/scuba/functions/fnc_calculateSafePressure.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Calculates a safe pressure the player can ascend to.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Maximum ambient pressure tolerated <NUMBER>
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _maxPAmbtol = 0;
|
||||
|
||||
{
|
||||
private _a = GVAR(interGasAValues) select (_forEachIndex * 2);
|
||||
private _b = GVAR(interGasBValues) select (_forEachIndex * 2);
|
||||
|
||||
private _pAmbtol = (_x - _a) * _b;
|
||||
_maxPAmbtol = _maxPAmbTol max _pAmbtol;
|
||||
} forEach (ACE_player getVariable QGVAR(compartments));
|
||||
|
||||
_maxPAmbtol
|
19
addons/scuba/functions/fnc_pfhMain.sqf
Normal file
19
addons/scuba/functions/fnc_pfhMain.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Simulates physical effects while diving.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
[] call FUNC(updateCompartments);
|
||||
private _safePressure = [] call FUNC(calculateSafePressure);
|
||||
private _safeDepth = (_safePressure - 1) * 10;
|
||||
|
||||
if (_safeDepth > ((getPosASL ACE_player select 2) * -1)) then {
|
||||
// Damage here
|
||||
};
|
28
addons/scuba/functions/fnc_updateCompartments.sqf
Normal file
28
addons/scuba/functions/fnc_updateCompartments.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Updates the inert gas pressure in each compartment.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private _compartments = ACE_player getVariable [QGVAR(compartments), [0,0,0,0,0,0,0,0]];
|
||||
|
||||
{
|
||||
private _pBegin = _x;
|
||||
private _pGas = ACE_player getVariable QGVAR(inertGasPressure);
|
||||
private _tExposure = 1/60;
|
||||
private _gasType = ACE_player getVariable QGVAR(inertGasType);
|
||||
private _tHalftime = (GVAR(inertGasHalftimes) select (GVAR(inertGasTypes) find _gasType)) select (_forEachIndex * 2);
|
||||
|
||||
// Bühlmann algorithm
|
||||
private _pComp = _pBegin + (_pGas - _pBegin) * (1 - 2 ^ (-1 * _tExposure / _tHalftime));
|
||||
|
||||
_compartments set [_forEachIndex, _pComp];
|
||||
} forEach _compartments;
|
||||
|
||||
ACE_player setVariable [QGVAR(compartments), _compartments];
|
1
addons/scuba/functions/script_component.hpp
Normal file
1
addons/scuba/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\blank\script_component.hpp"
|
18
addons/scuba/script_component.hpp
Normal file
18
addons/scuba/script_component.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
#define COMPONENT scuba
|
||||
#define COMPONENT_BEAUTIFIED Scuba
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define CBA_DEBUG_SYNCHRONOUS
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_SCUBA
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_SCUBA
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_SCUBA
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
Reference in New Issue
Block a user