Author |
Message |
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Sat Apr 26, 2003 1:01 pm Post subject: Attach process |
|
|
|
|
How much can ASSS alter the attach (F7) process?
My Goal:
Restrict attachments so that one must be within a certain distance of the target ship to attach.
Wasn't there an attachment event? I seem to remeber it passing Player structs. Or maybe that was MERV?
In either case... are the x/y coords at the event curent (player already attached) or not (pre-attachment)
I know this is a spacy post, please forgive me _________________ Signatures just seem so quaint. |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sat Apr 26, 2003 1:11 pm Post subject: |
|
|
|
|
Yes, that would really help your arena, wouldn't it?
Well, if it can be done, let me know, that has other uses too. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sat Apr 26, 2003 1:19 pm Post subject: |
|
|
|
|
From game.c:
void PAttach(Player *p, byte *pkt2, int n)
{
int pid2 = ((struct SimplePacket*)pkt2)->d1;
Arena *arena = p->arena;
struct SimplePacket pkt = { S2C_TURRET, p->pid, pid2 };
Player *to;
if (!arena) return;
to = (pid2 == -1) ? NULL : pd->PidToPlayer(pid2);
if (to && to->status != S_PLAYING)
{
lm->LogP(L_MALICIOUS, "game", p, "tried to attach to bad pid %d", pid2);
return;
}
if (pid2 == -1 ||
( p->arena == to->arena &&
p->p_freq == to->p_freq) )
{
p->p_attached = pid2;
net->SendToArena(arena, NULL, (byte*)&pkt, 5, NET_RELIABLE);
}
} |
For your zone, you could just override that function the in the dll with whatever you want. |
|
Back to top |
|
|
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Sat Apr 26, 2003 10:14 pm Post subject: |
|
|
|
|
how would i do that as a self-contained module... so that i could designate it as used or not for the arena....
or would i have to list game in the modules for each arena.. then specify the altered one for the specific arena? |
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Sun Apr 27, 2003 12:58 am Post subject: |
|
|
|
|
Actually, you can't just override that function without editing game.c and recompiling. I never considered that someone might want to do that, so I didn't add a hook for it.
If you want this feature, I think it's really something that should go in the client, because if it's just in the server, the client is still going to think it's attaching, and you'll get that effect where the ship disappears but doesn't go anywhere. Also, the client will be able to display an "out of range" message in the center of the screen, like it currently does for "can't attach to yourself" and "can't attach to specator", etc.
If you really want to do this right now, I can suggest a hack, but don't tell anyone you heard it from me! You'll want to write a module that adds a packet handler for C2S_ATTACHTO. In the handler, you should check whatever condition you want, and if you want to deny the attach, modify the packet that's passed to you so it looks like it's detaching (pid -1). In order for this to work, your custom module will have to be loaded _before_ the game module, so it can affect the packet that game sees. Again, this is really hacky and unsupported and don't complain if it doesn't work. |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sun Apr 27, 2003 3:08 am Post subject: |
|
|
|
|
Or edit game.c and compile. Ahhh... lieing to the client is so much fun :) |
|
Back to top |
|
|
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Sun Apr 27, 2003 3:28 pm Post subject: |
|
|
|
|
let me get some clarification - add a separate handler in the game.c code to handle arenas which have certain attributes?
I really want to make these modifications without affecting the other arenas in the zone.
sorry if i missed something obvious |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sun Apr 27, 2003 3:44 pm Post subject: |
|
|
|
|
Helicon wrote: | I really want to make these modifications without affecting the other arenas in the zone. |
Not possible without remaking the game.c, unless you want to try grel's suggestion, which may end up screwing up the client-server connection if done incorrectly. |
|
Back to top |
|
|
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Sun Apr 27, 2003 3:52 pm Post subject: |
|
|
|
|
could i hardcode a specific handler in game.c for specific arena (pub maybe) and just allow other arenas to fall through to the default? |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sun Apr 27, 2003 10:53 pm Post subject: |
|
|
|
|
Sure, just check the arena values inside the process. Make a if check for it, and run the default for the else. |
|
Back to top |
|
|
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Mon Apr 28, 2003 4:10 pm Post subject: |
|
|
|
|
i knew it i knew it i knew it... hahahahaha
You guys are awesome |
|
Back to top |
|
|
Kood Guest
Offline
|
|
Back to top |
|
|
Kood Guest
Offline
|
Posted: Sat Jan 03, 2004 12:04 am Post subject: |
|
|
|
|
P.S. Apologies for the date difference / dragging up an old thread.
P.P.S. I really should sign up so I can edit my posts to do this. |
|
Back to top |
|
|
Kood Guest
Offline
|
Posted: Sat Jan 03, 2004 11:58 am Post subject: |
|
|
|
|
Nevermind, what I wanted to do could of been done with "mm->RegCallback" on CB_PLAYERACTION, CB_SHIPCHANGE etc. but what I *had* wanted to do has already been written.... record.c, and better than I could have done (yet to test functionality, but have read through the code)
Nice job Grel. |
|
Back to top |
|
|
|