linkdead.tar.gz
snippets · 8.8 KB · 2010-03-30
Linkdead handling (hate.c, linkdead.code): code for linkdead players.
Download « Back to the snippets list
readme.linkdead
What: Link dead code for dirt based abermuds
hate code, so mobiles can attack people when the return.
The code simply allows linkdead players to be kept in the game for a period
of time before kicking them out. It gives players the chance to return
and not have to go a re-equip themselves. It comes in two parts, and could
be seperated with a little work. The linkdead code uses another thing included
here, that is hate.
who: This has been made available to you by Northern Lights, Vitastjern and
myself (Ithor). If there are problems, then I can be reached
at Northern Lights.
Installing LINKDEAD
--------------------
Though it is not needed that you place everything it the #ifdef KEEP_LINKDEAD
statements, I do recommend it, as it provides a fast, easy way to switch
it off...(if installed right)
Start with adding the following lines to the end of your config.h file:
/*
** Define this to keep link dead players in the game for a while. 0 will cause
** them to idle out as per normal idle out times. Anything greater will idle
** them out in that many seconds. -Ithor
** Comment away this define if you don't wish to use KEEP_LINKDEAD code at all.
*/
#define KEEP_LINKDEAD 300
The rest of the code:
A:- main.c
1) Add the prototype for cleanup_link to the top of main.c somewhere
2) Place cleanup_link() in the file main.c. (At the end will do)
3) The next two bits are a little tricky. In a function called main_loop()
there is a big while() loop. It has a switch statement, with things like
case JMP_QUITTING: in it.
Some of the existing code (from NL) has been included to show you where.
You may need to delete a couple of lines in your code...namely the
lines that currently kick out link dead players...or put that in the
#else part of the new code, instead of whats there.
4) Next is in a function called handle_packet(). About 20 lines into
the function there is an if statement listing different kinds of
errors. Need to replace similars lines to 3) with the code given
Lines like these.
crapup(NULL,CRAP_SAVE|CRAP_UNALIAS|CRAP_RETURN|CRAP_LINKLOSS);
errno = 0; /* Loose link */
quit_player();
Please realise the lines may not be exactly the same.
B:- timing.c
This might prove to be of little use, as different muds handle idle out
in different ways, but that is what this code is for, so feel free
to write your own version to suit your idle out code
5) In a function called on_timer() somewhere in loop stepping through
each player. Not KEEP_LINKDEAD in this case is the number of seconds
before we boot link dead players...0 meaning just idle them out normally
C:- mobile.c
6) Make sure no nasty mobiles beat players up while they aren't here.
In chkfight(), inside the loop that looks for players in same room
as mobile.
7) Add something to people's titles when looked at in a room, so players
know they are not really there
8) Add to regenerate(), to prevent link dead players healing. This is to
prevent players cutting link in a fight healing some and then re-entering
the fight.
Note that it is in the middle of an if statement that is already there.
D:- mud.c
9) Add a protoype somewhere at start of mud.c
10) Need to add a test so we don't reuse a link dead players slot in
find_free_player_slot(). You will note, that we replace an existing line
of code here.
11) Also need to make sure players do not start out linkdead, so add this
one somewhere amongst all the other default player settings
(also find_free_player_slot())
12) In get_passwd1() need to add a call to reconnect() so that linkdead
peoples get put back into their bodies
13) add the function, reconnect_player() that brings a new player into their
old body.
E:- mudtypes.h (playertype.h)
14) In the file with the PLAYER_REC definition add this line.
15) In commands.c add some lines to indicate that a player is linkdead,
as well as similar code to whocom, and any other user lists that
your mud supports
This is all there is to installing the linkdead code, however, if you do
not also install the hate code, you will need to remove the references
to hate in cleanup_link() etc.
HATE
=====
First add hate.c to the list of src, and hate.o to object files in your
makefile. There is no hate.h because the prototypes are required in the same
places as the fight functions, and thus they are added directly to fight.h
mudtypes.h: Need to add the following line to a ublock[]
char hate[MNAME_LEN+1]; /* Who do I hate enough to kill */
magic.c: in resurcom()
reset.c: In the function resetmobiles need to add a clear_hate() call. Note
that this function might be in mobile.c or elsewhere depending
on your version of dirt.
parse.c Need to add the call for the verb that allows setting of hate
Also need to add the verb hates to verbs.src
mobile.c: This is quite tricky to explain. In chkfight need to
still see if a player should be attacked even if the mobile
is not aggressive, but it hates someone. The if() is in a
loop that steps through all the mobiles in a room. You will need
to examine NL's code and reproduce it in your mud. NL's code
will not work directly, but should give you the idea.
fight.c: basically anywhere that a mobile might be hurt, you may want to
randomly allow mobiles to hate the attacker.
Archive contents (5 files)
| File | Size |
|---|---|
| ftp_game.org | 1.1 KB |
| hate.c | 6.2 KB |
| hate.code | 2.4 KB |
| linkdead.code | 11.9 KB |
| readme.linkdead | 5.4 KB |