mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Wirecutter - Replace fences with destroyed models when cut (#8106)
* Add more fence types for wirecutter * Replace fences with destroyed models when cut * Move fence destruction to server side
This commit is contained in:
parent
5bc43fe247
commit
61e8ae3c8b
@ -12,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));
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -80,4 +80,19 @@ class CfgVehicles {
|
|||||||
class Land_BackAlley_01_l_1m_F: Wall_F {
|
class Land_BackAlley_01_l_1m_F: Wall_F {
|
||||||
GVAR(isFence) = 1;
|
GVAR(isFence) = 1;
|
||||||
};
|
};
|
||||||
|
class Land_GameProofFence_01_l_5m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_03_m_3m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_03_m_3m_corner_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_03_m_3m_hole_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
|
class Land_NetFence_03_m_9m_F: Wall_F {
|
||||||
|
GVAR(isFence) = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
PREP(cutDownFence);
|
PREP(cutDownFence);
|
||||||
|
PREP(destroyFence);
|
||||||
PREP(interactEH);
|
PREP(interactEH);
|
||||||
PREP(isFence);
|
PREP(isFence);
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
|
||||||
|
|
||||||
["ace_interactMenuOpened", {_this call FUNC(interactEH)}] call CBA_fnc_addEventHandler;
|
|
9
addons/logistics_wirecutter/XEH_postInit.sqf
Normal file
9
addons/logistics_wirecutter/XEH_postInit.sqf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
if (hasInterface) then {
|
||||||
|
["ace_interactMenuOpened", {_this call FUNC(interactEH)}] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
[QGVAR(destroyFence), {_this call FUNC(destroyFence)}] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
@ -6,4 +6,28 @@ PREP_RECOMPILE_START;
|
|||||||
#include "XEH_PREP.hpp"
|
#include "XEH_PREP.hpp"
|
||||||
PREP_RECOMPILE_END;
|
PREP_RECOMPILE_END;
|
||||||
|
|
||||||
|
if (isServer) then {
|
||||||
|
GVAR(replacements) = createHashMapFromArray [
|
||||||
|
["gameprooffence_01_l_5m_f.p3d", [["Land_GameProofFence_01_l_d_F", [0, 0, 0], 0]]],
|
||||||
|
["indfnc_3_f.p3d", [["Land_IndFnc_3_D_F", [0.039, -0.221, 0], 0]]],
|
||||||
|
["indfnc_3_hole_f.p3d", [["Land_IndFnc_3_D_F", [0.042, -0.252, 0], 0]]],
|
||||||
|
["indfnc_9_f.p3d", [["Land_IndFnc_3_F", [-3, -0.06, 0], 0], ["Land_IndFnc_3_D_F", [0.039, -0.281, 0], 0], ["Land_IndFnc_3_F", [3, -0.06, 0], 0]]],
|
||||||
|
["indfnc_corner_f.p3d", [["Land_IndFnc_3_D_F", [0.116, -0.223, 0], 0]]],
|
||||||
|
["mil_wiredfence_f.p3d", [["Land_Mil_WiredFenceD_F", [0, 0, 0], 0]]],
|
||||||
|
["net_fence_8m_f.p3d", [["Land_Net_FenceD_8m_F", [0, 0.1, 0], 0]]],
|
||||||
|
["netfence_01_m_4m_f.p3d", [["Land_NetFence_01_m_d_F", [0, 0, 0], 0]]],
|
||||||
|
["netfence_01_m_8m_f.p3d", [["Land_NetFence_01_m_4m_F", [-2, 0, 0], 0], ["Land_NetFence_01_m_d_F", [2, 0, 0], 0]]],
|
||||||
|
["netfence_03_m_3m_corner_f.p3d", [["Land_NetFence_03_m_3m_d_F", [0.104, -0.183, 0], 0]]],
|
||||||
|
["netfence_03_m_3m_f.p3d", [["Land_NetFence_03_m_3m_d_F", [0.042, -0.236, 0], 0]]],
|
||||||
|
["netfence_03_m_3m_hole_f.p3d", [["Land_NetFence_03_m_3m_d_F", [0.045, -0.273, 0], 0]]],
|
||||||
|
["netfence_03_m_9m_f.p3d", [["Land_NetFence_03_m_3m_F", [-3.006, -0.073, 0], 0], ["Land_NetFence_03_m_3m_d_F", [0.038, -0.309, 0], 0], ["Land_NetFence_03_m_3m_F", [2.995, -0.073, 0], 0]]],
|
||||||
|
["plasticnetfence_01_long_f.p3d", [["Land_PlasticNetFence_01_long_d_F", [0, 0, -0.1], 0]]],
|
||||||
|
["wired_fence_4m_f.p3d", [["Land_Wired_Fence_4mD_F", [0, 0, 0], 0]]],
|
||||||
|
["wired_fence_8m_f.p3d", [["Land_Wired_Fence_4m_F", [-2, 0, 0], 0], ["Land_Wired_Fence_4mD_F", [3, 0, 0], 0]]],
|
||||||
|
["wiredfence_01_16m_f.p3d", [["Land_WiredFence_01_4m_F", [-6, 0, 0], 0], ["Land_WiredFence_01_8m_d_F", [0.34, -0.1, 0], 0]]],
|
||||||
|
["wiredfence_01_4m_f.p3d", [["Land_WiredFence_01_pole_F", [-2, 0, 0], 150]]],
|
||||||
|
["wiredfence_01_8m_f.p3d", [["Land_WiredFence_01_4m_F", [-2, 0, 0], 0], ["Land_WiredFence_01_pole_F", [0, 0, 0], 0]]]
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -35,7 +35,7 @@ if !(_unit call EFUNC(common,isSwimming)) then {
|
|||||||
TRACE_1("Fence cutting successful",_this);
|
TRACE_1("Fence cutting successful",_this);
|
||||||
(_this select 0) params ["_unit", "_fence"];
|
(_this select 0) params ["_unit", "_fence"];
|
||||||
|
|
||||||
_fence setDamage 1;
|
[QGVAR(destroyFence), [_fence]] call CBA_fnc_serverEvent;
|
||||||
if !(_unit call EFUNC(common,isSwimming)) then {
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
||||||
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
42
addons/logistics_wirecutter/functions/fnc_destroyFence.sqf
Normal file
42
addons/logistics_wirecutter/functions/fnc_destroyFence.sqf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: BaerMitUmlaut
|
||||||
|
* Destroys the given fence and replaces it with a destroyed fence if possible.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Fence <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [fence] call ace_logistics_wirecutter_fnc_destroyFence
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_fence"];
|
||||||
|
|
||||||
|
private _fenceModel = toLower ((getModelInfo _fence)#0);
|
||||||
|
|
||||||
|
// If fence cannot be replaced with destroyed model, just knock it over
|
||||||
|
if !(_fenceModel in GVAR(replacements)) exitWith {
|
||||||
|
_fence setDamage 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove old fence
|
||||||
|
if ([_fence] call CBA_fnc_isTerrainObject) then {
|
||||||
|
_fence setDamage 1;
|
||||||
|
_fence hideObjectGlobal true;
|
||||||
|
} else {
|
||||||
|
deleteVehicle _fence;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create replacement(s)
|
||||||
|
{
|
||||||
|
_x params ["_type", "_position", "_dir"];
|
||||||
|
|
||||||
|
private _replacement = _type createVehicle [0, 0, 0];
|
||||||
|
_replacement setPosWorld (_fence modelToWorldWorld _position);
|
||||||
|
_replacement setDir (direction _fence + _dir);
|
||||||
|
} forEach (GVAR(replacements) get _fenceModel);
|
@ -70,6 +70,7 @@
|
|||||||
"gm_gc_g501_sm70_02.p3d",\
|
"gm_gc_g501_sm70_02.p3d",\
|
||||||
"gm_gc_g501_sm70_03.p3d",\
|
"gm_gc_g501_sm70_03.p3d",\
|
||||||
"netfence_03_m_3m_f.p3d",\
|
"netfence_03_m_3m_f.p3d",\
|
||||||
|
"netfence_03_m_3m_hole_f.p3d",\
|
||||||
"netfence_03_m_3m_corner_f.p3d",\
|
"netfence_03_m_3m_corner_f.p3d",\
|
||||||
"netfence_03_m_9m_f.p3d",\
|
"netfence_03_m_9m_f.p3d",\
|
||||||
"vineyardfence_01_f.p3d",\
|
"vineyardfence_01_f.p3d",\
|
||||||
|
Loading…
Reference in New Issue
Block a user