mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Sitting Cleanup
- Add modern privates - Don't add actions, canInteractWith, or EH if not enabled
This commit is contained in:
parent
6a21b7da1e
commit
d372111d3f
@ -3,9 +3,16 @@
|
||||
// Exit on Headless
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Add interaction menu exception
|
||||
["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition);
|
||||
["SettingsInitialized", {
|
||||
TRACE_1("SettingInit", GVAR(enable));
|
||||
|
||||
//If not enabled, dont't add CanInteractWith Condition or event handlers:
|
||||
if (!GVAR(enable)) exitWith {};
|
||||
|
||||
// Handle interruptions
|
||||
["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler);
|
||||
["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler);
|
||||
// Add interaction menu exception
|
||||
["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition);
|
||||
|
||||
// Handle interruptions
|
||||
["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler);
|
||||
["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -16,19 +16,28 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_seat"];
|
||||
private ["_type", "_sitAction"];
|
||||
|
||||
_type = typeOf _seat;
|
||||
private _type = typeOf _seat;
|
||||
|
||||
// Exit if the object is not specified as a seat
|
||||
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canSit)) != 1) exitWith {};
|
||||
|
||||
// only run this after the settings are initialized
|
||||
if !(EGVAR(common,settingsInitFinished)) exitWith {
|
||||
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addSitActions), _this];
|
||||
};
|
||||
|
||||
//If not enabled, don't add actions:
|
||||
if (!GVAR(enable)) exitWith {};
|
||||
|
||||
// Exit if class already initialized
|
||||
if (_type in GVAR(initializedClasses)) exitWith {};
|
||||
|
||||
GVAR(initializedClasses) pushBack _type;
|
||||
|
||||
_sitAction = [
|
||||
TRACE_1("Adding Sit Action",_type);
|
||||
|
||||
private _sitAction = [
|
||||
QGVAR(Sit),
|
||||
localize LSTRING(Sit),
|
||||
QUOTE(PATHTOF(UI\sit_ca.paa)),
|
||||
|
@ -15,10 +15,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_animations";
|
||||
|
||||
// Animations Pool
|
||||
_animations = [
|
||||
private _animations = [
|
||||
QGVAR(HubSittingChairA_idle1),
|
||||
QGVAR(HubSittingChairA_idle2),
|
||||
QGVAR(HubSittingChairA_idle3),
|
||||
|
@ -16,15 +16,13 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_seatPosOrig"];
|
||||
|
||||
params ["_seat", "_player"];
|
||||
|
||||
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
||||
_player switchMove "amovpknlmstpsraswrfldnon";
|
||||
|
||||
// Add scroll-wheel action to release object
|
||||
_actionID = _player addAction [
|
||||
private _actionID = _player addAction [
|
||||
format ["<t color='#FFFF00'>%1</t>", localize LSTRING(Stand)],
|
||||
QUOTE((_this select 0) call FUNC(stand)),
|
||||
nil,
|
||||
@ -36,9 +34,9 @@ _actionID = _player addAction [
|
||||
];
|
||||
|
||||
// Read config
|
||||
_configFile = configFile >> "CfgVehicles" >> typeOf _seat;
|
||||
_sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection));
|
||||
_sitPosition = getArray (_configFile >> QGVAR(sitPosition));
|
||||
private _configFile = configFile >> "CfgVehicles" >> typeOf _seat;
|
||||
private _sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection));
|
||||
private _sitPosition = getArray (_configFile >> QGVAR(sitPosition));
|
||||
|
||||
// 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
|
||||
@ -55,7 +53,7 @@ _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple peop
|
||||
|
||||
|
||||
// Add automatical stand PFH in case of interruptions
|
||||
_seatPosOrig = getPosASL _seat;
|
||||
private _seatPosOrig = getPosASL _seat;
|
||||
[{
|
||||
params ["_args", "_pfhId"];
|
||||
_args params ["_player", "_seat", "_seatPosOrig"];
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_player"];
|
||||
private ["_animation"];
|
||||
|
||||
(_player getVariable QGVAR(isSitting)) params ["_seat", "_actionID"];
|
||||
|
||||
@ -24,7 +23,7 @@ private ["_animation"];
|
||||
_player removeAction _actionID;
|
||||
|
||||
// Restore animation
|
||||
_animation = switch (currentWeapon _player) do {
|
||||
private _animation = switch (currentWeapon _player) do {
|
||||
case "": {"amovpercmstpsnonwnondnon"};
|
||||
case (primaryWeapon _player): {"amovpercmstpslowwrfldnon"};
|
||||
case (handgunWeapon _player): {"amovpercmstpslowwpstdnon"};
|
||||
|
Loading…
Reference in New Issue
Block a user