blob: c402c0be4d65cfb8377ff2346d3ae224adc57ffc [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 object * clones()
3 object * clones(int what)
4 object * clones(string|object obj [, int what])
MG Mud User88f12472016-06-24 23:31:02 +02005
Zesstra715ec202025-07-09 22:18:31 +02006DESCRIPTION
7 The efuns returns an array with all clones of a certain blueprint.
8 The array is subject to the usual runtime limits.
MG Mud User88f12472016-06-24 23:31:02 +02009
Zesstra715ec202025-07-09 22:18:31 +020010 If <obj> is given, all clones of the blueprint of <obj> (which
11 may be <obj> itself) are returned, otherwise all clones of the
12 current object resp. of the current object's blueprint. If <obj>
13 is given as string, it must name an existing object.
MG Mud User88f12472016-06-24 23:31:02 +020014
Zesstra715ec202025-07-09 22:18:31 +020015 <what> selects how to treat clones made from earlier versions
16 of the blueprint:
17 == 0: (default) return the clones of the current blueprint only.
18 == 1: return the clones of the previous blueprints only.
19 == 2: return all clones of the blueprint.
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021 Note: this efun is computationally expensive.
MG Mud User88f12472016-06-24 23:31:02 +020022
Zesstra715ec202025-07-09 22:18:31 +020023 If the driver is compiled with DYNAMIC_COSTS, the cost of this
24 efun is proportional to the number of objects in the game.
25
26EXAMPLES
MG Mud User88f12472016-06-24 23:31:02 +020027 object o, p;
Zesstra715ec202025-07-09 22:18:31 +020028 o = clone_object("/std/thing"); /* or "std/thing" in COMPAT mode */
MG Mud User88f12472016-06-24 23:31:02 +020029 destruct(find_object("/std/thing"));
30 p = clone_object("/std/thing");
31
Zesstra715ec202025-07-09 22:18:31 +020032 clones("/std/thing") --> returns ({ p })
33 clones("/std/thing", 0) --> returns ({ p })
34 clones("/std/thing", 1) --> returns ({ o })
35 clones("/std/thing", 2) --> returns ({ o, p })
MG Mud User88f12472016-06-24 23:31:02 +020036
Zesstra715ec202025-07-09 22:18:31 +020037HISTORY
38 Introduced in LDMud 3.2.8.
39 LDMud 3.2.9 added the dynamic cost.
40
41SEE ALSO
42 blueprint(E), clone_object(E), clonep(E)