Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Attach process

 
Post new topic   Reply to topic Printable version
 View previous topic  `PTHREAD_MUTEX_RECURSIVE' undeclared. Post :: Post Win32 newer  View next topic  
Author Message
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Sat Apr 26, 2003 1:01 pm    Post subject: Attach process Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Apr 26, 2003 1:11 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sat Apr 26, 2003 1:19 pm    Post subject: Reply to topic Reply with quote

From game.c:

Code: Show/Hide
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
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Sat Apr 26, 2003 10:14 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Sun Apr 27, 2003 12:58 am    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email Visit posters website
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sun Apr 27, 2003 3:08 am    Post subject: Reply to topic Reply with quote

Or edit game.c and compile. Ahhh... lieing to the client is so much fun :)
Back to top
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Sun Apr 27, 2003 3:28 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sun Apr 27, 2003 3:44 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Sun Apr 27, 2003 3:52 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sun Apr 27, 2003 10:53 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email
Helicon
Server Help Squatter


Joined: Dec 03 2002
Posts: 771
Location: GNU Doldrums
Offline

PostPosted: Mon Apr 28, 2003 4:10 pm    Post subject: Reply to topic Reply with quote

i knew it i knew it i knew it... hahahahaha

You guys are awesome
Back to top
View users profile Send private message Add User to Ignore List
Kood
Guest


Offline

PostPosted: Sat Jan 03, 2004 12:02 am    Post subject: Reply to topic Reply with quote

Grelminar wrote:
You'll want to write a module that adds a packet handler for C2S_ATTACHTO. ... 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.

So that the module is loaded after core:net but before game:game?

Done with net->AddPacket? can you add more than one callback function for a packet?

e.g.
Code: Show/Hide
core:net loads
Our module loads
Our module does "net->AddPacket(C2S_GREEN, PFoobar);"
game:game loads
game:game does "net->AddPacket(C2S_GREEN, PGreen);"

Is that okay?
...or would PFoobar have to call PGreen after it's done what it wants to do? (much like proxy dll's)

Close? or a million miles away? icon_smile.gif
Back to top
Kood
Guest


Offline

PostPosted: Sat Jan 03, 2004 12:04 am    Post subject: Reply to topic Reply with quote

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. sa_tongue.gif
Back to top
Kood
Guest


Offline

PostPosted: Sat Jan 03, 2004 11:58 am    Post subject: Reply to topic Reply with quote

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. icon_smile.gif
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 658 page(s) served in previous 5 minutes.

phpBB Created this page in 2.049505 seconds : 39 queries executed (97.9%): GZIP compression disabled