Server Help

ASSS Questions - Freq

Hakaku - Tue Jul 29, 2008 10:42 pm
Post subject: Freq
I have a question concerning how would it be possible to lock frequencies without locking ships? I tried looking at how game.c is coded for locking the arena, but it doesn't really tell me much on how I could go about locking only frequencies. icon_confused.gif Any ideas?

(from game.c)
Code: Show/Hide
local void lock_work(const Target *target, int nval, int notify, int spec, int timeout)
{
   LinkedList set = LL_INITIALIZER;
   Link *l;

   pd->TargetToSet(target, &set);
   for (l = LLGetHead(&set); l; l = l->next)
   {
      Player *p = l->data;
      pdata *pdata = PPDATA(p, pdkey);

      if (spec && p->arena && p->p_ship != SHIP_SPEC)
         SetFreqAndShip(p, SHIP_SPEC, p->arena->specfreq);

      if (notify && pdata->lockship != nval && chat)
         chat->SendMessage(p, nval ?
               (p->p_ship == SHIP_SPEC ?
                "You have been locked to spectator mode." :
                "You have been locked to your ship.") :
               "Your ship has been unlocked.");

      pdata->lockship = nval;
      pdata->expires = (nval == FALSE || timeout == 0) ? 0 : time(NULL) + timeout;
   }
   LLEmpty(&set);
}

Dr Brain - Wed Jul 30, 2008 8:23 am
Post subject:
Make a freq manager that allows people to change ships but not frequencies.
Samapico - Wed Jul 30, 2008 11:39 pm
Post subject:
Dr Brain wrote:
Make a freq manager that allows people to change ships but not frequencies.
Isn't that like telling your <any sport> team: "hey, try to score goals" ?
Dr Brain - Thu Jul 31, 2008 7:56 am
Post subject:
Samapico wrote:
[..]

Isn't that like telling your <any sport> team: "hey, try to score goals" ?


It's more like telling them which side of the field the goal is on.
Hakaku - Fri Aug 01, 2008 1:12 am
Post subject:
Although I agree Brain is right, and perhaps Grel meant to eventually add a frequency manager judging by game.c, but the problem is that I don't know how. I assume the code for lock_work should pretty much be the same as if it were used for locking only frequencies. The difference being that locking the arena uses the following (commented out the rest):
Code: Show/Hide
#define KEY_SHIPLOCK 46
//
#include "packets/shipchange.h"
//

typedef struct
{
//

   /* some flags */
   byte lockship, rgnnoanti, rgnnoweapons, pad2;
//
} pdata;

typedef struct
{
//
   int initlockship, initspec;
//
} adata;

Code: Show/Hide
struct ShipChangePacket
{
   u8 type;
   i8 shiptype;
   i16 pnum;
   i16 freq;
};

This explains why both ships and frequencies cannot be changed after pdata->lockship = TRUE;, however I don't understand what #define KEY_SHIPLOCK 46 does exactly? Or more specifically, where does 46 come from?
Dr Brain - Fri Aug 01, 2008 7:55 am
Post subject:
I'm not sure what you mean about Grel eventually adding freq managers... they've been in ASSS since the first release. Look at fm_normal and fm_lockspec.

The simplest solution is to have the manager always lock teams, and then to lock them you just attach the module to the arena. If you want mods to be able to use the command, then you'll have to set up the module to work normally until a command is activated (I suggest starting with fm_normal).

the KEY_SHIPLOCK is a unique key for the persist data. 46 is a number no other module is using.
D1st0rt - Sun Aug 03, 2008 10:33 am
Post subject:
If you don't want to use C, there's even an example fm module in python (fm_password) that you can modify to do what you need.
Hakaku - Mon Aug 04, 2008 8:22 pm
Post subject:
Dr Brain wrote:
I'm not sure what you mean about Grel eventually adding freq managers... they've been in ASSS since the first release. Look at fm_normal and fm_lockspec.

The simplest solution is to have the manager always lock teams, and then to lock them you just attach the module to the arena. If you want mods to be able to use the command, then you'll have to set up the module to work normally until a command is activated (I suggest starting with fm_normal).

the KEY_SHIPLOCK is a unique key for the persist data. 46 is a number no other module is using.
Oh ok, that makes sense; I missed those two files. For some reason I was expecting there to be a file named just freqman, similar to arenaman, capman, or cmdman.

Anyhow, thanks for the input. I was just trying to see how it could be done, rather than emulating a bot's way of using *setfreq to place a player back on his/her respective team when another player or team has picked up all flags (to prevent freq hopping for points).
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group