-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
5bc43fe
commit 61e8ae3
Showing
9 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
PREP(cutDownFence); | ||
PREP(destroyFence); | ||
PREP(interactEH); | ||
PREP(isFence); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
addons/logistics_wirecutter/functions/fnc_destroyFence.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters