forked from Bob-Murphy/A3-Antistasi-1.4
-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hovering over vehicle menu buy button renders a preview of the vehicle. For when the mod-pack (Unsung) doesn't include images.
- Loading branch information
1 parent
7b6ddb2
commit 29338c8
Showing
5 changed files
with
160 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Maintainer: Caleb Serafin | ||
Similar to sizeOf, but it will always return the accurate size. | ||
The bounding-box diameters are cached after the first sizeOf call. | ||
If sizeOf returns 0, a vehicle will be created temporally for measurement. | ||
Arguments: | ||
<STRING> Vehicle Classname. | ||
Return Value: | ||
<SCALAR> The bounding-box diameter of the vehicle. | ||
Scope: Any, Local Effect | ||
Environment: Any | ||
Public: Yes | ||
Example: | ||
["C_Offroad_01_F"] call A3A_GUI_fnc_sizeOf; // 11.4563 | ||
["C_Heli_Light_01_civil_F"] call A3A_GUI_fnc_sizeOf; // 12.6111 | ||
// Within GUI | ||
["C_Offroad_01_F"] call FUNC(sizeOf); // 11.4563 | ||
*/ | ||
|
||
params [ | ||
["_classname", "", [""]] | ||
]; | ||
|
||
if (isNil "A3A_GUI_sizeOf_cache") then { | ||
A3A_GUI_sizeOf_cache = createHashMap; | ||
}; | ||
|
||
if (_classname in A3A_GUI_sizeOf_cache) exitWith { | ||
A3A_GUI_sizeOf_cache get _classname; // Object is cached. | ||
}; | ||
|
||
private _diameter = sizeOf _classname; | ||
if (_diameter != 0) exitWith { | ||
A3A_GUI_sizeOf_cache set [_classname, _diameter]; | ||
_diameter; // Object was not cached but did exist. | ||
}; | ||
|
||
private _object = createVehicle [_classname, [random 1000, random 1000, 1000 + random 1000], [], 0, "CAN_COLLIDE"]; | ||
|
||
if (isNull _object) exitWith { | ||
0; // Object does not exist. | ||
}; | ||
|
||
_diameter = sizeOf _classname; | ||
deleteVehicle _object; | ||
A3A_GUI_sizeOf_cache set [_classname, _diameter]; | ||
_diameter; // Object was not cached and did not exist. |