TinyMUSH 3.3
TinyMUSH Server
|
Commands that create new objects. More...
#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <stdbool.h>
#include <string.h>
Functions | |
dbref | parse_linkable_room (dbref player, char *room_name) |
Get a location to link to. More... | |
void | open_exit (dbref player, dbref loc, char *direction, char *linkto) |
Open a new exit and optionally link it somewhere. More... | |
void | do_open (dbref player, dbref cause __attribute__((unused)), int key, char *direction, char *links[], int nlinks) |
Open a new exit and optionally link it somewhere. More... | |
void | link_exit (dbref player, dbref exit, dbref dest) |
Set destination(exits), dropto(rooms) or home(player,thing) More... | |
void | do_link (dbref player, dbref cause, int key, char *what, char *where) |
Set destination(exits), dropto(rooms) or home(player,thing) More... | |
void | do_parent (dbref player, dbref cause __attribute__((unused)), int key __attribute__((unused)), char *tname, char *pname) |
Set an object's parent field. More... | |
void | do_dig (dbref player, dbref cause, int key, char *name, char *args[], int nargs) |
Create a new room. More... | |
void | do_create (dbref player, dbref cause __attribute__((unused)), int key __attribute__((unused)), char *name, char *coststr) |
Make a new object. More... | |
void | do_clone (dbref player, dbref cause __attribute__((unused)), int key, char *name, char *arg2) |
Create a copy of an object. More... | |
void | do_pcreate (dbref player, dbref cause __attribute__((unused)), int key, char *name, char *pass) |
Create new players and robots. More... | |
bool | can_destroy_exit (dbref player, dbref exit) |
Destroy exit things. More... | |
bool | destroyable (dbref victim) |
Indicates if target of a @destroy is a 'special' object in the database. More... | |
bool | can_destroy_player (dbref player, dbref victim) |
Check if the player can destroy a victim. More... | |
void | do_destroy (dbref player, dbref cause __attribute__((unused)), int key, char *what) |
Destroy something. More... | |
Commands that create new objects.
bool can_destroy_exit | ( | dbref | player, |
dbref | exit | ||
) |
Destroy exit things.
player | DBref of player |
exit | DBref of exit |
bool can_destroy_player | ( | dbref | player, |
dbref | victim | ||
) |
Check if the player can destroy a victim.
player | DBref of player |
victim | DBref of victim |
bool destroyable | ( | dbref | victim | ) |
Indicates if target of a @destroy is a 'special' object in the database.
victim | DBref of the target |
void do_clone | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int | key, | ||
char * | name, | ||
char * | arg2 | ||
) |
Create a copy of an object.
player | DBref of player |
cause | DBref of cause |
key | Key |
name | Name of the object |
arg2 | Arguments |
Let players clone things set VISUAL. It's easier than retyping in all that data
You can only make a parent link to what you control
You can only preserve the owner on the clone of an object owned by another player, if you control that player.
Determine the cost of cloning. We have to do limits enforcement here, because we're going to wipe out the attribute for money set by create_obj() and need to set this ourselves. Note that you can't change the cost of objects other than things.
Go make the clone object
Wipe out any old attributes and copy in the new data
Reset the name, since we cleared the attributes.
Reset the cost, since this also got wiped when we cleared attributes. Note that only things have a value, though you pay a cost for creating everything.
Clear out problem flags from the original. Don't strip the INHERIT bit if we got the Inherit switch. Don't strip other flags if we got the NoStrip switch EXCEPT for the Wizard flag, unless we're God. (Powers are not cloned, ever.)
Tell creator about it
Put the new thing in its new home. Break any dropto or link, then try to re-establish it.
If same owner run Aclone, else halt it. Also copy parent if we can
void do_create | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int key | __attribute__(unused), | ||
char * | name, | ||
char * | coststr | ||
) |
Make a new object.
player | DBref of player |
cause | DBref of cause |
key | Key |
name | Name of object |
coststr | Cost of object |
void do_destroy | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int | key, | ||
char * | what | ||
) |
Destroy something.
player | DBref of player |
cause | DBref of cause |
key | Key |
what | What to destroy |
You can destroy anything you control.
If you own a location, you can destroy its exits.
You can destroy DESTROY_OK things in your inventory.
Return an error if we didn't find anything to destroy.
Check SAFE and DESTROY_OK flags
Make sure we're not trying to destroy a special object
Make sure we can do it, on a type-specific basis
We can use @destroy/instant to immediately blow up an object that was already queued for destruction – that object is unmodified except for being Going.
If we specified the instant switch, or we're configured to immediately make Destroy_Ok things (or things owned by Destroy_Ok owners) go away, we do instant destruction.
Otherwise we queue things up for destruction.
void do_dig | ( | dbref | player, |
dbref | cause, | ||
int | key, | ||
char * | name, | ||
char * | args[], | ||
int | nargs | ||
) |
Create a new room.
player | DBref of player |
cause | DBref of cause |
key | Key |
name | Name of the room |
args | Arguments |
nargs | Number of arguments |
we don't need to know player's location! hooray!
void do_link | ( | dbref | player, |
dbref | cause, | ||
int | key, | ||
char * | what, | ||
char * | where | ||
) |
Set destination(exits), dropto(rooms) or home(player,thing)
player | DBref of player |
cause | DBref of cause |
key | Key |
what | What get an exit? |
where | Where does it lead? |
Find the thing to link
Allow unlink if where is not specified
Set destination
Set home
Set dropto
void do_open | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int | key, | ||
char * | direction, | ||
char * | links[], | ||
int | nlinks | ||
) |
Open a new exit and optionally link it somewhere.
player | DBref of player |
cause | DBref of cause |
key | Key |
direction | Direction |
links | Links |
nlinks | Number of links |
Create the exit and link to the destination, if there is one
Open the back link if we can
void do_parent | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int key | __attribute__(unused), | ||
char * | tname, | ||
char * | pname | ||
) |
Set an object's parent field.
player | DBref of player |
cause | DBref of cause |
key | Key |
tname | Thing name |
pname | Parent name |
get victim
Make sure we can do it
Find out what the new parent is
Make sure we have rights to set parent
Verify no recursive reference
void do_pcreate | ( | dbref | player, |
dbref cause | __attribute__(unused), | ||
int | key, | ||
char * | name, | ||
char * | pass | ||
) |
Create new players and robots.
player | DBref of player |
cause | DBref of cause |
key | Key |
name | Name |
pass | Password |
void link_exit | ( | dbref | player, |
dbref | exit, | ||
dbref | dest | ||
) |
Set destination(exits), dropto(rooms) or home(player,thing)
player | DBref of playyer |
exit | DBref of exit |
dest | DBref of destination |
Make sure we can link there: Our destination is HOME Our destination is AMBIGUOUS and we can link to variable exits Normal destination check: - We must control the destination or it must be LINK_OK or we must have LinkToAny and the destination's not God. - We must be able to pass the linklock, or we must be able to LinkToAny (power, or be a wizard) and be config'd so wizards ignore linklocks
Exit must be unlinked or controlled by you
handle costs
Pay the owner for his loss
link has been validated and paid for, do it and tell the player
void open_exit | ( | dbref | player, |
dbref | loc, | ||
char * | direction, | ||
char * | linkto | ||
) |
Open a new exit and optionally link it somewhere.
player | DBref of player |
loc | DBref of location |
direction | Direction |
linkto | Where to link to |
Initialize everything and link it in.
and we're done
See if we should do a link
Make sure the player passes the link lock
Link it if the player can pay for it
dbref parse_linkable_room | ( | dbref | player, |
char * | room_name | ||
) |
Get a location to link to.
player | DBref of player |
room_name | Room Name |
HOME is always linkable
Make sure we can link to it