This commit is contained in:
KoffeinFlummi 2015-04-17 15:45:22 +02:00
commit 1d93589ebc
16 changed files with 106 additions and 78 deletions

View File

@ -1,44 +1,28 @@
class Extended_PreInit_EventHandlers { class Extended_PreInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) ); init = QUOTE(call COMPILE_FILE(XEH_preInit));
}; };
}; };
class Extended_PostInit_EventHandlers { class Extended_PostInit_EventHandlers {
class ADDON { class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) ); init = QUOTE(call COMPILE_FILE(XEH_postInit));
}; };
}; };
class Extended_FiredBIS_EventHandlers { class Extended_FiredBIS_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
firedBIS = QUOTE( _this call FUNC(replaceATWeapon) ); firedBIS = QUOTE(_this call FUNC(replaceATWeapon));
}; };
}; };
}; };
// handle preloaded missile // handle preloaded missile
class Extended_Init_EventHandlers { class Extended_InitPost_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
init = QUOTE( _this call FUNC(takeLoadedATWeapon) ); init = QUOTE([ARR_2(_this select 0, secondaryWeapon (_this select 0))] call FUNC(takeLoadedATWeapon); systemChat str [ARR_2(_this select 0, secondaryWeapon (_this select 0))]);
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class ADDON {
take = QUOTE( _this call FUNC(takeLoadedATWeapon); [_this select 0] call FUNC(updateInventoryDisplay); );
};
};
};
class Extended_Put_EventHandlers {
class CAManBase {
class ADDON {
put = QUOTE( [_this select 0] call FUNC(updateInventoryDisplay); );
}; };
}; };
}; };

View File

@ -3,6 +3,7 @@ class CfgMagazines {
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
author = "$STR_ACE_Common_ACETeam"; author = "$STR_ACE_Common_ACETeam";
scope = 1; scope = 1;
scopeArsenal = 1;
displayName = "$STR_ACE_Disposable_PreloadedMissileDummy"; displayName = "$STR_ACE_Disposable_PreloadedMissileDummy";
picture = PATHTOEF(common,UI\blank_CO.paa); picture = PATHTOEF(common,UI\blank_CO.paa);
weaponPoolAvailable = 0; weaponPoolAvailable = 0;

View File

@ -0,0 +1,10 @@
// by commy2
#include "script_component.hpp"
if (!hasInterface) exitWith {};
["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler);
["playerInventoryChanged", {
[_this select 0, _this select 1 select 11] call FUNC(takeLoadedATWeapon);
[_this select 0] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler);

View File

@ -1,10 +0,0 @@
// by commy2
// The Arma InventoryOpened EH fires actually before the inventory dialog is opened (findDisplay 602 => displayNull).
#include "script_component.hpp"
["inventoryDisplayLoaded",{
[ACE_player] call FUNC(takeLoadedATWeapon);
[ACE_player, (_this select 0)] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler);

View File

@ -1,4 +1,3 @@
class Extended_PreInit_EventHandlers { class Extended_PreInit_EventHandlers {
class ADDON { class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit)); init = QUOTE(call COMPILE_FILE(XEH_preInit));

View File

@ -1,12 +0,0 @@
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,8 @@
class CfgVehicles {
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_wirecutter,4);
};
};
};

View File

@ -1,16 +1,16 @@
class CfgWeapons { class CfgWeapons {
class InventoryItem_Base_F; class InventoryItem_Base_F;
class ACE_ItemCore; class ACE_ItemCore;
class ACE_wirecutter: ACE_ItemCore { class ACE_wirecutter: ACE_ItemCore {
author = "$STR_ACE_Common_ACETeam"; author = "$STR_ACE_Common_ACETeam";
displayName = "$STR_ACE_logistics_wirecutter_wirecutterName"; displayName = "$STR_ACE_logistics_wirecutter_wirecutterName";
descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription"; descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription";
model = "\A3\weapons_F\ammo\mag_univ.p3d"; model = "\A3\weapons_F\ammo\mag_univ.p3d";
picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa));
scope = 2; scope = 2;
class ItemInfo: InventoryItem_Base_F { class ItemInfo: InventoryItem_Base_F {
mass = 100; mass = 100;
};
}; };
};
}; };

View File

@ -3,7 +3,7 @@
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {"ACE_wirecutter"};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"}; requiredAddons[] = {"ace_interaction"};
author[] = {"gpgpgpgp", "PabstMirror"}; author[] = {"gpgpgpgp", "PabstMirror"};
@ -13,5 +13,5 @@ class CfgPatches {
}; };
#include "CfgEventHandlers.hpp" #include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"

View File

@ -16,19 +16,26 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define SOUND_CLIP_TIME_SPACEING 1.5
private ["_timeToCut"]; private ["_timeToCut"];
PARAMS_2(_unit,_fenceObject); PARAMS_2(_unit,_fenceObject);
if (_unit != ACE_player) exitWith {}; if (_unit != ACE_player) exitWith {};
_timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {5} else {10}; _timeToCut = if ([ACE_player] call EFUNC(common,isEngineer)) then {7.5} else {11};
[ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); [ACE_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
if (_timeToCut > 5) then { _progressCheck = {
playSound "ACE_wirecutter_sound_long"; PARAMS_2(_args,_passedTime);
} else { EXPLODE_2_PVT(_args,_fenceObject,_lastSoundEffectTime);
playSound "ACE_wirecutter_sound"; if (_passedTime > (_lastSoundEffectTime + SOUND_CLIP_TIME_SPACEING)) then {
// playSound "ACE_wirecutter_sound";
playSound3D [QUOTE(PATHTO_R(sound\wirecut.ogg)), objNull, false, (getPosASL ACE_player), 3, 1, 10];
_args set [1, _passedTime];
};
((!isNull _fenceObject) && {(damage _fenceObject) < 1} && {("ACE_wirecutter" in (items ACE_player))})
}; };
[_timeToCut, [_fenceObject], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence"] call EFUNC(common,progressBar); [_timeToCut, [_fenceObject,0], {(_this select 0) call FUNC(cutDownFenceCallback)}, {(_this select 0) call FUNC(cutDownFenceAbort)}, localize "STR_ACE_logistics_wirecutter_CuttingFence", _progressCheck] call EFUNC(common,progressBar);

View File

@ -20,9 +20,9 @@ PARAMS_1(_unit);
_nearestFence = objNull; _nearestFence = objNull;
{ {
if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then { if ((isNull _nearestFence) && {[_x] call FUNC(isFence)}) then {
_nearestFence = _x; _nearestFence = _x;
}; };
} forEach nearestObjects [_unit, [], 15]; } forEach nearestObjects [_unit, [], 15];
_nearestFence _nearestFence

View File

@ -35,7 +35,7 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
} else { } else {
// Prevent Rare Error when ending mission with interact key down: // Prevent Rare Error when ending mission with interact key down:
if (isNull ace_player) exitWith {}; if (isNull ace_player) exitWith {};
//If player moved >5 meters from last pos, then rescan //If player moved >5 meters from last pos, then rescan
if (((getPosASL ace_player) distance _setPosition) > 5) then { if (((getPosASL ace_player) distance _setPosition) > 5) then {

View File

@ -17,11 +17,9 @@
#include "script_component.hpp" #include "script_component.hpp"
//find is case sensitive, so keep everything lowercase //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_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_P3DS ["mil_wiredfence_f.p3d","wall_indfnc_3.p3d", "wall_indfnc_9.p3d", "wall_indfnc_corner.p3d", "pletivo_wired.p3d", "wall_fen1_5.p3d"]
#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"]; private ["_typeOf", "_returnValue"];
PARAMS_1(_object); PARAMS_1(_object);
@ -30,14 +28,15 @@ _typeOf = toLower (typeOf _object);
_returnValue = false; _returnValue = false;
if (_typeOf != "") then { if (_typeOf != "") then {
_returnValue = _typeOf in (FENCE_A3_TYPENAMES + FENCE_AIA_TYPENAMES); //If the fence has configEntry we can check it directly
_returnValue = _typeOf in FENCE_TYPENAMES;
} else { } else {
_typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d" _typeOf = toLower (str _object); //something like "123201: wall_indfnc_9.p3d"
{ {
if ((_typeOf find _x) != -1) then { if ((_typeOf find _x) != -1) exitWith {
_returnValue = true; _returnValue = true;
}; };
} forEach (FENCE_A3_P3DS + FENCE_AIA_P3DS); } forEach FENCE_P3DS;
}; };
_returnValue _returnValue

View File

@ -14,12 +14,13 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
["ACE3", QGVAR(showAltimeter), localize "STR_ACE_Parachute_showAltimeter", ["ACE3", QGVAR(showAltimeter), localize "STR_ACE_Parachute_showAltimeter",
{ {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false};
if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then { if (!(missionNamespace getVariable [QGVAR(AltimeterActive), false])) then {
[ace_player] call FUNC(showAltimeter); [ace_player] call FUNC(showAltimeter);
@ -40,5 +41,4 @@ GVAR(PFH) = false;
}] call EFUNC(common,addEventHandler); }] call EFUNC(common,addEventHandler);
// don't show speed and height when in expert mode // don't show speed and height when in expert mode
["Parachute", {if (!cadetMode) then {_dlg = _this select 0; {(_dlg displayCtrl _x) ctrlShow false} forEach [121, 122, 1004, 1005, 1006, 1014];};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Parachute" ["infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call EFUNC(common,addEventHandler);
["Soldier", {if (!cadetMode) then {_dlg = _this select 0; {_ctrl = (_dlg displayCtrl _x); _ctrl ctrlSetPosition [0,0,0,0]; _ctrl ctrlCommit 0;} forEach [380, 382]};}] call EFUNC(common,addInfoDisplayEventHandler); //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"

View File

@ -18,6 +18,7 @@
ADDON = false; ADDON = false;
PREP(doLanding); PREP(doLanding);
PREP(handleInfoDisplayChanged);
PREP(hideAltimeter); PREP(hideAltimeter);
PREP(onEachFrame); PREP(onEachFrame);
PREP(showAltimeter); PREP(showAltimeter);

View File

@ -0,0 +1,41 @@
/*
* Author: commy2
* Hides the height and velocity display while freefalling or parachuting on higher difficulties.
*
* Arguments:
* Stuff from infoDisplayChanged eventhandler.
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_dialog", "_type"];
_dialog = _this select 0;
_type = _this select 1;
// don't do anything in noob mode
if (cadetMode) exitWith {};
switch (_type) do {
case ("Parachute"): {
{
(_dialog displayCtrl _x) ctrlShow false;
} forEach [121, 122, 1004, 1005, 1006, 1014];
};
case ("Soldier"): {
{
private "_control";
_control = (_dialog displayCtrl _x);
// these reset ctrlShow every frame by the engine. Set height/width to 0 as work around.
_control ctrlSetPosition [0,0,0,0];
_control ctrlCommit 0;
} forEach [380, 382];
};
};
nil // switch might return true if no case was found. Just to make sure the return value matches