fix: check other objects correctly
This commit is contained in:
parent
42e4bcd4dd
commit
9ffb0e7854
|
@ -1,5 +1,4 @@
|
|||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Housing;
|
||||
|
@ -100,26 +99,38 @@ public class ScreenshotMetadata {
|
|||
// var relevantModObjects = new List<Dalamud.Game.ClientState.Objects.Types.GameObject>();
|
||||
var relevantModObjects = new List<ushort>();
|
||||
var visible = plugin.ObjectTable
|
||||
.Where(obj => {
|
||||
.Select((obj, idx) => (obj, idx))
|
||||
.Where(tuple => {
|
||||
var (obj, idx) = tuple;
|
||||
// pull a sneaky and populate the relevantModObjects list here
|
||||
if (
|
||||
obj.ObjectKind is
|
||||
ObjectKind.Player
|
||||
or ObjectKind.Companion
|
||||
or ObjectKind.BattleNpc
|
||||
or ObjectKind.EventNpc
|
||||
or ObjectKind.MountType
|
||||
or ObjectKind.Retainer
|
||||
ObjectKind.Player
|
||||
or ObjectKind.Companion
|
||||
or ObjectKind.BattleNpc
|
||||
or ObjectKind.EventNpc
|
||||
or ObjectKind.MountType
|
||||
or ObjectKind.Retainer
|
||||
) {
|
||||
if (obj.ObjectId > ushort.MaxValue) {
|
||||
Plugin.Log.Warning($"cannot pass object with id {obj.ObjectId} to Penumbra: too large");
|
||||
if (idx > ushort.MaxValue) {
|
||||
Plugin.Log.Warning($"cannot pass object with idx {idx} to Penumbra: too large");
|
||||
} else {
|
||||
relevantModObjects.Add((ushort) obj.ObjectId);
|
||||
unsafe {
|
||||
var gobj = (GameObject*) obj.Address;
|
||||
var draw = gobj->DrawObject;
|
||||
if (draw != null && draw->IsVisible) {
|
||||
var visible = plugin.GameGui.WorldToScreen(obj.Position, out _, out _);
|
||||
if (visible) {
|
||||
relevantModObjects.Add((ushort) idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj is PlayerCharacter;
|
||||
})
|
||||
.Select(tuple => tuple.obj)
|
||||
.Cast<PlayerCharacter>()
|
||||
.Where(chara => {
|
||||
unsafe {
|
||||
|
|
Loading…
Reference in New Issue