mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Initial Sitting commit
This commit is contained in:
parent
be68284911
commit
c3c2fd0074
1
addons/sitting/$PBOPREFIX$
Normal file
1
addons/sitting/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
|||||||
|
z\ace\addons\sitting
|
5
addons/sitting/CfgEventHandlers.hpp
Normal file
5
addons/sitting/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class Extended_PreInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
|
};
|
||||||
|
};
|
99
addons/sitting/CfgVehicles.hpp
Normal file
99
addons/sitting/CfgVehicles.hpp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#define MACRO_SEAT_ACTION \
|
||||||
|
class ACE_Actions { \
|
||||||
|
class ACE_MainActions { \
|
||||||
|
displayName = ECSTRING(interaction,MainAction); \
|
||||||
|
selection = ""; \
|
||||||
|
distance = 1.25; \
|
||||||
|
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 CfgVehicles {
|
||||||
|
class Man;
|
||||||
|
class CAManBase: Man {
|
||||||
|
class ACE_SelfActions {
|
||||||
|
class GVAR(Stand) {
|
||||||
|
displayName = CSTRING(Stand);
|
||||||
|
condition = QUOTE(_player call FUNC(canStand));
|
||||||
|
statement = QUOTE(_player call FUNC(stand));
|
||||||
|
priority = 0;
|
||||||
|
//icon = PATHTOF(UI\sit_ca.paa);
|
||||||
|
//add exception isNotSitting to everything that shouldn't be available (eg. medical)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class ThingX;
|
||||||
|
// Folding Chair
|
||||||
|
class Land_CampingChair_V1_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
||||||
|
};
|
||||||
|
// Camping Chair
|
||||||
|
class Land_CampingChair_V2_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, -0.1, -0.45};
|
||||||
|
};
|
||||||
|
// Chair (Plastic)
|
||||||
|
class Land_ChairPlastic_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 90;
|
||||||
|
GVAR(sitPosition[]) = {-0.1, 0, -0.2};
|
||||||
|
};
|
||||||
|
// Chair (Wooden)
|
||||||
|
class Land_ChairWood_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, 0, 0};
|
||||||
|
};
|
||||||
|
// Office Chair
|
||||||
|
class Land_OfficeChair_01_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, 0, -0.6};
|
||||||
|
};
|
||||||
|
// Rattan Chair
|
||||||
|
class Land_RattanChair_01_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0.07, 0.17, 1};
|
||||||
|
};
|
||||||
|
// Field Toilet
|
||||||
|
class Land_FieldToilet_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, 0.75, -1.1};
|
||||||
|
};
|
||||||
|
// Toiletbox
|
||||||
|
class Land_ToiletBox_F: ThingX {
|
||||||
|
XEH_ENABLED;
|
||||||
|
MACRO_SEAT_ACTION
|
||||||
|
GVAR(canSit) = 1;
|
||||||
|
GVAR(sitDirection) = 180;
|
||||||
|
GVAR(sitPosition[]) = {0, 0.75, -1.1};
|
||||||
|
};
|
||||||
|
};
|
11
addons/sitting/XEH_preInit.sqf
Normal file
11
addons/sitting/XEH_preInit.sqf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(canSit);
|
||||||
|
PREP(canStand);
|
||||||
|
PREP(getRandomAnimation);
|
||||||
|
PREP(sit);
|
||||||
|
PREP(stand);
|
||||||
|
|
||||||
|
ADDON = true;
|
16
addons/sitting/config.cpp
Normal file
16
addons/sitting/config.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
class CfgPatches {
|
||||||
|
class ADDON {
|
||||||
|
units[] = {};
|
||||||
|
weapons[] = {};
|
||||||
|
requiredVersion = REQUIRED_VERSION;
|
||||||
|
requiredAddons[] = {"ace_common"};
|
||||||
|
author[] = {"Jonpas"};
|
||||||
|
authorUrl = "https://github.com/jonpas";
|
||||||
|
VERSION_CONFIG;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "CfgEventHandlers.hpp"
|
||||||
|
#include "CfgVehicles.hpp"
|
27
addons/sitting/functions/fnc_canSit.sqf
Normal file
27
addons/sitting/functions/fnc_canSit.sqf
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Check if the player can sit down.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Seat <OBJECT>
|
||||||
|
* 1: Player <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can Sit Down <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [seat, player] call ace_sitting_fnc_canSit;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
PARAMS_2(_seat,_player);
|
||||||
|
|
||||||
|
// If seat object and not occupied
|
||||||
|
if (getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1 &&
|
||||||
|
{isNil{_seat getVariable QGVAR(seatOccupied)}}
|
||||||
|
) exitWith {true};
|
||||||
|
|
||||||
|
// Default
|
||||||
|
false
|
22
addons/sitting/functions/fnc_canStand.sqf
Normal file
22
addons/sitting/functions/fnc_canStand.sqf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Check if the player can stand up (is in sitting position).
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* Player <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Can Stand Up <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* player call ace_sitting_fnc_canStand;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// If sitting
|
||||||
|
if (_this getVariable [QGVAR(sitting),false]) exitWith {true};
|
||||||
|
|
||||||
|
// Default
|
||||||
|
false
|
55
addons/sitting/functions/fnc_getRandomAnimation.sqf
Normal file
55
addons/sitting/functions/fnc_getRandomAnimation.sqf
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Gets a random animations from the list.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Random Animation <STRING>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* _animation = call ace_sitting_fnc_getRandomAnimation;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// Animations Pool
|
||||||
|
_animPool = [
|
||||||
|
"HubSittingChairUA_idle1",
|
||||||
|
"HubSittingChairUA_idle2",
|
||||||
|
"HubSittingChairUA_idle3",
|
||||||
|
"HubSittingChairUA_move1",
|
||||||
|
"HubSittingChairUB_idle1",
|
||||||
|
"HubSittingChairUB_idle2",
|
||||||
|
"HubSittingChairUB_idle3",
|
||||||
|
"HubSittingChairUB_move1",
|
||||||
|
"HubSittingChairUC_idle1",
|
||||||
|
"HubSittingChairUC_idle2",
|
||||||
|
"HubSittingChairUC_idle3",
|
||||||
|
"HubSittingChairUC_move1",
|
||||||
|
"HubSittingChairA_idle1",
|
||||||
|
"HubSittingChairA_idle2",
|
||||||
|
"HubSittingChairA_idle3",
|
||||||
|
"HubSittingChairA_move1",
|
||||||
|
"HubSittingChairB_idle1",
|
||||||
|
"HubSittingChairB_idle2",
|
||||||
|
"HubSittingChairB_idle3",
|
||||||
|
"HubSittingChairB_move1",
|
||||||
|
"HubSittingChairC_idle1",
|
||||||
|
"HubSittingChairC_idle2",
|
||||||
|
"HubSittingChairC_idle3",
|
||||||
|
"HubSittingChairC_move1"
|
||||||
|
];
|
||||||
|
|
||||||
|
// Set all animation names to lower-case
|
||||||
|
_animations = [];
|
||||||
|
{
|
||||||
|
_animations pushBack (toLower _x);
|
||||||
|
} forEach _animPool;
|
||||||
|
|
||||||
|
// Select random animation
|
||||||
|
_animation = _animations select (floor (random (count _animations)));
|
||||||
|
|
||||||
|
_animation
|
41
addons/sitting/functions/fnc_sit.sqf
Normal file
41
addons/sitting/functions/fnc_sit.sqf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Sits down the player.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Seat <OBJECT>
|
||||||
|
* 1: Player <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [seat, player] call ace_sitting_fnc_sit;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
PARAMS_2(_seat,_player);
|
||||||
|
|
||||||
|
// Set global variable for standing up
|
||||||
|
GVAR(seat) = _seat;
|
||||||
|
|
||||||
|
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
||||||
|
_player switchMove "amovpknlmstpsraswrfldnon";
|
||||||
|
|
||||||
|
// Read config
|
||||||
|
_sitDirection = getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(sitDirection));
|
||||||
|
_sitPosition = getArray (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(sitPosition));
|
||||||
|
|
||||||
|
// Set direction and position
|
||||||
|
_player setDir ((getDir _seat) + _sitDirection);
|
||||||
|
_player setPos (_seat modelToWorld _sitPosition);
|
||||||
|
|
||||||
|
// Get random animation and perform it
|
||||||
|
_animation = call FUNC(getRandomAnimation);
|
||||||
|
[_player, _animation, 2] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
|
// Set variables
|
||||||
|
_player setVariable [QGVAR(sitting), true];
|
||||||
|
_seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat
|
23
addons/sitting/functions/fnc_stand.sqf
Normal file
23
addons/sitting/functions/fnc_stand.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Author: Jonpas
|
||||||
|
* Stands up the player.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* Player <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* player call ace_sitting_fnc_stand;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// Restore animation
|
||||||
|
[_this, "", 2] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
|
// Set variables to nil
|
||||||
|
_this setVariable [QGVAR(sitting), nil];
|
||||||
|
GVAR(seat) setVariable [QGVAR(seatOccupied), nil, true];
|
1
addons/sitting/functions/script_component.hpp
Normal file
1
addons/sitting/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "\z\ace\addons\sitting\script_component.hpp"
|
12
addons/sitting/script_component.hpp
Normal file
12
addons/sitting/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#define COMPONENT sitting
|
||||||
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
|
#ifdef DEBUG_ENABLED_SITTING
|
||||||
|
#define DEBUG_MODE_FULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_SETTINGS_SITTING
|
||||||
|
#define DEBUG_SETTINGS DEBUG_SETTINGS_SITTING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "\z\ace\addons\main\script_macros.hpp"
|
11
addons/sitting/stringtable.xml
Normal file
11
addons/sitting/stringtable.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project name="ACE">
|
||||||
|
<Package name="Sitting">
|
||||||
|
<Key ID="STR_ACE_Sitting_Sit">
|
||||||
|
<English>Sit Down</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Sitting_Stand">
|
||||||
|
<English>Stand Up</English>
|
||||||
|
</Key>
|
||||||
|
</Package>
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user