mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Wire cutter - Various improvements and cleanup (#6389)
* Optimize and cleanup interactEH function * Add missing fences and improve formatting * Improve cutDownFence function * Remove unused sound files and cleanup * Multi-line condition and fix examples * Increase PFH delay and use distanceSqr
This commit is contained in:
parent
3673a6f56a
commit
def05b9cf1
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class Extended_PreStart_EventHandlers {
|
class Extended_PreStart_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||||
@ -13,6 +12,6 @@ class Extended_PreInit_EventHandlers {
|
|||||||
|
|
||||||
class Extended_PostInit_EventHandlers {
|
class Extended_PostInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
|
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
class CfgSounds {
|
|
||||||
class ACE_Wirecutter_sound {
|
|
||||||
name = "ACE_wirecutter_sound";
|
|
||||||
sound[] = {QPATHTOF(sound\wire_cut.ogg), "db-0", 1};
|
|
||||||
titles[] = {};
|
|
||||||
};
|
|
||||||
class ACE_Wirecutter_sound_long {
|
|
||||||
name = "ACE_wirecutter_sound_long";
|
|
||||||
sound[] = {QPATHTOF(sound\wire_cut_long.ogg), "db-0", 1};
|
|
||||||
titles[] = {};
|
|
||||||
};
|
|
||||||
};
|
|
@ -8,19 +8,76 @@ class CfgVehicles {
|
|||||||
|
|
||||||
class Wall_F;
|
class Wall_F;
|
||||||
class NonStrategic;
|
class NonStrategic;
|
||||||
|
class Land_Net_Fence_4m_F: Wall_F {
|
||||||
class Land_Net_Fence_4m_F: Wall_F { GVAR(isFence) = 1; };
|
GVAR(isFence) = 1;
|
||||||
class Land_Net_Fence_8m_F: Wall_F { GVAR(isFence) = 1; };
|
};
|
||||||
class Land_New_WiredFence_5m_F: Wall_F { GVAR(isFence) = 1; };
|
class Land_Net_Fence_8m_F: Wall_F {
|
||||||
class Land_New_WiredFence_10m_F: Wall_F { GVAR(isFence) = 1; };
|
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_New_WiredFence_5m_F: Wall_F {
|
||||||
class Land_Wired_Fence_8m_F: Wall_F { GVAR(isFence) = 1; };
|
GVAR(isFence) = 1;
|
||||||
class Land_SportGround_fence_noLC_F: Wall_F { GVAR(isFence) = 1; };
|
};
|
||||||
class Land_Mil_WiredFence_F: Wall_F { GVAR(isFence) = 1; };
|
class Land_New_WiredFence_10m_F: Wall_F {
|
||||||
class Land_IndFnc_Corner_F: Wall_F { GVAR(isFence) = 1; };
|
GVAR(isFence) = 1;
|
||||||
class Land_IndFnc_9_F: Wall_F { GVAR(isFence) = 1; };
|
};
|
||||||
class Land_IndFnc_3_Hole_F: Wall_F { GVAR(isFence) = 1; };
|
class Land_SportGround_fence_F: Wall_F {
|
||||||
class Land_IndFnc_3_F: Wall_F { GVAR(isFence) = 1; };
|
GVAR(isFence) = 1;
|
||||||
class Land_Razorwire_F: NonStrategic { GVAR(isFence) = 1; };
|
};
|
||||||
|
class Land_Wired_Fence_4m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_Wired_Fence_8m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_SportGround_fence_noLC_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_Mil_WiredFence_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_IndFnc_Corner_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_IndFnc_9_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_IndFnc_3_Hole_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_IndFnc_3_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_Razorwire_F: NonStrategic {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_PlasticNetFence_01_short_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_PlasticNetFence_01_long_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_01_m_4m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_01_m_8m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_WiredFence_01_4m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_WiredFence_01_8m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_WiredFence_01_16m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_Slums01_8m: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_Slums02_4m: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_BackAlley_01_l_1m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class CfgWeapons {
|
class CfgWeapons {
|
||||||
class CBA_MiscItem_ItemInfo;
|
|
||||||
class ACE_ItemCore;
|
class ACE_ItemCore;
|
||||||
|
class CBA_MiscItem_ItemInfo;
|
||||||
|
|
||||||
class ACE_wirecutter: ACE_ItemCore {
|
class ACE_wirecutter: ACE_ItemCore {
|
||||||
author = ECSTRING(common,ACETeam);
|
author = ECSTRING(common,ACETeam);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
ace_logistics_wirecutter
|
ace_logistics_wirecutter
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Adds an item that allows cutting of fences in Aarma 3 and AiA/CUP maps.
|
Adds an item that allows cutting of fences in Arma 3 and AiA/CUP maps.
|
||||||
|
|
||||||
#### Items Added:
|
#### Items Added:
|
||||||
`ACE_wirecutter`
|
`ACE_wirecutter`
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
PREP(cutDownFence);
|
PREP(cutDownFence);
|
||||||
PREP(interactEH);
|
PREP(interactEH);
|
||||||
PREP(isFence);
|
PREP(isFence);
|
||||||
|
@ -8,7 +8,7 @@ class CfgPatches {
|
|||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_interaction"};
|
requiredAddons[] = {"ace_interaction"};
|
||||||
author = ECSTRING(common,ACETeam);
|
author = ECSTRING(common,ACETeam);
|
||||||
authors[] = {"gpgpgpgp", "PabstMirror"};
|
authors[] = {"gpgpgpgp", "PabstMirror", "mharis001"};
|
||||||
url = ECSTRING(main,URL);
|
url = ECSTRING(main,URL);
|
||||||
VERSION_CONFIG;
|
VERSION_CONFIG;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
class StageTI
|
class StageTI {
|
||||||
{
|
texture = "a3\data_f\default_glass_ti_ca.paa";
|
||||||
texture = "a3\data_f\default_glass_ti_ca.paa";
|
|
||||||
};
|
};
|
||||||
ambient[] = {1,1,1,1};
|
ambient[] = {1,1,1,1};
|
||||||
diffuse[] = {1,1,1,1};
|
diffuse[] = {1,1,1,1};
|
||||||
@ -10,81 +9,71 @@ specular[] = {0,0,0,1};
|
|||||||
specularPower = 0;
|
specularPower = 0;
|
||||||
PixelShaderID = "Super";
|
PixelShaderID = "Super";
|
||||||
VertexShaderID = "Super";
|
VertexShaderID = "Super";
|
||||||
class Stage1
|
class Stage1 {
|
||||||
{
|
texture = "z\ace\addons\logistics_wirecutter\data\ace_wirecutter_nohq.paa";
|
||||||
texture = "z\ace\addons\logistics_wirecutter\data\ace_wirecutter_nohq.paa";
|
uvSource = "tex";
|
||||||
uvSource = "tex";
|
class uvTransform {
|
||||||
class uvTransform
|
aside[] = {1,0,0};
|
||||||
{
|
up[] = {0,1,0};
|
||||||
aside[] = {1,0,0};
|
dir[] = {0,0,0};
|
||||||
up[] = {0,1,0};
|
pos[] = {0,0,0};
|
||||||
dir[] = {0,0,0};
|
};
|
||||||
pos[] = {0,0,0};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class Stage2
|
class Stage2 {
|
||||||
{
|
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)";
|
||||||
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0.5,DT)";
|
uvSource = "tex";
|
||||||
uvSource = "tex";
|
class uvTransform {
|
||||||
class uvTransform
|
aside[] = {1,0,0};
|
||||||
{
|
up[] = {0,1,0};
|
||||||
aside[] = {1,0,0};
|
dir[] = {0,0,0};
|
||||||
up[] = {0,1,0};
|
pos[] = {0,0,0};
|
||||||
dir[] = {0,0,0};
|
};
|
||||||
pos[] = {0,0,0};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class Stage3
|
class Stage3
|
||||||
{
|
{
|
||||||
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
|
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
|
||||||
uvSource = "tex";
|
uvSource = "tex";
|
||||||
class uvTransform
|
class uvTransform {
|
||||||
{
|
aside[] = {1,0,0};
|
||||||
aside[] = {1,0,0};
|
up[] = {0,1,0};
|
||||||
up[] = {0,1,0};
|
dir[] = {0,0,0};
|
||||||
dir[] = {0,0,0};
|
pos[] = {0,0,0};
|
||||||
pos[] = {0,0,0};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class Stage4
|
class Stage4
|
||||||
{
|
{
|
||||||
texture = "#(argb,8,8,3)color(1,1,1,1,AS)";
|
texture = "#(argb,8,8,3)color(1,1,1,1,AS)";
|
||||||
uvSource = "tex";
|
uvSource = "tex";
|
||||||
class uvTransform
|
class uvTransform {
|
||||||
{
|
aside[] = {1,0,0};
|
||||||
aside[] = {1,0,0};
|
up[] = {0,1,0};
|
||||||
up[] = {0,1,0};
|
dir[] = {0,0,0};
|
||||||
dir[] = {0,0,0};
|
pos[] = {0,0,0};
|
||||||
pos[] = {0,0,0};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class Stage5
|
class Stage5
|
||||||
{
|
{
|
||||||
texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)";
|
texture = "#(argb,8,8,3)color(0,0.6,1,1,SMDI)";
|
||||||
uvSource = "tex";
|
uvSource = "tex";
|
||||||
class uvTransform
|
class uvTransform {
|
||||||
{
|
aside[] = {1,0,0};
|
||||||
aside[] = {1,0,0};
|
up[] = {0,1,0};
|
||||||
up[] = {0,1,0};
|
dir[] = {0,0,0};
|
||||||
dir[] = {0,0,0};
|
pos[] = {0,0,0};
|
||||||
pos[] = {0,0,0};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
class Stage6
|
class Stage6 {
|
||||||
{
|
texture = "#(ai,32,128,1)fresnel(0.71,0.74)";
|
||||||
texture = "#(ai,32,128,1)fresnel(0.71,0.74)";
|
uvSource = "none";
|
||||||
uvSource = "none";
|
};
|
||||||
|
class Stage7 {
|
||||||
|
texture = "a3\data_f\env_land_co.paa";
|
||||||
|
useWorldEnvMap = "true";
|
||||||
|
uvSource = "tex";
|
||||||
|
class uvTransform {
|
||||||
|
aside[] = {1.0,0.0,0.0};
|
||||||
|
up[] = {0.0,1.0,0.0};
|
||||||
|
dir[] = {0.0,0.0,0.0};
|
||||||
|
pos[] = {0.0,0.0,0.0};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
class Stage7
|
|
||||||
{
|
|
||||||
texture = "a3\data_f\env_land_co.paa";
|
|
||||||
useWorldEnvMap = "true";
|
|
||||||
uvSource = "tex";
|
|
||||||
class uvTransform
|
|
||||||
{
|
|
||||||
aside[] = {1.0,0.0,0.0};
|
|
||||||
up[] = {0.0,1.0,0.0};
|
|
||||||
dir[] = {0.0,0.0,0.0};
|
|
||||||
pos[] = {0.0,0.0,0.0};
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: gpgpgpgp, edited by commy2, PabstMirror
|
* Author: gpgpgpgp, commy2, PabstMirror, mharis001
|
||||||
* Starts cutting down a fence
|
* Starts cutting down a fence. Triggers global "ace_wireCuttingStarted" event.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -10,52 +10,59 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player, berlinWall] call ace_logistics_wirecutter_fnc_cutDownFence
|
* [player, cursorObject] call ace_logistics_wirecutter_fnc_cutDownFence
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_fenceObject"];
|
params ["_unit", "_fence"];
|
||||||
TRACE_2("params",_unit,_fenceObject);
|
TRACE_2("Fence cutting started",_unit,_fence);
|
||||||
|
|
||||||
if (_unit != ACE_player) exitWith {};
|
if (_unit != ACE_player) exitWith {};
|
||||||
|
|
||||||
private _timeToCut = if ([_unit] call EFUNC(common,isEngineer)) then {7.5} else {11};
|
// Get cut time based on if unit is a engineer
|
||||||
|
private _cutTime = if (_unit call EFUNC(common,isEngineer)) then {CUT_TIME_ENGINEER} else {CUT_TIME_DEFAULT};
|
||||||
|
|
||||||
if !(_unit call EFUNC(common,isSwimming)) then {
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
||||||
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _onCompletion = {
|
[
|
||||||
TRACE_1("_onCompletion",_this);
|
_cutTime,
|
||||||
(_this select 0) params ["_fenceObject", "", "_unit"];
|
[_unit, _fence, 0],
|
||||||
_fenceObject setdamage 1;
|
{
|
||||||
if !(_unit call EFUNC(common,isSwimming)) then {
|
TRACE_1("Fence cutting successful",_this);
|
||||||
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
(_this select 0) params ["_unit", "_fence"];
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _onFail = {
|
_fence setDamage 1;
|
||||||
TRACE_1("_onFail", _this);
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
||||||
(_this select 0) params ["", "", "_unit"];
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
||||||
if !(_unit call EFUNC(common,isSwimming)) then {
|
};
|
||||||
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
},
|
||||||
};
|
{
|
||||||
};
|
TRACE_1("Fence cutting failed",_this);
|
||||||
|
(_this select 0) params ["_unit"];
|
||||||
|
|
||||||
private _progressCheck = {
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
||||||
params ["_args", "_passedTime"];
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
||||||
_args params ["_fenceObject", "_lastSoundEffectTime", "_unit"];
|
};
|
||||||
|
},
|
||||||
|
localize LSTRING(CuttingFence),
|
||||||
|
{
|
||||||
|
params ["_args", "_elapsedTime"];
|
||||||
|
_args params ["_unit", "_fence", "_lastSoundTime"];
|
||||||
|
|
||||||
if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then {
|
if (_elapsedTime > _lastSoundTime + SOUND_CLIP_TIME_SPACING) then {
|
||||||
playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL _unit), 3, 1, 10];
|
playSound3D [QPATHTO_R(sound\wirecut.ogg), objNull, false, getPosASL _unit, 3, 1, 10];
|
||||||
_args set [1, _passedTime];
|
_args set [2, _elapsedTime];
|
||||||
};
|
};
|
||||||
|
|
||||||
((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items _unit))})
|
!isNull _fence
|
||||||
};
|
&& {damage _fence < 1}
|
||||||
|
&& {"ACE_wirecutter" in ([_player, false, true, true, true, false] call CBA_fnc_uniqueUnitItems)}
|
||||||
|
},
|
||||||
|
["isNotSwimming"]
|
||||||
|
] call EFUNC(common,progressBar);
|
||||||
|
|
||||||
[_timeToCut, [_fenceObject,0,_unit], _onCompletion, _onFail, localize LSTRING(CuttingFence), _progressCheck, ["isNotSwimming"]] call EFUNC(common,progressBar);
|
["ace_wireCuttingStarted", [_unit, _fence]] call CBA_fnc_globalEvent;
|
||||||
|
|
||||||
["ace_wireCuttingStarted", [_unit, _fenceObject]] call CBA_fnc_globalEvent;
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror, mharis001
|
||||||
* When interact_menu starts rendering (from "interact_keyDown" event)
|
* Dynamically adds "Cut Fence" actions to nearby fences when interact_menu is opened.
|
||||||
|
* Called by the "ace_interactMenuOpened" event.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* Interact Menu Type (0 - world, 1 - self) <NUMBER>
|
* Interact Menu Type (0 - World, 1 - Self) <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -11,65 +12,69 @@
|
|||||||
* Example:
|
* Example:
|
||||||
* [0] call ace_logistics_wirecutter_fnc_interactEH
|
* [0] call ace_logistics_wirecutter_fnc_interactEH
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_interactionType"];
|
params ["_interactionType"];
|
||||||
|
|
||||||
//Ignore self-interaction menu or mounted vehicle interaction
|
// Ignore self-interaction menu or mounted vehicle interaction
|
||||||
if ((_interactionType != 0) || {(vehicle ACE_player) != ACE_player}) exitWith {};
|
// For performance reasons only add PFH if player has wirecutter item
|
||||||
|
// If player somehow gets a wirecutter during keyDown, they will just have to reopen menu
|
||||||
|
if (
|
||||||
|
_interactionType != 0
|
||||||
|
|| {vehicle ACE_player != ACE_player}
|
||||||
|
|| {!("ACE_wirecutter" in ([ACE_player, false, true, true, true, false] call CBA_fnc_uniqueUnitItems))}
|
||||||
|
) exitWith {};
|
||||||
|
|
||||||
//for performance only do stuff it they have a wirecutter item
|
TRACE_1("Starting wirecuter interact PFH",_interactionType);
|
||||||
//(if they somehow get one durring keydown they'll just have to reopen)
|
|
||||||
if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
|
|
||||||
|
|
||||||
TRACE_1("Starting wire-cut action PFEH",_interactionType);
|
|
||||||
|
|
||||||
[{
|
[{
|
||||||
params ["_args", "_pfID"];
|
BEGIN_COUNTER(interactEH);
|
||||||
|
params ["_args", "_pfhID"];
|
||||||
_args params ["_setPosition", "_addedHelpers", "_fencesHelped"];
|
_args params ["_setPosition", "_addedHelpers", "_fencesHelped"];
|
||||||
|
|
||||||
if (!EGVAR(interact_menu,keyDown)) then {
|
if (!EGVAR(interact_menu,keyDown)) then {
|
||||||
{deleteVehicle _x; nil} count _addedHelpers;
|
{deleteVehicle _x} forEach _addedHelpers;
|
||||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
[_pfhID] call CBA_fnc_removePerFrameHandler;
|
||||||
} else {
|
} else {
|
||||||
// Prevent Rare Error when ending mission with interact key down:
|
// Prevent rare error when ending mission with interact key down
|
||||||
if (isNull ace_player) exitWith {};
|
if (isNull ACE_player) exitWith {};
|
||||||
|
|
||||||
//If player moved >5 meters from last pos, then rescan
|
|
||||||
if (((getPosASL ace_player) distance _setPosition) > 5) then {
|
|
||||||
|
|
||||||
|
// Rescan if player has moved more than 5 meters from last position
|
||||||
|
if (getPosASL ACE_player distanceSqr _setPosition > 25) then {
|
||||||
private _fncStatement = {
|
private _fncStatement = {
|
||||||
params ["", "_player", "_attachedFence"];
|
params ["", "_player", "_attachedFence"];
|
||||||
|
|
||||||
[_player, _attachedFence] call FUNC(cutDownFence);
|
[_player, _attachedFence] call FUNC(cutDownFence);
|
||||||
};
|
};
|
||||||
private _fncCondition = {
|
private _fncCondition = {
|
||||||
params ["_helper", "_player", "_attachedFence"];
|
params ["_helper", "_player", "_attachedFence"];
|
||||||
if (!([_player, _attachedFence, ["isNotSwimming"]] call EFUNC(common,canInteractWith))) exitWith {false};
|
|
||||||
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))} && {
|
!isNull _attachedFence
|
||||||
//Custom LOS check for fence
|
&& {damage _attachedFence < 1}
|
||||||
private _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot");
|
&& {"ACE_wirecutter" in ([_player, false, true, true, true, false] call CBA_fnc_uniqueUnitItems)}
|
||||||
((!(lineIntersects [AGLtoASL _headPos, AGLtoASL (_helper modelToWorldVisual [0,0,1.25]), _attachedFence, ACE_player])) ||
|
&& {[_player, _attachedFence, ["isNotSwimming"]] call EFUNC(common,canInteractWith)}
|
||||||
{!(lineIntersects [AGLtoASL _headPos, getPosASL _attachedFence, _attachedFence, ACE_player])})
|
&& {
|
||||||
})
|
// Custom LOS check for fence
|
||||||
|
private _headPos = AGLtoASL (_player modelToWorldVisual (_player selectionPosition "pilot"));
|
||||||
|
!lineIntersects [_headPos, AGLtoASL (_helper modelToWorldVisual [0, 0, 1.25]), _attachedFence, _player]
|
||||||
|
|| {!lineIntersects [_headPos, getPosASL _attachedFence, _attachedFence, _player]}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!(_x in _fencesHelped)) then {
|
if (!(_x in _fencesHelped) && {_x call FUNC(isFence)}) then {
|
||||||
if ([_x] call FUNC(isFence)) then {
|
_fencesHelped pushBack _x;
|
||||||
_fencesHelped pushBack _x;
|
private _helper = "ACE_LogicDummy" createVehicleLocal [0, 0, 0];
|
||||||
private _helper = "ACE_LogicDummy" createVehicleLocal (getpos _x);
|
private _action = [QGVAR(helperCutFence), localize LSTRING(CutFence), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0, 0, 0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction);
|
||||||
private _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction);
|
[_helper, 0, [], _action] call EFUNC(interact_menu,addActionToObject);
|
||||||
[_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject);
|
_helper setPosASL (getPosASL _x vectorAdd [0, 0, 1.25]);
|
||||||
_helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]);
|
_addedHelpers pushBack _helper;
|
||||||
_addedHelpers pushBack _helper;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
nil
|
} forEach nearestObjects [ACE_player, [], 15];
|
||||||
} count nearestObjects [ace_player, [], 15];
|
|
||||||
|
|
||||||
_args set [0, (getPosASL ace_player)];
|
_args set [0, getPosASL ACE_player];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}, 0.1, [((getPosASL ace_player) vectorAdd [-100,0,0]), [], []]] call CBA_fnc_addPerFrameHandler;
|
END_COUNTER(interactEH);
|
||||||
|
}, 0.5, [getPosASL ACE_player vectorAdd [-100, 0, 0], [], []]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* Author: PabstMirror
|
* Author: PabstMirror
|
||||||
* Checks if object is a fence. Should work on any fence type, even (typeOf == "").
|
* Checks if object is a fence. Should work on any fence type, even when (typeOf == "").
|
||||||
* Call is fairly expensive because of all of the string checking.
|
* Call is fairly expensive because of string checking.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: An Object To Test <OBJECT>
|
* 0: Object to test <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Is it a fence <BOOL>
|
* Is fence <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [aFence] call ace_logistics_wirecutter_fnc_isFence
|
* [cursorObject] call ace_logistics_wirecutter_fnc_isFence
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_object"];
|
params ["_object"];
|
||||||
TRACE_1("params",_object);
|
TRACE_1("Checking if fence",_object);
|
||||||
|
|
||||||
private _typeOf = typeOf _object;
|
private _typeOf = typeOf _object;
|
||||||
|
|
||||||
private _returnValue = if (_typeOf != "") then {
|
private _returnValue = if (_typeOf != "") then {
|
||||||
//If the fence has configEntry we can check it directly
|
// Check for isFence entry since we have valid typeOf
|
||||||
(1 == (getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence))));
|
1 == getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence));
|
||||||
} else {
|
} else {
|
||||||
//Check the p3d name against list (in script_component.hpp)
|
// Check the p3d name against list (in script_component.hpp)
|
||||||
((getModelInfo _object) select 0) in FENCE_P3DS;
|
(getModelInfo _object select 0) in FENCE_P3DS;
|
||||||
};
|
};
|
||||||
|
|
||||||
_returnValue
|
_returnValue
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
|
// find is case sensitive, so keep everything lowercase
|
||||||
//find is case sensitive, so keep everything lowercase
|
|
||||||
#define FENCE_P3DS [\
|
#define FENCE_P3DS [\
|
||||||
"mil_wiredfence_f.p3d",\
|
"mil_wiredfence_f.p3d",\
|
||||||
"wall_indfnc_3.p3d",\
|
"wall_indfnc_3.p3d",\
|
||||||
@ -26,7 +25,21 @@
|
|||||||
"pletivo_wired.p3d",\
|
"pletivo_wired.p3d",\
|
||||||
"wall_fen1_5.p3d",\
|
"wall_fen1_5.p3d",\
|
||||||
"net_fence_8m_f.p3d",\
|
"net_fence_8m_f.p3d",\
|
||||||
"razorwire_f.p3d"\
|
"razorwire_f.p3d",\
|
||||||
|
"wired_fence_4m_f.p3d",\
|
||||||
|
"wired_fence_8m_f.p3d",\
|
||||||
|
"plasticnetfence_01_short_f.p3d",\
|
||||||
|
"plasticnetfence_01_long_f.p3d",\
|
||||||
|
"netfence_01_m_4m_f.p3d",\
|
||||||
|
"netfence_01_m_8m_f.p3d",\
|
||||||
|
"wiredfence_01_4m_f.p3d",\
|
||||||
|
"wiredfence_01_8m_f.p3d",\
|
||||||
|
"wiredfence_01_16m_f.p3d",\
|
||||||
|
"slums01_8m.p3d",\
|
||||||
|
"slums02_4m.p3d",\
|
||||||
|
"backalley_01_l_1m_f.p3d"\
|
||||||
]
|
]
|
||||||
|
|
||||||
#define SOUND_CLIP_TIME_SPACEING 1.5
|
#define SOUND_CLIP_TIME_SPACING 1.5
|
||||||
|
#define CUT_TIME_DEFAULT 11
|
||||||
|
#define CUT_TIME_ENGINEER 7.5
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user