ACE3/addons/logistics_wirecutter/functions/fnc_destroyFence.sqf
Grim e06c6f7835
General - Replace toLower with toLowerANSI where applicable (#9790)
* General - Replace toLower with toLowerANSI where applicable

* whoops

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/repair/functions/fnc_setHitPointDamage.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/repair/dev/draw_showRepairInfo.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* comparment -> compartment

* Update fnc_showHud.sqf

* Update fnc_registerObjects.sqf

* Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-03-07 22:08:13 +01:00

43 lines
1002 B
Plaintext

#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 = toLowerANSI ((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);