forked from KAT-Advanced-Medical/KAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chemical - Add JCAD Chemical Detector (KAT-Advanced-Medical#628)
**When merged this pull request will:** - Adds a custom JCAD Chemical Detector ### IMPORTANT - [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`.
- Loading branch information
1 parent
d63a131
commit 9f8647e
Showing
13 changed files
with
206 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#define KAT_CHEM_GRID_WAbs (((safezoneW / safezoneH) min 0.7)) | ||
#define KAT_CHEM_GRID_HAbs ((((safezoneW / safezoneH) min 1.2) / 1.6)) | ||
#define KAT_CHEM_GRID_W ((((safeZoneW / safeZoneH) min 0.7) / 40)) | ||
#define KAT_CHEM_GRID_H (((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25)) | ||
#define KAT_CHEM_GRID_X ((safeZoneX + (safeZoneW - ((safeZoneW / safeZoneH) min 1.2)) / 11)) | ||
#define KAT_CHEM_GRID_Y ((safeZoneY + (safeZoneH - (((safeZoneW / safeZoneH) min 1.2) / 1.2)) / 0.8)) | ||
|
||
#define KAT_CHEM_POS_H(N) ((N) * KAT_CHEM_GRID_H) | ||
|
||
#define ST_LEFT 0 | ||
#define ST_CENTER 2 | ||
#define ST_RIGHT 1 | ||
|
||
#define pixelW (1 / (getResolution select 2)) | ||
#define pixelH (1 / (getResolution select 3)) | ||
#define pixelScale 0.50 | ||
|
||
// pixel grids macros | ||
#define UI_GRID_W (pixelW * pixelGridBase) | ||
#define UI_GRID_H (pixelH * pixelGridBase) | ||
|
||
#define SAFEZONE_X_RIGHTEDGE ((safeZoneX - 1) * -1) | ||
#define SAFEZONE_Y_LOWEDGE ((safeZoneY - 1) * -1) | ||
|
||
#define FRAME_W(N) ((UI_GRID_W * (N)) * (1.7777 / (getResolution select 4))) | ||
#define FRAME_H(N) ((UI_GRID_H * (N))) | ||
|
||
class RscTitles | ||
{ | ||
class KAT_ChemicalDetector | ||
{ | ||
idd = 18835; | ||
enableSimulation = 1; | ||
movingEnable = 0; | ||
fadeIn=0; | ||
fadeOut=1; | ||
duration = 10e10; | ||
onLoad = "uiNamespace setVariable ['KAT_ChemicalDetector', _this select 0];"; | ||
class controls | ||
{ | ||
class KatChemIcon: RscPicture | ||
{ | ||
idc = 18801; | ||
text = "\x\kat\addons\chemical\UI\kat_chemicalDet.paa"; | ||
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15)); | ||
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(25)); | ||
w = QUOTE(FRAME_W(25)); | ||
h = QUOTE(FRAME_H(25)); | ||
}; | ||
class KatChemTime: RscText | ||
{ | ||
idc = 18804; | ||
style = ST_CENTER; | ||
shadow = 0; | ||
font = "PuristaBold"; | ||
text = "12:00"; //--- ToDo: Localize; | ||
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(7.2)); | ||
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(6)); | ||
w = QUOTE(FRAME_W(7.5)); | ||
h = QUOTE(FRAME_H(4)); | ||
colorBackground[] = {0,0,0,0}; | ||
colorText[] = {0.3,0.3,0.3,0.8}; | ||
sizeEx = QUOTE(FRAME_H(2)); | ||
}; | ||
class KatChemStrength: RscText | ||
{ | ||
idc = 18805; | ||
style = ST_RIGHT; | ||
valign = "middle"; | ||
shadow = 0; | ||
font = "PuristaBold"; | ||
text = "0"; //--- ToDo: Localize; | ||
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(2.1)); | ||
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(7.5)); | ||
w = QUOTE(FRAME_W(5)); | ||
h = QUOTE(FRAME_H(3)); | ||
colorBackground[] = {0,0,0,0}; | ||
colorText[] = {0.3,0.3,0.3,0.8}; | ||
sizeEx = QUOTE(FRAME_H(2.2)); | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Garth 'L-H' de Wet | ||
* Modified: Mazinski | ||
* Removes the KWatch from the screen. | ||
* | ||
* Arguments: | ||
* None | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* call kat_watch_fnc_hideKWatch | ||
* | ||
* Public: No | ||
*/ | ||
GVAR(ChemDetectorActive) = false; | ||
"KAT_ChemicalDetector" cutText ["","PLAIN",0,true]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Garth 'L-H' de Wet | ||
* Modified: Mazinski | ||
* Displays the KWatch on screen. | ||
* | ||
* Arguments: | ||
* 0: unit <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [player] call kat_watch_fnc_showKWatch | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params ["_unit"]; | ||
|
||
"KAT_ChemicalDetector" cutRsc ["KAT_ChemicalDetector", "PLAIN", 0, true]; | ||
|
||
if (isNull (uiNamespace getVariable ["KAT_ChemicalDetector", displayNull])) exitWith {}; | ||
|
||
GVAR(ChemDetectorActive) = true; | ||
|
||
private _display = uiNamespace getVariable ["KAT_ChemicalDetector", displayNull]; | ||
private _background = _display displayCtrl 18801; | ||
private _time = _display displayCtrl 18804; | ||
private _exposure = _display displayCtrl 18805; | ||
|
||
[{ | ||
_this params ["_args", "_pfhID"]; | ||
_args params ["_unit", "_time", "_exposure"]; | ||
|
||
if !(GVAR(ChemDetectorActive)) exitWith { | ||
_pfhID call CBA_fnc_removePerFrameHandler; | ||
}; | ||
|
||
if !(alive _unit) exitWith { | ||
call FUNC(hideChemDetector); | ||
_pfhID call CBA_fnc_removePerFrameHandler; | ||
}; | ||
|
||
if !("KAT_ChemicalDetector" in assignedItems _unit) exitWith { | ||
call FUNC(hideChemDetector); | ||
_pfhID call CBA_fnc_removePerFrameHandler; | ||
}; | ||
|
||
private _hour = floor dayTime; | ||
private _minute = floor ((dayTime - _hour) * 60); | ||
|
||
_time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); | ||
|
||
private _gas = nearestObjects [_unit, ["kat_module_zeus_gas"], 2000]; | ||
|
||
if ((count _gas) > 0) then { | ||
private _distance = _unit distance (_gas select 0); | ||
private _radius = (_gas select 0) getVariable [QGVAR(gas_radius), 0]; | ||
|
||
_exposure ctrlSetText ((linearConversion[0, _radius, _distance, 1, 0, true]) toFixed 2); | ||
} else { | ||
_exposure ctrlSetText str (0); | ||
}; | ||
|
||
}, 1, [ | ||
_unit, | ||
_time, | ||
_exposure | ||
]] call CBA_fnc_addPerFrameHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.