Changed to using playerVehicleChanged.

This commit is contained in:
VKing 2016-02-14 13:51:44 +01:00
parent f652db1d2f
commit 560c509a3a
6 changed files with 23 additions and 55 deletions

View File

@ -15,17 +15,3 @@ class Extended_FiredBIS_EventHandlers {
};
};
};
class Extended_InitPost_EventHandlers {
class Mortar_01_base_F {
class ADDON {
init = QUOTE(_this call COMPILE_FILE(XEH_initPost));
};
};
};
class Extended_GetIn_EventHandlers {
class Mortar_01_base_F {
class ADDON {
getIn = QUOTE(_this call COMPILE_FILE(XEH_getIn));
};
};
};

View File

@ -1,16 +0,0 @@
#include "script_component.hpp"
params ["_mortar","_crewPosition","_unit","_turretPath"];
TRACE_4("",_mortar,_crewPosition,_unit,_turretPath);
if (_unit != player) exitWith {LOG("Exit")};
if (!EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [{
if (GVAR(useAmmoHandling)) then {
_this call FUNC(mortarInit);
};
}, _mortar];
};
_mortar call FUNC(mortarInit);

View File

@ -1,16 +0,0 @@
#include "script_component.hpp"
params ["_mortar"];
TRACE_1("",_mortar);
if (gunner _mortar != player) exitWith {LOG("Exit")};
if (!EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [{
if (GVAR(useAmmoHandling)) then {
_this call FUNC(mortarInit);
};
}, _this];
};
_this call FUNC(mortarInit);

View File

@ -2,7 +2,8 @@
class CfgPatches {
class ADDON {
units[] = {};
units[] = {"ACE_Box_82mm_Mo_HE","ACE_Box_82mm_Mo_Smoke",
"ACE_Box_82mm_Mo_Illum","ACE_Box_82mm_Mo_Combo"};
weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};

View File

@ -3,7 +3,7 @@
* Handles player getting into new vehicle. Loads PFEG for mortar display if it is a mortar.
*
* Arguments:
* 0:Player <OBJECT>
* 0: Player <OBJECT>
* 1: New Vehicle <OBJECT>
*
* Return Value:
@ -23,6 +23,19 @@ private["_tubeWeaponName" ,"_fireModes", "_lastFireMode"];
if (isNull _newVehicle) exitWith {};
if (!(_newVehicle isKindOf "Mortar_01_base_F")) exitWith {};
// Run magazine handling initialization if enabled
if (!EGVAR(common,settingsInitFinished)) then {
EGVAR(common,runAtSettingsInitialized) pushBack [{
if (GVAR(useAmmoHandling) && {!(_this getVariable [QGVAR(initialized),false]) && !(_this getVariable [QGVAR(exclude),false])}) then {
_this call FUNC(mortarInit);
};
}, _newVehicle];
} else {
if (GVAR(useAmmoHandling) && {!(_newVehicle getVariable [QGVAR(initialized),false]) && !(_newVehicle getVariable [QGVAR(exclude),false])}) then {
_newVehicle call FUNC(mortarInit);
};
};
_tubeWeaponName = (weapons _newVehicle) select 0;
_fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes");
@ -49,7 +62,7 @@ if (_lastFireMode != -1) then {
//Save firemode on vehicle:
_mortarVeh setVariable [QGVAR(lastFireMode), _currentChargeMode];
if (shownArtilleryComputer && {!GVAR(allowComputerRangefinder)}) then {
//Don't like this solution, but it works
closeDialog 0;

View File

@ -15,23 +15,23 @@
*/
#include "script_component.hpp"
if !(GVAR(useAmmoHandling)) exitWith {};
params ["_mortar"];
private ["_newWeapon","_currentWeapon"];
if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {TRACE_1("Exit",_mortar)};
// Remove all magazines
if (count magazines _mortar > 0) then {
{_mortar removeMagazineGlobal _x} forEach magazines _mortar;
{
[QGVAR(removeMagazine), [_mortar, _x]] call EFUNC(common,globalEvent);
} forEach magazines _mortar;
};
// Replace current weapon with ammo handling weapon
_currentWeapon = _mortar weaponsTurret [0] select 0;
private _currentWeapon = _mortar weaponsTurret [0] select 0;
private _newWeapon = "";
if (_currentWeapon == "mortar_82mm") then {
_newWeapon = "ace_mortar_82mm"
_newWeapon = "ace_mortar_82mm";
} else {
_newWeapon = getText (configFile >> "CfgWeapons" >> _currentWeapon >> QGVAR(replaceWith));
};