Skip to content

Commit 7d982f9

Browse files
authored
Merge pull request #182 from Freddo3000/v0.7.0
v0.7.0
2 parents 7b551a2 + 83a590e commit 7d982f9

File tree

370 files changed

+9566
-4804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

370 files changed

+9566
-4804
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* text=auto
2+
*.png binary
3+
*.jpg binary
4+
*.paa binary

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
DUWS-R.iml
55
localDevDeploy.properties
6-
DUWS-R_dev.Altis.pbo
6+
DUWS-R_dev.Altis.pbo

source/AIS/AIS_SETUP.sqf

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// by Psychobastard
2+
// AIS REVIVE Setup-File
3+
4+
//__________________________________________________________________________________________________________________________________________________________________
5+
// v v v v v v v v v v v v --- Main Settings --- v v v v v v v v v v v v
6+
7+
AIS_REVIVE_INIT_UNITS = "allPlayers"; // Auto-Init a group of units: "allPlayers" , "allPlayables" , "allUnits", "allUnitsBLUFOR", "allUnitsOPFOR", "allUnitsINDFOR", "allUnitsCIVILIAN"
8+
// Warning: I didn't recomment to use "allUnits" if you play with a lot of AI units! AIS is mainly created for players and/or their AI group.
9+
AIS_MEDICAL_EDUCATION = 1; // Who can revive an unconscious unit? 0 == Everybody, 1 == Everybody with a First Aid Kit or Medkit, 2 == Only Medics (this affects both, AI and players!).
10+
AIS_REVIVE_GUARANTY = false; // If true you will fall everytime in uncoscious mode, regardless how strong the impact of damage was.
11+
AIS_MEDEVAC_STATIONS = [];// Add one or more objects and a radius to activate the medevac feature. If enabled revive is only at this place(s) possible. Empty array means feature is disabled.
12+
// Syntax: f.e.: [ [myMedevacVehicle, 15], [myMedicTent, 10] ] --> make sure the variable name is avalible at gamestart. Otherwise call it later in a function.
13+
14+
15+
//__________________________________________________________________________________________________________________________________________________________________
16+
// v v v v v v v v v v v v --- Optional Settings --- v v v v v v v v v v v v
17+
18+
AIS_DAMAGE_TOLLERANCE_FACTOR = 1; // A higher value means more damage tolerance. 1 is Vanilla. 0.8 mean all damage will reduce to 80% of Vanilla.
19+
AIS_BLEEDOUT_TIME = 300; // Basic life time in seconds until the unit bleed out and die.. The real life time depends on the real damage of the unit. (can be less or more time from the basic value)
20+
AIS_REVIVETIME = 30; // Basic revive time in seconds. The real revive time depends on the real damage of the unit. (can be less or more time from the basic value)
21+
AIS_STABILIZETIME = 20; // Basic stabilize time in seconds to stop the bleeding of a unconscious unit. The real revive time depends on the real damage of the unit. (can be less or more time from the basic value)
22+
AIS_REVIVE_HEAL = false; // If set to true the injured unit get completely healed after the revive. (casual gameplay without a medic)
23+
AIS_TOGGLE_RADIO = true; // If set to true, unconscious players cannot use his TFAR or ACRE radios.
24+
AIS_NO_CHAT = true; // If set to true, a injured player cannot use text chat during he is uncoscious.
25+
AIS_AI_HELP_RADIUS = 50; // Number, Radius in metres. Units in this radius will help to revive if no group member is able to revive. Max value is 200 metres.
26+
AIS_DISABLE_RESPAWN_BUTTON = 30; // Time in seconds while the respawn button is disabled (Esc Menu). Set to 0 to enable the respawn button everytime.
27+
AIS_DISABLE_FURTHER_DAMAGE = false; // If set to true, an unconcious unit wont become further damage til death. If set to false, an unconcious unit can also die before bleedout timer is over. (f.e. trough near explosions)
28+
29+
30+
//__________________________________________________________________________________________________________________________________________________________________
31+
// v v v v v v v v v v v v --- Visual Settings --- v v v v v v v v v v v v
32+
33+
AIS_SHOW_UNC_MARKERS = true; // If set to true, a marker will show injured units on the map.
34+
AIS_SHOW_UNC_MESSAGE_TO = "Group"; // "None", "Side", "Group" --> who read the message about wounded units.
35+
AIS_SHOW_UNC_3D_MARKERS = true; // If set to true, an in-game visible 3D-icon shows you the position of injured units (within a range of 20 metres and 35 metres for medics).
36+
AIS_IMPACT_EFFECTS = true; // Set to true to enable impact effects. (simple simluation of supressing effects)
37+
AIS_SHOW_COUNTDOWN = true; // If set to true, an unconscious unit will be able to see the bleed out timer.
38+
AIS_SHOW_DIARYINFO = true; // If set to true, a diary entry with some informations about the AIS (Credits, features, How to) is added.

source/AIS/Core/cfgFunctions.hpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
class AIS_Core
2+
{
3+
class AIS_Core
4+
{
5+
file = "AIS\Core";
6+
class preInit { preInit = 1; };
7+
class postInit { postInit = 1; };
8+
class addAction;
9+
class aisInitHost;
10+
class aisInitPlayer;
11+
class bindEventHandler;
12+
class createLocalMarker;
13+
class dynamicText;
14+
class initEvents;
15+
class inRange;
16+
class interaction_Loop;
17+
class isPlayable;
18+
class onEachFrame;
19+
class onNextFrame;
20+
class progress_ShowBar;
21+
class progress_ShowBarText;
22+
class removeonEachFrame;
23+
class setPosAGLS;
24+
class setVariables;
25+
class triggerEvent;
26+
class waitUntilAndExecute;
27+
class handleDisconnect;
28+
class resetOnTeamSwitch;
29+
};
30+
};
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Author: NetFusion
3+
Description:
4+
Continuously checks whether an action should be added to the cursorTarget.
5+
Parameter(s):
6+
-
7+
Remarks:
8+
* Should only be called once per mission.
9+
10+
Returns:
11+
-
12+
Example:
13+
-
14+
*/
15+
16+
AIS_Core_lastCursorTarget = objNull;
17+
18+
[{
19+
_cursorTarget = cursorTarget;
20+
if (_cursorTarget isEqualTo AIS_Core_lastCursorTarget || {player distance _cursorTarget > 15}) exitWith {}; // psycho: prevent cycling trough cursorTargets more than 15m away (engine limitation is 15m for every action)
21+
AIS_Core_lastCursorTarget = _cursorTarget;
22+
23+
private _objActions = _cursorTarget getVariable ["AIS_Core_actionStorage", []];
24+
{
25+
_x params ["_onObject", "_text", "_distance", "_condition", "_callback", "_args", "_formated"];
26+
27+
if (!(_x in _objActions)) then {
28+
if ((_onObject isEqualType "" && {_cursorTarget isKindOf _onObject}) || (_onObject isEqualType objNull && {_cursorTarget isEqualTo _onObject})) then {
29+
private _action = _cursorTarget addAction [_text, _callback, _args, 1.5, true, true, "", _condition, _distance];
30+
_objActions pushBack _x;
31+
32+
if (_formated != "") then {
33+
_cursorTarget setUserActionText [
34+
_action,
35+
_text,
36+
format [_formated, _text],
37+
""
38+
];
39+
};
40+
};
41+
};
42+
nil
43+
} count (missionNamespace getVariable ["AIS_Core_actionStorage", []]);
44+
45+
_cursorTarget setVariable ["AIS_Core_actionStorage", _objActions]; //@todo maybe init array and remove this line - this requires module dependencies
46+
}] call AIS_Core_fnc_onEachFrame;

source/AIS/Core/fn_addAction.sqf

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
Author: [C-L-F] NetFusion
3+
Edited: Psychobastard
4+
5+
Description:
6+
Add an action to an object or type(s) of object(s).
7+
8+
Parameter(s):
9+
0: STRING - the title of the action.
10+
1: OBJECT, ARRAY, STRING - the object (type) which the action should be added to.
11+
2: NUMBER - the distance in which the action is visible.
12+
3: STRING - the condition which is evaluated on every frame (if play is in range) to determine whether the action is visible.
13+
4: CODE - the callback which gets called when the action is activated.
14+
5: ARRAY - (optional) the arguments which get passed to the callback.
15+
16+
Remarks:
17+
* '_target' is the object inside the condition string.
18+
* [object, caller, ID, arguments] is _this in the callback
19+
20+
Returns:
21+
-
22+
23+
Example:
24+
["Hint Hello!", player, 0, "true", { hint format ["Hello %1", name player]; }] call AIS_Core_fnc_addAction;
25+
["Hint Hello!", "Man", 3, "true", { hint format ["Hello %1", name (_this select 0)]; }] call AIS_Core_fnc_addAction;
26+
*/
27+
28+
params ["_text", "_onObject", "_distance", "_condition", "_callback", ["_args", []], ["_formated", "", [""]]];
29+
30+
31+
if (_distance > 0) then {
32+
_condition = format ["([cursorTarget, %1] call AIS_Core_fnc_inRange) && {%2}", _distance, _condition];
33+
};
34+
35+
36+
if (_onObject isEqualType objNull && {_onObject isEqualTo AIS_Core_realPlayer}) exitWith {
37+
private _action = _onObject addAction [_text, _callback, _args, 1.5, false, true, "", _condition, _distance];
38+
39+
if (_formated != "") then {
40+
_onObject setUserActionText [
41+
_action,
42+
_text,
43+
format [_formated, _text],
44+
""
45+
];
46+
};
47+
48+
[
49+
"AIS_playerChanged", {
50+
params ["_data", "_params"];
51+
_data params ["_currentPlayer", "_oldPlayer"];
52+
_params params ["_text", "_callback", "_distance", ["_args", []], "_condition", ["_formated", "", [""]]];
53+
54+
private _action = _currentPlayer addAction [_text, _callback, _args, 1.5, false, true, "", _condition, _distance];
55+
56+
if (_formated != "") then {
57+
_currentPlayer setUserActionText [
58+
_action,
59+
_text,
60+
format [_formated, _text],
61+
""
62+
];
63+
};
64+
},
65+
[_text, _callback, _distance, _args, _condition, _formated]
66+
] call AIS_Core_fnc_bindEventHandler;
67+
68+
};
69+
70+
if (!(_onObject isEqualType [])) then {
71+
_onObject = [_onObject];
72+
};
73+
74+
private _actionStorage = missionNamespace getVariable ["AIS_Core_actionStorage", []];
75+
{
76+
_actionStorage pushBack [_x, _text, _distance, _condition, _callback, _args, _formated];
77+
nil
78+
} count _onObject;
79+
missionNamespace setVariable ["AIS_Core_actionStorage", _actionStorage]; //@todo maybe init array and remove this line
80+
81+
_action

source/AIS/Core/fn_aisInitHost.sqf

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// this script run on the server/host for every unit which should be added to the revive system. It run's once by starting the mission.
2+
params ["_unit"];
3+
if (_unit getVariable ["AIS_noReviveInit", false]) exitWith {};
4+
5+
if (!isNil {_unit getVariable "ais_aisInit"}) then {
6+
_unit removeAllEventHandlers "Killed";
7+
_unit removeAllEventHandlers "Respawn";
8+
_unit removeAllEventHandlers "HandleHeal";
9+
[_unit] call AIS_Core_fnc_setVariables;
10+
};
11+
_unit setVariable ["ais_aisInit", true];
12+
13+
14+
// set damage EH only for local and non-player units!
15+
// last check if unit is local
16+
if (local _unit && !(isPlayer _unit)) then {
17+
[_unit] spawn {
18+
_unit = _this select 0;
19+
20+
waitUntil {!isNil {_unit getVariable "BIS_fnc_feedback_hitArrayHandler"} || {time > 0}};
21+
_unit removeAllEventHandlers "handleDamage";
22+
["%1 --- add damageEH to AI %2", diag_ticktime, _unit] call BIS_fnc_logFormat;
23+
ais_hdEH = _unit addEventHandler ["HandleDamage", {_this call AIS_Damage_fnc_handleDamage}];
24+
25+
ais_hkEH = _unit addEventHandler ["Killed", {_this call AIS_System_fnc_killed}];
26+
27+
if ([_unit] call AIS_Core_fnc_isPlayable) then {
28+
ais_hrEH = _unit addEventHandler ["Respawn", {_this call AIS_System_fnc_respawn}];
29+
};
30+
_unit removeAllEventHandlers "HandleHeal";
31+
ais_hhEH = _unit addEventHandler ["HandleHeal", {_this call AIS_System_fnc_handleHeal}];
32+
};
33+
};

source/AIS/Core/fn_aisInitPlayer.sqf

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// this script run only by the player!
2+
private _player = _this;
3+
if (_player != player) exitWith {["%1 --- exit aisInitPlayer cause it's not the local player itself %2", diag_ticktime, _player] call BIS_fnc_logFormat};
4+
if (isClass (configFile >> "CfgPatches" >> "ace_medical")) exitWith {["AIS: AIS shutdown itself cause ACE medical system is also running. ACE medical and AIS cant work at the same time."] call BIS_fnc_logFormat};
5+
6+
if (_player getVariable ["AIS_noReviveInit", false]) exitWith {};
7+
8+
// set damage EH local to the player
9+
if (local _player) then {
10+
[_player] call AIS_Core_fnc_setVariables;
11+
12+
[_player] spawn {
13+
_player = _this select 0;
14+
waitUntil {!isNil {_player getVariable "BIS_fnc_feedback_hitArrayHandler"} || {time > 0}};
15+
_player removeAllEventHandlers "handleDamage"; // make sure nothing else working byside
16+
//["%1 --- add damageEH to player %2", diag_ticktime, _player] call BIS_fnc_logFormat;
17+
_player addEventHandler ["HandleDamage", {_this call AIS_Damage_fnc_handleDamage}];
18+
19+
_player addEventHandler ["Killed", {_this call AIS_System_fnc_killed}];
20+
21+
_player addEventHandler ["Respawn", {_this call AIS_System_fnc_respawn}];
22+
23+
_player addEventHandler ["HandleHeal", {_this call AIS_System_fnc_handleHeal}];
24+
25+
waitUntil {!isNull (findDisplay 46)};
26+
(findDisplay 46) displayAddEventHandler ["KeyDown", {_this call AIS_System_fnc_keyHandler}];
27+
};
28+
};
29+
30+
// AI is local to the group leader on dedicated environment
31+
if (!isServer && (count (units group player) > 1)) then {
32+
if (leader group _player isEqualTo _player) then {
33+
34+
[_player] spawn {
35+
_player = _this select 0;
36+
_groupWithoutPlayers = ((units group _player) - (allUnits select {isPlayer _x}));
37+
{[_x] call AIS_Core_fnc_setVariables; true} count _groupWithoutPlayers;
38+
39+
waitUntil {!isNil {_player getVariable "BIS_fnc_feedback_hitArrayHandler"} || {time > 0}};
40+
{
41+
_x removeAllEventHandlers "handleDamage";
42+
//["%1 --- add damageEH to groupmember of %3's group: %2", diag_ticktime, _x, _player] call BIS_fnc_logFormat;
43+
_x addEventHandler ["HandleDamage", {_this call AIS_Damage_fnc_handleDamage}];
44+
45+
_x removeAllEventHandlers "Killed";
46+
_x addEventHandler ["Killed", {_this call AIS_System_fnc_killed}];
47+
48+
_x removeAllEventHandlers "Respawn";
49+
if ([_x] call AIS_Core_fnc_isPlayable) then {
50+
_x addEventHandler ["Respawn", {_this call AIS_System_fnc_respawn}];
51+
};
52+
53+
_x addEventHandler ["HandleHeal", {_this call AIS_System_fnc_handleHeal}];
54+
55+
true
56+
} count _groupWithoutPlayers;
57+
};
58+
59+
};
60+
};
61+
62+
63+
// add handleHeal local to the player for every unit and set the correct anim-state (local)
64+
private _allPlayers = allUnits select {isPlayer _x}; // doesn't use allPlayers at this point, cause it can be delayed in self-hosted env.
65+
private _ais_revive_units = toLower AIS_REVIVE_INIT_UNITS;
66+
private _init_units = call {
67+
if (_ais_revive_units isEqualTo "allunits") exitWith {allUnits};
68+
if (_ais_revive_units isEqualTo "allplayers") exitWith {_allPlayers}; // at this point only as a dummy. Cause everytime every player will auto-init, regardless what the setup will say.
69+
if (_ais_revive_units isEqualTo "allplayables") exitWith {if (isMultiplayer) then {playableUnits} else {switchableUnits}};
70+
if (_ais_revive_units isEqualTo "allunitsblufor") exitWith {allUnits select {(side _x) isEqualTo blufor}};
71+
if (_ais_revive_units isEqualTo "allunitsopfor") exitWith {allUnits select {(side _x) isEqualTo opfor}};
72+
if (_ais_revive_units isEqualTo "allunitsindfor") exitWith {allUnits select {(side _x) isEqualTo resistance}};
73+
if (_ais_revive_units isEqualTo "allunitscivilian") exitWith {allUnits select {(side _x) isEqualTo civilian}};
74+
diag_log "AIS ERROR: Issue in Setup-File found! Parameter AIS_REVIVE_UNITS wrong defined."; []
75+
};
76+
{
77+
_x removeAllEventHandlers "HandleHeal";
78+
_x addEventHandler ["HandleHeal", {_this call AIS_System_fnc_handleHeal}];
79+
80+
if (_x getVariable ["ais_unconscious", false]) then {
81+
if (!isNull(_x getVariable ["ais_DragDrop_Player", objNull])) then {
82+
_x switchMove "AinjPpneMrunSnonWnonDb";
83+
} else {
84+
_x playActionNow "agonyStart";
85+
};
86+
};
87+
88+
true
89+
} count _init_units;
90+
91+
92+
ais_medequip_array = [];
93+
if (AIS_TOGGLE_RADIO) then {
94+
[true] call AIS_Effects_fnc_toggleRadio;
95+
};
96+
97+
// JIP in a unconscious AI... and avoid cheating by left in lobby...
98+
if (_player getVariable ["ais_unconscious", false]) then {
99+
[{[(_this select 0)] call AIS_System_fnc_setUnconscious}, [_player]] call AIS_Core_fnc_onNextFrame;
100+
};
101+
102+
inGameUISetEventHandler ["Action", "_this call AIS_System_fnc_overrideHealAction"];
103+
104+
105+
_respawnDelay = getMissionConfigValue ["respawnDelay", 0];

0 commit comments

Comments
 (0)