Merge branch 'master' into pr/9273

This commit is contained in:
johnb432 2024-07-20 08:42:52 +02:00
commit 7a261773e2
53 changed files with 544 additions and 526 deletions

View File

@ -1,34 +1,45 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: commy2 * Author: commy2, johnb43
* Get the available firing modes of a weapon. Will ignore the AI helper modes. * Get the available firing modes of a weapon. Will ignore the AI helper modes.
* *
* Arguments: * Arguments:
* 0: Weapon <STRING> * 0: Weapon <STRING>
* 1: Muzzle <STRING> (default: weapon)
* *
* Return Value: * Return Value:
* Firing Modes <ARRAY> * Firing Modes <ARRAY>
* *
* Example: * Example:
* ["gun"] call ace_common_fnc_getWeaponModes * "arifle_AK12_F" call ace_common_fnc_getWeaponModes
* *
* Public: Yes * Public: Yes
*/ */
params [["_weapon", "", [""]]]; params [["_weapon", "", [""]], ["_muzzle", nil, [""]]];
private _config = configFile >> "CfgWeapons" >> _weapon; private _config = configFile >> "CfgWeapons" >> _weapon;
if (!isNil "_muzzle") then {
_config = _config >> _muzzle
};
if (!isClass _config) exitWith {
[] // return
};
private _modes = []; private _modes = [];
{ {
if (getNumber (_config >> _x >> "showToPlayer") == 1) then { if (getNumber (_config >> _x >> "showToPlayer") == 1) then {
_modes pushBack _x; if (_x == "this") then {
}; _modes pushBack (configName _config);
} else {
if (_x == "this") then { if (isClass (_config >> _x)) then {
_modes pushBack _weapon; _modes pushBack (configName (_config >> _x));
};
};
}; };
} forEach getArray (_config >> "modes"); } forEach getArray (_config >> "modes");
_modes _modes // return

View File

@ -3,11 +3,13 @@ class Extended_PreStart_EventHandlers {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
}; };
}; };
class Extended_PreInit_EventHandlers { class Extended_PreInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
}; };
}; };
class Extended_PostInit_EventHandlers { class Extended_PostInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));

View File

@ -4,7 +4,7 @@ class CfgVehicles {
class ACE_Actions { class ACE_Actions {
class ACE_Dogtag { class ACE_Dogtag {
displayName = CSTRING(itemName); displayName = CSTRING(itemName);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeDogtag)); condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckDogtag));
statement = ""; statement = "";
exceptions[] = {"isNotSwimming", "isNotInside"}; exceptions[] = {"isNotSwimming", "isNotInside"};
showDisabled = 0; showDisabled = 0;

View File

@ -16,8 +16,8 @@ class CfgWeapons {
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
scope = 0; scope = 0;
displayName = CSTRING(itemName); displayName = CSTRING(itemName);
model = QUOTE(PATHTOF(data\ace_dogtag.p3d)); model = QPATHTOF(data\ace_dogtag.p3d);
picture = QUOTE(PATHTOF(data\dogtagSingle.paa)); picture = QPATHTOF(data\dogtagSingle.paa);
class ItemInfo: CBA_MiscItem_ItemInfo { class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 0; //too small to for 1 ? mass = 0; //too small to for 1 ?
}; };

View File

@ -1,13 +1,11 @@
PREP(addDogtagActions); PREP(addDogtagActions);
PREP(addDogtagItem);
PREP(bloodType); PREP(bloodType);
PREP(canCheckDogtag); PREP(canCheckDogtag);
PREP(canTakeDogtag); PREP(canTakeDogtag);
PREP(checkDogtag); PREP(checkDogtag);
PREP(disableFactionDogtags);
PREP(getDogtagData); PREP(getDogtagData);
PREP(getDogtagItem); PREP(getDogtagItem);
PREP(showDogtag); PREP(showDogtag);
PREP(ssn); PREP(ssn);
PREP(takeDogtag); PREP(takeDogtag);
PREP(disableFactionDogtags);

View File

@ -1,9 +1,5 @@
#include "script_component.hpp" #include "script_component.hpp"
[QGVAR(showDogtag), LINKFUNC(showDogtag)] call CBA_fnc_addEventHandler;
[QGVAR(getDogtagItem), LINKFUNC(getDogtagItem)] call CBA_fnc_addEventHandler;
[QGVAR(addDogtagItem), LINKFUNC(addDogtagItem)] call CBA_fnc_addEventHandler;
if (hasInterface || isServer) then { if (hasInterface || isServer) then {
[QGVAR(broadcastDogtagInfo), { [QGVAR(broadcastDogtagInfo), {
GVAR(dogtagsData) set _this; GVAR(dogtagsData) set _this;
@ -18,69 +14,29 @@ if (hasInterface || isServer) then {
[QGVAR(broadcastDogtagInfo), [_x, _y], _clientOwner] call CBA_fnc_ownerEvent; [QGVAR(broadcastDogtagInfo), [_x, _y], _clientOwner] call CBA_fnc_ownerEvent;
} forEach GVAR(dogtagsData); } forEach GVAR(dogtagsData);
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
[QGVAR(getDogtagItem), LINKFUNC(getDogtagItem)] call CBA_fnc_addEventHandler;
} else { } else {
// To be here, hasInterface must be true // To be here, hasInterface must be true
[QGVAR(requestSyncDogtagDataJIP), clientOwner] call CBA_fnc_serverEvent; [QGVAR(requestSyncDogtagDataJIP), clientOwner] call CBA_fnc_serverEvent;
}; };
}; };
// Add actions and event handlers only if ace_medical is enabled if (hasInterface) then {
// - Adding actions via config would create a dependency // If the arsenal is loaded, show the custom names for dog tags when in the arsenal
["CBA_settingsInitialized", { if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
if !(GETEGVAR(medical,enabled,false)) exitWith {}; [QEGVAR(arsenal,rightPanelFilled), {
params ["_display", "_leftPanelIDC", "_rightPanelIDC"];
if (hasInterface) then { if !(_leftPanelIDC in [2010, 2012, 2014] && {_rightPanelIDC == 38}) exitWith {};
private _checkTagAction = [
"ACE_CheckDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _checkTagAction, true] call EFUNC(interact_menu,addActionToClass);
private _takeTagAction = [
"ACE_TakeDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction, true] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag", "_isGrave"];
if (_isGrave) exitWith {};
TRACE_2("ace_placedInBodyBag eh",_target,_bodyBag);
private _dogTagData = [_target] call FUNC(getDogtagData);
_bodyBag setVariable [QGVAR(dogtagData), _dogTagData, true];
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
_bodyBag setVariable [QGVAR(dogtagTaken), _bodyBag, true];
};
}] call CBA_fnc_addEventHandler;
};
}] call CBA_fnc_addEventHandler;
// If the arsenal is loaded, show the custom names for dog tags when in the arsenal
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(arsenal,rightPanelFilled), {
params ["_display", "_leftPanelIDC", "_rightPanelIDC"];
if (_leftPanelIDC in [2010, 2012, 2014] && {_rightPanelIDC == 38}) then {
LOG("passed");
private _rightPanel = _display displayCtrl 15; private _rightPanel = _display displayCtrl 15;
private _cfgWeapons = configFile >> "CfgWeapons"; private _cfgWeapons = configFile >> "CfgWeapons";
private _item = "";
private _dogtagData = []; TRACE_1("passed",_rightPanel);
for "_i" from 0 to (lnbSize _rightPanel select 0) - 1 do { for "_i" from 0 to (lnbSize _rightPanel select 0) - 1 do {
_item = _rightPanel lnbData [_i, 0]; private _item = _rightPanel lnbData [_i, 0];
if (_item isKindOf ["ACE_dogtag", _cfgWeapons]) then { if (_item isKindOf ["ACE_dogtag", _cfgWeapons]) then {
private _name = (GVAR(dogtagsData) getOrDefault [_item, []]) param [0, ""]; private _name = (GVAR(dogtagsData) getOrDefault [_item, []]) param [0, ""];
@ -93,27 +49,71 @@ if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
_rightPanel lnbSetText [[_i, 1], [LLSTRING(itemName), ": ", _name] joinString ""]; _rightPanel lnbSetText [[_i, 1], [LLSTRING(itemName), ": ", _name] joinString ""];
}; };
}; };
}; }] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler; };
// Add context menu option
[
"ACE_dogtag",
["GROUND", "CARGO", "CONTAINER"],
LLSTRING(checkItem),
nil,
QPATHTOF(data\dogtag_icon_ca.paa),
[
{true},
{true}
],
{
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag);
false
}
] call CBA_fnc_addItemContextMenuOption;
}; };
// Add context menu option // Add actions and event handlers only if ace_medical is enabled
[ // - Adding actions via config would create a dependency
"ACE_dogtag", ["CBA_settingsInitialized", {
["GROUND", "CARGO", "CONTAINER"], if !(GETEGVAR(medical,enabled,false)) exitWith {};
LLSTRING(checkItem),
nil,
QPATHTOF(data\dogtag_icon_ca.paa),
[
{true},
{true}
],
{
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag);
false if (hasInterface) then {
} private _checkTagAction = [
] call CBA_fnc_addItemContextMenuOption; "ACE_CheckDogtag",
format ["%1: %2", LLSTRING(itemName), LLSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player, _target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call EFUNC(interact_menu,createAction);
// Disable dogtags for civilians ["ACE_bodyBagObject", 0, ["ACE_MainActions"], _checkTagAction, true] call EFUNC(interact_menu,addActionToClass);
private _takeTagAction = [
"ACE_TakeDogtag",
format ["%1: %2", LLSTRING(itemName), LLSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player, _target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction, true] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag", "_isGrave"];
if (_isGrave) exitWith {};
TRACE_2("ace_placedInBodyBag eh",_target,_bodyBag);
private _dogtagData = _target call FUNC(getDogtagData);
_bodyBag setVariable [QGVAR(dogtagData), _dogtagData, true];
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
_bodyBag setVariable [QGVAR(dogtagTaken), _bodyBag, true];
};
}] call CBA_fnc_addEventHandler;
};
}] call CBA_fnc_addEventHandler;
// Disable dog tags for civilians
"CIV_F" call FUNC(disableFactionDogtags); "CIV_F" call FUNC(disableFactionDogtags);

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL, mharis001 * Author: SzwedzikPL, mharis001
* Returns children actions for checking dogtags in player's inventory. * Returns children actions for checking dog tags in the player's inventory.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -10,7 +10,7 @@
* Actions <ARRAY> * Actions <ARRAY>
* *
* Example: * Example:
* [_player] call ace_dogtags_fnc_addDogtagActions * player call ace_dogtags_fnc_addDogtagActions
* *
* Public: No * Public: No
*/ */
@ -23,14 +23,21 @@ private _fnc_getActions = {
{ {
private _config = _cfgWeapons >> _x; private _config = _cfgWeapons >> _x;
if (getNumber (_config >> QGVAR(tagID)) > 0) then {
private _displayName = getText (_config >> "displayName");
private _picture = getText (_config >> "picture");
private _action = [_x, _displayName, _picture, { if (getNumber (_config >> QGVAR(tagID)) > 0) then {
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag); _actions pushBack [
}, {true}, {}, _x] call EFUNC(interact_menu,createAction); [
_actions pushBack [_action, [], _player]; _x,
getText (_config >> "displayName"),
getText (_config >> "picture"),
{[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag)},
{true},
{},
_x
] call EFUNC(interact_menu,createAction),
[],
_player
];
}; };
} forEach (_player call EFUNC(common,uniqueItems)); } forEach (_player call EFUNC(common,uniqueItems));

View File

@ -1,38 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Adds dogtag item to unit (triggered by server).
*
* Arguments:
* 0: Item class <STRING>
* 1: Dogtag data <ARRAY>
*
* Return Value:
* None
*
* Example:
* ["itemClass", ["name", "610-27-5955", "A POS"]] call ace_dogtags_fnc_addDogtagItem
*
* Public: No
*/
params ["_item", "_dogtagData"];
if (_item == "") exitWith {};
// Verify that the unit has inventory space, otherwise drop the dogtag on the ground
[ace_player, _item, true] call CBA_fnc_addItem;
_dogtagData params ["_name"];
// If data doesn't exist or body has no name, set name as "unknown"
if (_name == "") then {
_name = LELSTRING(common,unknown);
};
private _displayText = format [localize LSTRING(takeDogtagSuccess), _name];
// display message
[{
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, _displayText, DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: commy2 * Author: commy2
* Reports a blood type depending on the units name. * Reports a blood type depending on the unit's name.
* *
* Arguments: * Arguments:
* 0: Name of a unit <STRING> * 0: Unit name <STRING>
* *
* Return Value: * Return Value:
* A random blood type <STRING> * A random blood type <STRING>
* *
* Example: * Example:
* _bloodType = ["name"] call ace_dogtags_fnc_bloodType * "name" call ace_dogtags_fnc_bloodType
* *
* Public: No * Public: No
*/ */

View File

@ -1,26 +1,26 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Checks if dogtag can be checked. * Checks if the target's dog tag can be checked by the unit.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player (not used) <OBJECT>
* 1: Target <OBJECT> * 1: Target <OBJECT>
* *
* Return Value: * Return Value:
* True if dogtag can be checked <BOOL> * If dog tag can be checked <BOOL>
* *
* Example: * Example:
* _canCheck = [player, unit] call ace_dogtags_fnc_canCheckDogtag * [player, cursorObject] call ace_dogtags_fnc_canCheckDogtag
* *
* Public: No * Public: No
*/ */
params ["_player", "_target"]; params ["", "_target"];
if (isNull _target) exitWith {false}; if (isNull _target) exitWith {false};
// check if disabled for faction // Check if disabled for faction
if ((faction _target) in GVAR(disabledFactions)) exitWith {false}; if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
!(_target call EFUNC(common,isAwake)) !(_target call EFUNC(common,isAwake))

View File

@ -1,17 +1,17 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Checks if dogtag can be taken. * Checks if the target's dog tag can be taken by the unit.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
* 1: Target <OBJECT> * 1: Target <OBJECT>
* *
* Return Value: * Return Value:
* True if dogtag can be taken <BOOL> * If dog tag can be taken <BOOL>
* *
* Example: * Example:
* _canTake = [player, unit] call ace_dogtags_fnc_canTakeDogtag * [player, cursorObject] call ace_dogtags_fnc_canTakeDogtag
* *
* Public: No * Public: No
*/ */
@ -20,7 +20,10 @@ params ["_player", "_target"];
if (isNull _target) exitWith {false}; if (isNull _target) exitWith {false};
// check if disabled for faction // Check if disabled for faction
if ((faction _target) in GVAR(disabledFactions)) exitWith {false}; if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
!(_target call EFUNC(common,isAwake)) && {_player canAdd ["ACE_dogtag_1", 1/*, true*/]} // Todo: Uncomment in 2.18 // CBA_fnc_canAddItem doesn't account for mass 0 items and unit not having any containers
!(_target call EFUNC(common,isAwake)) && {(uniform _player + vest _player + backpack _player) != ""} && {[_player, "ACE_dogtag_1"] call CBA_fnc_canAddItem}
// Todo: Use code below in 2.18
// _player canAdd ["ACE_dogtag_1", 1, true]

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Checks unit dogtag. * Checks the unit's dog tag.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -11,17 +11,17 @@
* None * None
* *
* Example: * Example:
* [player, unit] call ace_dogtags_fnc_checkDogtag * [player, cursorObject] call ace_dogtags_fnc_checkDogtag
* *
* Public: No * Public: No
*/ */
params ["_player", "_target"]; params ["_player", "_target"];
// animation // Animation
_player call EFUNC(common,goKneeling); _player call EFUNC(common,goKneeling);
// sound // Sound
private _position = _target modelToWorldWorld (_target selectionPosition "neck"); private _position = _target modelToWorldWorld (_target selectionPosition "neck");
playSound3D [ playSound3D [
@ -34,10 +34,8 @@ playSound3D [
50 50
]; ];
// display dogtag // Display dog tag
private _doubleTags = (_target getVariable [QGVAR(dogtagTaken), objNull]) != _target; private _doubleTags = (_target getVariable [QGVAR(dogtagTaken), objNull]) != _target;
private _dogTagData = [_target] call FUNC(getDogTagData); private _dogtagData = _target call FUNC(getDogtagData);
[{ [LINKFUNC(showDogtag), [_dogtagData, _doubleTags], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
[QGVAR(showDogtag), _this] call CBA_fnc_localEvent;
}, [_dogTagData, _doubleTags], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: commy2 * Author: commy2
* Disable this faction from using dogtags. * Disables this faction from using dog tags.
* *
* Arguments: * Arguments:
* 0: Faction <STRING> * 0: Faction <STRING>

View File

@ -1,19 +1,19 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: esteldunedain * Author: esteldunedain
* Get unit dogtag data. * Gets unit's dog tag data.
* *
* Arguments: * Arguments:
* 0: Target <OBJECT> * 0: Target <OBJECT>
* *
* Return Value: * Return Value:
* Dogtag Data <ARRAY> * Dog tag Data <ARRAY>
* 0: Name <STRING> * 0: Name <STRING>
* 1: SSN <STRING> * 1: SSN <STRING>
* 2: Blood Type <STRING> * 2: Blood Type <STRING>
* *
* Example: * Example:
* _dogtagData = [unit, player] call ace_dogtags_fnc_getDogtagData * player call ace_dogtags_fnc_getDogtagData
* *
* Public: No * Public: No
*/ */
@ -21,17 +21,20 @@
params ["_target"]; params ["_target"];
// Check if the data was already created // Check if the data was already created
private _dogTagData = _target getVariable QGVAR(dogtagData); private _dogtagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogTagData") exitWith {_dogTagData};
if (!isNil "_dogtagData") exitWith {_dogtagData};
// Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type // Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type
private _targetName = [_target, false, true] call EFUNC(common,getName); private _targetName = [_target, false, true] call EFUNC(common,getName);
private _dogTagData = [ private _dogtagData = [
_targetName, _targetName,
_targetName call FUNC(ssn), _targetName call FUNC(ssn),
_targetName call FUNC(bloodType) _targetName call FUNC(bloodType)
]; ];
// Store it // Store it
_target setVariable [QGVAR(dogtagData), _dogTagData, true]; _target setVariable [QGVAR(dogtagData), _dogtagData, true];
_dogTagData
_dogtagData

View File

@ -1,7 +1,8 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Server: creates new dogtag item and send it to client. * Server: Creates a new dog tag item and sends it to client.
* It broacasts the dog tag info to all machines with interfaces.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -11,12 +12,12 @@
* None * None
* *
* Example: * Example:
* [player, unit] call ace_dogtags_fnc_getDogtagItem * [player, cursorObject] call ace_dogtags_fnc_getDogtagItem
* *
* Public: No * Public: No
*/ */
if(!isServer) exitWith {}; if (!isServer) exitWith {};
params ["_player", "_target"]; params ["_player", "_target"];
TRACE_2("getDogtagItem",_player,_target); TRACE_2("getDogtagItem",_player,_target);
@ -28,7 +29,20 @@ if (GVAR(idCounter) > 999) exitWith {ERROR("Ran out of IDs");};
private _dogTagData = [_target] call FUNC(getDogTagData); private _dogTagData = [_target] call FUNC(getDogTagData);
private _item = format ["ACE_dogtag_%1", GVAR(idCounter)]; private _item = format ["ACE_dogtag_%1", GVAR(idCounter)];
[QGVAR(addDogtagItem), [_item, _dogTagData], [_player]] call CBA_fnc_targetEvent;
// Broadcast data globally, so that clients can use it where needed // Broadcast data globally, so that clients can use it where needed
[QGVAR(broadcastDogtagInfo), [_item, _dogTagData]] call CBA_fnc_globalEvent; [QGVAR(broadcastDogtagInfo), [_item, _dogTagData]] call CBA_fnc_globalEvent;
// Dog tags have no mass, so no need to check if it can fit in container, but check if unit has an inventory at all
[_player, _item, true] call CBA_fnc_addItem;
_name = _dogtagData param [0, ""];
// If data doesn't exist or body has no name, set name as "unknown"
if (_name == "") then {
_name = LELSTRING(common,unknown);
};
// Display message
[{
[QEGVAR(common,displayTextStructured), [_this select 0, 2.5], _this select 1] call CBA_fnc_targetEvent;
}, [format [LLSTRING(takeDogtagSuccess), _name], _player], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* Shows dogtag. * Shows dog tag.
* *
* Arguments: * Arguments:
* 0: Dogtag data <ARRAY> * 0: Dog tag data <ARRAY>
* 1: Display as double tag <BOOLEAN> * 1: Display as double tag <BOOLEAN>
* *
* Return Value: * Return Value:
@ -27,8 +27,10 @@ if (_doubleTags) then {
} else { } else {
(QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(singleTag), "PLAIN", 1, true]; (QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(singleTag), "PLAIN", 1, true];
}; };
private _display = uiNamespace getvariable [QGVAR(tag), displayNull];
if(isNull _display) exitWith {}; private _display = uiNamespace getVariable [QGVAR(tag), displayNull];
if (isNull _display) exitWith {};
private _control = _display displayCtrl 1001; private _control = _display displayCtrl 1001;
_dogtagData params ["_name", "_code", "_bloodType"]; _dogtagData params ["_name", "_code", "_bloodType"];

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: kymckay * Author: kymckay
* Reports a social security number generated from the units name. * Reports a social security number generated from the unit's name.
* *
* Arguments: * Arguments:
* 0: Name of a unit <STRING> * 0: Unit name <STRING>
* *
* Return Value: * Return Value:
* A random three/two/four format social security number <STRING> * A random three/two/four format social security number <STRING>
* *
* Example: * Example:
* _ssn = ["AAA"] call ace_dogtags_fnc_ssn * "name" call ace_dogtags_fnc_ssn
* *
* Public: No * Public: No
*/ */
@ -18,19 +18,20 @@
params ["_name"]; params ["_name"];
private _chars = toArray _name; private _chars = toArray _name;
private _length = count _chars;
// Warning, for strings containing non-latin characters, `_count _name` != `_count _chars` // Warning, for strings containing non-latin characters, `_count _name` != `_count _chars`
private _length = count _chars;
_chars pushBack _length; _chars pushBack _length;
_length = _length + 1; _length = _length + 1;
private _remainder = 0; private _remainder = 0;
private _nums = [0,0,0,0,0,0,0,0,0]; private _nums = [0, 0, 0, 0, 0, 0, 0, 0, 0];
for "_index" from 0 to (8 max _length) do { for "_index" from 0 to (8 max _length) do {
private _inputChar = _chars select (_index % _length); private _inputChar = _chars select (_index % _length);
_nums set [(_index % 9), ((_nums select (_index % 9)) + _inputChar + _remainder) % 10]; _nums set [_index % 9, ((_nums select (_index % 9)) + _inputChar + _remainder) % 10];
_remainder = (_inputChar + _remainder) % 256; _remainder = (_inputChar + _remainder) % 256;
}; };
([_nums select [0,3],_nums select [3,2], _nums select [5,4]] apply { _x joinString "" }) joinString "-" ([_nums select [0, 3], _nums select [3, 2], _nums select [5, 4]] apply { _x joinString "" }) joinString "-"

View File

@ -1,8 +1,8 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: SzwedzikPL * Author: SzwedzikPL
* If dogtag is not already taken triggers event on server. * If the dog tag hasn't already been taken, it triggers an event on the server.
* If dogtag already taken displays info about it. * If the dog tag has already been taken, it displays info about it.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -12,17 +12,17 @@
* None * None
* *
* Example: * Example:
* [player, unit] call ace_dogtags_fnc_takeDogtag * [player, cursorObject] call ace_dogtags_fnc_takeDogtag
* *
* Public: No * Public: No
*/ */
params ["_player", "_target"]; params ["_player", "_target"];
// animation // Animation
_player call EFUNC(common,goKneeling); _player call EFUNC(common,goKneeling);
// sound // Sound
private _position = _target modelToWorldWorld (_target selectionPosition "neck"); private _position = _target modelToWorldWorld (_target selectionPosition "neck");
playSound3D [ playSound3D [
@ -35,12 +35,11 @@ playSound3D [
50 50
]; ];
// display message // Display message
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then { if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
[{ [EFUNC(common,displayTextStructured), [LLSTRING(dogtagAlreadyTaken), 2.5], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, localize LSTRING(dogtagAlreadyTaken), DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
} else { } else {
_target setVariable [QGVAR(dogtagTaken), _target, true]; _target setVariable [QGVAR(dogtagTaken), _target, true];
[QGVAR(getDogtagItem), [_player, _target]] call CBA_fnc_serverEvent; [QGVAR(getDogtagItem), [_player, _target]] call CBA_fnc_serverEvent;
}; };

View File

@ -19,6 +19,12 @@
params ["_unit", "_target"]; params ["_unit", "_target"];
TRACE_2("params",_unit,_target); TRACE_2("params",_unit,_target);
// If in ViV cargo, unload it first
// Warn user if it failed to unload (shouldn't happen)
if (!isNull isVehicleCargo _target && {!(objNull setVehicleCargo _target)}) then {
WARNING_1("ViV Unload Failed %1",_target);
};
// Get attachTo offset and direction // Get attachTo offset and direction
private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
private _direction = _target getVariable [QGVAR(carryDirection), 0]; private _direction = _target getVariable [QGVAR(carryDirection), 0];

View File

@ -19,6 +19,12 @@
params ["_unit", "_target"]; params ["_unit", "_target"];
TRACE_2("params",_unit,_target); TRACE_2("params",_unit,_target);
// If in ViV cargo, unload it first
// Warn user if it failed to unload (shouldn't happen)
if (!isNull isVehicleCargo _target && {!(objNull setVehicleCargo _target)}) then {
WARNING_1("ViV Unload Failed %1",_target);
};
// Get attachTo offset and direction. // Get attachTo offset and direction.
private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
private _direction = _target getVariable [QGVAR(dragDirection), 0]; private _direction = _target getVariable [QGVAR(dragDirection), 0];

View File

@ -65,11 +65,12 @@ if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS})
_unit removeWeapon "ACE_FakePrimaryWeapon"; _unit removeWeapon "ACE_FakePrimaryWeapon";
// Reselect weapon and re-enable sprint // Reselect weapon and re-enable sprint
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1]; private _previousWeaponState = _unit getVariable QGVAR(previousWeapon);
_unit setVariable [QGVAR(previousWeapon), nil, true];
if (_previousWeaponIndex != -1) then { if (!isNil "_previousWeaponState") then {
_unit action ["SwitchWeapon", _unit, _unit, _previousWeaponIndex]; _unit selectWeapon _previousWeaponState;
_unit setVariable [QGVAR(previousWeapon), nil, true];
}; };
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set); [_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);

View File

@ -11,7 +11,7 @@
* Weight <NUMBER> * Weight <NUMBER>
* *
* Example: * Example:
* [cursorTarget] call ace_dragging_fnc_getWeight * cursorTarget call ace_dragging_fnc_getWeight
* *
* Public: No * Public: No
*/ */
@ -23,19 +23,20 @@ if (GVAR(weightCoefficient) == 0) exitWith {0};
private _weight = loadAbs _object; private _weight = loadAbs _object;
if !(GVAR(skipContainerWeight)) then { if (!GVAR(skipContainerWeight)) then {
// Add the mass of the object itself // Add the mass of the object itself
// getMass handles PhysX mass, this should be 0 for SupplyX containers and WeaponHolders // getMass handles PhysX mass, this should be 0 for SupplyX containers and WeaponHolders
// Use originalMass in case we're checking weight for a carried object // Use originalMass in case we're checking weight for a carried object
_weight = _weight + ((_object getVariable [QGVAR(originalMass), getMass _object])); _weight = _weight + (_object getVariable [QGVAR(originalMass), getMass _object]);
}; };
// Contents of backpacks get counted twice (https://github.com/acemod/ACE3/pull/8457#issuecomment-1062522447 and https://feedback.bistudio.com/T167469) // Fixed in https://feedback.bistudio.com/T167469 on 2.16 profiling branch and for 2.18 stable
// This is a workaround until that is fixed on BI's end if ((productVersion select 3) < 152017) then {
{ {
_x params ["", "_container"]; _x params ["", "_container"];
_weight = _weight - (loadAbs _container); _weight = _weight - (loadAbs _container);
} forEach (everyContainer _object); } forEach (everyContainer _object);
};
// Mass in Arma isn't an exact amount but rather a volume/weight value // Mass in Arma isn't an exact amount but rather a volume/weight value
// This attempts to work around that by making it a usable value (sort of) // This attempts to work around that by making it a usable value (sort of)

View File

@ -55,7 +55,7 @@ if (_target isKindOf "CAManBase") then {
}; };
// Select primary, otherwise the carry animation actions don't work // Select primary, otherwise the carry animation actions don't work
_unit selectWeapon _primaryWeapon; _unit selectWeapon _primaryWeapon; // This turns off lasers/lights
// Move a bit closer and adjust direction when trying to pick up a person // Move a bit closer and adjust direction when trying to pick up a person
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent; [QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
@ -67,10 +67,11 @@ if (_target isKindOf "CAManBase") then {
_timer = CBA_missionTime + 10; _timer = CBA_missionTime + 10;
} else { } else {
// Select no weapon and stop sprinting // Select no weapon and stop sprinting
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex); if (currentWeapon _unit != "") then {
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true]; _unit setVariable [QGVAR(previousWeapon), (weaponState _unit) select [0, 3], true];
_unit action ["SwitchWeapon", _unit, _unit, 299]; _unit action ["SwitchWeapon", _unit, _unit, 299];
};
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation); [_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);

View File

@ -46,7 +46,10 @@ if (!GVAR(dragAndFire)) then {
_primaryWeapon = "ACE_FakePrimaryWeapon"; _primaryWeapon = "ACE_FakePrimaryWeapon";
}; };
_unit selectWeapon _primaryWeapon; // Keep the laser/light on if the weapon is already selected
if (currentWeapon _unit != _primaryWeapon) then {
_unit selectWeapon _primaryWeapon;
};
} else { // Making sure the unit is holding a primary weapon or handgun } else { // Making sure the unit is holding a primary weapon or handgun
private _handgunWeapon = handgunWeapon _unit; private _handgunWeapon = handgunWeapon _unit;

View File

@ -1,25 +1,25 @@
#include "script_component.hpp" #include "script_component.hpp"
[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
// Only play sound if enabled in settings and enabled for the unit
if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;
if (!isServer) exitWith {};
["CBA_settingsInitialized", { ["CBA_settingsInitialized", {
TRACE_1("settingsInit",GVAR(enabled)); TRACE_1("settingsInitialized",GVAR(enabled));
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
// Only play sound if enabled in settings and enabled for the unit
if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;
if (!isServer) exitWith {};
GVAR(fireSources) = createHashMap; GVAR(fireSources) = createHashMap;
[QGVAR(addFireSource), { [QGVAR(addFireSource), {

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class SUBADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_medical_engine"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {};
url = ECSTRING(main,URL);
VERSION_CONFIG;
addonRootClass = QUOTE(ADDON);
};
};
#include "ACE_Medical_Treatment_Actions.hpp"

View File

@ -0,0 +1,3 @@
#define SUBCOMPONENT medical_engine
#define SUBCOMPONENT_BEAUTIFIED Medical Engine
#include "..\script_component.hpp"

View File

@ -1,20 +1,12 @@
#include "script_component.hpp" #include "script_component.hpp"
#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
name = COMPONENT_NAME; name = COMPONENT_NAME;
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_medical_engine"}; requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
authors[] = {"commy2", "tcvm"}; authors[] = {"commy2", "tcvm"};
url = ECSTRING(main,URL); url = ECSTRING(main,URL);
@ -25,7 +17,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp" #include "RscTitles.hpp"
#endif

View File

@ -148,19 +148,27 @@ params ["_unit", "_instigator"];
_unit call FUNC(burnReaction); _unit call FUNC(burnReaction);
}; };
if (!isNull _instigator) then { // Keep pain around unconsciousness limit to allow for more fun interactions
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
};
// Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/
private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3];
// Keep pain around unconciousness limit to allow for more fun interactions
private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)}); private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)});
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive if (GETEGVAR(medical,enabled,false)) then {
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent; if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
};
// Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/
private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3];
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent;
} else {
private _bodyParts = [["HitFace", "HitNeck", "HitHead"], ["HitPelvis", "HitAbdomen", "HitDiaphragm", "HitChest", "HitBody"], ["HitArms", "HitHands"], ["HitLegs"]] selectRandomWeighted [0.77, 0.5, 0.8, 0.3];
{
_unit setHitPointDamage [_x, (_unit getHitPointDamage _x) + _damageToAdd, true, _instigator, _instigator];
} forEach _bodyParts;
};
_unit setVariable [QGVAR(intensity), _intensity, true]; // Globally sync intensity across all clients to make sure simulation is deterministic _unit setVariable [QGVAR(intensity), _intensity, true]; // Globally sync intensity across all clients to make sure simulation is deterministic
}; };

View File

@ -5,7 +5,7 @@
LSTRING(Category_DisplayName), LSTRING(Category_DisplayName),
true, true,
1, 1,
{[QGVAR(fireEnabled), _this] call EFUNC(common,cbaSettings_settingChanged)}, {[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart true // Needs mission restart
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;

View File

@ -16,7 +16,14 @@
#endif #endif
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\medical_engine\script_macros_medical.hpp")
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp" #include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
#else
#define GET_PAIN_PERCEIVED(var) 0
#define PAIN_UNCONSCIOUS 1
#endif
#define FIRE_MANAGER_PFH_DELAY 0.25 #define FIRE_MANAGER_PFH_DELAY 0.25
#define FLARE_SIZE_MODIFIER 5 #define FLARE_SIZE_MODIFIER 5

View File

@ -25,7 +25,7 @@ private _hpData = (_hitData select 1) select _hitPartDataIndex;
private _objectHit = _hpData param [0, objNull]; private _objectHit = _hpData param [0, objNull];
TRACE_1("",_objectHit); TRACE_1("",_objectHit);
if ((isNil "_objectHit") || {isNull _objectHit}) exitWith {WARNING_1("Problem with hitPart data - bad object [%1]",_objectHit);}; if ((isNil "_objectHit") || {isNull _objectHit}) exitWith {WARNING_1("Problem with hitPart data - bad object [%1]",_objectHit);};
_objectHit removeEventHandler ["hitPart", _hpId]; _objectHit removeEventHandler ["HitPart", _hpId];
private _caliber = getNumber (configFile >> "CfgAmmo" >> _roundType >> "caliber"); private _caliber = getNumber (configFile >> "CfgAmmo" >> _roundType >> "caliber");
private _explosive = getNumber (configFile >> "CfgAmmo" >> _roundType >> "explosive"); private _explosive = getNumber (configFile >> "CfgAmmo" >> _roundType >> "explosive");

View File

@ -41,7 +41,7 @@ if (!alive _round) exitWith {
TRACE_1("doSpall",_foundObjectHPIds); TRACE_1("doSpall",_foundObjectHPIds);
{ {
if (!isNil "_x") then { if (!isNil "_x") then {
_x removeEventHandler ["hitPart", _foundObjectHPIds select _forEachIndex]; _x removeEventHandler ["HitPart", _foundObjectHPIds select _forEachIndex];
}; };
} forEach _spallTrack; } forEach _spallTrack;
}; };

View File

@ -31,7 +31,7 @@ if (_intersectsWith isEqualTo []) exitWith {};
{ {
// diag_log text format ["Adding HP: %1", _x]; // diag_log text format ["Adding HP: %1", _x];
private _index = count GVAR(spallHPData); private _index = count GVAR(spallHPData);
private _hpId = _x addEventHandler ["hitPart", compile format ["[%1, _this] call " + QFUNC(spallHP), _index]]; private _hpId = _x addEventHandler ["HitPart", compile format ["[%1, _this] call " + QFUNC(spallHP), _index]];
_foundObjects pushBack _x; _foundObjects pushBack _x;
_foundObjectHPIds pushBack _hpId; _foundObjectHPIds pushBack _hpId;
private _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds]; private _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds];

View File

@ -10,7 +10,7 @@
* Can Push <BOOL> * Can Push <BOOL>
* *
* Example: * Example:
* [target] call ace_interaction_fnc_canPush * cursorObject call ace_interaction_fnc_canPush
* *
* Public: No * Public: No
*/ */
@ -19,4 +19,5 @@ params ["_target"];
alive _target && alive _target &&
{getMass _target <= 2600 || getNumber (configOf _target >> QGVAR(canPush)) == 1} && {getMass _target <= 2600 || getNumber (configOf _target >> QGVAR(canPush)) == 1} &&
{vectorMagnitude velocity _target < 3} {vectorMagnitude velocity _target < 3} &&
{isNull isVehicleCargo _target} // Check if vehicle is loaded as ViV cargo

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar. * Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar.
* *
* Arguments: * Arguments:
* 0: Player <OBJECT> * 0: Player <OBJECT>
@ -11,7 +11,7 @@
* None * None
* *
* Example: * Example:
* [bob, mortar] call ace_mk6mortar_fnc_handlePlayerVehicleChanged; * [player, cursorObject] call ace_mk6mortar_fnc_handlePlayerVehicleChanged
* *
* Public: No * Public: No
*/ */
@ -24,83 +24,78 @@ if !(_newVehicle isKindOf "Mortar_01_base_F") exitWith {};
private _tubeWeaponName = (weapons _newVehicle) select 0; private _tubeWeaponName = (weapons _newVehicle) select 0;
private _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes"); private _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes");
//Restore last firemode: // Restore last firemode
private _lastFireMode = _newVehicle getVariable [QGVAR(lastFireMode), -1]; private _lastSavedWeaponsInfo = _newVehicle getVariable QGVAR(lastFireMode);
if (_lastFireMode != -1) then {
_player action ["SwitchWeapon", _newVehicle, _player, _lastFireMode]; if (!isNil "_lastSavedWeaponsInfo") then {
_newVehicle selectWeaponTurret [_lastSavedWeaponsInfo select 0, [0], _lastSavedWeaponsInfo select 1, _lastSavedWeaponsInfo select 2];
}; };
[{ [{
params ["_args", "_pfID"]; params ["_mortarVeh", "_pfhID"];
_args params ["_mortarVeh", "_fireModes"];
if ((vehicle ACE_player) != _mortarVeh) then { if ((vehicle ACE_player) != _mortarVeh) exitWith {
[_pfID] call CBA_fnc_removePerFrameHandler; _pfhID call CBA_fnc_removePerFrameHandler;
};
// Save firemode ('charge' from weaponstate) on vehicle
_mortarVeh setVariable [QGVAR(lastFireMode), (weaponState [_mortarVeh, [0]]) select [0, 3]];
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
// Don't like this solution, but it works
closeDialog 0;
[parseText "Computer Disabled"] call EFUNC(common,displayTextStructured);
};
private _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
if (isNull _display) exitWith {}; // It may be null for the first frame
// Hud should hidden in 3rd person
private _notGunnerView = cameraView != "GUNNER";
private _useMils = _mortarVeh getVariable [QGVAR(useMils), true];
// Get aiming values from ace_artillerytables
// Note: it also handles displaying the "charge" level
private _realAzimuth = missionNamespace getVariable [QEGVAR(artillerytables,predictedAzimuth), -1];
private _realElevation = missionNamespace getVariable [QEGVAR(artillerytables,predictedElevation), -1];
// Update Heading Display
if (_notGunnerView || !GVAR(allowCompass)) then {
(_display displayCtrl 80156) ctrlSetText "";
} else { } else {
if (_useMils) then {
private _useMils = _mortarVeh getVariable [QGVAR(useMils), true]; (_display displayCtrl 80156) ctrlSetText str (((round (_realAzimuth * 6400 / 360)) + 6400) % 6400);
//Compute: 'charge' from weaponstate
private _currentFireMode = (weaponState [_mortarVeh, [0]]) select 2;
private _currentChargeMode = _fireModes find _currentFireMode;
//Save firemode on vehicle:
_mortarVeh setVariable [QGVAR(lastFireMode), _currentChargeMode];
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
//Don't like this solution, but it works
closeDialog 0;
[parseText "Computer Disabled"] call EFUNC(common,displayTextStructured);
};
private _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull];
if (isNull _display) exitWith {}; //It may be null for the first frame
//Hud should hidden in 3rd person
private _notGunnerView = cameraView != "GUNNER";
// Get aiming values from ace_artillerytables
// Note: it also handles displaying the "charge" level
private _realAzimuth = missionNamespace getVariable [QEGVAR(artillerytables,predictedAzimuth), -1];
private _realElevation = missionNamespace getVariable [QEGVAR(artillerytables,predictedElevation), -1];
//Update Heading Display:
if (_notGunnerView || (!GVAR(allowCompass))) then {
(_display displayCtrl 80156) ctrlSetText "";
} else { } else {
(_display displayCtrl 80156) ctrlSetText str ((round (_realAzimuth + 360)) % 360);
};
};
// Update CurrentElevation Display
if (_notGunnerView) then {
(_display displayCtrl 80175) ctrlSetText "";
} else {
if (_useMils) then {
(_display displayCtrl 80175) ctrlSetText str ((round (_realElevation * 6400 / 360)) % 6400);
} else {
(_display displayCtrl 80175) ctrlSetText str (((round (_realElevation * 100)) / 100) % 360);
};
};
// Update ElevationNeeded Display
if (_notGunnerView || !GVAR(allowComputerRangefinder)) then {
(_display displayCtrl 80176) ctrlSetText "";
} else {
private _elevDeg = parseNumber ctrlText (_display displayCtrl 176);
if (_elevDeg <= 0) then { // Bad data means "----" out of range
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
} else {
_elevDeg = _elevDeg + (_realElevation - (parseNumber ctrlText (_display displayCtrl 175)));
if (_useMils) then { if (_useMils) then {
(_display displayCtrl 80156) ctrlSetText str (((round (_realAzimuth * 6400 / 360)) + 6400) % 6400); (_display displayCtrl 80176) ctrlSetText str round ((round (_elevDeg * 6400 / 360)) % 6400);
} else { } else {
(_display displayCtrl 80156) ctrlSetText str ((round (_realAzimuth + 360)) % 360); (_display displayCtrl 80176) ctrlSetText str (((round (_elevDeg * 100)) / 100) % 360);
};
};
//Update CurrentElevation Display
if (_notGunnerView) then {
(_display displayCtrl 80175) ctrlSetText "";
} else {
if (_useMils) then {
(_display displayCtrl 80175) ctrlSetText str ((round (_realElevation * 6400 / 360)) % 6400);
} else {
(_display displayCtrl 80175) ctrlSetText str (((round (_realElevation * 100)) / 100) % 360);
};
};
//Update ElevationNeeded Display:
if (_notGunnerView || (!GVAR(allowComputerRangefinder))) then {
(_display displayCtrl 80176) ctrlSetText "";
} else {
private _elevDeg = parseNumber ctrlText (_display displayCtrl 176);
if (_elevDeg <= 0) then { //Bad data means "----" out of range
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
} else {
_elevDeg = _elevDeg + (_realElevation - (parseNumber ctrlText (_display displayCtrl 175)));
if (_useMils) then {
(_display displayCtrl 80176) ctrlSetText str round ((round (_elevDeg * 6400 / 360)) % 6400);
} else {
(_display displayCtrl 80176) ctrlSetText str (((round (_elevDeg * 100)) / 100) % 360);
};
}; };
}; };
}; };
}, 0, [_newVehicle, _fireModes]] call CBA_fnc_addPerFrameHandler; }, 0, _newVehicle] call CBA_fnc_addPerFrameHandler;

View File

@ -2,9 +2,8 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
["ACE3 Movement", QGVAR(mount), [localize LSTRING(KeybindName), localize LSTRING(KeybindDescription)], "", { ["ACE3 Movement", QGVAR(mount), [LLSTRING(KeybindName), LLSTRING(KeybindDescription)], "", {
if (!dialog) then { if (!dialog) then {
[] call FUNC(getInNearest); call FUNC(getInNearest);
}; };
false
}] call CBA_fnc_addKeybind; }] call CBA_fnc_addKeybind;

View File

@ -1,131 +1,125 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
/* /*
* Author: Kingsley * Author: Kingsley
* Mount the player in the vehicle they are directly looking at based on their distance. * Mounts the player in the vehicle they are directly looking at based on their distance.
* *
* Arguments: * Arguments:
* 0: Target <OBJECT>(Optional) * 0: Target <OBJECT> (default: objNull)
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [] call ace_quickmount_fnc_getInNearest; * call ace_quickmount_fnc_getInNearest
* *
* Public: No * Public: No
*/ */
if (!GVAR(enabled) || if (
!GVAR(enabled) ||
{isNull ACE_player} || {isNull ACE_player} ||
{vehicle ACE_player != ACE_player} || {!isNull objectParent ACE_player} ||
{!alive ACE_player} || {!(ACE_player call EFUNC(common,isAwake))}
{ACE_player getVariable ["ace_unconscious", false]}
) exitWith {}; ) exitWith {};
params [["_interactionTarget", objNull, [objNull]]]; params [["_target", objNull, [objNull]]];
TRACE_1("getInNearest",_interactionTarget); TRACE_1("getInNearest",_target);
private _start = ACE_player modelToWorldVisualWorld (ACE_player selectionPosition "pilot"); // If target is not defined (e.g. keybind was used), search for valid target
private _end = (_start vectorAdd (getCameraViewDirection ACE_player vectorMultiply GVAR(distance))); if (isNull _target) then {
private _objects = lineIntersectsSurfaces [_start, _end, ACE_player]; private _start = ACE_player modelToWorldVisualWorld (ACE_player selectionPosition "pilot");
private _target = (_objects param [0, []]) param [2, objNull]; private _end = (_start vectorAdd (getCameraViewDirection ACE_player vectorMultiply GVAR(distance)));
private _objects = lineIntersectsSurfaces [_start, _end, ACE_player];
if ((isNull _target) && {alive _interactionTarget}) then {
_end = _start vectorAdd ((_start vectorFromTo (aimPos _interactionTarget)) vectorMultiply GVAR(distance));
_objects = lineIntersectsSurfaces [_start, _end, ACE_player];
TRACE_1("2nd ray attempt at interaction target aim pos",_objects);
_target = (_objects param [0, []]) param [2, objNull]; _target = (_objects param [0, []]) param [2, objNull];
}; };
if (locked _target in [2,3] || {!simulationEnabled _target}) exitWith { if (!alive _target) exitWith {};
[localize LSTRING(VehicleLocked)] call EFUNC(common,displayTextStructured);
true if (locked _target >= 2 || {!simulationEnabled _target}) exitWith {
[LLSTRING(VehicleLocked)] call EFUNC(common,displayTextStructured);
}; };
TRACE_2("",_target,typeOf _target); TRACE_2("",_target,typeOf _target);
if (!isNull _target && if (
{alive _target} && (speed _target > GVAR(speed)) ||
{{_target isKindOf _x} count ["Air","LandVehicle","Ship","StaticMortar"] > 0} && {["Air", "LandVehicle", "Ship", "StaticMortar"] findIf {_target isKindOf _x} == -1} ||
{([ACE_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} && {!([ACE_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith))}
{speed _target <= GVAR(speed)} ) exitWith {};
) then {
private _seats = ["driver", "gunner", "commander", "cargo"];
private _sortedSeats = [_seats select GVAR(priority)];
_seats deleteAt GVAR(priority);
_sortedSeats append _seats;
if (GVAR(priority) > 3 || GVAR(priority) < 0) then { private _fullCrew = fullCrew [_target, "", true];
GVAR(priority) = 0;
};
private _seats = ["Driver", "Gunner", "Commander", "Cargo"]; private _hasAction = false;
private _sortedSeats = [_seats select GVAR(priority)]; scopeName "SearchForSeat";
_seats deleteAt GVAR(priority);
_sortedSeats append _seats;
{
private _desiredRole = _x;
private _hasAction = false;
scopeName "SearchForSeat";
{ {
private _desiredRole = _x; _x params ["_unit", "_role", "_cargoIndex", "_turretPath"];
{
_x params ["_unit", "_role", "_cargoIndex", "_turretPath"];
if ((isNull _unit) || {!alive _unit}) then {
private _effectiveRole = toLowerANSI _role;
if ((_effectiveRole in ["driver", "gunner"]) && {unitIsUAV _target}) exitWith {}; // Ignoring UAV Driver/Gunner if (!alive _unit) then {
if ((_effectiveRole == "driver") && {(getNumber (configOf _target >> "hasDriver")) == 0}) exitWith {}; // Ignoring Non Driver (static weapons) private _effectiveRole = _role;
// Seats can be locked independently of the main vehicle if ((_effectiveRole in ["driver", "gunner"]) && {unitIsUAV _target}) exitWith {}; // Ignoring UAV Driver/Gunner
if ((_role == "driver") && {lockedDriver _target}) exitWith {TRACE_1("lockedDriver",_x);}; if ((_effectiveRole == "driver") && {(getNumber (configOf _target >> "hasDriver")) == 0}) exitWith {}; // Ignoring Non Driver (static weapons)
if ((_cargoIndex >= 0) && {_target lockedCargo _cargoIndex}) exitWith {TRACE_1("lockedCargo",_x);};
if ((_turretPath isNotEqualTo []) && {_target lockedTurret _turretPath}) exitWith {TRACE_1("lockedTurret",_x);};
if (_effectiveRole == "turret") then { // Seats can be locked independently of the main vehicle
private _turretConfig = [_target, _turretPath] call CBA_fnc_getTurret; if ((_effectiveRole == "driver") && {lockedDriver _target}) exitWith {TRACE_1("lockedDriver",_x);};
if (getNumber (_turretConfig >> "isCopilot") == 1) exitWith { if ((_cargoIndex >= 0) && {_target lockedCargo _cargoIndex}) exitWith {TRACE_1("lockedCargo",_x);};
_effectiveRole = "driver"; if ((_turretPath isNotEqualTo []) && {_target lockedTurret _turretPath}) exitWith {TRACE_1("lockedTurret",_x);};
};
if (
_cargoIndex >= 0 // FFV
|| {"" isEqualTo getText (_turretConfig >> "gun")} // turret without weapon
) exitWith {
_effectiveRole = "cargo";
};
_effectiveRole = "gunner"; // door gunners / 2nd turret
};
TRACE_2("",_effectiveRole,_x);
if (_effectiveRole != _desiredRole) exitWith {};
if (_turretPath isNotEqualTo []) then { if (_effectiveRole == "turret") then {
// Using GetInTurret seems to solve problems with incorrect GetInEH params when gunner/commander private _turretConfig = [_target, _turretPath] call CBA_fnc_getTurret;
ACE_player action ["GetInTurret", _target, _turretPath];
TRACE_3("Geting In Turret",_x,_role,_turretPath);
} else {
if (_cargoIndex > -1) then {
// GetInCargo expects the index of the seat in the "cargo" array from fullCrew
// See description: https://community.bistudio.com/wiki/fullCrew
private _cargoActionIndex = -1;
{
if ((_x select 2) == _cargoIndex) exitWith {_cargoActionIndex = _forEachIndex};
} forEach (fullCrew [_target, "cargo", true]);
ACE_player action ["GetInCargo", _target, _cargoActionIndex]; if (getNumber (_turretConfig >> "isCopilot") == 1) exitWith {
TRACE_4("Geting In Cargo",_x,_role,_cargoActionIndex,_cargoIndex); _effectiveRole = "driver";
} else {
ACE_player action ["GetIn" + _role, _target];
TRACE_2("Geting In",_x,_role);
};
}; };
_hasAction = true; if (
breakTo "SearchForSeat"; _cargoIndex >= 0 || // FFV
{getText (_turretConfig >> "gun") == ""} // Turret without weapon
) exitWith {
_effectiveRole = "cargo";
};
_effectiveRole = "gunner"; // Door gunners / 2nd turret
}; };
} forEach (fullCrew [_target, "", true]);
} forEach _sortedSeats;
if (!_hasAction) then { TRACE_2("",_effectiveRole,_x);
TRACE_1("no empty seats",_hasAction);
[localize LSTRING(VehicleFull)] call EFUNC(common,displayTextStructured); if (_effectiveRole != _desiredRole) exitWith {};
};
if (_turretPath isNotEqualTo []) then {
// Using GetInTurret seems to solve problems with incorrect GetInEH params when gunner/commander
ACE_player action ["GetInTurret", _target, _turretPath];
TRACE_3("Getting In Turret",_x,_role,_turretPath);
} else {
if (_cargoIndex > -1) then {
// GetInCargo expects the index of the seat in the "cargo" array from fullCrew
// See description: https://community.bistudio.com/wiki/fullCrew
private _cargoActionIndex = (fullCrew [_target, "cargo", true]) findIf {(_x select 2) == _cargoIndex};
ACE_player action ["GetInCargo", _target, _cargoActionIndex];
TRACE_4("Getting In Cargo",_x,_role,_cargoActionIndex,_cargoIndex);
} else {
ACE_player action ["GetIn" + _role, _target];
TRACE_2("Getting In",_x,_role);
};
};
_hasAction = true;
breakTo "SearchForSeat";
};
} forEach _fullCrew;
} forEach _sortedSeats;
if (!_hasAction) then {
TRACE_1("no empty seats",_hasAction);
[LLSTRING(VehicleFull)] call EFUNC(common,displayTextStructured);
}; };
true

View File

@ -28,7 +28,9 @@
#define REARM_HOLSTER_WEAPON \ #define REARM_HOLSTER_WEAPON \
_unit setVariable [QGVAR(selectedWeaponOnRearm), currentWeapon _unit]; \ if (currentWeapon _unit != "") then { \
_unit setVariable [QGVAR(selectedWeaponOnRearm), (weaponState _unit) select [0, 3]]; \
}; \
TRACE_2("REARM_HOLSTER_WEAPON",_unit,currentWeapon _unit); \ TRACE_2("REARM_HOLSTER_WEAPON",_unit,currentWeapon _unit); \
_unit action ["SwitchWeapon", _unit, _unit, 299]; _unit action ["SwitchWeapon", _unit, _unit, 299];

View File

@ -149,10 +149,15 @@ if (_callbackProgress == "") then {
// Player Animation // Player Animation
private _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); private _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE");
private _loopAnim = (getNumber (_config >> "loopAnimation")) isEqualTo 1; private _loopAnim = (getNumber (_config >> "loopAnimation")) isEqualTo 1;
_caller setVariable [QGVAR(selectedWeaponOnrepair), currentWeapon _caller];
private _currentWeapon = currentWeapon _caller;
if (_currentWeapon != "") then {
_caller setVariable [QGVAR(selectedWeaponOnrepair), (weaponState _caller) select [0, 3]];
};
// Cannot use secondairy weapon for animation // Cannot use secondairy weapon for animation
if (currentWeapon _caller == secondaryWeapon _caller) then { if (_currentWeapon == secondaryWeapon _caller) then {
_caller selectWeapon (primaryWeapon _caller); _caller selectWeapon (primaryWeapon _caller);
}; };

View File

@ -38,9 +38,11 @@ if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) th
_caller setVariable [QGVAR(repairCurrentAnimCaller), nil]; _caller setVariable [QGVAR(repairCurrentAnimCaller), nil];
_caller setVariable [QGVAR(repairPrevAnimCaller), nil]; _caller setVariable [QGVAR(repairPrevAnimCaller), nil];
private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); private _weaponSelect = _caller getVariable QGVAR(selectedWeaponOnrepair);
if (_weaponSelect != "") then {
if (!isNil "_weaponSelect") then {
_caller selectWeapon _weaponSelect; _caller selectWeapon _weaponSelect;
_caller setVariable [QGVAR(selectedWeaponOnrepair), nil];
} else { } else {
_caller action ["SwitchWeapon", _caller, _caller, 299]; _caller action ["SwitchWeapon", _caller, _caller, 299];
}; };

View File

@ -38,9 +38,11 @@ if (vehicle _caller == _caller && {!(_caller call EFUNC(common,isSwimming))}) th
_caller setVariable [QGVAR(repairCurrentAnimCaller), nil]; _caller setVariable [QGVAR(repairCurrentAnimCaller), nil];
_caller setVariable [QGVAR(repairPrevAnimCaller), nil]; _caller setVariable [QGVAR(repairPrevAnimCaller), nil];
private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnrepair), ""]); private _weaponSelect = _caller getVariable QGVAR(selectedWeaponOnrepair);
if (_weaponSelect != "") then {
if (!isNil "_weaponSelect") then {
_caller selectWeapon _weaponSelect; _caller selectWeapon _weaponSelect;
_caller setVariable [QGVAR(selectedWeaponOnrepair), nil];
} else { } else {
_caller action ["SwitchWeapon", _caller, _caller, 299]; _caller action ["SwitchWeapon", _caller, _caller, 299];
}; };

View File

@ -21,7 +21,7 @@ params ["_unit"];
// Saves the gear when the player! (and only him) is killed // Saves the gear when the player! (and only him) is killed
if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then { if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then {
_unit setVariable [QGVAR(unitGear), [_unit] call CBA_fnc_getLoadout]; _unit setVariable [QGVAR(unitGear), [_unit] call CBA_fnc_getLoadout];
_unit setVariable [QGVAR(activeWeaponAndMuzzle), [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]]; _unit setVariable [QGVAR(activeWeaponAndMuzzle), (weaponState _unit) select [0, 3]];
[QGVAR(saveGear), _unit] call CBA_fnc_localEvent; [QGVAR(saveGear), _unit] call CBA_fnc_localEvent;
}; };

View File

@ -5,7 +5,8 @@
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: All Gear based on return value of ACE_common_fnc_getAllGear <ARRAY> * 1: All Gear based on return value of ace_common_fnc_getAllGear <ARRAY>
* 2: All weapon info needed for restoring previous weapon status <ARRAY>
* *
* Return Value: * Return Value:
* None * None
@ -19,36 +20,12 @@
params ["_unit", "_allGear", "_activeWeaponAndMuzzle"]; params ["_unit", "_allGear", "_activeWeaponAndMuzzle"];
TRACE_3("restoreGear",_unit,count _allGear,_activeWeaponAndMuzzle); TRACE_3("restoreGear",_unit,count _allGear,_activeWeaponAndMuzzle);
// restore all gear // Restore all gear
if (!isNil "_allGear") then { if (!isNil "_allGear") then {
[_unit, _allGear] call CBA_fnc_setLoadout; [_unit, _allGear] call CBA_fnc_setLoadout;
}; };
// restore the last active weapon, muzzle and weaponMode // Restore the last active weapon, muzzle and weapon mode
if (!isNil "_activeWeaponAndMuzzle") then { if (!isNil "_activeWeaponAndMuzzle") then {
// @todo, replace this with CBA_fnc_selectWeapon after next CBA update _unit selectWeapon _activeWeaponAndMuzzle;
_activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
if (
(_activeMuzzle != "") &&
{_activeMuzzle != _activeWeapon} &&
{_activeMuzzle in getArray (configFile >> "CfgWeapons" >> _activeWeapon >> "muzzles")}
) then {
_unit selectWeapon _activeMuzzle;
} else {
if (_activeWeapon != "") then {
_unit selectWeapon _activeWeapon;
};
};
if (currentWeapon _unit != "") then {
private _index = 0;
while {
_index < 299 && {currentWeaponMode _unit != _activeWeaponMode}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
};
}; };

View File

@ -4,7 +4,7 @@
* Gets a random animations from the list. * Gets a random animations from the list.
* *
* Arguments: * Arguments:
* None * 0: Object to get animation pool from <OBJECT> (default: objNull)
* *
* Return Value: * Return Value:
* Random Animation <STRING> * Random Animation <STRING>
@ -15,30 +15,42 @@
* Public: No * Public: No
*/ */
params [["_object", objNull, [objNull]]];
private _animations = [];
if (!isNull _object) then {
_animations = getArray (configOf _object >> QGVAR(animations));
};
if (_animations isEqualTo []) then {
_animations = [
QGVAR(HubSittingChairA_idle1),
QGVAR(HubSittingChairA_idle2),
QGVAR(HubSittingChairA_idle3),
QGVAR(HubSittingChairA_move1),
QGVAR(HubSittingChairB_idle1),
QGVAR(HubSittingChairB_idle2),
QGVAR(HubSittingChairB_idle3),
QGVAR(HubSittingChairB_move1),
QGVAR(HubSittingChairC_idle1),
QGVAR(HubSittingChairC_idle2),
QGVAR(HubSittingChairC_idle3),
QGVAR(HubSittingChairC_move1),
QGVAR(HubSittingChairUA_idle1),
QGVAR(HubSittingChairUA_idle2),
QGVAR(HubSittingChairUA_idle3),
QGVAR(HubSittingChairUA_move1),
QGVAR(HubSittingChairUB_idle1),
QGVAR(HubSittingChairUB_idle2),
QGVAR(HubSittingChairUB_idle3),
QGVAR(HubSittingChairUB_move1),
QGVAR(HubSittingChairUC_idle1),
QGVAR(HubSittingChairUC_idle2),
QGVAR(HubSittingChairUC_idle3),
QGVAR(HubSittingChairUC_move1)
];
};
// Select random animation from Animations Pool // Select random animation from Animations Pool
selectRandom [ selectRandom _animations
QGVAR(HubSittingChairA_idle1),
QGVAR(HubSittingChairA_idle2),
QGVAR(HubSittingChairA_idle3),
QGVAR(HubSittingChairA_move1),
QGVAR(HubSittingChairB_idle1),
QGVAR(HubSittingChairB_idle2),
QGVAR(HubSittingChairB_idle3),
QGVAR(HubSittingChairB_move1),
QGVAR(HubSittingChairC_idle1),
QGVAR(HubSittingChairC_idle2),
QGVAR(HubSittingChairC_idle3),
QGVAR(HubSittingChairC_move1),
QGVAR(HubSittingChairUA_idle1),
QGVAR(HubSittingChairUA_idle2),
QGVAR(HubSittingChairUA_idle3),
QGVAR(HubSittingChairUA_move1),
QGVAR(HubSittingChairUB_idle1),
QGVAR(HubSittingChairUB_idle2),
QGVAR(HubSittingChairUB_idle3),
QGVAR(HubSittingChairUB_move1),
QGVAR(HubSittingChairUC_idle1),
QGVAR(HubSittingChairUC_idle2),
QGVAR(HubSittingChairUC_idle3),
QGVAR(HubSittingChairUC_move1)
]

View File

@ -48,7 +48,7 @@ if (_multiSitting) then {
}; };
// Get random animation and perform it (before moving player to ensure correct placement) // Get random animation and perform it (before moving player to ensure correct placement)
[_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations [_player, [_seat] call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations
[_player, "", 1] call EFUNC(common,doAnimation); // Correctly applies animation's config values (such as disallow throwing of grenades, intercept keybinds... etc). [_player, "", 1] call EFUNC(common,doAnimation); // Correctly applies animation's config values (such as disallow throwing of grenades, intercept keybinds... etc).
TRACE_2("Sit pos and dir",_sitPosition,_sitDirection); TRACE_2("Sit pos and dir",_sitPosition,_sitDirection);

View File

@ -132,6 +132,9 @@ if (_init) then {
GVAR(camDummy) = nil; GVAR(camDummy) = nil;
// Stop tracking everything // Stop tracking everything
{ deleteVehicle _x; } forEach GVAR(camLights);
GVAR(camLights) = nil;
GVAR(camMode) = nil; GVAR(camMode) = nil;
GVAR(camVision) = nil; GVAR(camVision) = nil;
GVAR(camFocus) = nil; GVAR(camFocus) = nil;
@ -144,6 +147,5 @@ if (_init) then {
GVAR(camYaw) = nil; GVAR(camYaw) = nil;
GVAR(camPitch) = nil; GVAR(camPitch) = nil;
GVAR(camSlow) = nil; GVAR(camSlow) = nil;
GVAR(camLights) = nil;
GVAR(camLight) = nil; GVAR(camLight) = nil;
}; };

View File

@ -35,3 +35,5 @@ if !(toLowerANSI (_filename select [count _filename - 4]) in [".wav", ".ogg", ".
}; };
playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance]; playSound3D [_filename, objNull, false, _position, _volume, _soundPitch, _distance];
nil // return

View File

@ -18,35 +18,23 @@
params ["_unit", "_weapon"]; params ["_unit", "_weapon"];
if (_weapon == "") exitWith {}; if (_weapon == "" || {!(_unit hasWeapon _weapon)}) exitWith {};
private _currentWeaponMode = (_unit weaponState _weapon) select 2;
private _muzzle = (_weapon call EFUNC(common,getWeaponMuzzles)) select 0;
if (currentWeapon _unit != _weapon) exitWith { if (currentWeapon _unit != _weapon) exitWith {
_unit selectWeapon _weapon; _unit selectWeapon [_weapon, _muzzle, _currentWeaponMode];
}; };
// unlock safety // Unlock safety
if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith { if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith {
[_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety); [_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety);
}; };
private _muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); private _modes = _weapon call EFUNC(common,getWeaponModes);
private _modes = [_weapon] call EFUNC(common,getWeaponModes);
private _index = (_modes find currentWeaponMode _unit) + 1; _unit selectWeapon [_weapon, _muzzle, _modes select (((_modes find _currentWeaponMode) + 1) % (count _modes))];
if (_index > count _modes - 1) then {_index = 0}; // Play fire mode selector sound
private _muzzle = _muzzles select 0;
private _mode = _modes select _index;
_index = 0;
while {
_index < 299 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
// play fire mode selector sound
[_unit, _weapon] call FUNC(playChangeFiremodeSound); [_unit, _weapon] call FUNC(playChangeFiremodeSound);

View File

@ -18,32 +18,22 @@
params ["_unit", "_weapon"]; params ["_unit", "_weapon"];
if (_weapon == "") exitWith {}; if (_weapon == "" || {!(_unit hasWeapon _weapon)}) exitWith {};
private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles); private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles);
if (currentWeapon _unit != _weapon) exitWith { if (count _muzzles <= 1) exitWith {};
if (count _muzzles > 1) then {
// unlock safety private _muzzle = (_unit weaponState _weapon) select 1;
/*if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith {
[_unit, _weapon, _muzzles select 1] call EFUNC(safemode,unlockSafety);
};*/
_unit selectWeapon (_muzzles select 1); private _index = if (currentWeapon _unit == _weapon) then {
}; (((_muzzles find currentMuzzle _unit) + 1) % (count _muzzles)) max 1
} else {
1
}; };
private _index = (_muzzles find currentMuzzle _unit) + 1;
if (_index > count _muzzles - 1) then {_index = 1};
private _muzzle = _muzzles select _index; private _muzzle = _muzzles select _index;
_index = 0; _unit selectWeapon [_weapon, _muzzle, ([_weapon, _muzzle] call EFUNC(common,getWeaponModes)) select 0];
while {
_index < 299 && {currentMuzzle _unit != _muzzle} nil // return
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};

View File

@ -240,6 +240,7 @@ ACE_plasmaIV_250 | Plasma IV (250ml) | ACE_ItemCore |
ACE_salineIV | Saline IV (1000ml) | ACE_ItemCore | ACE_salineIV | Saline IV (1000ml) | ACE_ItemCore |
ACE_salineIV_500 | Saline IV (500ml) | ACE_ItemCore | ACE_salineIV_500 | Saline IV (500ml) | ACE_ItemCore |
ACE_salineIV_250 | Saline IV (250ml) | ACE_ItemCore | ACE_salineIV_250 | Saline IV (250ml) | ACE_ItemCore |
ACE_suture | Suture | ACE_ItemCore |
ACE_surgicalKit | Surgical Kit | ACE_ItemCore | ACE_surgicalKit | Surgical Kit | ACE_ItemCore |
ACE_tourniquet | Tourniquet (CAT) | ACE_ItemCore | ACE_tourniquet | Tourniquet (CAT) | ACE_ItemCore |
ACE_medicalSupplyCrate | Simple ACE Medical Supply Crate | ammo box | ACE_medicalSupplyCrate | Simple ACE Medical Supply Crate | ammo box |

View File

@ -29,6 +29,7 @@ class CfgVehicles {
acex_sitting_sitDirection = 180; // Direction relative to object acex_sitting_sitDirection = 180; // Direction relative to object
acex_sitting_sitPosition[] = {0, -0.1, -0.45}; // Position relative to object (may behave weird with certain objects) acex_sitting_sitPosition[] = {0, -0.1, -0.45}; // Position relative to object (may behave weird with certain objects)
acex_sitting_interactPosition[] = {0, -0.1, -0.45}; acex_sitting_interactPosition[] = {0, -0.1, -0.45};
ace_sitting_animations[] = {"ace_sitting_HubSittingChairA_idle1"}; // Overwrite random animation pool
XEH_ENABLED; // Enable XEH (only necessary if XEH is not yet enabled for this class or the one this inherits from) XEH_ENABLED; // Enable XEH (only necessary if XEH is not yet enabled for this class or the one this inherits from)
}; };
}; };