TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
Functions
create.c File Reference

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>
Include dependency graph for create.c:

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...
 

Detailed Description

Commands that create new objects.

Author
TinyMUSH development team (https://github.com/TinyMUSH)
Version
3.3
Date
2020-12-28

Function Documentation

◆ can_destroy_exit()

bool can_destroy_exit ( dbref  player,
dbref  exit 
)

Destroy exit things.

Parameters
playerDBref of player
exitDBref of exit
Returns
bool

◆ can_destroy_player()

bool can_destroy_player ( dbref  player,
dbref  victim 
)

Check if the player can destroy a victim.

Parameters
playerDBref of player
victimDBref of victim
Returns
bool

◆ destroyable()

bool destroyable ( dbref  victim)

Indicates if target of a @destroy is a 'special' object in the database.

Parameters
victimDBref of the target
Returns
int

◆ do_clone()

void do_clone ( dbref  player,
dbref cause   __attribute__(unused),
int  key,
char *  name,
char *  arg2 
)

Create a copy of an object.

Parameters
playerDBref of player
causeDBref of cause
keyKey
nameName of the object
arg2Arguments

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

◆ do_create()

void do_create ( dbref  player,
dbref cause   __attribute__(unused),
int key   __attribute__(unused),
char *  name,
char *  coststr 
)

Make a new object.

Parameters
playerDBref of player
causeDBref of cause
keyKey
nameName of object
coststrCost of object

◆ do_destroy()

void do_destroy ( dbref  player,
dbref cause   __attribute__(unused),
int  key,
char *  what 
)

Destroy something.

Parameters
playerDBref of player
causeDBref of cause
keyKey
whatWhat 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.

◆ do_dig()

void do_dig ( dbref  player,
dbref  cause,
int  key,
char *  name,
char *  args[],
int  nargs 
)

Create a new room.

Parameters
playerDBref of player
causeDBref of cause
keyKey
nameName of the room
argsArguments
nargsNumber of arguments

we don't need to know player's location! hooray!

◆ do_link()

void do_link ( dbref  player,
dbref  cause,
int  key,
char *  what,
char *  where 
)

Set destination(exits), dropto(rooms) or home(player,thing)

Parameters
playerDBref of player
causeDBref of cause
keyKey
whatWhat get an exit?
whereWhere does it lead?

Find the thing to link

Allow unlink if where is not specified

Set destination

Set home

Set dropto

◆ do_open()

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.

Parameters
playerDBref of player
causeDBref of cause
keyKey
directionDirection
linksLinks
nlinksNumber of links

Create the exit and link to the destination, if there is one

Open the back link if we can

◆ do_parent()

void do_parent ( dbref  player,
dbref cause   __attribute__(unused),
int key   __attribute__(unused),
char *  tname,
char *  pname 
)

Set an object's parent field.

Parameters
playerDBref of player
causeDBref of cause
keyKey
tnameThing name
pnameParent 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

◆ do_pcreate()

void do_pcreate ( dbref  player,
dbref cause   __attribute__(unused),
int  key,
char *  name,
char *  pass 
)

Create new players and robots.

Parameters
playerDBref of player
causeDBref of cause
keyKey
nameName
passPassword

◆ link_exit()

void link_exit ( dbref  player,
dbref  exit,
dbref  dest 
)

Set destination(exits), dropto(rooms) or home(player,thing)

Parameters
playerDBref of playyer
exitDBref of exit
destDBref 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

◆ open_exit()

void open_exit ( dbref  player,
dbref  loc,
char *  direction,
char *  linkto 
)

Open a new exit and optionally link it somewhere.

Parameters
playerDBref of player
locDBref of location
directionDirection
linktoWhere 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

◆ parse_linkable_room()

dbref parse_linkable_room ( dbref  player,
char *  room_name 
)

Get a location to link to.

Parameters
playerDBref of player
room_nameRoom Name
Returns
dbref

HOME is always linkable

Make sure we can link to it