Author |
Message |
Hakaku Server Help Squatter

Joined: Apr 07 2006 Posts: 299 Location: Canada Offline
|
Posted: 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. Any ideas?
(from game.c)
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);
}
|
|
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Wed Jul 30, 2008 8:23 am Post subject: |
 |
|
|
|
Make a freq manager that allows people to change ships but not frequencies. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
Samapico No, these DO NOT look like penises, ok?

Joined: May 08 2003 Posts: 1252 Offline
|
Posted: 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" ? _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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. |
|
Back to top |
|
 |
Hakaku Server Help Squatter

Joined: Apr 07 2006 Posts: 299 Location: Canada Offline
|
Posted: 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):
#define KEY_SHIPLOCK 46
//
#include "packets/shipchange.h"
//
typedef struct
{
//
/* some flags */
byte lockship, rgnnoanti, rgnnoweapons, pad2;
//
} pdata;
typedef struct
{
//
int initlockship, initspec;
//
} adata;
|
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? |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: 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. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: 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. _________________
 |
|
Back to top |
|
 |
Hakaku Server Help Squatter

Joined: Apr 07 2006 Posts: 299 Location: Canada Offline
|
Posted: 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). |
|
Back to top |
|
 |
|