Merge pull request #5867 from acemod/spare-items-3den-settings

3den attribute for spare items in cargo
This commit is contained in:
commy2 2017-12-07 18:25:44 +01:00 committed by GitHub
commit 235315e4ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 15 deletions

View File

@ -63,6 +63,28 @@ class Cfg3DEN {
condition = "(1 - objectBrain) * (1 - objectVehicle)";
defaultValue = 0;
};
class GVAR(editorLoadedTracks) {
displayName = CSTRING(editorLoadedTracks);
tooltip = CSTRING(editorLoadedTracks_tooltip);
property = QGVAR(editorLoadedTracks);
control = "Edit";
expression = "_this setVariable ['%s',_value];";
defaultValue = "[0,1] select (_this isKindOf 'Tank')"; // must match pre init script
validate = "number";
condition = "objectHasInventoryCargo";
typeName = "NUMBER";
};
class GVAR(editorLoadedWheels) {
displayName = CSTRING(editorLoadedWheels);
tooltip = CSTRING(editorLoadedWheels_tooltip);
property = QGVAR(editorLoadedWheels);
control = "Edit";
expression = "_this setVariable ['%s',_value];";
defaultValue = "[0,1] select (_this isKindOf 'Car')"; // must match pre init script
validate = "number";
condition = "objectHasInventoryCargo";
typeName = "NUMBER";
};
};
};
};

View File

@ -0,0 +1,5 @@
class CfgEditorSubcategories {
class GVAR(subcategory) {
displayName = ECSTRING(main,Category_Logistics);
};
};

View File

@ -234,7 +234,7 @@ class CfgVehicles {
};
};
class ACE_moduleAddSpareParts: Module_F {
scope = 2;
scope = 1;
displayName = CSTRING(AddSpareParts_Module_DisplayName);
icon = QPATHTOF(ui\Icon_Module_Repair_ca.paa);
category = "ACE_Logistics";
@ -321,7 +321,8 @@ class CfgVehicles {
accuracy = 0.2;
vehicleClass = "ACE_Logistics_Items";
destrType = "DesturctNo"; // scripted delayed destruction
editorCategory = "EdCat_Supplies";
editorSubcategory = QGVAR(subcategory);
};
class ACE_Track: ACE_RepairItem_Base {
@ -335,7 +336,7 @@ class CfgVehicles {
mapSize = 0.5;
// damage handling
armor = 0.6;
armor = 1000;
armorStructural = 1;
minTotalDamageThreshold = 0.01;
explosionShielding = 1;
@ -350,6 +351,8 @@ class CfgVehicles {
QPATHTO_R(data\trailObjects_steel_destruct.rvmat)
};
};
editorPreview = QPATHTOF(data\preview_track.jpg);
};
class ACE_Wheel: ACE_RepairItem_Base {
@ -364,7 +367,7 @@ class CfgVehicles {
mapSize = 0.7;
// damage handling
armor = 0.05;
armor = 120;
armorStructural = 1;
minTotalDamageThreshold = 0.01;
explosionShielding = 1;
@ -396,6 +399,8 @@ class CfgVehicles {
QPATHTO_R(data\trailObjects_steel_destruct.rvmat)
};
};
editorPreview = QPATHTOF(data\preview_wheel.jpg);
};
// disable vanilla repair

View File

@ -5,14 +5,3 @@
// wheels
[QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler;
if (isServer) then {
["ace_settingsInitialized", {
TRACE_1("ace_settingsInitialized eh", GVAR(addSpareParts));
if (!GVAR(addSpareParts)) exitWith {};
if (!(["ace_cargo"] call EFUNC(common,isModLoaded))) exitWith {};
["Car", "Init", {[_this select 0, 1, "ACE_Wheel"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
["Tank", "Init", {[_this select 0, 1, "ACE_Track"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
}] call CBA_fnc_addEventHandler;
};

View File

@ -12,4 +12,27 @@ PREP_RECOMPILE_END;
[{deleteVehicle _this}, _object, 5] call CBA_fnc_waitAndExecute;
}] call CBA_fnc_addClassEventHandler;
// load tracks and wheels
if (isServer) then {
private _fnc_addSpareItems = {
if (!GVAR(addSpareParts)) exitWith {};
params ["_vehicle"];
private _spareTracks = _vehicle getVariable QGVAR(editorLoadedTracks);
if (isNil "_spareTracks") then {
_spareTracks = [0, 1] select (_vehicle isKindOf "Tank"); // must match eden attribute default
};
[_vehicle, _spareTracks, "ACE_Track"] call FUNC(addSpareParts);
private _spareWheels = _vehicle getVariable QGVAR(editorLoadedWheels);
if (isNil "_spareWheels") then {
_spareWheels = [0, 1] select (_vehicle isKindOf "Car"); // must match eden attribute default
};
[_vehicle, _spareWheels, "ACE_Wheel"] call FUNC(addSpareParts);
};
["Tank", "initPost", _fnc_addSpareItems] call CBA_fnc_addClassEventHandler;
["Car", "initPost", _fnc_addSpareItems] call CBA_fnc_addClassEventHandler;
};
ADDON = true;

View File

@ -21,3 +21,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgEditorSubcategories.hpp"

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -1792,5 +1792,22 @@
<Chinesesimp>引擎必须先关闭才能开始进行维修</Chinesesimp>
<Chinese>引擎必須先關閉才能開始進行維修</Chinese>
</Key>
<Key ID="STR_ACE_Repair_editorLoadedTracks">
<English>Spare Tracks</English>
<German>Ersatzketten</German>
</Key>
<Key ID="STR_ACE_Repair_editorLoadedTracks_tooltip">
<English>Number of spare tracks in cargo.</English>
<German>Anzahl der Ersatzketten im Laderaum.</German>
</Key>
<Key ID="STR_ACE_Repair_editorLoadedWheels">
<English>Spare Wheels</English>
<German>Ersatzreifen</German>
</Key>
<Key ID="STR_ACE_Repair_editorLoadedWheels_tooltip">
<English>Number of spare wheels in cargo.</English>
<German>Anzahl der Ersatzreifen im Laderaum.</German>
</Key>
</Package>
</Project>