Skip to content

Commit

Permalink
Add Fire component (acemod#8245)
Browse files Browse the repository at this point in the history
* merge fire

* Change required addons. Change getPos to getPosASL. Remove include

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Kyle Mckay <kymckay.dev@gmail.com>

* Update addons/fire/stringtable.xml

Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: Kyle Mckay <kymckay.dev@gmail.com>
  • Loading branch information
3 people authored and AndreasBrostrom committed Dec 3, 2021
1 parent 8f4b3d7 commit 8393b82
Show file tree
Hide file tree
Showing 39 changed files with 796 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/fire/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\fire
20 changes: 20 additions & 0 deletions addons/fire/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class EGVAR(medical_treatment,actions) {
class BasicBandage;
class PatDown: BasicBandage {
displayName = CSTRING(Actions_PatDown);
displayNameProgress = CSTRING(Actions_PerformingPatDown);
icon = "";
category = "advanced";
treatmentLocations = 0;
allowedSelections[] = {"All"};
allowSelfTreatment = 1;
medicRequired = 0;
treatmentTime = 5;
items[] = {};
condition = QFUNC(medical_canPatDown);
callbackSuccess = QFUNC(medical_success);
callbackProgress = QFUNC(medical_progress);
consumeItem = 0;
litter[] = {};
};
};
17 changes: 17 additions & 0 deletions addons/fire/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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));
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
26 changes: 26 additions & 0 deletions addons/fire/CfgSounds.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// weird ass concatenation syntax. PBO Project complains otherwise...
#define CONCAT(a,b) a####b
#define CREATE_SCREAM(no)\
class GVAR(DOUBLES(scream,no)) { \
name = QUOTE(GVAR(CONCAT(scream,no)));\
sound[] = {QUOTE(PATHTOF(CONCAT(sounds\scream,no).ogg)), db + 8, 1};\
titles[] = {}; \
}

class CfgSounds {
CREATE_SCREAM(1);
CREATE_SCREAM(2);
CREATE_SCREAM(3);
CREATE_SCREAM(4);
CREATE_SCREAM(5);
CREATE_SCREAM(6);
CREATE_SCREAM(7);
CREATE_SCREAM(8);
CREATE_SCREAM(9);
CREATE_SCREAM(10);
CREATE_SCREAM(11);
CREATE_SCREAM(12);
CREATE_SCREAM(13);
CREATE_SCREAM(14);
CREATE_SCREAM(15);
};
41 changes: 41 additions & 0 deletions addons/fire/RscTitles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class RscTitles {
class RscPicture;
class GVAR(onFire1) {
idd = -1;
movingEnable = "true";
duration = 0.1;
fadein = 0.15;
fadeout = 0.75;
name = QGVAR(onFire1);
onload = QUOTE(with uiNamespace do {GVAR(onFireIndicator1) = _this select 0});

class controls {
class GVAR(indicator): RscPicture {
idc = -1;
type = 0;
style = 48;
colorBackground[] = {0, 0, 0, 0};
colorText[] = {0.9, 0.9, 0.9, 0.6};
font = "LucidaConsoleB";
sizeEx = 0.023;
x = "SafeZoneX";
y = "SafeZoneY";
w = "SafeZoneW + 0.05";
h = "SafeZoneH + 0.05";
text = PATHTOF(data\overlay_burn_1.paa);
};
};
};

class GVAR(onFire2): GVAR(onFire1) {
idd = -1;
name = QGVAR(onFire2);
onload = QUOTE(with uiNamespace do {GVAR(onFireIndicator2) = _this select 0});

class controls: controls {
class GVAR(indicator): GVAR(indicator) {
text = PATHTOF(data\overlay_burn_2.paa);
};
};
};
};
9 changes: 9 additions & 0 deletions addons/fire/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PREP(burn);
PREP(isBurning);
PREP(isPlant);
PREP(burnIndicator);
PREP(fireManagerPFH);

PREP(medical_progress);
PREP(medical_success);
PREP(medical_canPatDown);
34 changes: 34 additions & 0 deletions addons/fire/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "script_component.hpp"

[QGVAR(burn), FUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
_source say3D _scream;
}] call CBA_fnc_addEventHandler;

["ace_settingsInitialized", {
TRACE_1("settingsInit", GVAR(enabled));
if (!GVAR(enabled)) exitWith {};

if (isServer) then {
[QGVAR(addFireSource), {
params ["_source", "_radius", "_intensity", "_key", ["_condition", { true }], ["_conditionArgs", []]];
private _fireLogic = createVehicle ["ACE_LogicDummy", [0, 0, 0], [], 0, "NONE"];
if (_source isEqualType objNull) then {
_fireLogic attachTo [_source];
} else {
_fireLogic setPosASL _source;
};

[GVAR(fireSources), _key, [_fireLogic, _radius, _intensity, _condition, _conditionArgs]] call CBA_fnc_hashSet;
}] call CBA_fnc_addEventHandler;

[QGVAR(removeFireSource), {
params ["_key"];
[GVAR(fireSources), _key] call CBA_fnc_hashRem;
}] call CBA_fnc_addEventHandler;

[{ _this call FUNC(fireManagerPFH) }, FIRE_MANAGER_PFH_DELAY, []] call CBA_fnc_addPerFrameHandler;
GVAR(fireSources) = [[], nil] call CBA_fnc_hashCreate;
};
}] call CBA_fnc_addEventHandler;
13 changes: 13 additions & 0 deletions addons/fire/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

GVAR(burningPlants) = [];

ADDON = true;
3 changes: 3 additions & 0 deletions addons/fire/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"
20 changes: 20 additions & 0 deletions addons/fire/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_medical_engine"};
author = ECSTRING(common,ACETeam);
authors[] = {"commy2", "Brandon (TCVM)"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp"
Binary file added addons/fire/data/overlay_burn_1.paa
Binary file not shown.
Binary file added addons/fire/data/overlay_burn_2.paa
Binary file not shown.
Loading

0 comments on commit 8393b82

Please sign in to comment.