Skip to content

Commit 2fd4453

Browse files
committed
Moved IsEntityOnScreen() from ESE to ESE_Entities
1 parent fb72f24 commit 2fd4453

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

resourceDatabase.rdb

72 Bytes
Binary file not shown.

scripts/Game/ESE.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -141,38 +141,6 @@ class ESE
141141
player.GetCharacterController().SelectWeapon(null);
142142
}
143143
// -----------------------------------------------------------------------------------------------------------
144-
// Returns alive state of given entity
145-
static bool IsEntityAlive(IEntity entity)
146-
{
147-
DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.FindComponent(DamageManagerComponent));
148-
if (damageManager)
149-
return damageManager.GetState() != EDamageState.DESTROYED;
150-
else
151-
return true;
152-
}
153-
// -----------------------------------------------------------------------------------------------------------
154-
#ifdef ESE_ENABLE_WIP
155-
/**
156-
TODO - MAKE SURE THIS WORKS AS INTENDED ON LOCAL PLAYERS WHEN CALLED
157-
Returns true if given entity is visible on local screen, false otherwise
158-
@code
159-
@endcode
160-
*/
161-
static bool IsEntityOnScreen(IEntity ent)
162-
{
163-
WorkspaceWidget workspace = GetGame().GetWorkspace();
164-
float width, height;
165-
workspace.GetScreenSize(width, height);
166-
167-
vector worldPos = ent.GetOrigin();
168-
if (!worldPos)
169-
return false;
170-
171-
vector screenPos = workspace.ProjWorldToScreenNative(worldPos, GetGame().GetWorld());
172-
return screenPos[2] > 0 && screenPos[0] > 0 && screenPos[0] < width && screenPos[1] > 0 && screenPos[1] < height);
173-
}
174-
#endif
175-
// -----------------------------------------------------------------------------------------------------------
176144
/**
177145
Outputs all available magazines for a given weapon and character into a MagazineComponent array
178146
@code

scripts/Game/ESE_Entities.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ class ESE_Entities
7575
IEntity ent = IEntity.Cast(Replication.FindItem(id));
7676
RplComponent.DeleteRplEntity(ent, false);
7777
}
78+
// -----------------------------------------------------------------------------------------------------------
79+
// Returns alive state of given entity
80+
static bool IsEntityAlive(IEntity entity)
81+
{
82+
DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.FindComponent(DamageManagerComponent));
83+
if (damageManager)
84+
return damageManager.GetState() != EDamageState.DESTROYED;
85+
else
86+
return true;
87+
}
7888

7989
// ------------------------------------------------------------- PHYSICS & COLLISION ------------------------------------------------------------- //
8090

0 commit comments

Comments
 (0)