Merge branch 'master' into microDAGR

This commit is contained in:
PabstMirror 2015-03-18 13:46:57 -05:00
commit 7688384971
197 changed files with 5431 additions and 3340 deletions

View File

@ -27,12 +27,11 @@ if (isServer) then {
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler);
//TODO: Medical Integration Events???
//Medical Integration Events???
["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler);
// [_unit, "knockedOut", {
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut};
// }] call ACE_Core_fnc_addCustomEventhandler;
if (!hasInterface) exitWith {};
// [_unit, "wokeUp", {
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp};
// }] call ACE_Core_fnc_addCustomEventhandler;
["isNotEscorting", {!(GETVAR(_this select 0,GVAR(isEscorting),false))}] call EFUNC(common,addCanInteractWithCondition);
["isNotHandcuffed", {!(GETVAR(_this select 0,GVAR(isHandcuffed),false))}] call EFUNC(common,addCanInteractWithCondition);
["isNotSurrendering", {!(GETVAR(_this select 0,GVAR(isSurrendering),false))}] call EFUNC(common,addCanInteractWithCondition);

View File

@ -19,10 +19,9 @@ PREP(doUnloadCaptive);
PREP(handleGetIn);
PREP(handleGetOut);
PREP(handleKilled);
PREP(handleKnockedOut);
PREP(handleOnUnconscious);
PREP(handlePlayerChanged);
PREP(handleUnitInitPost);
PREP(handleWokeUp);
PREP(handleZeusDisplayChanged);
PREP(moduleSurrender);
PREP(setHandcuffed);

View File

@ -16,16 +16,3 @@ class CfgPatches {
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
class ACE_canInteractConditions {
class GVAR(isNotEscorting) {
condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
};
class GVAR(isNotHandcuffed) {
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
};
class GVAR(isNotSurrendering) {
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
};
};

View File

@ -51,7 +51,7 @@ if (_state) then {
_unit setVariable [QGVAR(escortedUnit), objNull, true];
};
};
[_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
[_escortFnc, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
} else {
_unit setVariable [QGVAR(isEscorting), false, true];

View File

@ -1,25 +0,0 @@
/*
* Author: commy2, PabstMirror
* Handles when a unit gets knocked out. Ends surrendering.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [bob, true] call ACE_captives_fnc_handleKnockedOut
*
* Public: No
*/
#include "script_component.hpp"
//ToDo: Waiting on medical integration
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
[_unit, false] call FUNC(setSurrendered);
};

View File

@ -0,0 +1,36 @@
/*
* Author: commy2, PabstMirror
* Handles the "medical_onUnconscious" event
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Is Unconsisisiouses <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* [bob, true] call ACE_captives_fnc_handleOnUnconscious
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_isUnconc);
if (!local _unit) exitWith {};
systemChat format ["med: %1", _this];
if (_isUnconc) then {
//Knocked out: If surrendering, stop
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
[_unit, false] call FUNC(setSurrendered);
};
} else {
//Woke up: if handcuffed, goto animation
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
};
};

View File

@ -1,23 +0,0 @@
/*
* Author: commy2
* TODO
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob] call ACE_captives_fnc_handleWokeUp
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
};

View File

@ -52,7 +52,7 @@ if (_state) then {
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
PARAMS_2(_unit,_newAnimation);
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
ERROR("Handcuff animation interrupted");
systemChat format ["debug %2: new %1", _newAnimation, time];
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
@ -71,8 +71,8 @@ if (_state) then {
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
if ((vehicle _unit) == _unit) then {
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
if (((vehicle _unit) == _unit) && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
//Break out of hands up animation loop
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
};

View File

@ -50,7 +50,7 @@ if (_state) then {
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
PARAMS_2(_unit,_newAnimation);
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
ERROR("Surrender animation interrupted");
systemChat format ["debug %2: new %1", _newAnimation, time];
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);

View File

@ -7,14 +7,22 @@ class CfgWeapons {
simulation = "ItemMineDetector";
};
class Rifle_Base_F;
class Rifle;
class Rifle_Base_F: Rifle {
class WeaponSlotsInfo;
};
class ACE_FakePrimaryWeapon: Rifle_Base_F {
scope = 2;
displayName = "";
model = "";
picture = "";
magazines[] = {"ACE_FakeMagazine"};
discreteDistance[] = {};
discreteDistanceInitIndex = 0;
displayName = "";
picture = "";
model = "";
magazines[] = {"ACE_FakeMagazine"};
scope = 2;
class WeaponSlotsInfo: WeaponSlotsInfo {
mass = 0;
};
};
};

View File

@ -20,6 +20,19 @@ if (hasInterface) then {
};
}] call FUNC(addEventhandler);
["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler);
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
["lockVehicle", {
_this setVariable [QGVAR(lockStatus), locked _this];
_this lock 2;
}] call FUNC(addEventhandler);
["unlockVehicle", {
_this lock (_this getVariable [QGVAR(lockStatus), locked _this]);
}] call FUNC(addEventhandler);
// hack to get PFH to work in briefing
[QGVAR(onBriefingPFH), "onEachFrame", {
if (time > 0) exitWith {
@ -55,8 +68,6 @@ if (_currentVersion != _previousVersion) then {
if (!hasInterface) exitWith {};
call COMPILE_FILE(scripts\assignedItemFix);
call COMPILE_FILE(scripts\initCanInteractFunction);
call COMPILE_FILE(scripts\initScrollWheel);
0 spawn {
@ -88,6 +99,7 @@ GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
GVAR(OldCameraView) = cameraView;
GVAR(OldPlayerVehicle) = vehicle ACE_player;
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
// PFH to raise varios events
[{
@ -148,6 +160,14 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
};
// "playerWeaponChanged" event
_newPlayerWeapon = currentWeapon ACE_player;
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
};
}, 0, []] call cba_fnc_addPerFrameHandler;
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
@ -161,3 +181,5 @@ _vehicle setFuel _fuelLevel;
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);

View File

@ -7,6 +7,7 @@ ADDON = false;
PREP(addActionEventHandler);
PREP(addActionMenuEventHandler);
PREP(addCameraEventHandler);
PREP(addCanInteractWithCondition);
PREP(addCustomEventHandler);
PREP(addLineToDebugDraw);
PREP(addMapMarkerCreatedEventHandler);
@ -54,7 +55,10 @@ PREP(execPersistentFnc);
PREP(execRemoteFnc);
PREP(executePersistent);
PREP(filter);
PREP(fixCollision);
PREP(fixFloating);
PREP(fixLoweredRifleAnimation);
PREP(fixPosition);
PREP(getAllDefinedSetVariables);
PREP(getAllGear);
PREP(getCaptivityStatus);
@ -147,6 +151,7 @@ PREP(receiveRequest);
PREP(removeActionEventHandler);
PREP(removeActionMenuEventHandler);
PREP(removeCameraEventHandler);
PREP(removeCanInteractWithCondition);
PREP(removeCustomEventHandler);
PREP(removeMapMarkerCreatedEventHandler);
PREP(removeScrollWheelEventHandler);

View File

@ -51,12 +51,6 @@ class ACE_Rsc_Control_Base {
h = 0;
};
class ACE_canInteractConditions {
class GVAR(notOnMap) {
condition = "!visibleMap";
};
};
class ACE_Settings {
/*
*class GVAR(sampleSetting) {

View File

@ -0,0 +1,38 @@
/*
* Author: commy2
*
* Add a condition that gets checked by ace_common_fnc_canInteractWith.
*
* Arguments:
* 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String)
* 1: The condition to check. format of "_this" is "[_player, _target]". (Code)
*
* Return Value:
* Unit can interact?
*
*/
#include "script_component.hpp"
private ["_conditionName", "_conditionFunc"];
_conditionName = toLower (_this select 0);
_conditionFunc = _this select 1;
private ["_conditions", "_conditionNames", "_conditionFuncs"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditionNames = _conditions select 0;
_conditionFuncs = _conditions select 1;
private "_index";
_index = _conditionNames find _conditionName;
if (_index == -1) then {
_index = count _conditionNames;
};
_conditionNames set [_index, _conditionName];
_conditionFuncs set [_index, _conditionFunc];
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];

View File

@ -11,4 +11,4 @@
*/
#include "script_component.hpp"
sunOrMoon * sunOrMoon + moonIntensity/5 min 1
sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5 min 1) * (1 - overcast)

View File

@ -1,11 +1,49 @@
// by commy2
/*
* Author: commy2
*
* Check if the unit can interact.
*
* Arguments:
* 0: The player. (Object)
* 1: The interaction target. objNull to ignore. (Object)
* 2: Exceptions. What general conditions are to skip? (Array)
*
* Return Value:
* Unit can interact?
*
*/
#include "script_component.hpp"
private ["_unit", "_target", "_owner"];
private ["_unit", "_target", "_exceptions"];
_unit = _this select 0;
_target = _this select 1;
_exceptions = _this select 2;
_owner = _target getVariable ["ACE_isUsedBy", objNull];
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
isNull _owner || {_unit == _owner} || {!isPlayer _owner}
// exit if the target is not free to interact
private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {_unit != _owner}) exitWith {false};
// check general conditions
private ["_conditions", "_conditionNames", "_conditionFuncs"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditionNames = _conditions select 0;
_conditionFuncs = _conditions select 1;
private "_canInteract";
_canInteract = true;
{
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
_canInteract = false;
};
} forEach _conditionNames;
_canInteract

View File

@ -1,7 +1,20 @@
// by commy2
/*
* Author: commy2
*
* Unit claims the ownership over an object. This is used to prevent multiple players from draging the same ammo box or using up the same wheel when repairing etc.
*
* Arguments:
* 0: Unit that claims another object. ObjNull to remove claim. (Object)
* 1: The object that gets claimed. (Object)
* 2: Lock the claimed object aswell? (Bool)
*
* Return Value:
* NONE
*
*/
#include "script_component.hpp"
private ["_unit", "_target", "_lockTarget", "_owner"];
private ["_unit", "_target", "_lockTarget"];
_unit = _this select 0;
_target = _this select 1;
@ -9,20 +22,26 @@ _lockTarget = _this select 2;
if (isNil "_lockTarget") then {_lockTarget = false};
_owner = _target getVariable ["ACE_isUsedBy", objNull];
private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then {
diag_log text "[ACE] ERROR: Claiming already owned object.";
};
_target setVariable ["ACE_isUsedBy", _unit, true];
// transfer this immediately
_target setVariable [QGVAR(owner), _unit, true];
// lock target object
if (_lockTarget) then {
if (!isNull _unit) then {
[_target, "{_locked = locked _this; _this setVariable ['ACE_lockStatus', _locked]; _this lock 2}", _target] call FUNC(execRemoteFnc);
} else {
[_target, "{_this lock (_this getVariable ['ACE_lockStatus', locked _this])}", _target] call FUNC(execRemoteFnc);
};
if (!isNull _unit) then {
["lockVehicle", _target, _target] call FUNC(targetEvent);
} else {
["unlockVehicle", _target, _target] call FUNC(targetEvent);
};
};
//systemChat str locked _target; systemChat str (_target getVariable ['ACE_lockStatus', locked _target]);
/*
systemChat str locked _target;
systemChat str (_target getVariable [QGVAR(lockStatus), locked _target]);
*/

View File

@ -0,0 +1,21 @@
/*
* Author: commy2
* Attempt to fix physx collisions causing unreasonable impact forces and damage.
*
* Arguments:
* 0: Object <OBJECT>
*
* Return Value:
* Nothing
*
*/
#include "script_component.hpp"
// allowDamage requires local object
if (!local _this) exitWith {};
// prevent collision damage, @todo allowDamage API
_this allowDamage false;
// re-allow damage after 2 seconds
[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute);

View File

@ -0,0 +1,32 @@
/*
* Author: commy2
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
*
* Arguments:
* Physx object (Object)
*
* Return Value:
* Nothing
*
*/
#include "script_component.hpp"
private "_object";
_object = _this;
// setHitPointDamage requires local object
if (!local _object) exitWith {};
// save and restore hitpoints, see below why
private ["_hitPoints", "_hitPointDamages"];
_hitPoints = [_object] call FUNC(getHitpoints);
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
// this prevents physx objects from floating when near other physx objects with allowDamage false
_object setDamage damage _object;
{
_object setHitPointDamage [_x, _hitPointDamages select _forEachIndex];
} forEach _hitPoints;

View File

@ -0,0 +1,29 @@
/*
* Author: commy2
*
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
*
* Argument:
* Object (Object)
*
* Return value:
* NONE
*/
#include "script_component.hpp"
// setVectorUp requires local object
if (!local _this) exitWith {};
private "_position";
_position = getPos _this;
// don't place the object below the ground
if (_position select 2 < -0.1) then {
_position set [2, -0.1];
_this setPos _position;
};
// adjust position to sloped terrain, if placed on ground
if (getPosATL _this select 2 == _position select 2) then {
_this setVectorUp surfaceNormal _position;
};

View File

@ -1,8 +1,19 @@
// by commy2
/*
* Author: commy2
*
* Counterpart of ace_common_fnc_claim. Check if the given object is claimed by another unit.
*
* Arguments:
* 0: Any object. (Object)
*
* Return Value:
* Is this object claimed by someone?
*
*/
#include "script_component.hpp"
private "_object";
private "_target";
_object = _this select 0;
_target = _this select 0;
!isNull (_object getVariable ["ACE_isUsedBy", objNull])
!isNull (_target getVariable [QGVAR(owner), objNull])

View File

@ -11,7 +11,7 @@
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
* 4: STRING - (Optional) Localized Title
* 5: CODE - (Optional) Code to check each frame
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteract)
* 6: ARRAY - (Optional) Exceptions for checking EGVAR(common,canInteractWith)
*
* Return value:
* Nothing
@ -62,7 +62,7 @@ _perFrameFunction = {
if (!([_args, _elapsedTime, _totalTime, _errorCode] call _condition)) then {
_errorCode = 3;
} else {
if (!(_exceptions call EGVAR(common,canInteract))) then {
if (!([_player, objNull, _exceptions] call EGVAR(common,canInteractWith))) then {
_errorCode = 4;
} else {
if (_elapsedTime >= _totalTime) then {

View File

@ -0,0 +1,34 @@
/*
* Author: commy2
*
* Remove a condition that gets checked by ace_common_fnc_canInteractWith.
*
* Arguments:
* 0: The conditions id. (String)
*
* Return Value:
* Unit can interact?
*
*/
#include "script_component.hpp"
private "_conditionName";
_conditionName = toLower (_this select 0);
private ["_conditions", "_conditionNames", "_conditionFuncs"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
_conditionNames = _conditions select 0;
_conditionFuncs = _conditions select 1;
private "_index";
_index = _conditionNames find _conditionName;
if (_index == -1) exitWith {};
_conditionNames deleteAt _index;
_conditionFuncs deleteAt _index;
GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];

View File

@ -1,20 +0,0 @@
// by commy2
#include "script_component.hpp"
private ["_function", "_configFile", "_count", "_index", "_config", "_configName", "_condition"];
_function = "private '_exceptions'; _exceptions = _this; alive ACE_player";
_configFile = configFile >> "ACE_canInteractConditions";
_count = count _configFile;
for "_index" from 0 to (_count -1) do {
_config = _configFile select _index;
_configName = configName _config;
_condition = getText (_config >> "condition");
_function = _function + format ["&& {%1 || {'%2' in _exceptions}}", _condition, _configName];
};
GVAR(canInteract) = compileFinal _function;

View File

@ -0,0 +1 @@
z\ace\addons\dragging

View File

@ -0,0 +1,47 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit));
};
};
class Extended_Init_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class StaticMortar {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
};
class Extended_Killed_EventHandlers {
class CAManBase {
class ADDON {
killed = QUOTE(_this call DFUNC(handleKilled));
};
};
};
class Extended_AnimChanged_EventHandlers {
class CAManBase {
class ADDON {
animChanged = QUOTE(_this call DFUNC(handleAnimChanged));
};
};
};

View File

@ -0,0 +1,86 @@
class CfgVehicles {
// Static weapons
class LandVehicle;
class StaticWeapon: LandVehicle {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
//remove actions from Taru Pods
class Pod_Heli_Transport_04_base_F: StaticWeapon {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
// ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
XEH_ENABLED;
GVAR(canCarry) = 0;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 0;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
class Slingload_base_F: ReammoBox_F {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class EAST_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
class IND_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
/*class FIA_Box_Base_F: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};*/
class NATO_Box_Base: ReammoBox_F {
GVAR(canCarry) = 1;
GVAR(canDrag) = 1;
};
// Remove Larger crate dragging support.
// Would be better to allow some sort of joint push/drag functionality
// Requiring 2 units to access the larger crates and attaching them together (a crappy method of doing it)
// in order to move the bigger ones. Currently simply remove support.
// I believe these crates are currently broken (hitbox doesn't work or something) in 1.22 (2014-07-04)
class Box_East_AmmoVeh_F: EAST_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class Box_NATO_AmmoVeh_F: NATO_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class Box_IND_AmmoVeh_F: IND_Box_Base {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
};

View File

@ -0,0 +1,19 @@
// by PabstMirror, commy2
#include "script_component.hpp"
[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler);
if (isNil "ACE_maxWeightDrag") then {
ACE_maxWeightDrag = 800;
};
if (isNil "ACE_maxWeightCarry") then {
ACE_maxWeightCarry = 600;
};
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
["playerChanged", {_this call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
["playerWeaponChanged", {_this call DFUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler);

View File

@ -0,0 +1,28 @@
#include "script_component.hpp"
ADDON = false;
PREP(canCarry);
PREP(canDrag);
PREP(canDrop);
PREP(canDrop_carry);
PREP(carryObject);
PREP(carryObjectPFH);
PREP(dragObject);
PREP(dragObjectPFH);
PREP(dropObject);
PREP(dropObject_carry);
PREP(getWeight);
PREP(handleAnimChanged);
PREP(handleKilled);
PREP(handlePlayerChanged);
PREP(handlePlayerWeaponChanged);
PREP(handleScrollWheel);
PREP(initObject);
PREP(isObjectOnObject);
PREP(setCarryable);
PREP(setDraggable);
PREP(startDrag);
PREP(startDragPFH);
ADDON = true;

View File

@ -0,0 +1,5 @@
// by commy2
#include "script_component.hpp"
// release object on hard disconnection. Function is identical to killed
addMissionEventHandler ["HandleDisconnect", {_this call DFUNC(handleKilled)}];

View File

@ -0,0 +1,16 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common","ace_interaction","ace_interact_menu"};
author[] = {"Garth 'L-H' de Wet","commy2"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,25 @@
/*
* Author: commy2
*
* Check if unit can carry the object. Doesn't check weight.
*
* Argument:
* 0: Unit that should do the carrying (Object)
* 1: Object to carry (Object)
*
* Return value:
* Can the unit carry the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
alive _target && {_target getVariable [QGVAR(canCarry), false]}

View File

@ -0,0 +1,25 @@
/*
* Author: commy2
*
* Check if unit can drag the object. Doesn't check weight.
*
* Argument:
* 0: Unit that should do the dragging (Object)
* 1: Object to drag (Object)
*
* Return value:
* Can the unit drag the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
// a static weapon has to be empty for dragging
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
alive _target && {_target getVariable [QGVAR(canDrag), false]}

View File

@ -0,0 +1,22 @@
/*
* Author: commy2
*
* Check if unit can drop the object.
*
* Argument:
* 0: Unit that currently drags a object (Object)
* 1: Object that is dragged (Object)
*
* Return value:
* Can the unit drop the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false};
_unit getVariable [QGVAR(draggedObject), objNull] == _target

View File

@ -0,0 +1,22 @@
/*
* Author: commy2
*
* Check if unit can drop the carried object.
*
* Argument:
* 0: Unit that currently carries a object (Object)
* 1: Object that is carried (Object)
*
* Return value:
* Can the unit drop the object? (Bool)
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
if !([_unit, _target, ["isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
_unit getVariable [QGVAR(carriedObject), objNull] == _target

View File

@ -0,0 +1,80 @@
/*
* Author: commy2
*
* Carry an object.
*
* Argument:
* 0: Unit that should do the carrying (Object)
* 1: Object to carry (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// check weight
private "_weight";
_weight = [_target] call FUNC(getWeight);
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
};
// select no weapon and stop sprinting
_unit action ["SwitchWeapon", _unit, _unit, 99];
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
// prevent multiple players from accessing the same object
[_unit, _target, true] call EFUNC(common,claim);
// get attachTo offset and direction.
private ["_position", "_direction"];
_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
_direction = _target getVariable [QGVAR(carryDirection), 0];
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];
// attach object
_target attachTo [_unit, _position];
_target setDir _direction;
_unit setVariable [QGVAR(isCarrying), true, true];
_unit setVariable [QGVAR(carriedObject), _target, true];
// add scrollwheel action to release object
private "_actionID";
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])] call FUNC(dropObject_carry)),
nil,
20,
false,
true,
"",
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)]))
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(carryObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject_carry);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -0,0 +1,64 @@
/*
* Author: commy2
*
* Drag an object. Called from ace_dragging_fnc_startDrag
*
* Argument:
* 0: Unit that should do the dragging (Object)
* 1: Object to drag (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// get attachTo offset and direction.
private ["_position", "_direction"];
_position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
_direction = _target getVariable [QGVAR(dragDirection), 0];
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];
// attach object
_target attachTo [_unit, _position];
_target setDir _direction;
_unit setVariable [QGVAR(isDragging), true, true];
_unit setVariable [QGVAR(draggedObject), _target, true];
// add scrollwheel action to release object
private "_actionID";
_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1];
if (_actionID != -1) then {
_unit removeAction _actionID;
};
_actionID = _unit addAction [
format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Dragging_Drop"],
QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)),
nil,
20,
false,
true,
"",
QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)]))
];
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(dragObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -0,0 +1,50 @@
/*
* Author: commy2
*
* Drop a dragged object.
*
* Argument:
* 0: Unit that drags the other object (Object)
* 1: Dragged object to drop (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// remove scroll wheel action
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
private "_inBuilding";
_inBuilding = [_unit] call FUNC(isObjectOnObject);
// play release animation
_unit playAction "released";
// prevent collision damage
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
// release object
detach _target;
_unit removeWeapon "ACE_FakePrimaryWeapon";
// prevent object from flipping inside buildings
if (_inBuilding) then {
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
};
_unit setVariable [QGVAR(isDragging), false, true];
_unit setVariable [QGVAR(draggedObject), objNull, true];
// make object accesable for other units
[objNull, _target, true] call EFUNC(common,claim);
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
["fixFloating", _target, _target] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,50 @@
/*
* Author: commy2
*
* Drop a carried object.
*
* Argument:
* 0: Unit that carries the other object (Object)
* 1: Carried object to drop (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// remove scroll wheel action
_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]);
private "_inBuilding";
_inBuilding = [_unit] call FUNC(isObjectOnObject);
// prevent collision damage
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
// release object
detach _target;
// reselect weapon and re-enable sprint
_unit selectWeapon primaryWeapon _unit;
[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus);
// prevent object from flipping inside buildings
if (_inBuilding) then {
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
};
_unit setVariable [QGVAR(isCarrying), false, true];
_unit setVariable [QGVAR(carriedObject), objNull, true];
// make object accesable for other units
[objNull, _target, true] call EFUNC(common,claim);
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
["fixFloating", _target, _target] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,54 @@
/*
Name: AGM_Drag_fnc_GetWeight
Author(s):
L-H, edited by commy2
Description:
Returns the weight of a crate.
Parameters:
0: OBJECT - Crate to get weight of
Returns:
NUMBER - Weight
Example:
_weight = Crate1 call AGM_Drag_fnc_GetWeight;
*/
#include "script_component.hpp"
private "_object";
_object = _this select 0;
private ["_totalWeight", "_fnc","_fnc_Extra"];
_totalWeight = 0;
_fnc_Extra = {
private ["_weight", "_items"];
_items = _this select 0;
_weight = 0;
{
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> (_this select 2) >> "mass") * ((_items select 1) select _foreachIndex));
} foreach (_items select 0);
_weight
};
_fnc = {
private ["_weight", "_items"];
_items = _this select 0;
_weight = 0;
{
_weight = _weight + (getNumber (ConfigFile >> (_this select 1) >> _x >> "mass") * ((_items select 1) select _foreachIndex));
} foreach (_items select 0);
_weight
};
_totalWeight = ([getMagazineCargo _object, "CfgMagazines"] call _fnc);
_totalWeight = _totalWeight + ([getItemCargo _object, "CfgWeapons", "ItemInfo"] call _fnc_Extra);
_totalWeight = _totalWeight + ([getWeaponCargo _object, "CfgWeapons", "WeaponSlotsInfo"] call _fnc_Extra);
_totalWeight = _totalWeight + ([getBackpackCargo _object, "CfgVehicles"] call _fnc);
_totalWeight = _totalWeight * 0.5; // 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).
_totalWeight

View File

@ -0,0 +1,31 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_anim"];
_unit = _this select 0;
_anim = _this select 1;
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when not in valid animation
if !(_anim in DRAG_ANIMATIONS) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
// drop carried object when not standing
if (stance _unit != "STAND") then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
};

View File

@ -0,0 +1,20 @@
// by commy2
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
if (_unit getVariable [QGVAR(isDragging), false]) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};

View File

@ -0,0 +1,17 @@
// by commy2
#include "script_component.hpp"
private ["_newPlayer", "_oldPlayer"];
_newPlayer = _this select 0;
_oldPlayer = _this select 1;
{
if (_x getVariable [QGVAR(isDragging), false]) then {
[_x, _x getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
};
if (_x getVariable [QGVAR(isCarrying), false]) then {
[_x, _x getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry);
};
} forEach [_newPlayer, _oldPlayer];

View File

@ -0,0 +1,31 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_weapon"];
_unit = _this select 0;
_weapon = _this select 1;
if (_unit getVariable [QGVAR(isDragging), false]) then {
// drop dragged object when selecting a non-primary weapon
if (_weapon != primaryWeapon _unit) then {
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
};
if (_unit getVariable [QGVAR(isCarrying), false]) then {
// drop carried object when selecting any weapon
if (_weapon != "") then {
private "_carriedObject";
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
[_unit, _carriedObject] call FUNC(dropObject_carry);
};
};

View File

@ -0,0 +1,45 @@
/*
* Author: L-H, commy2
*
* Handles raising and lowering the dragged weapon to be able to place it on top of objects.
*
* Argument:
* 0: Scroll amount (Number)
*
* Return value:
* Handled or not. (Bool)
*/
#include "script_component.hpp"
// requires modifier key to be hold down
if (GETMVAR(ACE_Modifier,0) == 0) exitWith {false};
private "_unit";
_unit = ACE_player;
// EH is always assigned. Exit and don't overwrite input if not carrying
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false};
private "_scrollAmount";
_scrollAmount = _this select 0;
// move carried item 15 cm per scroll interval
_scrollAmount = _scrollAmount * 0.15;
private "_carriedItem";
_carriedItem = _unit getVariable [QGVAR(carriedObject),objNull];
private ["_position", "_maxHeight"];
_position = getPosATL _carriedItem;
_maxHeight = (_unit ModelToWorld [0,0,0]) select 2;
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
// move up/down object and reattach at current position
detach _carriedItem;
_carriedItem setPosATL _position;
_carriedItem attachTo [_unit];
true

View File

@ -0,0 +1,37 @@
/*
* Author: commy2
*
* Initialize variables for drag or carryable objects. Called from init EH.
*
* Argument:
* 0: Any object (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private "_object";
_object = _this select 0;
private "_config";
_config = configFile >> "CfgVehicles" >> typeOf _object;
if (getNumber (_config >> QGVAR(canDrag)) == 1) then {
private ["_position", "_direction"];
_position = getArray (_config >> QGVAR(dragPosition));
_direction = getNumber (_config >> QGVAR(dragDirection));
[_object, true, _position, _direction] call FUNC(setDraggable);
};
if (getNumber (_config >> QGVAR(canCarry)) == 1) then {
private ["_position", "_direction"];
_position = getArray (_config >> QGVAR(carryPosition));
_direction = getNumber (_config >> QGVAR(carryDirection));
[_object, true, _position, _direction] call FUNC(setCarryable);
};

View File

@ -0,0 +1,6 @@
// by commy2
private "_object";
_object = _this select 0;
(getPosATL _object select 2) - (getPos _object select 2) > 1E-5

View File

@ -0,0 +1,52 @@
/*
* Author: commy2
*
* Enable the object to be carried.
*
* Argument:
* 0: Any object (Object)
* 1: true to enable carrying, false to disable (Bool)
* 2: Position offset for attachTo command (Array, optinal; default: [0,1,1])
* 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_object", "_enableCarry", "_position", "_direction"];
_this resize 4;
_object = _this select 0;
_enableCarry = _this select 1;
_position = _this select 2;
_direction = _this select 3;
if (isNil "_position") then {
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
};
if (isNil "_direction") then {
_direction = _object getVariable [QGVAR(carryDirection), 0];
};
// update variables
_object setVariable [QGVAR(canCarry), _enableCarry];
_object setVariable [QGVAR(carryPosition), _position];
_object setVariable [QGVAR(carryDirection), _direction];
// add action to class if it is not already present
private ["_type", "_initializedClasses"];
_type = typeOf _object;
_initializedClasses = GETGVAR(initializedClasses_carry,[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
GVAR(initializedClasses_carry) = _initializedClasses;
[_type, 0, ["ACE_MainActions", QGVAR(carry)], localize "STR_ACE_Dragging_Carry", "", "", {[_player, _target] call FUNC(carryObject)}, {[_player, _target] call FUNC(canCarry)}, 2] call EFUNC(interact_menu,addClassAction);
[_type, 0, ["ACE_MainActions", QGVAR(drop_carry)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}, 2] call EFUNC(interact_menu,addClassAction);

View File

@ -0,0 +1,52 @@
/*
* Author: commy2
*
* Enable the object to be dragged.
*
* Argument:
* 0: Any object (Object)
* 1: true to enable dragging, false to disable (Bool)
* 2: Position offset for attachTo command (Array, optinal; default: [0,0,0])
* 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_object", "_enableDrag", "_position", "_direction"];
_this resize 4;
_object = _this select 0;
_enableDrag = _this select 1;
_position = _this select 2;
_direction = _this select 3;
if (isNil "_position") then {
_position = _object getVariable [QGVAR(dragPosition), [0,0,0]];
};
if (isNil "_direction") then {
_direction = _object getVariable [QGVAR(dragDirection), 0];
};
// update variables
_object setVariable [QGVAR(canDrag), _enableDrag];
_object setVariable [QGVAR(dragPosition), _position];
_object setVariable [QGVAR(dragDirection), _direction];
// add action to class if it is not already present
private ["_type", "_initializedClasses"];
_type = typeOf _object;
_initializedClasses = GETGVAR(initializedClasses,[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
_initializedClasses pushBack _type;
GVAR(initializedClasses) = _initializedClasses;
[_type, 0, ["ACE_MainActions", QGVAR(drag)], localize "STR_ACE_Dragging_Drag", "", "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}, 2] call EFUNC(interact_menu,addClassAction);
[_type, 0, ["ACE_MainActions", QGVAR(drop)], localize "STR_ACE_Dragging_Drop", "", "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}, 2] call EFUNC(interact_menu,addClassAction);

View File

@ -0,0 +1,43 @@
/*
* Author: commy2
*
* Start the dragging process.
*
* Argument:
* 0: Unit that should do the dragging (Object)
* 1: Object to drag (Object)
*
* Return value:
* NONE.
*/
#include "script_component.hpp"
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
// check weight
private "_weight";
_weight = [_target] call FUNC(getWeight);
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
};
// add a primary weapon if the unit has none.
// @todo prevent opening inventory when equipped with a fake weapon
if (primaryWeapon _unit == "") then {
_unit addWeapon "ACE_FakePrimaryWeapon";
};
// select primary, otherwise the drag animation actions don't work.
_unit selectWeapon primaryWeapon _unit;
// prevent multiple players from accessing the same object
[_unit, _target, true] call EFUNC(common,claim);
// can't play action that depends on weapon if it was added the same frame
[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame);
[FUNC(startDragPFH), 0.2, [_unit, _target, time + 5]] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,20 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_target", "_timeOut"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
_timeOut = _this select 0 select 2;
// timeout. Do nothing. Quit. time, because anim length is linked to ingame time.
if (time > _timeOut) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// unit is ready to start dragging
if (animationState _unit in DRAG_ANIMATIONS) exitWith {
[_unit, _target] call FUNC(dragObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\dragging\script_component.hpp"

View File

@ -0,0 +1,14 @@
#define COMPONENT dragging
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_SETTINGS DEBUG_ENABLED_DRAGGING
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define DRAG_ANIMATIONS ["amovpercmstpslowwrfldnon_acinpknlmwlkslowwrfldb_2", "amovpercmstpsraswpstdnon_acinpknlmwlksnonwpstdb_2", "amovpercmstpsnonwnondnon_acinpknlmwlksnonwnondb_2", "acinpknlmstpsraswrfldnon", "acinpknlmstpsnonwpstdnon", "acinpknlmstpsnonwnondnon", "acinpknlmwlksraswrfldb", "acinpknlmwlksnonwnondb"]

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-21 -->
<Project name="ACE">
<Package name="Dragging">
<Key ID="STR_ACE_Dragging_Drag">
<English>Drag</English>
<Russian>Тащить</Russian>
<Spanish>Arrastrar</Spanish>
<Polish>Ciągnij</Polish>
<Czech>Táhnout</Czech>
<French>Tracter</French>
<German>Ziehen</German>
<Portuguese>Arrastar</Portuguese>
<Italian>Trascina</Italian>
<Hungarian>Húzás</Hungarian>
</Key>
<Key ID="STR_ACE_Dragging_Drop">
<English>Release</English>
<Russian>Отпустить</Russian>
<Spanish>Soltar</Spanish>
<Polish>Puść</Polish>
<Czech>Položit</Czech>
<French>Lâcher</French>
<German>Loslassen</German>
<Portuguese>Largar</Portuguese>
<Italian>Lascia</Italian>
<Hungarian>Elengedés</Hungarian>
</Key>
<Key ID="STR_ACE_Dragging_UnableToDrag">
<English>Item to heavy</English>
<German>Gegenstand zu schwer</German>
<!-- <English>Unable to drag item due to weight</English>
<Russian>Слишком тяжелый предмет</Russian>
<Spanish>No se puede arrastrar el objeto debido a su peso</Spanish>
<Polish>Nie można ciągnąć tego przedmiotu z powodu jego wagi</Polish>
<Czech>Předmět je příliž těžký!</Czech>
<French>Trop lourd pour être tracté</French>
<German>Dieser Gegenstand kann nicht gezogen werden, da er zu schwer ist.</German>
<Portuguese>Não é possível carregar o item devido a seu peso</Portuguese>
<Italian>Non è possibile trascinare l'oggetto a causa del suo peso</Italian>
<Hungarian>Túl nehéz ahhoz, hogy elhúzd</Hungarian> -->
</Key>
<Key ID="STR_ACE_Dragging_Carry">
<English>Carry</English>
<German>Tragen</German>
<Spanish>Portar</Spanish>
<Polish>Nieś</Polish>
<French>Porter</French>
<Czech>Nést</Czech>
<Portuguese>Carregar</Portuguese>
<Italian>Trascina</Italian>
<Hungarian>Felvesz</Hungarian>
<Russian>Нести</Russian>
</Key>
</Package>
</Project>

View File

@ -36,6 +36,11 @@ class Extended_Init_EventHandlers {
serverInit = QUOTE(_this call FUNC(vehicleInit));
};
};
class StaticWeapon {
class ADDON {
serverInit = QUOTE(_this call FUNC(vehicleInit));
};
};
};
class Extended_Respawn_EventHandlers {
@ -64,6 +69,11 @@ class Extended_Respawn_EventHandlers {
respawn = QUOTE(_this call FUNC(vehicleInit));
};
};
class StaticWeapon {
class ADDON {
respawn = QUOTE(_this call FUNC(vehicleInit));
};
};
};
class Extended_FiredBIS_EventHandlers {
@ -92,4 +102,9 @@ class Extended_FiredBIS_EventHandlers {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class StaticWeapon {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
};

View File

@ -3,8 +3,7 @@
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
@ -21,8 +20,7 @@
GVAR(isDownStateKey1) = false;
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
@ -35,8 +33,7 @@
["ACE3", QGVAR(adjustRangeUp), localize "STR_ACE_FCS_AdjustRangeUp",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};
@ -50,8 +47,7 @@
["ACE3", QGVAR(adjustRangDown), localize "STR_ACE_FCS_AdjustRangeDown",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false};

View File

@ -13,8 +13,7 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
["ACE3", QGVAR(switchGrenadeMode), localize "STR_ACE_Grenades_SwitchGrenadeMode",
{
// Conditions: canInteract
_exceptions = [QEGVAR(captives,isNotEscorting)];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, ["isNotEscorting"]] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};

View File

@ -4,4 +4,4 @@ class CfgAmmo {
class B_127x108_Ball: BulletBase {
audibleFire = 15;
};
};
};

View File

@ -22,7 +22,7 @@ class Extended_Init_EventHandlers {
class Extended_FiredNear_EventHandlers {
class CAManBase {
class GVAR(FiredNear) {
clientFiredNear = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(firedNear)}; );
clientFiredNear = QUOTE( if (GVAR(enableCombatDeafness) && {_this select 0 == ACE_player}) then {_this call FUNC(firedNear)}; );
};
};
};
@ -30,7 +30,7 @@ class Extended_FiredNear_EventHandlers {
class Extended_Explosion_EventHandlers {
class CAManBase {
class GVAR(ExplosionNear) {
clientExplosion = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(explosionNear)}; );
clientExplosion = QUOTE( if (GVAR(enableCombatDeafness) && {_this select 0 == ACE_player}) then {_this call FUNC(explosionNear)}; );
};
};
};
};

View File

@ -11,4 +11,4 @@ class CfgSounds {
sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7};
titles[] = {};
};
};
};

View File

@ -4,8 +4,8 @@ class CfgVehicles {
class ACE_SelfActions {
class ACE_Equipment {
class ACE_PutInEarplugs {
displayName = "$STR_ACE_Hearing_Earbuds_On";
condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarBuds' in items _player} );
displayName = "$STR_ACE_Hearing_EarPlugs_On";
condition = QUOTE( !([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarPlugs' in items _player} );
statement = QUOTE( [_player] call FUNC(putInEarPlugs) );
showDisabled = 0;
priority = 2.5;
@ -14,7 +14,7 @@ class CfgVehicles {
enableInside = 1;
};
class ACE_RemoveEarplugs {
displayName = "$STR_ACE_Hearing_Earbuds_Off";
displayName = "$STR_ACE_Hearing_EarPlugs_Off";
condition = QUOTE( [_player] call FUNC(hasEarPlugsIn) );
statement = QUOTE( [_player] call FUNC(removeEarPlugs) );
showDisabled = 0;
@ -35,61 +35,84 @@ class CfgVehicles {
class Box_NATO_Support_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class B_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class Box_East_Support_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class O_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class Box_IND_Support_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class Box_FIA_Support_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class I_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class IG_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class C_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12);
MACRO_ADDITEM(ACE_EarPlugs,12);
};
};
class Module_F;
class ACE_ModuleHearing: Module_F {
author = "$STR_ACE_Common_ACETeam";
category = "ACE";
displayName = "Hearing";
function = QFUNC(moduleHearing);
scope = 2;
isGlobal = 1;
icon = PATHTOF(UI\IconHearing_ca.paa);
class Arguments {
class EnableCombatDeafness {
displayName = "Enable combat deafness?";
description = "Enable combat deafness?";
typeName = "BOOL";
class values {
class Yes { name = "Yes"; value = 1; default = 1; };
class No { name = "No"; value = 0; };
};
};
};
};
};

View File

@ -2,9 +2,9 @@ class CfgWeapons {
class ACE_ItemCore;
class InventoryItem_Base_F;
class ACE_EarBuds: ACE_ItemCore {
displayName = "$STR_ACE_Hearing_Earbuds_Name";
descriptionShort = "$STR_ACE_Hearing_Earbuds_Description";
class ACE_EarPlugs: ACE_ItemCore {
displayName = "$STR_ACE_Hearing_EarPlugs_Name";
descriptionShort = "$STR_ACE_Hearing_EarPlugs_Description";
model = PATHTOF(ACE_earplugs.p3d);
picture = PATHTOF(UI\ACE_earplugs_x_ca.paa);
scope = 2;
@ -12,4 +12,4 @@ class CfgWeapons {
mass = 1;
};
};
};
};

Binary file not shown.

View File

@ -7,6 +7,7 @@ PREP(earRinging);
PREP(explosionNear);
PREP(firedNear);
PREP(hasEarPlugsIn);
PREP(moduleHearing);
PREP(putInEarPlugs);
PREP(removeEarPlugs);
PREP(updateVolume);

View File

@ -3,7 +3,7 @@
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"ACE_EarBuds"};
weapons[] = {"ACE_EarPlugs"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_interaction"};
author[] = {"KoffeinFlummi", "CAA-Picard", "HopeJ", "commy2"};
@ -23,10 +23,22 @@ class CfgPatches {
#include "CfgAmmo.hpp"
class ACE_Settings {
class GVAR(EnableCombatDeafness) {
value = 1;
typeName = "BOOL";
};
class GVAR(EarplugsVolume) {
value = 0.5;
typeName = "SCALAR";
};
class GVAR(UnconsciousnessVolume) {
value = 0.4;
typeName = "SCALAR";
};
class GVAR(DisableEarRinging) {
default = 1;
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_Hearing_DisableEarRinging";
};
};
};

View File

@ -1,13 +1,17 @@
/*
* Author: commy2
*
* Called on unit initialization. Adds earplugs if the unit is equipped with either a really loud primary weapon or a rocket launcher.
*
* Argument:
* 0: A Soldier (Object)
* Arguments:
* 0: A Soldier <Object>
*
* Return value:
* Nothing
* Return Value:
* None
*
* Example:
* [guy] call ace_hearing_fnc_addEarPlugs
*
* Public: No
*/
#include "script_component.hpp"
@ -19,7 +23,7 @@ _unit = _this select 0;
_launcher = secondaryWeapon _unit;
if (_launcher != "") exitWith {
_unit addItem "ACE_EarBuds";
_unit addItem "ACE_EarPlugs";
};
// otherwise add earplugs if the soldier has a big rifle
@ -32,5 +36,5 @@ if (isNil "_magazine") exitWith {};
_ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "audiblefire") > 8) then {
_unit addItem "ACE_EarBuds";
_unit addItem "ACE_EarPlugs";
};

View File

@ -1,13 +1,18 @@
/*
* Author: KoffeinFlummi, commy2
*
* Creates ear ringing effect with set strength.
*
* Arguments:
* 0: strength of ear ringing (Number between 0 and 1)
* 0: Unit (player) <OBJECT>
* 1: strength of ear ringing (Number between 0 and 1) <NUMBER>
*
* Return Value:
* none
* None
*
* Example:
* [clientExplosionEvent] call ace_hearing_fnc_earRinging
*
* Public: No
*/
#include "script_component.hpp"
@ -17,7 +22,7 @@ _unit = _this select 0;
_strength = _this select 1;
if (_unit getVariable ["ACE_hasEarPlugsin", false]) then {
_strength = _strength / 4;
_strength = _strength / 4;
};
GVAR(newStrength) = GVAR(newStrength) max _strength;
@ -28,24 +33,24 @@ if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {
if (GVAR(DisableEarRinging)) exitWith {};
if (_strength > 0.75) exitWith {
playSound "ACE_EarRinging_Heavy";
GVAR(isEarRingingPlaying) = true;
[
playSound "ACE_EarRinging_Heavy";
GVAR(isEarRingingPlaying) = true;
[
{GVAR(isEarRingingPlaying) = false;}, [], 7.0, 0.25
] call EFUNC(common,waitAndExecute);
] call EFUNC(common,waitAndExecute);
};
if (_strength > 0.5) exitWith {
playSound "ACE_EarRinging_Medium";
GVAR(isEarRingingPlaying) = true;
[
playSound "ACE_EarRinging_Medium";
GVAR(isEarRingingPlaying) = true;
[
{GVAR(isEarRingingPlaying) = false;}, [], 5.0, 0.25
] call EFUNC(common,waitAndExecute);
] call EFUNC(common,waitAndExecute);
};
if (_strength > 0.2) exitWith {
playSound "ACE_EarRinging_Weak";
GVAR(isEarRingingPlaying) = true;
playSound "ACE_EarRinging_Weak";
GVAR(isEarRingingPlaying) = true;
[
GVAR(isEarRingingPlaying) = true;
[
{GVAR(isEarRingingPlaying) = false;}, [], 3.0, 0.25
] call EFUNC(common,waitAndExecute);
] call EFUNC(common,waitAndExecute);
};

View File

@ -1,13 +1,18 @@
/*
* Author: KoffeinFlummi, commy2
*
* Handles deafness due to explosions going off near the player.
*
* Arguments:
* -> Explosion Event Handler
* 0: vehicle - Object the event handler is assigned to (player) <OBJECT>
* 1: damage - Damage inflicted to the object <NUMBER>
*
* Return Value:
* none
* None
*
* Example:
* [clientExplosionEvent] call ace_hearing_fnc_explosionNear
*
* Public: No
*/
#include "script_component.hpp"
@ -19,7 +24,4 @@ _damage = _this select 1;
_strength = (_damage * 2) min 1;
if (_strength < 0.01) exitWith {};
[_unit, _strength] spawn {
sleep 0.2;
_this call FUNC(earRinging);
};
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute);

View File

@ -1,13 +1,23 @@
/*
* Author: KoffeinFlummi, commy2
*
* Handles deafness due to large-caliber weapons going off near the player.
*
* Arguments:
* -> FiredNear Event Handler
* 0: Unit - Object the event handler is assigned to <OBJECT>
* 1: Firer: Object - Object which fires a weapon near the unit <OBJECT>
* 2: Distance - Distance in meters between the unit and firer <NUMBER>
* 3: weapon - Fired weapon <STRING>
* 4: muzzle - Muzzle that was used <STRING>
* 5: mod - Current mode of the fired weapon <STRING>
* 6: ammo - Ammo used <STRING>
*
* Return Value:
* none
* None
*
* Example:
* [clientFiredNearEvent] call ace_hearing_fnc_firedNear
*
* Public: No
*/
#include "script_component.hpp"
@ -25,17 +35,17 @@ if (_weapon in ["Throw", "Put"]) exitWith {};
if (_unit != vehicle _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) exitWith {};
_silencer = switch (_weapon) do {
case (primaryWeapon _unit) : {primaryWeaponItems _unit select 0};
case (secondaryWeapon _unit) : {secondaryWeaponItems _unit select 0};
case (handgunWeapon _unit) : {handgunItems _unit select 0};
default {""};
case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0};
case (secondaryWeapon _firer) : {(secondaryWeaponItems _firer) select 0};
case (handgunWeapon _firer) : {(handgunItems _firer) select 0};
default {""};
};
_audibleFireCoef = 1;
//_audibleFireTimeCoef = 1;
if (_silencer != "") then {
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
//_audibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFireTime");
_audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire");
//_audibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFireTime");
};
_audibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
@ -46,7 +56,4 @@ _strength = _loudness - (_loudness/50 * _distance); // linear drop off
if (_strength < 0.01) exitWith {};
[_unit, _strength] spawn {
sleep 0.2;
_this call FUNC(earRinging);
};
[{_this call FUNC(earRinging)}, [_unit, _strength], 0.2, 0] call EFUNC(common,waitAndExecute);

View File

@ -1,18 +1,20 @@
/*
* Author: commy2
*
* Check if the unit has earplugs put in.
*
* Argument:
* A soldier (Object)
* Arguments:
* 0:Unit (player) <OBJECT>
*
* Return value:
* Boolean (Bool)
* Return Value:
* Have Earplugs in <BOOL>
*
* Example:
* [ace_player] call ace_hearing_fnc_hasEarPlugsIn
*
* Public: No
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
PARAMS_1(_unit);
_unit getVariable ["ACE_hasEarPlugsin", false]

View File

@ -0,0 +1,20 @@
/*
* Author: CAA-Picard
* Initializes the Map module.
*
* Arguments:
* Whatever the module provides. (I dunno.)
*
* Return Value:
* None
*/
#include "script_component.hpp"
_logic = _this select 0;
_activated = _this select 2;
if !(_activated) exitWith {};
[_logic, QGVAR(enableCombatDeafness), "EnableCombatDeafness"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Interaction Module Initialized.";

View File

@ -1,27 +1,28 @@
/*
* Author: Hope Johnson
* Edited by commy2
*
* Puts in / takes out earplugs.
* Author: Hope Johnson and commy2
* Puts in earplugs.
*
* Arguments:
* none
* 0:Unit (player) <OBJECT>
*
* Return Value:
* none
* None
*
* Example:
* [ace_player] call ace_hearing_fnc_putInEarplugs
*
* Public: No
*/
#include "script_component.hpp"
private "_player";
PARAMS_1(_player);
_player = _this select 0;
// Buds in inventory, putting them in
_player removeItem "ACE_EarBuds";
// Plugs in inventory, putting them in
_player removeItem "ACE_EarPlugs";
_player setVariable ["ACE_hasEarPlugsIn", true, true];
[localize "STR_ACE_Hearing_Earbuds_Are_On"] call EFUNC(common,displayTextStructured);
[localize "STR_ACE_Hearing_EarPlugs_Are_On"] call EFUNC(common,displayTextStructured);
/*// No Ear Buds in inventory, telling user
[localize "STR_ACE_Hearing_NoBuds"] call EFUNC(common,displayTextStructured);*/
/*// No Ear Plugs in inventory, telling user
[localize "STR_ACE_Hearing_NoPlugs"] call EFUNC(common,displayTextStructured);*/

View File

@ -1,28 +1,29 @@
/*
* Author: Hope Johnson
* Edited by commy2
*
* Puts in / takes out earplugs.
* Author: Hope Johnson and commy2
* Takes out earplugs.
*
* Arguments:
* none
* 0:Unit (player) <OBJECT>
*
* Return Value:
* none
* None
*
* Example:
* [ace_player] call ace_hearing_fnc_removeEarplugs
*
* Public: No
*/
#include "script_component.hpp"
private "_player";
PARAMS_1(_player);
_player = _this select 0;
if !(_player canAdd "ACE_EarBuds") exitWith { // inventory full
[localize "STR_ACE_Hearing_Inventory_Full"] call EFUNC(common,displayTextStructured);
if !(_player canAdd "ACE_EarPlugs") exitWith { // inventory full
[localize "STR_ACE_Hearing_Inventory_Full"] call EFUNC(common,displayTextStructured);
};
// Buds already in and removing them.
_player addItem "ACE_EarBuds";
// Plugs already in and removing them.
_player addItem "ACE_EarPlugs";
_player setVariable ["ACE_hasEarPlugsIn", false, true];
[localize "STR_ACE_Hearing_Earbuds_Are_Off"] call EFUNC(common,displayTextStructured);
[localize "STR_ACE_Hearing_EarPlugs_Are_Off"] call EFUNC(common,displayTextStructured);

View File

@ -1,22 +1,39 @@
// by commy2 and CAA-Picard
/*
* Author: commy2 and CAA-Picard
* Updates and applys the current deafness. Called every 0.1 sec from a PFEH.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_hearing_fnc_updateVolume
*
* Public: No
*/
#include "script_component.hpp"
#define STRENGHTODEAFNESS 3
#define MAXDEAFNESS 1.1
// Exit if combat deafness is disabled
if !(GVAR(enableCombatDeafness)) exitWith {};
// Check if new noises increase deafness
if (GVAR(newStrength) * STRENGHTODEAFNESS > GVAR(currentDeafness)) then {
GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS;
GVAR(currentDeafness) = GVAR(newStrength) * STRENGHTODEAFNESS min MAXDEAFNESS;
};
GVAR(newStrength) = 0;
// Recover rate is slower if deafness is severe
_recoverRate = 0.01;
if (GVAR(currentDeafness) > 0.7) then {
_recoverRate = 0.005;
if (GVAR(currentDeafness) > 0.9) then {
_recoverRate = 0.002;
};
_recoverRate = 0.005;
if (GVAR(currentDeafness) > 0.9) then {
_recoverRate = 0.002;
};
};
// Deafness recovers with time
@ -27,19 +44,19 @@ _volume = (1 - GVAR(currentDeafness) max 0)^2 max 0.04;
// Earplugs reduce hearing 50%
if ([ACE_player] call FUNC(hasEarPlugsIn)) then {
_volume = _volume min 0.5;
_volume = _volume min GVAR(EarplugsVolume);
};
// Reduce volume if player is unconscious
if (ACE_player getVariable ["ACE_isUnconscious", false]) then {
_volume = _volume min 0.4;
_volume = _volume min GVAR(UnconsciousnessVolume);
};
if (!(missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false])) then {
0.1 fadeSound _volume;
0.1 fadeSpeech _volume;
ACE_player setVariable ["tf_globalVolume", _volume];
ACE_player setVariable ["acre_sys_core_globalVolume", _volume];
0.1 fadeSound _volume;
0.1 fadeSpeech _volume;
ACE_player setVariable ["tf_globalVolume", _volume];
if (!isNil "acre_api_fnc_setGlobalVolume") then {[_volume] call acre_api_fnc_setGlobalVolume;};
};
//hintSilent format ["GVAR(currentDeafness), _Volume = %1, %2", GVAR(currentDeafness), _volume];

View File

@ -2,7 +2,7 @@
<!-- Edited with tabler - 2014-12-17 -->
<Project name="ACE">
<Package name="Hearing">
<Key ID="STR_ACE_Hearing_Earbuds_Name">
<Key ID="STR_ACE_Hearing_EarPlugs_Name">
<English>Ear Plugs</English>
<German>Ohrenstöpsel</German>
<Spanish>Tapones para los oídos</Spanish>
@ -14,8 +14,8 @@
<Portuguese>Protetor auricular</Portuguese>
<Italian>Tappi auricolari</Italian>
</Key>
<Key ID="STR_ACE_Hearing_Earbuds_Description">
<English>Protective Ear Buds allow the wearer to be near loud weaponry without damage to his hearing.</English>
<Key ID="STR_ACE_Hearing_EarPlugs_Description">
<English>Protective Ear Plugs allow the wearer to be near loud weaponry without damage to his hearing.</English>
<German>Schützende Ohrenstöpsel, die es dem Träger ermöglichen, sich in der Nähe lauter Waffen aufzuhalten.</German>
<Spanish>Los tapones para los oídos permiten al usuario operar armamento ruidoso sin sufrir pérdida de audición.</Spanish>
<Polish>Stopery do uszu umożliwiają użytkownikowi przebywać w pobliżu głośnej broni bez poniesienia konsekwencji jaką jest utrata słuchu.</Polish>
@ -26,7 +26,7 @@
<Portuguese>Protetor para ouvidos permitem que o usuário esteja próximo a ruídos sem danificar sua audição.</Portuguese>
<Italian>Proteggono l'apparato uditivo, permettendo a chi li indossa di resistere ai suoni particolarmente forti senza alcun danno.</Italian>
</Key>
<Key ID="STR_ACE_Hearing_Earbuds_On">
<Key ID="STR_ACE_Hearing_EarPlugs_On">
<English>Earplugs in</English>
<German>Ohrenstöpsel drinnen</German>
<Spanish>Poner tapones</Spanish>
@ -38,7 +38,7 @@
<Portuguese>Protetores colocados</Portuguese>
<Italian>Indossa i tappi auricolari</Italian>
</Key>
<Key ID="STR_ACE_Hearing_Earbuds_Off">
<Key ID="STR_ACE_Hearing_EarPlugs_Off">
<English>Earplugs out</English>
<German>Ohrenstöpsel raus</German>
<Spanish>Quitar tapones</Spanish>
@ -50,7 +50,7 @@
<Portuguese>Protetores retirados</Portuguese>
<Italian>Levati i tappi auricolari</Italian>
</Key>
<Key ID="STR_ACE_Hearing_Earbuds_Are_On">
<Key ID="STR_ACE_Hearing_EarPlugs_Are_On">
<English>Earplugs in</English>
<German>Ohrenstöpsel drinnen</German>
<Spanish>Tapones puestos</Spanish>
@ -62,7 +62,7 @@
<Portuguese>Protetores colocados</Portuguese>
<Italian>Indossa i tappi auricolari</Italian>
</Key>
<Key ID="STR_ACE_Hearing_Earbuds_Are_Off">
<Key ID="STR_ACE_Hearing_EarPlugs_Are_Off">
<English>Earplugs out</English>
<German>Ohrenstöpsel raus</German>
<Spanish>Tapones quitados</Spanish>
@ -74,7 +74,7 @@
<Portuguese>Protetores retirados</Portuguese>
<Italian>Levati i tappi auricolari</Italian>
</Key>
<Key ID="STR_ACE_Hearing_NoBuds">
<Key ID="STR_ACE_Hearing_NoPlugs">
<English>You have no ear plugs</English>
<German>Keine Ohrenstöpsel im Inventar</German>
<Spanish>No tienes tapones para los oídos</Spanish>

View File

@ -46,7 +46,7 @@ _recurseFnc = {
if (_condition == "") then {_condition = "true"};
// Add canInteract (including exceptions) and canInteractWith to condition
_condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;

View File

@ -43,7 +43,7 @@ _recurseFnc = {
if (_condition == "") then {_condition = "true"};
// Add canInteract (including exceptions) and canInteractWith to condition
_condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, objNull, %1)] call EGVAR(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")];
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;

View File

@ -19,5 +19,7 @@ if(!GVAR(keyDown)) then {
GVAR(keyDown) = true;
GVAR(keyDownTime) = diag_tickTime;
["interactMenuOpened", [0]] call EFUNC(common,localEvent);
};
true

View File

@ -17,6 +17,8 @@ if(!GVAR(keyDownSelfAction)) then {
GVAR(keyDown) = false;
GVAR(keyDownTime) = diag_tickTime;
["interactMenuOpened", [1]] call EFUNC(common,localEvent);
GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) || GVAR(AlwaysUseCursorSelfInteraction) || visibleMap;
if (GVAR(useCursorMenu)) then {

View File

@ -497,4 +497,17 @@ class CfgVehicles {
class ACE_SelfActions {};
};
class thingX;
class ReammoBox_F: thingX {
class ACE_Actions {
class ACE_MainActions {
displayName = "$STR_ACE_Interaction_MainAction";
selection = "";
distance = 2;
condition = "true";
};
};
class ACE_SelfActions {};
};
};

View File

@ -19,8 +19,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
@ -40,8 +39,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
if !([ACE_player, objNull, []] call EGVAR(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
@ -55,8 +53,7 @@ GVAR(isOpeningDoor) = false;
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
//if !([ACE_player, objNull, ["isNotDragging"]] call EGVAR(common,canInteractWith)) exitWith {false}; // not needed
// Statement
ACE_Modifier = 1;
@ -69,3 +66,5 @@ GVAR(isOpeningDoor) = false;
false;
},
[29, [false, false, false]], false] call cba_fnc_addKeybind;
["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition);

View File

@ -24,9 +24,3 @@ class ACE_Settings {
typeName = "BOOL";
};
};
class ACE_canInteractConditions {
class GVAR(isNotSwimming) {
condition = QUOTE( !underwater ACE_player );
};
};

View File

@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
};
if (!_usedMouseWheel && {time < _time} && {[] call EGVAR(common,canInteract)}) then {
if (!_usedMouseWheel && {time < _time} && {[ACE_player, objNull, []] call EGVAR(common,canInteractWith)}) then {
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]} forEach _animations;

View File

@ -0,0 +1,516 @@
/*
Adjust the scaling of the inventory screen
- changes it from scaling based on user's interface size to a dynamic size based on a setting variable
- text size and row height size are uneffected (so more rows in a list)
- also tweaks the height of the two ProgressBars which looked odd scaled up so much
regex:
x = "[-+]?(\d*[.]?\d+).*
x = X_PART\(\1\);
*/
class RscText;
class RscPicture;
class RscListBox;
class RscProgress;
class RscStructuredText;
class RscActiveText;
class RscCombo;
#define X_BIS(num) (num * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2))
#define Y_BIS(num) (num * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))
#define W_BIS(num) (num * (((safezoneW / safezoneH) min 1.2) / 40))
#define H_BIS(num) (num * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))
#define X_MAKEITBIGGA(num) (num * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2))
#define Y_MAKEITBIGGA(num) (num * (safeZoneH / 30) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2))
#define W_MAKEITBIGGA(num) (num * (safeZoneH / 40))
#define H_MAKEITBIGGA(num) (num * (safeZoneH / 30))
#define X_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(inventoryDisplaySize)), 0)]), X_BIS(num), X_MAKEITBIGGA(num))])
#define Y_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(inventoryDisplaySize)), 0)]), Y_BIS(num), Y_MAKEITBIGGA(num))])
#define W_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(inventoryDisplaySize)), 0)]), W_BIS(num), W_MAKEITBIGGA(num))])
#define H_PART(num) QUOTE(linearConversion [ARR_5(0, 2, (missionNamespace getVariable [ARR_2(QUOTE(QGVAR(inventoryDisplaySize)), 0)]), H_BIS(num), H_MAKEITBIGGA(num))])
class RscDisplayInventory {
class controls {
class CA_ContainerBackground: RscText {
//crate: GroundLoad adjust size
x = X_PART(1);
y = Y_PART(1);
w = W_PART(12);
h = H_PART(22.5);
};
class CA_PlayerBackground: RscText {
//center player's container: decrease height because of progressbar height decrease
x = X_PART(14.6);
y = Y_PART(2);
w = W_PART(24.4);
h = H_PART(21.5);
};
class TitleBackground: RscText {
x = X_PART(14.6);
y = Y_PART(1);
w = W_PART(24.4);
h = H_PART(1);
};
class PlayersName: RscText {
x = X_PART(15.6);
y = Y_PART(1);
w = W_PART(19.8);
h = H_PART(1);
};
class RankBackground: RscText {
x = X_PART(15.1);
y = Y_PART(1.25);
w = W_PART(0.6);
h = H_PART(0.6);
};
class RankPicture: RscPicture {
x = X_PART(15.1);
y = Y_PART(1.25);
w = W_PART(0.6);
h = H_PART(0.6);
};
class ButtonBack: RscActiveText {
x = X_PART(38);
y = Y_PART(1);
w = W_PART(1);
h = H_PART(1);
};
class BackgroundSlotPrimary: RscPicture {
x = X_PART(26.6);
y = Y_PART(6);
w = W_PART(11.9);
h = H_PART(3);
};
class BackgroundSlotPrimaryMuzzle: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotPrimaryFlashlight: BackgroundSlotPrimary {
x = X_PART(29.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotPrimaryOptics: BackgroundSlotPrimary {
x = X_PART(32.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotPrimaryMagazine: BackgroundSlotPrimary {
x = X_PART(35.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotSecondary: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(11.5);
w = W_PART(11.9);
h = H_PART(3);
};
class BackgroundSlotSecondaryMuzzle: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotSecondaryFlashlight: BackgroundSlotPrimary {
x = X_PART(29.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotSecondaryOptics: BackgroundSlotPrimary {
x = X_PART(32.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotSecondaryMagazine: BackgroundSlotPrimary {
x = X_PART(35.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotHandgun: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(17);
w = W_PART(11.9);
h = H_PART(3);
};
class BackgroundSlotHandgunMuzzle: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotHandgunFlashlight: BackgroundSlotPrimary {
x = X_PART(29.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotHandgunOptics: BackgroundSlotPrimary {
x = X_PART(32.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotHandgunMagazine: BackgroundSlotPrimary {
x = X_PART(35.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class BackgroundSlotHeadgear: BackgroundSlotPrimary {
x = X_PART(26.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class BackgroundSlotGoggles: BackgroundSlotPrimary {
x = X_PART(29.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class BackgroundSlotHMD: BackgroundSlotPrimary {
x = X_PART(32.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class BackgroundSlotBinoculars: BackgroundSlotPrimary {
x = X_PART(35.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class BackgroundSlotMap: BackgroundSlotPrimary {
x = X_PART(15.1);
y = Y_PART(20.1);
w = W_PART(2.12);
h = H_PART(2);
};
class BackgroundSlotGPS: BackgroundSlotPrimary {
x = X_PART(17.32);
y = Y_PART(20.1);
w = W_PART(2.12);
h = H_PART(2);
};
class BackgroundSlotCompass: BackgroundSlotPrimary {
x = X_PART(21.76);
y = Y_PART(20.1);
w = W_PART(2.12);
h = H_PART(2);
};
class BackgroundSlotRadio: BackgroundSlotPrimary {
x = X_PART(19.54);
y = Y_PART(20.1);
w = W_PART(2.12);
h = H_PART(2);
};
class BackgroundSlotWatch: BackgroundSlotPrimary {
x = X_PART(23.98);
y = Y_PART(20.1);
w = W_PART(2.12);
h = H_PART(2);
};
class ExternalContainerBackground: RscPicture {
x = X_PART(1.5);
y = Y_PART(3.7);
w = W_PART(11);
h = H_PART(18.4);
};
class PlayerContainerBackground: ExternalContainerBackground {
x = X_PART(15.1);
y = Y_PART(6);
w = W_PART(11);
h = H_PART(14);
};
class GroundTab: RscActiveText {
x = X_PART(1.5);
y = Y_PART(1.5);
w = W_PART(5.5);
h = H_PART(1);
};
class SoldierTab: GroundTab {
x = X_PART(7);
y = Y_PART(1.5);
w = W_PART(5.5);
h = H_PART(1);
};
class GroundContainer: RscListBox {
x = X_PART(1.5);
y = Y_PART(3.7);
w = W_PART(11);
h = H_PART(18.4);
};
class GroundFilter: RscCombo {
x = X_PART(1.5);
y = Y_PART(2.6);
w = W_PART(11);
h = H_PART(1);
};
class GroundLoad: RscProgress {
//crate: GroundLoad adjust size
x = X_PART(1.5);
y = Y_PART(22.5);
w = W_PART(11);
h = H_PART(0.5);
};
class SlotPrimary: GroundTab {
x = X_PART(26.6);
y = Y_PART(6);
w = W_PART(11.9);
h = H_PART(3);
};
class SlotPrimaryMuzzle: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotPrimaryGrip: SlotPrimary {
w = 0;
h = 0;
x = X_PART(39);
y = Y_PART(9);
};
class SlotPrimaryFlashlight: SlotPrimary {
x = X_PART(29.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotPrimaryOptics: SlotPrimary {
x = X_PART(32.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotPrimaryMagazine: SlotPrimary {
x = X_PART(35.6);
y = Y_PART(9.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotSecondary: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(11.5);
w = W_PART(11.9);
h = H_PART(3);
};
class SlotSecondaryMuzzle: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotSecondaryGrip: SlotPrimary {
w = 0;
h = 0;
x = X_PART(39);
y = Y_PART(14.5);
};
class SlotSecondaryFlashlight: SlotPrimary {
x = X_PART(29.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotSecondaryOptics: SlotPrimary {
x = X_PART(32.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotSecondaryMagazine: SlotPrimary {
x = X_PART(35.6);
y = Y_PART(14.6);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotHandgun: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(17);
w = W_PART(11.9);
h = H_PART(3);
};
class SlotHandgunMuzzle: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotHandgunGrip: SlotPrimary {
w = 0;
h = 0;
x = X_PART(39);
y = Y_PART(20);
};
class SlotHandgunFlashlight: SlotPrimary {
x = X_PART(29.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotHandgunOptics: SlotPrimary {
x = X_PART(32.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotHandgunMagazine: SlotPrimary {
x = X_PART(35.6);
y = Y_PART(20.1);
w = W_PART(2.9);
h = H_PART(2);
};
class SlotHeadgear: SlotPrimary {
x = X_PART(26.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class SlotGoggles: SlotPrimary {
x = X_PART(29.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class SlotHMD: SlotPrimary {
x = X_PART(32.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class SlotBinoculars: SlotPrimary {
x = X_PART(35.6);
y = Y_PART(2.5);
w = W_PART(2.9);
h = H_PART(2.9);
};
class SlotMap: SlotPrimary {
x = X_PART(15.16);
y = Y_PART(20.1);
w = W_PART(2);
h = H_PART(2);
};
class SlotGPS: SlotPrimary {
x = X_PART(17.38);
y = Y_PART(20.1);
w = W_PART(2);
h = H_PART(2);
};
class SlotCompass: SlotPrimary {
x = X_PART(21.82);
y = Y_PART(20.1);
w = W_PART(2);
h = H_PART(2);
};
class SlotRadio: SlotPrimary {
x = X_PART(19.6);
y = Y_PART(20.1);
w = W_PART(2);
h = H_PART(2);
};
class SlotWatch: SlotPrimary {
x = X_PART(24.04);
y = Y_PART(20.1);
w = W_PART(2);
h = H_PART(2);
};
class UniformTab: GroundTab {
x = X_PART(15.1);
y = Y_PART(2.5);
w = W_PART(3.5);
h = H_PART(3);
};
class UniformSlot: SlotPrimary {
x = X_PART(15.35);
y = Y_PART(2.5);
w = W_PART(3);
h = H_PART(3);
};
class UniformLoad: GroundLoad {
x = X_PART(15.1);
y = Y_PART(5.5);
w = W_PART(3.5);
h = H_PART(0.5);
};
class UniformContainer: GroundContainer {
x = X_PART(15.1);
y = Y_PART(6);
w = W_PART(11);
h = H_PART(14);
};
class VestTab: UniformTab {
x = X_PART(18.85);
y = Y_PART(2.5);
w = W_PART(3.5);
h = H_PART(3);
};
class VestSlot: SlotPrimary {
x = X_PART(19.1);
y = Y_PART(2.5);
w = W_PART(3);
h = H_PART(3);
};
class VestLoad: GroundLoad {
x = X_PART(18.85);
y = Y_PART(5.5);
w = W_PART(3.5);
h = H_PART(0.5);
};
class BackpackTab: UniformTab {
x = X_PART(22.6);
y = Y_PART(2.5);
w = W_PART(3.5);
h = H_PART(3);
};
class BackpackSlot: SlotPrimary {
x = X_PART(22.85);
y = Y_PART(2.5);
w = W_PART(3);
h = H_PART(3);
};
class BackpackLoad: GroundLoad {
x = X_PART(22.6);
y = Y_PART(5.5);
w = W_PART(3.5);
h = H_PART(0.5);
};
class TotalLoad: GroundLoad {
//center: progressbar height decrease
x = X_PART(15.1);
y = Y_PART(22.5);
w = W_PART(23.4);
h = H_PART(0.5);
};
class ContainerMarker: GroundTab {
x = X_PART(0);
y = Y_PART(24);
w = W_PART(1);
h = H_PART(1);
};
class GroundMarker: ContainerMarker {
x = X_PART(1.5);
y = Y_PART(24);
w = W_PART(1);
h = H_PART(1);
};
class SoldierMarker: ContainerMarker {
x = X_PART(3);
y = Y_PART(24);
w = W_PART(1);
h = H_PART(1);
};
};
};

View File

@ -12,503 +12,16 @@ class CfgPatches {
};
};
#include "RscDisplayInventory.hpp"
class RscText;
class RscPicture;
class RscListBox;
class RscProgress;
class RscStructuredText;
class RscActiveText;
class RscCombo;
class RscControlsGroupNoScrollbars;
/*
Adjust the scaling of the inventory screen
- changes it from scaling based on user's interface size to a static size
- text size and row height size are uneffected
- also tweaks the height of the two ProgressBars which looked odd scaled up so much
*/
class RscDisplayInventory {
class controls {
class CA_ContainerBackground: RscText {
//crate: GroundLoad adjust size
x = "1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "12 * (safeZoneH / 40)";
h = "22.5 * ((safeZoneH / 1.2) / 25)";
};
class CA_PlayerBackground: RscText {
//center player's container: decrease height because of progressbar height decrease
x = "14.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "24.4 * (safeZoneH / 40)";
h = "21.5 * ((safeZoneH / 1.2) / 25)";
};
class TitleBackground: RscText {
x = "14.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "24.4 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class PlayersName: RscText {
text = "Player name:";
x = "15.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "19.8 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class RankBackground: RscText {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1.25 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "0.6 * (safeZoneH / 40)";
h = "0.6 * ((safeZoneH / 1.2) / 25)";
};
class RankPicture: RscPicture {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1.25 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "0.6 * (safeZoneH / 40)";
h = "0.6 * ((safeZoneH / 1.2) / 25)";
};
class ButtonBack: RscActiveText {
x = "38 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "1 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotPrimary: RscPicture {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotPrimaryMuzzle: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotPrimaryFlashlight: BackgroundSlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotPrimaryOptics: BackgroundSlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotPrimaryMagazine: BackgroundSlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotSecondary: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "11.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotSecondaryMuzzle: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotSecondaryFlashlight: BackgroundSlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotSecondaryOptics: BackgroundSlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotSecondaryMagazine: BackgroundSlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHandgun: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "17 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHandgunMuzzle: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHandgunFlashlight: BackgroundSlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHandgunOptics: BackgroundSlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHandgunMagazine: BackgroundSlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHeadgear: BackgroundSlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotGoggles: BackgroundSlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotHMD: BackgroundSlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotBinoculars: BackgroundSlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotMap: BackgroundSlotPrimary {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.12 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotGPS: BackgroundSlotPrimary {
x = "17.32 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.12 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotCompass: BackgroundSlotPrimary {
x = "21.76 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.12 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotRadio: BackgroundSlotPrimary {
x = "19.54 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.12 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class BackgroundSlotWatch: BackgroundSlotPrimary {
x = "23.98 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.12 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class ExternalContainerBackground: RscPicture {
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "3.7 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "18.4 * ((safeZoneH / 1.2) / 25)";
};
class PlayerContainerBackground: ExternalContainerBackground {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "14 * ((safeZoneH / 1.2) / 25)";
};
class GroundTab: RscActiveText {
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "5.5 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class SoldierTab: GroundTab {
x = "7 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "1.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "5.5 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class GroundContainer: RscListBox {
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "3.7 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "18.4 * ((safeZoneH / 1.2) / 25)";
};
class GroundFilter: RscCombo {
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class GroundLoad: RscProgress {
//crate: GroundLoad adjust size
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "22.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "0.5 * ((safeZoneH / 1.2) / 25)";
};
class SlotPrimary: GroundTab {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class SlotPrimaryMuzzle: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotPrimaryGrip: SlotPrimary {
w = 0;
h = 0;
x = "39 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
};
class SlotPrimaryFlashlight: SlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotPrimaryOptics: SlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotPrimaryMagazine: SlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "9.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotSecondary: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "11.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class SlotSecondaryMuzzle: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotSecondaryGrip: SlotPrimary {
w = 0;
h = 0;
x = "39 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
};
class SlotSecondaryFlashlight: SlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotSecondaryOptics: SlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotSecondaryMagazine: SlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "14.6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotHandgun: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "17 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11.9 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class SlotHandgunMuzzle: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotHandgunGrip: SlotPrimary {
w = 0;
h = 0;
x = "39 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
};
class SlotHandgunFlashlight: SlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotHandgunOptics: SlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotHandgunMagazine: SlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotHeadgear: SlotPrimary {
x = "26.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class SlotGoggles: SlotPrimary {
x = "29.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class SlotHMD: SlotPrimary {
x = "32.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class SlotBinoculars: SlotPrimary {
x = "35.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2.9 * (safeZoneH / 40)";
h = "2.9 * ((safeZoneH / 1.2) / 25)";
};
class SlotMap: SlotPrimary {
x = "15.16 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotGPS: SlotPrimary {
x = "17.38 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotCompass: SlotPrimary {
x = "21.82 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotRadio: SlotPrimary {
x = "19.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class SlotWatch: SlotPrimary {
x = "24.04 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "20.1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "2 * (safeZoneH / 40)";
h = "2 * ((safeZoneH / 1.2) / 25)";
};
class UniformTab: GroundTab {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class UniformSlot: SlotPrimary {
x = "15.35 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class UniformLoad: GroundLoad {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "5.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "0.5 * ((safeZoneH / 1.2) / 25)";
};
class UniformContainer: GroundContainer {
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "6 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "11 * (safeZoneH / 40)";
h = "14 * ((safeZoneH / 1.2) / 25)";
};
class VestTab: UniformTab {
x = "18.85 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class VestSlot: SlotPrimary {
x = "19.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class VestLoad: GroundLoad {
x = "18.85 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "5.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "0.5 * ((safeZoneH / 1.2) / 25)";
};
class BackpackTab: UniformTab {
x = "22.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class BackpackSlot: SlotPrimary {
x = "22.85 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "2.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3 * (safeZoneH / 40)";
h = "3 * ((safeZoneH / 1.2) / 25)";
};
class BackpackLoad: GroundLoad {
x = "22.6 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "5.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "3.5 * (safeZoneH / 40)";
h = "0.5 * ((safeZoneH / 1.2) / 25)";
};
class TotalLoad: GroundLoad {
//center: progressbar height decrease
x = "15.1 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "22.5 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "23.4 * (safeZoneH / 40)";
h = "0.5 * ((safeZoneH / 1.2) / 25)";
};
class ContainerMarker: GroundTab {
x = "0 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "24 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "1 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class GroundMarker: ContainerMarker {
x = "1.5 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "24 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "1 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class SoldierMarker: ContainerMarker {
x = "3 * (safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)";
y = "24 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)";
w = "1 * (safeZoneH / 40)";
h = "1 * ((safeZoneH / 1.2) / 25)";
};
class ACE_Settings {
class GVAR(inventoryDisplaySize) {
value = 0;
typeName = "SCALAR";
isClientSetable = 1;
displayName = "$STR_ACE_Inventory_SettingName";
description = "$STR_ACE_Inventory_SettingDescription";
values[] = {"Normal (Default Size)", "Medium", "Bigger"};
};
};

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2015-02-13 -->
<Project name="ACE">
<Package name="Inventory">
<Key ID="STR_ACE_Inventory_SettingName">
<English>Make Inventory Display Bigger</English>
</Key>
<Key ID="STR_ACE_Inventory_SettingDescription">
<English>Normally inventory display is scaled by UI size. This allows scaling the Inventory UI size up, but doesn't increase font size allowing more rows displayed.</English>
</Key>
</Package>
</Project>

View File

@ -3,7 +3,7 @@
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {"AGM_acc_pointer_red","AGM_acc_pointer_green"};
weapons[] = {"ACE_acc_pointer_red","ACE_acc_pointer_green"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"commy2"};

View File

@ -4,3 +4,8 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
};
};

View File

@ -1,19 +0,0 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class GVAR(CutFence) {
displayName = "$STR_ACE_logistics_wirecutter_CutFence";
condition = QUOTE([_player] call FUNC(canCutFence));
statement = QUOTE([_player] call FUNC(cutDownFence));
exceptions[] = {};
showDisabled = 1;
priority = 0;
icon = PATHTOF(UI\wirecutter_ca.paa);
hotkey = "C";
};
};
};
};
};

View File

@ -0,0 +1,5 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler);

View File

@ -2,11 +2,11 @@
ADDON = false;
PREP(canCutFence);
PREP(cutDownFence);
PREP(cutDownFenceAbort);
PREP(cutDownFenceCallback);
PREP(getNearestFence);
PREP(interactEH);
PREP(isFence);
ADDON = true;

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_interaction"};
requiredAddons[] = {"ace_interact_menu"};
author[] = {"gpgpgpgp", "PabstMirror"};
authorUrl = "";
VERSION_CONFIG;
@ -13,6 +13,5 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "CfgSounds.hpp"
#include "CfgWeapons.hpp"

View File

@ -1,18 +0,0 @@
/* fnc_canCutFence.sqf
*
* Author: PabstMirror
*
* Condition check if player is able to cut a fence.
* Checks for "ACE_wirecutter" item and if there is a nearby fence.
*
* Argument:
* 0: OBJECT - Unit to check condition for (player)
*
* Return value:
* BOOL
*/
#include "script_component.hpp"
PARAMS_1(_unit);
("ACE_wirecutter" in (items _unit)) && {!(isNull ([_unit] call FUNC(getNearestFence)))}

View File

@ -1,20 +1,31 @@
// by gpgpgpgp, edited by commy2
/*
* Author: gpgpgpgp, edited by commy2, PabstMirror
* Starts cutting down a fence
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Fence <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, berlinWall] call ace_logistics_wirecutter_fnc_cutDownFence
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
private ["_timeToCut"];
PARAMS_2(_unit,_fenceObject);
if (_unit != ACE_player) exitWith {};
_fenceObject = [ACE_player] call FUNC(getNearestFence);
if (isNull _fenceObject) exitWith {};
_timeToCut = 5;
if !([ACE_player] call EFUNC(common,isEngineer)) then {
_timeToCut = _timeToCut + 5;
};
_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {5} else {10};
[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
if (_timeToCut > 4.5) then {
if (_timeToCut > 5) then {
playSound "ACE_wirecutter_sound_long";
} else {
playSound "ACE_wirecutter_sound";

View File

@ -1,4 +1,18 @@
// by commy2
/*
* Author: commy2
* Stops cutting down fence (reset animation)
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
* [] call ace_logistics_wirecutter_fnc_cutDownFenceAbort
*
* Public: No
*/
#include "script_component.hpp"
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);

View File

@ -1,7 +1,22 @@
/*
* Author: PabstMirror
* Once progressbar is done: Fence is cutdown
*
* Arguments:
* 0: Fence Object <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [aFence] call ace_logistics_wirecutter_fnc_cutDownFenceCallback
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_fenceObject);
_fenceObject setdamage 1;
[localize "STR_ACE_logistics_wirecutter_FenceCut"] call EFUNC(common,displayTextStructured);
// [localize "STR_ACE_logistics_wirecutter_FenceCut"] call EFUNC(common,displayTextStructured);
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);

View File

@ -1,15 +1,18 @@
/* fnc_getNearestFence.sqf
*
* Author: PabstMirror
*
* Gets nearest fence within 5 meters to the unit.
*
* Argument:
* 0: OBJECT - Unit to search for fence objects arround
*
* Return value:
* OBJECT - Nearest object that is a fence, objNull if none found.
*/
/*
* Author: PabstMirror
* Gets nearest fence object (not actully used, left for utility)
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* The return value <OBJECT>
*
* Example:
* [player] call ace_logistics_wirecutter_fnc_getNearestFence
*
* Public: Yes
*/
#include "script_component.hpp"
private "_nearestFence";
@ -20,6 +23,6 @@ _nearestFence = objNull;
if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then {
_nearestFence = _x;
};
} forEach nearestObjects [_unit, [], 5];
} forEach nearestObjects [_unit, [], 15];
_nearestFence

View File

@ -0,0 +1,64 @@
/*
* Author: PabstMirror
* When interact_menu starts rendering (from "interact_keyDown" event)
*
* Arguments:
* Interact Menu Type (0 - world, 1 - self) <NUMBER>
*
* Return Value:
* Nothing
*
* Example:
* [0] call ace_logistics_wirecutter_fnc_interactEH
*
* Public: Yes
*/
#include "script_component.hpp"
PARAMS_1(_interactionType);
if (_interactionType != 0) exitWith {};
//for performance only do stuff it they have a wirecutter item
//(if they somehow get one durring keydown they'll just have to reopen)
if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
[{
private ["_fncStatement", "_attachedFence", "_fncCondition", "_helper"];
PARAMS_2(_args,_pfID);
EXPLODE_3_PVT(_args,_setPosition,_addedHelpers,_fencesHelped);
if (!EGVAR(interact_menu,keyDown)) then {
{deleteVehicle _x;} forEach _addedHelpers;
[_pfID] call CBA_fnc_removePerFrameHandler;
} else {
//If play moved >5 meters from last pos, then rescan
if (((getPosASL ace_player) distance _setPosition) > 5) then {
_fncStatement = {
_attachedFence = _target getVariable [QGVAR(attachedFence), objNull];
[ace_player, _attachedFence] call FUNC(cutDownFence);
};
_fncCondition = {
_attachedFence = _target getVariable [QGVAR(attachedFence), objNull];
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items ace_player))})
};
{
if (!(_x in _fencesHelped)) then {
if ([_x] call FUNC(isFence)) then {
_fencesHelped pushBack _x;
_helper = "Sign_Sphere25cm_F" createVehicleLocal (getpos _x);
[_helper, 0, [""], (localize "STR_ACE_logistics_wirecutter_CutFence"), QUOTE(PATHTOF(ui\wirecutter_ca.paa)), [0,0,0], _fncStatement, _fncCondition, 5] call EFUNC(interact_menu,addAction);
_helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]);
_helper hideObject true;
_helper setVariable [QGVAR(attachedFence), _x];
_addedHelpers pushBack _helper;
};
};
} forEach nearestObjects [ace_player, [], 15];
_args set [0, (getPosASL ace_player)];
};
};
}, 0.1, [((getPosASL ace_player) vectorAdd [-100,0,0]), [], []]] call CBA_fnc_addPerFrameHandler;

Some files were not shown because too many files have changed in this diff Show More