mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
cleaning up in common
This commit is contained in:
parent
82042f85f4
commit
bdc60c074a
@ -42,19 +42,3 @@ class Extended_Respawn_EventHandlers {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(dropObject) {
|
||||
Killed = QUOTE(if (local (_this select 0)) then {[ARR_2(_this select 0, ObjNull)] call FUNC(carryObj)};);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_GetIn_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(dropObject) {
|
||||
GetIn = QUOTE(if (local (_this select 0)) then {[ARR_2(_this select 0, ObjNull)] call FUNC(carryObj)};);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -171,8 +171,6 @@ GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
}, 0, []] call cba_fnc_addPerFrameHandler;
|
||||
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(carriedBy),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
[QGVAR(carriedObj),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
|
||||
["VehicleSetFuel", {
|
||||
PARAMS_2(_vehicle,_fuelLevel);
|
||||
|
@ -15,7 +15,6 @@ PREP(adminKick);
|
||||
PREP(ambientBrightness);
|
||||
PREP(applyForceWalkStatus);
|
||||
PREP(ASLToPosition);
|
||||
PREP(beingCarried);
|
||||
PREP(binarizeNumber);
|
||||
PREP(blurScreen);
|
||||
PREP(cachedCall);
|
||||
@ -23,8 +22,6 @@ PREP(canGetInPosition);
|
||||
PREP(canInteract);
|
||||
PREP(canInteractWith);
|
||||
PREP(canUseWeapon);
|
||||
PREP(carriedByObj);
|
||||
PREP(carryObj);
|
||||
PREP(changeProjectileDirection);
|
||||
PREP(checkPBOs);
|
||||
PREP(claim);
|
||||
@ -58,8 +55,6 @@ PREP(fixPosition);
|
||||
PREP(getAllDefinedSetVariables);
|
||||
PREP(getAllGear);
|
||||
PREP(getCaptivityStatus);
|
||||
PREP(getCarriedBy);
|
||||
PREP(getCarriedObj);
|
||||
PREP(getConfigCommander);
|
||||
PREP(getConfigGunner);
|
||||
PREP(getDeathAnim);
|
||||
@ -122,7 +117,6 @@ PREP(isModLoaded);
|
||||
PREP(isPlayer);
|
||||
PREP(isTurnedOut);
|
||||
PREP(letterToCode);
|
||||
PREP(limitMovementSpeed);
|
||||
PREP(loadPerson);
|
||||
PREP(loadPersonLocal);
|
||||
PREP(loadSettingsFromProfile);
|
||||
@ -160,7 +154,6 @@ PREP(serverLog);
|
||||
PREP(setArrestState);
|
||||
PREP(setCanInteract);
|
||||
PREP(setCaptivityStatus);
|
||||
PREP(setCarriedBy);
|
||||
PREP(setDefinedVariable);
|
||||
PREP(setDisableUserInputStatus);
|
||||
PREP(setForceWalkStatus);
|
||||
|
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* fn_beingCarried.sqf
|
||||
* @Descr: Check if object is being carried
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [object OBJECT]
|
||||
* @Return: BOOL True if object is being carried
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
!(isNull ([_this select 0] call FUNC(getCarriedObj)));
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* fn_carriedByObj.sqf
|
||||
* @Descr: Check if object A is being carried by object B.
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [object OBJECT, unit OBJECT]
|
||||
* @Return: BOOL True if B is carrying A.
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
([(_this select 0)] call FUNC(getCarriedBy) == [(_this select 1)] call FUNC(getCarriedBy));
|
@ -1,72 +0,0 @@
|
||||
/**
|
||||
* fn_carryObj.sqf
|
||||
* @Descr: Have a unit carry an object. Use ObjNull for second parameter if you want the unit to carry nothing
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, objectToCarry OBJECT, attachToVector ARRAY (Optional)]
|
||||
* @Return: BOOL Returns true if succesful
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return", "_fallDown", "_carriedObj", "_positionUnit"];
|
||||
_unit = [_this, 0,ObjNull, [ObjNull]] call bis_fnc_param;
|
||||
_to = [_this, 1,ObjNull, [ObjNull]] call bis_fnc_param;
|
||||
_fallDown = false;
|
||||
if (count _this > 3) then {
|
||||
_fallDown = _this select 3;
|
||||
};
|
||||
_return = false;
|
||||
|
||||
[format["fnc_carryObj - UNIT: %1 ATTEMPTS TO CARRY %2",_unit,_to],2] call FUNC(debug);
|
||||
|
||||
if (((typeName _to) == "OBJECT" && (isNull ([_unit] call FUNC(getCarriedObj)))) || isNull _to) then {
|
||||
if (vehicle _unit != _unit) exitwith {};
|
||||
if (!isNull _to) then {
|
||||
if ((isNull ([_to] call FUNC(getCarriedObj))) && ([_unit] call FUNC(canInteract))) then {
|
||||
_return = true;
|
||||
_unit setvariable [QGVAR(carriedObj),_to,true];
|
||||
if (_fallDown) then {
|
||||
// [_unit,_fallDown] call FUNC(limitMovementSpeed);
|
||||
};
|
||||
[_to, _unit] call FUNC(setCarriedBy);
|
||||
if (count _this > 2) then {
|
||||
if (count (_this select 2) == 3) then {
|
||||
_to attachTo [_unit,(_this select 2)];
|
||||
[format["fnc_carryObj - UNIT: %1 TO %2 - attachTo offset: %3",_unit,_to,(_this select 2)],2] call FUNC(debug);
|
||||
};
|
||||
};
|
||||
["carryObject", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent);
|
||||
// ["carryObject", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent;
|
||||
};
|
||||
} else {
|
||||
if (!isNull ([_unit] call FUNC(getCarriedObj))) then {
|
||||
[format["fnc_carryObj - UNIT: %1 DROPING CARRIED OBJECT",_unit],2] call FUNC(debug);
|
||||
_carriedObj = ([_unit] call FUNC(getCarriedObj));
|
||||
|
||||
detach _carriedObj;
|
||||
//_carriedObj setPosATL [(getPosATL _carriedObj) select 0, (getPosATL _carriedObj) select 1,0];
|
||||
if (!surfaceIsWater getPos _unit) then {
|
||||
_positionUnit = getPosATL _carriedObj;
|
||||
_positionUnit set [2, ((getPosATL _unit) select 2) + 0.1];
|
||||
_carriedObj setPosATL _positionUnit;
|
||||
} else {
|
||||
_positionUnit = getPosASL _carriedObj;
|
||||
_positionUnit set [2, ((getPosASL _unit) select 2) + 0.1];
|
||||
_carriedObj setPosASL _positionUnit;
|
||||
};
|
||||
|
||||
[[_unit] call FUNC(getCarriedObj), objNull] call FUNC(setCarriedBy);
|
||||
_unit setvariable [QGVAR(carriedObj),_to,true];
|
||||
_return = true;
|
||||
|
||||
["carryObjectDropped", [_unit], [_unit, _to, _fallDown]] call EFUNC(common,targetEvent);
|
||||
// ["carryObjectDropped", [_unit, _to, _fallDown]] call ace_common_fnc_localEvent;
|
||||
|
||||
};
|
||||
};
|
||||
} else {
|
||||
[format["fnc_carryObj - UNIT: %1 FAILED TO CARRY %2 - not an object or already carrying",_unit,_to],2] call FUNC(debug);
|
||||
};
|
||||
_return
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* fn_getCarriedBy.sqf
|
||||
* @Descr: Get the object that is carrying given unit or object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: OBJECT Returns the object that is carrying the unit. Otherwise returns ObjNull
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(carriedBy),objNull]);
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* fn_getCarriedObj.sqf
|
||||
* @Descr: Grab the registered carried object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT]
|
||||
* @Return: OBJECT Returns the object that the unit is currently carrying. If not carrying, returns ObjNull
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
((_this select 0) getvariable [QGVAR(carriedObj),objNull]);
|
@ -1,53 +0,0 @@
|
||||
/**
|
||||
* fn_limitMovementSpeed.sqf
|
||||
* @Descr: Limits the movement speed of a unit
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unit OBJECT, fallDown BOOL (Optional)]
|
||||
* @Return: void
|
||||
* @PublicAPI: true
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_carriedObj"];
|
||||
_unit = _this select 0;
|
||||
_fallDown = false;
|
||||
if (count _this > 1) then {
|
||||
_fallDown = _this select 1;
|
||||
};
|
||||
|
||||
if ((_unit getvariable [QGVAR(limitMovementSpeed),false])) exitwith {
|
||||
_unit setvariable [QGVAR(limitMovementSpeed),nil,true];
|
||||
};
|
||||
|
||||
[{
|
||||
private["_unit","_fallDown","_carriedObj"];
|
||||
_unit = (_this select 0) select 0;
|
||||
_fallDown = (_this select 0) select 1;
|
||||
|
||||
_carriedObj = [_unit] call FUNC(getCarriedObj);
|
||||
|
||||
if !(_unit getvariable [QGVAR(limitMovementSpeed),false]) exitwith {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
if !((!isNull _carriedObj) && (alive _unit)) exitwith {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround _unit) then {
|
||||
|
||||
_unit setVelocity [0,0,0];
|
||||
|
||||
if (_fallDown) then {
|
||||
_unit playMove "amovppnemstpsraswrfldnon";
|
||||
};
|
||||
|
||||
if (_carriedObj isKindOf "Man") then {
|
||||
hint "You can not move this fast while transporting this person.";
|
||||
} else {
|
||||
hint "You can not move this fast while carrying this object";
|
||||
};
|
||||
[_unit,ObjNull] call FUNC(carryObj);
|
||||
};
|
||||
}, 0.5, [_unit,_fallDown] ] call CBA_fnc_addPerFrameHandler;
|
@ -35,8 +35,6 @@ if (_unit distance _loadcar <= 10) then {
|
||||
};
|
||||
if (!isNull _vehicle) then {
|
||||
[_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide);
|
||||
[_caller,objNull] call FUNC(carryObj);
|
||||
[_unit,objNull] call FUNC(carryObj);
|
||||
[[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
_vehicle
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* fn_setCarriedBy.sqf
|
||||
* @Descr: Registers an object being carried by another object
|
||||
* @Author: Glowbal
|
||||
*
|
||||
* @Arguments: [unitToBeCarried OBJECT, objectCarrying OBJECT]
|
||||
* @Return: BOOL True if succesfully registered
|
||||
* @PublicAPI: false
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_to","_return"];
|
||||
_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_to = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param;
|
||||
_return = false;
|
||||
if ((isNull ([_unit] call FUNC(getCarriedBy))) || isNull _to) then {
|
||||
_return = true;
|
||||
_unit setvariable [QGVAR(carriedBy),_to,true];
|
||||
};
|
||||
_return
|
Loading…
Reference in New Issue
Block a user