Changed mortar initialization to getIn; Zeus-controlled AI will not trigger the init.

This commit is contained in:
VKing 2015-12-19 19:54:45 +01:00
parent 85270e4521
commit b4cb5c2ba7
5 changed files with 31 additions and 4 deletions

View File

@ -22,3 +22,10 @@ class Extended_InitPost_EventHandlers {
}; };
}; };
}; };
class Extended_GetIn_EventHandlers {
class Mortar_01_base_F {
class ADDON {
getIn = QUOTE(_this call COMPILE_FILE(XEH_getIn));
};
};
};

View File

@ -0,0 +1,15 @@
#include "script_component.hpp"
params ["_mortar","_crewPosition","_unit","_turretPath"];
TRACE_4("",_mortar,_crewPosition,_unit,_turretPath);
if (_unit != player || {_crewPosition != "GUNNER"}) 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,5 +1,10 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_mortar"];
TRACE_1("",_mortar);
if (gunner _mortar != player) exitWith {LOG("Exit")};
if (!EGVAR(common,settingsInitFinished)) exitWith { if (!EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [{ EGVAR(common,runAtSettingsInitialized) pushBack [{
if (GVAR(useAmmoHandling)) then { if (GVAR(useAmmoHandling)) then {

View File

@ -23,11 +23,11 @@
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
if (GVAR(useAmmoHandling)) then { if (GVAR(useAmmoHandling) && {_vehicle getVariable [QGVAR(initialized),false] && !(_vehicle getVariable [QGVAR(exclude),false])}) then {
if !(_vehicle getVariable [QGVAR(exclude),false]) then { // if !(_vehicle getVariable [QGVAR(exclude),false]) then {
_vehicle removeMagazineGlobal (_vehicle magazinesTurret [0] select 0); _vehicle removeMagazineGlobal (_vehicle magazinesTurret [0] select 0);
TRACE_1("",_vehicle magazinesTurret [0]); TRACE_1("",_vehicle magazinesTurret [0]);
}; // };
}; };
if (!GVAR(airResistanceEnabled)) exitWith {}; if (!GVAR(airResistanceEnabled)) exitWith {};

View File

@ -18,7 +18,7 @@
params ["_mortar"]; params ["_mortar"];
private ["_newWeapon","_currentWeapon"]; private ["_newWeapon","_currentWeapon"];
if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {}; if (_mortar getVariable [QGVAR(initialized),false] || _mortar getVariable [QGVAR(exclude),false]) exitWith {TRACE_1("Exit",_mortar)};
// Remove all magazines // Remove all magazines
if (count magazines _mortar > 0) then { if (count magazines _mortar > 0) then {