He touched the fish, saying in a terrible voice, `Fish, fish, are you doing your duty?' To these words the fish lifting up their heads replied, `Yes, yes. If you reckon, we reckon. If you pay your debts, we pay ours. If you fly, we conquer, and are content.'
Most of the time, the data objects you create will be pre-defined, or at least derived from one of the pre-defined types. However, it is possible to make your own datum from scratch. Such an object may be useful for your own specialized purpose when you don't need all the extra baggage associated with the built-in types.
To define a new data type, simply derive it from the root, rather than from
an existing object type. The following code demonstrates the syntax by
defining a
As you can see, object variables and procs are defined just as with any
other data object. Inheritance works the same too, so you can derive new
types from ones you have already defined.
Generic data objects are intended to have as small of a pre-defined
"footprint" as possible. As a result, there are very few built-in
variables. These are described in the following list.
There are only a few pre-defined procedures for data objects. These all
have the same meaning as for the atomic objects which have already been
introduced. Figure 18.27 lists the procedures and the page
where you may find a full description.
1. Defining a Datum
Quest
datum.
Quest
var
mob/sponsor
quest_obj_type
reward_obj_type
desc
proc
Check()
var/mob/M
var/obj/O
for(M in view(sponsor,1))
O = locate(quest_obj_type) in M
if(O)
Reward(M,O)
return 1
Reward(mob/M,obj/O)
var/obj/R = new reward_obj_type(M)
O.Move(sponsor)
M << "You have completed the quest!"
M << "[sponsor] takes [O] and rewards you with \an [R]."
2. Object Variables
3. Object Procedures
Figure 18.27: Abstract Object Procedures
Procedure See Page
New [7.2]
Del [7.2]
Topic [7.6]
Read [12.4]
Write [12.4]