Update some WeaponHolder to WeaponHolderBase

This commit is contained in:
ebaydayz
2016-03-31 11:35:33 -04:00
parent c54a52a103
commit 6de88c7b07
47 changed files with 621 additions and 876 deletions

View File

@@ -16,6 +16,9 @@ Author: Foxy
#define Array_GetSet(array, index, value) ([array, index, value] call dz_fn_array_getSet)
#define Array_GetSet_Fast(array, index, value) ([(array) select (index), (array) set [index, value]] select 0)
#define Array_PushBack(array, element) ([array, element] call dz_fn_array_pushBack)
#define Array_PushBack_Fast(array, element) Array_Set(array, count (array), element)
//Returns true if any of the array elements matches the specified predicate
#define Array_Any(arr, predicate) ([arr, predicate] call dz_fn_array_any)

View File

@@ -35,9 +35,21 @@ Return value indicates if and where the item was placed. */
#define Player_AddItem_RESULT_GROUND 2
#define Player_AddItem_RESULT_VEHICLE 3
/* Attempts to the specified item from the player inventory.
Return value indicates whether the item was actually removed. */
#define Player_RemoveWeapon(class) ((class) call dz_fn_player_removeWeapon)
#define Player_RemoveWeapon_Fast(class) ([player hasWeapon _this, player removeWeapon _this] select 0)
#define Player_RemoveMagazine(class) ((class) call dz_fn_player_removeMagazine)
#define Player_RemoveMagazine_Fast(class) ([_this in magazines player, player removeMagazine _this] select 0)
/* Adds the specifed item on the ground at the player's feet.
The weaponholder containing the item is returned. Returns null if the function fails.*/
#define Player_DropWeapon(class) ([0, class] call dz_fn_player_dropItem)
#define Player_DropMagazine(class) ([1, class] call dz_fn_player_dropItem)
#define Player_GetStance_STAND 1
#define Player_GetStance_KNEEL 2
#define Player_GetStance_PRONE 3
#define Player_GetStance() (1 + floor ((((toArray animationState player) select 5) - 100) / 5))
#endif

View File

@@ -1,5 +1,10 @@
#include "Array.hpp"
dz_fn_array_pushBack =
{
Array_PushBack_Fast(_this select 0, _this select 1)
};
//Returns true if the given predicate evaluates to true for any element in the array
dz_fn_array_any =
{

View File

@@ -131,10 +131,10 @@ dz_fn_player_dropItem =
_wh = nil;
if (count _near == 0) then
{ _wh = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; }
else
if (count _near > 0) then
{ _wh = _near select 0; };
else
{ _wh = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"]; }
if (_this select 0 == 0) then
{ _wh addWeaponCargoGlobal [_this select 1, 1]; }
@@ -148,4 +148,14 @@ dz_fn_player_dropItem =
#undef DROP_ITEM_WEAPON_HOLDER_SEARCH_RADIUS
#undef DROP_ITEM_WEAPON_HOLDER_PLAYER_OFFSET
};
dz_fn_player_removeWeapon =
{
Player_RemoveWeapon_Fast(_this)
};
dz_fn_player_removeMagazine =
{
Player_RemoveMagazine_Fast(_this)
};