mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #97 from KoffeinFlummi/agmWirecutterPort
Port: AGM Wirecutters
This commit is contained in:
commit
58a71e6a66
@ -2,4 +2,4 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
QGVAR(CurrentTooltip) pushBack (_this select 0);
|
||||
GVAR(CurrentTooltip) pushBack (_this select 0);
|
||||
|
1
addons/logistics_wirecutter/$PBOPREFIX$
Normal file
1
addons/logistics_wirecutter/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\logistics_wirecutter
|
6
addons/logistics_wirecutter/CfgEventHandlers.hpp
Normal file
6
addons/logistics_wirecutter/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
12
addons/logistics_wirecutter/CfgSounds.hpp
Normal file
12
addons/logistics_wirecutter/CfgSounds.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
class CfgSounds {
|
||||
class ACE_Wirecutter_sound {
|
||||
name = "ACE_wirecutter_sound";
|
||||
sound[] = {QUOTE(PATHTOF(sound\wire_cut.ogg)), "db-0", 1};
|
||||
titles[] = {};
|
||||
};
|
||||
class ACE_Wirecutter_sound_long {
|
||||
name = "ACE_wirecutter_sound_long";
|
||||
sound[] = {QUOTE(PATHTOF(sound\wire_cut_long.ogg)), "db-0", 1};
|
||||
titles[] = {};
|
||||
};
|
||||
};
|
19
addons/logistics_wirecutter/CfgVehicles.hpp
Normal file
19
addons/logistics_wirecutter/CfgVehicles.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class GVAR(CutFence) {
|
||||
displayName = "$STR_ACE_logistics_wirecutter_CutFence";
|
||||
condition = QUOTE([_player] call FUNC(canCutFence));
|
||||
statement = QUOTE([_player] call FUNC(cutDownFence));
|
||||
exceptions[] = {};
|
||||
showDisabled = 1;
|
||||
priority = 0;
|
||||
icon = PATHTOF(UI\wirecutter_ca.paa);
|
||||
hotkey = "C";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
16
addons/logistics_wirecutter/CfgWeapons.hpp
Normal file
16
addons/logistics_wirecutter/CfgWeapons.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
class CfgWeapons {
|
||||
class InventoryItem_Base_F;
|
||||
class ACE_ItemCore;
|
||||
|
||||
class ACE_wirecutter: ACE_ItemCore {
|
||||
author = "$STR_ACE_Core_ACETeam";
|
||||
displayName = "$STR_ACE_logistics_wirecutter_wirecutterName";
|
||||
descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription";
|
||||
model = "\A3\weapons_F\ammo\mag_univ.p3d";
|
||||
picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa));
|
||||
scope = 2;
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 100;
|
||||
};
|
||||
};
|
||||
};
|
11
addons/logistics_wirecutter/README.md
Normal file
11
addons/logistics_wirecutter/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
ace_logistics_wirecutter
|
||||
===========
|
||||
|
||||
Adds an item `ACE_wirecutter` that allows cutting of fences in A3 and AiA maps.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
The people responsible for merging changes to this component or answering potential questions.
|
||||
|
||||
- [PabstMirror](https://github.com/PabstMirror)
|
12
addons/logistics_wirecutter/XEH_preInit.sqf
Normal file
12
addons/logistics_wirecutter/XEH_preInit.sqf
Normal file
@ -0,0 +1,12 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(canCutFence);
|
||||
PREP(cutDownFence);
|
||||
PREP(cutDownFenceAbort);
|
||||
PREP(cutDownFenceCallback);
|
||||
PREP(getNearestFence);
|
||||
PREP(isFence);
|
||||
|
||||
ADDON = true;
|
18
addons/logistics_wirecutter/config.cpp
Normal file
18
addons/logistics_wirecutter/config.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common", "ace_interaction"};
|
||||
author[] = {"gpgpgpgp", "PabstMirror"};
|
||||
authorUrl = "";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgSounds.hpp"
|
||||
#include "CfgWeapons.hpp"
|
18
addons/logistics_wirecutter/functions/fnc_canCutFence.sqf
Normal file
18
addons/logistics_wirecutter/functions/fnc_canCutFence.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/* fnc_canCutFence.sqf
|
||||
*
|
||||
* Author: PabstMirror
|
||||
*
|
||||
* Condition check if player is able to cut a fence.
|
||||
* Checks for "ACE_wirecutter" item and if there is a nearby fence.
|
||||
*
|
||||
* Argument:
|
||||
* 0: OBJECT - Unit to check condition for (player)
|
||||
*
|
||||
* Return value:
|
||||
* BOOL
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
PARAMS_1(_unit);
|
||||
|
||||
("ACE_wirecutter" in (items _unit)) && {!(isNull ([_unit] call FUNC(getNearestFence)))}
|
23
addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf
Normal file
23
addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
// by gpgpgpgp, edited by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_unit);
|
||||
if (_unit != ACE_player) exitWith {};
|
||||
|
||||
_fenceObject = [ACE_player] call FUNC(getNearestFence);
|
||||
if (isNull _fenceObject) exitWith {};
|
||||
|
||||
_timeToCut = 5;
|
||||
if !([ACE_player] call EFUNC(common,isEngineer)) then {
|
||||
_timeToCut = _timeToCut + 5;
|
||||
};
|
||||
|
||||
[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
|
||||
|
||||
if (_timeToCut > 4.5) then {
|
||||
playSound "ACE_wirecutter_sound_long";
|
||||
} else {
|
||||
playSound "ACE_wirecutter_sound";
|
||||
};
|
||||
|
||||
[_timeToCut, [_fenceObject], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence"] call EFUNC(common,progressBar);
|
@ -0,0 +1,4 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
@ -0,0 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_fenceObject);
|
||||
|
||||
_fenceObject setdamage 1;
|
||||
[localize "STR_ACE_logistics_wirecutter_FenceCut"] call EFUNC(common,displayTextStructured);
|
||||
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
@ -0,0 +1,25 @@
|
||||
/* fnc_getNearestFence.sqf
|
||||
*
|
||||
* Author: PabstMirror
|
||||
*
|
||||
* Gets nearest fence within 5 meters to the unit.
|
||||
*
|
||||
* Argument:
|
||||
* 0: OBJECT - Unit to search for fence objects arround
|
||||
*
|
||||
* Return value:
|
||||
* OBJECT - Nearest object that is a fence, objNull if none found.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_nearestFence";
|
||||
PARAMS_1(_unit);
|
||||
|
||||
_nearestFence = objNull;
|
||||
{
|
||||
if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then {
|
||||
_nearestFence = _x;
|
||||
};
|
||||
} forEach nearestObjects [_unit, [], 5];
|
||||
|
||||
_nearestFence
|
40
addons/logistics_wirecutter/functions/fnc_isFence.sqf
Normal file
40
addons/logistics_wirecutter/functions/fnc_isFence.sqf
Normal file
@ -0,0 +1,40 @@
|
||||
/* fnc_isFence.sqf
|
||||
*
|
||||
* Author: PabstMirror
|
||||
*
|
||||
* Checks if object is a fence. Should work on any fence type, even (typeof == "").
|
||||
* Call is fairly expensive because of all of the string checking.
|
||||
*
|
||||
* Argument:
|
||||
* 0: OBJECT - Ojbect to test
|
||||
*
|
||||
* Return value:
|
||||
* BOOL
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
//find is case sensitive, so keep everything lowercase
|
||||
#define FENCE_A3_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"]
|
||||
#define FENCE_A3_P3DS ["mil_wiredfence_f.p3d"]
|
||||
|
||||
#define FENCE_AIA_TYPENAMES []
|
||||
#define FENCE_AIA_P3DS ["wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"]
|
||||
|
||||
private ["_typeOf", "_returnValue"];
|
||||
PARAMS_1(_object);
|
||||
|
||||
_typeOf = typeOf _object;
|
||||
_returnValue = false;
|
||||
|
||||
if (_typeOf != "") then {
|
||||
_returnValue = _typeOf in (FENCE_A3_TYPENAMES + FENCE_AIA_TYPENAMES);
|
||||
} else {
|
||||
_typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d"
|
||||
{
|
||||
if ((_typeOf find _x) != -1) then {
|
||||
_returnValue = true;
|
||||
};
|
||||
} forEach (FENCE_A3_P3DS + FENCE_AIA_P3DS);
|
||||
};
|
||||
|
||||
_returnValue
|
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\logistics_wirecutter\script_component.hpp"
|
12
addons/logistics_wirecutter/script_component.hpp
Normal file
12
addons/logistics_wirecutter/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT logistics_wirecutter
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_LOGISTICS_WIRECUTTER
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_LOGISTICS_WIRECUTTER
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
BIN
addons/logistics_wirecutter/sound/wire_cut.ogg
Normal file
BIN
addons/logistics_wirecutter/sound/wire_cut.ogg
Normal file
Binary file not shown.
BIN
addons/logistics_wirecutter/sound/wire_cut_long.ogg
Normal file
BIN
addons/logistics_wirecutter/sound/wire_cut_long.ogg
Normal file
Binary file not shown.
50
addons/logistics_wirecutter/stringtable.xml
Normal file
50
addons/logistics_wirecutter/stringtable.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-21 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Wirecutter">
|
||||
<Key ID="STR_ACE_logistics_wirecutter_wirecutterName">
|
||||
<English>Wirecutter</English>
|
||||
<German>Drahtschneider</German>
|
||||
<Spanish>Wirecutter</Spanish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_logistics_wirecutter_wirecutterDescription">
|
||||
<English>Wirecutter</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_logistics_wirecutter_CutFence">
|
||||
<English>Cut Fence</English>
|
||||
<German>Zaun schneiden</German>
|
||||
<Spanish>Cortar alambrado</Spanish>
|
||||
<Polish>Przetnij płot</Polish>
|
||||
<Czech>Přestřihnout plot</Czech>
|
||||
<French>Cisailler Clôture</French>
|
||||
<Portuguese>Cortar Cerca</Portuguese>
|
||||
<Italian>Taglia</Italian>
|
||||
<Hungarian>Drótkerítés átvágása</Hungarian>
|
||||
<Russian>Вырезать забор</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_logistics_wirecutter_CuttingFence">
|
||||
<English>Cutting Fences / Wires ...</English>
|
||||
<German>Zaun / Draht schneiden ...</German>
|
||||
<Spanish>Cortando alambrado / cables ...</Spanish>
|
||||
<Polish>Przecinanie płotu / drutów ...</Polish>
|
||||
<Czech>Přestřihnout plot / dráty ...</Czech>
|
||||
<French>Cisaille l'obstacle ...</French>
|
||||
<Portuguese>Cortando Cerca / Arame ...</Portuguese>
|
||||
<Italian>Sto tagliando ...</Italian>
|
||||
<Hungarian>Drótok elvágása ...</Hungarian>
|
||||
<Russian>Вырезаем забор / провода ...</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_logistics_wirecutter_FenceCut">
|
||||
<English>Fence cut</English>
|
||||
<German>Zaun geschnitten</German>
|
||||
<Spanish>Alambrado cortado</Spanish>
|
||||
<Polish>Płot przecięty</Polish>
|
||||
<Czech>Plot přestřižen</Czech>
|
||||
<French>Clôture cisaillée</French>
|
||||
<Portuguese>Cerca cortada</Portuguese>
|
||||
<Italian>Fatto!</Italian>
|
||||
<Hungarian>Drótkerítés átvágva</Hungarian>
|
||||
<Russian>Забор вырезан</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
BIN
addons/logistics_wirecutter/ui/item_wirecutter_ca.paa
Normal file
BIN
addons/logistics_wirecutter/ui/item_wirecutter_ca.paa
Normal file
Binary file not shown.
BIN
addons/logistics_wirecutter/ui/wirecutter_ca.paa
Normal file
BIN
addons/logistics_wirecutter/ui/wirecutter_ca.paa
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user