Skip to content

Commit 4b75ecd

Browse files
SplenectomYrexxar-tc
authored andcommitted
Check for NPC on ownedby condition (#55)
* Check for NPC on ownedby condition Added a check to Keen's mysterious NPC Identity list, since NPCs cannot be found with MySession.Static.Players.TryGetPlayerById * Update CleanupModule.cs * Update CleanupModule.cs * Update CleanupModule.cs * Complying to change req. https://github.com/TorchAPI/Essentials/pull/55/files/970ab4ee61c9cc6eb2f4b082ff7ff00a5d71fda8
1 parent 553954f commit 4b75ecd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎Essentials/Commands/CleanupModule.cs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,16 @@ public bool OwnedBy(MyCubeGrid grid, string str)
280280
{
281281
var player = Utilities.GetPlayerByNameOrId(str);
282282
if (player == null)
283+
{
284+
if(long.TryParse(str, out long NPCId))
285+
{
286+
if(MySession.Static.Players.IdentityIsNpc(NPCId))
287+
{
288+
return grid.BigOwners.Contains(NPCId);
289+
}
290+
}
283291
return false;
284-
292+
}
285293
identityId = player.IdentityId;
286294
}
287295

0 commit comments

Comments
 (0)