ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/pod/objects.pod
Revision: 1.7
Committed: Tue Dec 19 21:06:08 2006 UTC (17 years, 5 months ago) by elmex
Branch: MAIN
Changes since 1.6: +55 -2 lines
Log Message:
added description for FOOD, FLESH and DRINK.

File Contents

# User Rev Content
1 elmex 1.1 =head1 CROSSFIRE+ OBJECT AND INTERNALS DOCUMENTATION
2    
3     Here is all information about the object types Crossfire+
4     supports at the moment. This is not a complete documentation (yet)
5     and browsing the source is still recommended to learn about
6     the objects that aren't documented here.
7    
8     This documentation is in a sketchy state. It's mostly
9     used to collect notes about the internal behaviour of the
10     objects.
11    
12     =head2 About archetypes and objects
13    
14     Field denotes an attribute of an archetype.
15     This is an example of an archetype:
16    
17     Object button_trigger
18     name button
19     type 30
20     face button_sma.111
21     anim
22     button_sma.111
23     button_sma.112
24     mina
25     is_animated 0
26     exp 30
27     no_pick 1
28     walk_on 1
29     walk_off 1
30     editable 48
31     visibility 50
32     weight 1
33     end
34    
35     This archetype has the name 'button_trigger' and the objects that
36     inherit from this archetype have the name 'button'.
37    
38     The next field 'type' decides the main behaviour of this archetype.
39     For a comprehensive list of types see include/define.h. For this case
40     you might find a line like:
41    
42     #define TRIGGER_BUTTON        30
43    
44     The server internally works with objects that 'inherit' attributes from
45     an archetype. They have a similar set of attributes.
46    
47     The following documentation will also document the meaning of code internal
48     attributes of objects. These attributes are marked as '(internal)' and can't
49     or shouldn't be set by an archetype. If the internal names differs the
50     external name (for the archetypes) for the attribute is written behind it.
51    
52     =head2 Description of generic archetype and object attributes
53    
54 elmex 1.2 These are the fields that most of the objects have and/or their
55     default behaviour.
56    
57     =over 4
58    
59     =item name <string>
60    
61     The name of the object.
62    
63     =item name_pl <string>
64    
65     The name of a collection of these objects (the plural of the name).
66    
67     =item face <facename>
68    
69     The graphical appearance of this object.
70    
71     =item invisible <number>
72    
73     If the <number> is greater than 0 the object is invisible.
74     For players this field reflects the duration of the invisibility
75     and is decreased every tick by 1.
76    
77     For non-player objects this field is not changed by server ticks.
78    
79 elmex 1.4 =item speed <number>
80 elmex 1.2
81     If this field is greater than MIN_ACTIVE_SPEED (~0.0001) the object is placed
82     on the active object list and will be processed each tick (see also speed_left!).
83    
84     If the speed field drops below the MIN_ACTIVE_SPEED the object is removed
85     from the active object list and it won't experience any processing per tick.
86    
87     =item speed_left <number>
88    
89     If this field is greater than 0 and the object is on the
90     active list (mostly means it's speed is also greater than 0):
91    
92     - speed_left is decreased by 1
93     - and this object is processed and experiences a server tick.
94    
95     If the object is on the active list and speed_left is lower or
96     equal to 0 the absolute value of the speed field is added to speed_left
97     on the end of the tick.
98    
99 elmex 1.7 This means: the lower the speed field is (but still above MIN_ACTIVE_SPEED)
100     the more seldom the object is processed. And the higher the speed field is
101     the more often the object is processed.
102    
103 elmex 1.2 =item no_drop (0|1)
104    
105 elmex 1.4 Sets the flag FLAG_NO_DROP.
106     See Flags section below.
107 elmex 1.2
108     =item applied (0|1)
109    
110 elmex 1.4 Sets the flag FLAG_APPLIED.
111     See Flags section below.
112 elmex 1.2
113     =item is_used_up (0|1)
114    
115 elmex 1.4 Sets the flag FLAG_IS_USED_UP.
116     See Flags section below.
117    
118     =item auto_apply (0|1)
119    
120     Sets the flag FLAG_AUTO_APPLY.
121     See Flags section below.
122 elmex 1.2
123 elmex 1.5 =item activate_on_push (0|1) (default: 1)
124    
125     Sets the flag FLAG_ACTIVATE_ON_PUSH.
126     See Flags section below.
127    
128     =item activate_on_release (0|1) (default: 1)
129    
130     Sets the flag FLAG_ACTIVATE_ON_RELEASE.
131     See Flags section below.
132    
133 elmex 1.2 =item editable (more than deprecated)
134    
135     This field had a special meaning for crossedit, which used parts
136     of the server code for editing. Wherever you see this attribute being
137     set in an archetype ignore it and/or remove it. No code interprets this
138     field anymore.
139    
140     =back
141    
142     =head3 Flags
143    
144     Here are the effects of the flags described.
145    
146 elmex 1.1 =over 4
147    
148 elmex 1.2 =item FLAG_NO_DROP
149    
150     An object can't be picked up and dropped.
151    
152     =item FLAG_APPLIED
153    
154     This flag mostly states whether this object has been 'applied' by the player.
155     For objects that are applied by the code or have this flag set in the archetype
156     it mostly means 'this object is active'.
157    
158     For example the player adjustments of the hp/sp/grace fields and inheritance
159     of flags from objects in his inventory is toggled by this flag.
160    
161     =item FLAG_IS_USED_UP
162    
163     This flag controls whether an object is 'used up'. If it is set the 'food' field
164     of the object is decreased by 1 each tick, and if it is lower or equal 0 after tha
165     it is removed.
166    
167     If also the flag FLAG_APPLIED is set, the 'duration' field controls whether
168     this object is removed or not, see the Force type below for the meaning
169     of the duration field in this context.
170    
171 elmex 1.3 If FLAG_APPLIED is not set the object is destroyed.
172    
173 elmex 1.4 =item FLAG_IS_A_TEMPLATE (internal use)
174    
175     This flag is set on the inventory of generators like CREATORs and CONVERTERs,
176     or other objects that have the flags FLAG_GENERATOR and FLAG_CONTENT_ON_GEN set.
177    
178     =item FLAG_AUTO_APPLY
179    
180     This flag has currently only meaning for the TREASURE type, see below.
181    
182 elmex 1.5 =item FLAG_ACTIVATE_ON_PUSH
183    
184     This flag has only meaning for objects that can be linked together
185     with the 'connected' field and controls wether the object should
186     be activated when the connection is 'pushed' or it is 'released'.
187    
188     This flag is by default on.
189    
190     =item FLAG_ACTIVATE_ON_RELEASE
191    
192     This flag has only meaning for objects that can be linked together
193     with the 'connected' field and controls wether the object should
194     be activated when the connection is 'pushed' or it is 'released'.
195    
196     This flag is by default on.
197    
198 elmex 1.1 =back
199    
200     =head2 Description of type specific attributes
201    
202     The beginning of the headers of the following subsection
203     are the server internal names for the objects types, see include/define.h.
204    
205 elmex 1.4 =head3 TRANSPORT - type 2 - Player transports
206    
207     This type is implemented by the transport extension and has currently no special
208     attributes that affect it.
209    
210     =head3 ROD - type 3 - Rods that fire spells
211    
212     Rods contain spells and can be fired by a player.
213    
214     =over 4
215    
216     =item level <number>
217    
218     This attribute is used for calculating the spell level that can be fired
219     with this rod, it's also the maximum level of the spell that can be fired.
220     The level of the spell that is being fired depends mostly on
221     the 'use magic item' skill level of the player and 1/10 of the level of the
222     rod is added as bonus.
223    
224     =item hp <number>
225    
226     The amount of spellpoints this rod has left.
227    
228     =item maxhp <number>
229    
230     The maximum amount of spellpoints this rod has.
231    
232     =item skill <skill name>
233    
234     This field determines which skill you need to apply this object.
235    
236     =back
237    
238     =head3 TREASURE - type 4 - Treasures
239    
240     This type of objects are for random treasure generation in maps.
241     If this object is applied by a player it will replace itself with it's
242     inventory. If it is automatically applied
243     generate a treasure and replace itself with the generated treasure.
244    
245     Chests are also of this type, their treasures are generated by
246     the auto apply code on map instantiation.
247    
248     =over 4
249    
250     =item hp <number>
251    
252     The number of treasures to generate.
253    
254     =item exp <level>
255    
256     If FLAG_AUTO_APPLY is not set the exp field has no further meaning
257     and the difficulty for the treasurecode only depends on the maps difficulty,
258     otherwise the exp field has the following meaning:
259    
260     If this field is not 0 it is passed as the difficulty
261     to the treasure generation code to determine how good, how much
262     worth a treasure is or what bonuses it is given by the treasure code.
263    
264     If this field is not set or 0 the difficulty of the map is passed to the treasure
265     generation code.
266    
267     =item randomitems <treasurelist>
268    
269     The treasurelist to use to generate the treasure which is put in the
270     treasure objects inventory.
271    
272     =back
273    
274     =head3 POTION - type 5 - Potions for drinking and other nastynesses
275    
276     These objects contain a spell and will emit it on apply, which most
277     of the time has the meaning of 'drinking'.
278    
279     If no resistancy field, stat field or attacktype is set and no spell
280     is put in the potion by the sp field or the randomitems the
281     potion will become an artifact and the artifact code decides which kind
282     of potion will be generated.
283    
284     If the potion has FLAG_CURSED or FLAG_DAMNED set the usage of this potion
285     will yield an explosion and hurt the player.
286    
287     =over 4
288    
289     =item Str, Dex, Con, Int, Wis, Cha, Pow <number>
290    
291     These stat fields determine how many stat points the player gets
292     when he applies this potion.
293    
294     If FLAG_CURSED or FLAG_DAMNED is set the player will loose that many stat points.
295    
296     =item sp <number>
297    
298     If this field is set and the randomitems field is not set
299     the field is interpreted as spell number, please look the right
300     number up in common/loader.C.
301    
302     If this field is set the randomitems field will be unset by the
303     map loading code.
304    
305     =item attacktype <attacktype>
306    
307     This field has some special meaning in potions, currently the
308     bits for AT_DEPLETE and AT_GODPOWER control whethere this is a
309     restoration potion or improvement potion.
310     See include/attackinc.h for the bits of these types.
311    
312     If AT_DEPLETE is set the player will be restored and the ARCH_DEPLETION
313     will be removed from him. If the potion has FLAG_CURSED or FLAG_DAMNED
314     set the player will be drained a random stat by inserting an ARCH_DEPLETION
315     into him.
316    
317     If AT_GODPOWER is enabled the player will gain +1 maxvalue in his hp, sp or grace stat.
318     When the potion has FLAG_CURSED or FLAG_DAMNED set he will loose one in one of these stats.
319    
320     =item resist_<resistancy> <number>
321    
322     If this stat is set and no spell is in the potion the potion
323     will create a force that give the player this specific resistancy.
324     The forces type will be changed to POTION_EFFECT (see POTION_EFFECT type below)
325     and the potion will last 10 times longer than the default force archetype
326     FORCE_NAME (at the moment of this writing spell/force.arc).
327    
328     =item randomitems <treasurelist>
329    
330     The inventory/spell of the potion will be created by calling the treasure code
331     with the treasurelist specified here. (I guess it's highly undefined what
332     happens if there is not a spell in the potions inventory).
333    
334     =item on_use_yield <archetype>
335 elmex 1.3
336 elmex 1.7 When this object is applied an instance of <archetype> will be created.
337 elmex 1.3
338 elmex 1.4 =item subtypes <potion subtype>
339 elmex 1.3
340 elmex 1.4 see include/spells.h for possible potion subtypes, there are currently 4:
341 elmex 1.3
342     =over 4
343    
344 elmex 1.4 =item POT_SPELL
345    
346     Unused, default behaiour of a potion.
347    
348     =item POT_DUST
349    
350     This potion can be thrown to cast the spell that it has in it's inventory,
351     the behaviour is not defined if there is not a spell in the inventory and the
352     server will log an error.
353    
354     =item POT_FIGURINE
355    
356     Unused, default behaiour of a potion.
357 elmex 1.3
358 elmex 1.4 =item POT_BALM
359 elmex 1.3
360 elmex 1.4 Unused, default behaiour of a potion.
361 elmex 1.3
362 elmex 1.4 =back
363 elmex 1.3
364     =back
365    
366 elmex 1.7 =head3 FOOD - type 6 - Eatable stuff
367    
368     This is for objects that are representing general eatables like
369     beef or bread.
370    
371     The main difference between FOOD, FLESH and DRINK is that they
372     give different messages.
373    
374     The specialty of FLESH is that it inherits the resistancies of the
375     monsters it was generated in and will let dragons raise their resistancies
376     with that.
377    
378     If a player runs low on food he will grab for FOOD, DRINK and POISON
379     and if he doesn't find any of that he will start eating FLESH.
380    
381     =over 4
382    
383     =item title <string>
384    
385     If the food has a title or is cursed it is considered 'special', which means that the
386     fields Str, Dex, Con, Int, Wis, Pow, resist_<resistancy>, hp and sp
387     are interpreted and have further effects on the player.
388    
389     The higher the food field is the longer the improvement of the player lasts
390     (except for hp and sp).
391    
392     =item food <number>
393    
394     This is the amount of food points the player gets when he eats this.
395    
396     =item on_use_yield <archetype>
397    
398     When this object is applied an instance of <archetype> will be created.
399    
400     =back
401    
402 elmex 1.1 =head3 WEAPON - type 15 - Weapons
403    
404     This type is for general hack and slash weapons like swords, maces
405     and daggers and and ....
406    
407     =over 4
408    
409     =item weapontype <type id>
410    
411     decides what attackmessages are generated, see include/define.h
412    
413     =item attacktype <bitmask>
414    
415     bitfield which decides the attacktype of the damage, see include/attackinc.h
416    
417 elmex 1.2 =item dam <number>
418 elmex 1.1
419     amount of damage being done with the attacktype
420    
421     =item item_power <level>
422    
423     the itempower of this weapon.
424    
425     =item name
426    
427     the name of the weapon.
428    
429     =item level (internal)
430    
431     The improvement state of the weapon.
432     If this field is greater than 0 the 'name' field starts with the
433     characters name who improved this weapon.
434    
435     =item last_eat (internal)
436    
437     seems to be the amount of improvements of a weapon,
438     the formular for equipping a weapon seems to be (server/apply.C:check_weapon_power):
439    
440     ((who->level / 5) + 5) >= op->last_eat
441    
442     =item last_sp
443    
444     the weapon speed (see magic description)
445    
446 elmex 1.2 =item food <number>
447 elmex 1.1
448     addition to food regeneration of the player
449    
450 elmex 1.2 =item hp <number>
451 elmex 1.1
452     addition to health regeneration
453    
454 elmex 1.2 =item sp <number>
455 elmex 1.1
456     addition to mana regeneration
457    
458 elmex 1.2 =item grace <number>
459 elmex 1.1
460     addititon to grace regeneration
461    
462 elmex 1.2 =item gen_sp_armour <number>
463 elmex 1.1
464 elmex 1.2 the players gen_sp_armour field (which is per default 10) is added the <number> amount.
465 elmex 1.1 gen_sp_armour seems to be a factor with which gen_sp in do_some_living()
466 elmex 1.2 is multiplied: gen_sp *= 10/<number>
467 elmex 1.1 meaning: values > 10 of gen_sp_armour limits the amout of regenerated
468     spellpoints.
469    
470     generally this field on weapons is in ranges of 1-30 and decides the slowdown of the
471     sp regeneration.
472    
473     =item body_<body slot/part>
474    
475     the part of the body you need to use this weapon, possible values should be
476     looked up in common/item.C at body_locations.
477    
478 elmex 1.2 =item resist_<resistnacy> <number>
479 elmex 1.1
480     this is the factor with which the difference of the players resistancy and 100%
481     is multiplied, something like this:
482    
483 elmex 1.2 additional_resistancy = (100 - current_resistanct) * (<number>/100)
484 elmex 1.1
485 elmex 1.2 if <number> is negative it is added to the total vulnerabilities,
486 elmex 1.1 and later the total resistance is decided by:
487    
488     'total resistance = total protections - total vulnerabilities'
489    
490     see also common/living.C:fix_player
491    
492     =item patch_(attuned|repelled|denied)
493    
494     this field modifies the pathes the player is attuned to, see include/spells.h PATH_*
495     for the pathes.
496    
497 elmex 1.2 =item luck <number>
498 elmex 1.1
499     this luck is added to the players luck
500    
501     =item move_type
502    
503     if the weapon has a move_type set the player inherits it's move_type
504    
505 elmex 1.2 =item exp <number>
506 elmex 1.1
507 elmex 1.2 the added_speed and bonus_speed of the player is raised by <number>/3.
508     if <number> < 0 then the added_speed is decreased by <number>
509 elmex 1.1
510     =item weight
511    
512     the weight of the weapon
513    
514     =item magic
515    
516     the magic field affects the amounts of the following fields:
517    
518     - wc : the players wc is adjusted by: player->wc -= (wc + magic)
519    
520     - ac : the players ac is lowered by (ac + magic) if (player->ac + magic) > 0
521    
522     - dam: the players dam is adjusted by: player->dam += (dam + magic)
523    
524     - weapon speed (last_sp): weapon_speed is calculated by: (last_sp * 2 - magic) / 2
525     (minium is 0)
526    
527 elmex 1.2 =item ac <number>
528 elmex 1.1
529     the amount of ac points the player's ac is decreased
530    
531 elmex 1.2 =item wc <number>
532 elmex 1.1
533 elmex 1.4 the amount of wc points the player's wc is decreased
534 elmex 1.1
535     =back
536    
537     =head4 Player inherits following flags from weapons:
538    
539 elmex 1.4 FLAG_LIFESAVE
540     FLAG_REFL_SPELL
541     FLAG_REFL_MISSILE
542     FLAG_STEALTH
543     FLAG_XRAYS
544     FLAG_BLIND
545     FLAG_SEE_IN_DARK
546     FLAG_UNDEAD
547    
548 elmex 1.7 =head3 DRINK - type 54 - Drinkable stuff
549    
550     See FOOD description.
551    
552 elmex 1.6 =head3 CHECK_INV - type 64 - Inventory checkers
553    
554     This object checks whether the player has a specific item in his
555     inventory when he moves above the inventory checker. If the player has
556     the item (or not, which can be controlled with a flag) a connection will be triggered.
557    
558     If you set move_block you can deny players and monsters to reach the space where
559     the inventory checker is on, see 'move_block' description below.
560    
561     The conditions specified by hp, slaying and race are concationated with OR.
562     So matching one of those conditions is enough.
563    
564     =over 4
565    
566     =item move_block <move type bitmask>
567    
568     If you set this field to block a movetype the move code will block any moves
569     onto the space with the inventory checker, IF the moving object doesn't have
570     (or has - if last_sp = 0) the item that the checker is searching for.
571    
572     =item last_sp (0|1)
573    
574     If last_sp is 1 'having' the item that is being checked for will
575     activate the connection or make the space with the checker non-blocking.
576     If last_sp is 0 'not having' the item will activate the connection
577     or make the space with the checker non-blocking.
578    
579     =item last_heal (0|1)
580    
581     If last_heal is 1 the matching item will be removed if the inventory checker
582     activates a connection and finds the item in the inventory.
583    
584     (A inventory checker that blocks a space won't remove anything from inventories)
585    
586     =item hp <number>
587    
588     If this field is not 0 the inventory checker will search for an object
589     with the type id <number>.
590    
591     =item slaying <string>
592    
593     If this field is set the inventory checker will search for an object that
594     has the same string in the slaying field (for example a key string of a key).
595    
596     =item race <string>
597    
598     If this field is set the inventory checker will search for an object which
599     has the archetype name that matches <string>.
600    
601     =item connected <connection id>
602    
603     This is the connection that will be activated.
604    
605     =back
606    
607 elmex 1.7 =head3 FLESH - type 72 - Organs and body parts
608    
609     See FOOD description.
610    
611 elmex 1.5 =head3 HOLE - type 94 - Holes
612    
613     Holes are holes in the ground where objects can fall through. When the hole
614     opens and/or is completly open all objects above it fall through (more
615     precisely: if their head is above the hole).
616    
617     Trapdoors can only transfer the one who falls through to other coordinates
618     on the B<same> map.
619    
620     =over 4
621    
622     =item maxsp (0|1)
623    
624     This field negates the state of the connection: When maxsp is 1 the pit will
625     open/close when the connection is deactivated. Otherwise it will open/close
626     when the connection is activated. This field only has effect when the
627     connection is triggered. So if you put a closed hole on a map, and the
628     connection is deactivated, and maxsp is 1 the hole will remain closed until the
629     connection was triggered once.
630    
631     =item connected <connection id>
632    
633     This is the connection id, which lets the hole opening or closing when
634     activated. The flags FLAG_ACTIVATE_ON_PUSH and FLAG_ACTIVATE_ON_RELEASE control
635     at which connection state the object is activated.
636    
637     For example: if FLAG_ACTIVATE_ON_RELEASE is set to 0 the hole won't react when
638     the connection is released.
639    
640     =item wc <number> (internal)
641    
642     This is an internal flag. If it is greater than 0 it means that the hole is not
643     yet fully open. More preciesly: this field is the animation-step and if it is
644     set to the 'closed' step of the animation the hole is closed and if it is on
645     the 'open' animation step (wc = 0), the hole is open.
646    
647     =item sp <number>
648    
649     The destination y coordinates on the same map.
650    
651     =item hp <number>
652    
653     The destination x coordinates on the same map.
654    
655     =back
656    
657 elmex 1.4 =head3 FORCE - type 114 - Forces
658    
659     Forces are a very 'thin' type. They don't have much behaviour other than
660 elmex 1.5 disappearing after a time and/or affecting the player if they are in his
661     inventory.
662 elmex 1.4
663     Forces only take effect on the player if they have set FLAG_APPLIED.
664    
665     Whether the duration field is processed or not a tick is controlled via the
666     speed and speed_left field. Look above at the generic description of these
667     fields.
668    
669 elmex 1.7 NOTE: Setting FLAG_IS_USED_UP on an force will also consider the 'food' field
670     like stated above in the FLAG_IS_USED_UP description. BUT: If the food field reaches
671     0 before duration and FLAG_APPLIED is set, the force will last for 'duration'.
672     If the FLAG_APPLIED is not set the force is removed when food reaches 0.
673     Generally this means: FLAG_IS_USED_UP doesn't have good semantics on forces.
674    
675 elmex 1.4 =over 4
676    
677     =item duration
678    
679 elmex 1.5 While this field is greater than 0 the force/object is not destroyed. It is
680     decreased each tick by 1.
681 elmex 1.4
682     If it reaches 0 the force/object is destroyed.
683    
684     This field can have this meaning for B<any> object if that object has
685     FLAG_IS_USED_UP and FLAG_APPLIED set. See the description of FLAG_IS_USED_UP
686     what happens then.
687    
688     =back
689    
690     =head3 POTION_EFFECT - type 115 - Potion effects (resistancies)
691    
692 elmex 1.5 This object is generated by the POTION code when the potion is a resistance
693     giving potion. It has mainly the same behaviour as a FORCE.
694 elmex 1.4
695     The specialty of the potion effect is that the resistancy it gives is absolute,
696 elmex 1.5 so if you drin a resistancy potion of fire+60 you will get 60% resistancy to
697     fire.
698 elmex 1.4
699     Multiple potion effects only give you the maximum of their resistancy.