Server Help

ASSS Questions - ASSS CB_ Additions?

50% Packetloss - Thu Jun 09, 2005 4:49 pm
Post subject: ASSS CB_ Additions?
I found that I needed a callback for player-turrets and KOTH. I'm sure grel gets at least 10 requests per day for new features so I wrote one example for how these 2 callbacks could work, in effort that grel won't have to bust his balls if he decides to add these callbacks to his source.

Code: Show/Hide

//in game.h
#define PID_NONE -1

#define CB_TURRET "playerturret"
typedef void (*PlayerTurret)(Arena *arena, Player *p, int old_attach);
//p->p_attached determines attachment/detachment
//p->p_attached == PID_NONE if detach
//in the case of detachment, old_attach will be the pid of the player detached from


//in koth.h
#define CB_KOTH "koth"
typedef void (*KothWin)(Arena *arena, LinkedList *winners, int points);
//the linklist is the one in check_koth(), a list of players that receive KOTH reward

Grelminar - Fri Jun 10, 2005 5:02 am
Post subject:
Sounds good, I'll add them to my todo list. Except I think it'll make for a cleaner interface to call CB_KOTH once for each winner, instead of passing the list around.
50% Packetloss - Fri Jun 10, 2005 6:07 am
Post subject:
Sweet!
Smong - Fri Jun 10, 2005 6:13 am
Post subject:
How about taking koth further and making a points_koth module? koth is currently one of the few modules not in scoring.so that requires persist.
50% Packetloss - Mon Jun 13, 2005 1:37 am
Post subject:
A CB_PlayerPositon would be nice. The thing is that I need to get correct player bounty amounts, I'm not sure if cb_green will provide as there are multiple ways to gather bounty, and cb_kill doesn't always have correct bounty amounts. PlayerPositions are constantly sent so I'm guessing that the callback hasn't been added because it will spam the hell out of the modules. I guess I can leave it out or do it with net->AddPacket() if I am really desperate.
Smong - Mon Jun 13, 2005 3:16 am
Post subject:
How about a bounty changed callback? To reduce callback spammage you could somehow queue up all the bounty changes in 10 ticks per player, and then call the callback.

game.c
Code: Show/Hide
bounty timer: newbounty, p
do cbs (new bounty, p)
p.bountychangecached = 0

# gets called from pppk when pkt.bounty != p.bounty
bountychanged: newbounty
if p.bountychangecached:
  newbounty += newbounty - p.bounty
else
  p.bountychangecached = 1
clear bounty timer (p)
start bounty timer (newbounty, 10, p)

All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group