Skip to content

Commit

Permalink
Cargo - Improve config and fnc_getNameItem (#8777)
Browse files Browse the repository at this point in the history
* change macro, block rename statics

* change macro, block rename statics

* revert noRename, improve getName function

* fix derp
  • Loading branch information
LinkIsGrim authored Jan 30, 2022
1 parent 00f35a3 commit 1013e1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 7 additions & 5 deletions addons/cargo/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,41 +426,43 @@ class CfgVehicles {
class Land_CanisterFuel_F: Items_base_F {
GVAR(size) = 1;
GVAR(canLoad) = 1;
EGVAR(cargo,noRename) = 1;
GVAR(noRename) = 1;
};

// Flexible Fuel tanks, 300L
class FlexibleTank_base_F: ThingX {
GVAR(size) = 3;
GVAR(canLoad) = 1;
GVAR(noRename) = 1;
};

// objects
class RoadCone_F: ThingX {
GVAR(size) = 1;
GVAR(canLoad) = 1;
EGVAR(cargo,noRename) = 1;
GVAR(noRename) = 1;
};
class RoadBarrier_F: RoadCone_F {
GVAR(size) = 2;
GVAR(noRename) = 1;
};

class Lamps_base_F;
class Land_PortableLight_single_F: Lamps_base_F {
GVAR(size) = 2;
GVAR(canLoad) = 1;
EGVAR(cargo,noRename) = 1;
GVAR(noRename) = 1;
};
class FloatingStructure_F;
class Land_Camping_Light_F: FloatingStructure_F {
GVAR(size) = 0.2;
GVAR(canLoad) = 1;
EGVAR(cargo,noRename) = 1;
GVAR(noRename) = 1;
};
class Land_Camping_Light_off_F: ThingX {
GVAR(size) = 0.2;
GVAR(canLoad) = 1;
EGVAR(cargo,noRename) = 1;
GVAR(noRename) = 1;
};


Expand Down
7 changes: 5 additions & 2 deletions addons/cargo/functions/fnc_getNameItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@

params ["_object", ["_addCustomPart", false]];

private _class = if (_object isEqualType "") then {_object} else {typeOf _object};
private _displayName = getText (configFile >> "CfgVehicles" >> _class >> "displayName");
private _displayName = if (_object isEqualType "") then {
getText (configFile >> "CfgVehicles" >> _object >> "displayName")
} else {
getText ((configOf _object) >> "displayName")
};

if (_addCustomPart && {!(_object isEqualType "")}) then {
private _customPart = _object getVariable [QGVAR(customName), ""];
Expand Down

0 comments on commit 1013e1a

Please sign in to comment.