Success!  Thank you Andrew and Trent.

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.

I’ll try to attach a screenshot, although I’m not sure if the email group allows that.

Darrell



> On Jun 3, 2020, at 2:25 PM, Andrew Sillers <apsillers at gmail.com> wrote:
> 
> 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]).
> 
> 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
> 
> this.target = world.ships[targetNum & ~0x40];
> 
> which says to me that everything but bits in 0x40 is the target.
> 
> 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.
> 
> 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.
> 
> Andrew
> 
> [1][https://github.com/apsillers/html5-netrek/blob/master/js/packets.js <https://github.com/apsillers/html5-netrek/blob/master/js/packets.js>]
> [2][https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js <https://github.com/apsillers/html5-netrek/blob/master/js/tractor.js>]
> 
> 
> 
> 
> On Wed, Jun 3, 2020, 3:44 PM Darrell Root <darrellroot at mac.com <mailto:darrellroot at mac.com>> wrote:
> Netrek-dev,
> 
> 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.
> 
> Which SP packet from the server tells me that a pressor or tractor is active?
> 
> I’ve included the packets.h summary and some “suspects” below.
> 
> I also suspect that you are only “aware” of tractor/pressor beams if they act on your ship, or you act on another ship.
> 
> 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.
> 
> 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.
> 
> 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:
> 
> "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"
> 
> Darrell
> 
> struct flags_spacket
>   {
>     char    type;                                /* SP_FLAGS */
>     char    pnum;                                /* whose flags are they? */
>     char    tractor;
>     char    pad2;
>     unsigned flags;
>   };
> 
> struct you_spacket
>   {
>     char    type;                                /* SP_YOU */
>     char    pnum;                                /* Guy needs to know this... 
>                                                   * 
>                                                   */
>     char    hostile;
>     char    swar;
>     char    armies;
>     char    tractor;
>     char    pad2;
>     char    pad3;
>     unsigned flags;
>     LONG    damage;
>     LONG    shield;
>     LONG    fuel;
>     unsigned short etemp;
>     unsigned short wtemp;
>     unsigned short whydead;
>     unsigned short whodead;
>   };
> 
> 
> /* packets sent from xtrek server to remote client */
> #define SP_MESSAGE      1
> #define SP_PLAYER_INFO  2       /* general player info not elsewhere */
> #define SP_KILLS        3       /* # kills a player has */
> #define SP_PLAYER       4       /* x,y for player */
> #define SP_TORP_INFO    5       /* torp status */
> #define SP_TORP         6       /* torp location */
> #define SP_PHASER       7       /* phaser status and direction */
> #define SP_PLASMA_INFO  8       /* player login information */
> #define SP_PLASMA       9       /* like SP_TORP */
> #define SP_WARNING      10      /* like SP_MESG */
> #define SP_MOTD         11      /* line from .motd screen */
> #define SP_YOU          12      /* info on you? */
> #define SP_QUEUE        13      /* estimated loc in queue? */
> #define SP_STATUS       14      /* galaxy status numbers */
> #define SP_PLANET       15      /* planet armies & facilities */
> #define SP_PICKOK       16      /* your team & ship was accepted */
> #define SP_LOGIN        17      /* login response */
> #define SP_FLAGS        18      /* give flags for a player */
> #define SP_MASK         19      /* tournament mode mask */
> #define SP_PSTATUS      20      /* give status for a player */
> #define SP_BADVERSION   21      /* invalid version number */
> #define SP_HOSTILE      22      /* hostility settings for a player */
> #define SP_STATS        23      /* a player's statistics */
> #define SP_PL_LOGIN     24      /* new player logs in */
> #define SP_RESERVED     25      /* for future use */
> #define SP_PLANET_LOC   26      /* planet name, x, y */
> 
> /* NOTE: not implemented */
> #define SP_SCAN         27      /* ATM: results of player scan */
> 
> #define SP_UDP_REPLY    28      /* notify client of UDP status */
> #define SP_SEQUENCE     29      /* sequence # packet */
> #define SP_SC_SEQUENCE  30      /* this trans is semi-critical info */
> 
> #define SP_RSA_KEY      31      /* handles binary verification */
> #define SP_MOTD_PIC     32      /* motd bitmap pictures (paradise) */
> 
> #define SP_SHIP_CAP     39      /* Handles server ship mods */
> 
> #define SP_S_REPLY      40      /* reply to send-short request */
> #define SP_S_MESSAGE    41      /* var. Message Packet */
> #define SP_S_WARNING    42      /* Warnings with 4  Bytes */
> #define SP_S_YOU        43      /* hostile,armies,whydead,etc .. */
> #define SP_S_YOU_SS     44      /* your ship status */
> #define SP_S_PLAYER     45      /* variable length player packet */
> 
> #define SP_PING         46      /* ping packet */
> 
> #define SP_S_TORP       47      /* variable length torp packet */
> #define SP_S_TORP_INFO  48      /* SP_S_TORP with TorpInfo */
> #define SP_S_8_TORP     49      /* optimized SP_S_TORP */
> #define SP_S_PLANET     50      /* see SP_PLANET */
> 
> /* S_P2 */
> #define SP_S_SEQUENCE   56      /* SP_SEQUENCE for compressed packets */
> #define SP_S_PHASER     57      /* see struct */
> #define SP_S_KILLS      58      /* # of kills player have */
> #define SP_S_STATS      59      /* see SP_STATS */
> 
> /* variable length packets */
> #define VPLAYER_SIZE    4
> #define SHORTVERSION    11      /* other number blocks, like UDP Version */
> #define OLDSHORTVERSION 10      /* S_P2 */
> 
> /* #ifdef FEATURE */
> #define SP_FEATURE      60
> /* #endif */
> 
> #define SP_BITMAP       61
> 
> _______________________________________________
> netrek-dev mailing list
> netrek-dev at us.netrek.org <mailto:netrek-dev at us.netrek.org>
> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev <http://mailman.us.netrek.org/mailman/listinfo/netrek-dev>
> _______________________________________________
> netrek-dev mailing list
> netrek-dev at us.netrek.org
> http://mailman.us.netrek.org/mailman/listinfo/netrek-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20200603/01fb5e64/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2020-06-03 at 3.52.05 PM.png
Type: image/png
Size: 923200 bytes
Desc: not available
URL: <http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20200603/01fb5e64/attachment-0001.png>