Merge branch 'master' of github.com:KoffeinFlummi/ACE3 into removeFrisk

Conflicts:
	addons/captives/CfgVehicles.hpp
This commit is contained in:
esteldunedain 2015-06-13 15:19:52 -03:00
commit d53ee1cf85
25 changed files with 280 additions and 143 deletions

View File

@ -56,6 +56,13 @@ class CfgVehicles {
priority = 2.2; priority = 2.2;
hotkey = "L"; hotkey = "L";
}; };
class GVAR(UnloadCaptive) {
displayName = CSTRING(UnloadCaptive);
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive));
priority = 1.2;
};
}; };
}; };
@ -101,13 +108,6 @@ class CfgVehicles {
exceptions[] = {"isNotEscorting"}; \ exceptions[] = {"isNotEscorting"}; \
priority = 1.2; \ priority = 1.2; \
}; \ }; \
class GVAR(UnloadCaptive) { \
displayName = CSTRING(UnloadCaptive); \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
priority = 1.2; \
}; \
}; \ }; \
}; };

View File

@ -23,4 +23,6 @@ PARAMS_2(_unit,_target);
(_target getVariable [QGVAR(isHandcuffed), false]) && (_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} && {isNull (attachedTo _target)} &&
{alive _target} && {alive _target} &&
{!(_target getVariable ["ACE_isUnconscious", false])} {!(_target getVariable ["ACE_isUnconscious", false])} &&
{(vehicle _unit) == _unit} &&
{(vehicle _target) == _target}

View File

@ -3,15 +3,14 @@
* Check if the unit can unload a captive from the vehicle. * Check if the unit can unload a captive from the vehicle.
* *
* Arguments: * Arguments:
* 0: Unit that wants to unload a captive <OBJECT> * 0: Unit that wants to unload a captive (player) <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT> * 1: A captive loaded in a vehicle <OBJECT>
* 2: Vehicle to unload a captive from <OBJECT>
* *
* Return Value: * Return Value:
* The return value <BOOL> * The return value <BOOL>
* *
* Example: * Example:
* [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive; * [player, bob] call ACE_captives_fnc_canUnloadCaptive;
* *
* Public: No * Public: No
*/ */
@ -19,10 +18,6 @@
private ["_cargo"]; private ["_cargo"];
PARAMS_2(_unit,_vehicle); PARAMS_2(_player,_unit);
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. ((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
count _cargo > 0

View File

@ -4,29 +4,18 @@
* *
* Arguments: * Arguments:
* 0: Unit that wants to unload a captive <OBJECT> * 0: Unit that wants to unload a captive <OBJECT>
* 1: Vehicle to unload a captive from. <BOOL> * 1: A captive loaded in a vehicle <OBJECT>
* *
* Return Value: * Return Value:
* Nothing * Nothing
* *
* Example: * Example:
* [bob, car] call ACE_captives_fnc_doUnloadCaptive * [bob, prisoner] call ACE_captives_fnc_doUnloadCaptive
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_2(_unit,_vehicle); PARAMS_2(_unit,_target);
private ["_cargo", "_target"]; ["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
if ((count _cargo) > 0) then {
_target = _cargo select 0;
["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
} else {
ERROR("No captive to unload");
};

View File

@ -3,6 +3,7 @@ class CfgAmmo {
class FlareBase: FlareCore { class FlareBase: FlareCore {
intensity = 20000; intensity = 20000;
flareSize = 12; flareSize = 12;
timeToLive = 60;
}; };
class F_40mm_White: FlareBase { class F_40mm_White: FlareBase {
intensity = 40000; intensity = 40000;
@ -10,7 +11,7 @@ class CfgAmmo {
}; };
class F_20mm_White: FlareBase { class F_20mm_White: FlareBase {
intensity = 20000; intensity = 20000;
flareSize = 12; flareSize = 6;
}; };
class F_Signal_Green: FlareBase { class F_Signal_Green: FlareBase {
intensity = 20000; intensity = 20000;
@ -19,6 +20,7 @@ class CfgAmmo {
class Flare_82mm_AMOS_White: FlareCore { class Flare_82mm_AMOS_White: FlareCore {
intensity = 80000; intensity = 80000;
flareSize = 12; flareSize = 12;
timeToLive = 60;
}; };
class F_20mm_Red: F_20mm_White {}; class F_20mm_Red: F_20mm_White {};

View File

@ -11,4 +11,12 @@ class CfgSounds {
sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7}; sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7};
titles[] = {}; titles[] = {};
}; };
class ACE_Combat_Deafness {
sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1};
titles[] = {};
};
class ACE_Ring_Backblast {
sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1};
titles[] = {};
};
}; };

View File

@ -6,6 +6,13 @@ GVAR(currentDeafness) = 0;
GVAR(newStrength) = 0; GVAR(newStrength) = 0;
GVAR(playerVehAttenuation) = 1; GVAR(playerVehAttenuation) = 1;
GVAR(beep) = false;
GVAR(beep2) = false;
GVAR(time2) = 0;
GVAR(time3) = 0;
GVAR(time4) = 0;
GVAR(earRingingPFH) = -1;
// Spawn volume updating process // Spawn volume updating process
[FUNC(updateVolume), 0.1, [] ] call CBA_fnc_addPerFrameHandler; [FUNC(updateVolume), 0.1, [] ] call CBA_fnc_addPerFrameHandler;
@ -15,6 +22,14 @@ GVAR(playerVehAttenuation) = 1;
//Reset deafness on respawn (or remote control player switch) //Reset deafness on respawn (or remote control player switch)
["playerChanged", { ["playerChanged", {
ACE_player setVariable [QGVAR(dv), 0];
ACE_player setVariable [QGVAR(prior), 0];
ACE_player setvariable [QGVAR(deaf), false];
GVAR(beep) = false;
GVAR(beep2) = false;
GVAR(time2) = 0;
GVAR(time3) = 0;
GVAR(time4) = 0;
GVAR(currentDeafness) = 0; GVAR(currentDeafness) = 0;
GVAR(newStrength) = 0; GVAR(newStrength) = 0;
}] call EFUNC(common,addEventhandler); }] call EFUNC(common,addEventhandler);

View File

@ -6,7 +6,7 @@ class CfgPatches {
weapons[] = {"ACE_EarPlugs"}; weapons[] = {"ACE_EarPlugs"};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"}; requiredAddons[] = {"ace_interaction"};
author[] = {"KoffeinFlummi", "esteldunedain", "HopeJ", "commy2"}; author[] = {"KoffeinFlummi", "esteldunedain", "HopeJ", "commy2", "Rocko", "Rommel", "Ruthberg"};
authorUrl = "https://github.com/KoffeinFlummi/"; authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG; VERSION_CONFIG;
}; };

View File

@ -1,56 +1,92 @@
/* /*
* Author: KoffeinFlummi, commy2 * Author: KoffeinFlummi, commy2, Rocko, Rommel, Ruthberg
* Creates ear ringing effect with set strength. * Ear ringing PFH
* *
* Arguments: * Arguments:
* 0: Unit (player) <OBJECT> * 0: unit <OBJECT>
* 1: strength of ear ringing (Number between 0 and 1) <NUMBER> * 1: strength of ear ringing (Number between 0 and 1) <NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [clientExplosionEvent] call ace_hearing_fnc_earRinging * [_unit, _strength] call ace_hearing_fnc_earRinging
* *
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_strength"]; if (GVAR(DisableEarRinging)) exitWith {};
_unit = _this select 0; PARAMS_2(_unit,_strength);
_strength = _this select 1;
if (isNull _unit) exitWith {};
if (_strength < 0.05) exitWith {};
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
_strength = _strength / 4; _strength = _strength / 4;
}; };
GVAR(newStrength) = GVAR(newStrength) max _strength; _unit setVariable [QGVAR(dv), (_unit getVariable [QGVAR(dv), 0]) + _strength];
if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; if (GVAR(earRingingPFH) != -1) exitWith {};
GVAR(earRingingPFH) = [{
EXPLODE_1_PVT(_this select 0,_unit);
private ["_prior"];
_prior = (_unit getvariable [QGVAR(dv), 0]) min 20;
if (!alive _unit || _prior <= 0) exitWith {
_unit setVariable [QGVAR(dv), 0];
_unit setVariable [QGVAR(prior), 0];
GVAR(beep) = false;
GVAR(beep2) = false;
GVAR(time2) = 0;
GVAR(time3) = 0;
GVAR(time4) = 0;
GVAR(earRingingPFH) = -1;
[_this select 1] call cba_fnc_removePerFrameHandler;
};
if (((_unit getvariable [QGVAR(dv), 0]) - (_unit getvariable [QGVAR(prior), 0])) > 2) then {
if (ACE_time > GVAR(time3)) then {
GVAR(beep2) = false;
};
if (!GVAR(beep2)) then {
playSound "ACE_Combat_Deafness";
GVAR(beep2) = true;
GVAR(time3) = ACE_time + 5;
};
};
_unit setvariable [QGVAR(prior), _prior];
GVAR(volume) = (1 - (_prior / 20)) max 0;
if (_prior > 19.75) then {
_unit setvariable [QGVAR(deaf), true];
} else {
_unit setvariable [QGVAR(deaf), false];
};
if ((_unit getvariable [QGVAR(deaf), false]) && {ACE_time > GVAR(time4)}) then {
playSound "ACE_Combat_Deafness";
GVAR(beep2) = true;
GVAR(time3) = ACE_time + 10;
GVAR(time4) = ACE_time + 30;
};
if (GVAR(DisableEarRinging)) exitWith {}; // Hearing takes longer to return to normal after it hits rock bottom
_unit setvariable [QGVAR(dv), _prior - (0.5 * (GVAR(volume) max 0.1))];
if (_strength > 0.75) exitWith {
playSound "ACE_EarRinging_Heavy"; if (_prior > 10) then {
GVAR(isEarRingingPlaying) = true; //check if the ringing is already being played
[ if (ACE_time > GVAR(time2)) then {
{GVAR(isEarRingingPlaying) = false;}, [], 7.0, 0.25 GVAR(beep) = false;
] call EFUNC(common,waitAndExecute); };
}; if (!GVAR(beep)) then {
if (_strength > 0.5) exitWith { playSound "ACE_Ring_Backblast";
playSound "ACE_EarRinging_Medium"; GVAR(time2) = ACE_time + 22;
GVAR(isEarRingingPlaying) = true; GVAR(beep) = true;
[ };
{GVAR(isEarRingingPlaying) = false;}, [], 5.0, 0.25 };
] call EFUNC(common,waitAndExecute); }, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
};
if (_strength > 0.2) exitWith {
playSound "ACE_EarRinging_Weak";
GVAR(isEarRingingPlaying) = true;
GVAR(isEarRingingPlaying) = true;
[
{GVAR(isEarRingingPlaying) = false;}, [], 3.0, 0.25
] call EFUNC(common,waitAndExecute);
};

View File

@ -1,5 +1,5 @@
/* /*
* Author: KoffeinFlummi, commy2 * Author: KoffeinFlummi, commy2, Ruthberg
* Handles deafness due to explosions going off near the player. * Handles deafness due to explosions going off near the player.
* *
* Arguments: * Arguments:
@ -16,12 +16,10 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_damage", "_strength"]; PARAMS_2(_unit,_damage);
_unit = _this select 0; private ["_strength"];
_damage = _this select 1; _strength = 0 max _damage;
_strength = (_damage * 2) min 1;
if (_strength < 0.01) exitWith {}; if (_strength < 0.01) exitWith {};
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute); [{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute);

View File

@ -21,7 +21,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_silencer", "_audibleFireCoef", "_audibleFire", "_loudness", "_strength", "_vehAttenuation"]; private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation", "_magazine", "_muzzles", "_weaponMagazines", "_muzzleMagazines", "_ammoType", "_initSpeed", "_ammoConfig", "_caliber", "_parentClasses"];
PARAMS_7(_object,_firer,_distance,_weapon,_muzzle,_mode,_ammo); PARAMS_7(_object,_firer,_distance,_weapon,_muzzle,_mode,_ammo);
@ -30,10 +30,11 @@ if (!GVAR(enableCombatDeafness)) exitWith {};
//Only run if firedNear object is player or player's vehicle: //Only run if firedNear object is player or player's vehicle:
if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {}; if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {};
if (_weapon in ["Throw", "Put"]) exitWith {}; if (_weapon in ["Throw", "Put"]) exitWith {};
if (_distance > 50) exitWith {};
_vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)};
if (_distance < 1) then {_distance = 1;}; _distance = 1 max _distance;
_silencer = switch (_weapon) do { _silencer = switch (_weapon) do {
case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0}; case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0};
@ -47,10 +48,47 @@ if (_silencer != "") then {
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire"); _audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
}; };
_audibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire"); _weaponMagazines = missionNamespace getVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], []];
if (count _weaponMagazines == 0) then {
_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
_weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
{
if (_x != "this") then {
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
_weaponMagazines append _muzzleMagazines;
};
} forEach _muzzles;
missionNamespace setVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], _weaponMagazines];
};
_loudness = _audibleFireCoef * _audibleFire / 64; _magazine = "";
_strength = _vehAttenuation * (_loudness - (_loudness/50 * _distance)); // linear drop off {
_ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
if (_ammoType == _ammo) exitWith {
_magazine = _x;
};
} forEach _weaponMagazines;
if (_magazine == "") exitWith {};
_initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
_ammoConfig = (configFile >> "CfgAmmo" >> _ammo);
_parentClasses = [_ammoConfig, true] call BIS_fnc_returnParents;
_caliber = getNumber(_ammoConfig >> "ACE_caliber");
_caliber = switch (true) do {
case ("ShellBase" in _parentClasses): { 80 };
case ("RocketBase" in _parentClasses): { 200 };
case ("MissileBase" in _parentClasses): { 600 };
case ("SubmunitionBase" in _parentClasses): { 80 };
default {
if (_caliber <= 0) then { 6.5 } else { _caliber };
};
};
_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5;
_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off
//systemChat format["%1 : %2 : %3", _strength, _initSpeed, _parentClasses];
//systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed];
if (_strength < 0.01) exitWith {}; if (_strength < 0.01) exitWith {};

View File

@ -15,6 +15,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_effectType", "_newAttenuation", "_turretConfig", "_turretPath", "_vehicle"];
_vehicle = vehicle ACE_player; _vehicle = vehicle ACE_player;
if (isNull _vehicle) exitWith {}; if (isNull _vehicle) exitWith {};

View File

@ -1,5 +1,5 @@
/* /*
* Author: commy2 and esteldunedain * Author: commy2 and esteldunedain and Ruthberg
* Updates and applys the current deafness. Called every 0.1 sec from a PFEH. * Updates and applys the current deafness. Called every 0.1 sec from a PFEH.
* *
* Arguments: * Arguments:
@ -15,19 +15,16 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define STRENGHTODEAFNESS 3
#define MAXDEAFNESS 1.1
private ["_recoverRate", "_volume"]; private ["_recoverRate", "_volume"];
// Exit if combat deafness is disabled // Exit if combat deafness is disabled
if !(GVAR(enableCombatDeafness)) exitWith {}; if !(GVAR(enableCombatDeafness)) exitWith {};
// Check if new noises increase deafness // Check if new noises increase deafness
if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then { GVAR(newStrength) = (((ACE_player getvariable [QGVAR(dv), 0]) min 20) / 20) ^ 2;
GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS; if (GVAR(newStrength) > GVAR(currentDeafness)) then {
GVAR(currentDeafness) = GVAR(newStrength);
}; };
GVAR(newStrength) = 0;
// Recover rate is slower if deafness is severe // Recover rate is slower if deafness is severe
_recoverRate = 0.01; _recoverRate = 0.01;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -548,6 +548,30 @@ class CfgVehicles {
}; };
}; };
}; };
class StaticMGWeapon: StaticWeapon {};
class HMG_01_base_F: StaticMGWeapon {};
class HMG_01_high_base_F: HMG_01_base_F {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[-0.172852,0.164063,-0.476091]";
};
};
};
class AA_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
};
class AT_01_base_F: StaticMGWeapon {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
position = "[0,0.515869,-0.200671]";
};
};
};
class thingX; class thingX;
class ReammoBox_F: thingX { class ReammoBox_F: thingX {

View File

@ -32,6 +32,9 @@ _actions = [];
case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) }; case (commander _vehicle): { QUOTE(A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa) };
default { "" }; default { "" };
}; };
if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then {
_icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa));
};
_actions pushBack _actions pushBack
[ [
[ [

View File

@ -7,7 +7,7 @@ TRACE_1("enter", _this);
private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"]; private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"];
private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"]; private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"];
private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"]; private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"];
private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"]; private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"];
private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"]; private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"];
@ -44,24 +44,24 @@ _magazineConfig = if ((currentMagazine _currentShooter) != "") then {
[] []
}; };
//Only enable if both weapon and currentMagazine are enabled (bandaid to allow firing the "AP" missle) //If weapon does not have "javelin enabled", then exit PFEH
if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1} || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith { if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1}) exitWith {
__JavelinIGUITargeting ctrlShow false; __JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false;
if(!isNil "_fireDisabledEH") then { if(!isNil "_fireDisabledEH") then {
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
}; };
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil]; uiNamespace setVariable["ACE_RscOptics_javelin_PFH", nil];
}; };
// Find a target within the optic range // Find a target within the optic range
_newTarget = objNull; _newTarget = objNull;
// Bail on fast movement // Bail on fast movement
if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady.
ACE_player switchCamera "INTERNAL"; ACE_player switchCamera "INTERNAL";
@ -69,19 +69,20 @@ if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} &&
// Refresh the firemode // Refresh the firemode
[] call FUNC(showFireMode); [] call FUNC(showFireMode);
_ammo = _currentShooter ammo (currentWeapon _currentShooter);
// bail on not loaded // not loaded or not "javelin enabled" for magazine, hide targeting and enable firing
if( (vehicle ACE_player) != ACE_player) then { if ((_ammo == 0) || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith {
if( (vehicle player) magazineTurretAmmo ["1Rnd_GAT_missiles", [0]] < 1) exitWith { __JavelinIGUITargeting ctrlShow false;
TRACE_1("No turret ammo, exit", ""); __JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false;
if(!isNil "_fireDisabledEH") then {
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
}; };
} else {
if (ACE_player ammo (currentWeapon ACE_player) < 1 ) exitWith {
TRACE_1("No ammo, exit", "");
};
}; };
_range = parseNumber (ctrlText __JavelinIGUIRangefinder); _range = parseNumber (ctrlText __JavelinIGUIRangefinder);
TRACE_1("Viewing range", _range); TRACE_1("Viewing range", _range);
if (_range > 50 && {_range < 2500}) then { if (_range > 50 && {_range < 2500}) then {
@ -113,7 +114,7 @@ _zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selecti
_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)]; _randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)];
_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds); _apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds);
_aposX = 0; _aposX = 0;
_aposY = 0; _aposY = 0;
if (count _apos < 2) then { if (count _apos < 2) then {
@ -124,7 +125,7 @@ if (count _apos < 2) then {
_aposY = (_apos select 1) + _offsetY; _aposY = (_apos select 1) + _offsetY;
}; };
if((call CBA_fnc_getFoV) select 1 > 9) then { if((call CBA_fnc_getFoV) select 1 > 9) then {
__JavelinIGUINFOV ctrlSetTextColor __ColorGreen; __JavelinIGUINFOV ctrlSetTextColor __ColorGreen;
__JavelinIGUIWFOV ctrlSetTextColor __ColorGray; __JavelinIGUIWFOV ctrlSetTextColor __ColorGray;
} else { } else {
@ -134,9 +135,9 @@ if((call CBA_fnc_getFoV) select 1 > 9) then {
FUNC(disableFire) = { FUNC(disableFire) = {
_firedEH = _this select 0; _firedEH = _this select 0;
if(_firedEH < 0 && difficulty > 0) then { if(_firedEH < 0 && difficulty > 0) then {
_firedEH = [ACE_player, "DefaultAction", {true}, { _firedEH = [ACE_player, "DefaultAction", {true}, {
_canFire = (_this select 1) getVariable["ace_missileguidance_target", nil]; _canFire = (_this select 1) getVariable["ace_missileguidance_target", nil];
if(!isNil "_canFire") exitWith { false }; if(!isNil "_canFire") exitWith { false };
true true
@ -146,7 +147,7 @@ FUNC(disableFire) = {
}; };
FUNC(enableFire) = { FUNC(enableFire) = {
_firedEH = _this select 0; _firedEH = _this select 0;
if(_firedEH > 0 && difficulty > 0) then { if(_firedEH > 0 && difficulty > 0) then {
[ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler); [ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler);
}; };
@ -157,38 +158,38 @@ if (isNull _newTarget) then {
// No targets found // No targets found
_currentTarget = objNull; _currentTarget = objNull;
_lockTime = 0; _lockTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false; __JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target",nil, false]; _currentShooter setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire // Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
} else { } else {
_fov = [] call CBA_fnc_getFoV; _fov = [] call CBA_fnc_getFoV;
TRACE_1("FOV", _fov); TRACE_1("FOV", _fov);
if (_newTarget distance ACE_player < 2500 if (_newTarget distance ACE_player < 2500
&& {(call CBA_fnc_getFoV) select 1 > 9} && {(call CBA_fnc_getFoV) select 1 > 9}
&& { (currentVisionMode ACE_player == 2)} && { (currentVisionMode ACE_player == 2)}
&& GVAR(isLockKeyDown) && GVAR(isLockKeyDown)
) then { ) then {
// Lock on after 3 seconds // Lock on after 3 seconds
if(_currentTarget != _newTarget) then { if(_currentTarget != _newTarget) then {
TRACE_1("New Target, reseting locking", _newTarget); TRACE_1("New Target, reseting locking", _newTarget);
_lockTime = ACE_diagTime; _lockTime = ACE_diagTime;
_currentTarget = _newTarget; _currentTarget = _newTarget;
playSound "ACE_Javelin_Locking"; playSound "ACE_Javelin_Locking";
} else { } else {
if(ACE_diagTime - _lockTime > __LOCKONTIME + _randomLockInterval) then { if(ACE_diagTime - _lockTime > __LOCKONTIME + _randomLockInterval) then {
TRACE_2("LOCKED!", _currentTarget, _lockTime); TRACE_2("LOCKED!", _currentTarget, _lockTime);
__JavelinIGUISeek ctrlSetTextColor __ColorGreen; __JavelinIGUISeek ctrlSetTextColor __ColorGreen;
__JavelinIGUITargeting ctrlShow true; __JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow false; __JavelinIGUITargetingConstrains ctrlShow false;
__JavelinIGUITargetingGate ctrlShow true; __JavelinIGUITargetingGate ctrlShow true;
@ -198,34 +199,34 @@ if (isNull _newTarget) then {
//__JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1]; //__JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1];
//__JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY]; //__JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY];
//{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV]; //{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV];
_boundsInput = if (_currentTarget isKindOf "CAManBase") then { _boundsInput = if (_currentTarget isKindOf "CAManBase") then {
[_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"];
} else { } else {
[_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"]; [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"];
}; };
_bpos = _boundsInput call EFUNC(common,worldToScreenBounds); _bpos = _boundsInput call EFUNC(common,worldToScreenBounds);
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft; _minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop; _minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY); TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR];
_currentShooter setVariable["ace_missileguidance_target", _currentTarget, false]; _currentShooter setVariable["ace_missileguidance_target", _currentTarget, false];
// Allow fire // Allow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire);
if(ACE_diagTime > _soundTime) then { if(ACE_diagTime > _soundTime) then {
playSound "ACE_Javelin_Locked"; playSound "ACE_Javelin_Locked";
_soundTime = ACE_diagTime + 0.25; _soundTime = ACE_diagTime + 0.25;
@ -233,31 +234,31 @@ if (isNull _newTarget) then {
} else { } else {
__JavelinIGUITargeting ctrlShow true; __JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingGate ctrlShow true; __JavelinIGUITargetingGate ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true; __JavelinIGUITargetingConstrains ctrlShow true;
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;
_currentShooter setVariable["ace_missileguidance_target", nil, false]; _currentShooter setVariable["ace_missileguidance_target", nil, false];
_boundsInput = if (_currentTarget isKindOf "CAManBase") then { _boundsInput = if (_currentTarget isKindOf "CAManBase") then {
[_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; [_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"];
} else { } else {
[_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"]; [_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"];
}; };
_bpos = _boundsInput call EFUNC(common,worldToScreenBounds); _bpos = _boundsInput call EFUNC(common,worldToScreenBounds);
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft; _minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop; _minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY); TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR];
if(ACE_diagTime > _soundTime) then { if(ACE_diagTime > _soundTime) then {
@ -265,25 +266,25 @@ if (isNull _newTarget) then {
_soundTime = ACE_diagTime + 0.25; _soundTime = ACE_diagTime + 0.25;
}; };
// Disallow fire // Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
}; };
}; };
} else { } else {
// No targets found // No targets found
_currentTarget = objNull; _currentTarget = objNull;
_lockTime = 0; _lockTime = 0;
__JavelinIGUISeek ctrlSetTextColor __ColorGray; __JavelinIGUISeek ctrlSetTextColor __ColorGray;
__JavelinIGUITargeting ctrlShow false; __JavelinIGUITargeting ctrlShow false;
__JavelinIGUITargetingGate ctrlShow false; __JavelinIGUITargetingGate ctrlShow false;
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target",nil, false]; _currentShooter setVariable ["ace_missileguidance_target",nil, false];
// Disallow fire // Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);
}; };
}; };
//TRACE_2("", _newTarget, _currentTarget); //TRACE_2("", _newTarget, _currentTarget);

View File

@ -20,7 +20,7 @@ __JavelinIGUITargetingLines ctrlShow false;
uiNameSpace setVariable [QGVAR(arguments), uiNameSpace setVariable [QGVAR(arguments),
[ [
0, // Last runtime ACE_diagTime, // Last runtime
objNull, // currentTargetObject objNull, // currentTargetObject
0, // Run Time 0, // Run Time
0, // Lock Time 0, // Lock Time

View File

@ -219,7 +219,7 @@ class ACE_Medical_Actions {
items[] = {"ACE_personalAidKit"}; items[] = {"ACE_personalAidKit"};
treatmentLocations[] = {QGVAR(useLocation_PAK)}; treatmentLocations[] = {QGVAR(useLocation_PAK)};
requiredMedic = QGVAR(medicSetting_PAK); requiredMedic = QGVAR(medicSetting_PAK);
treatmentTime = 10; treatmentTime = QUOTE((_this select 1) call FUNC(treatmentAdvanced_fullHealTreatmentTime));
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
itemConsumed = QGVAR(consumeItem_PAK); itemConsumed = QGVAR(consumeItem_PAK);
animationPatient = ""; animationPatient = "";

View File

@ -76,6 +76,7 @@ PREP(treatmentAdvanced_CPR);
PREP(treatmentAdvanced_CPRLocal); PREP(treatmentAdvanced_CPRLocal);
PREP(treatmentAdvanced_fullHeal); PREP(treatmentAdvanced_fullHeal);
PREP(treatmentAdvanced_fullHealLocal); PREP(treatmentAdvanced_fullHealLocal);
PREP(treatmentAdvanced_fullHealTreatmentTime);
PREP(treatmentAdvanced_medication); PREP(treatmentAdvanced_medication);
PREP(treatmentAdvanced_medicationLocal); PREP(treatmentAdvanced_medicationLocal);
PREP(treatmentAdvanced_surgicalKit_onProgress); PREP(treatmentAdvanced_surgicalKit_onProgress);

View File

@ -0,0 +1,26 @@
/*
* Author: Ruthberg
* Calculates the personal aid kit treatment time based on amount of damage to heal
*
* Arguments:
* unit <OBJECT>
*
* Return Value:
* treatment time <NUMBER>
*
* Example:
* [_target] call ace_medical_fnc_treatmentAdvanced_fullHealTreatmentTime
*
* Public: No
*/
#include "script_component.hpp"
private ["_target", "_totalDamage"];
_target = _this;
_totalDamage = 0;
{
_totalDamage = _totalDamage + _x;
} forEach (_target getVariable [QGVAR(bodyPartStatus), []]);
(10 max (_totalDamage * 10) min 120)