mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Better sitting framework in terms of interactions
This commit is contained in:
parent
e3985dce3e
commit
a7a716ca8d
@ -17,3 +17,11 @@ class Extended_Killed_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_InitPost_EventHandlers {
|
||||||
|
class All {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(_this call DFUNC(addSitActions))
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -34,29 +34,10 @@ class CfgVehicles {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MACRO_SEAT_ACTION \
|
|
||||||
class ACE_Actions { \
|
|
||||||
class ACE_MainActions { \
|
|
||||||
displayName = ECSTRING(interaction,MainAction); \
|
|
||||||
selection = ""; \
|
|
||||||
distance = 1.5; \
|
|
||||||
condition = "true"; \
|
|
||||||
class GVAR(Sit) { \
|
|
||||||
displayName = CSTRING(Sit); \
|
|
||||||
condition = QUOTE(_this call FUNC(canSit)); \
|
|
||||||
statement = QUOTE(_this call FUNC(sit)); \
|
|
||||||
showDisabled = 0; \
|
|
||||||
priority = 0; \
|
|
||||||
icon = PATHTOF(UI\sit_ca.paa); \
|
|
||||||
}; \
|
|
||||||
}; \
|
|
||||||
};
|
|
||||||
|
|
||||||
class ThingX;
|
class ThingX;
|
||||||
// Folding Chair
|
// Folding Chair
|
||||||
class Land_CampingChair_V1_F: ThingX {
|
class Land_CampingChair_V1_F: ThingX {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 180;
|
GVAR(sitDirection) = 180;
|
||||||
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
||||||
@ -64,7 +45,6 @@ class CfgVehicles {
|
|||||||
// Camping Chair
|
// Camping Chair
|
||||||
class Land_CampingChair_V2_F: ThingX {
|
class Land_CampingChair_V2_F: ThingX {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 180;
|
GVAR(sitDirection) = 180;
|
||||||
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
||||||
@ -74,7 +54,6 @@ class CfgVehicles {
|
|||||||
// Chair (Plastic)
|
// Chair (Plastic)
|
||||||
class Land_ChairPlastic_F: Furniture_base_F {
|
class Land_ChairPlastic_F: Furniture_base_F {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 90;
|
GVAR(sitDirection) = 90;
|
||||||
GVAR(sitPosition[]) = {0, 0, -0.5};
|
GVAR(sitPosition[]) = {0, 0, -0.5};
|
||||||
@ -82,7 +61,6 @@ class CfgVehicles {
|
|||||||
// Chair (Wooden)
|
// Chair (Wooden)
|
||||||
class Land_ChairWood_F: Furniture_base_F {
|
class Land_ChairWood_F: Furniture_base_F {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 180;
|
GVAR(sitDirection) = 180;
|
||||||
GVAR(sitPosition[]) = {0, -0.05, 0};
|
GVAR(sitPosition[]) = {0, -0.05, 0};
|
||||||
@ -90,7 +68,6 @@ class CfgVehicles {
|
|||||||
// Office Chair
|
// Office Chair
|
||||||
class Land_OfficeChair_01_F: Furniture_base_F {
|
class Land_OfficeChair_01_F: Furniture_base_F {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 180;
|
GVAR(sitDirection) = 180;
|
||||||
GVAR(sitPosition[]) = {0, 0, -0.6};
|
GVAR(sitPosition[]) = {0, 0, -0.6};
|
||||||
@ -98,7 +75,6 @@ class CfgVehicles {
|
|||||||
// Rattan Chair
|
// Rattan Chair
|
||||||
class Land_RattanChair_01_F: Furniture_base_F {
|
class Land_RattanChair_01_F: Furniture_base_F {
|
||||||
XEH_ENABLED;
|
XEH_ENABLED;
|
||||||
MACRO_SEAT_ACTION
|
|
||||||
GVAR(canSit) = 1;
|
GVAR(canSit) = 1;
|
||||||
GVAR(sitDirection) = 180;
|
GVAR(sitDirection) = 180;
|
||||||
GVAR(sitPosition[]) = {0, -0.1, -1}; // Z must be -1 due to chair's geometry (magic floating seat point)
|
GVAR(sitPosition[]) = {0, -0.1, -1}; // Z must be -1 due to chair's geometry (magic floating seat point)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(addSitActions);
|
||||||
PREP(canSit);
|
PREP(canSit);
|
||||||
PREP(canStand);
|
PREP(canStand);
|
||||||
PREP(getRandomAnimation);
|
PREP(getRandomAnimation);
|
||||||
@ -10,4 +11,6 @@ PREP(moduleInit);
|
|||||||
PREP(sit);
|
PREP(sit);
|
||||||
PREP(stand);
|
PREP(stand);
|
||||||
|
|
||||||
|
GVAR(initializedClasses) = [];
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
42
addons/sitting/functions/fnc_addSitActions.sqf
Normal file
42
addons/sitting/functions/fnc_addSitActions.sqf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Adds sit actions.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Seat <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [seat] call ace_sitting_fnc_addSitActions
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_seat"];
|
||||||
|
private ["_type", "_sitAction"];
|
||||||
|
|
||||||
|
_type = typeOf _seat;
|
||||||
|
|
||||||
|
// Exit if the object is not specified as a seat
|
||||||
|
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canSit)) != 1) exitWith {};
|
||||||
|
|
||||||
|
// Exit if class already initialized
|
||||||
|
if (_type in GVAR(initializedClasses)) exitWith {};
|
||||||
|
|
||||||
|
GVAR(initializedClasses) pushBack _type;
|
||||||
|
|
||||||
|
_sitAction = [
|
||||||
|
QGVAR(Sit),
|
||||||
|
localize LSTRING(Sit),
|
||||||
|
QUOTE(PATHTOF(UI\sit_ca.paa)),
|
||||||
|
{_this call FUNC(sit)},
|
||||||
|
{_this call FUNC(canSit)},
|
||||||
|
{},
|
||||||
|
[],
|
||||||
|
[0, 0, 0],
|
||||||
|
1.5
|
||||||
|
] call EFUNC(interact_menu,createAction);
|
||||||
|
[_type, 0, ["ACE_MainActions"], _sitAction] call EFUNC(interact_menu,addActionToClass);
|
@ -4,22 +4,20 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Seat <OBJECT>
|
* 0: Seat <OBJECT>
|
||||||
* 1: Player <OBJECT>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Can Sit Down <BOOL>
|
* Can Sit Down <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [seat, player] call ace_sitting_fnc_canSit
|
* [seat] call ace_sitting_fnc_canSit
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_seat", "_player"];
|
params ["_seat"];
|
||||||
|
|
||||||
// Sitting enabled, is seat object, not occupied and standing up (or not on a big slope)
|
// Sitting enabled, is seat object, not occupied and standing up (or not on a big slope)
|
||||||
GVAR(enable) &&
|
GVAR(enable) &&
|
||||||
{getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1} &&
|
|
||||||
{isNil {_seat getVariable QGVAR(seatOccupied)}} &&
|
{isNil {_seat getVariable QGVAR(seatOccupied)}} &&
|
||||||
{round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}}
|
{round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}}
|
||||||
|
@ -21,7 +21,7 @@ private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_seatPosO
|
|||||||
params ["_seat", "_player"];
|
params ["_seat", "_player"];
|
||||||
|
|
||||||
// Set global variable for standing up
|
// Set global variable for standing up
|
||||||
GVAR(seat) = _seat;
|
GVAR(seat) = _seat; //@todo - put into player isSitting variable
|
||||||
|
|
||||||
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
||||||
_player switchMove "amovpknlmstpsraswrfldnon";
|
_player switchMove "amovpknlmstpsraswrfldnon";
|
||||||
|
Loading…
Reference in New Issue
Block a user