mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#2238 - use config for fences + cleanup
This commit is contained in:
parent
27d974687e
commit
2e1d734420
@ -74,6 +74,7 @@ class CfgVehicles {
|
||||
scope = 2;
|
||||
displayName = $STR_ACE_CONCERTINA_WIRE;
|
||||
model = PATHTOF(data\ACE_ConcertinaWire.p3d);
|
||||
EGVAR(logistics_wirecutter,isFence) = 1;
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
selection = "";
|
||||
|
@ -5,4 +5,22 @@ class CfgVehicles {
|
||||
MACRO_ADDITEM(ACE_wirecutter,4);
|
||||
};
|
||||
};
|
||||
|
||||
class Wall_F;
|
||||
class NonStrategic;
|
||||
|
||||
class Land_Net_Fence_4m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Net_Fence_8m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Net_FenceD_8m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_New_WiredFence_5m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_New_WiredFence_10m_Dam_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_New_WiredFence_10m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Pipe_fence_4m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Pipe_fence_4mNoLC_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_SportGround_fence_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Wired_Fence_4m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Wired_Fence_4mD_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Wired_Fence_8m_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Wired_Fence_8mD_F: Wall_F { GVAR(isFence) = 1; };
|
||||
class Land_Razorwire_F: NonStrategic { GVAR(isFence) = 1; };
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ class CfgWeapons {
|
||||
picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa));
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 100;
|
||||
mass = 65;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -3,9 +3,6 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(cutDownFence);
|
||||
PREP(cutDownFenceAbort);
|
||||
PREP(cutDownFenceCallback);
|
||||
PREP(getNearestFence);
|
||||
PREP(interactEH);
|
||||
PREP(isFence);
|
||||
|
||||
|
@ -16,21 +16,35 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
#define SOUND_CLIP_TIME_SPACEING 1.5
|
||||
private ["_timeToCut", "_progressCheck"];
|
||||
params ["_unit", "_fenceObject"];
|
||||
TRACE_2("params",_unit,_fenceObject);
|
||||
|
||||
private ["_timeToCut", "_progressCheck", "_onCompletion", "_onFail"];
|
||||
|
||||
PARAMS_2(_unit,_fenceObject);
|
||||
if (_unit != ACE_player) exitWith {};
|
||||
|
||||
_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11};
|
||||
|
||||
[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
||||
|
||||
_onCompletion = {
|
||||
TRACE_1("_onCompletion",_this);
|
||||
(_this select 0) params ["_fenceObject", "", "_unit"];
|
||||
_fenceObject setdamage 1;
|
||||
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
_onFail = {
|
||||
TRACE_1("_onFail", _this);
|
||||
(_this select 0) params ["", "", "_unit"];
|
||||
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
_progressCheck = {
|
||||
PARAMS_2(_args,_passedTime);
|
||||
EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime);
|
||||
params ["_args", "_passedTime"];
|
||||
_args params ["_fenceObject", "_lastSoundEffectTime"];
|
||||
|
||||
if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then {
|
||||
// playSound "ACE_wirecutter_sound";
|
||||
playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10];
|
||||
_args set [1, _passedTime];
|
||||
};
|
||||
@ -38,4 +52,4 @@ _progressCheck = {
|
||||
((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))})
|
||||
};
|
||||
|
||||
[_timeToCut, [_fenceObject,0], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar);
|
||||
[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck] call EFUNC(common,progressBar);
|
||||
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* 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);
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* 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 LSTRING(FenceCut)] call EFUNC(common,displayTextStructured);
|
||||
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* 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";
|
||||
PARAMS_1(_unit);
|
||||
|
||||
_nearestFence = objNull;
|
||||
{
|
||||
if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then {
|
||||
_nearestFence = _x;
|
||||
};
|
||||
} forEach nearestObjects [_unit, [], 15];
|
||||
|
||||
_nearestFence
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_interactionType);
|
||||
params ["_interactionType"];
|
||||
|
||||
//Ignore self-interaction menu
|
||||
if (_interactionType != 0) exitWith {};
|
||||
@ -26,11 +26,11 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
|
||||
|
||||
[{
|
||||
private ["_fncStatement", "_attachedFence", "_fncCondition", "_helper", "_action"];
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_3_PVT(_args,_setPosition,_addedHelpers,_fencesHelped);
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_setPosition", "_addedHelpers", "_fencesHelped"];
|
||||
|
||||
if (!EGVAR(interact_menu,keyDown)) then {
|
||||
{deleteVehicle _x;} forEach _addedHelpers;
|
||||
{deleteVehicle _x; nil} count _addedHelpers;
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
} else {
|
||||
// Prevent Rare Error when ending mission with interact key down:
|
||||
@ -40,11 +40,12 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
|
||||
if (((getPosASL ace_player) distance _setPosition) > 5) then {
|
||||
|
||||
_fncStatement = {
|
||||
PARAMS_3(_dummyTarget,_player,_attachedFence);
|
||||
params ["", "_player", "_attachedFence"];
|
||||
[_player, _attachedFence] call FUNC(cutDownFence);
|
||||
};
|
||||
_fncCondition = {
|
||||
PARAMS_3(_dummyTarget,_player,_attachedFence);
|
||||
params ["", "_player", "_attachedFence"];
|
||||
if (!([_player, _attachedFence, []] call EFUNC(common,canInteractWith))) exitWith {false};
|
||||
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))})
|
||||
};
|
||||
|
||||
@ -52,15 +53,15 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
|
||||
if (!(_x in _fencesHelped)) then {
|
||||
if ([_x] call FUNC(isFence)) then {
|
||||
_fencesHelped pushBack _x;
|
||||
_helper = "Sign_Sphere25cm_F" createVehicleLocal (getpos _x);
|
||||
_helper = "ACE_LogicDummy" createVehicleLocal (getpos _x);
|
||||
_action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QUOTE(PATHTOF(ui\wirecutter_ca.paa)), _fncStatement, _fncCondition, {}, _x, [0,0,0], 5] call EFUNC(interact_menu,createAction);
|
||||
[_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject);
|
||||
_helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]);
|
||||
_helper hideObject true;
|
||||
_addedHelpers pushBack _helper;
|
||||
};
|
||||
};
|
||||
} forEach nearestObjects [ace_player, [], 15];
|
||||
nil
|
||||
} count nearestObjects [ace_player, [], 15];
|
||||
|
||||
_args set [0, (getPosASL ace_player)];
|
||||
};
|
||||
|
@ -16,27 +16,26 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
//find is case sensitive, so keep everything lowercase
|
||||
#define FENCE_TYPENAMES ["land_net_fence_4m_f", "land_net_fence_8m_f", "land_net_fenced_8m_f", "land_new_wiredfence_5m_f", "land_new_wiredfence_10m_dam_f", "land_new_wiredfence_10m_f", "land_pipe_fence_4m_f", "land_pipe_fence_4mnolc_f", "land_sportground_fence_f", "land_wired_fence_4m_f", "land_wired_fence_4md_f", "land_wired_fence_8m_f", "land_wired_fence_8md_f", "land_razorwire_f", "ace_concertinawire"]
|
||||
|
||||
#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"]
|
||||
params ["_object"];
|
||||
TRACE_1("params",_object);
|
||||
|
||||
private ["_typeOf", "_returnValue"];
|
||||
PARAMS_1(_object);
|
||||
|
||||
_typeOf = toLower (typeOf _object);
|
||||
_returnValue = false;
|
||||
|
||||
if (_typeOf != "") then {
|
||||
//If the fence has configEntry we can check it directly
|
||||
_returnValue = _typeOf in FENCE_TYPENAMES;
|
||||
_returnValue = (1 == (getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence))));
|
||||
} else {
|
||||
//TODO: 1.50 use getModelInfo
|
||||
_typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d"
|
||||
{
|
||||
if ((_typeOf find _x) != -1) exitWith {
|
||||
_returnValue = true;
|
||||
};
|
||||
} forEach FENCE_P3DS;
|
||||
nil
|
||||
} count FENCE_P3DS;
|
||||
};
|
||||
|
||||
_returnValue
|
||||
|
@ -10,3 +10,9 @@
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
//find is case sensitive, so keep everything lowercase
|
||||
#define FENCE_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"]
|
||||
|
||||
#define SOUND_CLIP_TIME_SPACEING 1.5
|
||||
|
Loading…
Reference in New Issue
Block a user