<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Success! Thank you Andrew and Trent.<div class=""><br class=""></div><div class="">My development version now has visible tractor (green) and pressor (blue) beams with a cool SwiftUI animation…at least for _my_ pressors and tractors. The fact that only my tractors are visible means I don’t need to implement the other case.</div><div class=""><br class=""></div><div class="">I’ll try to attach a screenshot, although I’m not sure if the email group allows that.</div><div class=""><br class=""></div><div class="">Darrell</div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="D01DA5C5-C40A-4336-B8AF-AECEEDB54300" width="773" height="640" src="cid:9365FB3E-5E14-4BB1-8ED5-A11D507FDDDC@hsd1.ca.comcast.net." class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 3, 2020, at 2:25 PM, Andrew Sillers <<a href="mailto:apsillers@gmail.com" class="">apsillers@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class="">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" class=""><br class=""></div><div dir="auto" class="">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" class=""><br class=""></div><div dir="auto" class="">this.target = world.ships[targetNum & ~0x40];</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">which says to me that everything but bits in 0x40 is the target.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">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" class=""><br class=""></div><div dir="auto" class="">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" class=""><br class=""></div><div dir="auto" class="">Andrew</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">[1][https<a href="https://github.com/apsillers/html5-netrek/blob/master/js/packets.js" style="font-family:sans-serif" target="_blank" rel="noreferrer" class="">://github.com/apsillers/html5-netrek/blob/master/js/packets.js</a>]<br class=""></div><div dir="auto" class="">[2][<a href="https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js" target="_blank" rel="noreferrer" class="">https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js</a>]<br class=""></div><div dir="auto" class=""><br class=""></div><div dir="auto" class=""><br class=""></div><div dir="auto" class=""><br class=""></div></div><br class=""><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" class="">darrellroot@mac.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Netrek-dev,<br class="">
<br class="">
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 class="">
<br class="">
Which SP packet from the server tells me that a pressor or tractor is active?<br class="">
<br class="">
I’ve included the packets.h summary and some “suspects” below.<br class="">
<br class="">
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 class="">
<br class="">
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 class="">
<br class="">
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 class="">
<br class="">
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 class="">
<br class="">
"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 class="">
<br class="">
Darrell<br class="">
<br class="">
struct flags_spacket<br class="">
{<br class="">
char type; /* SP_FLAGS */<br class="">
char pnum; /* whose flags are they? */<br class="">
char tractor;<br class="">
char pad2;<br class="">
unsigned flags;<br class="">
};<br class="">
<br class="">
struct you_spacket<br class="">
{<br class="">
char type; /* SP_YOU */<br class="">
char pnum; /* Guy needs to know this... <br class="">
* <br class="">
*/<br class="">
char hostile;<br class="">
char swar;<br class="">
char armies;<br class="">
char tractor;<br class="">
char pad2;<br class="">
char pad3;<br class="">
unsigned flags;<br class="">
LONG damage;<br class="">
LONG shield;<br class="">
LONG fuel;<br class="">
unsigned short etemp;<br class="">
unsigned short wtemp;<br class="">
unsigned short whydead;<br class="">
unsigned short whodead;<br class="">
};<br class="">
<br class="">
<br class="">
/* packets sent from xtrek server to remote client */<br class="">
#define SP_MESSAGE 1<br class="">
#define SP_PLAYER_INFO 2 /* general player info not elsewhere */<br class="">
#define SP_KILLS 3 /* # kills a player has */<br class="">
#define SP_PLAYER 4 /* x,y for player */<br class="">
#define SP_TORP_INFO 5 /* torp status */<br class="">
#define SP_TORP 6 /* torp location */<br class="">
#define SP_PHASER 7 /* phaser status and direction */<br class="">
#define SP_PLASMA_INFO 8 /* player login information */<br class="">
#define SP_PLASMA 9 /* like SP_TORP */<br class="">
#define SP_WARNING 10 /* like SP_MESG */<br class="">
#define SP_MOTD 11 /* line from .motd screen */<br class="">
#define SP_YOU 12 /* info on you? */<br class="">
#define SP_QUEUE 13 /* estimated loc in queue? */<br class="">
#define SP_STATUS 14 /* galaxy status numbers */<br class="">
#define SP_PLANET 15 /* planet armies & facilities */<br class="">
#define SP_PICKOK 16 /* your team & ship was accepted */<br class="">
#define SP_LOGIN 17 /* login response */<br class="">
#define SP_FLAGS 18 /* give flags for a player */<br class="">
#define SP_MASK 19 /* tournament mode mask */<br class="">
#define SP_PSTATUS 20 /* give status for a player */<br class="">
#define SP_BADVERSION 21 /* invalid version number */<br class="">
#define SP_HOSTILE 22 /* hostility settings for a player */<br class="">
#define SP_STATS 23 /* a player's statistics */<br class="">
#define SP_PL_LOGIN 24 /* new player logs in */<br class="">
#define SP_RESERVED 25 /* for future use */<br class="">
#define SP_PLANET_LOC 26 /* planet name, x, y */<br class="">
<br class="">
/* NOTE: not implemented */<br class="">
#define SP_SCAN 27 /* ATM: results of player scan */<br class="">
<br class="">
#define SP_UDP_REPLY 28 /* notify client of UDP status */<br class="">
#define SP_SEQUENCE 29 /* sequence # packet */<br class="">
#define SP_SC_SEQUENCE 30 /* this trans is semi-critical info */<br class="">
<br class="">
#define SP_RSA_KEY 31 /* handles binary verification */<br class="">
#define SP_MOTD_PIC 32 /* motd bitmap pictures (paradise) */<br class="">
<br class="">
#define SP_SHIP_CAP 39 /* Handles server ship mods */<br class="">
<br class="">
#define SP_S_REPLY 40 /* reply to send-short request */<br class="">
#define SP_S_MESSAGE 41 /* var. Message Packet */<br class="">
#define SP_S_WARNING 42 /* Warnings with 4 Bytes */<br class="">
#define SP_S_YOU 43 /* hostile,armies,whydead,etc .. */<br class="">
#define SP_S_YOU_SS 44 /* your ship status */<br class="">
#define SP_S_PLAYER 45 /* variable length player packet */<br class="">
<br class="">
#define SP_PING 46 /* ping packet */<br class="">
<br class="">
#define SP_S_TORP 47 /* variable length torp packet */<br class="">
#define SP_S_TORP_INFO 48 /* SP_S_TORP with TorpInfo */<br class="">
#define SP_S_8_TORP 49 /* optimized SP_S_TORP */<br class="">
#define SP_S_PLANET 50 /* see SP_PLANET */<br class="">
<br class="">
/* S_P2 */<br class="">
#define SP_S_SEQUENCE 56 /* SP_SEQUENCE for compressed packets */<br class="">
#define SP_S_PHASER 57 /* see struct */<br class="">
#define SP_S_KILLS 58 /* # of kills player have */<br class="">
#define SP_S_STATS 59 /* see SP_STATS */<br class="">
<br class="">
/* variable length packets */<br class="">
#define VPLAYER_SIZE 4<br class="">
#define SHORTVERSION 11 /* other number blocks, like UDP Version */<br class="">
#define OLDSHORTVERSION 10 /* S_P2 */<br class="">
<br class="">
/* #ifdef FEATURE */<br class="">
#define SP_FEATURE 60<br class="">
/* #endif */<br class="">
<br class="">
#define SP_BITMAP 61<br class="">
<br class="">
_______________________________________________<br class="">
netrek-dev mailing list<br class="">
<a href="mailto:netrek-dev@us.netrek.org" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank" class="">netrek-dev@us.netrek.org</a><br class="">
<a href="http://mailman.us.netrek.org/mailman/listinfo/netrek-dev" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank" class="">http://mailman.us.netrek.org/mailman/listinfo/netrek-dev</a><br class="">
</blockquote></div>
_______________________________________________<br class="">netrek-dev mailing list<br class=""><a href="mailto:netrek-dev@us.netrek.org" class="">netrek-dev@us.netrek.org</a><br class="">http://mailman.us.netrek.org/mailman/listinfo/netrek-dev<br class=""></div></blockquote></div><br class=""></div></body></html>