namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
private static uint DockingZeroUpdateSelfTest()
{
var frame=new Snapshot{valid=true,healthValid=true,hullFraction=1,rawFsdState=2,tick=100,sequence=20,entity=7,life=0x10000,inputRoot=0x20000,fsd=0x30000,referenceWorld=9};
var selection=new LocalSelection{generation=3,expires=200,epoch=5,entity=frame.entity,life=frame.life,inputRoot=frame.inputRoot,fsd=frame.fsd,target=new(){market=11}};
var wanted=new DockingZeroUpdate{computer=0x40058,controller=0x50000,fsd=frame.fsd,market=11,throttle=.75f,
command=new(){expires=200,sequence=20,entity=frame.entity,life=frame.life,inputRoot=frame.inputRoot,world=9,epoch=5,selection=3}};
bool Match(DockingZeroUpdate p,Snapshot f,LocalSelection s,ulong now=150,ulong epoch=5,bool owner=true,bool enabled=true,bool active=true,bool overridden=false,nuint computer=0x40058)
=>DockingZeroUpdateMatches(p,f,s,computer,now,epoch,owner,enabled,active,overridden);
uint passed=0;
if(Match(wanted,frame,selection))passed|=1;
if(!Match(wanted,frame,selection,200)&&Match(wanted,frame,selection,199))passed|=2;
var other=wanted;other.command.entity++;
if(!Match(other,frame,selection)){other=wanted;other.command.world++;if(!Match(other,frame,selection))passed|=4;}
other=wanted;other.command.epoch++;
if(!Match(other,frame,selection)&&!Match(wanted,frame,selection,owner:false))passed|=8;
var stableDamage=frame;stableDamage.hullFraction=.4;
var emergency=stableDamage;emergency.healthEmergency=true;
var invalidHealth=stableDamage;invalidHealth.healthValid=false;
var destroyed=stableDamage;destroyed.hullFraction=0;
if(Match(wanted,stableDamage,selection)&&!Match(wanted,emergency,selection)
&&!Match(wanted,invalidHealth,selection)&&!Match(wanted,destroyed,selection))passed|=16;
if(!Match(wanted,frame,selection,computer:0)&&!Match(wanted,frame,selection,computer:0x60058))passed|=32;
if(!Match(wanted,frame,selection,enabled:false)&&!Match(wanted,frame,selection,active:false)&&!Match(wanted,frame,selection,overridden:true))passed|=64;
var acknowledged=selection;acknowledged.expires=1;
if(Match(wanted,frame,acknowledged)&&!Match(wanted,frame,acknowledged,200))
{
var changed=acknowledged;changed.target.market++;
if(!Match(wanted,frame,changed))
{
changed=acknowledged;changed.generation++;
if(!Match(wanted,frame,changed))
{
var cooldown=frame;cooldown.rawFsdState=1;
var charging=frame;charging.rawFsdState=3;
if(Match(wanted,cooldown,acknowledged)&&!Match(wanted,charging,acknowledged))passed|=128;
}
}
}
return passed;
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationDockingZeroUpdateSelfTest")]
internal static uint ExportDockingZeroUpdateSelfTest()=>RunTest(DockingZeroUpdateSelfTest);
#endif
}
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
private static uint DockingZeroUpdateSelfTest()
{
var frame=new Snapshot{valid=true,healthValid=true,hullFraction=1,rawFsdState=2,tick=100,sequence=20,entity=7,life=0x10000,inputRoot=0x20000,fsd=0x30000,referenceWorld=9};
var selection=new LocalSelection{generation=3,expires=200,epoch=5,entity=frame.entity,life=frame.life,inputRoot=frame.inputRoot,fsd=frame.fsd,target=new(){market=11}};
var wanted=new DockingZeroUpdate{computer=0x40058,controller=0x50000,fsd=frame.fsd,market=11,throttle=.75f,
command=new(){expires=200,sequence=20,entity=frame.entity,life=frame.life,inputRoot=frame.inputRoot,world=9,epoch=5,selection=3}};
bool Match(DockingZeroUpdate p,Snapshot f,LocalSelection s,ulong now=150,ulong epoch=5,bool owner=true,bool enabled=true,bool active=true,bool overridden=false,nuint computer=0x40058)
=>DockingZeroUpdateMatches(p,f,s,computer,now,epoch,owner,enabled,active,overridden);
uint passed=0;
if(Match(wanted,frame,selection))passed|=1;
if(!Match(wanted,frame,selection,200)&&Match(wanted,frame,selection,199))passed|=2;
var other=wanted;other.command.entity++;
if(!Match(other,frame,selection)){other=wanted;other.command.world++;if(!Match(other,frame,selection))passed|=4;}
other=wanted;other.command.epoch++;
if(!Match(other,frame,selection)&&!Match(wanted,frame,selection,owner:false))passed|=8;
var stableDamage=frame;stableDamage.hullFraction=.4;
var emergency=stableDamage;emergency.healthEmergency=true;
var invalidHealth=stableDamage;invalidHealth.healthValid=false;
var destroyed=stableDamage;destroyed.hullFraction=0;
if(Match(wanted,stableDamage,selection)&&!Match(wanted,emergency,selection)
&&!Match(wanted,invalidHealth,selection)&&!Match(wanted,destroyed,selection))passed|=16;
if(!Match(wanted,frame,selection,computer:0)&&!Match(wanted,frame,selection,computer:0x60058))passed|=32;
if(!Match(wanted,frame,selection,enabled:false)&&!Match(wanted,frame,selection,active:false)&&!Match(wanted,frame,selection,overridden:true))passed|=64;
var acknowledged=selection;acknowledged.expires=1;
if(Match(wanted,frame,acknowledged)&&!Match(wanted,frame,acknowledged,200))
{
var changed=acknowledged;changed.target.market++;
if(!Match(wanted,frame,changed))
{
changed=acknowledged;changed.generation++;
if(!Match(wanted,frame,changed))
{
var cooldown=frame;cooldown.rawFsdState=1;
var charging=frame;charging.rawFsdState=3;
if(Match(wanted,cooldown,acknowledged)&&!Match(wanted,charging,acknowledged))passed|=128;
}
}
}
return passed;
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationDockingZeroUpdateSelfTest")]
internal static uint ExportDockingZeroUpdateSelfTest()=>RunTest(DockingZeroUpdateSelfTest);
#endif
}