Skip to content

Commit 9e7db6e

Browse files
committed
Added ESE_Entities.CanPickUpEntity() and ESE_Entities.IsEntityWeapon()
1 parent 84ac2a4 commit 9e7db6e

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Enforce-Script-Extensions v0.2.1 pre-release
1+
# Enforce-Script-Extensions v0.2.2 pre-release
22
A collection of new data types, methods, aliases etc. for Arma Reforger to help streamline the scripting experience.
33

44
For full documentation, [see the wiki](https://github.com/NarcoMarshDev/Enforce-Script-Extensions/wiki).

resourceDatabase.rdb

25 Bytes
Binary file not shown.

scripts/Game/ESE.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ESE
2222
{
2323
static const int VERSION_MAJOR = 0;
2424
static const int VERSION_MINOR = 2;
25-
static const int VERSION_PATCH = 1;
25+
static const int VERSION_PATCH = 2;
2626

2727
// Base class for all ESE static methods, if we ever get modding support for core types many of these will get added to their respective classes as well
2828

scripts/Game/ESE_Entities.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,35 @@ class ESE_Entities
7777
RplComponent.DeleteRplEntity(ent, false);
7878
}
7979
// -----------------------------------------------------------------------------------------------------------
80+
// #ESE_ADD_DOCUMENTATION
81+
// Checks if given entity can be picked up as an inventory item
82+
static bool CanPickUpEntity(IEntity ent)
83+
{
84+
ActionsManagerComponent actionsManager = ActionsManagerComponent.Cast(ent.FindComponent(ActionsManagerComponent));
85+
if (!actionsManager)
86+
return false;
87+
88+
array<BaseUserAction> actionsArray = new array<BaseUserAction>();
89+
actionsManager.GetActionsList(actionsArray);
90+
foreach (BaseUserAction action: actionsArray)
91+
{
92+
if (action.GetActionName() == "#AR-Inventory_PickUp")
93+
{
94+
return true;
95+
}
96+
}
97+
return false;
98+
}
99+
// -----------------------------------------------------------------------------------------------------------
100+
// #ESE_ADD_DOCUMENTATION
101+
static bool IsEntityWeapon(IEntity ent)
102+
{
103+
if (ent.FindComponent(WeaponComponent) && CanPickUpEntity(ent))
104+
return true;
105+
106+
return false;
107+
}
108+
// -----------------------------------------------------------------------------------------------------------
80109
// Returns alive state of given entity
81110
static bool IsEntityAlive(IEntity entity)
82111
{

0 commit comments

Comments
 (0)