cookoff ammo selections default values (#4604)

* cookoff ammo selections default values

* Add missing subTurret cache for Wheeled APCs
This commit is contained in:
commy2 2016-10-28 22:10:40 +02:00 committed by Glowbal
parent 2df4a28145
commit eb38290aaf
2 changed files with 20 additions and 8 deletions

View File

@ -28,20 +28,16 @@ class CfgVehicles {
class Tank; class Tank;
class Tank_F: Tank { class Tank_F: Tank {
GVAR(ammoLocation) = "HitTurret"; GVAR(ammoLocation) = "HitHull";
GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"}; GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"};
}; };
class MBT_02_base_F: Tank_F {
class MBT_01_base_F: Tank_F { GVAR(ammoLocation) = "HitTurret";
GVAR(ammoLocation) = "HitHull";
};
class APC_Tracked_01_base_F: Tank_F {
GVAR(ammoLocation) = "HitHull";
}; };
class Car_F; class Car_F;
class Wheeled_APC_F: Car_F { class Wheeled_APC_F: Car_F {
GVAR(ammoLocation) = "HitTurret"; GVAR(ammoLocation) = "HitHull";
GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"}; GVAR(cookoffSelections)[] = {"poklop_gunner","poklop_commander"};
// big explosions for wheeled APCs (same as for tanks) // big explosions for wheeled APCs (same as for tanks)

View File

@ -36,6 +36,22 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
["Wheeled_APC_F", "init", { ["Wheeled_APC_F", "init", {
params ["_vehicle"]; params ["_vehicle"];
private _typeOf = typeOf _vehicle;
if (isNil {GVAR(cacheTankDuplicates) getVariable _typeOf}) then {
private _hitpoints = (getAllHitPointsDamage _vehicle param [0, []]) apply {toLower _x};
private _duplicateHitpoints = [];
{
if ((_x != "") && {_x in (_hitpoints select [0,_forEachIndex])}) then {
_duplicateHitpoints pushBack _forEachIndex;
};
} forEach _hitpoints;
TRACE_2("dupes",_typeOf,_duplicateHitpoints);
GVAR(cacheTankDuplicates) setVariable [_typeOf, _duplicateHitpoints];
};
_vehicle addEventHandler ["HandleDamage", { _vehicle addEventHandler ["HandleDamage", {
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)]) then { if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)]) then {
["tank", _this] call FUNC(handleDamage); ["tank", _this] call FUNC(handleDamage);