<div dir="auto">It's been a minute since I worked on tractor/pressor stuff, but you can look for "tractor" in my packets.js [1] (which delegates incoming SP packets to the appropriate module, in this case tractor.js [2]).<div dir="auto"><br></div><div dir="auto">Notably I see `if(tractor & 0x40)` guarding the tractor logic (where `tractor` is from SP_YOU and SP_FLAGS), and in tractor.js I see</div><div dir="auto"><br></div><div dir="auto">this.target = world.ships[targetNum & ~0x40];</div><div dir="auto"><br></div><div dir="auto">which says to me that everything but bits in 0x40 is the target.</div><div dir="auto"><br></div><div dir="auto">I also see a mask on PFPRESS to decide if it's a pressor or not, where PFPRESS is defined in constants.js as 0x800000.</div><div dir="auto"><br></div><div dir="auto">As I recall, I may also have needed to set a flag in a client options packet to receive tractor data at all (you can opt out of tractor info to slim down game data, I guess??). I'm less sure about that part.</div><div dir="auto"><br></div><div dir="auto">Andrew</div><div dir="auto"><br></div><div dir="auto">[1][https<a href="https://github.com/apsillers/html5-netrek/blob/master/js/packets.js" style="font-family:sans-serif" target="_blank" rel="noreferrer">://github.com/apsillers/html5-netrek/blob/master/js/packets.js</a>]<br></div><div dir="auto">[2][<a href="https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js" target="_blank" rel="noreferrer">https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js</a>]<br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 3, 2020, 3:44 PM Darrell Root <<a href="mailto:darrellroot@mac.com" rel="noreferrer noreferrer noreferrer" target="_blank">darrellroot@mac.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Netrek-dev,<br>
<br>
I’ve seen some clients which visually display that a tractor beam or pressor beam is active. I’m trying to add this feature to my MacOS client.<br>
<br>
Which SP packet from the server tells me that a pressor or tractor is active?<br>
<br>
I’ve included the packets.h summary and some “suspects” below.<br>
<br>
I also suspect that you are only “aware” of tractor/pressor beams if they act on your ship, or you act on another ship.<br>
<br>
I’m familiar with the CP_TRACTOR and CP_PRESSOR packets to request a tractor/pressor. I’m looking for the SP packets from the server which tell you that a pressor/tractor is active.<br>
<br>
The “tractor” field in the flags_spacket looked possible, but I didn’t see anything other than a 0 in that field while trying out some tractor/pressor beams.<br>
<br>
I did capture a SP_YOU packet with non-zero numbers in the tractor field, but don’t know how to interpret the number 69:<br>
<br>
"Received SP_YOU 12 1 hostile 14 war 0 armies 0 tractor 69 flags 46145536 damage 81 shieldStrength 130 fuel 12996 engineTemp 64 weaponsTemp 0 whyDead 2 whodead 3"<br>
<br>
Darrell<br>
<br>
struct flags_spacket<br>
{<br>
char type; /* SP_FLAGS */<br>
char pnum; /* whose flags are they? */<br>
char tractor;<br>
char pad2;<br>
unsigned flags;<br>
};<br>
<br>
struct you_spacket<br>
{<br>
char type; /* SP_YOU */<br>
char pnum; /* Guy needs to know this... <br>
* <br>
*/<br>
char hostile;<br>
char swar;<br>
char armies;<br>
char tractor;<br>
char pad2;<br>
char pad3;<br>
unsigned flags;<br>
LONG damage;<br>
LONG shield;<br>
LONG fuel;<br>
unsigned short etemp;<br>
unsigned short wtemp;<br>
unsigned short whydead;<br>
unsigned short whodead;<br>
};<br>
<br>
<br>
/* packets sent from xtrek server to remote client */<br>
#define SP_MESSAGE 1<br>
#define SP_PLAYER_INFO 2 /* general player info not elsewhere */<br>
#define SP_KILLS 3 /* # kills a player has */<br>
#define SP_PLAYER 4 /* x,y for player */<br>
#define SP_TORP_INFO 5 /* torp status */<br>
#define SP_TORP 6 /* torp location */<br>
#define SP_PHASER 7 /* phaser status and direction */<br>
#define SP_PLASMA_INFO 8 /* player login information */<br>
#define SP_PLASMA 9 /* like SP_TORP */<br>
#define SP_WARNING 10 /* like SP_MESG */<br>
#define SP_MOTD 11 /* line from .motd screen */<br>
#define SP_YOU 12 /* info on you? */<br>
#define SP_QUEUE 13 /* estimated loc in queue? */<br>
#define SP_STATUS 14 /* galaxy status numbers */<br>
#define SP_PLANET 15 /* planet armies & facilities */<br>
#define SP_PICKOK 16 /* your team & ship was accepted */<br>
#define SP_LOGIN 17 /* login response */<br>
#define SP_FLAGS 18 /* give flags for a player */<br>
#define SP_MASK 19 /* tournament mode mask */<br>
#define SP_PSTATUS 20 /* give status for a player */<br>
#define SP_BADVERSION 21 /* invalid version number */<br>
#define SP_HOSTILE 22 /* hostility settings for a player */<br>
#define SP_STATS 23 /* a player's statistics */<br>
#define SP_PL_LOGIN 24 /* new player logs in */<br>
#define SP_RESERVED 25 /* for future use */<br>
#define SP_PLANET_LOC 26 /* planet name, x, y */<br>
<br>
/* NOTE: not implemented */<br>
#define SP_SCAN 27 /* ATM: results of player scan */<br>
<br>
#define SP_UDP_REPLY 28 /* notify client of UDP status */<br>
#define SP_SEQUENCE 29 /* sequence # packet */<br>
#define SP_SC_SEQUENCE 30 /* this trans is semi-critical info */<br>
<br>
#define SP_RSA_KEY 31 /* handles binary verification */<br>
#define SP_MOTD_PIC 32 /* motd bitmap pictures (paradise) */<br>
<br>
#define SP_SHIP_CAP 39 /* Handles server ship mods */<br>
<br>
#define SP_S_REPLY 40 /* reply to send-short request */<br>
#define SP_S_MESSAGE 41 /* var. Message Packet */<br>
#define SP_S_WARNING 42 /* Warnings with 4 Bytes */<br>
#define SP_S_YOU 43 /* hostile,armies,whydead,etc .. */<br>
#define SP_S_YOU_SS 44 /* your ship status */<br>
#define SP_S_PLAYER 45 /* variable length player packet */<br>
<br>
#define SP_PING 46 /* ping packet */<br>
<br>
#define SP_S_TORP 47 /* variable length torp packet */<br>
#define SP_S_TORP_INFO 48 /* SP_S_TORP with TorpInfo */<br>
#define SP_S_8_TORP 49 /* optimized SP_S_TORP */<br>
#define SP_S_PLANET 50 /* see SP_PLANET */<br>
<br>
/* S_P2 */<br>
#define SP_S_SEQUENCE 56 /* SP_SEQUENCE for compressed packets */<br>
#define SP_S_PHASER 57 /* see struct */<br>
#define SP_S_KILLS 58 /* # of kills player have */<br>
#define SP_S_STATS 59 /* see SP_STATS */<br>
<br>
/* variable length packets */<br>
#define VPLAYER_SIZE 4<br>
#define SHORTVERSION 11 /* other number blocks, like UDP Version */<br>
#define OLDSHORTVERSION 10 /* S_P2 */<br>
<br>
/* #ifdef FEATURE */<br>
#define SP_FEATURE 60<br>
/* #endif */<br>
<br>
#define SP_BITMAP 61<br>
<br>
_______________________________________________<br>
netrek-dev mailing list<br>
<a href="mailto:netrek-dev@us.netrek.org" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">netrek-dev@us.netrek.org</a><br>
<a href="http://mailman.us.netrek.org/mailman/listinfo/netrek-dev" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">http://mailman.us.netrek.org/mailman/listinfo/netrek-dev</a><br>
</blockquote></div>