Merge pull request #97 from KoffeinFlummi/agmWirecutterPort

Port: AGM Wirecutters
This commit is contained in:
PabstMirror 2015-02-01 11:03:20 -06:00
commit 58a71e6a66
22 changed files with 276 additions and 1 deletions

View File

@ -2,4 +2,4 @@
#include "script_component.hpp"
QGVAR(CurrentTooltip) pushBack (_this select 0);
GVAR(CurrentTooltip) pushBack (_this select 0);

View File

@ -0,0 +1 @@
z\ace\addons\logistics_wirecutter

View File

@ -0,0 +1,6 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};

View 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[] = {};
};
};

View 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";
};
};
};
};
};

View 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;
};
};
};

View 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)

View 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;

View 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"

View 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)))}

View 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);

View File

@ -0,0 +1,4 @@
// by commy2
#include "script_component.hpp"
[ACE_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);

View File

@ -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);

View File

@ -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

View 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

View File

@ -0,0 +1 @@
#include "\z\ace\addons\logistics_wirecutter\script_component.hpp"

View 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"

Binary file not shown.

Binary file not shown.

View 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>

Binary file not shown.

Binary file not shown.